@agent-native/core 0.79.12 → 0.79.15
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 +19 -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 +27 -3
- package/corpus/core/src/deploy/build.ts +417 -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 +93 -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 +14 -4
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/deploy/build.d.ts +3 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +361 -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/resources/handlers.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/styles/agent-native.css +93 -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,6 +178,7 @@ 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;
|
|
@@ -2819,6 +2820,11 @@ export function AgentSidebar({
|
|
|
2819
2820
|
? renderAnimatedPanel
|
|
2820
2821
|
: shouldMountPanel;
|
|
2821
2822
|
const panelOpen = open && shouldMountPanel;
|
|
2823
|
+
const panelLayout = isMobile
|
|
2824
|
+
? "mobile"
|
|
2825
|
+
: effectiveFullscreen
|
|
2826
|
+
? "fullscreen"
|
|
2827
|
+
: "desktop";
|
|
2822
2828
|
// On desktop the resize handle is also the visual divider. Avoid painting a
|
|
2823
2829
|
// second panel border next to it.
|
|
2824
2830
|
const showResizeHandle = !isMobile && !effectiveFullscreen && panelOpen;
|
|
@@ -2838,7 +2844,9 @@ export function AgentSidebar({
|
|
|
2838
2844
|
maxWidth: "85vw",
|
|
2839
2845
|
maxHeight: "100vh",
|
|
2840
2846
|
zIndex: SIDEBAR_OVERLAY_Z_INDEX,
|
|
2841
|
-
|
|
2847
|
+
"--agent-sidebar-background":
|
|
2848
|
+
"var(--agent-native-lower-surface, hsl(var(--background)))",
|
|
2849
|
+
background: "var(--agent-sidebar-background)",
|
|
2842
2850
|
borderLeft: isLeft ? "none" : "1px solid hsl(var(--border))",
|
|
2843
2851
|
borderRight: isLeft ? "1px solid hsl(var(--border))" : "none",
|
|
2844
2852
|
display: mobileAnimationEnabled || panelOpen ? "flex" : "none",
|
|
@@ -2861,6 +2869,9 @@ export function AgentSidebar({
|
|
|
2861
2869
|
...AGENT_PANEL_ROOT_STYLE,
|
|
2862
2870
|
"--agent-sidebar-width": `${width}px`,
|
|
2863
2871
|
"--agent-sidebar-inner-closed-transform": `translateX(${isLeft ? "-" : ""}100%)`,
|
|
2872
|
+
"--agent-sidebar-background":
|
|
2873
|
+
"var(--agent-native-lower-surface, hsl(var(--background)))",
|
|
2874
|
+
background: "var(--agent-sidebar-background)",
|
|
2864
2875
|
width: desktopAnimationEnabled ? undefined : width,
|
|
2865
2876
|
maxHeight: "100vh",
|
|
2866
2877
|
borderLeft:
|
|
@@ -2897,6 +2908,8 @@ export function AgentSidebar({
|
|
|
2897
2908
|
? "desktop"
|
|
2898
2909
|
: undefined
|
|
2899
2910
|
}
|
|
2911
|
+
data-agent-sidebar-layout={panelLayout}
|
|
2912
|
+
data-agent-sidebar-position={position}
|
|
2900
2913
|
data-agent-sidebar-state={panelOpen ? "open" : "closed"}
|
|
2901
2914
|
style={
|
|
2902
2915
|
chatViewTransition
|
|
@@ -2933,7 +2946,10 @@ export function AgentSidebar({
|
|
|
2933
2946
|
) : null;
|
|
2934
2947
|
|
|
2935
2948
|
return (
|
|
2936
|
-
<div
|
|
2949
|
+
<div
|
|
2950
|
+
className="agent-sidebar-shell flex min-w-0 flex-1 h-screen overflow-hidden"
|
|
2951
|
+
data-agent-sidebar-position={position}
|
|
2952
|
+
>
|
|
2937
2953
|
<AgentNativeRouteWarmup />
|
|
2938
2954
|
{/* Mobile backdrop — tapping it closes the sidebar */}
|
|
2939
2955
|
{isMobile &&
|
|
@@ -2957,7 +2973,15 @@ export function AgentSidebar({
|
|
|
2957
2973
|
commands the agent writes via `set-search-params` / `set-url`. */}
|
|
2958
2974
|
{shouldMountPanel ? <URLSync browserTabId={browserTabId} /> : null}
|
|
2959
2975
|
{isLeft && !presentationMode ? sidebar : null}
|
|
2960
|
-
<div
|
|
2976
|
+
<div
|
|
2977
|
+
className="agent-sidebar-main-surface flex flex-1 flex-col overflow-auto min-w-0"
|
|
2978
|
+
data-agent-sidebar-main-position={position}
|
|
2979
|
+
data-agent-sidebar-main-state={
|
|
2980
|
+
!isMobile && !effectiveFullscreen && !presentationMode && panelOpen
|
|
2981
|
+
? "open"
|
|
2982
|
+
: "closed"
|
|
2983
|
+
}
|
|
2984
|
+
>
|
|
2961
2985
|
{/* Screen-refresh key: the agent's `refresh-screen` tool bumps this
|
|
2962
2986
|
counter, remounting only the main content subtree so it re-fetches
|
|
2963
2987
|
its data. The sidebar above stays mounted, preserving chat state. */}
|
|
@@ -100,6 +100,363 @@ 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
|
+
"mkdir",
|
|
316
|
+
"readFile",
|
|
317
|
+
"readdir",
|
|
318
|
+
"readlink",
|
|
319
|
+
"realpath",
|
|
320
|
+
"rename",
|
|
321
|
+
"rm",
|
|
322
|
+
"stat",
|
|
323
|
+
"symlink",
|
|
324
|
+
"unlink",
|
|
325
|
+
"writeFile",
|
|
326
|
+
]),
|
|
327
|
+
http: cloudflareNodeBuiltinStubSource("http", [
|
|
328
|
+
"Agent",
|
|
329
|
+
"ClientRequest",
|
|
330
|
+
"IncomingMessage",
|
|
331
|
+
"ServerResponse",
|
|
332
|
+
"createServer",
|
|
333
|
+
"get",
|
|
334
|
+
"request",
|
|
335
|
+
]),
|
|
336
|
+
http2: cloudflareNodeBuiltinStubSource("http2", [
|
|
337
|
+
"Http2ServerRequest",
|
|
338
|
+
"Http2ServerResponse",
|
|
339
|
+
"constants",
|
|
340
|
+
"connect",
|
|
341
|
+
"createSecureServer",
|
|
342
|
+
"createServer",
|
|
343
|
+
]),
|
|
344
|
+
https: cloudflareNodeBuiltinStubSource("https", [
|
|
345
|
+
"Agent",
|
|
346
|
+
"createServer",
|
|
347
|
+
"get",
|
|
348
|
+
"request",
|
|
349
|
+
]),
|
|
350
|
+
inspector: cloudflareNodeBuiltinStubSource("inspector", [
|
|
351
|
+
"Session",
|
|
352
|
+
"close",
|
|
353
|
+
"open",
|
|
354
|
+
"url",
|
|
355
|
+
"waitForDebugger",
|
|
356
|
+
]),
|
|
357
|
+
module: cloudflareNodeBuiltinStubSource(
|
|
358
|
+
"module",
|
|
359
|
+
["Module", "builtinModules", "createRequire", "syncBuiltinESMExports"],
|
|
360
|
+
[
|
|
361
|
+
"export const builtinModules = [];",
|
|
362
|
+
"export const createRequire = () => globalThis.require ?? ((specifier) => { throw new Error('Cannot require: ' + specifier); });",
|
|
363
|
+
],
|
|
364
|
+
),
|
|
365
|
+
net: cloudflareNodeBuiltinStubSource("net", [
|
|
366
|
+
"Socket",
|
|
367
|
+
"connect",
|
|
368
|
+
"createConnection",
|
|
369
|
+
"createServer",
|
|
370
|
+
]),
|
|
371
|
+
os: cloudflareNodeBuiltinStubSource(
|
|
372
|
+
"os",
|
|
373
|
+
[
|
|
374
|
+
"arch",
|
|
375
|
+
"cpus",
|
|
376
|
+
"endianness",
|
|
377
|
+
"freemem",
|
|
378
|
+
"homedir",
|
|
379
|
+
"hostname",
|
|
380
|
+
"networkInterfaces",
|
|
381
|
+
"platform",
|
|
382
|
+
"release",
|
|
383
|
+
"tmpdir",
|
|
384
|
+
"totalmem",
|
|
385
|
+
"type",
|
|
386
|
+
"userInfo",
|
|
387
|
+
],
|
|
388
|
+
[
|
|
389
|
+
'export const EOL = "\\n";',
|
|
390
|
+
'export const arch = () => "x64";',
|
|
391
|
+
"export const cpus = () => [];",
|
|
392
|
+
'export const endianness = () => "LE";',
|
|
393
|
+
"export const freemem = () => 0;",
|
|
394
|
+
'export const homedir = () => "/tmp";',
|
|
395
|
+
'export const hostname = () => "cloudflare-worker";',
|
|
396
|
+
"export const networkInterfaces = () => ({});",
|
|
397
|
+
'export const platform = () => "linux";',
|
|
398
|
+
'export const release = () => "";',
|
|
399
|
+
'export const tmpdir = () => "/tmp";',
|
|
400
|
+
"export const totalmem = () => 0;",
|
|
401
|
+
'export const type = () => "Worker";',
|
|
402
|
+
"export const userInfo = () => ({ username: 'worker', homedir: '/tmp' });",
|
|
403
|
+
],
|
|
404
|
+
),
|
|
405
|
+
readline: cloudflareNodeBuiltinStubSource("readline", [
|
|
406
|
+
"Interface",
|
|
407
|
+
"clearLine",
|
|
408
|
+
"clearScreenDown",
|
|
409
|
+
"createInterface",
|
|
410
|
+
"cursorTo",
|
|
411
|
+
"emitKeypressEvents",
|
|
412
|
+
"moveCursor",
|
|
413
|
+
]),
|
|
414
|
+
repl: cloudflareNodeBuiltinStubSource("repl", ["start"]),
|
|
415
|
+
sqlite: cloudflareNodeBuiltinStubSource("sqlite", ["DatabaseSync"]),
|
|
416
|
+
sys: cloudflareNodeBuiltinStubSource("sys", [
|
|
417
|
+
"debug",
|
|
418
|
+
"deprecate",
|
|
419
|
+
"error",
|
|
420
|
+
"inspect",
|
|
421
|
+
"log",
|
|
422
|
+
"print",
|
|
423
|
+
"puts",
|
|
424
|
+
]),
|
|
425
|
+
tls: cloudflareNodeBuiltinStubSource("tls", [
|
|
426
|
+
"TLSSocket",
|
|
427
|
+
"connect",
|
|
428
|
+
"createSecureContext",
|
|
429
|
+
"createServer",
|
|
430
|
+
]),
|
|
431
|
+
trace_events: cloudflareNodeBuiltinStubSource("trace_events", [
|
|
432
|
+
"createTracing",
|
|
433
|
+
"getEnabledCategories",
|
|
434
|
+
]),
|
|
435
|
+
tty: cloudflareNodeBuiltinStubSource("tty", [
|
|
436
|
+
"ReadStream",
|
|
437
|
+
"WriteStream",
|
|
438
|
+
"isatty",
|
|
439
|
+
]),
|
|
440
|
+
v8: cloudflareNodeBuiltinStubSource("v8", [
|
|
441
|
+
"deserialize",
|
|
442
|
+
"getHeapStatistics",
|
|
443
|
+
"serialize",
|
|
444
|
+
]),
|
|
445
|
+
vm: cloudflareNodeBuiltinStubSource("vm", [
|
|
446
|
+
"Script",
|
|
447
|
+
"compileFunction",
|
|
448
|
+
"createContext",
|
|
449
|
+
"runInContext",
|
|
450
|
+
"runInNewContext",
|
|
451
|
+
"runInThisContext",
|
|
452
|
+
]),
|
|
453
|
+
wasi: cloudflareNodeBuiltinStubSource("wasi", ["WASI"]),
|
|
454
|
+
worker_threads: cloudflareNodeBuiltinStubSource(
|
|
455
|
+
"worker_threads",
|
|
456
|
+
["MessageChannel", "MessagePort", "Worker", "isMainThread", "parentPort"],
|
|
457
|
+
["export const isMainThread = true;", "export const parentPort = null;"],
|
|
458
|
+
),
|
|
459
|
+
};
|
|
103
460
|
|
|
104
461
|
export interface GenerateWorkerEntryOptions {
|
|
105
462
|
includeReactRouterSsr?: boolean;
|
|
@@ -144,6 +501,7 @@ const NODE_ONLY_PLUGINS = new Set([
|
|
|
144
501
|
// observability there; the framework default is the Node SDK.
|
|
145
502
|
"sentry",
|
|
146
503
|
]);
|
|
504
|
+
const EDGE_SERVER_ENTRYPOINT = "@agent-native/core/server/edge";
|
|
147
505
|
|
|
148
506
|
function isNodeOnlyPlugin(filePath: string): boolean {
|
|
149
507
|
const basename = path.basename(filePath, path.extname(filePath));
|
|
@@ -155,7 +513,7 @@ export function generateProvidedPluginsNitroPluginSource(
|
|
|
155
513
|
): string {
|
|
156
514
|
const stems = [...new Set(pluginStems.filter(Boolean))].sort();
|
|
157
515
|
return `// AUTO-GENERATED by @agent-native/core deploy build
|
|
158
|
-
import { markDefaultPluginProvided } from "
|
|
516
|
+
import { markDefaultPluginProvided } from "${EDGE_SERVER_ENTRYPOINT}";
|
|
159
517
|
|
|
160
518
|
const pluginStems = ${JSON.stringify(stems)};
|
|
161
519
|
|
|
@@ -217,7 +575,7 @@ export function addImmutableAssetRouteRulesForClientBuild(
|
|
|
217
575
|
* If a workspace core is present (monorepo with `agent-native.workspaceCore`
|
|
218
576
|
* configured and the named package resolves), any plugin slot that the
|
|
219
577
|
* workspace core exports is imported from there instead of from
|
|
220
|
-
* `@agent-native/core/server`. This is the middle layer of the three-layer
|
|
578
|
+
* `@agent-native/core/server/edge`. This is the middle layer of the three-layer
|
|
221
579
|
* inheritance model: app local > workspace core > framework default.
|
|
222
580
|
*/
|
|
223
581
|
export function generateWorkerEntry(
|
|
@@ -323,11 +681,11 @@ export function generateWorkerEntry(
|
|
|
323
681
|
)};`,
|
|
324
682
|
);
|
|
325
683
|
} else {
|
|
326
|
-
// Fall back to the framework default from
|
|
684
|
+
// Fall back to the framework default from the edge-safe core entrypoint.
|
|
327
685
|
const defaultExportName = DEFAULT_PLUGIN_REGISTRY[stem];
|
|
328
686
|
if (!defaultExportName) continue;
|
|
329
687
|
pluginImports.push(
|
|
330
|
-
`import { ${defaultExportName} as ${varName} } from "
|
|
688
|
+
`import { ${defaultExportName} as ${varName} } from "${EDGE_SERVER_ENTRYPOINT}";`,
|
|
331
689
|
);
|
|
332
690
|
}
|
|
333
691
|
pluginCalls.push(` if (typeof ${varName} === "function") {
|
|
@@ -345,7 +703,7 @@ export function generateWorkerEntry(
|
|
|
345
703
|
: [];
|
|
346
704
|
if (generatedPluginMarks.length > 0) {
|
|
347
705
|
pluginImports.unshift(
|
|
348
|
-
`import { markDefaultPluginProvided as markGeneratedPluginProvided } from "
|
|
706
|
+
`import { markDefaultPluginProvided as markGeneratedPluginProvided } from "${EDGE_SERVER_ENTRYPOINT}";`,
|
|
349
707
|
);
|
|
350
708
|
}
|
|
351
709
|
|
|
@@ -1118,8 +1476,8 @@ async function buildCloudflarePages() {
|
|
|
1118
1476
|
// Exclude _worker.js from being served as a public asset
|
|
1119
1477
|
fs.writeFileSync(path.join(distDir, ".assetsignore"), "_worker.js\n");
|
|
1120
1478
|
|
|
1121
|
-
// Write
|
|
1122
|
-
//
|
|
1479
|
+
// Write package metadata inside _worker.js/ for the ES module worker that
|
|
1480
|
+
// Wrangler compiles and uploads for Cloudflare Pages.
|
|
1123
1481
|
fs.mkdirSync(path.join(distDir, "_worker.js"), { recursive: true });
|
|
1124
1482
|
fs.writeFileSync(
|
|
1125
1483
|
path.join(distDir, "_worker.js", "package.json"),
|
|
@@ -1221,27 +1579,35 @@ async function buildCloudflarePages() {
|
|
|
1221
1579
|
// Create stub modules for native/Node-only deps that can't run on Workers.
|
|
1222
1580
|
// These get resolved by esbuild instead of the real modules, avoiding bundling
|
|
1223
1581
|
// 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
1582
|
const stubDir = path.join(tmpDir, "node_modules");
|
|
1233
|
-
for (const mod of
|
|
1583
|
+
for (const [mod, source] of Object.entries(CLOUDFLARE_WORKER_STUB_MODULES)) {
|
|
1234
1584
|
const modDir = path.join(stubDir, mod);
|
|
1235
1585
|
fs.mkdirSync(modDir, { recursive: true });
|
|
1236
|
-
fs.writeFileSync(
|
|
1237
|
-
path.join(modDir, "index.js"),
|
|
1238
|
-
`export default {}; export const watch = () => ({ close() {} });`,
|
|
1239
|
-
);
|
|
1586
|
+
fs.writeFileSync(path.join(modDir, "index.js"), source);
|
|
1240
1587
|
fs.writeFileSync(
|
|
1241
1588
|
path.join(modDir, "package.json"),
|
|
1242
1589
|
JSON.stringify({ name: mod, main: "index.js", type: "module" }),
|
|
1243
1590
|
);
|
|
1244
1591
|
}
|
|
1592
|
+
const stubAliases = Object.keys(CLOUDFLARE_WORKER_STUB_MODULES).map(
|
|
1593
|
+
(mod) => `--alias:${mod}=${path.join(stubDir, mod, "index.js")}`,
|
|
1594
|
+
);
|
|
1595
|
+
const nodeBuiltinStubDir = path.join(tmpDir, "node-builtin-stubs");
|
|
1596
|
+
fs.mkdirSync(nodeBuiltinStubDir, { recursive: true });
|
|
1597
|
+
const nodeBuiltinStubAliases: string[] = [];
|
|
1598
|
+
for (const [mod, source] of Object.entries(
|
|
1599
|
+
CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES,
|
|
1600
|
+
).sort(([a], [b]) => b.length - a.length)) {
|
|
1601
|
+
const stubFile = path.join(
|
|
1602
|
+
nodeBuiltinStubDir,
|
|
1603
|
+
`${mod.replace(/\W+/g, "_")}.js`,
|
|
1604
|
+
);
|
|
1605
|
+
fs.writeFileSync(stubFile, source);
|
|
1606
|
+
nodeBuiltinStubAliases.push(
|
|
1607
|
+
`--alias:${mod}=${stubFile}`,
|
|
1608
|
+
`--alias:node:${mod}=${stubFile}`,
|
|
1609
|
+
);
|
|
1610
|
+
}
|
|
1245
1611
|
|
|
1246
1612
|
const esbuildBin = findEsbuild();
|
|
1247
1613
|
|
|
@@ -1257,8 +1623,17 @@ async function buildCloudflarePages() {
|
|
|
1257
1623
|
// Only externalize bare names. node:* externals would otherwise pin
|
|
1258
1624
|
// the prefix in output; instead we alias node:* → bare so anything that
|
|
1259
1625
|
// resolves past alias land as bare externals.
|
|
1260
|
-
const
|
|
1261
|
-
|
|
1626
|
+
const nodeBuiltinStubs = new Set(
|
|
1627
|
+
Object.keys(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES),
|
|
1628
|
+
);
|
|
1629
|
+
const nodeExternals = builtinNames
|
|
1630
|
+
.filter((n) => !nodeBuiltinStubs.has(n))
|
|
1631
|
+
.sort((a, b) => b.length - a.length)
|
|
1632
|
+
.map((n) => `--external:${n}`);
|
|
1633
|
+
const nodeAliases = builtinNames
|
|
1634
|
+
.filter((n) => !nodeBuiltinStubs.has(n))
|
|
1635
|
+
.sort((a, b) => b.length - a.length)
|
|
1636
|
+
.map((n) => `--alias:node:${n}=${n}`);
|
|
1262
1637
|
|
|
1263
1638
|
// Hard externalize large client-only / node-only libraries so they don't
|
|
1264
1639
|
// bloat the edge worker. These are never executed in the CF Pages runtime
|
|
@@ -1271,9 +1646,9 @@ async function buildCloudflarePages() {
|
|
|
1271
1646
|
// files. Both import sites degrade gracefully when the runtime import
|
|
1272
1647
|
// fails: context-xray token counts fall back to char/4 estimates and the
|
|
1273
1648
|
// OG image route falls back to SVG.
|
|
1274
|
-
const heavyClientExternals = CLOUDFLARE_WORKER_ESBUILD_EXTERNALS.
|
|
1275
|
-
(p) =>
|
|
1276
|
-
);
|
|
1649
|
+
const heavyClientExternals = CLOUDFLARE_WORKER_ESBUILD_EXTERNALS.filter(
|
|
1650
|
+
(p) => !Object.hasOwn(CLOUDFLARE_WORKER_STUB_MODULES, p),
|
|
1651
|
+
).map((p) => `--external:${p}`);
|
|
1277
1652
|
|
|
1278
1653
|
execFileSync(
|
|
1279
1654
|
esbuildBin,
|
|
@@ -1302,6 +1677,8 @@ async function buildCloudflarePages() {
|
|
|
1302
1677
|
// Externalize node: builtins — CF Workers runtime provides them
|
|
1303
1678
|
...nodeExternals,
|
|
1304
1679
|
...heavyClientExternals,
|
|
1680
|
+
...stubAliases,
|
|
1681
|
+
...nodeBuiltinStubAliases,
|
|
1305
1682
|
// Rewrite node:* -> bare names so chunks never contain node: imports
|
|
1306
1683
|
...nodeAliases,
|
|
1307
1684
|
],
|
|
@@ -1420,6 +1797,7 @@ const NODE_BUILTINS = [
|
|
|
1420
1797
|
"dgram",
|
|
1421
1798
|
"diagnostics_channel",
|
|
1422
1799
|
"dns",
|
|
1800
|
+
"dns/promises",
|
|
1423
1801
|
"domain",
|
|
1424
1802
|
"events",
|
|
1425
1803
|
"fs",
|
|
@@ -1465,22 +1843,14 @@ export function getNodeBuiltinNames(): string[] {
|
|
|
1465
1843
|
* Injected via esbuild --inject so CJS deps work on Workers runtime.
|
|
1466
1844
|
*/
|
|
1467
1845
|
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");
|
|
1846
|
+
// Shim Node builtins that Cloudflare Pages can import, and return lazy
|
|
1847
|
+
// unavailable proxies for builtins that Pages Functions reject at upload
|
|
1848
|
+
// time (child_process, fs, net, etc.). This lets optional Node-only code stay
|
|
1849
|
+
// present in the shared bundle without making worker initialization fail.
|
|
1850
|
+
const stubbed = new Set(
|
|
1851
|
+
Object.keys(CLOUDFLARE_WORKER_NODE_BUILTIN_STUB_MODULES),
|
|
1852
|
+
);
|
|
1853
|
+
const shimmed = NODE_BUILTINS.filter((name) => !stubbed.has(name));
|
|
1484
1854
|
|
|
1485
1855
|
// Bare module names — CF Pages Functions runs under nodejs_compat v1,
|
|
1486
1856
|
// which rejects "node:fs" and only accepts "fs". The post-build pass in
|
|
@@ -1498,9 +1868,14 @@ function generateRequireShim(): string {
|
|
|
1498
1868
|
const entries = shimmed
|
|
1499
1869
|
.map((m) => `"${m}":__${m.replace("/", "_")}`)
|
|
1500
1870
|
.join(",");
|
|
1871
|
+
const stubEntries = Array.from(stubbed)
|
|
1872
|
+
.sort()
|
|
1873
|
+
.map((m) => `"${m}":__unavailable("${m}")`)
|
|
1874
|
+
.join(",");
|
|
1875
|
+
const allEntries = [entries, stubEntries].filter(Boolean).join(",");
|
|
1501
1876
|
|
|
1502
1877
|
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={${
|
|
1878
|
+
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
1879
|
}
|
|
1505
1880
|
|
|
1506
1881
|
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",
|