@agent-native/core 0.112.0 → 0.114.0
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/agent-native.eject.json +164 -0
- package/corpus/README.md +4 -2
- package/corpus/core/CHANGELOG.md +33 -0
- package/corpus/core/README.md +61 -174
- package/corpus/core/agent-native.eject.json +164 -0
- package/corpus/core/docs/AGENTS.md +7 -0
- package/corpus/core/docs/content/agent-native-toolkit.mdx +38 -0
- package/corpus/core/docs/content/integrations.mdx +63 -2
- package/corpus/core/docs/content/package-lifecycle.mdx +54 -4
- package/corpus/core/docs/design/provider-integration-authority.md +117 -0
- package/corpus/core/package.json +20 -2
- package/corpus/core/scripts/materialize-source-corpus.mjs +9 -2
- package/corpus/core/src/cli/atomic-json-file.ts +324 -0
- package/corpus/core/src/cli/claude-code-participant.ts +515 -0
- package/corpus/core/src/cli/code-agent-executor.ts +18 -10
- package/corpus/core/src/cli/code-agent-runs.concurrent-worker.ts +33 -0
- package/corpus/core/src/cli/code-agent-runs.ts +55 -62
- package/corpus/core/src/cli/codex-cli-participant.ts +496 -0
- package/corpus/core/src/cli/eject.ts +1594 -0
- package/corpus/core/src/cli/index.ts +16 -0
- package/corpus/core/src/cli/multi-frontier-runs.ts +1246 -135
- package/corpus/core/src/client/chat/ChatHistoryList.tsx +7 -404
- package/corpus/core/src/client/index.ts +4 -0
- package/corpus/core/src/client/resources/McpConnectionSuggestion.tsx +8 -2
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +7 -2
- package/corpus/core/src/client/resources/ResourcesPanel.tsx +17 -3
- package/corpus/core/src/client/resources/index.ts +19 -0
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +9 -1
- package/corpus/core/src/client/resources/runtime.ts +1 -0
- package/corpus/core/src/client/setup-connections/catalog.ts +6 -0
- package/corpus/core/src/client/setup-connections/index.ts +1 -0
- package/corpus/core/src/client/setup-connections/runtime.ts +1 -0
- package/corpus/core/src/connections/catalog.ts +41 -24
- package/corpus/core/src/connections/index.ts +1 -0
- package/corpus/core/src/connections/runtime.ts +1 -0
- package/corpus/core/src/eject/provider-api-definitions.ts +193 -0
- package/corpus/core/src/eject/remote-mcp-presets.ts +137 -0
- package/corpus/core/src/eject/setup-readiness-ui.tsx +29 -0
- package/corpus/core/src/eject/workspace-connections.ts +92 -0
- package/corpus/core/src/index.ts +1 -0
- package/corpus/core/src/integrations/adapter-overrides.ts +12 -0
- package/corpus/core/src/integrations/eject/messaging-adapters.ts +85 -0
- package/corpus/core/src/integrations/index.ts +15 -1
- package/corpus/core/src/integrations/plugin.ts +34 -12
- package/corpus/core/src/integrations/runtime.ts +1 -0
- package/corpus/core/src/integrations/slack-oauth.ts +1 -0
- package/corpus/core/src/integrations/types.ts +3 -1
- package/corpus/core/src/integrations/webhook-delivery.ts +55 -0
- package/corpus/core/src/notifications/channels.ts +4 -10
- package/corpus/core/src/package-lifecycle/eject-manifest.ts +345 -0
- package/corpus/core/src/package-lifecycle/index.ts +1 -0
- package/corpus/core/src/provider-api/actions/custom-provider-registration.ts +197 -0
- package/corpus/core/src/provider-api/actions/delete-staged-dataset.ts +3 -42
- package/corpus/core/src/provider-api/actions/list-staged-datasets.ts +3 -45
- package/corpus/core/src/provider-api/actions/provider-api-audit.ts +88 -0
- package/corpus/core/src/provider-api/actions/provider-api.ts +460 -0
- package/corpus/core/src/provider-api/actions/query-staged-dataset.ts +3 -140
- package/corpus/core/src/provider-api/actions/staged-datasets.ts +359 -0
- package/corpus/core/src/provider-api/gong.ts +108 -0
- package/corpus/core/src/provider-api/index.ts +46 -12
- package/corpus/core/src/provider-api/runtime.ts +1 -0
- package/corpus/core/src/scripts/docs/source-search.ts +2 -1
- package/corpus/core/src/server/google-oauth-credentials.ts +80 -3
- package/corpus/core/src/server/index.ts +6 -0
- package/corpus/core/src/setup-connections/index.ts +1 -0
- package/corpus/core/src/shared/merge-by-id.ts +14 -0
- package/corpus/core/src/styles/chat-history-list.css +1 -313
- package/corpus/core/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/core/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/corpus/core/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/core/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/corpus/core/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/corpus/core/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/corpus/core/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/core/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/default/AGENTS.md +26 -18
- package/corpus/core/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/corpus/core/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/corpus/core/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/core/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/corpus/core/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/corpus/core/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/headless/AGENTS.md +8 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/corpus/core/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +7 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/core/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/core/src/templates/workspace-core/AGENTS.md +4 -0
- package/corpus/core/src/templates/workspace-root/AGENTS.md +4 -0
- package/corpus/core/src/vite/client.ts +25 -2
- package/corpus/templates/analytics/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/analytics/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/analytics/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/analytics/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/analytics/actions/delete-staged-dataset.ts +3 -23
- package/corpus/templates/analytics/actions/list-staged-datasets.ts +3 -27
- package/corpus/templates/analytics/actions/provider-api-catalog.ts +16 -19
- package/corpus/templates/analytics/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/analytics/actions/provider-api-request.ts +162 -185
- package/corpus/templates/analytics/actions/query-staged-dataset.ts +3 -47
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +52 -161
- package/corpus/templates/assets/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/assets/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/assets/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/assets/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +63 -160
- package/corpus/templates/brain/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/brain/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/brain/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/brain/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/brain/actions/_schemas.ts +13 -7
- package/corpus/templates/brain/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/brain/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/brain/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/brain/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/brain/actions/provider-api-request.ts +3 -37
- package/corpus/templates/brain/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/brain/actions/remediate-legacy-capture-audiences.ts +167 -0
- package/corpus/templates/brain/actions/update-source.ts +5 -1
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +48 -154
- package/corpus/templates/brain/app/lib/brain-chat-readiness.ts +6 -0
- package/corpus/templates/brain/app/lib/brain.ts +55 -0
- package/corpus/templates/brain/app/lib/ingest-handoff.ts +35 -0
- package/corpus/templates/brain/app/routes/_index.tsx +8 -0
- package/corpus/templates/brain/app/routes.ts +1 -0
- package/corpus/templates/brain/changelog/2026-07-19-ask-starts-immediately-when-builder-s-managed-ai-connection-.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-and-granola-backfills-now-process-captures-concurrentl.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-can-now-join-configured-public-channels-befo.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-continue-across-the-configured-number-of.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-slack-backfills-now-start-with-a-safe-four-week-window-and-r.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-source-review-settings-now-control-knowledge-approval.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-19-the-manage-agent-page-now-opens-correctly-from-brain-navigat.md +6 -0
- package/corpus/templates/brain/server/db/schema.ts +3 -0
- package/corpus/templates/brain/server/lib/brain.ts +41 -2
- package/corpus/templates/brain/server/lib/connectors.ts +432 -115
- package/corpus/templates/brain/server/lib/meeting-audience.ts +38 -0
- package/corpus/templates/brain/server/lib/slack-channel-membership.ts +44 -0
- package/corpus/templates/brain/server/plugins/db.ts +10 -0
- package/corpus/templates/brain/server/routes/api/_agent-native/brain/ingest.post.ts +6 -4
- package/corpus/templates/brain/shared/slack-source-config.ts +60 -0
- package/corpus/templates/calendar/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/calendar/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/calendar/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/calendar/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/calendar/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/calendar/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/calendar/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/calendar/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/calendar/actions/provider-api-request.ts +3 -37
- package/corpus/templates/calendar/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/calendar/server/handlers/gong.ts +6 -61
- package/corpus/templates/calendar/server/handlers/google-auth.ts +10 -8
- package/corpus/templates/calendar/server/lib/google-calendar.ts +7 -45
- package/corpus/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/chat/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/corpus/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/chat/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/chat/AGENTS.md +6 -2
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/corpus/templates/clips/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/clips/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/clips/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/clips/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/clips/AGENTS.md +11 -0
- package/corpus/templates/clips/actions/export-to-brain.ts +505 -171
- package/corpus/templates/clips/changelog/2026-07-19-ready-clips-transcripts-can-be-backfilled-to-brain-for-a-bou.md +6 -0
- package/corpus/templates/clips/server/lib/calendar-event-meetings.ts +1 -1
- package/corpus/templates/clips/server/lib/google-calendar-client.ts +12 -22
- package/corpus/templates/clips/server/lib/google-calendar-oauth.ts +9 -6
- package/corpus/templates/clips/server/lib/slack-oauth.ts +12 -47
- package/corpus/templates/clips/server/routes/_agent-native/google/auth-url.get.ts +2 -6
- package/corpus/templates/clips/server/routes/api/auth/google-calendar.get.ts +4 -4
- package/corpus/templates/content/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/content/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/content/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/content/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/content/actions/delete-staged-dataset.ts +3 -24
- package/corpus/templates/content/actions/list-staged-datasets.ts +3 -28
- package/corpus/templates/content/actions/provider-api-catalog.ts +5 -11
- package/corpus/templates/content/actions/provider-api-docs.ts +3 -5
- package/corpus/templates/content/actions/provider-api-request.ts +3 -37
- package/corpus/templates/content/actions/query-staged-dataset.ts +3 -48
- package/corpus/templates/design/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/design/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/design/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/design/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/design/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/design/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/design/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/design/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/design/actions/provider-api-request.ts +140 -164
- package/corpus/templates/design/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/dispatch/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/dispatch/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/dispatch/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/dispatch/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/dispatch/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/dispatch/actions/list-staged-datasets.ts +4 -30
- package/corpus/templates/dispatch/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/dispatch/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/dispatch/actions/provider-api-request.ts +138 -163
- package/corpus/templates/dispatch/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/forms/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/forms/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/forms/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/forms/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/forms/server/lib/integrations.ts +23 -22
- package/corpus/templates/macros/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/macros/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/mail/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/mail/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/mail/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/mail/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/mail/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/mail/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/mail/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/mail/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/mail/actions/provider-api-request.ts +146 -173
- package/corpus/templates/mail/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/mail/server/handlers/gong.ts +6 -61
- package/corpus/templates/mail/server/lib/google-auth.ts +10 -13
- package/corpus/templates/plan/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/plan/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/plan/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/plan/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +47 -156
- package/corpus/templates/slides/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/slides/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/slides/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/slides/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/templates/slides/actions/delete-staged-dataset.ts +4 -23
- package/corpus/templates/slides/actions/list-staged-datasets.ts +4 -27
- package/corpus/templates/slides/actions/provider-api-catalog.ts +15 -18
- package/corpus/templates/slides/actions/provider-api-docs.ts +57 -48
- package/corpus/templates/slides/actions/provider-api-request.ts +145 -172
- package/corpus/templates/slides/actions/query-staged-dataset.ts +4 -47
- package/corpus/templates/slides/server/lib/google-docs-oauth.ts +11 -36
- package/corpus/templates/tasks/.agents/skills/actions/SKILL.md +32 -12
- package/corpus/templates/tasks/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/corpus/templates/tasks/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/corpus/templates/tasks/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/corpus/templates/tasks/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/corpus/toolkit/CHANGELOG.md +131 -0
- package/corpus/toolkit/README.md +60 -0
- package/corpus/toolkit/agent-native.eject.json +411 -0
- package/corpus/toolkit/export-snapshot.json +35 -0
- package/corpus/toolkit/migration-manifest.json +4 -0
- package/corpus/toolkit/package.json +284 -0
- package/corpus/toolkit/scripts/finalize-build.mjs +55 -0
- package/corpus/toolkit/src/app-shell/header-actions.tsx +84 -0
- package/corpus/toolkit/src/app-shell/index.ts +1 -0
- package/corpus/toolkit/src/chat-history/ChatHistoryList.tsx +469 -0
- package/corpus/toolkit/src/chat-history/index.ts +7 -0
- package/corpus/toolkit/src/chat-history.css +314 -0
- package/corpus/toolkit/src/collab-ui/AgentPresenceChip.tsx +69 -0
- package/corpus/toolkit/src/collab-ui/LiveCursorOverlay.tsx +241 -0
- package/corpus/toolkit/src/collab-ui/PresenceBar.tsx +346 -0
- package/corpus/toolkit/src/collab-ui/RecentEditHighlights.tsx +225 -0
- package/corpus/toolkit/src/collab-ui/RemoteSelectionRings.tsx +227 -0
- package/corpus/toolkit/src/collab-ui/agent-identity.ts +16 -0
- package/corpus/toolkit/src/collab-ui/index.ts +39 -0
- package/corpus/toolkit/src/collab-ui/lead-client.ts +32 -0
- package/corpus/toolkit/src/collab-ui/types.ts +96 -0
- package/corpus/toolkit/src/composer/AgentComposerFrame.tsx +59 -0
- package/corpus/toolkit/src/composer/ComposerPlusMenu.tsx +983 -0
- package/corpus/toolkit/src/composer/MentionPopover.tsx +412 -0
- package/corpus/toolkit/src/composer/PastedTextChip.tsx +150 -0
- package/corpus/toolkit/src/composer/PromptComposer.tsx +718 -0
- package/corpus/toolkit/src/composer/RealtimeVoiceMode.tsx +856 -0
- package/corpus/toolkit/src/composer/TiptapComposer.tsx +2936 -0
- package/corpus/toolkit/src/composer/VoiceButton.tsx +255 -0
- package/corpus/toolkit/src/composer/asset-picker-url.ts +80 -0
- package/corpus/toolkit/src/composer/attachment-accept.ts +71 -0
- package/corpus/toolkit/src/composer/draft-key.ts +7 -0
- package/corpus/toolkit/src/composer/extensions/FileReference.tsx +55 -0
- package/corpus/toolkit/src/composer/extensions/MentionReference.tsx +93 -0
- package/corpus/toolkit/src/composer/extensions/SkillReference.tsx +56 -0
- package/corpus/toolkit/src/composer/index.ts +79 -0
- package/corpus/toolkit/src/composer/pasted-text.ts +160 -0
- package/corpus/toolkit/src/composer/prompt-attachments.ts +93 -0
- package/corpus/toolkit/src/composer/realtime-voice-audio-level.ts +64 -0
- package/corpus/toolkit/src/composer/realtime-voice-transcript.ts +134 -0
- package/corpus/toolkit/src/composer/runtime-adapters.tsx +343 -0
- package/corpus/toolkit/src/composer/types.ts +66 -0
- package/corpus/toolkit/src/composer/use-file-search.ts +64 -0
- package/corpus/toolkit/src/composer/use-mention-search.ts +90 -0
- package/corpus/toolkit/src/composer/use-skills.ts +45 -0
- package/corpus/toolkit/src/composer/useRealtimeVoiceMode.tsx +2117 -0
- package/corpus/toolkit/src/composer/useVoiceDictation.ts +1191 -0
- package/corpus/toolkit/src/context-ui/ContextMeter.tsx +101 -0
- package/corpus/toolkit/src/context-ui/ContextSegmentRow.tsx +184 -0
- package/corpus/toolkit/src/context-ui/ContextTreemap.tsx +125 -0
- package/corpus/toolkit/src/context-ui/ContextXRayPanel.tsx +377 -0
- package/corpus/toolkit/src/context-ui/format.ts +42 -0
- package/corpus/toolkit/src/context-ui/index.ts +15 -0
- package/corpus/toolkit/src/context-ui/types.ts +43 -0
- package/corpus/toolkit/src/design-tweaks/index.ts +1 -0
- package/corpus/toolkit/src/design-tweaks/visual-style-controls.tsx +1084 -0
- package/corpus/toolkit/src/editor/BubbleToolbar.tsx +253 -0
- package/corpus/toolkit/src/editor/CodeBlockNode.tsx +254 -0
- package/corpus/toolkit/src/editor/DragHandle.ts +1437 -0
- package/corpus/toolkit/src/editor/ImageExtension.ts +306 -0
- package/corpus/toolkit/src/editor/RegistryBlockContext.tsx +107 -0
- package/corpus/toolkit/src/editor/RegistryBlockNode.tsx +652 -0
- package/corpus/toolkit/src/editor/RichMarkdownEditor.tsx +81 -0
- package/corpus/toolkit/src/editor/RunId.ts +61 -0
- package/corpus/toolkit/src/editor/SharedRichEditor.tsx +321 -0
- package/corpus/toolkit/src/editor/SlashCommandMenu.tsx +310 -0
- package/corpus/toolkit/src/editor/extensions.ts +402 -0
- package/corpus/toolkit/src/editor/gfmDoc.ts +92 -0
- package/corpus/toolkit/src/editor/index.ts +93 -0
- package/corpus/toolkit/src/editor/registrySlashCommands.ts +131 -0
- package/corpus/toolkit/src/editor/surgical-apply.ts +192 -0
- package/corpus/toolkit/src/editor/useCollabReconcile.ts +589 -0
- package/corpus/toolkit/src/editor.css +510 -0
- package/corpus/toolkit/src/hooks/index.ts +2 -0
- package/corpus/toolkit/src/hooks/use-mobile.tsx +21 -0
- package/corpus/toolkit/src/hooks/use-toast.ts +188 -0
- package/corpus/toolkit/src/index.ts +8 -0
- package/corpus/toolkit/src/onboarding/index.ts +1 -0
- package/corpus/toolkit/src/provider.tsx +47 -0
- package/corpus/toolkit/src/sharing/VisibilityBadge.tsx +37 -0
- package/corpus/toolkit/src/sharing/index.ts +4 -0
- package/corpus/toolkit/src/styles.css +21 -0
- package/corpus/toolkit/src/ui/accordion.tsx +56 -0
- package/corpus/toolkit/src/ui/alert-dialog.tsx +141 -0
- package/corpus/toolkit/src/ui/alert.tsx +59 -0
- package/corpus/toolkit/src/ui/aspect-ratio.tsx +5 -0
- package/corpus/toolkit/src/ui/avatar.tsx +48 -0
- package/corpus/toolkit/src/ui/badge.tsx +37 -0
- package/corpus/toolkit/src/ui/breadcrumb.tsx +115 -0
- package/corpus/toolkit/src/ui/button.tsx +78 -0
- package/corpus/toolkit/src/ui/calendar.tsx +214 -0
- package/corpus/toolkit/src/ui/card.tsx +86 -0
- package/corpus/toolkit/src/ui/carousel.tsx +260 -0
- package/corpus/toolkit/src/ui/chart.tsx +375 -0
- package/corpus/toolkit/src/ui/checkbox.tsx +28 -0
- package/corpus/toolkit/src/ui/collapsible.tsx +9 -0
- package/corpus/toolkit/src/ui/command.tsx +174 -0
- package/corpus/toolkit/src/ui/context-menu.tsx +202 -0
- package/corpus/toolkit/src/ui/date-picker.tsx +64 -0
- package/corpus/toolkit/src/ui/dialog.tsx +146 -0
- package/corpus/toolkit/src/ui/drawer.tsx +126 -0
- package/corpus/toolkit/src/ui/dropdown-menu.tsx +218 -0
- package/corpus/toolkit/src/ui/form.tsx +177 -0
- package/corpus/toolkit/src/ui/hover-card.tsx +27 -0
- package/corpus/toolkit/src/ui/index.ts +52 -0
- package/corpus/toolkit/src/ui/input-otp.tsx +69 -0
- package/corpus/toolkit/src/ui/input.tsx +22 -0
- package/corpus/toolkit/src/ui/label.tsx +24 -0
- package/corpus/toolkit/src/ui/logo.tsx +36 -0
- package/corpus/toolkit/src/ui/menubar.tsx +235 -0
- package/corpus/toolkit/src/ui/navigation-menu.tsx +128 -0
- package/corpus/toolkit/src/ui/pagination.tsx +121 -0
- package/corpus/toolkit/src/ui/popover.tsx +44 -0
- package/corpus/toolkit/src/ui/progress.tsx +26 -0
- package/corpus/toolkit/src/ui/radio-group.tsx +42 -0
- package/corpus/toolkit/src/ui/resizable.tsx +43 -0
- package/corpus/toolkit/src/ui/scroll-area.tsx +46 -0
- package/corpus/toolkit/src/ui/select.tsx +158 -0
- package/corpus/toolkit/src/ui/separator.tsx +29 -0
- package/corpus/toolkit/src/ui/sheet.tsx +160 -0
- package/corpus/toolkit/src/ui/sidebar.tsx +777 -0
- package/corpus/toolkit/src/ui/skeleton.tsx +18 -0
- package/corpus/toolkit/src/ui/slider.tsx +26 -0
- package/corpus/toolkit/src/ui/sonner.tsx +58 -0
- package/corpus/toolkit/src/ui/spinner.tsx +17 -0
- package/corpus/toolkit/src/ui/switch.tsx +27 -0
- package/corpus/toolkit/src/ui/table.tsx +117 -0
- package/corpus/toolkit/src/ui/tabs.tsx +53 -0
- package/corpus/toolkit/src/ui/textarea.tsx +23 -0
- package/corpus/toolkit/src/ui/toast.tsx +127 -0
- package/corpus/toolkit/src/ui/toaster.tsx +33 -0
- package/corpus/toolkit/src/ui/toggle-group.tsx +59 -0
- package/corpus/toolkit/src/ui/toggle.tsx +43 -0
- package/corpus/toolkit/src/ui/tooltip.tsx +53 -0
- package/corpus/toolkit/src/ui/use-toast.ts +3 -0
- package/corpus/toolkit/src/utils.ts +8 -0
- package/corpus/toolkit/tsconfig.json +23 -0
- package/dist/cli/atomic-json-file.d.ts +30 -0
- package/dist/cli/atomic-json-file.d.ts.map +1 -0
- package/dist/cli/atomic-json-file.js +240 -0
- package/dist/cli/atomic-json-file.js.map +1 -0
- package/dist/cli/claude-code-participant.d.ts +77 -0
- package/dist/cli/claude-code-participant.d.ts.map +1 -0
- package/dist/cli/claude-code-participant.js +355 -0
- package/dist/cli/claude-code-participant.js.map +1 -0
- package/dist/cli/code-agent-executor.d.ts.map +1 -1
- package/dist/cli/code-agent-executor.js +18 -10
- package/dist/cli/code-agent-executor.js.map +1 -1
- package/dist/cli/code-agent-runs.concurrent-worker.d.ts +2 -0
- package/dist/cli/code-agent-runs.concurrent-worker.d.ts.map +1 -0
- package/dist/cli/code-agent-runs.concurrent-worker.js +32 -0
- package/dist/cli/code-agent-runs.concurrent-worker.js.map +1 -0
- package/dist/cli/code-agent-runs.d.ts.map +1 -1
- package/dist/cli/code-agent-runs.js +43 -56
- package/dist/cli/code-agent-runs.js.map +1 -1
- package/dist/cli/codex-cli-participant.d.ts +77 -0
- package/dist/cli/codex-cli-participant.d.ts.map +1 -0
- package/dist/cli/codex-cli-participant.js +354 -0
- package/dist/cli/codex-cli-participant.js.map +1 -0
- package/dist/cli/eject.d.ts +21 -0
- package/dist/cli/eject.d.ts.map +1 -0
- package/dist/cli/eject.js +1145 -0
- package/dist/cli/eject.js.map +1 -0
- package/dist/cli/index.js +15 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/multi-frontier-runs.d.ts +115 -0
- package/dist/cli/multi-frontier-runs.d.ts.map +1 -1
- package/dist/cli/multi-frontier-runs.js +831 -113
- package/dist/cli/multi-frontier-runs.js.map +1 -1
- package/dist/client/chat/ChatHistoryList.d.ts +1 -87
- package/dist/client/chat/ChatHistoryList.d.ts.map +1 -1
- package/dist/client/chat/ChatHistoryList.js +1 -82
- package/dist/client/chat/ChatHistoryList.js.map +1 -1
- package/dist/client/index.d.ts +1 -1
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/index.js.map +1 -1
- package/dist/client/resources/McpConnectionSuggestion.d.ts +4 -3
- package/dist/client/resources/McpConnectionSuggestion.d.ts.map +1 -1
- package/dist/client/resources/McpConnectionSuggestion.js +3 -3
- package/dist/client/resources/McpConnectionSuggestion.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts +4 -3
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +2 -2
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts +4 -1
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +9 -7
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/resources/index.d.ts +3 -0
- package/dist/client/resources/index.d.ts.map +1 -1
- package/dist/client/resources/index.js +3 -0
- package/dist/client/resources/index.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +2 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +6 -2
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/resources/runtime.d.ts +2 -0
- package/dist/client/resources/runtime.d.ts.map +1 -0
- package/dist/client/resources/runtime.js +2 -0
- package/dist/client/resources/runtime.js.map +1 -0
- package/dist/client/setup-connections/catalog.d.ts +2 -0
- package/dist/client/setup-connections/catalog.d.ts.map +1 -0
- package/dist/client/setup-connections/catalog.js +7 -0
- package/dist/client/setup-connections/catalog.js.map +1 -0
- package/dist/client/setup-connections/index.d.ts +1 -0
- package/dist/client/setup-connections/index.d.ts.map +1 -1
- package/dist/client/setup-connections/index.js +1 -0
- package/dist/client/setup-connections/index.js.map +1 -1
- package/dist/client/setup-connections/runtime.d.ts +2 -0
- package/dist/client/setup-connections/runtime.d.ts.map +1 -0
- package/dist/client/setup-connections/runtime.js +2 -0
- package/dist/client/setup-connections/runtime.js.map +1 -0
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/connections/catalog.d.ts +5 -3
- package/dist/connections/catalog.d.ts.map +1 -1
- package/dist/connections/catalog.js +16 -8
- package/dist/connections/catalog.js.map +1 -1
- package/dist/connections/index.d.ts +1 -1
- package/dist/connections/index.d.ts.map +1 -1
- package/dist/connections/index.js +1 -1
- package/dist/connections/index.js.map +1 -1
- package/dist/connections/runtime.d.ts +2 -0
- package/dist/connections/runtime.d.ts.map +1 -0
- package/dist/connections/runtime.js +2 -0
- package/dist/connections/runtime.js.map +1 -0
- package/dist/eject/provider-api-definitions.d.ts +34 -0
- package/dist/eject/provider-api-definitions.d.ts.map +1 -0
- package/dist/eject/provider-api-definitions.js +88 -0
- package/dist/eject/provider-api-definitions.js.map +1 -0
- package/dist/eject/remote-mcp-presets.d.ts +17 -0
- package/dist/eject/remote-mcp-presets.d.ts.map +1 -0
- package/dist/eject/remote-mcp-presets.js +81 -0
- package/dist/eject/remote-mcp-presets.js.map +1 -0
- package/dist/eject/setup-readiness-ui.d.ts +7 -0
- package/dist/eject/setup-readiness-ui.d.ts.map +1 -0
- package/dist/eject/setup-readiness-ui.js +13 -0
- package/dist/eject/setup-readiness-ui.js.map +1 -0
- package/dist/eject/workspace-connections.d.ts +11 -0
- package/dist/eject/workspace-connections.d.ts.map +1 -0
- package/dist/eject/workspace-connections.js +47 -0
- package/dist/eject/workspace-connections.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/adapter-overrides.d.ts +3 -0
- package/dist/integrations/adapter-overrides.d.ts.map +1 -0
- package/dist/integrations/adapter-overrides.js +7 -0
- package/dist/integrations/adapter-overrides.js.map +1 -0
- package/dist/integrations/eject/messaging-adapters.d.ts +12 -0
- package/dist/integrations/eject/messaging-adapters.d.ts.map +1 -0
- package/dist/integrations/eject/messaging-adapters.js +49 -0
- package/dist/integrations/eject/messaging-adapters.js.map +1 -0
- package/dist/integrations/index.d.ts +5 -3
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +4 -2
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/plugin.d.ts +32 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +19 -12
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/runtime.d.ts +2 -0
- package/dist/integrations/runtime.d.ts.map +1 -0
- package/dist/integrations/runtime.js +2 -0
- package/dist/integrations/runtime.js.map +1 -0
- package/dist/integrations/slack-manifest.d.ts +1 -1
- package/dist/integrations/slack-oauth.d.ts +1 -1
- package/dist/integrations/slack-oauth.d.ts.map +1 -1
- package/dist/integrations/slack-oauth.js +1 -0
- package/dist/integrations/slack-oauth.js.map +1 -1
- package/dist/integrations/types.d.ts +3 -1
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/integrations/webhook-delivery.d.ts +23 -0
- package/dist/integrations/webhook-delivery.d.ts.map +1 -0
- package/dist/integrations/webhook-delivery.js +32 -0
- package/dist/integrations/webhook-delivery.js.map +1 -0
- package/dist/notifications/channels.d.ts.map +1 -1
- package/dist/notifications/channels.js +4 -9
- package/dist/notifications/channels.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/package-lifecycle/eject-manifest.d.ts +43 -0
- package/dist/package-lifecycle/eject-manifest.d.ts.map +1 -0
- package/dist/package-lifecycle/eject-manifest.js +219 -0
- package/dist/package-lifecycle/eject-manifest.js.map +1 -0
- package/dist/package-lifecycle/index.d.ts +1 -0
- package/dist/package-lifecycle/index.d.ts.map +1 -1
- package/dist/package-lifecycle/index.js +1 -0
- package/dist/package-lifecycle/index.js.map +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +136 -0
- package/dist/provider-api/actions/custom-provider-registration.d.ts.map +1 -0
- package/dist/provider-api/actions/custom-provider-registration.js +154 -0
- package/dist/provider-api/actions/custom-provider-registration.js.map +1 -0
- package/dist/provider-api/actions/delete-staged-dataset.d.ts +1 -1
- package/dist/provider-api/actions/delete-staged-dataset.d.ts.map +1 -1
- package/dist/provider-api/actions/delete-staged-dataset.js +3 -34
- package/dist/provider-api/actions/delete-staged-dataset.js.map +1 -1
- package/dist/provider-api/actions/list-staged-datasets.d.ts +2 -3
- package/dist/provider-api/actions/list-staged-datasets.d.ts.map +1 -1
- package/dist/provider-api/actions/list-staged-datasets.js +3 -40
- package/dist/provider-api/actions/list-staged-datasets.js.map +1 -1
- package/dist/provider-api/actions/provider-api-audit.d.ts +7 -0
- package/dist/provider-api/actions/provider-api-audit.d.ts.map +1 -0
- package/dist/provider-api/actions/provider-api-audit.js +74 -0
- package/dist/provider-api/actions/provider-api-audit.js.map +1 -0
- package/dist/provider-api/actions/provider-api.d.ts +370 -0
- package/dist/provider-api/actions/provider-api.d.ts.map +1 -0
- package/dist/provider-api/actions/provider-api.js +280 -0
- package/dist/provider-api/actions/provider-api.js.map +1 -0
- package/dist/provider-api/actions/query-staged-dataset.d.ts +1 -1
- package/dist/provider-api/actions/query-staged-dataset.d.ts.map +1 -1
- package/dist/provider-api/actions/query-staged-dataset.js +3 -116
- package/dist/provider-api/actions/query-staged-dataset.js.map +1 -1
- package/dist/provider-api/actions/staged-datasets.d.ts +190 -0
- package/dist/provider-api/actions/staged-datasets.d.ts.map +1 -0
- package/dist/provider-api/actions/staged-datasets.js +210 -0
- package/dist/provider-api/actions/staged-datasets.js.map +1 -0
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/provider-api/gong.d.ts +44 -0
- package/dist/provider-api/gong.d.ts.map +1 -0
- package/dist/provider-api/gong.js +56 -0
- package/dist/provider-api/gong.js.map +1 -0
- package/dist/provider-api/index.d.ts +6 -2
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +25 -12
- package/dist/provider-api/index.js.map +1 -1
- package/dist/provider-api/runtime.d.ts +2 -0
- package/dist/provider-api/runtime.d.ts.map +1 -0
- package/dist/provider-api/runtime.js +2 -0
- package/dist/provider-api/runtime.js.map +1 -0
- package/dist/scripts/docs/source-search.d.ts +2 -1
- package/dist/scripts/docs/source-search.d.ts.map +1 -1
- package/dist/scripts/docs/source-search.js +2 -1
- package/dist/scripts/docs/source-search.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/google-oauth-credentials.d.ts +35 -0
- package/dist/server/google-oauth-credentials.d.ts.map +1 -1
- package/dist/server/google-oauth-credentials.js +48 -2
- package/dist/server/google-oauth-credentials.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/setup-connections/index.d.ts +1 -1
- package/dist/setup-connections/index.d.ts.map +1 -1
- package/dist/setup-connections/index.js +1 -1
- package/dist/setup-connections/index.js.map +1 -1
- package/dist/shared/merge-by-id.d.ts +5 -0
- package/dist/shared/merge-by-id.d.ts.map +1 -0
- package/dist/shared/merge-by-id.js +7 -0
- package/dist/shared/merge-by-id.js.map +1 -0
- package/dist/styles/chat-history-list.css +1 -313
- package/dist/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/chat/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/dist/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/dist/templates/chat/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/dist/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/chat/AGENTS.md +6 -2
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/dist/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/default/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/dist/templates/default/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/dist/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/dist/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/dist/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/dist/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/default/AGENTS.md +26 -18
- package/dist/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/dist/templates/headless/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/dist/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/dist/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/dist/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/dist/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/headless/AGENTS.md +8 -0
- package/dist/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/dist/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/dist/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +7 -0
- package/dist/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/dist/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/dist/templates/workspace-core/AGENTS.md +4 -0
- package/dist/templates/workspace-root/AGENTS.md +4 -0
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +22 -2
- package/dist/vite/client.js.map +1 -1
- package/docs/AGENTS.md +7 -0
- package/docs/content/agent-native-toolkit.mdx +38 -0
- package/docs/content/integrations.mdx +63 -2
- package/docs/content/package-lifecycle.mdx +54 -4
- package/docs/design/provider-integration-authority.md +117 -0
- package/package.json +20 -2
- package/src/a2a/agent-card.ts +83 -0
- package/src/a2a/artifact-response.ts +1648 -0
- package/src/a2a/auth-policy.ts +66 -0
- package/src/a2a/caller-auth.ts +102 -0
- package/src/a2a/client.ts +876 -0
- package/src/a2a/correlation.ts +50 -0
- package/src/a2a/handlers.ts +1285 -0
- package/src/a2a/index.ts +50 -0
- package/src/a2a/invoke.ts +348 -0
- package/src/a2a/response-text.ts +53 -0
- package/src/a2a/server.ts +586 -0
- package/src/a2a/task-store.ts +917 -0
- package/src/a2a/types.ts +221 -0
- package/src/a2a-claims.ts +52 -0
- package/src/action-change-marker.ts +74 -0
- package/src/action-ui.ts +38 -0
- package/src/action.ts +1406 -0
- package/src/adapters/cli/index.ts +6 -0
- package/src/adapters/cli/registry.ts +73 -0
- package/src/adapters/cli/shell-adapter.ts +92 -0
- package/src/adapters/cli/types.ts +27 -0
- package/src/agent/action-continuation-guidance.ts +38 -0
- package/src/agent/app-model-defaults.ts +201 -0
- package/src/agent/context-xray/actions/context-evict.ts +56 -0
- package/src/agent/context-xray/actions/context-manifest-get.ts +75 -0
- package/src/agent/context-xray/actions/context-pin.ts +56 -0
- package/src/agent/context-xray/actions/context-preview-get.ts +134 -0
- package/src/agent/context-xray/actions/context-report.ts +75 -0
- package/src/agent/context-xray/actions/context-restore.ts +51 -0
- package/src/agent/context-xray/actions/errors.ts +40 -0
- package/src/agent/context-xray/apply-directives.ts +137 -0
- package/src/agent/context-xray/directives-store.ts +178 -0
- package/src/agent/context-xray/identity.ts +37 -0
- package/src/agent/context-xray/manifest.ts +284 -0
- package/src/agent/context-xray/migrations.ts +32 -0
- package/src/agent/context-xray/plugin.ts +23 -0
- package/src/agent/context-xray/schema.ts +17 -0
- package/src/agent/context-xray/segments.ts +194 -0
- package/src/agent/context-xray/tokenize.ts +93 -0
- package/src/agent/default-model.ts +5 -0
- package/src/agent/durable-background.ts +547 -0
- package/src/agent/engine/ai-sdk-engine.ts +565 -0
- package/src/agent/engine/anthropic-engine.ts +320 -0
- package/src/agent/engine/builder-engine.ts +1110 -0
- package/src/agent/engine/builder-gateway-headers.ts +44 -0
- package/src/agent/engine/builtin.ts +122 -0
- package/src/agent/engine/context-directives-transform.ts +73 -0
- package/src/agent/engine/continuation-dispatch-retry.ts +168 -0
- package/src/agent/engine/credential-errors.ts +69 -0
- package/src/agent/engine/index.ts +54 -0
- package/src/agent/engine/openai-compatible-endpoint.ts +25 -0
- package/src/agent/engine/output-tokens.ts +181 -0
- package/src/agent/engine/provider-env-vars.ts +69 -0
- package/src/agent/engine/registry.ts +853 -0
- package/src/agent/engine/tool-call-journal-seed.ts +85 -0
- package/src/agent/engine/translate-ai-sdk.ts +407 -0
- package/src/agent/engine/translate-anthropic.ts +611 -0
- package/src/agent/engine/types.ts +310 -0
- package/src/agent/harness/acp-adapter.ts +893 -0
- package/src/agent/harness/acp-builtin.ts +70 -0
- package/src/agent/harness/ai-sdk-adapter.ts +509 -0
- package/src/agent/harness/background.ts +365 -0
- package/src/agent/harness/builtin.ts +50 -0
- package/src/agent/harness/index.ts +86 -0
- package/src/agent/harness/lifecycle.ts +498 -0
- package/src/agent/harness/registry.ts +97 -0
- package/src/agent/harness/runner.ts +182 -0
- package/src/agent/harness/store.ts +466 -0
- package/src/agent/harness/translate.ts +130 -0
- package/src/agent/harness/types.ts +129 -0
- package/src/agent/index.ts +32 -0
- package/src/agent/loop-settings.ts +186 -0
- package/src/agent/model-config.ts +363 -0
- package/src/agent/observational-memory/compactor.ts +78 -0
- package/src/agent/observational-memory/config.ts +78 -0
- package/src/agent/observational-memory/index.ts +79 -0
- package/src/agent/observational-memory/internal-run.ts +89 -0
- package/src/agent/observational-memory/message-text.ts +49 -0
- package/src/agent/observational-memory/migrations.ts +44 -0
- package/src/agent/observational-memory/observer.ts +128 -0
- package/src/agent/observational-memory/plugin.ts +35 -0
- package/src/agent/observational-memory/prompts.ts +53 -0
- package/src/agent/observational-memory/read.ts +131 -0
- package/src/agent/observational-memory/reflector.ts +119 -0
- package/src/agent/observational-memory/schema.ts +48 -0
- package/src/agent/observational-memory/store.ts +275 -0
- package/src/agent/observational-memory/types.ts +65 -0
- package/src/agent/processors.ts +209 -0
- package/src/agent/production-agent.ts +8254 -0
- package/src/agent/run-loop-with-resume.ts +394 -0
- package/src/agent/run-manager.ts +1825 -0
- package/src/agent/run-ownership.ts +75 -0
- package/src/agent/run-store.ts +2601 -0
- package/src/agent/runtime-context.ts +169 -0
- package/src/agent/thread-data-builder.ts +1584 -0
- package/src/agent/tool-call-journal.ts +368 -0
- package/src/agent/tool-error-redaction.ts +52 -0
- package/src/agent/tool-result-images.ts +178 -0
- package/src/agent/tool-search.ts +376 -0
- package/src/agent/types.ts +372 -0
- package/src/agent-native/index.ts +198 -0
- package/src/agent-web/config.ts +253 -0
- package/src/agent-web/generator.ts +382 -0
- package/src/agent-web/index.ts +36 -0
- package/src/appearance/actions/change-appearance.ts +35 -0
- package/src/application-state/emitter.ts +81 -0
- package/src/application-state/handlers.ts +121 -0
- package/src/application-state/index.ts +44 -0
- package/src/application-state/script-helpers.ts +155 -0
- package/src/application-state/store.ts +274 -0
- package/src/assets/branding/agent-native.icon/Assets/background.svg +3 -0
- package/src/assets/branding/agent-native.icon/Assets/foreground.svg +12 -0
- package/src/assets/branding/agent-native.icon/icon.json +49 -0
- package/src/assets/branding/favicon.png +0 -0
- package/src/assets/branding/favicon.svg +1 -0
- package/src/assets/branding/icon-on-dark.svg +10 -0
- package/src/assets/branding/icon-on-light.svg +10 -0
- package/src/assets/branding/mac-app-icon.svg +1 -0
- package/src/assets/branding/slack-bot/agent-native-1024.png +0 -0
- package/src/assets/branding/slack-bot/agent-native-512.png +0 -0
- package/src/assets/branding/tray-icon.svg +6 -0
- package/src/assets/branding/wordmark-on-dark.svg +21 -0
- package/src/assets/branding/wordmark-on-light.svg +21 -0
- package/src/assets/fonts/LICENSE_LIBERATION +96 -0
- package/src/assets/fonts/LICENSE_NOTO_NASKH_ARABIC +93 -0
- package/src/assets/fonts/LiberationSans-Bold.ttf +0 -0
- package/src/assets/fonts/LiberationSans-Regular.ttf +0 -0
- package/src/assets/fonts/NotoNaskhArabic-Variable.ttf +0 -0
- package/src/audit/actions/export-audit-events.ts +162 -0
- package/src/audit/actions/get-audit-event.ts +24 -0
- package/src/audit/actions/list-audit-events.ts +66 -0
- package/src/audit/cleanup-job.ts +100 -0
- package/src/audit/config.ts +90 -0
- package/src/audit/index.ts +43 -0
- package/src/audit/record.ts +180 -0
- package/src/audit/redact.ts +109 -0
- package/src/audit/store.ts +346 -0
- package/src/audit/types.ts +141 -0
- package/src/automation/index.ts +802 -0
- package/src/brand-kit/brand-signals.ts +124 -0
- package/src/brand-kit/fig/index.ts +64 -0
- package/src/brand-kit/index.ts +72 -0
- package/src/brand-kit/types.ts +113 -0
- package/src/browser-sessions/actions.ts +302 -0
- package/src/browser-sessions/routes.ts +234 -0
- package/src/browser-sessions/store.ts +679 -0
- package/src/browser-sessions/types.ts +84 -0
- package/src/changelog/parse.ts +328 -0
- package/src/chat-threads/emitter.ts +22 -0
- package/src/chat-threads/schema.ts +43 -0
- package/src/chat-threads/store.ts +1311 -0
- package/src/checkpoints/index.ts +15 -0
- package/src/checkpoints/service.ts +142 -0
- package/src/checkpoints/store.ts +153 -0
- package/src/cli/add.ts +425 -0
- package/src/cli/agent.ts +424 -0
- package/src/cli/agents.ts +122 -0
- package/src/cli/app-skill.ts +1455 -0
- package/src/cli/atomic-json-file.ts +324 -0
- package/src/cli/audit-agent-web.ts +324 -0
- package/src/cli/changelog.ts +199 -0
- package/src/cli/claude-code-participant.ts +515 -0
- package/src/cli/code-agent-commands.ts +270 -0
- package/src/cli/code-agent-connector.ts +1109 -0
- package/src/cli/code-agent-executor.ts +1970 -0
- package/src/cli/code-agent-output-smoother.ts +140 -0
- package/src/cli/code-agent-runs.concurrent-worker.ts +33 -0
- package/src/cli/code-agent-runs.ts +548 -0
- package/src/cli/code.ts +1805 -0
- package/src/cli/codex-cli-participant.ts +496 -0
- package/src/cli/connect.ts +2714 -0
- package/src/cli/content-local.ts +442 -0
- package/src/cli/context-xray-local.ts +2193 -0
- package/src/cli/create-workspace.ts +30 -0
- package/src/cli/create.ts +2247 -0
- package/src/cli/deploy-build.ts +50 -0
- package/src/cli/design-connect.ts +3187 -0
- package/src/cli/doctor.ts +472 -0
- package/src/cli/eject.ts +1594 -0
- package/src/cli/eval.ts +134 -0
- package/src/cli/gateway-helpers.ts +70 -0
- package/src/cli/index.ts +1217 -0
- package/src/cli/info.ts +105 -0
- package/src/cli/invoke.ts +288 -0
- package/src/cli/mcp-config-writers.ts +857 -0
- package/src/cli/mcp.ts +594 -0
- package/src/cli/migrate.ts +1813 -0
- package/src/cli/migration-codemod.ts +646 -0
- package/src/cli/multi-frontier-runs.ts +1952 -0
- package/src/cli/package-lifecycle.ts +823 -0
- package/src/cli/plan-blocks.ts +143 -0
- package/src/cli/plan-local.ts +3189 -0
- package/src/cli/plan-publish-store.ts +138 -0
- package/src/cli/pr-visual-recap-workflow.ts +2 -0
- package/src/cli/recap.ts +5 -0
- package/src/cli/setup-agents.ts +120 -0
- package/src/cli/skills-content/assets-skill.ts +83 -0
- package/src/cli/skills-content/canvas.ts +153 -0
- package/src/cli/skills-content/connection.ts +52 -0
- package/src/cli/skills-content/content-skill.ts +120 -0
- package/src/cli/skills-content/design-exploration-skill.ts +118 -0
- package/src/cli/skills-content/design-visual-edit-skill.ts +228 -0
- package/src/cli/skills-content/document-quality.ts +196 -0
- package/src/cli/skills-content/exemplar.ts +69 -0
- package/src/cli/skills-content/help.ts +77 -0
- package/src/cli/skills-content/index.ts +22 -0
- package/src/cli/skills-content/local-files.ts +100 -0
- package/src/cli/skills-content/plan-setup-auth.ts +80 -0
- package/src/cli/skills-content/visual-plan-skill.ts +493 -0
- package/src/cli/skills-content/visual-recap-skill.ts +553 -0
- package/src/cli/skills-content/visualize-repo-skill.ts +93 -0
- package/src/cli/skills-content/wireframe.ts +349 -0
- package/src/cli/skills.ts +4340 -0
- package/src/cli/sync-builder-starter-manifest.ts +631 -0
- package/src/cli/telemetry.ts +136 -0
- package/src/cli/templates-meta.ts +269 -0
- package/src/cli/upgrade.ts +956 -0
- package/src/cli/visualize-repo.ts +715 -0
- package/src/cli/workspace-dev.ts +1486 -0
- package/src/cli/workspacify.ts +258 -0
- package/src/client/AgentAskPopover.tsx +89 -0
- package/src/client/AgentChatHome.tsx +66 -0
- package/src/client/AgentNative.tsx +161 -0
- package/src/client/AgentNativeEmbedded.tsx +288 -0
- package/src/client/AgentNativeFrame.tsx +151 -0
- package/src/client/AgentPanel.tsx +3437 -0
- package/src/client/AgentTaskCard.tsx +273 -0
- package/src/client/AppearancePicker.tsx +79 -0
- package/src/client/AssistantChat.tsx +5793 -0
- package/src/client/ClientOnly.tsx +22 -0
- package/src/client/CommandMenu.tsx +726 -0
- package/src/client/ConnectBuilderCard.tsx +390 -0
- package/src/client/DefaultSpinner.tsx +47 -0
- package/src/client/ErrorBoundary.tsx +359 -0
- package/src/client/ErrorReportActions.tsx +69 -0
- package/src/client/FeedbackButton.tsx +553 -0
- package/src/client/HighlightedCodeBlock.tsx +173 -0
- package/src/client/IframeEmbed.tsx +151 -0
- package/src/client/KeepTabOpenNotice.tsx +181 -0
- package/src/client/MultiTabAssistantChat.tsx +2576 -0
- package/src/client/NewWorkspaceAppFlow.tsx +525 -0
- package/src/client/PoweredByBadge.tsx +284 -0
- package/src/client/RunStuckBanner.tsx +431 -0
- package/src/client/StarfieldBackground.tsx +466 -0
- package/src/client/Turnstile.tsx +125 -0
- package/src/client/active-run-state.ts +139 -0
- package/src/client/agent-chat/index.ts +279 -0
- package/src/client/agent-chat-adapter.ts +3692 -0
- package/src/client/agent-chat.ts +1233 -0
- package/src/client/agent-engine-key.ts +122 -0
- package/src/client/agent-page/AgentContextTab.tsx +487 -0
- package/src/client/agent-page/AgentEmptyState.tsx +44 -0
- package/src/client/agent-page/AgentJobsTab.tsx +441 -0
- package/src/client/agent-page/AgentTabFrame.tsx +39 -0
- package/src/client/agent-page/AgentTabsPage.tsx +1096 -0
- package/src/client/agent-page/types.ts +18 -0
- package/src/client/agent-page/use-jobs.ts +150 -0
- package/src/client/agent-sidebar-state.ts +166 -0
- package/src/client/analytics/index.ts +40 -0
- package/src/client/analytics-session.ts +70 -0
- package/src/client/analytics.ts +1757 -0
- package/src/client/api-path.ts +124 -0
- package/src/client/app-providers.tsx +230 -0
- package/src/client/appearance.ts +130 -0
- package/src/client/application-state.ts +154 -0
- package/src/client/assistant-ui-recovery.tsx +205 -0
- package/src/client/automation/index.ts +4 -0
- package/src/client/automation.ts +22 -0
- package/src/client/blocks/AiEditableField.tsx +30 -0
- package/src/client/blocks/BlockView.tsx +145 -0
- package/src/client/blocks/RegistryBlockDataProvider.tsx +121 -0
- package/src/client/blocks/SchemaBlockEditor.tsx +457 -0
- package/src/client/blocks/agent.ts +95 -0
- package/src/client/blocks/code-block-direction.ts +21 -0
- package/src/client/blocks/index.ts +308 -0
- package/src/client/blocks/library/AnnotatedCodeBlock.tsx +710 -0
- package/src/client/blocks/library/ApiEndpointBlock.tsx +1120 -0
- package/src/client/blocks/library/DataModelBlock.tsx +775 -0
- package/src/client/blocks/library/DiffBlock.tsx +1854 -0
- package/src/client/blocks/library/FileTreeBlock.tsx +868 -0
- package/src/client/blocks/library/HighlightedCode.tsx +260 -0
- package/src/client/blocks/library/JsonExplorerBlock.tsx +608 -0
- package/src/client/blocks/library/MermaidBlock.tsx +362 -0
- package/src/client/blocks/library/OpenApiSpecBlock.tsx +998 -0
- package/src/client/blocks/library/annotated-code.config.ts +101 -0
- package/src/client/blocks/library/annotation-rail.tsx +1020 -0
- package/src/client/blocks/library/api-endpoint.config.ts +207 -0
- package/src/client/blocks/library/block-copy.ts +399 -0
- package/src/client/blocks/library/callout.config.ts +57 -0
- package/src/client/blocks/library/callout.tsx +149 -0
- package/src/client/blocks/library/checklist.config.ts +56 -0
- package/src/client/blocks/library/checklist.tsx +208 -0
- package/src/client/blocks/library/code-filename-label.tsx +59 -0
- package/src/client/blocks/library/code-highlight.tsx +178 -0
- package/src/client/blocks/library/code-tabs.config.ts +70 -0
- package/src/client/blocks/library/code-tabs.tsx +606 -0
- package/src/client/blocks/library/code.config.ts +69 -0
- package/src/client/blocks/library/code.tsx +440 -0
- package/src/client/blocks/library/columns.config.ts +85 -0
- package/src/client/blocks/library/columns.tsx +334 -0
- package/src/client/blocks/library/data-model.config.ts +152 -0
- package/src/client/blocks/library/dev-doc-ui.tsx +191 -0
- package/src/client/blocks/library/diagram.config.ts +222 -0
- package/src/client/blocks/library/diagram.tsx +958 -0
- package/src/client/blocks/library/diff.config.ts +115 -0
- package/src/client/blocks/library/file-tree.config.ts +92 -0
- package/src/client/blocks/library/html.config.ts +79 -0
- package/src/client/blocks/library/html.tsx +258 -0
- package/src/client/blocks/library/json-explorer.config.ts +74 -0
- package/src/client/blocks/library/mermaid.config.ts +49 -0
- package/src/client/blocks/library/narrow-container.tsx +37 -0
- package/src/client/blocks/library/openapi-spec.config.ts +66 -0
- package/src/client/blocks/library/question-form.config.ts +127 -0
- package/src/client/blocks/library/question-form.tsx +944 -0
- package/src/client/blocks/library/sanitize-html.ts +343 -0
- package/src/client/blocks/library/server-specs.ts +338 -0
- package/src/client/blocks/library/specs.tsx +308 -0
- package/src/client/blocks/library/table.config.ts +61 -0
- package/src/client/blocks/library/table.tsx +449 -0
- package/src/client/blocks/library/tabs.config.ts +96 -0
- package/src/client/blocks/library/tabs.tsx +665 -0
- package/src/client/blocks/library/wireframe-icons.ts +210 -0
- package/src/client/blocks/library/wireframe-kit.tsx +1850 -0
- package/src/client/blocks/library/wireframe.config.ts +539 -0
- package/src/client/blocks/library/wireframe.tsx +535 -0
- package/src/client/blocks/mdx.ts +364 -0
- package/src/client/blocks/provider.tsx +51 -0
- package/src/client/blocks/registry.ts +83 -0
- package/src/client/blocks/schema-form/introspect.ts +201 -0
- package/src/client/blocks/server.ts +170 -0
- package/src/client/blocks/types.ts +415 -0
- package/src/client/browser-session-bridge.ts +548 -0
- package/src/client/browser-tab-id.ts +36 -0
- package/src/client/builder-frame.ts +194 -0
- package/src/client/builder-mark.tsx +21 -0
- package/src/client/changelog/Changelog.tsx +333 -0
- package/src/client/changelog/index.ts +1 -0
- package/src/client/chat/ChatHistoryList.tsx +7 -0
- package/src/client/chat/attachment-adapters.ts +426 -0
- package/src/client/chat/connectors.ts +1579 -0
- package/src/client/chat/index.ts +160 -0
- package/src/client/chat/markdown-renderer.tsx +693 -0
- package/src/client/chat/message-components.tsx +1326 -0
- package/src/client/chat/repo-helpers.ts +281 -0
- package/src/client/chat/run-recovery.tsx +994 -0
- package/src/client/chat/runtime.ts +1810 -0
- package/src/client/chat/tool-call-display.tsx +1270 -0
- package/src/client/chat/tool-render-registry.tsx +144 -0
- package/src/client/chat/use-agent-chat-lifecycle-tracking.ts +74 -0
- package/src/client/chat/use-reconnect-reader-owner.ts +28 -0
- package/src/client/chat/widgets/DataChartRenderer.tsx +242 -0
- package/src/client/chat/widgets/DataChartWidget.tsx +51 -0
- package/src/client/chat/widgets/DataInsightsWidget.tsx +59 -0
- package/src/client/chat/widgets/DataTableWidget.tsx +240 -0
- package/src/client/chat/widgets/InlineExtensionWidget.tsx +60 -0
- package/src/client/chat/widgets/builtin-tool-renderers.tsx +213 -0
- package/src/client/chat/widgets/data-widget-types.ts +1 -0
- package/src/client/chat/widgets/inline-extension-result.ts +86 -0
- package/src/client/chat-model-groups.ts +171 -0
- package/src/client/chat-thread-url.ts +11 -0
- package/src/client/chat-view-transition.ts +213 -0
- package/src/client/client-action.ts +21 -0
- package/src/client/client-bootstrap.ts +7 -0
- package/src/client/client-surface.ts +41 -0
- package/src/client/clipboard.ts +89 -0
- package/src/client/code-agent-chat-adapter.ts +537 -0
- package/src/client/collab/index.ts +60 -0
- package/src/client/command-navigation/index.ts +15 -0
- package/src/client/comments-review/index.ts +1 -0
- package/src/client/components/AgentPresenceChip.tsx +4 -0
- package/src/client/components/ApiKeySettings.tsx +309 -0
- package/src/client/components/CodeAgentIndicator.tsx +59 -0
- package/src/client/components/CodeRequiredDialog.tsx +470 -0
- package/src/client/components/LiveCursorOverlay.tsx +5 -0
- package/src/client/components/MissingKeyCard.tsx +61 -0
- package/src/client/components/PresenceBar.tsx +4 -0
- package/src/client/components/RecentEditHighlights.tsx +4 -0
- package/src/client/components/RemoteSelectionRings.tsx +5 -0
- package/src/client/components/icons/AgentNativeIcon.tsx +46 -0
- package/src/client/components/ui/dialog.tsx +1 -0
- package/src/client/components/ui/dropdown-menu.tsx +1 -0
- package/src/client/components/ui/hover-card.tsx +1 -0
- package/src/client/components/ui/message-scroller.tsx +131 -0
- package/src/client/components/ui/popover.tsx +1 -0
- package/src/client/components/ui/sheet.tsx +1 -0
- package/src/client/components/ui/tooltip.tsx +1 -0
- package/src/client/composer/index.ts +11 -0
- package/src/client/composer/runtime-adapters.tsx +123 -0
- package/src/client/composer/use-mention-search.ts +7 -0
- package/src/client/composer/wired-components.tsx +53 -0
- package/src/client/context-xray/ContextMeter.tsx +124 -0
- package/src/client/context-xray/ContextSegmentRow.tsx +27 -0
- package/src/client/context-xray/ContextTreemap.tsx +24 -0
- package/src/client/context-xray/ContextXRayPanel.tsx +59 -0
- package/src/client/context-xray/SegmentProvenancePopover.tsx +18 -0
- package/src/client/context-xray/format.ts +27 -0
- package/src/client/conversation/AgentConversation.tsx +555 -0
- package/src/client/conversation/code-agent-transcript.ts +283 -0
- package/src/client/conversation/index.ts +22 -0
- package/src/client/conversation/types.ts +85 -0
- package/src/client/conversation/use-near-bottom-autoscroll.ts +278 -0
- package/src/client/create-query-client.ts +86 -0
- package/src/client/db-admin/DataGrid.tsx +551 -0
- package/src/client/db-admin/DbAdminPage.tsx +218 -0
- package/src/client/db-admin/DevDatabaseLink.tsx +16 -0
- package/src/client/db-admin/EditableCell.tsx +451 -0
- package/src/client/db-admin/FilterBar.tsx +203 -0
- package/src/client/db-admin/ResultsGrid.tsx +114 -0
- package/src/client/db-admin/RowSidePanel.tsx +337 -0
- package/src/client/db-admin/SqlEditor.tsx +840 -0
- package/src/client/db-admin/TableBrowser.tsx +212 -0
- package/src/client/db-admin/TableEditor.tsx +760 -0
- package/src/client/db-admin/cell-format.ts +246 -0
- package/src/client/db-admin/changeset.ts +296 -0
- package/src/client/db-admin/export-utils.ts +78 -0
- package/src/client/db-admin/index.ts +33 -0
- package/src/client/db-admin/sql-storage.ts +134 -0
- package/src/client/db-admin/storage.ts +68 -0
- package/src/client/db-admin/useAgentSync.ts +226 -0
- package/src/client/db-admin/useDbAdmin.ts +294 -0
- package/src/client/dev-overlay/DevOverlay.tsx +576 -0
- package/src/client/dev-overlay/builtins.ts +40 -0
- package/src/client/dev-overlay/index.ts +23 -0
- package/src/client/dev-overlay/registry.ts +67 -0
- package/src/client/dev-overlay/types.ts +64 -0
- package/src/client/dev-overlay/use-dev-option.ts +78 -0
- package/src/client/dev-overlay/use-dev-overlay-shortcut.ts +31 -0
- package/src/client/dynamic-suggestions.ts +455 -0
- package/src/client/embed-auth.ts +544 -0
- package/src/client/embed.ts +54 -0
- package/src/client/error-capture.ts +690 -0
- package/src/client/error-format.ts +211 -0
- package/src/client/error-reporting.ts +100 -0
- package/src/client/extensions/AgentNativeExtensionFrame.e2e-host.tsx +136 -0
- package/src/client/extensions/AgentNativeExtensionFrame.tsx +708 -0
- package/src/client/extensions/EmbeddedExtension.tsx +604 -0
- package/src/client/extensions/ExtensionEditor.tsx +450 -0
- package/src/client/extensions/ExtensionQueryErrorState.tsx +47 -0
- package/src/client/extensions/ExtensionSlot.tsx +345 -0
- package/src/client/extensions/ExtensionViewer.tsx +1502 -0
- package/src/client/extensions/ExtensionViewerPage.tsx +32 -0
- package/src/client/extensions/ExtensionsListPage.tsx +432 -0
- package/src/client/extensions/ExtensionsSidebarSection.tsx +1259 -0
- package/src/client/extensions/InlineExtensionFrame.tsx +660 -0
- package/src/client/extensions/agent-native-extension-runtime.ts +495 -0
- package/src/client/extensions/delete-extension.ts +76 -0
- package/src/client/extensions/extension-load-error.ts +26 -0
- package/src/client/extensions/extension-order.ts +49 -0
- package/src/client/extensions/extension-popularity.ts +61 -0
- package/src/client/extensions/iframe-bridge.ts +377 -0
- package/src/client/extensions/index.ts +84 -0
- package/src/client/extensions/portable-extension.ts +712 -0
- package/src/client/feature-flags/FeatureFlagsPanel.tsx +519 -0
- package/src/client/feature-flags/helpers.ts +77 -0
- package/src/client/feature-flags/index.ts +13 -0
- package/src/client/feature-flags/types.ts +29 -0
- package/src/client/feature-flags/use-feature-flag.ts +26 -0
- package/src/client/feedback-context.ts +90 -0
- package/src/client/frame-protocol.ts +168 -0
- package/src/client/frame.ts +329 -0
- package/src/client/guided-questions.tsx +1152 -0
- package/src/client/history/VersionHistoryPanel.tsx +175 -0
- package/src/client/history/index.ts +21 -0
- package/src/client/history/use-history.ts +114 -0
- package/src/client/hooks/index.ts +46 -0
- package/src/client/host/index.ts +170 -0
- package/src/client/host-bridge.ts +1272 -0
- package/src/client/host-tools.ts +190 -0
- package/src/client/i18n.tsx +798 -0
- package/src/client/index.ts +370 -0
- package/src/client/integrations/IntegrationCard.tsx +186 -0
- package/src/client/integrations/IntegrationsPanel.tsx +633 -0
- package/src/client/integrations/api.ts +295 -0
- package/src/client/integrations/index.ts +29 -0
- package/src/client/integrations/useIntegrationStatus.ts +52 -0
- package/src/client/mcp-app-host.ts +720 -0
- package/src/client/mcp-apps/McpAppRenderer.tsx +760 -0
- package/src/client/navigation/index.ts +54 -0
- package/src/client/notifications/NotificationsBell.tsx +383 -0
- package/src/client/notifications/index.ts +1 -0
- package/src/client/observability/ObservabilityDashboard.tsx +890 -0
- package/src/client/observability/ThumbsFeedback.tsx +160 -0
- package/src/client/observability/index.ts +20 -0
- package/src/client/observability/useObservability.ts +266 -0
- package/src/client/onboarding/OnboardingBanner.tsx +73 -0
- package/src/client/onboarding/OnboardingPanel.tsx +1036 -0
- package/src/client/onboarding/SetupButton.tsx +64 -0
- package/src/client/onboarding/index.ts +25 -0
- package/src/client/onboarding/use-onboarding.ts +164 -0
- package/src/client/onboarding/use-preview-mode.ts +40 -0
- package/src/client/org/InvitationBanner.tsx +148 -0
- package/src/client/org/OrgSwitcher.tsx +754 -0
- package/src/client/org/RequireActiveOrg.tsx +337 -0
- package/src/client/org/TeamPage.tsx +1432 -0
- package/src/client/org/hooks.ts +359 -0
- package/src/client/org/index.ts +70 -0
- package/src/client/org/workspace-app-links.ts +367 -0
- package/src/client/org-team/index.ts +1 -0
- package/src/client/progress/RunsTray.tsx +680 -0
- package/src/client/progress/index.ts +1 -0
- package/src/client/require-session.tsx +142 -0
- package/src/client/resources/BuiltinCapabilityDetail.tsx +258 -0
- package/src/client/resources/McpConnectionSuggestion.tsx +276 -0
- package/src/client/resources/McpIntegrationDialog.tsx +808 -0
- package/src/client/resources/McpServerDetail.tsx +230 -0
- package/src/client/resources/ResourceEditor.tsx +872 -0
- package/src/client/resources/ResourceTree.tsx +860 -0
- package/src/client/resources/ResourcesPanel.tsx +1960 -0
- package/src/client/resources/index.ts +25 -0
- package/src/client/resources/mcp-integration-catalog.ts +771 -0
- package/src/client/resources/mcp-integration-logos.ts +108 -0
- package/src/client/resources/runtime.ts +1 -0
- package/src/client/resources/use-builtin-capabilities.ts +113 -0
- package/src/client/resources/use-mcp-servers.ts +217 -0
- package/src/client/resources/use-resources.ts +402 -0
- package/src/client/review/ReviewCommentComposer.tsx +123 -0
- package/src/client/review/ReviewStatusBadge.tsx +39 -0
- package/src/client/review/ReviewThreadPanel.tsx +625 -0
- package/src/client/review/index.ts +38 -0
- package/src/client/review/use-review.ts +186 -0
- package/src/client/route-chunk-recovery/index.ts +1 -0
- package/src/client/route-chunk-recovery.ts +331 -0
- package/src/client/route-state.ts +455 -0
- package/src/client/route-warmup.tsx +543 -0
- package/src/client/session-replay-iframe.e2e-host.tsx +100 -0
- package/src/client/session-replay.ts +3417 -0
- package/src/client/settings/AgentsSection.tsx +441 -0
- package/src/client/settings/AutomationsSection.tsx +516 -0
- package/src/client/settings/BackgroundAgentSection.tsx +189 -0
- package/src/client/settings/BrowserSection.tsx +110 -0
- package/src/client/settings/DemoModeSection.tsx +48 -0
- package/src/client/settings/SecretsSection.tsx +875 -0
- package/src/client/settings/SettingsPanel.tsx +3162 -0
- package/src/client/settings/SettingsSection.tsx +283 -0
- package/src/client/settings/SettingsTabsPage.tsx +592 -0
- package/src/client/settings/UsageSection.tsx +401 -0
- package/src/client/settings/VoiceTranscriptionSection.tsx +960 -0
- package/src/client/settings/agent-settings-search.ts +220 -0
- package/src/client/settings/index.ts +27 -0
- package/src/client/settings/useBuilderStatus.ts +1055 -0
- package/src/client/setup-connections/BuilderConnectCard.tsx +89 -0
- package/src/client/setup-connections/ProviderReadinessBadge.tsx +73 -0
- package/src/client/setup-connections/SetupConnectionsPage.tsx +94 -0
- package/src/client/setup-connections/catalog.ts +6 -0
- package/src/client/setup-connections/index.ts +47 -0
- package/src/client/setup-connections/runtime.ts +1 -0
- package/src/client/sharing/ShareButton.tsx +1748 -0
- package/src/client/sharing/ShareDialog.tsx +846 -0
- package/src/client/sharing/VisibilityBadge.tsx +4 -0
- package/src/client/sharing/index.ts +2 -0
- package/src/client/sse-event-processor.ts +2002 -0
- package/src/client/terminal/AgentTerminal.tsx +488 -0
- package/src/client/terminal/index.ts +7 -0
- package/src/client/theme.ts +27 -0
- package/src/client/tombstone/agent-presence-chip.ts +17 -0
- package/src/client/tombstone/editor.ts +265 -0
- package/src/client/tombstone/live-cursor-overlay.ts +21 -0
- package/src/client/tombstone/presence-bar.ts +17 -0
- package/src/client/tombstone/recent-edit-highlights.ts +17 -0
- package/src/client/tombstone/remote-selection-rings.ts +21 -0
- package/src/client/tombstone/rich-markdown-editor.ts +265 -0
- package/src/client/tombstone/ui-dialog.ts +49 -0
- package/src/client/tombstone/ui-dropdown-menu.ts +69 -0
- package/src/client/tombstone/ui-hover-card.ts +21 -0
- package/src/client/tombstone/ui-popover.ts +25 -0
- package/src/client/tombstone/ui-sheet.ts +49 -0
- package/src/client/tombstone/ui-tooltip.ts +29 -0
- package/src/client/tombstone/visual-style-controls.ts +61 -0
- package/src/client/tool-cells/BashCell.tsx +164 -0
- package/src/client/tool-cells/EditCell.tsx +303 -0
- package/src/client/tool-cells/FilesChangedSummary.tsx +208 -0
- package/src/client/tool-cells/WriteCell.tsx +145 -0
- package/src/client/tool-cells/index.ts +7 -0
- package/src/client/tool-display.ts +41 -0
- package/src/client/track.ts +57 -0
- package/src/client/transcription/BuilderTranscriptionCta.tsx +120 -0
- package/src/client/transcription/use-live-transcription.ts +292 -0
- package/src/client/ui/index.ts +55 -0
- package/src/client/uploads/index.ts +6 -0
- package/src/client/uploads/upload-editor-image.ts +79 -0
- package/src/client/uploads/use-upload-resource.ts +24 -0
- package/src/client/url-scrub.ts +51 -0
- package/src/client/use-action.ts +766 -0
- package/src/client/use-agent-chat-context.ts +63 -0
- package/src/client/use-agent-chat-home-handoff.ts +207 -0
- package/src/client/use-agent-chat.ts +53 -0
- package/src/client/use-agent-engine-configured.ts +211 -0
- package/src/client/use-avatar.ts +127 -0
- package/src/client/use-change-version.ts +150 -0
- package/src/client/use-chat-models.ts +252 -0
- package/src/client/use-chat-threads.ts +1262 -0
- package/src/client/use-db-sync.ts +1112 -0
- package/src/client/use-demo-mode-status.ts +30 -0
- package/src/client/use-dev-mode.ts +177 -0
- package/src/client/use-external-value.ts +40 -0
- package/src/client/use-pausing-interval.ts +65 -0
- package/src/client/use-pinch-zoom.ts +202 -0
- package/src/client/use-run-stuck-detection.ts +427 -0
- package/src/client/use-send-to-agent-chat.ts +85 -0
- package/src/client/use-session.ts +114 -0
- package/src/client/utils.ts +7 -0
- package/src/client/visual-style-controls.tsx +1 -0
- package/src/client/vite-dev-recovery-script.ts +226 -0
- package/src/client/voice-provider-status.ts +44 -0
- package/src/client/widgets/index.ts +41 -0
- package/src/code-agents/background-controller.ts +398 -0
- package/src/code-agents/background-run.ts +156 -0
- package/src/code-agents/index.ts +95 -0
- package/src/code-agents/prompt-attachments.ts +39 -0
- package/src/code-agents/transcript-normalizer.ts +750 -0
- package/src/code-agents/transcript-order.ts +73 -0
- package/src/coding-tools/index.ts +742 -0
- package/src/coding-tools/run-code.ts +1662 -0
- package/src/coding-tools/sandbox/adapter.ts +82 -0
- package/src/coding-tools/sandbox/background.ts +406 -0
- package/src/coding-tools/sandbox/executions-store.ts +517 -0
- package/src/coding-tools/sandbox/index.ts +132 -0
- package/src/coding-tools/sandbox/local-child-process-adapter.ts +217 -0
- package/src/collab/agent-identity.ts +5 -0
- package/src/collab/agent-presence.ts +341 -0
- package/src/collab/awareness-store.ts +196 -0
- package/src/collab/awareness.ts +317 -0
- package/src/collab/client-struct.ts +366 -0
- package/src/collab/client.ts +1205 -0
- package/src/collab/emitter.ts +31 -0
- package/src/collab/follow-mode.ts +107 -0
- package/src/collab/index.ts +151 -0
- package/src/collab/json-to-yjs.ts +504 -0
- package/src/collab/presence.ts +207 -0
- package/src/collab/recent-edits.ts +215 -0
- package/src/collab/routes.ts +191 -0
- package/src/collab/storage.ts +228 -0
- package/src/collab/struct-routes.ts +133 -0
- package/src/collab/text-to-yjs.ts +79 -0
- package/src/collab/undo.ts +432 -0
- package/src/collab/xml-ops.ts +68 -0
- package/src/collab/ydoc-manager.ts +544 -0
- package/src/command-navigation/actions.ts +100 -0
- package/src/command-navigation/index.ts +12 -0
- package/src/comments-review/index.ts +1 -0
- package/src/connections/catalog.ts +451 -0
- package/src/connections/index.ts +48 -0
- package/src/connections/reader.ts +911 -0
- package/src/connections/runtime.ts +1 -0
- package/src/credentials/index.ts +187 -0
- package/src/data-programs/actions.ts +335 -0
- package/src/data-programs/contract.ts +284 -0
- package/src/data-programs/execute.ts +693 -0
- package/src/data-programs/index.ts +72 -0
- package/src/data-programs/schema.ts +148 -0
- package/src/data-programs/store.ts +755 -0
- package/src/data-widgets/index.ts +376 -0
- package/src/db/client.ts +1627 -0
- package/src/db/create-get-db.ts +579 -0
- package/src/db/ddl-guard.ts +302 -0
- package/src/db/drizzle-config.ts +190 -0
- package/src/db/ensure-additive-columns.ts +430 -0
- package/src/db/index.ts +57 -0
- package/src/db/migrations.ts +691 -0
- package/src/db/request-telemetry.ts +154 -0
- package/src/db/runtime-diagnostics.ts +331 -0
- package/src/db/schema.ts +121 -0
- package/src/db/widen-columns.ts +75 -0
- package/src/db-admin/agent-tools.ts +202 -0
- package/src/db-admin/index.ts +26 -0
- package/src/db-admin/operations.ts +803 -0
- package/src/db-admin/routes.ts +174 -0
- package/src/db-admin/types.ts +110 -0
- package/src/demo/browser-state.ts +47 -0
- package/src/demo/fetch-interceptor.ts +175 -0
- package/src/demo/redact.ts +575 -0
- package/src/deploy/build.ts +3935 -0
- package/src/deploy/immutable-assets.ts +65 -0
- package/src/deploy/route-discovery.ts +458 -0
- package/src/deploy/workspace-core.ts +282 -0
- package/src/deploy/workspace-deploy.ts +1488 -0
- package/src/eject/provider-api-definitions.ts +193 -0
- package/src/eject/remote-mcp-presets.ts +137 -0
- package/src/eject/setup-readiness-ui.tsx +29 -0
- package/src/eject/workspace-connections.ts +92 -0
- package/src/embedding/agent.ts +159 -0
- package/src/embedding/bridge.ts +297 -0
- package/src/embedding/index.ts +43 -0
- package/src/embedding/protocol.ts +185 -0
- package/src/embedding/react.tsx +319 -0
- package/src/embeddings/index.ts +233 -0
- package/src/eval/agent-runner.ts +210 -0
- package/src/eval/define-eval.ts +55 -0
- package/src/eval/index.ts +49 -0
- package/src/eval/report.ts +75 -0
- package/src/eval/runner.ts +369 -0
- package/src/eval/scorer.ts +244 -0
- package/src/eval/types.ts +188 -0
- package/src/event-bus/bus.ts +140 -0
- package/src/event-bus/index.ts +3 -0
- package/src/event-bus/registry.ts +79 -0
- package/src/event-bus/types.ts +29 -0
- package/src/extensions/actions.ts +1636 -0
- package/src/extensions/change-marker.ts +54 -0
- package/src/extensions/content-patch.ts +468 -0
- package/src/extensions/fetch-tool.ts +461 -0
- package/src/extensions/html-shell.ts +803 -0
- package/src/extensions/local.ts +462 -0
- package/src/extensions/path.ts +40 -0
- package/src/extensions/proxy-security.ts +171 -0
- package/src/extensions/routes.ts +1080 -0
- package/src/extensions/schema.ts +269 -0
- package/src/extensions/session-replay-iframe.ts +131 -0
- package/src/extensions/slots/routes.ts +126 -0
- package/src/extensions/slots/schema.ts +87 -0
- package/src/extensions/slots/store.ts +450 -0
- package/src/extensions/store.ts +1347 -0
- package/src/extensions/theme.ts +114 -0
- package/src/extensions/url-safety.ts +316 -0
- package/src/extensions/web-content.ts +663 -0
- package/src/extensions/web-search-tool.ts +437 -0
- package/src/feature-flags/a2a-action-route.ts +56 -0
- package/src/feature-flags/actions/get-feature-flags.ts +24 -0
- package/src/feature-flags/actions/list-feature-flags.ts +69 -0
- package/src/feature-flags/actions/set-feature-flag.ts +89 -0
- package/src/feature-flags/index.ts +21 -0
- package/src/feature-flags/permissions.ts +53 -0
- package/src/feature-flags/plugin.ts +44 -0
- package/src/feature-flags/registry.ts +96 -0
- package/src/feature-flags/store.ts +176 -0
- package/src/file-upload/actions/upload-image.ts +213 -0
- package/src/file-upload/builder.ts +431 -0
- package/src/file-upload/index.ts +24 -0
- package/src/file-upload/pre-upload-attachments.ts +305 -0
- package/src/file-upload/registry.ts +125 -0
- package/src/file-upload/types.ts +89 -0
- package/src/guards/db-tool-scoping.ts +129 -0
- package/src/guards/index.ts +23 -0
- package/src/guards/no-drizzle-push.ts +116 -0
- package/src/guards/no-env-credentials.ts +229 -0
- package/src/guards/no-env-mutation.ts +114 -0
- package/src/guards/no-localhost-fallback.ts +124 -0
- package/src/guards/no-unscoped-credentials.ts +227 -0
- package/src/guards/no-unscoped-queries.ts +834 -0
- package/src/guards/scan-utils.ts +105 -0
- package/src/guards/types.ts +30 -0
- package/src/history/actions/create-resource-version.ts +92 -0
- package/src/history/actions/get-resource-version.ts +60 -0
- package/src/history/actions/list-resource-history.ts +53 -0
- package/src/history/actions/list-resource-versions.ts +43 -0
- package/src/history/actions/restore-resource-version.ts +96 -0
- package/src/history/index.ts +26 -0
- package/src/history/registry.ts +111 -0
- package/src/history/store.ts +379 -0
- package/src/history/types.ts +69 -0
- package/src/index.browser.ts +155 -0
- package/src/index.ts +408 -0
- package/src/ingestion/docx.ts +158 -0
- package/src/ingestion/figma-node-to-html.ts +1860 -0
- package/src/ingestion/figma.ts +548 -0
- package/src/ingestion/index.ts +107 -0
- package/src/ingestion/media.ts +264 -0
- package/src/ingestion/notion.ts +121 -0
- package/src/ingestion/office.ts +213 -0
- package/src/ingestion/orchestration.ts +160 -0
- package/src/ingestion/pptx.ts +331 -0
- package/src/ingestion/selection.ts +81 -0
- package/src/ingestion/website.ts +151 -0
- package/src/integrations/a2a-continuation-marker.ts +2 -0
- package/src/integrations/a2a-continuation-processor.ts +888 -0
- package/src/integrations/a2a-continuations-store.ts +643 -0
- package/src/integrations/adapter-overrides.ts +12 -0
- package/src/integrations/adapters/discord.ts +364 -0
- package/src/integrations/adapters/email.ts +1164 -0
- package/src/integrations/adapters/google-docs.ts +371 -0
- package/src/integrations/adapters/index.ts +29 -0
- package/src/integrations/adapters/microsoft-teams.ts +413 -0
- package/src/integrations/adapters/slack.ts +1914 -0
- package/src/integrations/adapters/telegram.ts +386 -0
- package/src/integrations/adapters/whatsapp.ts +358 -0
- package/src/integrations/awaiting-input-store.ts +130 -0
- package/src/integrations/catalog.ts +571 -0
- package/src/integrations/computer-supervision-store.ts +423 -0
- package/src/integrations/computer-supervision.ts +213 -0
- package/src/integrations/config-store.ts +131 -0
- package/src/integrations/controls-store.ts +187 -0
- package/src/integrations/eject/messaging-adapters.ts +85 -0
- package/src/integrations/google-docs-poller.ts +671 -0
- package/src/integrations/identity-links-store.ts +210 -0
- package/src/integrations/identity.ts +196 -0
- package/src/integrations/index.ts +220 -0
- package/src/integrations/installations-store.ts +677 -0
- package/src/integrations/integration-memory.ts +187 -0
- package/src/integrations/internal-token.ts +106 -0
- package/src/integrations/pending-tasks-retry-job.ts +286 -0
- package/src/integrations/pending-tasks-store.ts +468 -0
- package/src/integrations/plugin.ts +3048 -0
- package/src/integrations/remote-commands-store.ts +690 -0
- package/src/integrations/remote-devices-store.ts +492 -0
- package/src/integrations/remote-json-safety.ts +127 -0
- package/src/integrations/remote-push-delivery-job.ts +48 -0
- package/src/integrations/remote-push-delivery.ts +370 -0
- package/src/integrations/remote-push-store.ts +664 -0
- package/src/integrations/remote-retry-job.ts +55 -0
- package/src/integrations/remote-run-events-store.ts +222 -0
- package/src/integrations/remote-types.ts +186 -0
- package/src/integrations/runtime.ts +1 -0
- package/src/integrations/scope-store.ts +498 -0
- package/src/integrations/slack-manifest.ts +78 -0
- package/src/integrations/slack-oauth.ts +344 -0
- package/src/integrations/task-queue-stats.ts +144 -0
- package/src/integrations/thread-mapping-store.ts +134 -0
- package/src/integrations/types.ts +485 -0
- package/src/integrations/usage-budget-store.ts +906 -0
- package/src/integrations/webhook-delivery.ts +55 -0
- package/src/integrations/webhook-handler.ts +1939 -0
- package/src/jobs/actions/list-recurring-jobs.ts +105 -0
- package/src/jobs/actions/manage-recurring-job.ts +85 -0
- package/src/jobs/cron.ts +126 -0
- package/src/jobs/index.ts +9 -0
- package/src/jobs/scheduler.ts +703 -0
- package/src/jobs/tools.ts +367 -0
- package/src/local-artifacts/index.ts +1372 -0
- package/src/localization/actions/get-localization-preference.ts +24 -0
- package/src/localization/actions/set-localization-preference.ts +32 -0
- package/src/localization/default-messages.ts +1009 -0
- package/src/localization/index.ts +2 -0
- package/src/localization/server.ts +131 -0
- package/src/localization/shared.ts +208 -0
- package/src/mcp/actions/call-mcp-tool.ts +19 -0
- package/src/mcp/actions/create-org-service-token.ts +87 -0
- package/src/mcp/actions/list-mcp-tools.ts +18 -0
- package/src/mcp/actions/list-org-service-tokens.ts +44 -0
- package/src/mcp/actions/revoke-org-service-token.ts +30 -0
- package/src/mcp/actions/service-token-access.ts +121 -0
- package/src/mcp/ask-app-inline-tasks.ts +125 -0
- package/src/mcp/build-server.ts +2356 -0
- package/src/mcp/builtin-tools.ts +1506 -0
- package/src/mcp/connect-route.ts +1460 -0
- package/src/mcp/connect-store.ts +680 -0
- package/src/mcp/embed-app.ts +2051 -0
- package/src/mcp/embed-route.ts +84 -0
- package/src/mcp/external-agent-policy.ts +18 -0
- package/src/mcp/index.ts +47 -0
- package/src/mcp/oauth-route.ts +1016 -0
- package/src/mcp/oauth-store.ts +581 -0
- package/src/mcp/oauth-token.ts +227 -0
- package/src/mcp/org-directory.ts +343 -0
- package/src/mcp/route-paths.ts +34 -0
- package/src/mcp/screen-memory-stdio.ts +290 -0
- package/src/mcp/server.ts +507 -0
- package/src/mcp/stdio.ts +328 -0
- package/src/mcp/workspace-resolve.ts +261 -0
- package/src/mcp-client/app-api.ts +136 -0
- package/src/mcp-client/app-result.ts +64 -0
- package/src/mcp-client/builtin-capabilities.ts +146 -0
- package/src/mcp-client/builtin-store.ts +93 -0
- package/src/mcp-client/config.ts +281 -0
- package/src/mcp-client/errors.ts +54 -0
- package/src/mcp-client/hub-client.ts +172 -0
- package/src/mcp-client/hub-routes.ts +198 -0
- package/src/mcp-client/index.ts +504 -0
- package/src/mcp-client/manager.ts +968 -0
- package/src/mcp-client/oauth-client.ts +462 -0
- package/src/mcp-client/oauth-routes.ts +307 -0
- package/src/mcp-client/remote-store.ts +674 -0
- package/src/mcp-client/remote-url.ts +97 -0
- package/src/mcp-client/routes.ts +1093 -0
- package/src/mcp-client/screen-memory-local.ts +461 -0
- package/src/mcp-client/tool-policy.ts +182 -0
- package/src/mcp-client/visibility.ts +56 -0
- package/src/mcp-client/workspace-servers.ts +379 -0
- package/src/navigation/index.ts +170 -0
- package/src/notifications/actions.ts +151 -0
- package/src/notifications/channels.ts +410 -0
- package/src/notifications/index.ts +22 -0
- package/src/notifications/registry.ts +216 -0
- package/src/notifications/routes.ts +106 -0
- package/src/notifications/store.ts +236 -0
- package/src/notifications/types.ts +52 -0
- package/src/oauth-tokens/google-refresh.ts +175 -0
- package/src/oauth-tokens/index.ts +15 -0
- package/src/oauth-tokens/store.ts +384 -0
- package/src/observability/cleanup-job.ts +124 -0
- package/src/observability/evals.ts +507 -0
- package/src/observability/experiments.ts +359 -0
- package/src/observability/feedback.ts +332 -0
- package/src/observability/hosted-model-experiment.ts +118 -0
- package/src/observability/index.ts +62 -0
- package/src/observability/plugin.ts +31 -0
- package/src/observability/routes.ts +431 -0
- package/src/observability/sentiment.ts +261 -0
- package/src/observability/store.ts +1347 -0
- package/src/observability/traces.ts +789 -0
- package/src/observability/tracing.ts +157 -0
- package/src/observability/tracking-identity.ts +55 -0
- package/src/observability/types.ts +211 -0
- package/src/onboarding/default-steps.ts +428 -0
- package/src/onboarding/index.ts +22 -0
- package/src/onboarding/plugin.ts +262 -0
- package/src/onboarding/registry.ts +47 -0
- package/src/onboarding/types.ts +96 -0
- package/src/org/accept-pending.ts +98 -0
- package/src/org/auto-join-domain.ts +113 -0
- package/src/org/context.ts +614 -0
- package/src/org/free-email-providers.ts +124 -0
- package/src/org/handlers.ts +1153 -0
- package/src/org/index.ts +63 -0
- package/src/org/migrations.ts +105 -0
- package/src/org/permissions.ts +30 -0
- package/src/org/plugin.ts +255 -0
- package/src/org/schema.ts +28 -0
- package/src/org/types.ts +57 -0
- package/src/org-team/index.ts +1 -0
- package/src/package-lifecycle/deprecated-imports.ts +179 -0
- package/src/package-lifecycle/eject-manifest.ts +345 -0
- package/src/package-lifecycle/index.ts +7 -0
- package/src/package-lifecycle/manifest.ts +120 -0
- package/src/package-lifecycle/migration-manifest.ts +159 -0
- package/src/package-lifecycle/migration-message.ts +6 -0
- package/src/package-lifecycle/tombstone.ts +58 -0
- package/src/package-lifecycle/upgrade-error.ts +37 -0
- package/src/private-blob/index.ts +18 -0
- package/src/private-blob/registry.ts +242 -0
- package/src/private-blob/types.ts +55 -0
- package/src/progress/actions.ts +179 -0
- package/src/progress/index.ts +16 -0
- package/src/progress/registry.ts +127 -0
- package/src/progress/routes.ts +89 -0
- package/src/progress/store.ts +353 -0
- package/src/progress/types.ts +59 -0
- package/src/provider-api/actions/custom-provider-registration.ts +197 -0
- package/src/provider-api/actions/delete-staged-dataset.ts +5 -0
- package/src/provider-api/actions/github-repo-files.ts +266 -0
- package/src/provider-api/actions/list-staged-datasets.ts +5 -0
- package/src/provider-api/actions/provider-api-audit.ts +88 -0
- package/src/provider-api/actions/provider-api.ts +460 -0
- package/src/provider-api/actions/query-staged-dataset.ts +5 -0
- package/src/provider-api/actions/staged-datasets.ts +359 -0
- package/src/provider-api/corpus-jobs-store.ts +522 -0
- package/src/provider-api/corpus-jobs.ts +1817 -0
- package/src/provider-api/custom-registry.ts +456 -0
- package/src/provider-api/github-repo.ts +675 -0
- package/src/provider-api/gong.ts +108 -0
- package/src/provider-api/index.ts +5444 -0
- package/src/provider-api/quota-governor.ts +562 -0
- package/src/provider-api/runtime.ts +1 -0
- package/src/provider-api/staged-datasets-aggregate.ts +304 -0
- package/src/provider-api/staged-datasets-store.ts +441 -0
- package/src/provider-api/staging.ts +483 -0
- package/src/resources/agents.ts +65 -0
- package/src/resources/emitter.ts +54 -0
- package/src/resources/handlers.ts +728 -0
- package/src/resources/index.ts +4 -0
- package/src/resources/metadata.ts +252 -0
- package/src/resources/script-helpers.ts +160 -0
- package/src/resources/store.ts +1618 -0
- package/src/review/actions/consume-review-feedback.ts +48 -0
- package/src/review/actions/create-review-comment.ts +108 -0
- package/src/review/actions/delete-review-comment.ts +67 -0
- package/src/review/actions/get-review-feedback.ts +49 -0
- package/src/review/actions/list-review-comments.ts +87 -0
- package/src/review/actions/reply-review-comment.ts +118 -0
- package/src/review/actions/resolve-review-thread.ts +94 -0
- package/src/review/actions/send-review-thread-to-agent.ts +62 -0
- package/src/review/actions/set-review-status.ts +58 -0
- package/src/review/identity.ts +101 -0
- package/src/review/index.ts +45 -0
- package/src/review/mentions.ts +44 -0
- package/src/review/registry.ts +111 -0
- package/src/review/store.ts +997 -0
- package/src/review/types.ts +101 -0
- package/src/router/index.ts +24 -0
- package/src/scripts/agent-engines/list-agent-engines.ts +130 -0
- package/src/scripts/agent-engines/manage-agent-engine.ts +197 -0
- package/src/scripts/agent-engines/set-agent-engine.ts +84 -0
- package/src/scripts/agent-engines/test-agent-engine.ts +174 -0
- package/src/scripts/call-agent.ts +792 -0
- package/src/scripts/chat/index.ts +8 -0
- package/src/scripts/chat/open-chat.ts +56 -0
- package/src/scripts/chat/search-chats.ts +121 -0
- package/src/scripts/core-scripts.ts +22 -0
- package/src/scripts/db/check-scoping.ts +212 -0
- package/src/scripts/db/exec.ts +791 -0
- package/src/scripts/db/index.ts +19 -0
- package/src/scripts/db/migrate-encrypt-credentials.ts +223 -0
- package/src/scripts/db/migrate-encrypt-oauth-tokens.ts +213 -0
- package/src/scripts/db/migrate-user-api-keys.ts +257 -0
- package/src/scripts/db/patch.ts +820 -0
- package/src/scripts/db/query.ts +299 -0
- package/src/scripts/db/reset-dev-owner.ts +285 -0
- package/src/scripts/db/safety.ts +286 -0
- package/src/scripts/db/schema.ts +364 -0
- package/src/scripts/db/scoping.ts +341 -0
- package/src/scripts/db/sqlite-client.ts +78 -0
- package/src/scripts/db/tool-mode.ts +23 -0
- package/src/scripts/db/tool-schemas.ts +31 -0
- package/src/scripts/db/wipe-leaked-builder-keys.ts +201 -0
- package/src/scripts/dev/index.ts +296 -0
- package/src/scripts/dev/list-files.ts +119 -0
- package/src/scripts/dev/read-file.ts +77 -0
- package/src/scripts/dev/search-files.ts +151 -0
- package/src/scripts/dev/shell.ts +111 -0
- package/src/scripts/dev/write-file.ts +56 -0
- package/src/scripts/dev-session.ts +96 -0
- package/src/scripts/docs/index.ts +8 -0
- package/src/scripts/docs/search.ts +274 -0
- package/src/scripts/docs/source-search.ts +363 -0
- package/src/scripts/index.ts +15 -0
- package/src/scripts/manage-agent-loop-settings.ts +84 -0
- package/src/scripts/parse-args.ts +46 -0
- package/src/scripts/resources/delete-memory.ts +67 -0
- package/src/scripts/resources/delete.ts +69 -0
- package/src/scripts/resources/effective.ts +71 -0
- package/src/scripts/resources/index.ts +18 -0
- package/src/scripts/resources/list.ts +103 -0
- package/src/scripts/resources/migrate-learnings.ts +40 -0
- package/src/scripts/resources/read.ts +107 -0
- package/src/scripts/resources/save-memory.ts +99 -0
- package/src/scripts/resources/write.ts +158 -0
- package/src/scripts/runner.ts +339 -0
- package/src/scripts/utils.ts +130 -0
- package/src/search/index.ts +413 -0
- package/src/search-utils/index.ts +112 -0
- package/src/secrets/crypto.ts +228 -0
- package/src/secrets/index.ts +65 -0
- package/src/secrets/onboarding.ts +101 -0
- package/src/secrets/register-framework-secrets.ts +228 -0
- package/src/secrets/register.ts +129 -0
- package/src/secrets/routes.ts +697 -0
- package/src/secrets/schema.ts +52 -0
- package/src/secrets/storage.ts +561 -0
- package/src/secrets/substitution.ts +305 -0
- package/src/server/__snapshots__/agent-chat-plugin.surface.spec.ts.snap +150 -0
- package/src/server/action-change.ts +66 -0
- package/src/server/action-discovery.ts +774 -0
- package/src/server/action-routes.ts +608 -0
- package/src/server/agent-access.ts +72 -0
- package/src/server/agent-chat/action-filters-a2a.ts +339 -0
- package/src/server/agent-chat/browser-team-tools.ts +510 -0
- package/src/server/agent-chat/context-tools.ts +599 -0
- package/src/server/agent-chat/framework-prompts.ts +467 -0
- package/src/server/agent-chat/lazy-fs.ts +11 -0
- package/src/server/agent-chat/mcp-glue.ts +91 -0
- package/src/server/agent-chat/plugin-options.ts +379 -0
- package/src/server/agent-chat/process-run-failure.ts +62 -0
- package/src/server/agent-chat/prompt-resources.ts +1004 -0
- package/src/server/agent-chat/recurring-jobs-runtime.ts +80 -0
- package/src/server/agent-chat/request-surface.ts +71 -0
- package/src/server/agent-chat/run-code-tools.ts +67 -0
- package/src/server/agent-chat/script-entries.ts +796 -0
- package/src/server/agent-chat/shared-thread.ts +301 -0
- package/src/server/agent-chat/skill-frontmatter.ts +41 -0
- package/src/server/agent-chat-plugin.ts +5930 -0
- package/src/server/agent-discovery.ts +706 -0
- package/src/server/agent-engine-api-key-route.ts +236 -0
- package/src/server/agent-run-context.ts +204 -0
- package/src/server/agent-teams-run-queue.ts +344 -0
- package/src/server/agent-teams.ts +2257 -0
- package/src/server/agents-bundle.ts +464 -0
- package/src/server/analytics.ts +105 -0
- package/src/server/app-base-path.ts +79 -0
- package/src/server/app-name.ts +53 -0
- package/src/server/app-url.ts +184 -0
- package/src/server/attachment-actions.ts +276 -0
- package/src/server/attribution.ts +214 -0
- package/src/server/auth-marketing.ts +260 -0
- package/src/server/auth-plugin.ts +27 -0
- package/src/server/auth.ts +3803 -0
- package/src/server/better-auth-instance.ts +1197 -0
- package/src/server/builder-browser.ts +1701 -0
- package/src/server/builder-design-systems.ts +668 -0
- package/src/server/builder-space.ts +176 -0
- package/src/server/captcha.ts +63 -0
- package/src/server/capture-error.ts +64 -0
- package/src/server/cli-capture.ts +141 -0
- package/src/server/collab-plugin.ts +391 -0
- package/src/server/complete-text.ts +231 -0
- package/src/server/cookie-namespace.ts +159 -0
- package/src/server/core-routes-plugin.ts +4122 -0
- package/src/server/cors-origins.ts +60 -0
- package/src/server/create-server.ts +268 -0
- package/src/server/credential-provider.ts +1202 -0
- package/src/server/csrf.ts +229 -0
- package/src/server/date-utils.ts +42 -0
- package/src/server/deep-link.ts +119 -0
- package/src/server/derived-secret.ts +32 -0
- package/src/server/design-token-utils.ts +1032 -0
- package/src/server/desktop-sso.ts +83 -0
- package/src/server/edge.ts +69 -0
- package/src/server/email-actions.ts +218 -0
- package/src/server/email-template.ts +192 -0
- package/src/server/email-templates.ts +148 -0
- package/src/server/email.ts +219 -0
- package/src/server/embed-route.ts +283 -0
- package/src/server/embed-session.ts +805 -0
- package/src/server/embedded.ts +252 -0
- package/src/server/entry-server.tsx +154 -0
- package/src/server/framework-request-handler.ts +848 -0
- package/src/server/fusion-app.ts +447 -0
- package/src/server/google-auth-mode.ts +34 -0
- package/src/server/google-auth-plugin.ts +496 -0
- package/src/server/google-oauth-credentials.ts +128 -0
- package/src/server/google-oauth.ts +972 -0
- package/src/server/google-realtime-session.ts +182 -0
- package/src/server/h3-helpers.ts +174 -0
- package/src/server/http-response-telemetry.ts +396 -0
- package/src/server/identity-sso-store.ts +304 -0
- package/src/server/identity-sso.ts +514 -0
- package/src/server/index.ts +593 -0
- package/src/server/missing-key.ts +36 -0
- package/src/server/oauth-helpers.ts +44 -0
- package/src/server/oauth-public-origin.ts +44 -0
- package/src/server/oauth-return-url.ts +120 -0
- package/src/server/og-fonts-data.ts +15 -0
- package/src/server/og-fonts.ts +75 -0
- package/src/server/onboarding-html.ts +4040 -0
- package/src/server/open-route.ts +311 -0
- package/src/server/org-admin.ts +28 -0
- package/src/server/poll-events.ts +88 -0
- package/src/server/poll.ts +1224 -0
- package/src/server/prompts/framework-core-compact.ts +107 -0
- package/src/server/prompts/framework-core.ts +143 -0
- package/src/server/prompts/index.ts +16 -0
- package/src/server/prompts/model-overlays.ts +54 -0
- package/src/server/prompts/shared-rules.ts +104 -0
- package/src/server/realtime-voice.ts +967 -0
- package/src/server/recap-image-route.ts +242 -0
- package/src/server/recap-image-store.ts +185 -0
- package/src/server/request-context.ts +416 -0
- package/src/server/request-origin.ts +67 -0
- package/src/server/resources-plugin.ts +119 -0
- package/src/server/schema-prompt.ts +429 -0
- package/src/server/scoped-key-storage.ts +223 -0
- package/src/server/security-headers.ts +170 -0
- package/src/server/self-dispatch.ts +224 -0
- package/src/server/sentry-config.ts +73 -0
- package/src/server/sentry-plugin.ts +138 -0
- package/src/server/sentry.ts +444 -0
- package/src/server/short-lived-token.ts +170 -0
- package/src/server/social-og-image.ts +454 -0
- package/src/server/sse.ts +102 -0
- package/src/server/ssr-handler.ts +466 -0
- package/src/server/transcribe-voice.ts +1076 -0
- package/src/server/voice-providers-status.ts +118 -0
- package/src/server/workspace-oauth.ts +31 -0
- package/src/server/workspace-provider-oauth.ts +970 -0
- package/src/session-replay-iframe-protocol.ts +58 -0
- package/src/settings/handlers.ts +44 -0
- package/src/settings/index.ts +34 -0
- package/src/settings/org-settings.ts +83 -0
- package/src/settings/script-helpers.ts +24 -0
- package/src/settings/store.ts +247 -0
- package/src/settings/user-settings.ts +47 -0
- package/src/setup-connections/index.ts +90 -0
- package/src/setup-connections/onboarding.ts +47 -0
- package/src/shared/agent-access.ts +112 -0
- package/src/shared/agent-chat.ts +124 -0
- package/src/shared/agent-env.ts +46 -0
- package/src/shared/agent-readable-resource.ts +111 -0
- package/src/shared/agent-sidebar-url.ts +39 -0
- package/src/shared/cache-control.ts +25 -0
- package/src/shared/cloudflare-globals.d.ts +34 -0
- package/src/shared/context-xray.ts +172 -0
- package/src/shared/embed-auth.ts +6 -0
- package/src/shared/index.ts +83 -0
- package/src/shared/llm-connection.ts +42 -0
- package/src/shared/markdown-block-split.ts +129 -0
- package/src/shared/mcp-connect-content.ts +130 -0
- package/src/shared/mcp-embed-headers.ts +175 -0
- package/src/shared/mcp-integration-config.ts +101 -0
- package/src/shared/merge-by-id.ts +14 -0
- package/src/shared/oauth-state.ts +39 -0
- package/src/shared/reasoning-effort.ts +228 -0
- package/src/shared/route-warmup-config.ts +128 -0
- package/src/shared/runtime.ts +31 -0
- package/src/shared/social-meta.ts +82 -0
- package/src/shared/streaming-text-smoothing.ts +184 -0
- package/src/shared/truncate.ts +13 -0
- package/src/shared/workspace-app-audience.ts +177 -0
- package/src/shared/workspace-app-id.ts +54 -0
- package/src/sharing/access.ts +585 -0
- package/src/sharing/actions/create-agent-resource-link.ts +91 -0
- package/src/sharing/actions/extension-change.ts +22 -0
- package/src/sharing/actions/list-resource-shares.ts +93 -0
- package/src/sharing/actions/set-resource-visibility.ts +91 -0
- package/src/sharing/actions/share-resource.ts +322 -0
- package/src/sharing/actions/unshare-resource.ts +72 -0
- package/src/sharing/index.ts +35 -0
- package/src/sharing/registry.ts +201 -0
- package/src/sharing/schema.ts +99 -0
- package/src/styles/agent-conversation.css +766 -0
- package/src/styles/agent-native.css +938 -0
- package/src/styles/blocks.css +1717 -0
- package/src/styles/chat-history-list.css +1 -0
- package/src/styles/rich-markdown-editor.css +1 -0
- package/src/tailwind.preset.ts +140 -0
- package/src/templates/chat/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/chat/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/src/templates/chat/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/src/templates/chat/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/src/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/chat/AGENTS.md +6 -2
- package/src/templates/chat/app/components/layout/Sidebar.tsx +51 -157
- package/src/templates/default/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/default/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/src/templates/default/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/src/templates/default/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/src/templates/default/.agents/skills/onboarding/SKILL.md +56 -0
- package/src/templates/default/.agents/skills/secrets/SKILL.md +273 -0
- package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/default/AGENTS.md +26 -18
- package/src/templates/headless/.agents/skills/actions/SKILL.md +512 -0
- package/src/templates/headless/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/src/templates/headless/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/src/templates/headless/.agents/skills/integration-webhooks/SKILL.md +323 -0
- package/src/templates/headless/.agents/skills/secrets/SKILL.md +273 -0
- package/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/headless/AGENTS.md +8 -0
- package/src/templates/workspace-core/.agents/skills/actions/SKILL.md +32 -12
- package/src/templates/workspace-core/.agents/skills/agent-native-docs/SKILL.md +21 -9
- package/src/templates/workspace-core/.agents/skills/agent-native-toolkit/SKILL.md +7 -0
- package/src/templates/workspace-core/.agents/skills/customizing-agent-native/SKILL.md +145 -0
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +14 -2
- package/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +6 -0
- package/src/templates/workspace-core/AGENTS.md +4 -0
- package/src/templates/workspace-root/AGENTS.md +4 -0
- package/src/terminal/cli-registry.ts +57 -0
- package/src/terminal/index.ts +22 -0
- package/src/terminal/pty-server.ts +389 -0
- package/src/terminal/terminal-plugin.ts +265 -0
- package/src/testing.ts +23 -0
- package/src/tracking/index.ts +10 -0
- package/src/tracking/providers.ts +422 -0
- package/src/tracking/registry.ts +102 -0
- package/src/tracking/route.ts +108 -0
- package/src/tracking/types.ts +16 -0
- package/src/transcription/builder-transcription.ts +118 -0
- package/src/triggers/actions/list-automations.ts +99 -0
- package/src/triggers/actions/manage-automation.ts +78 -0
- package/src/triggers/actions.ts +333 -0
- package/src/triggers/condition-evaluator.ts +163 -0
- package/src/triggers/dispatcher.ts +536 -0
- package/src/triggers/index.ts +13 -0
- package/src/triggers/routes.ts +322 -0
- package/src/triggers/types.ts +42 -0
- package/src/types/pglite.d.ts +26 -0
- package/src/usage/store.ts +698 -0
- package/src/vite/action-types-plugin.ts +481 -0
- package/src/vite/agent-web-plugin.ts +78 -0
- package/src/vite/agents-bundle-plugin.ts +185 -0
- package/src/vite/client.ts +3039 -0
- package/src/vite/index.ts +21 -0
- package/src/voice/index.ts +18 -0
- package/src/voice/voice-cleanup-prompt.ts +38 -0
- package/src/voice/voice-context.ts +217 -0
- package/src/voice/voice-replacements.ts +75 -0
- package/src/workspace-connections/credentials.ts +603 -0
- package/src/workspace-connections/index.ts +72 -0
- package/src/workspace-connections/lifecycle.ts +43 -0
- package/src/workspace-connections/store.ts +1943 -0
- package/src/workspace-files/index.ts +18 -0
- package/src/workspace-files/store.ts +339 -0
- package/src/workspace-files/tool.ts +266 -0
|
@@ -0,0 +1,1813 @@
|
|
|
1
|
+
import crypto from "crypto";
|
|
2
|
+
import fs from "fs";
|
|
3
|
+
import path from "path";
|
|
4
|
+
import { fileURLToPath } from "url";
|
|
5
|
+
|
|
6
|
+
import {
|
|
7
|
+
appendCodeAgentTranscriptEvent,
|
|
8
|
+
codeAgentRunArtifactsDir,
|
|
9
|
+
createCodeAgentRunRecord,
|
|
10
|
+
getLastCodeAgentRunRecord,
|
|
11
|
+
listCodeAgentRunRecords,
|
|
12
|
+
writeCodeAgentRunRecord,
|
|
13
|
+
type CodeAgentRunRecord,
|
|
14
|
+
} from "./code-agent-runs.js";
|
|
15
|
+
|
|
16
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
17
|
+
const __dirname = path.dirname(__filename);
|
|
18
|
+
|
|
19
|
+
const DEFAULT_APP_NAME = "migration";
|
|
20
|
+
const DEFAULT_OUTPUT = "../migrated-app";
|
|
21
|
+
const DEFAULT_TARGET = "agent-native";
|
|
22
|
+
const DEFAULT_DOSSIER_DIR = "agent-native-migration-dossier";
|
|
23
|
+
const MIGRATION_DEV_PORT = 8101;
|
|
24
|
+
const MIGRATE_SUBCOMMANDS = new Set(["resume", "status", "stop", "ui"]);
|
|
25
|
+
const MIGRATION_SESSION_COMMAND = "agent-native code /migrate";
|
|
26
|
+
const MODEL_CREDENTIAL_ENV_NAMES = [
|
|
27
|
+
"ANTHROPIC_API_KEY",
|
|
28
|
+
"OPENAI_API_KEY",
|
|
29
|
+
"GOOGLE_GENERATIVE_AI_API_KEY",
|
|
30
|
+
"GROQ_API_KEY",
|
|
31
|
+
"MISTRAL_API_KEY",
|
|
32
|
+
"COHERE_API_KEY",
|
|
33
|
+
"BUILDER_PRIVATE_KEY",
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
type MigrateSubcommand = "resume" | "status" | "stop" | "ui";
|
|
37
|
+
type SourceKind = "path" | "url" | "description";
|
|
38
|
+
|
|
39
|
+
export interface MigrateCliOptions {
|
|
40
|
+
subcommand?: MigrateSubcommand;
|
|
41
|
+
source?: string;
|
|
42
|
+
sourcePath?: string;
|
|
43
|
+
sourceUrl?: string;
|
|
44
|
+
sourceDescription?: string;
|
|
45
|
+
workbench?: string;
|
|
46
|
+
output?: string;
|
|
47
|
+
appName?: string;
|
|
48
|
+
target?: string;
|
|
49
|
+
planOnly?: boolean;
|
|
50
|
+
planFile?: string;
|
|
51
|
+
emit?: boolean;
|
|
52
|
+
emitDir?: string;
|
|
53
|
+
appSurface?: boolean;
|
|
54
|
+
last?: boolean;
|
|
55
|
+
help?: boolean;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface SourceSpec {
|
|
59
|
+
kind: SourceKind;
|
|
60
|
+
value: string;
|
|
61
|
+
sourceRoot?: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export interface EmitDossierResult {
|
|
66
|
+
dossierRoot: string;
|
|
67
|
+
files: string[];
|
|
68
|
+
source: SourceSpec;
|
|
69
|
+
usedMigrateHelpers: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface ProjectIRLike {
|
|
73
|
+
site: {
|
|
74
|
+
framework: "nextjs" | "react" | "aem" | "unknown";
|
|
75
|
+
sourceRoot: string;
|
|
76
|
+
routes: Array<{
|
|
77
|
+
id: string;
|
|
78
|
+
path: string;
|
|
79
|
+
filePath: string;
|
|
80
|
+
router: "next-pages" | "next-app" | "unknown";
|
|
81
|
+
kind: "marketing" | "docs" | "landing" | "app" | "api" | "unknown";
|
|
82
|
+
dynamic: boolean;
|
|
83
|
+
public: boolean;
|
|
84
|
+
notes?: string[];
|
|
85
|
+
}>;
|
|
86
|
+
redirects: Array<Record<string, unknown>>;
|
|
87
|
+
metadata: Record<string, unknown>;
|
|
88
|
+
};
|
|
89
|
+
components: {
|
|
90
|
+
components: Array<{
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
filePath: string;
|
|
94
|
+
usedByRoutes: string[];
|
|
95
|
+
notes?: string[];
|
|
96
|
+
}>;
|
|
97
|
+
designTokens: Record<string, unknown>;
|
|
98
|
+
};
|
|
99
|
+
content: {
|
|
100
|
+
models: Array<Record<string, unknown>>;
|
|
101
|
+
assets: Array<{
|
|
102
|
+
id: string;
|
|
103
|
+
path: string;
|
|
104
|
+
type: string;
|
|
105
|
+
metadata?: Record<string, unknown>;
|
|
106
|
+
}>;
|
|
107
|
+
};
|
|
108
|
+
behavior: {
|
|
109
|
+
apiEndpoints: Array<{
|
|
110
|
+
id: string;
|
|
111
|
+
path: string;
|
|
112
|
+
method: string;
|
|
113
|
+
filePath: string;
|
|
114
|
+
recommendedRecipe: string;
|
|
115
|
+
}>;
|
|
116
|
+
dataStores: Array<{
|
|
117
|
+
id: string;
|
|
118
|
+
name: string;
|
|
119
|
+
filePath: string;
|
|
120
|
+
kind: "database" | "api" | "local-state" | "unknown";
|
|
121
|
+
}>;
|
|
122
|
+
llmCalls: Array<{ id: string; filePath: string; provider: string }>;
|
|
123
|
+
clientState: Array<{ id: string; filePath: string; reason: string }>;
|
|
124
|
+
auth: Array<{ id: string; filePath: string; provider: string }>;
|
|
125
|
+
jobs: Array<{ id: string; filePath: string; kind: string }>;
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export function parseMigrateArgs(argv: string[]): MigrateCliOptions {
|
|
130
|
+
const opts: MigrateCliOptions = {};
|
|
131
|
+
for (let i = 0; i < argv.length; i++) {
|
|
132
|
+
const arg = argv[i];
|
|
133
|
+
|
|
134
|
+
if (i === 0 && MIGRATE_SUBCOMMANDS.has(arg)) {
|
|
135
|
+
opts.subcommand = arg as MigrateSubcommand;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (arg === "--help" || arg === "-h") {
|
|
140
|
+
opts.help = true;
|
|
141
|
+
} else if (arg === "--out" && argv[i + 1]) {
|
|
142
|
+
opts.output = argv[++i];
|
|
143
|
+
} else if (arg.startsWith("--out=")) {
|
|
144
|
+
opts.output = arg.slice("--out=".length);
|
|
145
|
+
} else if (arg === "--name" && argv[i + 1]) {
|
|
146
|
+
opts.appName = argv[++i];
|
|
147
|
+
} else if (arg.startsWith("--name=")) {
|
|
148
|
+
opts.appName = arg.slice("--name=".length);
|
|
149
|
+
} else if (arg === "--target" && argv[i + 1]) {
|
|
150
|
+
opts.target = argv[++i];
|
|
151
|
+
} else if (arg.startsWith("--target=")) {
|
|
152
|
+
opts.target = arg.slice("--target=".length);
|
|
153
|
+
} else if (arg === "--source" && argv[i + 1]) {
|
|
154
|
+
setSourceOption(opts, argv[++i]);
|
|
155
|
+
} else if (arg.startsWith("--source=")) {
|
|
156
|
+
setSourceOption(opts, arg.slice("--source=".length));
|
|
157
|
+
} else if (arg === "--path" && argv[i + 1]) {
|
|
158
|
+
opts.sourcePath = argv[++i];
|
|
159
|
+
} else if (arg.startsWith("--path=")) {
|
|
160
|
+
opts.sourcePath = arg.slice("--path=".length);
|
|
161
|
+
} else if (arg === "--url" && argv[i + 1]) {
|
|
162
|
+
opts.sourceUrl = argv[++i];
|
|
163
|
+
} else if (arg.startsWith("--url=")) {
|
|
164
|
+
opts.sourceUrl = arg.slice("--url=".length);
|
|
165
|
+
} else if (
|
|
166
|
+
(arg === "--description" || arg === "--describe") &&
|
|
167
|
+
argv[i + 1]
|
|
168
|
+
) {
|
|
169
|
+
opts.sourceDescription = argv[++i];
|
|
170
|
+
} else if (arg.startsWith("--description=")) {
|
|
171
|
+
opts.sourceDescription = arg.slice("--description=".length);
|
|
172
|
+
} else if (arg.startsWith("--describe=")) {
|
|
173
|
+
opts.sourceDescription = arg.slice("--describe=".length);
|
|
174
|
+
} else if (arg === "--emit") {
|
|
175
|
+
opts.emit = true;
|
|
176
|
+
if (argv[i + 1] && !argv[i + 1].startsWith("-")) {
|
|
177
|
+
opts.emitDir = argv[++i];
|
|
178
|
+
}
|
|
179
|
+
} else if (arg.startsWith("--emit=")) {
|
|
180
|
+
opts.emit = true;
|
|
181
|
+
opts.emitDir = arg.slice("--emit=".length);
|
|
182
|
+
} else if (arg === "--emit-dir" && argv[i + 1]) {
|
|
183
|
+
opts.emit = true;
|
|
184
|
+
opts.emitDir = argv[++i];
|
|
185
|
+
} else if (arg.startsWith("--emit-dir=")) {
|
|
186
|
+
opts.emit = true;
|
|
187
|
+
opts.emitDir = arg.slice("--emit-dir=".length);
|
|
188
|
+
} else if (arg === "--app-surface" || arg === "--workbench") {
|
|
189
|
+
opts.appSurface = true;
|
|
190
|
+
} else if (arg === "--plan-only") {
|
|
191
|
+
opts.planOnly = true;
|
|
192
|
+
} else if (arg === "--plan-file" && argv[i + 1]) {
|
|
193
|
+
opts.planFile = argv[++i];
|
|
194
|
+
} else if (arg.startsWith("--plan-file=")) {
|
|
195
|
+
opts.planFile = arg.slice("--plan-file=".length);
|
|
196
|
+
} else if (arg === "--last") {
|
|
197
|
+
opts.last = true;
|
|
198
|
+
} else if (!arg.startsWith("-")) {
|
|
199
|
+
if (
|
|
200
|
+
opts.subcommand &&
|
|
201
|
+
["status", "stop", "ui"].includes(opts.subcommand) &&
|
|
202
|
+
!opts.workbench
|
|
203
|
+
) {
|
|
204
|
+
opts.workbench = arg;
|
|
205
|
+
} else if (!opts.source) {
|
|
206
|
+
opts.source = arg;
|
|
207
|
+
} else if (!opts.workbench) {
|
|
208
|
+
opts.workbench = arg;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return opts;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export async function runMigrate(argv: string[]): Promise<void> {
|
|
216
|
+
const opts = parseMigrateArgs(argv);
|
|
217
|
+
if (opts.help) {
|
|
218
|
+
console.log(migrateUsage());
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (opts.subcommand === "status") {
|
|
223
|
+
printMigrationStatus(opts);
|
|
224
|
+
return;
|
|
225
|
+
}
|
|
226
|
+
if (opts.subcommand === "stop") {
|
|
227
|
+
printMigrationStop(opts);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (opts.subcommand === "ui") {
|
|
231
|
+
printMigrationUi(opts);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (opts.emit) {
|
|
235
|
+
try {
|
|
236
|
+
const result = await emitOwnAgentDossier(opts);
|
|
237
|
+
console.log(renderEmitResult(result));
|
|
238
|
+
} catch (error) {
|
|
239
|
+
if (isExpectedMigrationCliError(error)) {
|
|
240
|
+
console.error(`\n${migrationCliErrorMessage(error)}\n`);
|
|
241
|
+
process.exit(1);
|
|
242
|
+
}
|
|
243
|
+
throw error;
|
|
244
|
+
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
if (opts.subcommand === "resume" && !hasAnySource(opts)) {
|
|
248
|
+
printMigrationResume(opts);
|
|
249
|
+
return;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
if (opts.appSurface) {
|
|
253
|
+
await scaffoldOrResumeWorkbench();
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
try {
|
|
258
|
+
await createMigrationCodeAgentSession(opts);
|
|
259
|
+
} catch (error) {
|
|
260
|
+
if (isExpectedMigrationCliError(error)) {
|
|
261
|
+
console.error(`\n${migrationCliErrorMessage(error)}\n`);
|
|
262
|
+
process.exit(1);
|
|
263
|
+
}
|
|
264
|
+
throw error;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export async function emitOwnAgentDossier(
|
|
269
|
+
opts: MigrateCliOptions,
|
|
270
|
+
cwd = process.cwd(),
|
|
271
|
+
): Promise<EmitDossierResult> {
|
|
272
|
+
const source = resolveSourceSpec(opts, cwd);
|
|
273
|
+
if (!source) {
|
|
274
|
+
throw new Error(
|
|
275
|
+
"Usage: agent-native migrate <source-path-or-url> --emit [dossier-dir]",
|
|
276
|
+
);
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
let dossierRoot = resolveDossierRoot(opts, source, cwd);
|
|
280
|
+
const explicitEmitDir = Boolean(opts.emitDir);
|
|
281
|
+
if (source.sourceRoot && isInsideOrSame(source.sourceRoot, dossierRoot)) {
|
|
282
|
+
if (explicitEmitDir) {
|
|
283
|
+
throw new Error(
|
|
284
|
+
`Refusing to emit dossier inside sourceRoot (${source.sourceRoot}). Choose an --emit path outside the source project.`,
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
dossierRoot = defaultDossierRoot(source, cwd);
|
|
288
|
+
}
|
|
289
|
+
if (source.sourceRoot) {
|
|
290
|
+
assertOutsideSourceRoot(source.sourceRoot, dossierRoot, "dossier");
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
fs.mkdirSync(dossierRoot, { recursive: true });
|
|
294
|
+
const planInputs = await readMigrationPlanInputs(opts, cwd);
|
|
295
|
+
const written = new Set<string>();
|
|
296
|
+
const write = (relativePath: string, content: string) => {
|
|
297
|
+
const filePath = path.join(dossierRoot, relativePath);
|
|
298
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
299
|
+
fs.writeFileSync(
|
|
300
|
+
filePath,
|
|
301
|
+
content.endsWith("\n") ? content : `${content}\n`,
|
|
302
|
+
);
|
|
303
|
+
written.add(relativePath);
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const templateDir = findMigrationTemplateDir();
|
|
307
|
+
const templateAgents = readTextIfExists(
|
|
308
|
+
templateDir ? path.join(templateDir, "AGENTS.md") : undefined,
|
|
309
|
+
);
|
|
310
|
+
write("AGENTS.md", renderDossierAgentsMd(source, templateAgents, planInputs));
|
|
311
|
+
|
|
312
|
+
for (const copied of copyMigrationSkills(templateDir, dossierRoot)) {
|
|
313
|
+
written.add(copied);
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
const helperResult = await writeAssessmentWithMigrateHelpers({
|
|
317
|
+
source,
|
|
318
|
+
dossierRoot,
|
|
319
|
+
target: opts.target ?? DEFAULT_TARGET,
|
|
320
|
+
write,
|
|
321
|
+
});
|
|
322
|
+
const usedMigrateHelpers = helperResult;
|
|
323
|
+
if (!helperResult) {
|
|
324
|
+
const fallback = buildFallbackAssessment(source);
|
|
325
|
+
write("01-assessment.md", fallback.assessment);
|
|
326
|
+
if (fallback.ir) {
|
|
327
|
+
write("ir.json", `${JSON.stringify(fallback.ir, null, 2)}\n`);
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (planInputs) {
|
|
332
|
+
write("02-plan-inputs.json", `${JSON.stringify(planInputs, null, 2)}\n`);
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
write("MIGRATION_PLAYBOOK.md", renderMigrationPlaybook(source, planInputs));
|
|
336
|
+
write(
|
|
337
|
+
"source.json",
|
|
338
|
+
`${JSON.stringify(
|
|
339
|
+
{
|
|
340
|
+
source,
|
|
341
|
+
target: opts.target ?? DEFAULT_TARGET,
|
|
342
|
+
planInputs,
|
|
343
|
+
createdAt: new Date().toISOString(),
|
|
344
|
+
usedMigrateHelpers,
|
|
345
|
+
},
|
|
346
|
+
null,
|
|
347
|
+
2,
|
|
348
|
+
)}\n`,
|
|
349
|
+
);
|
|
350
|
+
|
|
351
|
+
return {
|
|
352
|
+
dossierRoot,
|
|
353
|
+
files: [...written].sort(),
|
|
354
|
+
source,
|
|
355
|
+
usedMigrateHelpers,
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
export function isExpectedMigrationCliError(error: unknown): boolean {
|
|
360
|
+
const message = migrationCliErrorMessage(error);
|
|
361
|
+
return (
|
|
362
|
+
message.startsWith("Usage: agent-native migrate") ||
|
|
363
|
+
message.startsWith("Refusing to emit dossier inside sourceRoot") ||
|
|
364
|
+
message.startsWith("Refusing to write ") ||
|
|
365
|
+
message.startsWith("Could not read migration plan file ")
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
function migrationCliErrorMessage(error: unknown): string {
|
|
370
|
+
if (error instanceof Error) return error.message;
|
|
371
|
+
return String(error);
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
async function scaffoldOrResumeWorkbench(): Promise<void> {
|
|
375
|
+
console.error(
|
|
376
|
+
[
|
|
377
|
+
"",
|
|
378
|
+
"The legacy migration app surface has been removed.",
|
|
379
|
+
"Use `agent-native code /migrate <source>` for the supported migration workflow.",
|
|
380
|
+
"Use `--emit [dir]` when you want a portable dossier for another coding agent.",
|
|
381
|
+
"",
|
|
382
|
+
].join("\n"),
|
|
383
|
+
);
|
|
384
|
+
process.exit(1);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
async function createMigrationCodeAgentSession(
|
|
388
|
+
opts: MigrateCliOptions,
|
|
389
|
+
): Promise<void> {
|
|
390
|
+
const cwd = process.cwd();
|
|
391
|
+
const source = resolveSourceSpec(opts, cwd);
|
|
392
|
+
if (!source) {
|
|
393
|
+
console.error(migrateUsage());
|
|
394
|
+
process.exit(1);
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
const outputRoot = path.resolve(cwd, opts.output ?? DEFAULT_OUTPUT);
|
|
398
|
+
const planInputs = await readMigrationPlanInputs(opts, cwd);
|
|
399
|
+
if (source.sourceRoot) {
|
|
400
|
+
assertOutsideSourceRoot(source.sourceRoot, outputRoot, "outputRoot");
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
const run = createCodeAgentRunRecord({
|
|
404
|
+
goalId: "migrate",
|
|
405
|
+
title: defaultRunName(source),
|
|
406
|
+
subtitle: formatSourceForDisplay(source),
|
|
407
|
+
status: "needs-approval",
|
|
408
|
+
phase: "intake",
|
|
409
|
+
needsApproval: true,
|
|
410
|
+
progress: {
|
|
411
|
+
label: "Intake",
|
|
412
|
+
completed: 0,
|
|
413
|
+
total: 1,
|
|
414
|
+
percent: 0,
|
|
415
|
+
},
|
|
416
|
+
cwd,
|
|
417
|
+
metadata: {
|
|
418
|
+
source,
|
|
419
|
+
sourceRoot: source.sourceRoot,
|
|
420
|
+
outputRoot,
|
|
421
|
+
target: opts.target ?? DEFAULT_TARGET,
|
|
422
|
+
planInputs,
|
|
423
|
+
},
|
|
424
|
+
});
|
|
425
|
+
appendCodeAgentTranscriptEvent({
|
|
426
|
+
runId: run.id,
|
|
427
|
+
kind: "user",
|
|
428
|
+
message: `Migrate ${formatSourceForDisplay(source)} to ${opts.target ?? DEFAULT_TARGET}.`,
|
|
429
|
+
metadata: {
|
|
430
|
+
source,
|
|
431
|
+
outputRoot,
|
|
432
|
+
target: opts.target ?? DEFAULT_TARGET,
|
|
433
|
+
planInputs,
|
|
434
|
+
},
|
|
435
|
+
});
|
|
436
|
+
appendCodeAgentTranscriptEvent({
|
|
437
|
+
runId: run.id,
|
|
438
|
+
kind: "status",
|
|
439
|
+
message: "Preparing migration dossier.",
|
|
440
|
+
metadata: { status: "needs-approval", phase: "intake" },
|
|
441
|
+
});
|
|
442
|
+
const artifactRoot = codeAgentRunArtifactsDir(run.id);
|
|
443
|
+
const dossierRoot = path.join(artifactRoot, "migration-dossier");
|
|
444
|
+
const dossier = await emitOwnAgentDossier(
|
|
445
|
+
{
|
|
446
|
+
...opts,
|
|
447
|
+
emit: true,
|
|
448
|
+
emitDir: dossierRoot,
|
|
449
|
+
target: opts.target ?? DEFAULT_TARGET,
|
|
450
|
+
},
|
|
451
|
+
cwd,
|
|
452
|
+
);
|
|
453
|
+
|
|
454
|
+
const updated: CodeAgentRunRecord = {
|
|
455
|
+
...run,
|
|
456
|
+
progress: {
|
|
457
|
+
label: "Dossier ready; waiting for approval",
|
|
458
|
+
completed: 1,
|
|
459
|
+
total: 2,
|
|
460
|
+
percent: 50,
|
|
461
|
+
},
|
|
462
|
+
artifactRoot,
|
|
463
|
+
details: [
|
|
464
|
+
{ label: "Source", value: formatSourceForDisplay(source) },
|
|
465
|
+
{ label: "Output", value: outputRoot },
|
|
466
|
+
{ label: "Dossier", value: dossierRoot },
|
|
467
|
+
{ label: "Resume", value: "agent-native code resume --last" },
|
|
468
|
+
{ label: "Attach", value: "agent-native code attach --last" },
|
|
469
|
+
],
|
|
470
|
+
metadata: {
|
|
471
|
+
...(run.metadata ?? {}),
|
|
472
|
+
dossierRoot,
|
|
473
|
+
dossierFiles: dossier.files,
|
|
474
|
+
artifactFiles: dossier.files.map((file) => path.join(dossierRoot, file)),
|
|
475
|
+
planInputs,
|
|
476
|
+
usedMigrateHelpers: dossier.usedMigrateHelpers,
|
|
477
|
+
resumeCommand: "agent-native code resume --last",
|
|
478
|
+
attachCommand: "agent-native code attach --last",
|
|
479
|
+
statusCommand: "agent-native code status --last",
|
|
480
|
+
preferredCommand: MIGRATION_SESSION_COMMAND,
|
|
481
|
+
},
|
|
482
|
+
updatedAt: new Date().toISOString(),
|
|
483
|
+
};
|
|
484
|
+
writeCodeAgentRunRecord(updated);
|
|
485
|
+
appendCodeAgentTranscriptEvent({
|
|
486
|
+
runId: run.id,
|
|
487
|
+
kind: "artifact",
|
|
488
|
+
message: "Migration dossier created.",
|
|
489
|
+
metadata: {
|
|
490
|
+
path: dossierRoot,
|
|
491
|
+
files: dossier.files,
|
|
492
|
+
usedMigrateHelpers: dossier.usedMigrateHelpers,
|
|
493
|
+
},
|
|
494
|
+
});
|
|
495
|
+
appendCodeAgentTranscriptEvent({
|
|
496
|
+
runId: run.id,
|
|
497
|
+
kind: "note",
|
|
498
|
+
message:
|
|
499
|
+
"Use the dossier with Codex, Claude Code, Cursor, or another coding agent; no migration agent process has been started by the CLI.",
|
|
500
|
+
metadata: { source: "migration-dossier" },
|
|
501
|
+
});
|
|
502
|
+
appendCodeAgentTranscriptEvent({
|
|
503
|
+
runId: run.id,
|
|
504
|
+
kind: "status",
|
|
505
|
+
message:
|
|
506
|
+
"Migration dossier is ready. Resume the /migrate session from Agent-Native Code when you are ready to approve or continue.",
|
|
507
|
+
metadata: { status: "needs-approval", phase: "intake" },
|
|
508
|
+
});
|
|
509
|
+
|
|
510
|
+
console.log(renderCodeAgentMigrationSession(updated, dossier));
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
function printMigrationStatus(opts: MigrateCliOptions): void {
|
|
514
|
+
const last = getLastCodeAgentRunRecord("migrate");
|
|
515
|
+
const runs = listCodeAgentRunRecords("migrate");
|
|
516
|
+
if (last || !opts.appSurface) {
|
|
517
|
+
console.log(renderCodeAgentMigrationStatus(runs));
|
|
518
|
+
return;
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
const appDir = resolveWorkbenchDir(opts);
|
|
522
|
+
const seedPath = path.join(appDir, "data", "migration-source.json");
|
|
523
|
+
const seed = readJsonIfExists(seedPath) as {
|
|
524
|
+
sourceKind?: string;
|
|
525
|
+
sourceRoot?: string;
|
|
526
|
+
sourceUrl?: string;
|
|
527
|
+
sourceDescription?: string;
|
|
528
|
+
outputRoot?: string;
|
|
529
|
+
target?: string;
|
|
530
|
+
} | null;
|
|
531
|
+
const artifactRuns = readArtifactRuns(appDir);
|
|
532
|
+
|
|
533
|
+
if (!fs.existsSync(appDir)) {
|
|
534
|
+
console.error(`No Migration Workbench found at ${appDir}.`);
|
|
535
|
+
console.error(
|
|
536
|
+
`Create one with: npx @agent-native/core@latest code /migrate <source>`,
|
|
537
|
+
);
|
|
538
|
+
console.error(
|
|
539
|
+
`The direct migrate command is a shortcut into that same Agent-Native Code slash command.`,
|
|
540
|
+
);
|
|
541
|
+
process.exit(1);
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
console.log(
|
|
545
|
+
[
|
|
546
|
+
"",
|
|
547
|
+
"Migration Workbench status",
|
|
548
|
+
"",
|
|
549
|
+
` App: ${appDir}`,
|
|
550
|
+
` Seed: ${fs.existsSync(seedPath) ? seedPath : "not found"}`,
|
|
551
|
+
` Source: ${formatSeedSource(seed)}`,
|
|
552
|
+
` Output: ${seed?.outputRoot ?? "not set"}`,
|
|
553
|
+
` Target: ${seed?.target ?? DEFAULT_TARGET}`,
|
|
554
|
+
` Artifacts: ${artifactRuns.length} run${artifactRuns.length === 1 ? "" : "s"}`,
|
|
555
|
+
...artifactRuns
|
|
556
|
+
.slice(0, 5)
|
|
557
|
+
.map((run) => ` - ${run.id} (${run.phase})`),
|
|
558
|
+
artifactRuns.length > 5 ? ` - ${artifactRuns.length - 5} more...` : "",
|
|
559
|
+
"",
|
|
560
|
+
...credentialStatusLines(),
|
|
561
|
+
]
|
|
562
|
+
.filter(Boolean)
|
|
563
|
+
.join("\n"),
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
|
|
567
|
+
function printMigrationStop(_opts: MigrateCliOptions): void {
|
|
568
|
+
console.log(
|
|
569
|
+
[
|
|
570
|
+
"",
|
|
571
|
+
"Agent-Native Code /migrate stop",
|
|
572
|
+
"",
|
|
573
|
+
"The migrate CLI creates resumable session records and artifacts; it does not daemonize a background process yet.",
|
|
574
|
+
"Stop the terminal, Desktop run, or external coding agent that is actively working on the session.",
|
|
575
|
+
].join("\n"),
|
|
576
|
+
);
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
function printMigrationUi(opts: MigrateCliOptions): void {
|
|
580
|
+
const last = getLastCodeAgentRunRecord("migrate");
|
|
581
|
+
if (last && !opts.appSurface) {
|
|
582
|
+
console.log(renderCodeAgentMigrationUi(last));
|
|
583
|
+
return;
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
const appDir = resolveWorkbenchDir(opts);
|
|
587
|
+
console.log(
|
|
588
|
+
[
|
|
589
|
+
"",
|
|
590
|
+
"Migration Workbench UI",
|
|
591
|
+
"",
|
|
592
|
+
` App: ${appDir}`,
|
|
593
|
+
` URL: http://localhost:${MIGRATION_DEV_PORT}/`,
|
|
594
|
+
"",
|
|
595
|
+
"Start it with:",
|
|
596
|
+
` cd ${shellQuote(path.relative(process.cwd(), appDir) || ".")}`,
|
|
597
|
+
" pnpm install",
|
|
598
|
+
" pnpm dev",
|
|
599
|
+
"",
|
|
600
|
+
"Deep-link shape:",
|
|
601
|
+
` http://localhost:${MIGRATION_DEV_PORT}/`,
|
|
602
|
+
" Pick a run in the Workbench, or ask the app agent to navigate by run ID.",
|
|
603
|
+
].join("\n"),
|
|
604
|
+
);
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
function printMigrationResume(opts: MigrateCliOptions): void {
|
|
608
|
+
const last = getLastCodeAgentRunRecord("migrate");
|
|
609
|
+
if (last && !opts.appSurface) {
|
|
610
|
+
console.log(renderCodeAgentMigrationResume(last));
|
|
611
|
+
return;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
const appDir = resolveWorkbenchDir(opts);
|
|
615
|
+
const seedPath = path.join(appDir, "data", "migration-source.json");
|
|
616
|
+
const seed = readJsonIfExists(seedPath);
|
|
617
|
+
if (!fs.existsSync(appDir) || !seed) {
|
|
618
|
+
console.error(
|
|
619
|
+
"No resumable Migration Workbench seed found. Run `npx @agent-native/core@latest code /migrate <source>` first.",
|
|
620
|
+
);
|
|
621
|
+
process.exit(1);
|
|
622
|
+
}
|
|
623
|
+
console.log(
|
|
624
|
+
[
|
|
625
|
+
"",
|
|
626
|
+
"Migration Workbench resume",
|
|
627
|
+
"",
|
|
628
|
+
` App: ${appDir}`,
|
|
629
|
+
` Seed: ${seedPath}`,
|
|
630
|
+
"",
|
|
631
|
+
"Continue with:",
|
|
632
|
+
` cd ${shellQuote(path.relative(process.cwd(), appDir) || ".")}`,
|
|
633
|
+
" pnpm dev",
|
|
634
|
+
"",
|
|
635
|
+
`Workbench URL: http://localhost:${MIGRATION_DEV_PORT}/`,
|
|
636
|
+
].join("\n"),
|
|
637
|
+
);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
function renderWorkbenchReady(args: {
|
|
641
|
+
appDir: string;
|
|
642
|
+
existing: boolean;
|
|
643
|
+
outputRoot: string;
|
|
644
|
+
source: SourceSpec;
|
|
645
|
+
}): string {
|
|
646
|
+
const rel = path.relative(process.cwd(), args.appDir) || ".";
|
|
647
|
+
const sourceCommand = formatSourceForCommand(args.source);
|
|
648
|
+
return [
|
|
649
|
+
"",
|
|
650
|
+
args.existing
|
|
651
|
+
? "Migration Workbench is ready (reused existing app)."
|
|
652
|
+
: "Migration Workbench is ready.",
|
|
653
|
+
"",
|
|
654
|
+
` Source: ${formatSourceForDisplay(args.source)}`,
|
|
655
|
+
` Output: ${args.outputRoot}`,
|
|
656
|
+
` App: ${args.appDir}`,
|
|
657
|
+
"",
|
|
658
|
+
"Run it:",
|
|
659
|
+
` cd ${shellQuote(rel)}`,
|
|
660
|
+
" pnpm install",
|
|
661
|
+
" pnpm dev",
|
|
662
|
+
"",
|
|
663
|
+
"npx-friendly commands:",
|
|
664
|
+
` npx @agent-native/core@latest code /migrate ${sourceCommand} --out ${shellQuote(path.relative(process.cwd(), args.outputRoot) || ".")}`,
|
|
665
|
+
` npx @agent-native/core@latest code /migrate ${sourceCommand} --emit ${shellQuote(defaultDossierDirForDisplay(args.source))}`,
|
|
666
|
+
"",
|
|
667
|
+
"Workbench URL:",
|
|
668
|
+
` http://localhost:${MIGRATION_DEV_PORT}/`,
|
|
669
|
+
" If Vite chooses another port, use the URL printed by `pnpm dev`.",
|
|
670
|
+
"",
|
|
671
|
+
"Deep-link shape:",
|
|
672
|
+
` http://localhost:${MIGRATION_DEV_PORT}/`,
|
|
673
|
+
" Select the run inside the Workbench, or ask the app agent to open a run by ID.",
|
|
674
|
+
"",
|
|
675
|
+
...credentialStatusLines(),
|
|
676
|
+
"",
|
|
677
|
+
"The Workbench seed is written to data/migration-source.json. It stores paths and source metadata only, never secret values.",
|
|
678
|
+
].join("\n");
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
function renderCodeAgentMigrationSession(
|
|
682
|
+
run: CodeAgentRunRecord,
|
|
683
|
+
dossier: EmitDossierResult,
|
|
684
|
+
): string {
|
|
685
|
+
return [
|
|
686
|
+
"",
|
|
687
|
+
"Agent-Native Code /migrate session created.",
|
|
688
|
+
"",
|
|
689
|
+
` Run: ${run.id}`,
|
|
690
|
+
" Goal: /migrate",
|
|
691
|
+
` Source: ${run.subtitle ?? "not set"}`,
|
|
692
|
+
` Output: ${stringMetadata(run, "outputRoot") ?? "not set"}`,
|
|
693
|
+
` Dossier: ${stringMetadata(run, "dossierRoot") ?? dossier.dossierRoot}`,
|
|
694
|
+
` Engine: ${dossier.usedMigrateHelpers ? "@agent-native/migrate helpers" : "safe local fallback"}`,
|
|
695
|
+
"",
|
|
696
|
+
"Artifacts:",
|
|
697
|
+
...dossier.files
|
|
698
|
+
.filter((file) =>
|
|
699
|
+
[
|
|
700
|
+
"AGENTS.md",
|
|
701
|
+
"MIGRATION_PLAYBOOK.md",
|
|
702
|
+
"01-assessment.md",
|
|
703
|
+
"ir.json",
|
|
704
|
+
"source.json",
|
|
705
|
+
].includes(file),
|
|
706
|
+
)
|
|
707
|
+
.map((file) => ` - ${path.join(dossier.dossierRoot, file)}`),
|
|
708
|
+
"",
|
|
709
|
+
"Continue:",
|
|
710
|
+
" agent-native code attach --last",
|
|
711
|
+
" agent-native code resume --last",
|
|
712
|
+
" agent-native code logs --last",
|
|
713
|
+
" agent-native code status --last",
|
|
714
|
+
"",
|
|
715
|
+
"Desktop:",
|
|
716
|
+
" Open Agent-Native Code in the left sidebar. This run appears as a /migrate session.",
|
|
717
|
+
"",
|
|
718
|
+
"Use another agent:",
|
|
719
|
+
` Point Codex, Claude Code, Cursor, or another coding agent at ${shellQuote(dossier.dossierRoot)} and ask it to follow AGENTS.md plus MIGRATION_PLAYBOOK.md.`,
|
|
720
|
+
"",
|
|
721
|
+
"Default surface:",
|
|
722
|
+
" Migration stays in Agent-Native Code. No hidden app/template was scaffolded.",
|
|
723
|
+
" The legacy --app-surface detail app has been removed.",
|
|
724
|
+
].join("\n");
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
function renderCodeAgentMigrationStatus(runs: CodeAgentRunRecord[]): string {
|
|
728
|
+
return [
|
|
729
|
+
"",
|
|
730
|
+
"Agent-Native Code /migrate status",
|
|
731
|
+
"",
|
|
732
|
+
runs.length === 0
|
|
733
|
+
? " No /migrate sessions found. Start one with `agent-native code /migrate <source>`."
|
|
734
|
+
: ` ${runs.length} session${runs.length === 1 ? "" : "s"} found.`,
|
|
735
|
+
...runs.slice(0, 8).map((run) => {
|
|
736
|
+
const output = stringMetadata(run, "outputRoot");
|
|
737
|
+
const dossier = stringMetadata(run, "dossierRoot");
|
|
738
|
+
const progress = run.progress?.label
|
|
739
|
+
? ` Progress: ${run.progress.label} (${run.progress.completed}/${run.progress.total})`
|
|
740
|
+
: "";
|
|
741
|
+
return [
|
|
742
|
+
` - ${run.id}`,
|
|
743
|
+
` Status: ${run.status}${run.phase ? ` (${run.phase})` : ""}`,
|
|
744
|
+
progress,
|
|
745
|
+
` Source: ${run.subtitle ?? "not set"}`,
|
|
746
|
+
output ? ` Output: ${output}` : "",
|
|
747
|
+
dossier ? ` Dossier: ${dossier}` : "",
|
|
748
|
+
` Resume: agent-native code resume ${run.id}`,
|
|
749
|
+
]
|
|
750
|
+
.filter(Boolean)
|
|
751
|
+
.join("\n");
|
|
752
|
+
}),
|
|
753
|
+
runs.length > 8 ? ` - ${runs.length - 8} more...` : "",
|
|
754
|
+
"",
|
|
755
|
+
"Shortcuts:",
|
|
756
|
+
" agent-native migrate status --last shows the same Agent-Native Code sessions.",
|
|
757
|
+
" The legacy --app-surface detail app has been removed.",
|
|
758
|
+
]
|
|
759
|
+
.filter(Boolean)
|
|
760
|
+
.join("\n");
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
function renderCodeAgentMigrationResume(run: CodeAgentRunRecord): string {
|
|
764
|
+
const dossier = stringMetadata(run, "dossierRoot");
|
|
765
|
+
return [
|
|
766
|
+
"",
|
|
767
|
+
"Agent-Native Code /migrate resume",
|
|
768
|
+
"",
|
|
769
|
+
` Run: ${run.id}`,
|
|
770
|
+
` Status: ${run.status}${run.phase ? ` (${run.phase})` : ""}`,
|
|
771
|
+
` Source: ${run.subtitle ?? "not set"}`,
|
|
772
|
+
dossier ? ` Dossier: ${dossier}` : "",
|
|
773
|
+
"",
|
|
774
|
+
"Continue in the interactive shell:",
|
|
775
|
+
" agent-native code",
|
|
776
|
+
"",
|
|
777
|
+
"Resume this run directly:",
|
|
778
|
+
` agent-native code resume ${run.id}`,
|
|
779
|
+
" agent-native code attach --last",
|
|
780
|
+
"",
|
|
781
|
+
dossier
|
|
782
|
+
? `Or hand off to another agent by pointing it at ${shellQuote(dossier)}.`
|
|
783
|
+
: "No dossier path is recorded on this run.",
|
|
784
|
+
]
|
|
785
|
+
.filter(Boolean)
|
|
786
|
+
.join("\n");
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
function renderCodeAgentMigrationUi(run: CodeAgentRunRecord): string {
|
|
790
|
+
return [
|
|
791
|
+
"",
|
|
792
|
+
"Agent-Native Code /migrate UI",
|
|
793
|
+
"",
|
|
794
|
+
` Run: ${run.id}`,
|
|
795
|
+
"",
|
|
796
|
+
"Open Agent-Native Desktop and choose Agent-Native Code from the left sidebar.",
|
|
797
|
+
"The legacy migration detail app is no longer scaffolded.",
|
|
798
|
+
].join("\n");
|
|
799
|
+
}
|
|
800
|
+
|
|
801
|
+
function renderEmitResult(result: EmitDossierResult): string {
|
|
802
|
+
return [
|
|
803
|
+
"",
|
|
804
|
+
"Migration agent dossier emitted.",
|
|
805
|
+
"",
|
|
806
|
+
` Source: ${formatSourceForDisplay(result.source)}`,
|
|
807
|
+
` Dossier: ${result.dossierRoot}`,
|
|
808
|
+
` IR: ${result.files.includes("ir.json") ? "included" : "not available from this input"}`,
|
|
809
|
+
` Engine: ${result.usedMigrateHelpers ? "@agent-native/migrate helpers" : "safe local fallback"}`,
|
|
810
|
+
"",
|
|
811
|
+
"Files:",
|
|
812
|
+
...result.files.map((file) => ` - ${file}`),
|
|
813
|
+
"",
|
|
814
|
+
"Use with Agent-Native Code/Desktop:",
|
|
815
|
+
` Point the agent at ${shellQuote(result.dossierRoot)} and ask it to follow AGENTS.md plus MIGRATION_PLAYBOOK.md.`,
|
|
816
|
+
"",
|
|
817
|
+
"Safety:",
|
|
818
|
+
" The dossier was written outside sourceRoot and contains no secret values.",
|
|
819
|
+
].join("\n");
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
function migrateUsage(): string {
|
|
823
|
+
return [
|
|
824
|
+
"Usage:",
|
|
825
|
+
" agent-native code /migrate <source-path-or-url> [--out ../migrated-app] (preferred)",
|
|
826
|
+
" agent-native migrate <source-path-or-url> [--out ../migrated-app] (shortcut)",
|
|
827
|
+
" agent-native migrate <source> --emit [dossier-dir]",
|
|
828
|
+
' agent-native migrate --describe "legacy app described in prose" --emit',
|
|
829
|
+
" agent-native migrate resume --last",
|
|
830
|
+
" agent-native migrate status --last",
|
|
831
|
+
" agent-native migrate ui --last",
|
|
832
|
+
" agent-native migrate stop --last",
|
|
833
|
+
"",
|
|
834
|
+
"Examples:",
|
|
835
|
+
" npx @agent-native/core@latest code /migrate ./my-next-app --out ../migrated-app",
|
|
836
|
+
" npx @agent-native/core@latest migrate ./my-next-app --out ../migrated-app",
|
|
837
|
+
' npx @agent-native/core@latest code /migrate https://example.com --describe "marketing site" --emit ../migration-dossier',
|
|
838
|
+
' npx @agent-native/core@latest code /migrate --describe "A Rails admin app with reporting dashboards" --emit',
|
|
839
|
+
"",
|
|
840
|
+
"Default:",
|
|
841
|
+
" Migration is an Agent-Native Code slash command. The legacy hidden migration app has been removed.",
|
|
842
|
+
"",
|
|
843
|
+
"Options:",
|
|
844
|
+
" --source, --path <path> Local source path",
|
|
845
|
+
" --url <url> Source URL",
|
|
846
|
+
" --description, --describe Source description for any-input migrations",
|
|
847
|
+
" --emit [dir] Emit an own-agent dossier without recording a session",
|
|
848
|
+
" --out <path> Generated output path for the migration session",
|
|
849
|
+
" --plan-file <path> Custom migration profile JSON or notes",
|
|
850
|
+
" --app-surface, --workbench Removed legacy detail-app flag; prints migration guidance",
|
|
851
|
+
" --name <name> Legacy app-surface name (ignored for supported flows)",
|
|
852
|
+
" --target <name> Migration target (default: agent-native)",
|
|
853
|
+
" --plan-only Legacy app-surface plan-only seed (ignored for supported flows)",
|
|
854
|
+
].join("\n");
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
function setSourceOption(opts: MigrateCliOptions, value: string): void {
|
|
858
|
+
opts.source = value;
|
|
859
|
+
if (isProbablyUrl(value)) {
|
|
860
|
+
opts.sourceUrl = value;
|
|
861
|
+
} else {
|
|
862
|
+
opts.sourcePath = value;
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
function hasAnySource(opts: MigrateCliOptions): boolean {
|
|
867
|
+
return Boolean(
|
|
868
|
+
opts.source || opts.sourcePath || opts.sourceUrl || opts.sourceDescription,
|
|
869
|
+
);
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
function resolveSourceSpec(
|
|
873
|
+
opts: MigrateCliOptions,
|
|
874
|
+
cwd = process.cwd(),
|
|
875
|
+
): SourceSpec | null {
|
|
876
|
+
if (opts.sourceUrl) {
|
|
877
|
+
return {
|
|
878
|
+
kind: "url",
|
|
879
|
+
value: opts.sourceUrl,
|
|
880
|
+
description: opts.sourceDescription,
|
|
881
|
+
};
|
|
882
|
+
}
|
|
883
|
+
if (opts.sourcePath) {
|
|
884
|
+
return {
|
|
885
|
+
kind: "path",
|
|
886
|
+
value: opts.sourcePath,
|
|
887
|
+
sourceRoot: path.resolve(cwd, opts.sourcePath),
|
|
888
|
+
description: opts.sourceDescription,
|
|
889
|
+
};
|
|
890
|
+
}
|
|
891
|
+
if (opts.source) {
|
|
892
|
+
if (isProbablyUrl(opts.source)) {
|
|
893
|
+
return {
|
|
894
|
+
kind: "url",
|
|
895
|
+
value: opts.source,
|
|
896
|
+
description: opts.sourceDescription,
|
|
897
|
+
};
|
|
898
|
+
}
|
|
899
|
+
return {
|
|
900
|
+
kind: "path",
|
|
901
|
+
value: opts.source,
|
|
902
|
+
sourceRoot: path.resolve(cwd, opts.source),
|
|
903
|
+
description: opts.sourceDescription,
|
|
904
|
+
};
|
|
905
|
+
}
|
|
906
|
+
if (opts.sourceDescription) {
|
|
907
|
+
return {
|
|
908
|
+
kind: "description",
|
|
909
|
+
value: opts.sourceDescription,
|
|
910
|
+
description: opts.sourceDescription,
|
|
911
|
+
};
|
|
912
|
+
}
|
|
913
|
+
return null;
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
function resolveDossierRoot(
|
|
917
|
+
opts: MigrateCliOptions,
|
|
918
|
+
source: SourceSpec,
|
|
919
|
+
cwd: string,
|
|
920
|
+
): string {
|
|
921
|
+
if (opts.emitDir) return path.resolve(cwd, opts.emitDir);
|
|
922
|
+
return defaultDossierRoot(source, cwd);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
async function readMigrationPlanInputs(
|
|
926
|
+
opts: MigrateCliOptions,
|
|
927
|
+
cwd: string,
|
|
928
|
+
): Promise<unknown | null> {
|
|
929
|
+
if (!opts.planFile) return null;
|
|
930
|
+
const filePath = path.resolve(cwd, opts.planFile);
|
|
931
|
+
let text = "";
|
|
932
|
+
try {
|
|
933
|
+
text = fs.readFileSync(filePath, "utf-8");
|
|
934
|
+
} catch (error) {
|
|
935
|
+
throw new Error(
|
|
936
|
+
`Could not read migration plan file ${filePath}: ${migrationCliErrorMessage(error)}`,
|
|
937
|
+
);
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
try {
|
|
941
|
+
const migratePackage = "@agent-native/migrate";
|
|
942
|
+
const migrate = (await import(migratePackage)) as {
|
|
943
|
+
parseMigrationPlanInputsText?: (
|
|
944
|
+
text: string,
|
|
945
|
+
sourceLabel?: string,
|
|
946
|
+
) => unknown;
|
|
947
|
+
};
|
|
948
|
+
const parsed = migrate.parseMigrationPlanInputsText?.(
|
|
949
|
+
text,
|
|
950
|
+
path.basename(filePath),
|
|
951
|
+
);
|
|
952
|
+
if (migrate.parseMigrationPlanInputsText) return parsed ?? null;
|
|
953
|
+
} catch {
|
|
954
|
+
// The dossier writer can run without the migrate package being bundled.
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
try {
|
|
958
|
+
const parsed = JSON.parse(text);
|
|
959
|
+
return isRecognizedPlanInputJson(parsed) ? parsed : null;
|
|
960
|
+
} catch {
|
|
961
|
+
return inferMigrationPlanInputsFromText(text, path.basename(filePath));
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
function isRecognizedPlanInputJson(value: unknown): boolean {
|
|
966
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
967
|
+
return false;
|
|
968
|
+
}
|
|
969
|
+
return [
|
|
970
|
+
"summary",
|
|
971
|
+
"notes",
|
|
972
|
+
"aem",
|
|
973
|
+
"builder",
|
|
974
|
+
"headless",
|
|
975
|
+
"jquery",
|
|
976
|
+
"verification",
|
|
977
|
+
].some((key) => Object.prototype.hasOwnProperty.call(value, key));
|
|
978
|
+
}
|
|
979
|
+
|
|
980
|
+
function inferMigrationPlanInputsFromText(
|
|
981
|
+
text: string,
|
|
982
|
+
sourceLabel: string,
|
|
983
|
+
): Record<string, unknown> {
|
|
984
|
+
const lower = text.toLowerCase();
|
|
985
|
+
const planInputs: Record<string, unknown> = {
|
|
986
|
+
summary: firstMeaningfulLine(text) ?? sourceLabel,
|
|
987
|
+
notes: text.trim(),
|
|
988
|
+
};
|
|
989
|
+
const mentionsAem =
|
|
990
|
+
/\baem\b|adobe experience manager|content fragment|experience fragment|sling|htl|jcr|vault|dam/.test(
|
|
991
|
+
lower,
|
|
992
|
+
);
|
|
993
|
+
const mentionsBuilder = /\bbuilder\b|fusion|publish|visual editor/.test(
|
|
994
|
+
lower,
|
|
995
|
+
);
|
|
996
|
+
const mentionsHeadless = /akeneo|akineo|headless|dynamic pages?/.test(lower);
|
|
997
|
+
const mentionsJQuery = /\bjquery\b|\$\(|clientlib/.test(lower);
|
|
998
|
+
|
|
999
|
+
if (mentionsAem) {
|
|
1000
|
+
planInputs.aem = {
|
|
1001
|
+
modes: ["enterprise"],
|
|
1002
|
+
contentFragmentPolicy: mentionsHeadless ? "headless" : "manual",
|
|
1003
|
+
experienceFragmentPolicy: mentionsBuilder
|
|
1004
|
+
? "builder-section"
|
|
1005
|
+
: "react-component",
|
|
1006
|
+
componentPolicy: mentionsBuilder
|
|
1007
|
+
? "builder-registered-component"
|
|
1008
|
+
: "react-component",
|
|
1009
|
+
};
|
|
1010
|
+
}
|
|
1011
|
+
if (mentionsBuilder) {
|
|
1012
|
+
planInputs.builder = {
|
|
1013
|
+
enabled: true,
|
|
1014
|
+
componentRegistration: "register",
|
|
1015
|
+
routeOwnership: [
|
|
1016
|
+
{
|
|
1017
|
+
pattern: "static/low-change pages",
|
|
1018
|
+
owner: "builder-page",
|
|
1019
|
+
notes:
|
|
1020
|
+
"Use Builder for static or low-change public pages that benefit from visual management.",
|
|
1021
|
+
},
|
|
1022
|
+
],
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
1025
|
+
if (mentionsHeadless) {
|
|
1026
|
+
planInputs.headless = {
|
|
1027
|
+
provider:
|
|
1028
|
+
lower.includes("akeneo") || lower.includes("akineo")
|
|
1029
|
+
? "Akeneo"
|
|
1030
|
+
: "headless",
|
|
1031
|
+
routePatterns: ["dynamic pages"],
|
|
1032
|
+
};
|
|
1033
|
+
const builder = planInputs.builder as
|
|
1034
|
+
| { routeOwnership?: Array<Record<string, string>> }
|
|
1035
|
+
| undefined;
|
|
1036
|
+
if (builder) {
|
|
1037
|
+
builder.routeOwnership = [
|
|
1038
|
+
...(builder.routeOwnership ?? []),
|
|
1039
|
+
{
|
|
1040
|
+
pattern: "dynamic pages",
|
|
1041
|
+
owner: "headless",
|
|
1042
|
+
notes:
|
|
1043
|
+
"Route dynamic pages through the approved headless source instead of treating Builder as a content dump.",
|
|
1044
|
+
},
|
|
1045
|
+
];
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
if (mentionsJQuery) {
|
|
1049
|
+
planInputs.jquery = { policy: "rewrite" };
|
|
1050
|
+
}
|
|
1051
|
+
return planInputs;
|
|
1052
|
+
}
|
|
1053
|
+
|
|
1054
|
+
function firstMeaningfulLine(text: string): string | undefined {
|
|
1055
|
+
return text
|
|
1056
|
+
.split(/\r?\n/)
|
|
1057
|
+
.map((line) => line.replace(/^#+\s*/, "").trim())
|
|
1058
|
+
.find(Boolean)
|
|
1059
|
+
?.slice(0, 140);
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
function defaultDossierRoot(source: SourceSpec, cwd: string): string {
|
|
1063
|
+
if (source.sourceRoot) {
|
|
1064
|
+
return path.resolve(
|
|
1065
|
+
path.dirname(source.sourceRoot),
|
|
1066
|
+
`${path.basename(source.sourceRoot)}-migration-dossier`,
|
|
1067
|
+
);
|
|
1068
|
+
}
|
|
1069
|
+
return path.resolve(cwd, DEFAULT_DOSSIER_DIR);
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
function defaultDossierDirForDisplay(source: SourceSpec): string {
|
|
1073
|
+
if (source.sourceRoot) {
|
|
1074
|
+
return `../${path.basename(source.sourceRoot)}-migration-dossier`;
|
|
1075
|
+
}
|
|
1076
|
+
return DEFAULT_DOSSIER_DIR;
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
function assertOutsideSourceRoot(
|
|
1080
|
+
sourceRoot: string,
|
|
1081
|
+
targetPath: string,
|
|
1082
|
+
label: string,
|
|
1083
|
+
): void {
|
|
1084
|
+
if (isInsideOrSame(sourceRoot, targetPath)) {
|
|
1085
|
+
throw new Error(
|
|
1086
|
+
`Refusing to write ${label} inside sourceRoot (${sourceRoot}). Choose a path outside the source project.`,
|
|
1087
|
+
);
|
|
1088
|
+
}
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
function isInsideOrSame(root: string, candidate: string): boolean {
|
|
1092
|
+
const relative = path.relative(path.resolve(root), path.resolve(candidate));
|
|
1093
|
+
return (
|
|
1094
|
+
relative === "" ||
|
|
1095
|
+
(!relative.startsWith("..") && !path.isAbsolute(relative))
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
|
|
1099
|
+
async function writeAssessmentWithMigrateHelpers(args: {
|
|
1100
|
+
source: SourceSpec;
|
|
1101
|
+
dossierRoot: string;
|
|
1102
|
+
target: string;
|
|
1103
|
+
write(relativePath: string, content: string): void;
|
|
1104
|
+
}): Promise<boolean> {
|
|
1105
|
+
try {
|
|
1106
|
+
const migratePackage = "@agent-native/migrate";
|
|
1107
|
+
const migrate = (await import(migratePackage)) as any;
|
|
1108
|
+
const adapter = migrate.nextjsSourceAdapter;
|
|
1109
|
+
|
|
1110
|
+
if (
|
|
1111
|
+
args.source.sourceRoot &&
|
|
1112
|
+
fs.existsSync(args.source.sourceRoot) &&
|
|
1113
|
+
adapter?.introspect &&
|
|
1114
|
+
migrate.createMigrationRun &&
|
|
1115
|
+
migrate.discoverMigration &&
|
|
1116
|
+
migrate.artifactPaths
|
|
1117
|
+
) {
|
|
1118
|
+
if (adapter.detect) {
|
|
1119
|
+
const detected = await adapter.detect(args.source.sourceRoot);
|
|
1120
|
+
if (!detected) return false;
|
|
1121
|
+
}
|
|
1122
|
+
|
|
1123
|
+
const artifactRoot = path.join(args.dossierRoot, ".migrate-artifacts");
|
|
1124
|
+
const outputRoot = path.join(args.dossierRoot, "generated-output");
|
|
1125
|
+
assertOutsideSourceRoot(
|
|
1126
|
+
args.source.sourceRoot,
|
|
1127
|
+
artifactRoot,
|
|
1128
|
+
"artifacts",
|
|
1129
|
+
);
|
|
1130
|
+
assertOutsideSourceRoot(args.source.sourceRoot, outputRoot, "outputRoot");
|
|
1131
|
+
|
|
1132
|
+
const run = await migrate.createMigrationRun({
|
|
1133
|
+
sourceRoot: args.source.sourceRoot,
|
|
1134
|
+
outputRoot,
|
|
1135
|
+
artifactRoot,
|
|
1136
|
+
target: args.target,
|
|
1137
|
+
id: "dossier",
|
|
1138
|
+
});
|
|
1139
|
+
const result = await migrate.discoverMigration(run, adapter);
|
|
1140
|
+
const artifacts = migrate.artifactPaths(result.run);
|
|
1141
|
+
args.write(
|
|
1142
|
+
"01-assessment.md",
|
|
1143
|
+
fs.readFileSync(result.assessmentPath, "utf-8"),
|
|
1144
|
+
);
|
|
1145
|
+
if (fs.existsSync(artifacts.irPath)) {
|
|
1146
|
+
args.write("ir.json", fs.readFileSync(artifacts.irPath, "utf-8"));
|
|
1147
|
+
}
|
|
1148
|
+
return true;
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
if (!args.source.sourceRoot && migrate.createSkeletonProjectIR) {
|
|
1152
|
+
const ir = migrate.createSkeletonProjectIR({
|
|
1153
|
+
sourceRoot: args.source.value,
|
|
1154
|
+
inputKind: args.source.kind,
|
|
1155
|
+
inputDescription: args.source.description ?? args.source.value,
|
|
1156
|
+
}) as ProjectIRLike;
|
|
1157
|
+
args.write("01-assessment.md", renderLocalAssessment(args.source, ir));
|
|
1158
|
+
args.write("ir.json", `${JSON.stringify(ir, null, 2)}\n`);
|
|
1159
|
+
return true;
|
|
1160
|
+
}
|
|
1161
|
+
} catch {
|
|
1162
|
+
return false;
|
|
1163
|
+
}
|
|
1164
|
+
return false;
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
function buildFallbackAssessment(source: SourceSpec): {
|
|
1168
|
+
assessment: string;
|
|
1169
|
+
ir?: ProjectIRLike;
|
|
1170
|
+
} {
|
|
1171
|
+
if (source.sourceRoot && fs.existsSync(source.sourceRoot)) {
|
|
1172
|
+
const ir = createLocalProjectIr(source.sourceRoot);
|
|
1173
|
+
return { assessment: renderLocalAssessment(source, ir), ir };
|
|
1174
|
+
}
|
|
1175
|
+
return { assessment: renderNonPathAssessment(source) };
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
function createLocalProjectIr(sourceRoot: string): ProjectIRLike {
|
|
1179
|
+
const files = walkSourceFiles(sourceRoot);
|
|
1180
|
+
const packageJson = readJsonIfExists(
|
|
1181
|
+
path.join(sourceRoot, "package.json"),
|
|
1182
|
+
) as {
|
|
1183
|
+
dependencies?: Record<string, string>;
|
|
1184
|
+
devDependencies?: Record<string, string>;
|
|
1185
|
+
} | null;
|
|
1186
|
+
const deps = {
|
|
1187
|
+
...(packageJson?.dependencies ?? {}),
|
|
1188
|
+
...(packageJson?.devDependencies ?? {}),
|
|
1189
|
+
};
|
|
1190
|
+
const framework =
|
|
1191
|
+
deps.next ||
|
|
1192
|
+
hasAnyFile(sourceRoot, [
|
|
1193
|
+
"next.config.js",
|
|
1194
|
+
"next.config.mjs",
|
|
1195
|
+
"next.config.ts",
|
|
1196
|
+
])
|
|
1197
|
+
? "nextjs"
|
|
1198
|
+
: deps.react
|
|
1199
|
+
? "react"
|
|
1200
|
+
: "unknown";
|
|
1201
|
+
const routes = files
|
|
1202
|
+
.map((file) => routeFromFile(file))
|
|
1203
|
+
.filter((route): route is ProjectIRLike["site"]["routes"][number] =>
|
|
1204
|
+
Boolean(route),
|
|
1205
|
+
)
|
|
1206
|
+
.sort((a, b) => a.path.localeCompare(b.path));
|
|
1207
|
+
const codeFiles = files.filter((file) => /\.(ts|tsx|js|jsx)$/.test(file));
|
|
1208
|
+
const behavior: ProjectIRLike["behavior"] = {
|
|
1209
|
+
apiEndpoints: [],
|
|
1210
|
+
dataStores: [],
|
|
1211
|
+
llmCalls: [],
|
|
1212
|
+
clientState: [],
|
|
1213
|
+
auth: [],
|
|
1214
|
+
jobs: [],
|
|
1215
|
+
};
|
|
1216
|
+
|
|
1217
|
+
for (const file of codeFiles) {
|
|
1218
|
+
const text = readSmallText(path.join(sourceRoot, file));
|
|
1219
|
+
if (!text) continue;
|
|
1220
|
+
if (
|
|
1221
|
+
file.startsWith("pages/api/") ||
|
|
1222
|
+
/(^|\/)api\/.*\/route\.[tj]sx?$/.test(file)
|
|
1223
|
+
) {
|
|
1224
|
+
behavior.apiEndpoints.push({
|
|
1225
|
+
id: stableId(file),
|
|
1226
|
+
path: apiPathFromFile(file),
|
|
1227
|
+
method: inferHttpMethod(text),
|
|
1228
|
+
filePath: file,
|
|
1229
|
+
recommendedRecipe: "api-routes-to-actions",
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
if (/\b(useState|useReducer|localStorage|sessionStorage)\b/.test(text)) {
|
|
1233
|
+
behavior.clientState.push({
|
|
1234
|
+
id: stableId(`${file}:state`),
|
|
1235
|
+
filePath: file,
|
|
1236
|
+
reason:
|
|
1237
|
+
"Review for important UI state that should move into application_state.",
|
|
1238
|
+
});
|
|
1239
|
+
}
|
|
1240
|
+
if (
|
|
1241
|
+
/\b(openai|anthropic|generateText|streamText|chat\.completions|messages\.create)\b/i.test(
|
|
1242
|
+
text,
|
|
1243
|
+
)
|
|
1244
|
+
) {
|
|
1245
|
+
behavior.llmCalls.push({
|
|
1246
|
+
id: stableId(`${file}:llm`),
|
|
1247
|
+
filePath: file,
|
|
1248
|
+
provider: inferLlmProvider(text),
|
|
1249
|
+
});
|
|
1250
|
+
}
|
|
1251
|
+
if (
|
|
1252
|
+
/\b(drizzle|prisma|postgres|supabase|mysql|sqlite|mongoose)\b/i.test(text)
|
|
1253
|
+
) {
|
|
1254
|
+
behavior.dataStores.push({
|
|
1255
|
+
id: stableId(`${file}:data`),
|
|
1256
|
+
name: path.basename(file),
|
|
1257
|
+
filePath: file,
|
|
1258
|
+
kind: "database",
|
|
1259
|
+
});
|
|
1260
|
+
}
|
|
1261
|
+
if (/\b(next-auth|better-auth|auth0|clerk|supabase\.auth)\b/i.test(text)) {
|
|
1262
|
+
behavior.auth.push({
|
|
1263
|
+
id: stableId(`${file}:auth`),
|
|
1264
|
+
filePath: file,
|
|
1265
|
+
provider: inferAuthProvider(text),
|
|
1266
|
+
});
|
|
1267
|
+
}
|
|
1268
|
+
if (
|
|
1269
|
+
/\b(cron|schedule|queue|inngest|trigger\.dev|setInterval)\b/i.test(text)
|
|
1270
|
+
) {
|
|
1271
|
+
behavior.jobs.push({
|
|
1272
|
+
id: stableId(`${file}:job`),
|
|
1273
|
+
filePath: file,
|
|
1274
|
+
kind: "scheduled-or-queued",
|
|
1275
|
+
});
|
|
1276
|
+
}
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
return {
|
|
1280
|
+
site: {
|
|
1281
|
+
framework,
|
|
1282
|
+
sourceRoot,
|
|
1283
|
+
routes,
|
|
1284
|
+
redirects: [],
|
|
1285
|
+
metadata: {
|
|
1286
|
+
routeCount: routes.length,
|
|
1287
|
+
fileCount: files.length,
|
|
1288
|
+
packageManager: detectPackageManager(sourceRoot),
|
|
1289
|
+
},
|
|
1290
|
+
},
|
|
1291
|
+
components: {
|
|
1292
|
+
components: files
|
|
1293
|
+
.filter(
|
|
1294
|
+
(file) =>
|
|
1295
|
+
/(^|\/)(components|ui)\//.test(file) &&
|
|
1296
|
+
/\.(ts|tsx|js|jsx)$/.test(file),
|
|
1297
|
+
)
|
|
1298
|
+
.sort()
|
|
1299
|
+
.map((file) => ({
|
|
1300
|
+
id: stableId(file),
|
|
1301
|
+
name: componentName(file),
|
|
1302
|
+
filePath: file,
|
|
1303
|
+
usedByRoutes: [],
|
|
1304
|
+
})),
|
|
1305
|
+
designTokens: {},
|
|
1306
|
+
},
|
|
1307
|
+
content: {
|
|
1308
|
+
models: [],
|
|
1309
|
+
assets: files
|
|
1310
|
+
.filter((file) =>
|
|
1311
|
+
/\.(png|jpe?g|webp|gif|svg|avif|pdf|mp4|webm)$/i.test(file),
|
|
1312
|
+
)
|
|
1313
|
+
.sort()
|
|
1314
|
+
.map((file) => ({
|
|
1315
|
+
id: stableId(file),
|
|
1316
|
+
path: file,
|
|
1317
|
+
type: path.extname(file).slice(1).toLowerCase() || "unknown",
|
|
1318
|
+
})),
|
|
1319
|
+
},
|
|
1320
|
+
behavior,
|
|
1321
|
+
};
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
function renderLocalAssessment(source: SourceSpec, ir: ProjectIRLike): string {
|
|
1325
|
+
return `# Migration Assessment
|
|
1326
|
+
|
|
1327
|
+
Source type: \`${source.kind}\`
|
|
1328
|
+
Source: \`${formatSourceForDisplay(source)}\`
|
|
1329
|
+
${source.description ? `Description: ${source.description}\n` : ""}
|
|
1330
|
+
Target: \`${DEFAULT_TARGET}\`
|
|
1331
|
+
|
|
1332
|
+
## Inventory
|
|
1333
|
+
|
|
1334
|
+
- Framework: ${ir.site.framework}
|
|
1335
|
+
- Routes: ${ir.site.routes.length}
|
|
1336
|
+
- Components: ${ir.components.components.length}
|
|
1337
|
+
- API endpoints: ${ir.behavior.apiEndpoints.length}
|
|
1338
|
+
- Data stores: ${ir.behavior.dataStores.length}
|
|
1339
|
+
- LLM calls: ${ir.behavior.llmCalls.length}
|
|
1340
|
+
- Client state hotspots: ${ir.behavior.clientState.length}
|
|
1341
|
+
- Auth hotspots: ${ir.behavior.auth.length}
|
|
1342
|
+
- Jobs: ${ir.behavior.jobs.length}
|
|
1343
|
+
- Assets: ${ir.content.assets.length}
|
|
1344
|
+
|
|
1345
|
+
## Routes
|
|
1346
|
+
|
|
1347
|
+
${ir.site.routes.map((route) => `- \`${route.path}\` (${route.kind}) from \`${route.filePath}\``).join("\n") || "- No routes detected."}
|
|
1348
|
+
|
|
1349
|
+
## Agent-Native Focus Areas
|
|
1350
|
+
|
|
1351
|
+
- Convert API routes and server mutations into actions unless they are uploads, webhooks, OAuth callbacks, or streams.
|
|
1352
|
+
- Move app-owned state into SQL with Drizzle and expose reads/writes through actions.
|
|
1353
|
+
- Delegate all AI work to the agent chat instead of calling model APIs directly from UI code.
|
|
1354
|
+
- Expose important navigation and selection state through application_state.
|
|
1355
|
+
- Keep public pages server-rendered and logged-in workflows inside the persistent app shell.
|
|
1356
|
+
`;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
function renderNonPathAssessment(source: SourceSpec): string {
|
|
1360
|
+
return `# Migration Assessment
|
|
1361
|
+
|
|
1362
|
+
Source type: \`${source.kind}\`
|
|
1363
|
+
Source: ${source.kind === "url" ? source.value : "provided description"}
|
|
1364
|
+
${source.description && source.kind !== "description" ? `Description: ${source.description}\n` : ""}
|
|
1365
|
+
${source.kind === "description" ? `Description: ${source.value}\n` : ""}
|
|
1366
|
+
Target: \`${DEFAULT_TARGET}\`
|
|
1367
|
+
|
|
1368
|
+
## Inventory
|
|
1369
|
+
|
|
1370
|
+
No local source path was provided, so this dossier does not include file-level IR. Use the URL or description as the intake brief, then let an Agent-Native Code or Desktop session inspect the real source before writing output.
|
|
1371
|
+
|
|
1372
|
+
## Agent-Native Focus Areas
|
|
1373
|
+
|
|
1374
|
+
- Identify public pages, logged-in workflows, API endpoints, data ownership, auth, jobs, and direct LLM calls.
|
|
1375
|
+
- Convert operations into actions and keep application data in SQL.
|
|
1376
|
+
- Generate output outside the original source tree.
|
|
1377
|
+
- Verify claims with deterministic checks or explicit human review notes.
|
|
1378
|
+
`;
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
function renderDossierAgentsMd(
|
|
1382
|
+
source: SourceSpec,
|
|
1383
|
+
templateAgents: string | null,
|
|
1384
|
+
planInputs: unknown | null,
|
|
1385
|
+
): string {
|
|
1386
|
+
return `# Migration Dossier Agent Instructions
|
|
1387
|
+
|
|
1388
|
+
You are migrating an existing application to agent-native.
|
|
1389
|
+
|
|
1390
|
+
## Source
|
|
1391
|
+
|
|
1392
|
+
- Type: ${source.kind}
|
|
1393
|
+
- Value: ${formatSourceForDisplay(source)}
|
|
1394
|
+
${source.description ? `- Description: ${source.description}\n` : ""}
|
|
1395
|
+
## Hard Rules
|
|
1396
|
+
|
|
1397
|
+
- Never write generated files inside the sourceRoot.
|
|
1398
|
+
- Treat source as read-only unless the user explicitly asks for source edits.
|
|
1399
|
+
- Put generated output in a separate directory.
|
|
1400
|
+
- Keep app-owned data in SQL, expose operations as actions, and route AI work through the agent chat.
|
|
1401
|
+
- Use 01-assessment.md and ir.json when present. If they are incomplete, update the assessment before implementation.
|
|
1402
|
+
- Record manual gaps and verification evidence. Do not present a migration as complete without checks.
|
|
1403
|
+
${planInputs ? "- Treat `02-plan-inputs.json` as binding planning input. Do not approve output writes until the generated task list covers it.\n" : ""}
|
|
1404
|
+
|
|
1405
|
+
## Files In This Dossier
|
|
1406
|
+
|
|
1407
|
+
- \`MIGRATION_PLAYBOOK.md\` - ordered workflow for Agent-Native Code/Desktop.
|
|
1408
|
+
- \`01-assessment.md\` - initial source assessment.
|
|
1409
|
+
- \`02-plan-inputs.json\` - custom route ownership, AEM, Builder, jQuery, or verification profile when present.
|
|
1410
|
+
- \`ir.json\` - source inventory when available.
|
|
1411
|
+
- \`.agents/skills/migration*/SKILL.md\` - extra instruction packs when available from the migration goal surface.
|
|
1412
|
+
|
|
1413
|
+
${templateAgents ? `## Migration Goal Surface Instructions\n\n${templateAgents.trim()}\n` : ""}
|
|
1414
|
+
`;
|
|
1415
|
+
}
|
|
1416
|
+
|
|
1417
|
+
function renderMigrationPlaybook(
|
|
1418
|
+
source: SourceSpec,
|
|
1419
|
+
planInputs: unknown | null,
|
|
1420
|
+
): string {
|
|
1421
|
+
return `# Migration Playbook
|
|
1422
|
+
|
|
1423
|
+
## 1. Intake Any Input
|
|
1424
|
+
|
|
1425
|
+
Start from the available input: a local source path, a URL, or a prose description. If this dossier has \`ir.json\`, use it as a first inventory. If not, inspect the real source before planning implementation.
|
|
1426
|
+
|
|
1427
|
+
Source: ${formatSourceForDisplay(source)}
|
|
1428
|
+
|
|
1429
|
+
## 2. Build The Migration Map
|
|
1430
|
+
|
|
1431
|
+
Classify routes, public pages, logged-in app surfaces, API endpoints, data stores, auth, jobs, client state, assets, and direct LLM calls. Update \`01-assessment.md\` when you learn more.
|
|
1432
|
+
|
|
1433
|
+
${planInputs ? "Use `02-plan-inputs.json` as the customer-specific migration profile. Apply its route ownership, AEM evidence, Builder registration, headless, jQuery, and verification constraints before approving output writes.\n" : ""}
|
|
1434
|
+
|
|
1435
|
+
## 3. Apply Agent-Native Rules
|
|
1436
|
+
|
|
1437
|
+
- Actions are the single source of truth for operations.
|
|
1438
|
+
- Data lives in SQL through Drizzle.
|
|
1439
|
+
- AI work goes through the agent chat.
|
|
1440
|
+
- Important UI state is mirrored through \`application_state\`.
|
|
1441
|
+
- Public/SEO pages server-render; logged-in workflows use the persistent app shell.
|
|
1442
|
+
- Ownable resources use sharing and access helpers.
|
|
1443
|
+
|
|
1444
|
+
## 4. Work In Samples
|
|
1445
|
+
|
|
1446
|
+
Migrate one representative route or workflow first. Verify it, tune the pattern, then sweep similar surfaces. Keep generated output outside the original source tree.
|
|
1447
|
+
|
|
1448
|
+
## 5. Verify
|
|
1449
|
+
|
|
1450
|
+
Run typecheck/build plus route, action, and data checks that fit the migrated app. Capture unresolved gaps in a report before handing off.
|
|
1451
|
+
|
|
1452
|
+
## 6. Use With Agent-Native Code Or Desktop
|
|
1453
|
+
|
|
1454
|
+
Point Codex, Claude Code, another code agent, or Agent-Native Desktop at this dossier directory. Ask it to follow \`AGENTS.md\`, then implement the plan in a separate output project.
|
|
1455
|
+
`;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
function copyMigrationSkills(
|
|
1459
|
+
templateDir: string | undefined,
|
|
1460
|
+
dossierRoot: string,
|
|
1461
|
+
): string[] {
|
|
1462
|
+
if (!templateDir) return [];
|
|
1463
|
+
const skillsRoot = path.join(templateDir, ".agents", "skills");
|
|
1464
|
+
if (!fs.existsSync(skillsRoot)) return [];
|
|
1465
|
+
const copied: string[] = [];
|
|
1466
|
+
for (const entry of fs.readdirSync(skillsRoot, { withFileTypes: true })) {
|
|
1467
|
+
if (!entry.isDirectory() || !entry.name.startsWith("migration")) continue;
|
|
1468
|
+
const src = path.join(skillsRoot, entry.name, "SKILL.md");
|
|
1469
|
+
if (!fs.existsSync(src)) continue;
|
|
1470
|
+
const relative = path.join(".agents", "skills", entry.name, "SKILL.md");
|
|
1471
|
+
const dest = path.join(dossierRoot, relative);
|
|
1472
|
+
fs.mkdirSync(path.dirname(dest), { recursive: true });
|
|
1473
|
+
fs.copyFileSync(src, dest);
|
|
1474
|
+
copied.push(relative);
|
|
1475
|
+
}
|
|
1476
|
+
return copied;
|
|
1477
|
+
}
|
|
1478
|
+
|
|
1479
|
+
function findMigrationTemplateDir(): string | undefined {
|
|
1480
|
+
const starts = [__dirname, process.cwd()];
|
|
1481
|
+
for (const start of starts) {
|
|
1482
|
+
let dir = path.resolve(start);
|
|
1483
|
+
for (let i = 0; i < 12; i++) {
|
|
1484
|
+
for (const candidate of [
|
|
1485
|
+
path.join(dir, "templates", "migration"),
|
|
1486
|
+
path.join(dir, "src", "templates", "migration"),
|
|
1487
|
+
]) {
|
|
1488
|
+
if (fs.existsSync(path.join(candidate, "AGENTS.md"))) {
|
|
1489
|
+
return candidate;
|
|
1490
|
+
}
|
|
1491
|
+
}
|
|
1492
|
+
const parent = path.dirname(dir);
|
|
1493
|
+
if (parent === dir) break;
|
|
1494
|
+
dir = parent;
|
|
1495
|
+
}
|
|
1496
|
+
}
|
|
1497
|
+
return undefined;
|
|
1498
|
+
}
|
|
1499
|
+
|
|
1500
|
+
function resolveWorkbenchDir(opts: MigrateCliOptions): string {
|
|
1501
|
+
if (opts.workbench) return path.resolve(process.cwd(), opts.workbench);
|
|
1502
|
+
return resolveScaffoldedAppDir(
|
|
1503
|
+
process.cwd(),
|
|
1504
|
+
opts.appName ?? DEFAULT_APP_NAME,
|
|
1505
|
+
);
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
function resolveScaffoldedAppDir(cwd: string, appName: string): string {
|
|
1509
|
+
const workspaceAppDir = path.join(cwd, "apps", appName);
|
|
1510
|
+
if (fs.existsSync(workspaceAppDir)) return workspaceAppDir;
|
|
1511
|
+
return path.join(cwd, appName);
|
|
1512
|
+
}
|
|
1513
|
+
|
|
1514
|
+
function sourceSeedPayload(source: SourceSpec): Record<string, string> {
|
|
1515
|
+
return {
|
|
1516
|
+
kind: source.kind,
|
|
1517
|
+
value: source.value,
|
|
1518
|
+
...(source.sourceRoot ? { sourceRoot: source.sourceRoot } : {}),
|
|
1519
|
+
...(source.description ? { description: source.description } : {}),
|
|
1520
|
+
};
|
|
1521
|
+
}
|
|
1522
|
+
|
|
1523
|
+
function defaultRunName(source: SourceSpec): string {
|
|
1524
|
+
if (source.sourceRoot) {
|
|
1525
|
+
return `Migration from ${path.basename(source.sourceRoot)}`;
|
|
1526
|
+
}
|
|
1527
|
+
if (source.kind === "url") {
|
|
1528
|
+
return `Migration from ${source.value}`;
|
|
1529
|
+
}
|
|
1530
|
+
return "Migration from described source";
|
|
1531
|
+
}
|
|
1532
|
+
|
|
1533
|
+
function stringMetadata(
|
|
1534
|
+
run: CodeAgentRunRecord,
|
|
1535
|
+
key: string,
|
|
1536
|
+
): string | undefined {
|
|
1537
|
+
const value = run.metadata?.[key];
|
|
1538
|
+
return typeof value === "string" ? value : undefined;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
function formatSeedSource(
|
|
1542
|
+
seed: {
|
|
1543
|
+
sourceKind?: string;
|
|
1544
|
+
sourceRoot?: string;
|
|
1545
|
+
sourceUrl?: string;
|
|
1546
|
+
sourceDescription?: string;
|
|
1547
|
+
} | null,
|
|
1548
|
+
): string {
|
|
1549
|
+
if (!seed) return "not set";
|
|
1550
|
+
if (seed.sourceRoot) return seed.sourceRoot;
|
|
1551
|
+
if (seed.sourceUrl) return seed.sourceUrl;
|
|
1552
|
+
if (seed.sourceDescription) return seed.sourceDescription;
|
|
1553
|
+
return seed.sourceKind ?? "not set";
|
|
1554
|
+
}
|
|
1555
|
+
|
|
1556
|
+
function readArtifactRuns(
|
|
1557
|
+
appDir: string,
|
|
1558
|
+
): Array<{ id: string; phase: string }> {
|
|
1559
|
+
const runsRoot = path.join(appDir, "data", "migration-runs");
|
|
1560
|
+
if (!fs.existsSync(runsRoot)) return [];
|
|
1561
|
+
return fs
|
|
1562
|
+
.readdirSync(runsRoot, { withFileTypes: true })
|
|
1563
|
+
.filter((entry) => entry.isDirectory())
|
|
1564
|
+
.map((entry) => {
|
|
1565
|
+
const run = readJsonIfExists(
|
|
1566
|
+
path.join(runsRoot, entry.name, "run.json"),
|
|
1567
|
+
) as { id?: string; phase?: string; updatedAt?: string } | null;
|
|
1568
|
+
return {
|
|
1569
|
+
id: run?.id ?? entry.name,
|
|
1570
|
+
phase: run?.phase ?? "unknown",
|
|
1571
|
+
updatedAt: run?.updatedAt ?? "",
|
|
1572
|
+
};
|
|
1573
|
+
})
|
|
1574
|
+
.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
|
|
1575
|
+
}
|
|
1576
|
+
|
|
1577
|
+
function credentialStatusLines(): string[] {
|
|
1578
|
+
const configured = MODEL_CREDENTIAL_ENV_NAMES.filter((key) =>
|
|
1579
|
+
Boolean(process.env[key]),
|
|
1580
|
+
);
|
|
1581
|
+
if (configured.length > 0) {
|
|
1582
|
+
return [
|
|
1583
|
+
`Headless credentials: detected ${configured.join(", ")} in this shell.`,
|
|
1584
|
+
"Secret values were not read or stored.",
|
|
1585
|
+
];
|
|
1586
|
+
}
|
|
1587
|
+
return [
|
|
1588
|
+
`Headless credentials: none of ${MODEL_CREDENTIAL_ENV_NAMES.join(", ")} are set in this shell.`,
|
|
1589
|
+
"Set credentials in the Workbench app env or use Desktop/Agent-Native Code credentials; the migrate CLI will not store them.",
|
|
1590
|
+
];
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1593
|
+
function walkSourceFiles(root: string): string[] {
|
|
1594
|
+
const out: string[] = [];
|
|
1595
|
+
const ignored = new Set([
|
|
1596
|
+
".git",
|
|
1597
|
+
".next",
|
|
1598
|
+
".turbo",
|
|
1599
|
+
"node_modules",
|
|
1600
|
+
"dist",
|
|
1601
|
+
"build",
|
|
1602
|
+
".output",
|
|
1603
|
+
"coverage",
|
|
1604
|
+
]);
|
|
1605
|
+
const visit = (dir: string) => {
|
|
1606
|
+
if (out.length > 5000) return;
|
|
1607
|
+
let entries: fs.Dirent[];
|
|
1608
|
+
try {
|
|
1609
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
1610
|
+
} catch {
|
|
1611
|
+
return;
|
|
1612
|
+
}
|
|
1613
|
+
for (const entry of entries) {
|
|
1614
|
+
if (ignored.has(entry.name)) continue;
|
|
1615
|
+
const absolute = path.join(dir, entry.name);
|
|
1616
|
+
if (entry.isDirectory()) {
|
|
1617
|
+
visit(absolute);
|
|
1618
|
+
} else if (entry.isFile()) {
|
|
1619
|
+
out.push(toPosix(path.relative(root, absolute)));
|
|
1620
|
+
}
|
|
1621
|
+
}
|
|
1622
|
+
};
|
|
1623
|
+
visit(root);
|
|
1624
|
+
return out.sort();
|
|
1625
|
+
}
|
|
1626
|
+
|
|
1627
|
+
function routeFromFile(
|
|
1628
|
+
relativePath: string,
|
|
1629
|
+
): ProjectIRLike["site"]["routes"][number] | null {
|
|
1630
|
+
const normalized = toPosix(relativePath);
|
|
1631
|
+
const router = normalized.startsWith("app/") ? "next-app" : "next-pages";
|
|
1632
|
+
const isPageRoute =
|
|
1633
|
+
normalized.startsWith("pages/") &&
|
|
1634
|
+
/\.(ts|tsx|js|jsx|md|mdx)$/.test(normalized) &&
|
|
1635
|
+
!normalized.startsWith("pages/_app.") &&
|
|
1636
|
+
!normalized.startsWith("pages/_document.");
|
|
1637
|
+
const isAppRoute =
|
|
1638
|
+
normalized.startsWith("app/") &&
|
|
1639
|
+
/\/(page|route)\.(ts|tsx|js|jsx|md|mdx)$/.test(normalized);
|
|
1640
|
+
if (!isPageRoute && !isAppRoute) return null;
|
|
1641
|
+
|
|
1642
|
+
const isApi =
|
|
1643
|
+
normalized.startsWith("pages/api/") ||
|
|
1644
|
+
/(^|\/)api\/.*\/route\.[tj]sx?$/.test(normalized) ||
|
|
1645
|
+
normalized.endsWith("/route.ts") ||
|
|
1646
|
+
normalized.endsWith("/route.tsx") ||
|
|
1647
|
+
normalized.endsWith("/route.js") ||
|
|
1648
|
+
normalized.endsWith("/route.jsx");
|
|
1649
|
+
|
|
1650
|
+
let routePath = normalized;
|
|
1651
|
+
if (router === "next-app") {
|
|
1652
|
+
routePath = routePath
|
|
1653
|
+
.replace(/^app\//, "")
|
|
1654
|
+
.replace(/(^|\/)(page|route)\.(ts|tsx|js|jsx|md|mdx)$/, "");
|
|
1655
|
+
} else {
|
|
1656
|
+
routePath = routePath
|
|
1657
|
+
.replace(/^pages\//, "")
|
|
1658
|
+
.replace(/\.(ts|tsx|js|jsx|md|mdx)$/, "");
|
|
1659
|
+
}
|
|
1660
|
+
|
|
1661
|
+
routePath = routePath
|
|
1662
|
+
.replace(/\/index$/, "")
|
|
1663
|
+
.replace(/^index$/, "")
|
|
1664
|
+
.replace(/^\(.*?\)\//, "")
|
|
1665
|
+
.replace(/\[(\.\.\.)?([^\]]+)\]/g, (_, dots: string, name: string) =>
|
|
1666
|
+
dots ? `*${name}` : `:${name}`,
|
|
1667
|
+
);
|
|
1668
|
+
const publicPath = routePath ? `/${routePath}` : "/";
|
|
1669
|
+
const pathValue = publicPath === "/api" && isApi ? "/api/*" : publicPath;
|
|
1670
|
+
const kind = isApi
|
|
1671
|
+
? "api"
|
|
1672
|
+
: pathValue === "/"
|
|
1673
|
+
? "landing"
|
|
1674
|
+
: pathValue.includes("docs")
|
|
1675
|
+
? "docs"
|
|
1676
|
+
: pathValue.includes("pricing") || pathValue.includes("blog")
|
|
1677
|
+
? "marketing"
|
|
1678
|
+
: "app";
|
|
1679
|
+
return {
|
|
1680
|
+
id: stableId(normalized),
|
|
1681
|
+
path: pathValue,
|
|
1682
|
+
filePath: normalized,
|
|
1683
|
+
router,
|
|
1684
|
+
kind,
|
|
1685
|
+
dynamic: pathValue.includes(":") || pathValue.includes("*"),
|
|
1686
|
+
public: kind !== "app" && kind !== "api",
|
|
1687
|
+
notes: isApi
|
|
1688
|
+
? [
|
|
1689
|
+
"Convert to an action unless it uploads, streams, handles OAuth, or receives webhooks.",
|
|
1690
|
+
]
|
|
1691
|
+
: [],
|
|
1692
|
+
};
|
|
1693
|
+
}
|
|
1694
|
+
|
|
1695
|
+
function apiPathFromFile(file: string): string {
|
|
1696
|
+
let value = file
|
|
1697
|
+
.replace(/^pages\/api\//, "/api/")
|
|
1698
|
+
.replace(/^app\//, "/")
|
|
1699
|
+
.replace(/\/route\.[tj]sx?$/, "")
|
|
1700
|
+
.replace(/\.[tj]sx?$/, "");
|
|
1701
|
+
value = value
|
|
1702
|
+
.replace(/\/index$/, "")
|
|
1703
|
+
.replace(/\[(\.\.\.)?([^\]]+)\]/g, (_, dots: string, name: string) =>
|
|
1704
|
+
dots ? `*${name}` : `:${name}`,
|
|
1705
|
+
);
|
|
1706
|
+
return value || "/api";
|
|
1707
|
+
}
|
|
1708
|
+
|
|
1709
|
+
function inferHttpMethod(text: string): string {
|
|
1710
|
+
const exported = text.match(
|
|
1711
|
+
/export\s+(?:async\s+)?function\s+(GET|POST|PUT|PATCH|DELETE)/,
|
|
1712
|
+
);
|
|
1713
|
+
if (exported) return exported[1];
|
|
1714
|
+
const method = text.match(
|
|
1715
|
+
/method\s*[:=]\s*["'](GET|POST|PUT|PATCH|DELETE)["']/i,
|
|
1716
|
+
);
|
|
1717
|
+
return method?.[1]?.toUpperCase() ?? "GET";
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
function inferLlmProvider(text: string): string {
|
|
1721
|
+
if (/anthropic/i.test(text)) return "anthropic";
|
|
1722
|
+
if (/openai/i.test(text)) return "openai";
|
|
1723
|
+
return "unknown";
|
|
1724
|
+
}
|
|
1725
|
+
|
|
1726
|
+
function inferAuthProvider(text: string): string {
|
|
1727
|
+
if (/better-auth/i.test(text)) return "better-auth";
|
|
1728
|
+
if (/next-auth/i.test(text)) return "next-auth";
|
|
1729
|
+
if (/clerk/i.test(text)) return "clerk";
|
|
1730
|
+
if (/auth0/i.test(text)) return "auth0";
|
|
1731
|
+
if (/supabase\.auth/i.test(text)) return "supabase";
|
|
1732
|
+
return "unknown";
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
function componentName(file: string): string {
|
|
1736
|
+
const base = path.basename(file).replace(/\.(ts|tsx|js|jsx)$/, "");
|
|
1737
|
+
return base
|
|
1738
|
+
.split(/[-_]/g)
|
|
1739
|
+
.filter(Boolean)
|
|
1740
|
+
.map((part) => part[0]?.toUpperCase() + part.slice(1))
|
|
1741
|
+
.join("");
|
|
1742
|
+
}
|
|
1743
|
+
|
|
1744
|
+
function detectPackageManager(sourceRoot: string): string {
|
|
1745
|
+
if (fs.existsSync(path.join(sourceRoot, "pnpm-lock.yaml"))) return "pnpm";
|
|
1746
|
+
if (fs.existsSync(path.join(sourceRoot, "yarn.lock"))) return "yarn";
|
|
1747
|
+
if (fs.existsSync(path.join(sourceRoot, "package-lock.json"))) return "npm";
|
|
1748
|
+
return "unknown";
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
function readSmallText(filePath: string): string | null {
|
|
1752
|
+
try {
|
|
1753
|
+
const stat = fs.statSync(filePath);
|
|
1754
|
+
if (stat.size > 256_000) return null;
|
|
1755
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
1756
|
+
} catch {
|
|
1757
|
+
return null;
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
|
|
1761
|
+
function readJsonIfExists(filePath: string): unknown | null {
|
|
1762
|
+
try {
|
|
1763
|
+
return JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
1764
|
+
} catch {
|
|
1765
|
+
return null;
|
|
1766
|
+
}
|
|
1767
|
+
}
|
|
1768
|
+
|
|
1769
|
+
function readTextIfExists(filePath: string | undefined): string | null {
|
|
1770
|
+
if (!filePath) return null;
|
|
1771
|
+
try {
|
|
1772
|
+
return fs.readFileSync(filePath, "utf-8");
|
|
1773
|
+
} catch {
|
|
1774
|
+
return null;
|
|
1775
|
+
}
|
|
1776
|
+
}
|
|
1777
|
+
|
|
1778
|
+
function hasAnyFile(root: string, files: string[]): boolean {
|
|
1779
|
+
return files.some((file) => fs.existsSync(path.join(root, file)));
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
function stableId(value: string): string {
|
|
1783
|
+
return crypto.createHash("sha1").update(value).digest("hex").slice(0, 12);
|
|
1784
|
+
}
|
|
1785
|
+
|
|
1786
|
+
function isProbablyUrl(value: string): boolean {
|
|
1787
|
+
return /^[a-z][a-z0-9+.-]*:\/\//i.test(value);
|
|
1788
|
+
}
|
|
1789
|
+
|
|
1790
|
+
function formatSourceForDisplay(source: SourceSpec): string {
|
|
1791
|
+
if (source.sourceRoot) return source.sourceRoot;
|
|
1792
|
+
return source.value;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
function formatSourceForCommand(source: SourceSpec): string {
|
|
1796
|
+
if (source.kind === "description") {
|
|
1797
|
+
return `--describe ${shellQuote(source.value)}`;
|
|
1798
|
+
}
|
|
1799
|
+
const base = shellQuote(source.value);
|
|
1800
|
+
if (source.description) {
|
|
1801
|
+
return `${base} --describe ${shellQuote(source.description)}`;
|
|
1802
|
+
}
|
|
1803
|
+
return base;
|
|
1804
|
+
}
|
|
1805
|
+
|
|
1806
|
+
function shellQuote(value: string): string {
|
|
1807
|
+
if (/^[A-Za-z0-9_./:@%+=,-]+$/.test(value)) return value;
|
|
1808
|
+
return JSON.stringify(value);
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
function toPosix(value: string): string {
|
|
1812
|
+
return value.split(path.sep).join("/");
|
|
1813
|
+
}
|