Skip to content

Commit 687427e

Browse files
authored
Merge pull request #252 from cloudflare/feat/refactor-agents-base
Feat: General agents + presentations
2 parents e73a089 + e414208 commit 687427e

File tree

192 files changed

+15366
-7458
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

192 files changed

+15366
-7458
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,7 @@ debug-tools/*.json
5151
.env.sentry-build-plugin
5252
data-dump
5353
debug-tools/extracted
54+
debug-tools/presentation-tester
55+
56+
.test-data
5457
cli
55-
debug-tools

bun.lock

Lines changed: 501 additions & 562 deletions
Large diffs are not rendered by default.

commitlint.config.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export default {
2222
'type-empty': [2, 'never'],
2323
'subject-empty': [2, 'never'],
2424
'subject-full-stop': [2, 'never', '.'],
25-
'header-max-length': [2, 'always', 100],
25+
'header-max-length': [2, 'always', 150],
2626
'body-leading-blank': [1, 'always'],
27-
'body-max-line-length': [2, 'always', 100],
27+
'body-max-line-length': [2, 'always', 200],
2828
'footer-leading-blank': [1, 'always'],
29-
'footer-max-line-length': [2, 'always', 100],
29+
'footer-max-line-length': [2, 'always', 200],
3030
},
3131
};
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"name": "presentation-tester",
3+
"private": true,
4+
"version": "1.0.0",
5+
"type": "module",
6+
"scripts": {
7+
"dev": "vite",
8+
"build": "tsc && vite build",
9+
"preview": "vite preview"
10+
},
11+
"dependencies": {
12+
"react": "^18.3.1",
13+
"react-dom": "^18.3.1",
14+
"fflate": "^0.8.2",
15+
"reveal.js": "^5.1.0",
16+
"sucrase": "^3.35.0",
17+
"framer-motion": "^11.11.17",
18+
"lucide-react": "^0.344.0",
19+
"clsx": "^2.1.1",
20+
"tailwind-merge": "^2.5.4"
21+
},
22+
"devDependencies": {
23+
"@types/react": "^18.3.12",
24+
"@types/react-dom": "^18.3.1",
25+
"@vitejs/plugin-react": "^4.3.3",
26+
"typescript": "^5.6.3",
27+
"vite": "^5.4.11",
28+
"tailwindcss": "^3.4.15",
29+
"postcss": "^8.4.49",
30+
"autoprefixer": "^10.4.20"
31+
}
32+
}

eslint.config.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,18 @@ import tseslint from 'typescript-eslint'
66
import importPlugin from 'eslint-plugin-import'
77

88
export default tseslint.config(
9-
{ ignores: ['dist', 'wrangler-configuration.d.ts', 'test-diff-formatters/**', '**/*.test.ts', '**/*.test.tsx', '**/*.spec.ts', '**/*.spec.tsx'] },
9+
{
10+
ignores: [
11+
'dist',
12+
'wrangler-configuration.d.ts',
13+
'test-diff-formatters/**',
14+
'cf-git/**',
15+
'**/*.test.ts',
16+
'**/*.test.tsx',
17+
'**/*.spec.ts',
18+
'**/*.spec.tsx',
19+
],
20+
},
1021
{
1122
extends: [
1223
js.configs.recommended,
@@ -46,4 +57,18 @@ export default tseslint.config(
4657
'react-refresh/only-export-components': 'off',
4758
},
4859
},
60+
// Contexts and feature modules intentionally export hooks/objects
61+
{
62+
files: ['src/contexts/**/*.{ts,tsx}', 'src/features/**/*.{ts,tsx}'],
63+
rules: {
64+
'react-refresh/only-export-components': 'off',
65+
},
66+
},
67+
// Auth modal provider exports a hook + provider
68+
{
69+
files: ['src/components/auth/**/*.{ts,tsx}'],
70+
rules: {
71+
'react-refresh/only-export-components': 'off',
72+
},
73+
},
4974
)

index.html

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
<meta charset="UTF-8" />
55
<link rel="icon" href="/favicon.ico" />
66
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<meta http-equiv="Content-Security-Policy" content="default-src 'self'; script-src 'self' 'unsafe-inline' blob: https://cdnjs.cloudflare.com https://cdn.tailwindcss.com https://esm.sh; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com https://cdnjs.cloudflare.com; font-src 'self' https://fonts.gstatic.com; img-src 'self' data: https:; connect-src 'self' wss: ws: http: https:; frame-src 'self' http://*.localhost:* https://*;" />
78
<link rel="preconnect" href="https://fonts.googleapis.com">
89
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
910
<link href="https://fonts.googleapis.com/css2?family=Gloria+Hallelujah&family=Caveat:wght@600&display=swap" rel="stylesheet">

package.json

