@agent-native/core 0.91.1 → 0.92.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/blueprints/action/crud.md +1 -1
- package/blueprints/channel/discord.md +1 -1
- package/blueprints/provider/stripe.md +1 -1
- package/blueprints/sandbox/docker.md +1 -1
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +31 -0
- package/corpus/core/blueprints/action/crud.md +1 -1
- package/corpus/core/blueprints/channel/discord.md +1 -1
- package/corpus/core/blueprints/provider/stripe.md +1 -1
- package/corpus/core/blueprints/sandbox/docker.md +1 -1
- package/corpus/core/docs/content/faq.mdx +17 -0
- package/corpus/core/docs/content/notifications.mdx +12 -6
- package/corpus/core/package.json +6 -5
- package/corpus/core/src/agent/production-agent.ts +140 -46
- package/corpus/core/src/agent/run-manager.ts +23 -2
- package/corpus/core/src/agent/run-store.ts +2 -2
- package/corpus/core/src/agent/tool-search.ts +71 -4
- package/corpus/core/src/cli/add.ts +1 -1
- package/corpus/core/src/cli/create.ts +8 -3
- package/corpus/core/src/cli/index.ts +25 -4
- package/corpus/core/src/cli/upgrade.ts +798 -0
- package/corpus/core/src/client/AssistantChat.tsx +1 -1
- package/corpus/core/src/client/HighlightedCodeBlock.tsx +20 -3
- package/corpus/core/src/client/agent-chat-adapter.ts +31 -6
- package/corpus/core/src/client/chat/message-components.tsx +85 -8
- package/corpus/core/src/client/chat/tool-call-display.tsx +355 -144
- package/corpus/core/src/client/code-agent-chat-adapter.ts +2 -9
- package/corpus/core/src/client/extensions/ExtensionSlot.tsx +7 -0
- package/corpus/core/src/client/settings/SettingsPanel.tsx +533 -389
- package/corpus/core/src/client/settings/SettingsSection.tsx +154 -17
- package/corpus/core/src/client/sse-event-processor.ts +29 -2
- package/corpus/core/src/extensions/actions.ts +113 -5
- package/corpus/core/src/jobs/scheduler.ts +30 -1
- package/corpus/core/src/localization/default-messages.ts +21 -0
- package/corpus/core/src/notifications/channels.ts +88 -25
- package/corpus/core/src/notifications/registry.ts +17 -3
- package/corpus/core/src/notifications/types.ts +4 -1
- package/corpus/core/src/server/agent-chat-plugin.ts +7 -3
- package/corpus/core/src/server/request-context.ts +7 -0
- package/corpus/core/src/styles/agent-conversation.css +1 -1
- package/corpus/core/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/core/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/core/src/templates/default/AGENTS.md +10 -3
- package/corpus/core/src/templates/default/app/i18n/ar-SA.ts +21 -0
- package/corpus/core/src/templates/default/app/i18n/de-DE.ts +21 -0
- package/corpus/core/src/templates/default/app/i18n/en-US.ts +21 -0
- package/corpus/core/src/templates/default/app/i18n/es-ES.ts +21 -0
- package/corpus/core/src/templates/default/app/i18n/fr-FR.ts +21 -0
- package/corpus/core/src/templates/default/app/i18n/hi-IN.ts +20 -0
- package/corpus/core/src/templates/default/app/i18n/ja-JP.ts +21 -0
- package/corpus/core/src/templates/default/app/i18n/ko-KR.ts +20 -0
- package/corpus/core/src/templates/default/app/i18n/pt-BR.ts +21 -0
- package/corpus/core/src/templates/default/app/i18n/zh-CN.ts +20 -0
- package/corpus/core/src/templates/default/app/i18n/zh-TW.ts +19 -0
- package/corpus/core/src/templates/default/package.json +4 -3
- package/corpus/core/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/core/src/templates/headless/AGENTS.md +9 -3
- package/corpus/core/src/templates/headless/package.json +4 -3
- package/corpus/core/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/core/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/core/src/templates/workspace-core/package.json +6 -6
- package/corpus/core/src/templates/workspace-root/AGENTS.md +10 -4
- package/corpus/core/src/templates/workspace-root/package.json +3 -2
- package/corpus/core/src/triggers/dispatcher.ts +30 -2
- package/corpus/core/src/vite/client.ts +96 -1
- package/corpus/templates/analytics/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/analytics/.agents/skills/session-replay/SKILL.md +20 -2
- package/corpus/templates/analytics/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/analytics/AGENTS.md +7 -5
- package/corpus/templates/analytics/actions/save-monitor.ts +14 -0
- package/corpus/templates/analytics/app/components/dashboard/DataTable.tsx +41 -6
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +122 -11
- package/corpus/templates/analytics/app/global.css +26 -10
- package/corpus/templates/analytics/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/analytics/app/i18n-data.ts +25 -0
- package/corpus/templates/analytics/app/pages/monitoring/MonitoringPage.tsx +8 -2
- package/corpus/templates/analytics/app/pages/monitoring/uptime/MonitorFormPage.tsx +151 -32
- package/corpus/templates/analytics/app/pages/monitoring/uptime/i18n.ts +17 -2
- package/corpus/templates/analytics/app/pages/monitoring/uptime/types.ts +4 -0
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +461 -286
- package/corpus/templates/analytics/app/pages/sessions/SessionDevToolsPanel.tsx +285 -294
- package/corpus/templates/analytics/changelog/2026-07-08-console-details-expand-inline-under-each-row-and-the-event-t.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-dashboard-tables-keep-their-size-while-loading.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-monitoring-uptime-and-errors-tabs-now-clearly-show-which-view-is-active.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-session-replay-keeps-a-usable-stage-when-dev-tools-is-open-a.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-session-replay-resumes-after-scrubbing-and-expands-console-r.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-session-replay-uses-stock-rrweb-sizing-again-so-recorded.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-session-replays-wait-for-full-load-keep-a-normal-viewport-an.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-sidebar-dashboard-menus-now-open-above-the-dashboard-canvas.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-08-uptime-alerting-clarifies-in-app-inbox-vs-email-and-lets-you-paste-slack-or-webhook-urls-per-monitor.md +6 -0
- package/corpus/templates/analytics/docs/uptime-monitoring.md +13 -11
- package/corpus/templates/analytics/package.json +2 -2
- package/corpus/templates/analytics/server/db/schema-monitoring.ts +4 -0
- package/corpus/templates/analytics/server/lib/uptime-monitors.ts +60 -12
- package/corpus/templates/analytics/server/plugins/db.ts +10 -0
- package/corpus/templates/assets/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/assets/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/assets/package.json +2 -2
- package/corpus/templates/brain/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/brain/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/brain/package.json +2 -2
- package/corpus/templates/calendar/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/calendar/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/calendar/AGENTS.md +10 -0
- package/corpus/templates/calendar/actions/create-event.ts +5 -1
- package/corpus/templates/calendar/actions/event-action-helpers.ts +41 -0
- package/corpus/templates/calendar/actions/get-attendee-timezones.ts +28 -0
- package/corpus/templates/calendar/actions/set-attendee-timezone.ts +68 -0
- package/corpus/templates/calendar/app/components/calendar/EventAttendeesSection.tsx +150 -11
- package/corpus/templates/calendar/app/components/calendar/EventDetailPanel.tsx +36 -1
- package/corpus/templates/calendar/app/components/calendar/EventDetailPopover.tsx +32 -0
- package/corpus/templates/calendar/app/hooks/use-attendee-timezones.ts +24 -0
- package/corpus/templates/calendar/app/i18n/zh-TW.ts +2 -0
- package/corpus/templates/calendar/app/i18n-data.ts +20 -0
- package/corpus/templates/calendar/app/lib/attendee-local-time.ts +122 -0
- package/corpus/templates/calendar/changelog/2026-07-08-event-details-now-support-extension-widgets-and-you-can-see-.md +6 -0
- package/corpus/templates/calendar/changelog/2026-07-08-when-you-invite-guests-to-a-new-event-you-now-appear-in.md +6 -0
- package/corpus/templates/calendar/package.json +2 -2
- package/corpus/templates/calendar/server/handlers/events.ts +5 -1
- package/corpus/templates/calendar/shared/api.ts +6 -0
- package/corpus/templates/chat/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/chat/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/chat/package.json +2 -2
- package/corpus/templates/clips/.agents/skills/meetings/SKILL.md +6 -2
- package/corpus/templates/clips/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/clips/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/clips/actions/create-meeting.ts +8 -3
- package/corpus/templates/clips/actions/list-meetings.ts +31 -3
- package/corpus/templates/clips/changelog/2026-07-08-after-finishing-a-desktop-recording-reopening-clips-restor.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-clips-now-pops-up-to-take-notes-when-you-join-an-adhoc-zoom-.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-desktop-clip-recordings-are-louder-after-capture-mic-only.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-desktop-meeting-notes-stay-active-from-tray-and-shortcut-controls.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-desktop-meeting-popovers-can-start-notes-and-join-the-meetin.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-meeting-notes-keep-their-recording-state-when-the-desktop.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-meeting-reminder-dropdowns-now-expand-fully-instead-of-being.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-meeting-reminders-now-appear-1-minute-before-start-stay-unti.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-08-the-desktop-meetings-panel-has-room-for-its-drop-shadow-and-.md +6 -0
- package/corpus/templates/clips/chrome-extension/package.json +2 -2
- package/corpus/templates/clips/desktop/package.json +2 -2
- package/corpus/templates/clips/desktop/src/app.tsx +214 -37
- package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +30 -6
- package/corpus/templates/clips/desktop/src/lib/meeting-notification-timing.ts +83 -0
- package/corpus/templates/clips/desktop/src/lib/native-recording-warm.ts +21 -0
- package/corpus/templates/clips/desktop/src/lib/recorder.ts +98 -20
- package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +197 -50
- package/corpus/templates/clips/desktop/src/styles.css +150 -53
- package/corpus/templates/clips/desktop/src-tauri/src/adhoc_meetings_watcher.rs +362 -0
- package/corpus/templates/clips/desktop/src-tauri/src/clips/mod.rs +41 -7
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +9 -2
- package/corpus/templates/clips/desktop/src-tauri/src/meetings_watcher.rs +89 -11
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +71 -17
- package/corpus/templates/clips/desktop/src-tauri/src/native_speech.rs +36 -1
- package/corpus/templates/clips/desktop/src-tauri/src/notifications.rs +62 -10
- package/corpus/templates/clips/desktop/src-tauri/src/shortcuts.rs +3 -3
- package/corpus/templates/clips/desktop/src-tauri/src/silence_detector.rs +1 -25
- package/corpus/templates/clips/desktop/src-tauri/src/state.rs +5 -0
- package/corpus/templates/clips/desktop/src-tauri/src/tray.rs +18 -6
- package/corpus/templates/clips/desktop/src-tauri/src/util.rs +36 -1
- package/corpus/templates/clips/package.json +2 -2
- package/corpus/templates/content/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/content/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/content/actions/_batch-utils.ts +8 -0
- package/corpus/templates/content/actions/_builder-cms-read-client.ts +7 -5
- package/corpus/templates/content/actions/_content-database-personal-view.ts +80 -0
- package/corpus/templates/content/actions/_database-source-utils.ts +776 -319
- package/corpus/templates/content/actions/_database-utils.ts +6 -1
- package/corpus/templates/content/actions/_property-utils.ts +168 -0
- package/corpus/templates/content/actions/add-content-database-source-field-property.ts +19 -12
- package/corpus/templates/content/actions/bind-content-database-source-field.ts +19 -12
- package/corpus/templates/content/actions/delete-document.ts +9 -13
- package/corpus/templates/content/actions/get-content-database-personal-view.ts +27 -0
- package/corpus/templates/content/actions/refresh-content-database-source.ts +5 -5
- package/corpus/templates/content/actions/update-content-database-personal-view.ts +31 -0
- package/corpus/templates/content/actions/update-content-database-view.ts +3 -0
- package/corpus/templates/content/app/components/editor/DocumentProperties.tsx +1 -1
- package/corpus/templates/content/app/components/editor/body-hydration.ts +35 -11
- package/corpus/templates/content/app/components/editor/database/DatabaseView.tsx +2631 -551
- package/corpus/templates/content/app/components/editor/database/filter-sort.ts +220 -18
- package/corpus/templates/content/app/hooks/use-content-database.ts +32 -0
- package/corpus/templates/content/app/hooks/use-documents.ts +8 -2
- package/corpus/templates/content/app/i18n/zh-TW.ts +16 -0
- package/corpus/templates/content/app/i18n-data.ts +154 -0
- package/corpus/templates/content/changelog/2026-07-08-builder-source-sync-now-completes-reliably-on-hosted-databases.md +6 -0
- package/corpus/templates/content/changelog/2026-07-08-database-filters-now-support-notion-style-reset-save-for-eve.md +6 -0
- package/corpus/templates/content/changelog/2026-07-08-date-filters-can-now-target-a-between-range.md +6 -0
- package/corpus/templates/content/changelog/2026-07-08-fixed-builder-database-sync-so-large-sources-continue-past-t.md +6 -0
- package/corpus/templates/content/package.json +2 -2
- package/corpus/templates/content/parity/matrix.md +1 -1
- package/corpus/templates/content/parity/matrix.ts +2 -0
- package/corpus/templates/content/server/plugins/db.ts +19 -0
- package/corpus/templates/content/shared/api.ts +24 -0
- package/corpus/templates/design/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/design/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/design/package.json +2 -2
- package/corpus/templates/dispatch/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/dispatch/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/dispatch/app/i18n/zh-TW.ts +34 -1
- package/corpus/templates/dispatch/app/i18n-data.ts +387 -10
- package/corpus/templates/dispatch/app/routes/automations.tsx +1 -0
- package/corpus/templates/dispatch/changelog/2026-07-08-added-an-automations-page-to-review-pause-and-create.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-08-destinations-now-shows-outbound-delivery-queue-health.md +6 -0
- package/corpus/templates/dispatch/package.json +2 -2
- package/corpus/templates/forms/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/forms/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/forms/package.json +2 -2
- package/corpus/templates/macros/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/macros/package.json +2 -2
- package/corpus/templates/mail/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/mail/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/mail/app/hooks/use-emails.ts +56 -44
- package/corpus/templates/mail/app/lib/gmail-mutation-queue.ts +325 -0
- package/corpus/templates/mail/changelog/2026-07-08-rapid-archive-and-mark-read-now-batch-gmail-updates-so-the-i.md +6 -0
- package/corpus/templates/mail/package.json +2 -2
- package/corpus/templates/plan/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/plan/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/plan/package.json +2 -2
- package/corpus/templates/slides/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/corpus/templates/slides/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/slides/app/components/editor/ImageDropPromptPopover.tsx +46 -29
- package/corpus/templates/slides/app/context/DeckContext.tsx +45 -18
- package/corpus/templates/slides/app/i18n/ar-SA.ts +4 -0
- package/corpus/templates/slides/app/i18n/de-DE.ts +4 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +4 -0
- package/corpus/templates/slides/app/i18n/es-ES.ts +4 -0
- package/corpus/templates/slides/app/i18n/fr-FR.ts +4 -0
- package/corpus/templates/slides/app/i18n/hi-IN.ts +4 -0
- package/corpus/templates/slides/app/i18n/ja-JP.ts +4 -0
- package/corpus/templates/slides/app/i18n/ko-KR.ts +4 -0
- package/corpus/templates/slides/app/i18n/pt-BR.ts +4 -0
- package/corpus/templates/slides/app/i18n/zh-CN.ts +4 -0
- package/corpus/templates/slides/app/i18n/zh-TW.ts +4 -0
- package/corpus/templates/slides/app/lib/image-drop-to-agent.ts +115 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +22 -13
- package/corpus/templates/slides/changelog/2026-07-08-dropping-an-image-onto-a-slide-and-sending-it-to-the-agent-w.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-08-undo-works-after-the-agent-edits-a-slide-so-you-can-reverse.md +6 -0
- package/corpus/templates/slides/package.json +2 -2
- package/corpus/templates/videos/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/corpus/templates/voice/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/dist/agent/production-agent.d.ts +5 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +112 -42
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +23 -2
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.js +2 -2
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/tool-search.d.ts +2 -0
- package/dist/agent/tool-search.d.ts.map +1 -1
- package/dist/agent/tool-search.js +60 -4
- package/dist/agent/tool-search.js.map +1 -1
- package/dist/catalog.json +2 -2
- package/dist/cli/add.js +1 -1
- package/dist/cli/add.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +8 -3
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +24 -4
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/upgrade.d.ts +100 -0
- package/dist/cli/upgrade.d.ts.map +1 -0
- package/dist/cli/upgrade.js +678 -0
- package/dist/cli/upgrade.js.map +1 -0
- package/dist/client/AssistantChat.js +1 -1
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/HighlightedCodeBlock.d.ts +2 -0
- package/dist/client/HighlightedCodeBlock.d.ts.map +1 -1
- package/dist/client/HighlightedCodeBlock.js +10 -1
- package/dist/client/HighlightedCodeBlock.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +32 -4
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +61 -8
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +12 -0
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +136 -42
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/code-agent-chat-adapter.js +2 -9
- package/dist/client/code-agent-chat-adapter.js.map +1 -1
- package/dist/client/extensions/ExtensionSlot.js +6 -0
- package/dist/client/extensions/ExtensionSlot.js.map +1 -1
- package/dist/client/settings/SettingsPanel.d.ts.map +1 -1
- package/dist/client/settings/SettingsPanel.js +52 -19
- package/dist/client/settings/SettingsPanel.js.map +1 -1
- package/dist/client/settings/SettingsSection.d.ts +19 -4
- package/dist/client/settings/SettingsSection.d.ts.map +1 -1
- package/dist/client/settings/SettingsSection.js +33 -4
- package/dist/client/settings/SettingsSection.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts +9 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +20 -2
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/extensions/actions.d.ts.map +1 -1
- package/dist/extensions/actions.js +85 -5
- package/dist/extensions/actions.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/jobs/scheduler.js +26 -1
- package/dist/jobs/scheduler.js.map +1 -1
- package/dist/localization/default-messages.d.ts +19 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +19 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/notifications/channels.d.ts +8 -3
- package/dist/notifications/channels.d.ts.map +1 -1
- package/dist/notifications/channels.js +61 -22
- package/dist/notifications/channels.js.map +1 -1
- package/dist/notifications/registry.d.ts.map +1 -1
- package/dist/notifications/registry.js +14 -3
- package/dist/notifications/registry.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/notifications/types.d.ts +4 -1
- package/dist/notifications/types.d.ts.map +1 -1
- package/dist/notifications/types.js.map +1 -1
- package/dist/observability/routes.d.ts +1 -1
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/resources/handlers.d.ts +3 -3
- package/dist/server/agent-chat-plugin.d.ts +5 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +2 -2
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/request-context.d.ts +7 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js.map +1 -1
- package/dist/styles/agent-conversation.css +1 -1
- package/dist/templates/default/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/dist/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/dist/templates/default/AGENTS.md +10 -3
- package/dist/templates/default/app/i18n/ar-SA.ts +21 -0
- package/dist/templates/default/app/i18n/de-DE.ts +21 -0
- package/dist/templates/default/app/i18n/en-US.ts +21 -0
- package/dist/templates/default/app/i18n/es-ES.ts +21 -0
- package/dist/templates/default/app/i18n/fr-FR.ts +21 -0
- package/dist/templates/default/app/i18n/hi-IN.ts +20 -0
- package/dist/templates/default/app/i18n/ja-JP.ts +21 -0
- package/dist/templates/default/app/i18n/ko-KR.ts +20 -0
- package/dist/templates/default/app/i18n/pt-BR.ts +21 -0
- package/dist/templates/default/app/i18n/zh-CN.ts +20 -0
- package/dist/templates/default/app/i18n/zh-TW.ts +19 -0
- package/dist/templates/default/package.json +4 -3
- package/dist/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/dist/templates/headless/AGENTS.md +9 -3
- package/dist/templates/headless/package.json +4 -3
- package/dist/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/dist/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/dist/templates/workspace-core/package.json +6 -6
- package/dist/templates/workspace-root/AGENTS.md +10 -4
- package/dist/templates/workspace-root/package.json +3 -2
- package/dist/triggers/dispatcher.js +27 -2
- package/dist/triggers/dispatcher.js.map +1 -1
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +70 -1
- package/dist/vite/client.js.map +1 -1
- package/docs/content/faq.mdx +17 -0
- package/docs/content/notifications.mdx +12 -6
- package/package.json +7 -6
- package/src/templates/default/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/src/templates/default/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/src/templates/default/AGENTS.md +10 -3
- package/src/templates/default/app/i18n/ar-SA.ts +21 -0
- package/src/templates/default/app/i18n/de-DE.ts +21 -0
- package/src/templates/default/app/i18n/en-US.ts +21 -0
- package/src/templates/default/app/i18n/es-ES.ts +21 -0
- package/src/templates/default/app/i18n/fr-FR.ts +21 -0
- package/src/templates/default/app/i18n/hi-IN.ts +20 -0
- package/src/templates/default/app/i18n/ja-JP.ts +21 -0
- package/src/templates/default/app/i18n/ko-KR.ts +20 -0
- package/src/templates/default/app/i18n/pt-BR.ts +21 -0
- package/src/templates/default/app/i18n/zh-CN.ts +20 -0
- package/src/templates/default/app/i18n/zh-TW.ts +19 -0
- package/src/templates/default/package.json +4 -3
- package/src/templates/headless/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/src/templates/headless/AGENTS.md +9 -3
- package/src/templates/headless/package.json +4 -3
- package/src/templates/workspace-core/.agents/skills/self-modifying-code/SKILL.md +20 -2
- package/src/templates/workspace-core/.agents/skills/upgrade-agent-native/SKILL.md +87 -0
- package/src/templates/workspace-core/package.json +6 -6
- package/src/templates/workspace-root/AGENTS.md +10 -4
- package/src/templates/workspace-root/package.json +3 -2
|
@@ -0,0 +1,678 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `agent-native upgrade` — bring an existing Agent Native app/workspace current.
|
|
3
|
+
*
|
|
4
|
+
* Older branches often break after a core bump. Agents then invent
|
|
5
|
+
* `pnpm.overrides` / patches against `@agent-native/*` (especially dispatch),
|
|
6
|
+
* which makes things worse. This command is the supported path:
|
|
7
|
+
*
|
|
8
|
+
* 1. Doctor: refuse or warn on framework overrides/patches
|
|
9
|
+
* 2. Bump `@agent-native/*` deps to `latest` (unless file:/link:/workspace:)
|
|
10
|
+
* 3. Install
|
|
11
|
+
* 4. Refresh scaffold skills (`skills update scaffold --project`)
|
|
12
|
+
* 5. Verify with typecheck when available
|
|
13
|
+
*
|
|
14
|
+
* On failure: print the error and stop. Do not patch framework packages.
|
|
15
|
+
*/
|
|
16
|
+
import { spawnSync } from "node:child_process";
|
|
17
|
+
import fs from "node:fs";
|
|
18
|
+
import path from "node:path";
|
|
19
|
+
import { fileURLToPath } from "node:url";
|
|
20
|
+
const AGENT_NATIVE_SCOPE = "@agent-native/";
|
|
21
|
+
const PINNABLE_VERSION = "latest";
|
|
22
|
+
const defaultIo = {
|
|
23
|
+
log: (message) => console.log(message),
|
|
24
|
+
err: (message) => console.error(message),
|
|
25
|
+
spawn: (command, args, options) => spawnSync(command, args, {
|
|
26
|
+
cwd: options.cwd,
|
|
27
|
+
stdio: options.stdio ?? "inherit",
|
|
28
|
+
encoding: "utf-8",
|
|
29
|
+
shell: process.platform === "win32",
|
|
30
|
+
}),
|
|
31
|
+
runSkillsUpdate: async (cwd) => {
|
|
32
|
+
const { runSkills } = await import("./skills.js");
|
|
33
|
+
const previous = process.cwd();
|
|
34
|
+
process.chdir(cwd);
|
|
35
|
+
try {
|
|
36
|
+
await runSkills(["update", "scaffold", "--project"]);
|
|
37
|
+
}
|
|
38
|
+
finally {
|
|
39
|
+
process.chdir(previous);
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
export function parseUpgradeArgs(argv) {
|
|
44
|
+
const opts = { command: "run" };
|
|
45
|
+
for (let i = 0; i < argv.length; i++) {
|
|
46
|
+
const arg = argv[i];
|
|
47
|
+
if (arg === "check" || arg === "doctor") {
|
|
48
|
+
opts.command = "check";
|
|
49
|
+
}
|
|
50
|
+
else if (arg === "help" || arg === "--help" || arg === "-h") {
|
|
51
|
+
opts.command = "help";
|
|
52
|
+
opts.help = true;
|
|
53
|
+
}
|
|
54
|
+
else if (arg === "--dry-run") {
|
|
55
|
+
opts.dryRun = true;
|
|
56
|
+
}
|
|
57
|
+
else if (arg === "--skip-install") {
|
|
58
|
+
opts.skipInstall = true;
|
|
59
|
+
}
|
|
60
|
+
else if (arg === "--skip-verify") {
|
|
61
|
+
opts.skipVerify = true;
|
|
62
|
+
}
|
|
63
|
+
else if (arg === "--skip-skills") {
|
|
64
|
+
opts.skipSkills = true;
|
|
65
|
+
}
|
|
66
|
+
else if (arg === "--json") {
|
|
67
|
+
opts.json = true;
|
|
68
|
+
}
|
|
69
|
+
else if (arg === "--force") {
|
|
70
|
+
opts.force = true;
|
|
71
|
+
}
|
|
72
|
+
else if (arg === "--cwd" && argv[i + 1]) {
|
|
73
|
+
opts.cwd = argv[++i];
|
|
74
|
+
}
|
|
75
|
+
else if (arg.startsWith("--cwd=")) {
|
|
76
|
+
opts.cwd = arg.slice("--cwd=".length);
|
|
77
|
+
}
|
|
78
|
+
else if (!arg.startsWith("-")) {
|
|
79
|
+
// Ignore unknown positional for forward-compat; help covers usage.
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return opts;
|
|
83
|
+
}
|
|
84
|
+
export function printUpgradeHelp(io = defaultIo) {
|
|
85
|
+
io.log([
|
|
86
|
+
"Usage:",
|
|
87
|
+
" agent-native upgrade Bring this app/workspace to current @agent-native/*",
|
|
88
|
+
" agent-native upgrade check Doctor only: overrides, patches, pending bumps",
|
|
89
|
+
" agent-native upgrade --dry-run Show the plan without writing or installing",
|
|
90
|
+
"",
|
|
91
|
+
"Options:",
|
|
92
|
+
" --skip-install Bump package.json only; do not run the package manager",
|
|
93
|
+
" --skip-skills Skip `skills update scaffold --project`",
|
|
94
|
+
" --skip-verify Skip typecheck after upgrade",
|
|
95
|
+
" --force Continue even when framework overrides/patches are present",
|
|
96
|
+
" --json Machine-readable report",
|
|
97
|
+
" --cwd <dir> Run against a project root other than the current directory",
|
|
98
|
+
"",
|
|
99
|
+
"On failure: report the error and stop. Do NOT add pnpm.overrides,",
|
|
100
|
+
"patchedDependencies, or local patches against @agent-native/* packages.",
|
|
101
|
+
"Do NOT edit node_modules/@agent-native/* or invent dispatch/core behavior",
|
|
102
|
+
"overrides. Revert those changes and re-run `agent-native upgrade`.",
|
|
103
|
+
].join("\n"));
|
|
104
|
+
}
|
|
105
|
+
function readJsonFile(filePath) {
|
|
106
|
+
try {
|
|
107
|
+
return JSON.parse(fs.readFileSync(filePath, "utf-8"));
|
|
108
|
+
}
|
|
109
|
+
catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function writeJsonFile(filePath, value) {
|
|
114
|
+
fs.writeFileSync(filePath, `${JSON.stringify(value, null, 2)}\n`);
|
|
115
|
+
}
|
|
116
|
+
export function isAgentNativePackageName(name) {
|
|
117
|
+
return name === "@agent-native" || name.startsWith(AGENT_NATIVE_SCOPE);
|
|
118
|
+
}
|
|
119
|
+
export function isPinnedOrLocalVersion(version) {
|
|
120
|
+
const v = version.trim();
|
|
121
|
+
return (v.startsWith("file:") ||
|
|
122
|
+
v.startsWith("link:") ||
|
|
123
|
+
v.startsWith("workspace:") ||
|
|
124
|
+
v.startsWith("portal:") ||
|
|
125
|
+
v.startsWith("git+") ||
|
|
126
|
+
v.startsWith("github:") ||
|
|
127
|
+
v.startsWith("http:") ||
|
|
128
|
+
v.startsWith("https:"));
|
|
129
|
+
}
|
|
130
|
+
export function shouldBumpAgentNativeVersion(version) {
|
|
131
|
+
if (isPinnedOrLocalVersion(version))
|
|
132
|
+
return false;
|
|
133
|
+
return version.trim() !== PINNABLE_VERSION;
|
|
134
|
+
}
|
|
135
|
+
function collectOverrideFindings(file, pkg) {
|
|
136
|
+
const findings = [];
|
|
137
|
+
const tables = [
|
|
138
|
+
{ field: "pnpm.overrides", map: pkg.pnpm?.overrides },
|
|
139
|
+
{ field: "pnpm.patchedDependencies", map: pkg.pnpm?.patchedDependencies },
|
|
140
|
+
{ field: "overrides", map: pkg.overrides },
|
|
141
|
+
{ field: "resolutions", map: pkg.resolutions },
|
|
142
|
+
];
|
|
143
|
+
for (const table of tables) {
|
|
144
|
+
if (!table.map)
|
|
145
|
+
continue;
|
|
146
|
+
for (const [key, value] of Object.entries(table.map)) {
|
|
147
|
+
// Keys may be bare (`@agent-native/core`) or versioned
|
|
148
|
+
// (`@agent-native/core@1.2.3` for patchedDependencies).
|
|
149
|
+
if (key.includes(AGENT_NATIVE_SCOPE) || isAgentNativePackageName(key)) {
|
|
150
|
+
findings.push({ file, field: table.field, key, value: String(value) });
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return findings;
|
|
155
|
+
}
|
|
156
|
+
function collectBumps(file, pkg) {
|
|
157
|
+
const bumps = [];
|
|
158
|
+
const sections = [
|
|
159
|
+
"dependencies",
|
|
160
|
+
"devDependencies",
|
|
161
|
+
"optionalDependencies",
|
|
162
|
+
];
|
|
163
|
+
for (const section of sections) {
|
|
164
|
+
const deps = pkg[section];
|
|
165
|
+
if (!deps)
|
|
166
|
+
continue;
|
|
167
|
+
for (const [name, version] of Object.entries(deps)) {
|
|
168
|
+
if (!isAgentNativePackageName(name))
|
|
169
|
+
continue;
|
|
170
|
+
if (!shouldBumpAgentNativeVersion(version))
|
|
171
|
+
continue;
|
|
172
|
+
bumps.push({
|
|
173
|
+
file,
|
|
174
|
+
section,
|
|
175
|
+
name,
|
|
176
|
+
from: version,
|
|
177
|
+
to: PINNABLE_VERSION,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return bumps;
|
|
182
|
+
}
|
|
183
|
+
function applyBumps(pkg, bumps) {
|
|
184
|
+
for (const bump of bumps) {
|
|
185
|
+
const section = pkg[bump.section];
|
|
186
|
+
if (!section)
|
|
187
|
+
continue;
|
|
188
|
+
if (section[bump.name] === bump.from) {
|
|
189
|
+
section[bump.name] = bump.to;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
export function detectUpgradeProject(cwd) {
|
|
194
|
+
const start = path.resolve(cwd);
|
|
195
|
+
let dir = start;
|
|
196
|
+
while (true) {
|
|
197
|
+
const pkgPath = path.join(dir, "package.json");
|
|
198
|
+
if (fs.existsSync(pkgPath)) {
|
|
199
|
+
const pkg = readJsonFile(pkgPath);
|
|
200
|
+
const hasCore = Boolean(pkg?.dependencies?.["@agent-native/core"]) ||
|
|
201
|
+
Boolean(pkg?.devDependencies?.["@agent-native/core"]);
|
|
202
|
+
const workspaceYaml = path.join(dir, "pnpm-workspace.yaml");
|
|
203
|
+
const isWorkspace = fs.existsSync(workspaceYaml);
|
|
204
|
+
if (hasCore || isWorkspace) {
|
|
205
|
+
const packageFiles = [pkgPath];
|
|
206
|
+
if (isWorkspace) {
|
|
207
|
+
packageFiles.push(...workspacePackageFiles(dir, workspaceYaml));
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
root: dir,
|
|
211
|
+
kind: isWorkspace ? "workspace" : "standalone",
|
|
212
|
+
packageFiles: Array.from(new Set(packageFiles)),
|
|
213
|
+
};
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
const parent = path.dirname(dir);
|
|
217
|
+
if (parent === dir)
|
|
218
|
+
break;
|
|
219
|
+
dir = parent;
|
|
220
|
+
}
|
|
221
|
+
return null;
|
|
222
|
+
}
|
|
223
|
+
function workspacePackageFiles(root, workspaceYaml) {
|
|
224
|
+
const patterns = parseWorkspacePackagePatterns(workspaceYaml);
|
|
225
|
+
const included = new Set();
|
|
226
|
+
const excluded = new Set();
|
|
227
|
+
for (const rawPattern of patterns) {
|
|
228
|
+
const exclude = rawPattern.startsWith("!");
|
|
229
|
+
const pattern = exclude ? rawPattern.slice(1) : rawPattern;
|
|
230
|
+
const files = packageFilesForWorkspacePattern(root, pattern);
|
|
231
|
+
for (const file of files) {
|
|
232
|
+
if (exclude)
|
|
233
|
+
excluded.add(file);
|
|
234
|
+
else
|
|
235
|
+
included.add(file);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
return Array.from(included)
|
|
239
|
+
.filter((file) => !excluded.has(file))
|
|
240
|
+
.sort();
|
|
241
|
+
}
|
|
242
|
+
function parseWorkspacePackagePatterns(workspaceYaml) {
|
|
243
|
+
let text = "";
|
|
244
|
+
try {
|
|
245
|
+
text = fs.readFileSync(workspaceYaml, "utf-8");
|
|
246
|
+
}
|
|
247
|
+
catch {
|
|
248
|
+
return ["apps/*", "packages/*"];
|
|
249
|
+
}
|
|
250
|
+
const patterns = [];
|
|
251
|
+
let inPackages = false;
|
|
252
|
+
for (const line of text.split(/\r?\n/)) {
|
|
253
|
+
const trimmed = line.trim();
|
|
254
|
+
if (!trimmed || trimmed.startsWith("#"))
|
|
255
|
+
continue;
|
|
256
|
+
if (/^[A-Za-z0-9_-]+:/.test(trimmed)) {
|
|
257
|
+
inPackages = trimmed === "packages:";
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
if (!inPackages || !trimmed.startsWith("-"))
|
|
261
|
+
continue;
|
|
262
|
+
const pattern = trimmed
|
|
263
|
+
.slice(1)
|
|
264
|
+
.trim()
|
|
265
|
+
.replace(/^['"]|['"]$/g, "");
|
|
266
|
+
if (pattern)
|
|
267
|
+
patterns.push(pattern);
|
|
268
|
+
}
|
|
269
|
+
return patterns.length ? patterns : ["apps/*", "packages/*"];
|
|
270
|
+
}
|
|
271
|
+
function packageFilesForWorkspacePattern(root, pattern) {
|
|
272
|
+
const normalized = pattern.replace(/\\/g, "/").replace(/\/+$/g, "");
|
|
273
|
+
if (!normalized || normalized.includes("node_modules"))
|
|
274
|
+
return [];
|
|
275
|
+
if (normalized.endsWith("/**")) {
|
|
276
|
+
return collectPackageFilesRecursive(path.join(root, normalized.slice(0, -3)));
|
|
277
|
+
}
|
|
278
|
+
if (normalized.endsWith("/*")) {
|
|
279
|
+
const base = path.join(root, normalized.slice(0, -2));
|
|
280
|
+
if (!fs.existsSync(base))
|
|
281
|
+
return [];
|
|
282
|
+
return fs
|
|
283
|
+
.readdirSync(base, { withFileTypes: true })
|
|
284
|
+
.filter((entry) => entry.isDirectory())
|
|
285
|
+
.map((entry) => path.join(base, entry.name, "package.json"))
|
|
286
|
+
.filter((file) => fs.existsSync(file));
|
|
287
|
+
}
|
|
288
|
+
if (normalized.includes("*")) {
|
|
289
|
+
return collectPackageFilesRecursive(path.join(root, normalized.split("*")[0]));
|
|
290
|
+
}
|
|
291
|
+
const file = path.join(root, normalized, "package.json");
|
|
292
|
+
return fs.existsSync(file) ? [file] : [];
|
|
293
|
+
}
|
|
294
|
+
function collectPackageFilesRecursive(dir) {
|
|
295
|
+
if (!fs.existsSync(dir))
|
|
296
|
+
return [];
|
|
297
|
+
const files = [];
|
|
298
|
+
for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
299
|
+
if (!entry.isDirectory())
|
|
300
|
+
continue;
|
|
301
|
+
if (entry.name === "node_modules" || entry.name === ".git")
|
|
302
|
+
continue;
|
|
303
|
+
const child = path.join(dir, entry.name);
|
|
304
|
+
const pkg = path.join(child, "package.json");
|
|
305
|
+
if (fs.existsSync(pkg))
|
|
306
|
+
files.push(pkg);
|
|
307
|
+
files.push(...collectPackageFilesRecursive(child));
|
|
308
|
+
}
|
|
309
|
+
return files;
|
|
310
|
+
}
|
|
311
|
+
function resolveInstalledPackageVersion(projectRoot, packageName) {
|
|
312
|
+
let dir = projectRoot;
|
|
313
|
+
while (true) {
|
|
314
|
+
const candidate = path.join(dir, "node_modules", ...packageName.split("/"), "package.json");
|
|
315
|
+
if (fs.existsSync(candidate)) {
|
|
316
|
+
const pkg = readJsonFile(candidate);
|
|
317
|
+
return typeof pkg?.version === "string" ? pkg.version : null;
|
|
318
|
+
}
|
|
319
|
+
const parent = path.dirname(dir);
|
|
320
|
+
if (parent === dir)
|
|
321
|
+
break;
|
|
322
|
+
dir = parent;
|
|
323
|
+
}
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
function readCliCoreVersion() {
|
|
327
|
+
try {
|
|
328
|
+
const here = path.dirname(fileURLToPath(import.meta.url));
|
|
329
|
+
const pkgPath = path.resolve(here, "../../package.json");
|
|
330
|
+
const pkg = readJsonFile(pkgPath);
|
|
331
|
+
return typeof pkg?.version === "string" ? pkg.version : null;
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
return null;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
function detectPackageManager(projectRoot) {
|
|
338
|
+
if (fs.existsSync(path.join(projectRoot, "pnpm-lock.yaml")))
|
|
339
|
+
return "pnpm";
|
|
340
|
+
if (fs.existsSync(path.join(projectRoot, "yarn.lock")))
|
|
341
|
+
return "yarn";
|
|
342
|
+
if (fs.existsSync(path.join(projectRoot, "package-lock.json")))
|
|
343
|
+
return "npm";
|
|
344
|
+
// Prefer pnpm for Agent Native scaffolds.
|
|
345
|
+
return "pnpm";
|
|
346
|
+
}
|
|
347
|
+
function installArgs(pm) {
|
|
348
|
+
if (pm === "npm")
|
|
349
|
+
return ["install"];
|
|
350
|
+
if (pm === "yarn")
|
|
351
|
+
return ["install"];
|
|
352
|
+
return ["install"];
|
|
353
|
+
}
|
|
354
|
+
export function buildUpgradeDoctorReport(project) {
|
|
355
|
+
const findings = [];
|
|
356
|
+
const bumps = [];
|
|
357
|
+
for (const file of project.packageFiles) {
|
|
358
|
+
const pkg = readJsonFile(file);
|
|
359
|
+
if (!pkg)
|
|
360
|
+
continue;
|
|
361
|
+
findings.push(...collectOverrideFindings(file, pkg));
|
|
362
|
+
bumps.push(...collectBumps(file, pkg));
|
|
363
|
+
}
|
|
364
|
+
const installedCoreVersion = resolveInstalledPackageVersion(project.root, "@agent-native/core");
|
|
365
|
+
const cliCoreVersion = readCliCoreVersion();
|
|
366
|
+
const skillsUpdateScript = project.packageFiles.some((file) => {
|
|
367
|
+
const pkg = readJsonFile(file);
|
|
368
|
+
return Boolean(pkg?.scripts?.["skills:update"]);
|
|
369
|
+
});
|
|
370
|
+
return {
|
|
371
|
+
project,
|
|
372
|
+
findings,
|
|
373
|
+
bumps,
|
|
374
|
+
installedCoreVersion,
|
|
375
|
+
cliCoreVersion,
|
|
376
|
+
scaffoldStaleHint: skillsUpdateScript || bumps.length > 0,
|
|
377
|
+
};
|
|
378
|
+
}
|
|
379
|
+
function relativeTo(root, file) {
|
|
380
|
+
const rel = path.relative(root, file);
|
|
381
|
+
return rel || ".";
|
|
382
|
+
}
|
|
383
|
+
function formatDoctorHuman(report) {
|
|
384
|
+
const lines = [];
|
|
385
|
+
lines.push(`Project: ${report.project.root} (${report.project.kind})`);
|
|
386
|
+
if (report.installedCoreVersion) {
|
|
387
|
+
lines.push(`Installed @agent-native/core: ${report.installedCoreVersion}`);
|
|
388
|
+
}
|
|
389
|
+
else {
|
|
390
|
+
lines.push("Installed @agent-native/core: (not found in node_modules)");
|
|
391
|
+
}
|
|
392
|
+
if (report.cliCoreVersion) {
|
|
393
|
+
lines.push(`CLI package version: ${report.cliCoreVersion}`);
|
|
394
|
+
}
|
|
395
|
+
if (report.findings.length === 0) {
|
|
396
|
+
lines.push("Framework overrides/patches: none");
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
lines.push("Framework overrides/patches:");
|
|
400
|
+
for (const finding of report.findings) {
|
|
401
|
+
lines.push(` - ${relativeTo(report.project.root, finding.file)} ${finding.field}["${finding.key}"] = ${finding.value}`);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
404
|
+
if (report.bumps.length === 0) {
|
|
405
|
+
lines.push("Pending @agent-native/* bumps: none");
|
|
406
|
+
}
|
|
407
|
+
else {
|
|
408
|
+
lines.push("Pending @agent-native/* bumps:");
|
|
409
|
+
for (const bump of report.bumps) {
|
|
410
|
+
lines.push(` - ${relativeTo(report.project.root, bump.file)} ${bump.name}: ${bump.from} → ${bump.to}`);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return lines.join("\n");
|
|
414
|
+
}
|
|
415
|
+
const FAILURE_GUIDANCE = [
|
|
416
|
+
"Upgrade failed. Do not paper over this with framework patches.",
|
|
417
|
+
"Never add pnpm.overrides / patchedDependencies / resolutions for @agent-native/*.",
|
|
418
|
+
"Never edit node_modules/@agent-native/* or invent local dispatch/core behavior overrides.",
|
|
419
|
+
"Revert those changes if present, fix the app-level compile/runtime error, then re-run:",
|
|
420
|
+
" npx @agent-native/core@latest upgrade",
|
|
421
|
+
].join("\n");
|
|
422
|
+
export async function runUpgrade(argv, io = defaultIo) {
|
|
423
|
+
const opts = parseUpgradeArgs(argv);
|
|
424
|
+
if (opts.help || opts.command === "help") {
|
|
425
|
+
printUpgradeHelp(io);
|
|
426
|
+
return 0;
|
|
427
|
+
}
|
|
428
|
+
const cwd = path.resolve(opts.cwd ?? process.cwd());
|
|
429
|
+
const project = detectUpgradeProject(cwd);
|
|
430
|
+
if (!project) {
|
|
431
|
+
const message = "No Agent Native app/workspace found. Run from an app or workspace root that depends on @agent-native/core.";
|
|
432
|
+
if (opts.json) {
|
|
433
|
+
io.err(JSON.stringify({ ok: false, message }, null, 2));
|
|
434
|
+
}
|
|
435
|
+
else {
|
|
436
|
+
io.err(message);
|
|
437
|
+
}
|
|
438
|
+
return 1;
|
|
439
|
+
}
|
|
440
|
+
const doctor = buildUpgradeDoctorReport(project);
|
|
441
|
+
if (opts.command === "check") {
|
|
442
|
+
if (opts.json) {
|
|
443
|
+
io.log(JSON.stringify({ ok: doctor.findings.length === 0, doctor }, null, 2));
|
|
444
|
+
}
|
|
445
|
+
else {
|
|
446
|
+
io.log(formatDoctorHuman(doctor));
|
|
447
|
+
if (doctor.findings.length > 0) {
|
|
448
|
+
io.err("");
|
|
449
|
+
io.err(FAILURE_GUIDANCE);
|
|
450
|
+
}
|
|
451
|
+
}
|
|
452
|
+
return doctor.findings.length > 0 ? 1 : 0;
|
|
453
|
+
}
|
|
454
|
+
const result = {
|
|
455
|
+
ok: true,
|
|
456
|
+
dryRun: Boolean(opts.dryRun),
|
|
457
|
+
doctor,
|
|
458
|
+
steps: [],
|
|
459
|
+
message: "",
|
|
460
|
+
exitCode: 0,
|
|
461
|
+
};
|
|
462
|
+
if (doctor.findings.length > 0 && !opts.force) {
|
|
463
|
+
result.ok = false;
|
|
464
|
+
result.exitCode = 1;
|
|
465
|
+
result.message =
|
|
466
|
+
"Blocked: framework overrides/patches for @agent-native/* are present. Remove them, then re-run upgrade (or pass --force to continue unsafely).";
|
|
467
|
+
result.steps.push({
|
|
468
|
+
id: "doctor",
|
|
469
|
+
status: "failed",
|
|
470
|
+
detail: result.message,
|
|
471
|
+
});
|
|
472
|
+
if (opts.json) {
|
|
473
|
+
io.err(JSON.stringify(result, null, 2));
|
|
474
|
+
}
|
|
475
|
+
else {
|
|
476
|
+
io.log(formatDoctorHuman(doctor));
|
|
477
|
+
io.err("");
|
|
478
|
+
io.err(result.message);
|
|
479
|
+
io.err("");
|
|
480
|
+
io.err(FAILURE_GUIDANCE);
|
|
481
|
+
}
|
|
482
|
+
return 1;
|
|
483
|
+
}
|
|
484
|
+
result.steps.push({
|
|
485
|
+
id: "doctor",
|
|
486
|
+
status: doctor.findings.length > 0 ? "ok" : "ok",
|
|
487
|
+
detail: doctor.findings.length > 0
|
|
488
|
+
? "Continuing with --force despite framework overrides/patches"
|
|
489
|
+
: "No framework overrides/patches",
|
|
490
|
+
});
|
|
491
|
+
// Apply package.json bumps.
|
|
492
|
+
if (doctor.bumps.length === 0) {
|
|
493
|
+
result.steps.push({
|
|
494
|
+
id: "bump",
|
|
495
|
+
status: "skipped",
|
|
496
|
+
detail: "All @agent-native/* deps already use latest or local pins",
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
else if (opts.dryRun) {
|
|
500
|
+
result.steps.push({
|
|
501
|
+
id: "bump",
|
|
502
|
+
status: "planned",
|
|
503
|
+
detail: doctor.bumps
|
|
504
|
+
.map((b) => `${relativeTo(project.root, b.file)} ${b.name}: ${b.from} → ${b.to}`)
|
|
505
|
+
.join("; "),
|
|
506
|
+
});
|
|
507
|
+
}
|
|
508
|
+
else {
|
|
509
|
+
const byFile = new Map();
|
|
510
|
+
for (const bump of doctor.bumps) {
|
|
511
|
+
const list = byFile.get(bump.file) ?? [];
|
|
512
|
+
list.push(bump);
|
|
513
|
+
byFile.set(bump.file, list);
|
|
514
|
+
}
|
|
515
|
+
for (const [file, bumps] of byFile) {
|
|
516
|
+
const pkg = readJsonFile(file);
|
|
517
|
+
if (!pkg)
|
|
518
|
+
continue;
|
|
519
|
+
applyBumps(pkg, bumps);
|
|
520
|
+
writeJsonFile(file, pkg);
|
|
521
|
+
}
|
|
522
|
+
result.steps.push({
|
|
523
|
+
id: "bump",
|
|
524
|
+
status: "ok",
|
|
525
|
+
detail: `Updated ${doctor.bumps.length} @agent-native/* dependency pin(s)`,
|
|
526
|
+
});
|
|
527
|
+
}
|
|
528
|
+
// Install.
|
|
529
|
+
if (opts.skipInstall) {
|
|
530
|
+
result.steps.push({
|
|
531
|
+
id: "install",
|
|
532
|
+
status: "skipped",
|
|
533
|
+
detail: "--skip-install",
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
else if (opts.dryRun) {
|
|
537
|
+
result.steps.push({
|
|
538
|
+
id: "install",
|
|
539
|
+
status: "planned",
|
|
540
|
+
detail: `${detectPackageManager(project.root)} install`,
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
else {
|
|
544
|
+
const pm = detectPackageManager(project.root);
|
|
545
|
+
const spawned = io.spawn(pm, installArgs(pm), {
|
|
546
|
+
cwd: project.root,
|
|
547
|
+
stdio: opts.json ? "pipe" : "inherit",
|
|
548
|
+
});
|
|
549
|
+
if (spawned.status !== 0) {
|
|
550
|
+
result.ok = false;
|
|
551
|
+
result.exitCode = spawned.status ?? 1;
|
|
552
|
+
result.message = `${pm} install failed`;
|
|
553
|
+
result.steps.push({
|
|
554
|
+
id: "install",
|
|
555
|
+
status: "failed",
|
|
556
|
+
detail: result.message,
|
|
557
|
+
});
|
|
558
|
+
emitResult(io, opts, result);
|
|
559
|
+
return result.exitCode;
|
|
560
|
+
}
|
|
561
|
+
result.steps.push({ id: "install", status: "ok", detail: `${pm} install` });
|
|
562
|
+
}
|
|
563
|
+
// Skills refresh.
|
|
564
|
+
if (opts.skipSkills) {
|
|
565
|
+
result.steps.push({
|
|
566
|
+
id: "skills",
|
|
567
|
+
status: "skipped",
|
|
568
|
+
detail: "--skip-skills",
|
|
569
|
+
});
|
|
570
|
+
}
|
|
571
|
+
else if (opts.dryRun) {
|
|
572
|
+
result.steps.push({
|
|
573
|
+
id: "skills",
|
|
574
|
+
status: "planned",
|
|
575
|
+
detail: "skills update scaffold --project",
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
else {
|
|
579
|
+
try {
|
|
580
|
+
await io.runSkillsUpdate(project.root);
|
|
581
|
+
result.steps.push({
|
|
582
|
+
id: "skills",
|
|
583
|
+
status: "ok",
|
|
584
|
+
detail: "skills update scaffold --project",
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
catch (err) {
|
|
588
|
+
result.ok = false;
|
|
589
|
+
result.exitCode = 1;
|
|
590
|
+
result.message = `skills update failed: ${err instanceof Error ? err.message : String(err)}`;
|
|
591
|
+
result.steps.push({
|
|
592
|
+
id: "skills",
|
|
593
|
+
status: "failed",
|
|
594
|
+
detail: result.message,
|
|
595
|
+
});
|
|
596
|
+
emitResult(io, opts, result);
|
|
597
|
+
return result.exitCode;
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
// Verify.
|
|
601
|
+
if (opts.skipVerify) {
|
|
602
|
+
result.steps.push({
|
|
603
|
+
id: "verify",
|
|
604
|
+
status: "skipped",
|
|
605
|
+
detail: "--skip-verify",
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
else if (opts.dryRun) {
|
|
609
|
+
result.steps.push({
|
|
610
|
+
id: "verify",
|
|
611
|
+
status: "planned",
|
|
612
|
+
detail: "typecheck (when available)",
|
|
613
|
+
});
|
|
614
|
+
}
|
|
615
|
+
else {
|
|
616
|
+
const rootPkg = readJsonFile(path.join(project.root, "package.json"));
|
|
617
|
+
const hasTypecheck = Boolean(rootPkg?.scripts?.typecheck);
|
|
618
|
+
if (!hasTypecheck) {
|
|
619
|
+
result.steps.push({
|
|
620
|
+
id: "verify",
|
|
621
|
+
status: "skipped",
|
|
622
|
+
detail: "no typecheck script",
|
|
623
|
+
});
|
|
624
|
+
}
|
|
625
|
+
else {
|
|
626
|
+
const pm = detectPackageManager(project.root);
|
|
627
|
+
const args = pm === "npm"
|
|
628
|
+
? ["run", "typecheck"]
|
|
629
|
+
: pm === "yarn"
|
|
630
|
+
? ["typecheck"]
|
|
631
|
+
: ["typecheck"];
|
|
632
|
+
const spawned = io.spawn(pm, args, {
|
|
633
|
+
cwd: project.root,
|
|
634
|
+
stdio: opts.json ? "pipe" : "inherit",
|
|
635
|
+
});
|
|
636
|
+
if (spawned.status !== 0) {
|
|
637
|
+
result.ok = false;
|
|
638
|
+
result.exitCode = spawned.status ?? 1;
|
|
639
|
+
result.message = "typecheck failed";
|
|
640
|
+
result.steps.push({
|
|
641
|
+
id: "verify",
|
|
642
|
+
status: "failed",
|
|
643
|
+
detail: result.message,
|
|
644
|
+
});
|
|
645
|
+
emitResult(io, opts, result);
|
|
646
|
+
return result.exitCode;
|
|
647
|
+
}
|
|
648
|
+
result.steps.push({ id: "verify", status: "ok", detail: "typecheck" });
|
|
649
|
+
}
|
|
650
|
+
}
|
|
651
|
+
result.message = opts.dryRun
|
|
652
|
+
? "Dry run complete. Re-run without --dry-run to apply."
|
|
653
|
+
: "Upgrade complete. If the app still fails to run, fix app-level code — do not patch @agent-native/*.";
|
|
654
|
+
emitResult(io, opts, result);
|
|
655
|
+
return 0;
|
|
656
|
+
}
|
|
657
|
+
function emitResult(io, opts, result) {
|
|
658
|
+
if (opts.json) {
|
|
659
|
+
const sink = result.ok ? io.log : io.err;
|
|
660
|
+
sink(JSON.stringify(result, null, 2));
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
io.log(formatDoctorHuman(result.doctor));
|
|
664
|
+
io.log("");
|
|
665
|
+
for (const step of result.steps) {
|
|
666
|
+
io.log(`[${step.status}] ${step.id}${step.detail ? ` — ${step.detail}` : ""}`);
|
|
667
|
+
}
|
|
668
|
+
io.log("");
|
|
669
|
+
if (result.ok) {
|
|
670
|
+
io.log(result.message);
|
|
671
|
+
}
|
|
672
|
+
else {
|
|
673
|
+
io.err(result.message);
|
|
674
|
+
io.err("");
|
|
675
|
+
io.err(FAILURE_GUIDANCE);
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
//# sourceMappingURL=upgrade.js.map
|