@agent-native/core 0.79.12 → 0.79.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +25 -0
- package/corpus/core/docs/content/locales/zh-TW/a2a-protocol.md +68 -68
- package/corpus/core/docs/content/locales/zh-TW/actions.md +82 -82
- package/corpus/core/docs/content/locales/zh-TW/agent-mentions.md +22 -22
- package/corpus/core/docs/content/locales/zh-TW/agent-surfaces.md +82 -82
- package/corpus/core/docs/content/locales/zh-TW/agent-teams.md +29 -29
- package/corpus/core/docs/content/locales/zh-TW/agent-web-surfaces.md +11 -11
- package/corpus/core/docs/content/locales/zh-TW/audit-log.md +16 -16
- package/corpus/core/docs/content/locales/zh-TW/authentication.md +32 -32
- package/corpus/core/docs/content/locales/zh-TW/automations.md +32 -32
- package/corpus/core/docs/content/locales/zh-TW/blueprint-installer.md +19 -19
- package/corpus/core/docs/content/locales/zh-TW/cli-adapters.md +17 -17
- package/corpus/core/docs/content/locales/zh-TW/client.md +62 -62
- package/corpus/core/docs/content/locales/zh-TW/cloneable-saas.md +32 -32
- package/corpus/core/docs/content/locales/zh-TW/code-agents-ui.md +91 -91
- package/corpus/core/docs/content/locales/zh-TW/components.md +51 -51
- package/corpus/core/docs/content/locales/zh-TW/context-awareness.md +66 -66
- package/corpus/core/docs/content/locales/zh-TW/creating-templates.md +39 -39
- package/corpus/core/docs/content/locales/zh-TW/cross-app-sso.md +29 -29
- package/corpus/core/docs/content/locales/zh-TW/database.md +21 -21
- package/corpus/core/docs/content/locales/zh-TW/deployment.md +37 -37
- package/corpus/core/docs/content/locales/zh-TW/dispatch.md +43 -43
- package/corpus/core/docs/content/locales/zh-TW/drop-in-agent.md +34 -34
- package/corpus/core/docs/content/locales/zh-TW/durable-resume.md +18 -18
- package/corpus/core/docs/content/locales/zh-TW/embedding-sdk.md +73 -73
- package/corpus/core/docs/content/locales/zh-TW/evals.md +16 -16
- package/corpus/core/docs/content/locales/zh-TW/extensions.md +81 -81
- package/corpus/core/docs/content/locales/zh-TW/external-agents.md +146 -146
- package/corpus/core/docs/content/locales/zh-TW/faq.md +43 -43
- package/corpus/core/docs/content/locales/zh-TW/file-uploads.md +11 -11
- package/corpus/core/docs/content/locales/zh-TW/frames.md +33 -33
- package/corpus/core/docs/content/locales/zh-TW/getting-started.md +28 -28
- package/corpus/core/docs/content/locales/zh-TW/harness-agents.md +78 -78
- package/corpus/core/docs/content/locales/zh-TW/human-approval.md +27 -27
- package/corpus/core/docs/content/locales/zh-TW/internationalization.md +19 -19
- package/corpus/core/docs/content/locales/zh-TW/key-concepts.md +68 -68
- package/corpus/core/docs/content/locales/zh-TW/local-file-mode.md +50 -50
- package/corpus/core/docs/content/locales/zh-TW/mcp-apps.md +38 -38
- package/corpus/core/docs/content/locales/zh-TW/mcp-clients.md +67 -67
- package/corpus/core/docs/content/locales/zh-TW/mcp-protocol.md +50 -50
- package/corpus/core/docs/content/locales/zh-TW/messaging.md +99 -99
- package/corpus/core/docs/content/locales/zh-TW/migration-workbench.md +6 -6
- package/corpus/core/docs/content/locales/zh-TW/multi-app-workspace.md +39 -39
- package/corpus/core/docs/content/locales/zh-TW/multi-tenancy.md +7 -7
- package/corpus/core/docs/content/locales/zh-TW/native-chat-ui.md +38 -38
- package/corpus/core/docs/content/locales/zh-TW/notifications.md +23 -23
- package/corpus/core/docs/content/locales/zh-TW/observability.md +49 -49
- package/corpus/core/docs/content/locales/zh-TW/observational-memory.md +23 -23
- package/corpus/core/docs/content/locales/zh-TW/onboarding.md +40 -40
- package/corpus/core/docs/content/locales/zh-TW/plan-plugin.md +37 -37
- package/corpus/core/docs/content/locales/zh-TW/pr-visual-recap.md +72 -72
- package/corpus/core/docs/content/locales/zh-TW/processors.md +17 -17
- package/corpus/core/docs/content/locales/zh-TW/progress.md +15 -15
- package/corpus/core/docs/content/locales/zh-TW/pure-agent-apps.md +10 -10
- package/corpus/core/docs/content/locales/zh-TW/real-time-collaboration.md +103 -103
- package/corpus/core/docs/content/locales/zh-TW/recurring-jobs.md +19 -19
- package/corpus/core/docs/content/locales/zh-TW/routing.md +9 -9
- package/corpus/core/docs/content/locales/zh-TW/sandbox-adapters.md +48 -48
- package/corpus/core/docs/content/locales/zh-TW/security.md +49 -49
- package/corpus/core/docs/content/locales/zh-TW/server.md +47 -47
- package/corpus/core/docs/content/locales/zh-TW/sharing.md +22 -22
- package/corpus/core/docs/content/locales/zh-TW/skills-guide.md +46 -46
- package/corpus/core/docs/content/locales/zh-TW/template-analytics.md +40 -40
- package/corpus/core/docs/content/locales/zh-TW/template-assets.md +69 -69
- package/corpus/core/docs/content/locales/zh-TW/template-brain.md +81 -81
- package/corpus/core/docs/content/locales/zh-TW/template-calendar.md +40 -40
- package/corpus/core/docs/content/locales/zh-TW/template-chat.md +27 -27
- package/corpus/core/docs/content/locales/zh-TW/template-clips.md +85 -85
- package/corpus/core/docs/content/locales/zh-TW/template-content.md +65 -66
- package/corpus/core/docs/content/locales/zh-TW/template-design.md +29 -29
- package/corpus/core/docs/content/locales/zh-TW/template-dispatch.md +51 -51
- package/corpus/core/docs/content/locales/zh-TW/template-forms.md +25 -25
- package/corpus/core/docs/content/locales/zh-TW/template-mail.md +71 -71
- package/corpus/core/docs/content/locales/zh-TW/template-plan.md +92 -92
- package/corpus/core/docs/content/locales/zh-TW/template-slides.md +52 -52
- package/corpus/core/docs/content/locales/zh-TW/template-videos.md +30 -30
- package/corpus/core/docs/content/locales/zh-TW/tracking.md +29 -29
- package/corpus/core/docs/content/locales/zh-TW/using-your-agent.md +18 -18
- package/corpus/core/docs/content/locales/zh-TW/voice-input.md +19 -19
- package/corpus/core/docs/content/locales/zh-TW/what-is-agent-native.md +61 -61
- package/corpus/core/docs/content/locales/zh-TW/workspace-connections.md +41 -41
- package/corpus/core/docs/content/locales/zh-TW/workspace-management.md +27 -27
- package/corpus/core/docs/content/locales/zh-TW/workspace.md +58 -58
- package/corpus/core/docs/content/locales/zh-TW/writing-agent-instructions.md +41 -41
- package/corpus/core/docs/content/template-clips.md +48 -2
- package/corpus/core/package.json +2 -1
- package/corpus/core/src/client/AgentPanel.tsx +29 -6
- package/corpus/core/src/deploy/build.ts +432 -42
- package/corpus/core/src/deploy/route-discovery.ts +1 -1
- package/corpus/core/src/server/edge.ts +50 -0
- package/corpus/core/src/styles/agent-native.css +123 -0
- package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +44 -44
- package/corpus/core/src/vite/client.ts +1 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +5 -3
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +69 -70
- package/corpus/templates/analytics/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/assets/app/components/layout/Layout.tsx +3 -3
- package/corpus/templates/assets/app/i18n/zh-TW.ts +82 -82
- package/corpus/templates/assets/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/brain/app/components/layout/Layout.tsx +6 -4
- package/corpus/templates/brain/app/i18n/zh-TW.ts +90 -90
- package/corpus/templates/brain/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/calendar/app/i18n/zh-TW.ts +57 -57
- package/corpus/templates/calendar/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/calendar/server/lib/booking-og-fonts.ts +20 -6
- package/corpus/templates/calendar/server/lib/booking-og-image.ts +17 -9
- package/corpus/templates/chat/app/components/layout/Layout.tsx +5 -3
- package/corpus/templates/chat/app/i18n/zh-TW.ts +3 -3
- package/corpus/templates/chat/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/clips/AGENTS.md +6 -0
- package/corpus/templates/clips/actions/delete-recording-permanent.ts +7 -1
- package/corpus/templates/clips/actions/get-recording-player-data.ts +44 -2
- package/corpus/templates/clips/actions/navigate.ts +2 -0
- package/corpus/templates/clips/actions/save-bug-report-context.ts +173 -0
- package/corpus/templates/clips/actions/view-screen.ts +58 -7
- package/corpus/templates/clips/app/components/recorder/storage-setup-card.tsx +9 -3
- package/corpus/templates/clips/app/hooks/use-navigation-state.ts +17 -0
- package/corpus/templates/clips/app/i18n/ar-SA.ts +31 -0
- package/corpus/templates/clips/app/i18n/de-DE.ts +32 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +32 -0
- package/corpus/templates/clips/app/i18n/es-ES.ts +32 -0
- package/corpus/templates/clips/app/i18n/fr-FR.ts +32 -0
- package/corpus/templates/clips/app/i18n/hi-IN.ts +32 -0
- package/corpus/templates/clips/app/i18n/ja-JP.ts +31 -0
- package/corpus/templates/clips/app/i18n/ko-KR.ts +32 -0
- package/corpus/templates/clips/app/i18n/pt-BR.ts +32 -0
- package/corpus/templates/clips/app/i18n/zh-CN.ts +30 -0
- package/corpus/templates/clips/app/i18n/zh-TW.ts +461 -451
- package/corpus/templates/clips/app/routes/bug-report.done.tsx +126 -0
- package/corpus/templates/clips/app/routes/bug-report.tsx +222 -0
- package/corpus/templates/clips/app/routes/record.tsx +104 -12
- package/corpus/templates/clips/changelog/2026-06-26-brief-network-blips-no-longer-block-recording-or-wrongly-pro.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-bug-report-recordings-can-keep-redacted-host-app-context-wit.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-bug-report-widgets-can-launch-clips-recordings-from-embedded.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-desktop-recording-keeps-connected-users-out-of-the-storage-s.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-26-if-a-recording-can-t-be-uploaded-the-chrome-extension-now-sa.md +6 -0
- package/corpus/templates/clips/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/clips/chrome-extension/public/manifest.json +9 -2
- package/corpus/templates/clips/chrome-extension/src/background.ts +43 -0
- package/corpus/templates/clips/chrome-extension/src/offscreen.ts +111 -6
- package/corpus/templates/clips/chrome-extension/src/popup.ts +18 -7
- package/corpus/templates/clips/desktop/src/app.tsx +53 -19
- package/corpus/templates/clips/server/db/schema.ts +26 -0
- package/corpus/templates/clips/server/lib/public-agent-context.ts +51 -0
- package/corpus/templates/clips/server/plugins/auth.ts +1 -0
- package/corpus/templates/clips/server/plugins/db.ts +28 -0
- package/corpus/templates/clips/server/routes/api/agent-context.json.get.ts +4 -1
- package/corpus/templates/clips/shared/bug-report.ts +161 -0
- package/corpus/templates/content/app/components/layout/Layout.tsx +10 -8
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +1 -1
- package/corpus/templates/content/app/i18n/zh-TW.ts +67 -66
- package/corpus/templates/content/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/design/app/components/layout/Layout.tsx +3 -3
- package/corpus/templates/design/app/i18n/zh-TW.ts +44 -44
- package/corpus/templates/design/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/dispatch/app/i18n/zh-TW.ts +5 -4
- package/corpus/templates/dispatch/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/forms/app/components/layout/Layout.tsx +4 -2
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/forms/app/i18n/zh-TW.ts +48 -48
- package/corpus/templates/forms/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +3 -3
- package/corpus/templates/macros/app/i18n/zh-TW.ts +5 -5
- package/corpus/templates/macros/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/mail/app/i18n/zh-TW.ts +83 -83
- package/corpus/templates/mail/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/plan/app/components/layout/Layout.tsx +5 -3
- package/corpus/templates/plan/app/i18n/zh-TW.ts +69 -69
- package/corpus/templates/plan/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/slides/app/components/layout/Layout.tsx +3 -3
- package/corpus/templates/slides/app/i18n/zh-TW.ts +64 -64
- package/corpus/templates/slides/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/videos/app/components/layout/Layout.tsx +2 -2
- package/corpus/templates/videos/app/i18n/zh-TW.ts +54 -54
- package/corpus/templates/videos/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +16 -6
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/collab/routes.d.ts +2 -2
- package/dist/deploy/build.d.ts +3 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +372 -37
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/route-discovery.d.ts +1 -1
- package/dist/deploy/route-discovery.js +1 -1
- package/dist/deploy/route-discovery.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/server/agent-engine-api-key-route.d.ts +2 -2
- package/dist/server/edge.d.ts +11 -0
- package/dist/server/edge.d.ts.map +1 -0
- package/dist/server/edge.js +11 -0
- package/dist/server/edge.js.map +1 -0
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/styles/agent-native.css +123 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +44 -44
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +1 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/locales/zh-TW/a2a-protocol.md +68 -68
- package/docs/content/locales/zh-TW/actions.md +82 -82
- package/docs/content/locales/zh-TW/agent-mentions.md +22 -22
- package/docs/content/locales/zh-TW/agent-surfaces.md +82 -82
- package/docs/content/locales/zh-TW/agent-teams.md +29 -29
- package/docs/content/locales/zh-TW/agent-web-surfaces.md +11 -11
- package/docs/content/locales/zh-TW/audit-log.md +16 -16
- package/docs/content/locales/zh-TW/authentication.md +32 -32
- package/docs/content/locales/zh-TW/automations.md +32 -32
- package/docs/content/locales/zh-TW/blueprint-installer.md +19 -19
- package/docs/content/locales/zh-TW/cli-adapters.md +17 -17
- package/docs/content/locales/zh-TW/client.md +62 -62
- package/docs/content/locales/zh-TW/cloneable-saas.md +32 -32
- package/docs/content/locales/zh-TW/code-agents-ui.md +91 -91
- package/docs/content/locales/zh-TW/components.md +51 -51
- package/docs/content/locales/zh-TW/context-awareness.md +66 -66
- package/docs/content/locales/zh-TW/creating-templates.md +39 -39
- package/docs/content/locales/zh-TW/cross-app-sso.md +29 -29
- package/docs/content/locales/zh-TW/database.md +21 -21
- package/docs/content/locales/zh-TW/deployment.md +37 -37
- package/docs/content/locales/zh-TW/dispatch.md +43 -43
- package/docs/content/locales/zh-TW/drop-in-agent.md +34 -34
- package/docs/content/locales/zh-TW/durable-resume.md +18 -18
- package/docs/content/locales/zh-TW/embedding-sdk.md +73 -73
- package/docs/content/locales/zh-TW/evals.md +16 -16
- package/docs/content/locales/zh-TW/extensions.md +81 -81
- package/docs/content/locales/zh-TW/external-agents.md +146 -146
- package/docs/content/locales/zh-TW/faq.md +43 -43
- package/docs/content/locales/zh-TW/file-uploads.md +11 -11
- package/docs/content/locales/zh-TW/frames.md +33 -33
- package/docs/content/locales/zh-TW/getting-started.md +28 -28
- package/docs/content/locales/zh-TW/harness-agents.md +78 -78
- package/docs/content/locales/zh-TW/human-approval.md +27 -27
- package/docs/content/locales/zh-TW/internationalization.md +19 -19
- package/docs/content/locales/zh-TW/key-concepts.md +68 -68
- package/docs/content/locales/zh-TW/local-file-mode.md +50 -50
- package/docs/content/locales/zh-TW/mcp-apps.md +38 -38
- package/docs/content/locales/zh-TW/mcp-clients.md +67 -67
- package/docs/content/locales/zh-TW/mcp-protocol.md +50 -50
- package/docs/content/locales/zh-TW/messaging.md +99 -99
- package/docs/content/locales/zh-TW/migration-workbench.md +6 -6
- package/docs/content/locales/zh-TW/multi-app-workspace.md +39 -39
- package/docs/content/locales/zh-TW/multi-tenancy.md +7 -7
- package/docs/content/locales/zh-TW/native-chat-ui.md +38 -38
- package/docs/content/locales/zh-TW/notifications.md +23 -23
- package/docs/content/locales/zh-TW/observability.md +49 -49
- package/docs/content/locales/zh-TW/observational-memory.md +23 -23
- package/docs/content/locales/zh-TW/onboarding.md +40 -40
- package/docs/content/locales/zh-TW/plan-plugin.md +37 -37
- package/docs/content/locales/zh-TW/pr-visual-recap.md +72 -72
- package/docs/content/locales/zh-TW/processors.md +17 -17
- package/docs/content/locales/zh-TW/progress.md +15 -15
- package/docs/content/locales/zh-TW/pure-agent-apps.md +10 -10
- package/docs/content/locales/zh-TW/real-time-collaboration.md +103 -103
- package/docs/content/locales/zh-TW/recurring-jobs.md +19 -19
- package/docs/content/locales/zh-TW/routing.md +9 -9
- package/docs/content/locales/zh-TW/sandbox-adapters.md +48 -48
- package/docs/content/locales/zh-TW/security.md +49 -49
- package/docs/content/locales/zh-TW/server.md +47 -47
- package/docs/content/locales/zh-TW/sharing.md +22 -22
- package/docs/content/locales/zh-TW/skills-guide.md +46 -46
- package/docs/content/locales/zh-TW/template-analytics.md +40 -40
- package/docs/content/locales/zh-TW/template-assets.md +69 -69
- package/docs/content/locales/zh-TW/template-brain.md +81 -81
- package/docs/content/locales/zh-TW/template-calendar.md +40 -40
- package/docs/content/locales/zh-TW/template-chat.md +27 -27
- package/docs/content/locales/zh-TW/template-clips.md +85 -85
- package/docs/content/locales/zh-TW/template-content.md +65 -66
- package/docs/content/locales/zh-TW/template-design.md +29 -29
- package/docs/content/locales/zh-TW/template-dispatch.md +51 -51
- package/docs/content/locales/zh-TW/template-forms.md +25 -25
- package/docs/content/locales/zh-TW/template-mail.md +71 -71
- package/docs/content/locales/zh-TW/template-plan.md +92 -92
- package/docs/content/locales/zh-TW/template-slides.md +52 -52
- package/docs/content/locales/zh-TW/template-videos.md +30 -30
- package/docs/content/locales/zh-TW/tracking.md +29 -29
- package/docs/content/locales/zh-TW/using-your-agent.md +18 -18
- package/docs/content/locales/zh-TW/voice-input.md +19 -19
- package/docs/content/locales/zh-TW/what-is-agent-native.md +61 -61
- package/docs/content/locales/zh-TW/workspace-connections.md +41 -41
- package/docs/content/locales/zh-TW/workspace-management.md +27 -27
- package/docs/content/locales/zh-TW/workspace.md +58 -58
- package/docs/content/locales/zh-TW/writing-agent-instructions.md +41 -41
- package/docs/content/template-clips.md +48 -2
- package/package.json +2 -1
- package/src/templates/default/app/i18n/zh-TW.ts +44 -44
|
@@ -178,12 +178,13 @@ const AGENT_PANEL_ROOT_STYLE = {
|
|
|
178
178
|
lineHeight: 1.2,
|
|
179
179
|
} satisfies React.CSSProperties;
|
|
180
180
|
type AgentPanelStyle = React.CSSProperties & {
|
|
181
|
+
"--agent-sidebar-background"?: string;
|
|
181
182
|
"--agent-sidebar-closed-transform"?: string;
|
|
182
183
|
"--agent-sidebar-inner-closed-transform"?: string;
|
|
183
184
|
"--agent-sidebar-width"?: string;
|
|
184
185
|
};
|
|
185
186
|
const AGENT_PANEL_HEADER_CLASS =
|
|
186
|
-
"relative z-[240] flex h-12 shrink-0 items-center justify-between gap-2 border-b border-border";
|
|
187
|
+
"agent-native-shell-topbar relative z-[240] flex h-12 shrink-0 items-center justify-between gap-2 border-b border-border";
|
|
187
188
|
const AGENT_PANEL_HEADER_STYLE = {
|
|
188
189
|
paddingLeft: 8,
|
|
189
190
|
paddingRight: 8,
|
|
@@ -1879,8 +1880,7 @@ function ResizeHandle({
|
|
|
1879
1880
|
<div
|
|
1880
1881
|
ref={ref}
|
|
1881
1882
|
className={cn(
|
|
1882
|
-
"relative z-20 shrink-0
|
|
1883
|
-
"bg-border hover:bg-accent active:bg-accent",
|
|
1883
|
+
"agent-sidebar-resize-handle relative z-20 w-px shrink-0 touch-none select-none bg-transparent transition-colors hover:bg-border active:bg-border",
|
|
1884
1884
|
)}
|
|
1885
1885
|
style={{ cursor: "col-resize" }}
|
|
1886
1886
|
/>
|
|
@@ -2819,6 +2819,11 @@ export function AgentSidebar({
|
|
|
2819
2819
|
? renderAnimatedPanel
|
|
2820
2820
|
: shouldMountPanel;
|
|
2821
2821
|
const panelOpen = open && shouldMountPanel;
|
|
2822
|
+
const panelLayout = isMobile
|
|
2823
|
+
? "mobile"
|
|
2824
|
+
: effectiveFullscreen
|
|
2825
|
+
? "fullscreen"
|
|
2826
|
+
: "desktop";
|
|
2822
2827
|
// On desktop the resize handle is also the visual divider. Avoid painting a
|
|
2823
2828
|
// second panel border next to it.
|
|
2824
2829
|
const showResizeHandle = !isMobile && !effectiveFullscreen && panelOpen;
|
|
@@ -2838,7 +2843,9 @@ export function AgentSidebar({
|
|
|
2838
2843
|
maxWidth: "85vw",
|
|
2839
2844
|
maxHeight: "100vh",
|
|
2840
2845
|
zIndex: SIDEBAR_OVERLAY_Z_INDEX,
|
|
2841
|
-
|
|
2846
|
+
"--agent-sidebar-background":
|
|
2847
|
+
"var(--agent-native-lower-surface, hsl(var(--background)))",
|
|
2848
|
+
background: "var(--agent-sidebar-background)",
|
|
2842
2849
|
borderLeft: isLeft ? "none" : "1px solid hsl(var(--border))",
|
|
2843
2850
|
borderRight: isLeft ? "1px solid hsl(var(--border))" : "none",
|
|
2844
2851
|
display: mobileAnimationEnabled || panelOpen ? "flex" : "none",
|
|
@@ -2861,6 +2868,9 @@ export function AgentSidebar({
|
|
|
2861
2868
|
...AGENT_PANEL_ROOT_STYLE,
|
|
2862
2869
|
"--agent-sidebar-width": `${width}px`,
|
|
2863
2870
|
"--agent-sidebar-inner-closed-transform": `translateX(${isLeft ? "-" : ""}100%)`,
|
|
2871
|
+
"--agent-sidebar-background":
|
|
2872
|
+
"var(--agent-native-lower-surface, hsl(var(--background)))",
|
|
2873
|
+
background: "var(--agent-sidebar-background)",
|
|
2864
2874
|
width: desktopAnimationEnabled ? undefined : width,
|
|
2865
2875
|
maxHeight: "100vh",
|
|
2866
2876
|
borderLeft:
|
|
@@ -2897,6 +2907,8 @@ export function AgentSidebar({
|
|
|
2897
2907
|
? "desktop"
|
|
2898
2908
|
: undefined
|
|
2899
2909
|
}
|
|
2910
|
+
data-agent-sidebar-layout={panelLayout}
|
|
2911
|
+
data-agent-sidebar-position={position}
|
|
2900
2912
|
data-agent-sidebar-state={panelOpen ? "open" : "closed"}
|
|
2901
2913
|
style={
|
|
2902
2914
|
chatViewTransition
|
|
@@ -2933,7 +2945,10 @@ export function AgentSidebar({
|
|
|
2933
2945
|
) : null;
|
|
2934
2946
|
|
|
2935
2947
|
return (
|
|
2936
|
-
<div
|
|
2948
|
+
<div
|
|
2949
|
+
className="agent-sidebar-shell flex min-w-0 flex-1 h-screen overflow-hidden"
|
|
2950
|
+
data-agent-sidebar-position={position}
|
|
2951
|
+
>
|
|
2937
2952
|
<AgentNativeRouteWarmup />
|
|
2938
2953
|
{/* Mobile backdrop — tapping it closes the sidebar */}
|
|
2939
2954
|
{isMobile &&
|
|
@@ -2957,7 +2972,15 @@ export function AgentSidebar({
|
|
|
2957
2972
|
commands the agent writes via `set-search-params` / `set-url`. */}
|
|
2958
2973
|
{shouldMountPanel ? <URLSync browserTabId={browserTabId} /> : null}
|
|
2959
2974
|
{isLeft && !presentationMode ? sidebar : null}
|
|
2960
|
-
<div
|
|
2975
|
+
<div
|
|
2976
|
+
className="agent-sidebar-main-surface flex flex-1 flex-col overflow-auto min-w-0"
|
|
2977
|
+
data-agent-sidebar-main-position={position}
|
|
2978
|
+
data-agent-sidebar-main-state={
|
|
2979
|
+
!isMobile && !effectiveFullscreen && !presentationMode && panelOpen
|
|
2980
|
+
? "open"
|
|
2981
|
+
: "closed"
|
|
2982
|
+
}
|
|
2983
|
+
>
|
|
2961
2984
|
{/* Screen-refresh key: the agent's `refresh-screen` tool bumps this
|
|
2962
2985
|
counter, remounting only the main content subtree so it re-fetches
|
|
2963
2986
|
its data. The sidebar above stays mounted, preserving chat state. */}
|
|
@@ -100,6 +100,378 @@ export const CLOUDFLARE_WORKER_ESBUILD_EXTERNALS = [
|
|
|
100
100
|
"@sparticuz/chromium-min",
|
|
101
101
|
"fsevents",
|
|
102
102
|
];
|
|
103
|
+
export const CLOUDFLARE_WORKER_STUB_MODULES: Record<string, string> = {
|
|
104
|
+
"better-sqlite3":
|
|
105
|
+
"export default {}; export const Database = class {}; export const watch = () => ({ close() {} });\n",
|
|
106
|
+
"node-pty":
|
|
107
|
+
"export default {}; export const watch = () => ({ close() {} });\n",
|
|
108
|
+
chokidar: "export default {}; export const watch = () => ({ close() {} });\n",
|
|
109
|
+
fsevents: "export default {}; export const watch = () => ({ close() {} });\n",
|
|
110
|
+
dotenv: "export default {}; export const config = () => ({ parsed: {} });\n",
|
|
111
|
+
"@anthropic-ai/sdk": "export default class Anthropic {}\n",
|
|
112
|
+
"@anthropic-ai/tokenizer":
|
|
113
|
+
"export default {}; export const countTokens = undefined;\n",
|
|
114
|
+
"@sentry/node": [
|
|
115
|
+
"export const init = () => {};",
|
|
116
|
+
"const scope = {",
|
|
117
|
+
" setUser() {},",
|
|
118
|
+
" setTag() {},",
|
|
119
|
+
" setExtra() {},",
|
|
120
|
+
" setContext() {},",
|
|
121
|
+
" setLevel() {},",
|
|
122
|
+
" getScopeData() { return {}; },",
|
|
123
|
+
"};",
|
|
124
|
+
"export const getIsolationScope = () => scope;",
|
|
125
|
+
"export const withScope = (fn) => fn(scope);",
|
|
126
|
+
"export const captureException = () => undefined;",
|
|
127
|
+
"export default { init, getIsolationScope, withScope, captureException };",
|
|
128
|
+
"",
|
|
129
|
+
].join("\n"),
|
|
130
|
+
"@resvg/resvg-js": [
|
|
131
|
+
"export class Resvg {",
|
|
132
|
+
' constructor() { throw new Error("@resvg/resvg-js unavailable in Cloudflare Pages worker"); }',
|
|
133
|
+
"}",
|
|
134
|
+
"export default { Resvg };",
|
|
135
|
+
"",
|
|
136
|
+
].join("\n"),
|
|
137
|
+
"playwright-core": [
|
|
138
|
+
"const unavailable = async () => { throw new Error('playwright-core unavailable in Cloudflare Pages worker'); };",
|
|
139
|
+
"export const chromium = { launch: unavailable };",
|
|
140
|
+
"export const firefox = { launch: unavailable };",
|
|
141
|
+
"export const webkit = { launch: unavailable };",
|
|
142
|
+
"export default { chromium, firefox, webkit };",
|
|
143
|
+
"",
|
|
144
|
+
].join("\n"),
|
|
145
|
+
"@sparticuz/chromium-min": [
|
|
146
|
+
"const chromium = {",
|
|
147
|
+
" args: [],",
|
|
148
|
+
" setGraphicsMode: false,",
|
|
149
|
+
" executablePath: async () => { throw new Error('@sparticuz/chromium-min unavailable in Cloudflare Pages worker'); },",
|
|
150
|
+
"};",
|
|
151
|
+
"export default chromium;",
|
|
152
|
+
"",
|
|
153
|
+
].join("\n"),
|
|
154
|
+
"@google/genai": [
|
|
155
|
+
"export class GoogleGenAI {",
|
|
156
|
+
" constructor() { throw new Error('@google/genai unavailable in Cloudflare Pages worker'); }",
|
|
157
|
+
"}",
|
|
158
|
+
"export default { GoogleGenAI };",
|
|
159
|
+
"",
|
|
160
|
+
].join("\n"),
|
|
161
|
+
"pdf-parse": [
|
|
162
|
+
"export class PDFParse {",
|
|
163
|
+
" constructor() { throw new Error('pdf-parse unavailable in Cloudflare Pages worker'); }",
|
|
164
|
+
"}",
|
|
165
|
+
"export default { PDFParse };",
|
|
166
|
+
"",
|
|
167
|
+
].join("\n"),
|
|
168
|
+
"pdfjs-dist":
|
|
169
|
+
"export default {}; export const getDocument = () => { throw new Error('pdfjs-dist unavailable in Cloudflare Pages worker'); };\n",
|
|
170
|
+
"chartjs-node-canvas": [
|
|
171
|
+
"export class ChartJSNodeCanvas {",
|
|
172
|
+
" constructor() { throw new Error('chartjs-node-canvas unavailable in Cloudflare Pages worker'); }",
|
|
173
|
+
"}",
|
|
174
|
+
"export default { ChartJSNodeCanvas };",
|
|
175
|
+
"",
|
|
176
|
+
].join("\n"),
|
|
177
|
+
"@napi-rs/canvas":
|
|
178
|
+
"export default {}; export const createCanvas = () => { throw new Error('@napi-rs/canvas unavailable in Cloudflare Pages worker'); };\n",
|
|
179
|
+
mermaid: "export default {}; export const mermaidAPI = {};\n",
|
|
180
|
+
"@excalidraw/excalidraw":
|
|
181
|
+
"export default {}; export const MainMenu = {}; export const WelcomeScreen = {};\n",
|
|
182
|
+
"@excalidraw/mermaid-to-excalidraw":
|
|
183
|
+
"export default async () => ({ elements: [], files: {} });\n",
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
function cloudflareNodeBuiltinStubSource(
|
|
187
|
+
moduleName: string,
|
|
188
|
+
namedExports: string[],
|
|
189
|
+
overrides: string[] = [],
|
|
190
|
+
): string {
|
|
191
|
+
const overridden = new Set(
|
|
192
|
+
overrides.flatMap((source) =>
|
|
193
|
+
Array.from(source.matchAll(/\bexport const ([A-Za-z_$][\w$]*)/g)).map(
|
|
194
|
+
(match) => match[1],
|
|
195
|
+
),
|
|
196
|
+
),
|
|
197
|
+
);
|
|
198
|
+
const exports = Array.from(new Set(namedExports))
|
|
199
|
+
.filter((name) => !overridden.has(name))
|
|
200
|
+
.sort();
|
|
201
|
+
return [
|
|
202
|
+
`const unavailable = (name) => (..._args) => { throw new Error(name + " is unavailable in Cloudflare Pages workers"); };`,
|
|
203
|
+
`const proxy = new Proxy({}, { get(_target, prop) { return unavailable("${moduleName}." + String(prop)); } });`,
|
|
204
|
+
...overrides,
|
|
205
|
+
...exports.map(
|
|
206
|
+
(name) => `export const ${name} = unavailable("${moduleName}.${name}");`,
|
|
207
|
+
),
|
|
208
|
+
"export default proxy;",
|
|
209
|
+
"",
|
|
210
|
+
].join("\n");
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export const CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES: Record<
|
|
214
|
+
string,
|
|
215
|
+
string
|
|
216
|
+
> = {
|
|
217
|
+
child_process: cloudflareNodeBuiltinStubSource("child_process", [
|
|
218
|
+
"exec",
|
|
219
|
+
"execFile",
|
|
220
|
+
"execFileSync",
|
|
221
|
+
"execSync",
|
|
222
|
+
"fork",
|
|
223
|
+
"spawn",
|
|
224
|
+
"spawnSync",
|
|
225
|
+
]),
|
|
226
|
+
cluster: cloudflareNodeBuiltinStubSource("cluster", [
|
|
227
|
+
"disconnect",
|
|
228
|
+
"fork",
|
|
229
|
+
"isMaster",
|
|
230
|
+
"isPrimary",
|
|
231
|
+
"isWorker",
|
|
232
|
+
"setupMaster",
|
|
233
|
+
"setupPrimary",
|
|
234
|
+
"worker",
|
|
235
|
+
"workers",
|
|
236
|
+
]),
|
|
237
|
+
dgram: cloudflareNodeBuiltinStubSource("dgram", ["createSocket"]),
|
|
238
|
+
dns: cloudflareNodeBuiltinStubSource("dns", [
|
|
239
|
+
"lookup",
|
|
240
|
+
"promises",
|
|
241
|
+
"resolve",
|
|
242
|
+
"resolve4",
|
|
243
|
+
"resolve6",
|
|
244
|
+
]),
|
|
245
|
+
"dns/promises": cloudflareNodeBuiltinStubSource("dns/promises", [
|
|
246
|
+
"lookup",
|
|
247
|
+
"resolve",
|
|
248
|
+
"resolve4",
|
|
249
|
+
"resolve6",
|
|
250
|
+
]),
|
|
251
|
+
domain: cloudflareNodeBuiltinStubSource("domain", ["create"]),
|
|
252
|
+
fs: cloudflareNodeBuiltinStubSource(
|
|
253
|
+
"fs",
|
|
254
|
+
[
|
|
255
|
+
"access",
|
|
256
|
+
"accessSync",
|
|
257
|
+
"appendFile",
|
|
258
|
+
"appendFileSync",
|
|
259
|
+
"chmod",
|
|
260
|
+
"chmodSync",
|
|
261
|
+
"close",
|
|
262
|
+
"closeSync",
|
|
263
|
+
"copyFile",
|
|
264
|
+
"copyFileSync",
|
|
265
|
+
"cp",
|
|
266
|
+
"cpSync",
|
|
267
|
+
"createReadStream",
|
|
268
|
+
"createWriteStream",
|
|
269
|
+
"existsSync",
|
|
270
|
+
"lstat",
|
|
271
|
+
"lstatSync",
|
|
272
|
+
"mkdir",
|
|
273
|
+
"mkdirSync",
|
|
274
|
+
"open",
|
|
275
|
+
"openSync",
|
|
276
|
+
"readFile",
|
|
277
|
+
"readFileSync",
|
|
278
|
+
"readdir",
|
|
279
|
+
"readdirSync",
|
|
280
|
+
"readlink",
|
|
281
|
+
"readlinkSync",
|
|
282
|
+
"realpath",
|
|
283
|
+
"realpathSync",
|
|
284
|
+
"rename",
|
|
285
|
+
"renameSync",
|
|
286
|
+
"rm",
|
|
287
|
+
"rmSync",
|
|
288
|
+
"stat",
|
|
289
|
+
"statSync",
|
|
290
|
+
"symlink",
|
|
291
|
+
"symlinkSync",
|
|
292
|
+
"unlink",
|
|
293
|
+
"unlinkSync",
|
|
294
|
+
"watch",
|
|
295
|
+
"writeFile",
|
|
296
|
+
"writeFileSync",
|
|
297
|
+
],
|
|
298
|
+
[
|
|
299
|
+
"export const constants = {};",
|
|
300
|
+
"export const promises = {};",
|
|
301
|
+
"export const existsSync = () => false;",
|
|
302
|
+
"export const readdirSync = () => [];",
|
|
303
|
+
"export const realpathSync = (value) => value;",
|
|
304
|
+
"export const mkdirSync = () => undefined;",
|
|
305
|
+
"export const rmSync = () => undefined;",
|
|
306
|
+
],
|
|
307
|
+
),
|
|
308
|
+
"fs/promises": cloudflareNodeBuiltinStubSource("fs/promises", [
|
|
309
|
+
"access",
|
|
310
|
+
"appendFile",
|
|
311
|
+
"chmod",
|
|
312
|
+
"copyFile",
|
|
313
|
+
"cp",
|
|
314
|
+
"lstat",
|
|
315
|
+
"mkdtemp",
|
|
316
|
+
"mkdir",
|
|
317
|
+
"readFile",
|
|
318
|
+
"readdir",
|
|
319
|
+
"readlink",
|
|
320
|
+
"realpath",
|
|
321
|
+
"rename",
|
|
322
|
+
"rm",
|
|
323
|
+
"stat",
|
|
324
|
+
"symlink",
|
|
325
|
+
"unlink",
|
|
326
|
+
"writeFile",
|
|
327
|
+
]),
|
|
328
|
+
http: cloudflareNodeBuiltinStubSource("http", [
|
|
329
|
+
"Agent",
|
|
330
|
+
"ClientRequest",
|
|
331
|
+
"IncomingMessage",
|
|
332
|
+
"ServerResponse",
|
|
333
|
+
"createServer",
|
|
334
|
+
"get",
|
|
335
|
+
"request",
|
|
336
|
+
]),
|
|
337
|
+
http2: cloudflareNodeBuiltinStubSource("http2", [
|
|
338
|
+
"Http2ServerRequest",
|
|
339
|
+
"Http2ServerResponse",
|
|
340
|
+
"constants",
|
|
341
|
+
"connect",
|
|
342
|
+
"createSecureServer",
|
|
343
|
+
"createServer",
|
|
344
|
+
]),
|
|
345
|
+
https: cloudflareNodeBuiltinStubSource("https", [
|
|
346
|
+
"Agent",
|
|
347
|
+
"createServer",
|
|
348
|
+
"get",
|
|
349
|
+
"request",
|
|
350
|
+
]),
|
|
351
|
+
inspector: cloudflareNodeBuiltinStubSource("inspector", [
|
|
352
|
+
"Session",
|
|
353
|
+
"close",
|
|
354
|
+
"open",
|
|
355
|
+
"url",
|
|
356
|
+
"waitForDebugger",
|
|
357
|
+
]),
|
|
358
|
+
module: cloudflareNodeBuiltinStubSource(
|
|
359
|
+
"module",
|
|
360
|
+
["Module", "builtinModules", "createRequire", "syncBuiltinESMExports"],
|
|
361
|
+
[
|
|
362
|
+
"export const builtinModules = [];",
|
|
363
|
+
"export const createRequire = () => globalThis.require ?? ((specifier) => { throw new Error('Cannot require: ' + specifier); });",
|
|
364
|
+
],
|
|
365
|
+
),
|
|
366
|
+
net: cloudflareNodeBuiltinStubSource(
|
|
367
|
+
"net",
|
|
368
|
+
["Socket", "connect", "createConnection", "createServer", "isIP"],
|
|
369
|
+
[
|
|
370
|
+
`export const isIP = (value) => {
|
|
371
|
+
const input = String(value ?? "");
|
|
372
|
+
const ipv4Parts = input.split(".");
|
|
373
|
+
if (
|
|
374
|
+
ipv4Parts.length === 4 &&
|
|
375
|
+
ipv4Parts.every((part) => /^\\d{1,3}$/.test(part) && Number(part) >= 0 && Number(part) <= 255)
|
|
376
|
+
) {
|
|
377
|
+
return 4;
|
|
378
|
+
}
|
|
379
|
+
if (input.includes(":") && /^[0-9A-Fa-f:.]+$/.test(input)) {
|
|
380
|
+
return 6;
|
|
381
|
+
}
|
|
382
|
+
return 0;
|
|
383
|
+
};`,
|
|
384
|
+
],
|
|
385
|
+
),
|
|
386
|
+
os: cloudflareNodeBuiltinStubSource(
|
|
387
|
+
"os",
|
|
388
|
+
[
|
|
389
|
+
"arch",
|
|
390
|
+
"cpus",
|
|
391
|
+
"endianness",
|
|
392
|
+
"freemem",
|
|
393
|
+
"homedir",
|
|
394
|
+
"hostname",
|
|
395
|
+
"networkInterfaces",
|
|
396
|
+
"platform",
|
|
397
|
+
"release",
|
|
398
|
+
"tmpdir",
|
|
399
|
+
"totalmem",
|
|
400
|
+
"type",
|
|
401
|
+
"userInfo",
|
|
402
|
+
],
|
|
403
|
+
[
|
|
404
|
+
'export const EOL = "\\n";',
|
|
405
|
+
'export const arch = () => "x64";',
|
|
406
|
+
"export const cpus = () => [];",
|
|
407
|
+
'export const endianness = () => "LE";',
|
|
408
|
+
"export const freemem = () => 0;",
|
|
409
|
+
'export const homedir = () => "/tmp";',
|
|
410
|
+
'export const hostname = () => "cloudflare-worker";',
|
|
411
|
+
"export const networkInterfaces = () => ({});",
|
|
412
|
+
'export const platform = () => "linux";',
|
|
413
|
+
'export const release = () => "";',
|
|
414
|
+
'export const tmpdir = () => "/tmp";',
|
|
415
|
+
"export const totalmem = () => 0;",
|
|
416
|
+
'export const type = () => "Worker";',
|
|
417
|
+
"export const userInfo = () => ({ username: 'worker', homedir: '/tmp' });",
|
|
418
|
+
],
|
|
419
|
+
),
|
|
420
|
+
readline: cloudflareNodeBuiltinStubSource("readline", [
|
|
421
|
+
"Interface",
|
|
422
|
+
"clearLine",
|
|
423
|
+
"clearScreenDown",
|
|
424
|
+
"createInterface",
|
|
425
|
+
"cursorTo",
|
|
426
|
+
"emitKeypressEvents",
|
|
427
|
+
"moveCursor",
|
|
428
|
+
]),
|
|
429
|
+
repl: cloudflareNodeBuiltinStubSource("repl", ["start"]),
|
|
430
|
+
sqlite: cloudflareNodeBuiltinStubSource("sqlite", ["DatabaseSync"]),
|
|
431
|
+
sys: cloudflareNodeBuiltinStubSource("sys", [
|
|
432
|
+
"debug",
|
|
433
|
+
"deprecate",
|
|
434
|
+
"error",
|
|
435
|
+
"inspect",
|
|
436
|
+
"log",
|
|
437
|
+
"print",
|
|
438
|
+
"puts",
|
|
439
|
+
]),
|
|
440
|
+
tls: cloudflareNodeBuiltinStubSource("tls", [
|
|
441
|
+
"TLSSocket",
|
|
442
|
+
"connect",
|
|
443
|
+
"createSecureContext",
|
|
444
|
+
"createServer",
|
|
445
|
+
]),
|
|
446
|
+
trace_events: cloudflareNodeBuiltinStubSource("trace_events", [
|
|
447
|
+
"createTracing",
|
|
448
|
+
"getEnabledCategories",
|
|
449
|
+
]),
|
|
450
|
+
tty: cloudflareNodeBuiltinStubSource("tty", [
|
|
451
|
+
"ReadStream",
|
|
452
|
+
"WriteStream",
|
|
453
|
+
"isatty",
|
|
454
|
+
]),
|
|
455
|
+
v8: cloudflareNodeBuiltinStubSource("v8", [
|
|
456
|
+
"deserialize",
|
|
457
|
+
"getHeapStatistics",
|
|
458
|
+
"serialize",
|
|
459
|
+
]),
|
|
460
|
+
vm: cloudflareNodeBuiltinStubSource("vm", [
|
|
461
|
+
"Script",
|
|
462
|
+
"compileFunction",
|
|
463
|
+
"createContext",
|
|
464
|
+
"runInContext",
|
|
465
|
+
"runInNewContext",
|
|
466
|
+
"runInThisContext",
|
|
467
|
+
]),
|
|
468
|
+
wasi: cloudflareNodeBuiltinStubSource("wasi", ["WASI"]),
|
|
469
|
+
worker_threads: cloudflareNodeBuiltinStubSource(
|
|
470
|
+
"worker_threads",
|
|
471
|
+
["MessageChannel", "MessagePort", "Worker", "isMainThread", "parentPort"],
|
|
472
|
+
["export const isMainThread = true;", "export const parentPort = null;"],
|
|
473
|
+
),
|
|
474
|
+
};
|
|
103
475
|
|
|
104
476
|
export interface GenerateWorkerEntryOptions {
|
|
105
477
|
includeReactRouterSsr?: boolean;
|
|
@@ -144,6 +516,7 @@ const NODE_ONLY_PLUGINS = new Set([
|
|
|
144
516
|
// observability there; the framework default is the Node SDK.
|
|
145
517
|
"sentry",
|
|
146
518
|
]);
|
|
519
|
+
const EDGE_SERVER_ENTRYPOINT = "@agent-native/core/server/edge";
|
|
147
520
|
|
|
148
521
|
function isNodeOnlyPlugin(filePath: string): boolean {
|
|
149
522
|
const basename = path.basename(filePath, path.extname(filePath));
|
|
@@ -155,7 +528,7 @@ export function generateProvidedPluginsNitroPluginSource(
|
|
|
155
528
|
): string {
|
|
156
529
|
const stems = [...new Set(pluginStems.filter(Boolean))].sort();
|
|
157
530
|
return `// AUTO-GENERATED by @agent-native/core deploy build
|
|
158
|
-
import { markDefaultPluginProvided } from "
|
|
531
|
+
import { markDefaultPluginProvided } from "${EDGE_SERVER_ENTRYPOINT}";
|
|
159
532
|
|
|
160
533
|
const pluginStems = ${JSON.stringify(stems)};
|
|
161
534
|
|
|
@@ -217,7 +590,7 @@ export function addImmutableAssetRouteRulesForClientBuild(
|
|
|
217
590
|
* If a workspace core is present (monorepo with `agent-native.workspaceCore`
|
|
218
591
|
* configured and the named package resolves), any plugin slot that the
|
|
219
592
|
* workspace core exports is imported from there instead of from
|
|
220
|
-
* `@agent-native/core/server`. This is the middle layer of the three-layer
|
|
593
|
+
* `@agent-native/core/server/edge`. This is the middle layer of the three-layer
|
|
221
594
|
* inheritance model: app local > workspace core > framework default.
|
|
222
595
|
*/
|
|
223
596
|
export function generateWorkerEntry(
|
|
@@ -323,11 +696,11 @@ export function generateWorkerEntry(
|
|
|
323
696
|
)};`,
|
|
324
697
|
);
|
|
325
698
|
} else {
|
|
326
|
-
// Fall back to the framework default from
|
|
699
|
+
// Fall back to the framework default from the edge-safe core entrypoint.
|
|
327
700
|
const defaultExportName = DEFAULT_PLUGIN_REGISTRY[stem];
|
|
328
701
|
if (!defaultExportName) continue;
|
|
329
702
|
pluginImports.push(
|
|
330
|
-
`import { ${defaultExportName} as ${varName} } from "
|
|
703
|
+
`import { ${defaultExportName} as ${varName} } from "${EDGE_SERVER_ENTRYPOINT}";`,
|
|
331
704
|
);
|
|
332
705
|
}
|
|
333
706
|
pluginCalls.push(` if (typeof ${varName} === "function") {
|
|
@@ -345,7 +718,7 @@ export function generateWorkerEntry(
|
|
|
345
718
|
: [];
|
|
346
719
|
if (generatedPluginMarks.length > 0) {
|
|
347
720
|
pluginImports.unshift(
|
|
348
|
-
`import { markDefaultPluginProvided as markGeneratedPluginProvided } from "
|
|
721
|
+
`import { markDefaultPluginProvided as markGeneratedPluginProvided } from "${EDGE_SERVER_ENTRYPOINT}";`,
|
|
349
722
|
);
|
|
350
723
|
}
|
|
351
724
|
|
|
@@ -1118,8 +1491,8 @@ async function buildCloudflarePages() {
|
|
|
1118
1491
|
// Exclude _worker.js from being served as a public asset
|
|
1119
1492
|
fs.writeFileSync(path.join(distDir, ".assetsignore"), "_worker.js\n");
|
|
1120
1493
|
|
|
1121
|
-
// Write
|
|
1122
|
-
//
|
|
1494
|
+
// Write package metadata inside _worker.js/ for the ES module worker that
|
|
1495
|
+
// Wrangler compiles and uploads for Cloudflare Pages.
|
|
1123
1496
|
fs.mkdirSync(path.join(distDir, "_worker.js"), { recursive: true });
|
|
1124
1497
|
fs.writeFileSync(
|
|
1125
1498
|
path.join(distDir, "_worker.js", "package.json"),
|
|
@@ -1221,27 +1594,35 @@ async function buildCloudflarePages() {
|
|
|
1221
1594
|
// Create stub modules for native/Node-only deps that can't run on Workers.
|
|
1222
1595
|
// These get resolved by esbuild instead of the real modules, avoiding bundling
|
|
1223
1596
|
// native code that would fail on the Workers runtime.
|
|
1224
|
-
const stubModules = [
|
|
1225
|
-
"better-sqlite3",
|
|
1226
|
-
"node-pty",
|
|
1227
|
-
"chokidar",
|
|
1228
|
-
"fsevents",
|
|
1229
|
-
"dotenv",
|
|
1230
|
-
"@anthropic-ai/sdk",
|
|
1231
|
-
];
|
|
1232
1597
|
const stubDir = path.join(tmpDir, "node_modules");
|
|
1233
|
-
for (const mod of
|
|
1598
|
+
for (const [mod, source] of Object.entries(CLOUDFLARE_WORKER_STUB_MODULES)) {
|
|
1234
1599
|
const modDir = path.join(stubDir, mod);
|
|
1235
1600
|
fs.mkdirSync(modDir, { recursive: true });
|
|
1236
|
-
fs.writeFileSync(
|
|
1237
|
-
path.join(modDir, "index.js"),
|
|
1238
|
-
`export default {}; export const watch = () => ({ close() {} });`,
|
|
1239
|
-
);
|
|
1601
|
+
fs.writeFileSync(path.join(modDir, "index.js"), source);
|
|
1240
1602
|
fs.writeFileSync(
|
|
1241
1603
|
path.join(modDir, "package.json"),
|
|
1242
1604
|
JSON.stringify({ name: mod, main: "index.js", type: "module" }),
|
|
1243
1605
|
);
|
|
1244
1606
|
}
|
|
1607
|
+
const stubAliases = Object.keys(CLOUDFLARE_WORKER_STUB_MODULES).map(
|
|
1608
|
+
(mod) => `--alias:${mod}=${path.join(stubDir, mod, "index.js")}`,
|
|
1609
|
+
);
|
|
1610
|
+
const nodeBuiltinStubDir = path.join(tmpDir, "node-builtin-stubs");
|
|
1611
|
+
fs.mkdirSync(nodeBuiltinStubDir, { recursive: true });
|
|
1612
|
+
const nodeBuiltinStubAliases: string[] = [];
|
|
1613
|
+
for (const [mod, source] of Object.entries(
|
|
1614
|
+
CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES,
|
|
1615
|
+
).sort(([a], [b]) => b.length - a.length)) {
|
|
1616
|
+
const stubFile = path.join(
|
|
1617
|
+
nodeBuiltinStubDir,
|
|
1618
|
+
`${mod.replace(/\W+/g, "_")}.js`,
|
|
1619
|
+
);
|
|
1620
|
+
fs.writeFileSync(stubFile, source);
|
|
1621
|
+
nodeBuiltinStubAliases.push(
|
|
1622
|
+
`--alias:${mod}=${stubFile}`,
|
|
1623
|
+
`--alias:node:${mod}=${stubFile}`,
|
|
1624
|
+
);
|
|
1625
|
+
}
|
|
1245
1626
|
|
|
1246
1627
|
const esbuildBin = findEsbuild();
|
|
1247
1628
|
|
|
@@ -1257,8 +1638,17 @@ async function buildCloudflarePages() {
|
|
|
1257
1638
|
// Only externalize bare names. node:* externals would otherwise pin
|
|
1258
1639
|
// the prefix in output; instead we alias node:* → bare so anything that
|
|
1259
1640
|
// resolves past alias land as bare externals.
|
|
1260
|
-
const
|
|
1261
|
-
|
|
1641
|
+
const nodeBuiltinStubs = new Set(
|
|
1642
|
+
Object.keys(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES),
|
|
1643
|
+
);
|
|
1644
|
+
const nodeExternals = builtinNames
|
|
1645
|
+
.filter((n) => !nodeBuiltinStubs.has(n))
|
|
1646
|
+
.sort((a, b) => b.length - a.length)
|
|
1647
|
+
.map((n) => `--external:${n}`);
|
|
1648
|
+
const nodeAliases = builtinNames
|
|
1649
|
+
.filter((n) => !nodeBuiltinStubs.has(n))
|
|
1650
|
+
.sort((a, b) => b.length - a.length)
|
|
1651
|
+
.map((n) => `--alias:node:${n}=${n}`);
|
|
1262
1652
|
|
|
1263
1653
|
// Hard externalize large client-only / node-only libraries so they don't
|
|
1264
1654
|
// bloat the edge worker. These are never executed in the CF Pages runtime
|
|
@@ -1271,9 +1661,9 @@ async function buildCloudflarePages() {
|
|
|
1271
1661
|
// files. Both import sites degrade gracefully when the runtime import
|
|
1272
1662
|
// fails: context-xray token counts fall back to char/4 estimates and the
|
|
1273
1663
|
// OG image route falls back to SVG.
|
|
1274
|
-
const heavyClientExternals = CLOUDFLARE_WORKER_ESBUILD_EXTERNALS.
|
|
1275
|
-
(p) =>
|
|
1276
|
-
);
|
|
1664
|
+
const heavyClientExternals = CLOUDFLARE_WORKER_ESBUILD_EXTERNALS.filter(
|
|
1665
|
+
(p) => !Object.hasOwn(CLOUDFLARE_WORKER_STUB_MODULES, p),
|
|
1666
|
+
).map((p) => `--external:${p}`);
|
|
1277
1667
|
|
|
1278
1668
|
execFileSync(
|
|
1279
1669
|
esbuildBin,
|
|
@@ -1302,6 +1692,8 @@ async function buildCloudflarePages() {
|
|
|
1302
1692
|
// Externalize node: builtins — CF Workers runtime provides them
|
|
1303
1693
|
...nodeExternals,
|
|
1304
1694
|
...heavyClientExternals,
|
|
1695
|
+
...stubAliases,
|
|
1696
|
+
...nodeBuiltinStubAliases,
|
|
1305
1697
|
// Rewrite node:* -> bare names so chunks never contain node: imports
|
|
1306
1698
|
...nodeAliases,
|
|
1307
1699
|
],
|
|
@@ -1420,6 +1812,7 @@ const NODE_BUILTINS = [
|
|
|
1420
1812
|
"dgram",
|
|
1421
1813
|
"diagnostics_channel",
|
|
1422
1814
|
"dns",
|
|
1815
|
+
"dns/promises",
|
|
1423
1816
|
"domain",
|
|
1424
1817
|
"events",
|
|
1425
1818
|
"fs",
|
|
@@ -1465,22 +1858,14 @@ export function getNodeBuiltinNames(): string[] {
|
|
|
1465
1858
|
* Injected via esbuild --inject so CJS deps work on Workers runtime.
|
|
1466
1859
|
*/
|
|
1467
1860
|
function generateRequireShim(): string {
|
|
1468
|
-
// Shim
|
|
1469
|
-
//
|
|
1470
|
-
//
|
|
1471
|
-
//
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
// the runtime provides; failures only surface when callers actually USE
|
|
1477
|
-
// the unsupported APIs at request time, which is the same as if the
|
|
1478
|
-
// shim wasn't there.
|
|
1479
|
-
//
|
|
1480
|
-
// `sqlite` is excluded because it's Node 22+ only and Workers'
|
|
1481
|
-
// nodejs_compat doesn't expose it yet — importing it makes the whole
|
|
1482
|
-
// bundle fail to load.
|
|
1483
|
-
const shimmed = NODE_BUILTINS.filter((name) => name !== "sqlite");
|
|
1861
|
+
// Shim Node builtins that Cloudflare Pages can import, and return lazy
|
|
1862
|
+
// unavailable proxies for builtins that Pages Functions reject at upload
|
|
1863
|
+
// time (child_process, fs, net, etc.). This lets optional Node-only code stay
|
|
1864
|
+
// present in the shared bundle without making worker initialization fail.
|
|
1865
|
+
const stubbed = new Set(
|
|
1866
|
+
Object.keys(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES),
|
|
1867
|
+
);
|
|
1868
|
+
const shimmed = NODE_BUILTINS.filter((name) => !stubbed.has(name));
|
|
1484
1869
|
|
|
1485
1870
|
// Bare module names — CF Pages Functions runs under nodejs_compat v1,
|
|
1486
1871
|
// which rejects "node:fs" and only accepts "fs". The post-build pass in
|
|
@@ -1498,9 +1883,14 @@ function generateRequireShim(): string {
|
|
|
1498
1883
|
const entries = shimmed
|
|
1499
1884
|
.map((m) => `"${m}":__${m.replace("/", "_")}`)
|
|
1500
1885
|
.join(",");
|
|
1886
|
+
const stubEntries = Array.from(stubbed)
|
|
1887
|
+
.sort()
|
|
1888
|
+
.map((m) => `"${m}":__unavailable("${m}")`)
|
|
1889
|
+
.join(",");
|
|
1890
|
+
const allEntries = [entries, stubEntries].filter(Boolean).join(",");
|
|
1501
1891
|
|
|
1502
1892
|
const messageChannelPolyfill = `if(typeof MessageChannel==="undefined"){globalThis.MessageChannel=class{constructor(){const a={onmessage:null},b={onmessage:null};a.postMessage=d=>{if(b.onmessage)setTimeout(()=>b.onmessage({data:d}),0)};b.postMessage=d=>{if(a.onmessage)setTimeout(()=>a.onmessage({data:d}),0)};this.port1=a;this.port2=b}}}`;
|
|
1503
|
-
return `${imports}\n${messageChannelPolyfill}\nconst __mods={${
|
|
1893
|
+
return `${imports}\n${messageChannelPolyfill}\nconst __unavailable=(m)=>new Proxy({}, { get(_target, prop) { return (..._args) => { throw new Error(m + "." + String(prop) + " is unavailable in Cloudflare Pages workers"); }; } });\nconst __mods={${allEntries}};export var require=globalThis.require||function(m){const r=__mods[m];if(r!==undefined)return r;throw new Error("Cannot require: "+m)};\n`;
|
|
1504
1894
|
}
|
|
1505
1895
|
|
|
1506
1896
|
function findEsbuild(): string {
|
|
@@ -140,7 +140,7 @@ function isRuntimeSourceFile(filename: string): boolean {
|
|
|
140
140
|
|
|
141
141
|
/**
|
|
142
142
|
* Default plugins that auto-mount when not provided by the template.
|
|
143
|
-
* Key = filename stem, value = export name from @agent-native/core/server.
|
|
143
|
+
* Key = filename stem, value = export name from @agent-native/core/server/edge.
|
|
144
144
|
*/
|
|
145
145
|
export const DEFAULT_PLUGIN_REGISTRY: Record<string, string> = {
|
|
146
146
|
"agent-chat": "defaultAgentChatPlugin",
|