Lines changed: 29 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"lint": "eslint .",
1313
"preview": "npm run build && vite preview",
1414
"deploy": "bun --env-file .prod.vars scripts/deploy.ts",
15+
"cli": "tsx --tsconfig tsconfig.app.json cli/index.ts",
16+
"tui": "tsx --tsconfig tsconfig.app.json cli/tui.tsx",
1517
"cf-typegen": "wrangler types --include-runtime false",
1618
"test": "vitest run",
1719
"test:watch": "vitest",
@@ -73,17 +75,19 @@
7375
"@radix-ui/react-toggle-group": "^1.1.11",
7476
"@radix-ui/react-tooltip": "^1.2.8",
7577
"@rolldown/binding-linux-x64-gnu": "^1.0.0-beta.9-commit.d91dfb5",
76-
"@sentry/cloudflare": "^10.29.0",
77-
"@sentry/react": "^10.29.0",
78+
"@sentry/cloudflare": "^10.30.0",
79+
"@sentry/react": "^10.30.0",
7880
"@simplewebauthn/browser": "^13.2.2",
7981
"@types/argon2-browser": "^1.18.4",
8082
"@types/mdast": "^4.0.4",
8183
"@vitejs/plugin-react": "^5.1.2",
82-
"agents": "^0.2.31",
84+
"agents": "^0.2.32",
8385
"class-variance-authority": "^0.7.1",
86+
"cli-table3": "^0.6.5",
8487
"cloudflare": "^4.5.0",
8588
"clsx": "^2.1.1",
8689
"cmdk": "^1.1.1",
90+
"cross-spawn": "^7.0.6",
8791
"date-fns": "^4.1.0",
8892
"diff": "^8.0.2",
8993
"drizzle-orm": "^0.44.7",
@@ -92,11 +96,12 @@
9296
"eslint-import-resolver-typescript": "^4.4.4",
9397
"eslint-plugin-import": "^2.32.0",
9498
"fflate": "^0.8.2",
95-
"framer-motion": "^12.23.25",
99+
"framer-motion": "^12.23.26",
96100
"hash-wasm": "^4.12.0",
97-
"hono": "^4.10.7",
101+
"hono": "^4.11.0",
98102
"html2canvas-pro": "^1.5.13",
99103
"input-otp": "^1.4.2",
104+
"inquirer": "^12.11.1",
100105
"jose": "^5.10.0",
101106
"jsonc-parser": "^3.3.1",
102107
"lucide-react": "^0.541.0",
@@ -105,10 +110,11 @@
105110
"nanoid": "^5.1.6",
106111
"next-themes": "^0.4.6",
107112
"openai": "^5.23.2",
113+
"ora": "^9.0.0",
108114
"partysocket": "^1.1.6",
109-
"react": "^19.2.1",
115+
"react": "^19.2.3",
110116
"react-day-picker": "^9.12.0",
111-
"react-dom": "^19.2.1",
117+
"react-dom": "^19.2.3",
112118
"react-feather": "^2.0.10",
113119
"react-hook-form": "^7.68.0",
114120
"react-markdown": "^10.1.0",
@@ -118,42 +124,49 @@
118124
"rehype-external-links": "^3.0.0",
119125
"remark-gfm": "^4.0.1",
120126
"remark-parse": "^11.0.0",
121-
"rolldown-vite": "^7.2.10",
127+
"rolldown-vite": "^7.2.11",
122128
"sonner": "^2.0.7",
123129
"tailwind-merge": "^3.4.0",
124130
"unified": "^11.0.5",
125131
"vaul": "^1.1.2",
126132
"vite-plugin-svgr": "^4.5.0",
133+
"ws": "^8.18.3",
127134
"zod": "^3.25.76"
128135
},
129136
"devDependencies": {
130-
"@cloudflare/vite-plugin": "^1.17.0",
137+
"@cloudflare/vite-plugin": "^1.17.1",
131138
"@cloudflare/vitest-pool-workers": "^0.8.71",
132-
"@cloudflare/workers-types": "^4.20251205.0",
133-
"@eslint/js": "^9.39.1",
139+
"@cloudflare/workers-types": "^4.20251213.0",
140+
"@eslint/js": "^9.39.2",
134141
"@tailwindcss/typography": "^0.5.19",
135-
"@tailwindcss/vite": "^4.1.17",
142+
"@tailwindcss/vite": "^4.1.18",
136143
"@types/jest": "^29.5.14",
137-
"@types/node": "^22.19.2",
144+
"@types/node": "^22.19.3",
138145
"@types/react": "^19.2.7",
139146
"@types/react-dom": "^19.2.3",
140147
"@vitest/coverage-v8": "^3.2.4",
141148
"drizzle-kit": "^0.31.8",
142-
"eslint": "^9.39.1",
149+
"eslint": "^9.39.2",
143150
"eslint-plugin-react-hooks": "^5.2.0",
144151
"eslint-plugin-react-refresh": "^0.4.24",
145152
"globals": "^16.5.0",
146153
"husky": "^9.1.7",
154+
"ink": "^6.5.1",
155+
"ink-big-text": "^2.0.0",
156+
"ink-box": "^2.0.0",
157+
"ink-gradient": "^3.0.0",
158+
"ink-spinner": "^5.0.0",
159+
"ink-text-input": "^6.0.0",
147160
"jest": "^29.7.0",
148-
"knip": "^5.72.0",
161+
"knip": "^5.73.4",
149162
"prettier-plugin-tailwindcss": "^0.6.14",
150163
"tsx": "^4.21.0",
151164
"tw-animate-css": "^1.4.0",
152165
"typescript": "^5.9.3",
153166
"typescript-eslint": "^8.49.0",
154167
"vite": "npm:[email protected]",
155168
"vitest": "^3.2.4",
156-
"wrangler": "4.45.0"
169+
"wrangler": "4.50.0"
157170
},
158171
"prettier": {
159172
"singleQuote": true,

src/App.tsx

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,25 @@ import { VaultProvider } from './contexts/vault-context';
66
import { Toaster } from './components/ui/sonner';
77
import { AppLayout } from './components/layout/app-layout';
88
import { ErrorBoundary } from './components/ErrorBoundary';
9+
import { FeatureProvider } from './features';
910

1011
export default function App() {
1112
return (
1213
<ErrorBoundary>
1314
<ThemeProvider>
14-
<AuthProvider>
15-
<VaultProvider>
16-
<AuthModalProvider>
17-
<AppLayout>
18-
<Outlet />
19-
</AppLayout>
20-
<Toaster richColors position="top-right" />
21-
</AuthModalProvider>
22-
</VaultProvider>
23-
</AuthProvider>
15+
<FeatureProvider>
16+
<AuthProvider>
17+
<VaultProvider>
18+
<AuthModalProvider>
19+
<AppLayout>
20+
<Outlet />
21+
</AppLayout>
22+
<Toaster richColors position="top-right" />
23+
</AuthModalProvider>
24+
</VaultProvider>
25+
</AuthProvider>
26+
</FeatureProvider>
2427
</ThemeProvider>
2528
</ErrorBoundary>
2629
);
27-
}
30+
}

src/api-types.ts

Lines changed: 43 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,22 @@ export type {
6161

6262
export type { PlatformStatusData } from 'worker/api/controllers/status/types';
6363

64+
export type { CapabilitiesData } from 'worker/api/controllers/capabilities/types';
65+
66+
export type {
67+
ViewMode,
68+
FeatureCapabilities,
69+
FeatureDefinition,
70+
ViewDefinition,
71+
PlatformCapabilities,
72+
PlatformCapabilitiesConfig,
73+
} from 'worker/agents/core/features/types';
74+
75+
export {
76+
DEFAULT_FEATURE_DEFINITIONS,
77+
getBehaviorTypeForProject,
78+
} from 'worker/agents/core/features';
79+
6480
// Model Config API Types
6581
export type {
6682
ModelConfigsData,
@@ -112,14 +128,19 @@ export type {
112128
SecretMetadata,
113129
} from 'worker/services/secrets/vault-types';
114130

115-
// Agent/CodeGen API Types
131+
// Agent/CodeGen API Types
116132
export type {
117133
AgentConnectionData,
118134
} from 'worker/api/controllers/agent/types';
119135

136+
// Template Types
137+
export type {
138+
TemplateDetails,
139+
} from 'worker/services/sandbox/sandboxTypes';
140+
120141
// WebSocket Types
121-
export type {
122-
WebSocketMessage,
142+
export type {
143+
WebSocketMessage,
123144
WebSocketMessageData,
124145
CodeFixEdits,
125146
ModelConfigsInfoMessage,
@@ -144,17 +165,24 @@ export type {
144165
} from 'worker/database/types';
145166

146167
// Agent/Generator Types
147-
export type {
168+
export type {
148169
Blueprint as BlueprintType,
170+
PhasicBlueprint,
149171
CodeReviewOutputType,
150172
FileConceptType,
151173
FileOutputType as GeneratedFile,
152174
} from 'worker/agents/schemas';
153175

154-
export type {
155-
CodeGenState
176+
export type {
177+
AgentState,
178+
PhasicState
156179
} from 'worker/agents/core/state';
157180

181+
export type {
182+
BehaviorType,
183+
ProjectType
184+
} from 'worker/agents/core/types';
185+
158186
export type {
159187
ConversationMessage,
160188
} from 'worker/agents/inferutils/common';
@@ -176,7 +204,7 @@ export type {
176204
export type { RateLimitError } from "worker/services/rate-limit/errors";
177205
export type { AgentPreviewResponse, CodeGenArgs } from 'worker/api/controllers/agent/types';
178206
export type { RateLimitErrorResponse } from 'worker/api/responses';
179-
export { RateLimitExceededError, SecurityError, SecurityErrorType } from 'shared/types/errors';
207+
export { RateLimitExceededError, SecurityError, SecurityErrorType } from '../shared/types/errors.js';
180208

181209
export type { AIModels } from 'worker/agents/inferutils/config.types';
182210
// Model selection types
@@ -251,6 +279,14 @@ export interface CsrfTokenResponseData {
251279
expiresIn?: number;
252280
}
253281

282+
// CLI Token Response - for CLI authentication
283+
export interface CliTokenData {
284+
token: string;
285+
expiresIn: number;
286+
expiresAt: string;
287+
instructions: string;
288+
}
289+
254290
// Active Sessions Response - matches getUserSessions + isCurrent from controller
255291
export interface ActiveSessionsData {
256292
sessions: Array<{

0 commit comments

Comments
 (0)