@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
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { parseMcpToolName } from "../mcp-client/manager.js";
|
|
2
2
|
import { isMcpToolAllowedForRequest } from "../mcp-client/visibility.js";
|
|
3
|
+
import { getRequestRunContext } from "../server/request-context.js";
|
|
3
4
|
export const TOOL_SEARCH_ACTION_NAME = "tool-search";
|
|
4
5
|
const DEFAULT_LIMIT = 8;
|
|
5
6
|
const MAX_LIMIT = 25;
|
|
6
7
|
export function createToolSearchEntry(getRegistry, options = {}) {
|
|
7
8
|
return {
|
|
8
9
|
tool: {
|
|
9
|
-
description: "Discover callable tools/actions, including connected MCP server tools named `mcp__<server>__<tool>`. Call it with NO query to list every available tool by name with a one-line description (cheap — no input schemas)
|
|
10
|
+
description: "Discover callable tools/actions, including connected MCP server tools named `mcp__<server>__<tool>`. Call it with NO query to list every available tool by name with a one-line description (cheap — no input schemas); names from that menu are not loaded for calling yet, so call tool-search again with a specific query for the tool/capability before invoking it. Use this whenever you need a capability but aren't sure which tool to call — most tools are not loaded into context up front, so this is how you find and then call them.",
|
|
10
11
|
parameters: {
|
|
11
12
|
type: "object",
|
|
12
13
|
properties: {
|
|
13
14
|
query: {
|
|
14
15
|
type: "string",
|
|
15
|
-
description: "What capability to find, e.g. `send slack message`, `create calendar event`, `zapier gmail`, or `browser screenshot`. Omit to list every available tool name (the full menu) with one-line descriptions.",
|
|
16
|
+
description: "What capability to find, e.g. `send slack message`, `create calendar event`, `zapier gmail`, or `browser screenshot`. Omit to list every available tool name (the full menu) with one-line descriptions; then call tool-search again with a specific query before calling a tool from that menu.",
|
|
16
17
|
},
|
|
17
18
|
limit: {
|
|
18
19
|
type: "number",
|
|
@@ -44,12 +45,39 @@ export function searchToolRegistry(registry, args = {}, options = {}) {
|
|
|
44
45
|
const listAll = query.length === 0;
|
|
45
46
|
const includeSchemas = !listAll && parseBoolean(args.includeSchemas);
|
|
46
47
|
const limit = parseLimit(args.limit, options.defaultLimit ?? DEFAULT_LIMIT, options.maxLimit ?? MAX_LIMIT);
|
|
48
|
+
const cacheKey = normalizeToolSearchCacheKey({
|
|
49
|
+
query,
|
|
50
|
+
limit,
|
|
51
|
+
includeSchemas,
|
|
52
|
+
});
|
|
53
|
+
const runCtx = getRequestRunContext();
|
|
54
|
+
const priorSearch = includeSchemas
|
|
55
|
+
? undefined
|
|
56
|
+
: runCtx?.toolSearchReads?.[cacheKey];
|
|
57
|
+
if (priorSearch) {
|
|
58
|
+
return {
|
|
59
|
+
query,
|
|
60
|
+
totalTools: priorSearch.totalTools,
|
|
61
|
+
count: priorSearch.resultNames.length,
|
|
62
|
+
repeated: true,
|
|
63
|
+
message: "This exact tool-search query already ran in this agent run. Use the previously returned schemas/details instead of searching again.",
|
|
64
|
+
results: priorSearch.resultNames.map((name) => ({
|
|
65
|
+
name,
|
|
66
|
+
kind: parseMcpToolName(name) ? "mcp" : "action",
|
|
67
|
+
score: 0,
|
|
68
|
+
description: "Already returned by an earlier identical tool-search call.",
|
|
69
|
+
parameters: [],
|
|
70
|
+
})),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
47
73
|
const queryTokens = tokenize(query);
|
|
48
74
|
const candidates = [];
|
|
49
75
|
let totalTools = 0;
|
|
50
76
|
for (const [name, entry] of Object.entries(registry)) {
|
|
51
77
|
if (!entry?.tool || name === TOOL_SEARCH_ACTION_NAME)
|
|
52
78
|
continue;
|
|
79
|
+
if (entry.agentTool === false)
|
|
80
|
+
continue;
|
|
53
81
|
if (name.startsWith("mcp__") && !isMcpToolAllowedForRequest(name)) {
|
|
54
82
|
continue;
|
|
55
83
|
}
|
|
@@ -93,19 +121,47 @@ export function searchToolRegistry(registry, args = {}, options = {}) {
|
|
|
93
121
|
}
|
|
94
122
|
if (listAll) {
|
|
95
123
|
candidates.sort((a, b) => a.name.localeCompare(b.name));
|
|
96
|
-
|
|
124
|
+
const result = {
|
|
125
|
+
query,
|
|
126
|
+
totalTools,
|
|
127
|
+
count: candidates.length,
|
|
128
|
+
message: 'Menu mode lists tool names only; it does not load schemas for calling. Before invoking a tool found here, call tool-search again with a specific query such as the tool name or capability (for example, { "query": "hubspot-deals" }).',
|
|
129
|
+
results: candidates,
|
|
130
|
+
};
|
|
131
|
+
rememberToolSearchResult(cacheKey, result);
|
|
132
|
+
return result;
|
|
97
133
|
}
|
|
98
134
|
candidates.sort((a, b) => {
|
|
99
135
|
if (b.score !== a.score)
|
|
100
136
|
return b.score - a.score;
|
|
101
137
|
return a.name.localeCompare(b.name);
|
|
102
138
|
});
|
|
103
|
-
|
|
139
|
+
const result = {
|
|
104
140
|
query,
|
|
105
141
|
totalTools,
|
|
106
142
|
count: Math.min(candidates.length, limit),
|
|
107
143
|
results: candidates.slice(0, limit),
|
|
108
144
|
};
|
|
145
|
+
if (!includeSchemas)
|
|
146
|
+
rememberToolSearchResult(cacheKey, result);
|
|
147
|
+
return result;
|
|
148
|
+
}
|
|
149
|
+
function normalizeToolSearchCacheKey(options) {
|
|
150
|
+
return JSON.stringify({
|
|
151
|
+
query: options.query.trim().toLowerCase(),
|
|
152
|
+
limit: options.limit,
|
|
153
|
+
includeSchemas: options.includeSchemas,
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
function rememberToolSearchResult(cacheKey, result) {
|
|
157
|
+
const runCtx = getRequestRunContext();
|
|
158
|
+
if (!runCtx)
|
|
159
|
+
return;
|
|
160
|
+
const reads = (runCtx.toolSearchReads ??= {});
|
|
161
|
+
reads[cacheKey] = {
|
|
162
|
+
totalTools: result.totalTools,
|
|
163
|
+
resultNames: result.results.map((item) => item.name),
|
|
164
|
+
};
|
|
109
165
|
}
|
|
110
166
|
function truncate(value, max) {
|
|
111
167
|
if (value.length <= max)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tool-search.js","sourceRoot":"","sources":["../../src/agent/tool-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AAGzE,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;AA+BrD,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,MAAM,UAAU,qBAAqB,CACnC,WAA8C,EAC9C,OAAO,GAAsB,EAAE;IAE/B,OAAO;QACL,IAAI,EAAE;YACJ,WAAW,EACT,wfAAwf;YAC1f,UAAU,EAAE;gBACV,IAAI,EAAE,QAAQ;gBACd,UAAU,EAAE;oBACV,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EACT,0MAA0M;qBAC7M;oBACD,KAAK,EAAE;wBACL,IAAI,EAAE,QAAQ;wBACd,WAAW,EAAE,sDAAsD,OAAO,CAAC,YAAY,IAAI,aAAa,kDAAkD;qBAC3J;oBACD,cAAc,EAAE;wBACd,IAAI,EAAE,SAAS;wBACf,WAAW,EACT,2EAA2E;qBAC9E;iBACF;aACF;SACF;QACD,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,IAAI;QACd,GAAG,EAAE,KAAK,EAAE,IAA4B,EAAE,EAAE,CAC1C,kBAAkB,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,OAAO,CAAC;KACnD,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,gBAAgB,CAC9B,QAAqC,EACrC,OAAO,GAAsB,EAAE;IAE/B,QAAQ,CAAC,uBAAuB,CAAC,GAAG,qBAAqB,CACvD,GAAG,EAAE,CAAC,QAAQ,EACd,OAAO,CACR,CAAC;IACF,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED,MAAM,UAAU,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AC,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,KAAK,IAAI,CAAC,CAAC;iBAC7C,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAAE,KAAK,IAAI,CAAC,CAAC;QAC9C,CAAC;QAED,IAAI,WAAW,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,KAAK,IAAI,CAAC,CAAC;QAC5C,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,KAAK,IAAI,CAAC,CAAC;QACvC,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC;YAAE,KAAK,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,KAAK,MAAM,KAAK,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACrD,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC;YAAE,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IACxC,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,SAAS,cAAc,CAAC,KAAa;IACnC,OAAO,KAAK;SACT,OAAO,CAAC,oBAAoB,EAAE,OAAO,CAAC;SACtC,WAAW,EAAE;SACb,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC;SAC3B,IAAI,EAAE,CAAC;AACZ,CAAC;AAED,SAAS,mBAAmB,CAAC,KAAa;IACxC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC;AAC3C,CAAC","sourcesContent":["import { parseMcpToolName } from \"../mcp-client/manager.js\";\nimport { isMcpToolAllowedForRequest } from \"../mcp-client/visibility.js\";\nimport type { ActionEntry } from \"./production-agent.js\";\n\nexport const TOOL_SEARCH_ACTION_NAME = \"tool-search\";\n\ntype ToolSearchArgs = {\n query?: unknown;\n limit?: unknown;\n includeSchemas?: unknown;\n};\n\ntype ToolParameterSummary = {\n name: string;\n type?: string;\n required: boolean;\n description?: string;\n enum?: string[];\n};\n\ntype ToolSearchResult = {\n name: string;\n kind: \"action\" | \"mcp\";\n source?: string;\n description: string;\n score: number;\n parameters: ToolParameterSummary[];\n inputSchema?: unknown;\n};\n\ntype ToolSearchOptions = {\n defaultLimit?: number;\n maxLimit?: number;\n};\n\nconst DEFAULT_LIMIT = 8;\nconst MAX_LIMIT = 25;\n\nexport function createToolSearchEntry(\n getRegistry: () => Record<string, ActionEntry>,\n options: ToolSearchOptions = {},\n): ActionEntry {\n return {\n tool: {\n description:\n \"Discover callable tools/actions, including connected MCP server tools named `mcp__<server>__<tool>`. Call it with NO query to list every available tool by name with a one-line description (cheap — no input schemas) so you can see the full menu of what exists; pass a `query` to find specific tools and get their parameter summaries. Use this whenever you need a capability but aren't sure which tool to call — most tools are not loaded into context up front, so this is how you find and then call them.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"What capability to find, e.g. `send slack message`, `create calendar event`, `zapier gmail`, or `browser screenshot`. Omit to list every available tool name (the full menu) with one-line descriptions.\",\n },\n limit: {\n type: \"number\",\n description: `Maximum results to return for a query. Defaults to ${options.defaultLimit ?? DEFAULT_LIMIT}. Ignored when listing the full menu (no query).`,\n },\n includeSchemas: {\n type: \"boolean\",\n description:\n \"When true, include each matching tool's full input schema. Default false.\",\n },\n },\n },\n },\n http: false,\n readOnly: true,\n run: async (args: Record<string, string>) =>\n searchToolRegistry(getRegistry(), args, options),\n };\n}\n\nexport function attachToolSearch(\n registry: Record<string, ActionEntry>,\n options: ToolSearchOptions = {},\n): Record<string, ActionEntry> {\n registry[TOOL_SEARCH_ACTION_NAME] = createToolSearchEntry(\n () => registry,\n options,\n );\n return registry;\n}\n\nexport function searchToolRegistry(\n registry: Record<string, ActionEntry>,\n args: ToolSearchArgs = {},\n options: ToolSearchOptions = {},\n): {\n query: string;\n totalTools: number;\n count: number;\n results: ToolSearchResult[];\n} {\n const query = String(args.query ?? \"\").trim();\n // No query → \"menu\" mode: list every available tool by name + a terse\n // description, with no parameter summaries or input schemas. This is the\n // cheap, non-opaque counterpart to the compact catalog: the agent can see\n // the full set of tools for a small token cost, then search/load the few it\n // actually needs. A query switches to ranked search with parameter details.\n const listAll = query.length === 0;\n const includeSchemas = !listAll && parseBoolean(args.includeSchemas);\n const limit = parseLimit(\n args.limit,\n options.defaultLimit ?? DEFAULT_LIMIT,\n options.maxLimit ?? MAX_LIMIT,\n );\n const queryTokens = tokenize(query);\n\n const candidates: ToolSearchResult[] = [];\n let totalTools = 0;\n\n for (const [name, entry] of Object.entries(registry)) {\n if (!entry?.tool || name === TOOL_SEARCH_ACTION_NAME) continue;\n if (name.startsWith(\"mcp__\") && !isMcpToolAllowedForRequest(name)) {\n continue;\n }\n\n totalTools++;\n const description = normalizeWhitespace(entry.tool.description ?? \"\");\n const parsedMcp = parseMcpToolName(name);\n const kind = parsedMcp ? \"mcp\" : \"action\";\n const source = parsedMcp?.serverId;\n\n if (listAll) {\n candidates.push({\n name,\n kind,\n ...(source ? { source } : {}),\n description: truncate(description, 140),\n score: 0,\n parameters: [],\n });\n continue;\n }\n\n const parameters = summarizeParameters(entry.tool.parameters);\n const score = scoreTool({\n query,\n queryTokens,\n name,\n source,\n description,\n parameters,\n kind,\n });\n\n if (score <= 0) continue;\n\n candidates.push({\n name,\n kind,\n ...(source ? { source } : {}),\n description,\n score,\n parameters,\n ...(includeSchemas ? { inputSchema: entry.tool.parameters ?? {} } : {}),\n });\n }\n\n if (listAll) {\n candidates.sort((a, b) => a.name.localeCompare(b.name));\n return { query, totalTools, count: candidates.length, results: candidates };\n }\n\n candidates.sort((a, b) => {\n if (b.score !== a.score) return b.score - a.score;\n return a.name.localeCompare(b.name);\n });\n\n return {\n query,\n totalTools,\n count: Math.min(candidates.length, limit),\n results: candidates.slice(0, limit),\n };\n}\n\nfunction truncate(value: string, max: number): string {\n if (value.length <= max) return value;\n return `${value.slice(0, max - 1).trimEnd()}…`;\n}\n\nfunction parseLimit(value: unknown, fallback: number, max: number): number {\n const n =\n typeof value === \"number\"\n ? value\n : typeof value === \"string\" && value.trim()\n ? Number(value)\n : fallback;\n if (!Number.isFinite(n) || n <= 0) return fallback;\n return Math.max(1, Math.min(max, Math.floor(n)));\n}\n\nfunction parseBoolean(value: unknown): boolean {\n if (typeof value === \"boolean\") return value;\n if (typeof value !== \"string\") return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"true\" || normalized === \"1\" || normalized === \"yes\";\n}\n\nfunction summarizeParameters(schema: unknown): ToolParameterSummary[] {\n if (!schema || typeof schema !== \"object\") return [];\n const obj = schema as {\n properties?: Record<string, unknown>;\n required?: unknown;\n };\n const properties = obj.properties;\n if (!properties || typeof properties !== \"object\") return [];\n const required = new Set(\n Array.isArray(obj.required)\n ? obj.required.filter(\n (value): value is string => typeof value === \"string\",\n )\n : [],\n );\n\n return Object.entries(properties).map(([name, raw]) => {\n const prop =\n raw && typeof raw === \"object\" ? (raw as Record<string, unknown>) : {};\n const enumValues = Array.isArray(prop.enum)\n ? prop.enum.map((value) => String(value)).slice(0, 20)\n : undefined;\n return {\n name,\n type: summarizeType(prop.type),\n required: required.has(name),\n description:\n typeof prop.description === \"string\"\n ? normalizeWhitespace(prop.description)\n : undefined,\n ...(enumValues && enumValues.length > 0 ? { enum: enumValues } : {}),\n };\n });\n}\n\nfunction summarizeType(value: unknown): string | undefined {\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) {\n const parts = value.filter((v): v is string => typeof v === \"string\");\n return parts.length > 0 ? parts.join(\" | \") : undefined;\n }\n return undefined;\n}\n\nfunction scoreTool(input: {\n query: string;\n queryTokens: string[];\n name: string;\n source?: string;\n description: string;\n parameters: ToolParameterSummary[];\n kind: \"action\" | \"mcp\";\n}): number {\n if (input.queryTokens.length === 0) return 1;\n\n const name = searchableText(input.name);\n const source = searchableText(input.source ?? \"\");\n const description = searchableText(input.description);\n const params = searchableText(\n input.parameters\n .map((p) => `${p.name} ${p.type ?? \"\"} ${p.description ?? \"\"}`)\n .join(\" \"),\n );\n const all = `${name} ${source} ${description} ${params} ${input.kind}`;\n const phrase = searchableText(input.query);\n\n let score = 0;\n if (name.includes(phrase)) score += 14;\n if (source && source.includes(phrase)) score += 10;\n if (description.includes(phrase)) score += 8;\n if (params.includes(phrase)) score += 5;\n\n for (const token of input.queryTokens) {\n if (name.split(\" \").includes(token)) score += 9;\n else if (name.includes(token)) score += 6;\n\n if (source) {\n if (source.split(\" \").includes(token)) score += 6;\n else if (source.includes(token)) score += 3;\n }\n\n if (description.includes(token)) score += 3;\n if (params.includes(token)) score += 2;\n if (all.includes(token)) score += 1;\n }\n\n return score;\n}\n\nfunction tokenize(value: string): string[] {\n const seen = new Set<string>();\n for (const token of searchableText(value).split(\" \")) {\n if (token.length > 0) seen.add(token);\n }\n return Array.from(seen);\n}\n\nfunction searchableText(value: string): string {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \" \")\n .trim();\n}\n\nfunction normalizeWhitespace(value: string): string {\n return value.replace(/\\s+/g, \" \").trim();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"tool-search.js","sourceRoot":"","sources":["../../src/agent/tool-search.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,0BAA0B,EAAE,MAAM,6BAA6B,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AAGpE,MAAM,CAAC,MAAM,uBAAuB,GAAG,aAAa,CAAC;AA+BrD,MAAM,aAAa,GAAG,CAAC,CAAC;AACxB,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,MAAM,UAAU,qBAAqB,CACnC,WAA8C,EAC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ility.js\";\nimport { getRequestRunContext } from \"../server/request-context.js\";\nimport type { ActionEntry } from \"./production-agent.js\";\n\nexport const TOOL_SEARCH_ACTION_NAME = \"tool-search\";\n\ntype ToolSearchArgs = {\n query?: unknown;\n limit?: unknown;\n includeSchemas?: unknown;\n};\n\ntype ToolParameterSummary = {\n name: string;\n type?: string;\n required: boolean;\n description?: string;\n enum?: string[];\n};\n\ntype ToolSearchResult = {\n name: string;\n kind: \"action\" | \"mcp\";\n source?: string;\n description: string;\n score: number;\n parameters: ToolParameterSummary[];\n inputSchema?: unknown;\n};\n\ntype ToolSearchOptions = {\n defaultLimit?: number;\n maxLimit?: number;\n};\n\nconst DEFAULT_LIMIT = 8;\nconst MAX_LIMIT = 25;\n\nexport function createToolSearchEntry(\n getRegistry: () => Record<string, ActionEntry>,\n options: ToolSearchOptions = {},\n): ActionEntry {\n return {\n tool: {\n description:\n \"Discover callable tools/actions, including connected MCP server tools named `mcp__<server>__<tool>`. Call it with NO query to list every available tool by name with a one-line description (cheap — no input schemas); names from that menu are not loaded for calling yet, so call tool-search again with a specific query for the tool/capability before invoking it. Use this whenever you need a capability but aren't sure which tool to call — most tools are not loaded into context up front, so this is how you find and then call them.\",\n parameters: {\n type: \"object\",\n properties: {\n query: {\n type: \"string\",\n description:\n \"What capability to find, e.g. `send slack message`, `create calendar event`, `zapier gmail`, or `browser screenshot`. Omit to list every available tool name (the full menu) with one-line descriptions; then call tool-search again with a specific query before calling a tool from that menu.\",\n },\n limit: {\n type: \"number\",\n description: `Maximum results to return for a query. Defaults to ${options.defaultLimit ?? DEFAULT_LIMIT}. Ignored when listing the full menu (no query).`,\n },\n includeSchemas: {\n type: \"boolean\",\n description:\n \"When true, include each matching tool's full input schema. Default false.\",\n },\n },\n },\n },\n http: false,\n readOnly: true,\n run: async (args: Record<string, string>) =>\n searchToolRegistry(getRegistry(), args, options),\n };\n}\n\nexport function attachToolSearch(\n registry: Record<string, ActionEntry>,\n options: ToolSearchOptions = {},\n): Record<string, ActionEntry> {\n registry[TOOL_SEARCH_ACTION_NAME] = createToolSearchEntry(\n () => registry,\n options,\n );\n return registry;\n}\n\nexport function searchToolRegistry(\n registry: Record<string, ActionEntry>,\n args: ToolSearchArgs = {},\n options: ToolSearchOptions = {},\n): {\n query: string;\n totalTools: number;\n count: number;\n repeated?: boolean;\n message?: string;\n results: ToolSearchResult[];\n} {\n const query = String(args.query ?? \"\").trim();\n // No query → \"menu\" mode: list every available tool by name + a terse\n // description, with no parameter summaries or input schemas. This is the\n // cheap, non-opaque counterpart to the compact catalog: the agent can see\n // the full set of tools for a small token cost, then search/load the few it\n // actually needs. A query switches to ranked search with parameter details.\n const listAll = query.length === 0;\n const includeSchemas = !listAll && parseBoolean(args.includeSchemas);\n const limit = parseLimit(\n args.limit,\n options.defaultLimit ?? DEFAULT_LIMIT,\n options.maxLimit ?? MAX_LIMIT,\n );\n const cacheKey = normalizeToolSearchCacheKey({\n query,\n limit,\n includeSchemas,\n });\n const runCtx = getRequestRunContext();\n const priorSearch = includeSchemas\n ? undefined\n : runCtx?.toolSearchReads?.[cacheKey];\n if (priorSearch) {\n return {\n query,\n totalTools: priorSearch.totalTools,\n count: priorSearch.resultNames.length,\n repeated: true,\n message:\n \"This exact tool-search query already ran in this agent run. Use the previously returned schemas/details instead of searching again.\",\n results: priorSearch.resultNames.map((name) => ({\n name,\n kind: parseMcpToolName(name) ? (\"mcp\" as const) : (\"action\" as const),\n score: 0,\n description:\n \"Already returned by an earlier identical tool-search call.\",\n parameters: [],\n })),\n };\n }\n const queryTokens = tokenize(query);\n\n const candidates: ToolSearchResult[] = [];\n let totalTools = 0;\n\n for (const [name, entry] of Object.entries(registry)) {\n if (!entry?.tool || name === TOOL_SEARCH_ACTION_NAME) continue;\n if (entry.agentTool === false) continue;\n if (name.startsWith(\"mcp__\") && !isMcpToolAllowedForRequest(name)) {\n continue;\n }\n\n totalTools++;\n const description = normalizeWhitespace(entry.tool.description ?? \"\");\n const parsedMcp = parseMcpToolName(name);\n const kind = parsedMcp ? \"mcp\" : \"action\";\n const source = parsedMcp?.serverId;\n\n if (listAll) {\n candidates.push({\n name,\n kind,\n ...(source ? { source } : {}),\n description: truncate(description, 140),\n score: 0,\n parameters: [],\n });\n continue;\n }\n\n const parameters = summarizeParameters(entry.tool.parameters);\n const score = scoreTool({\n query,\n queryTokens,\n name,\n source,\n description,\n parameters,\n kind,\n });\n\n if (score <= 0) continue;\n\n candidates.push({\n name,\n kind,\n ...(source ? { source } : {}),\n description,\n score,\n parameters,\n ...(includeSchemas ? { inputSchema: entry.tool.parameters ?? {} } : {}),\n });\n }\n\n if (listAll) {\n candidates.sort((a, b) => a.name.localeCompare(b.name));\n const result = {\n query,\n totalTools,\n count: candidates.length,\n message:\n 'Menu mode lists tool names only; it does not load schemas for calling. Before invoking a tool found here, call tool-search again with a specific query such as the tool name or capability (for example, { \"query\": \"hubspot-deals\" }).',\n results: candidates,\n };\n rememberToolSearchResult(cacheKey, result);\n return result;\n }\n\n candidates.sort((a, b) => {\n if (b.score !== a.score) return b.score - a.score;\n return a.name.localeCompare(b.name);\n });\n\n const result = {\n query,\n totalTools,\n count: Math.min(candidates.length, limit),\n results: candidates.slice(0, limit),\n };\n if (!includeSchemas) rememberToolSearchResult(cacheKey, result);\n return result;\n}\n\nfunction normalizeToolSearchCacheKey(options: {\n query: string;\n limit: number;\n includeSchemas: boolean;\n}): string {\n return JSON.stringify({\n query: options.query.trim().toLowerCase(),\n limit: options.limit,\n includeSchemas: options.includeSchemas,\n });\n}\n\nfunction rememberToolSearchResult(\n cacheKey: string,\n result: { totalTools: number; results: Array<{ name: string }> },\n) {\n const runCtx = getRequestRunContext();\n if (!runCtx) return;\n const reads = (runCtx.toolSearchReads ??= {});\n reads[cacheKey] = {\n totalTools: result.totalTools,\n resultNames: result.results.map((item) => item.name),\n };\n}\n\nfunction truncate(value: string, max: number): string {\n if (value.length <= max) return value;\n return `${value.slice(0, max - 1).trimEnd()}…`;\n}\n\nfunction parseLimit(value: unknown, fallback: number, max: number): number {\n const n =\n typeof value === \"number\"\n ? value\n : typeof value === \"string\" && value.trim()\n ? Number(value)\n : fallback;\n if (!Number.isFinite(n) || n <= 0) return fallback;\n return Math.max(1, Math.min(max, Math.floor(n)));\n}\n\nfunction parseBoolean(value: unknown): boolean {\n if (typeof value === \"boolean\") return value;\n if (typeof value !== \"string\") return false;\n const normalized = value.trim().toLowerCase();\n return normalized === \"true\" || normalized === \"1\" || normalized === \"yes\";\n}\n\nfunction summarizeParameters(schema: unknown): ToolParameterSummary[] {\n if (!schema || typeof schema !== \"object\") return [];\n const obj = schema as {\n properties?: Record<string, unknown>;\n required?: unknown;\n };\n const properties = obj.properties;\n if (!properties || typeof properties !== \"object\") return [];\n const required = new Set(\n Array.isArray(obj.required)\n ? obj.required.filter(\n (value): value is string => typeof value === \"string\",\n )\n : [],\n );\n\n return Object.entries(properties).map(([name, raw]) => {\n const prop =\n raw && typeof raw === \"object\" ? (raw as Record<string, unknown>) : {};\n const enumValues = Array.isArray(prop.enum)\n ? prop.enum.map((value) => String(value)).slice(0, 20)\n : undefined;\n return {\n name,\n type: summarizeType(prop.type),\n required: required.has(name),\n description:\n typeof prop.description === \"string\"\n ? normalizeWhitespace(prop.description)\n : undefined,\n ...(enumValues && enumValues.length > 0 ? { enum: enumValues } : {}),\n };\n });\n}\n\nfunction summarizeType(value: unknown): string | undefined {\n if (typeof value === \"string\") return value;\n if (Array.isArray(value)) {\n const parts = value.filter((v): v is string => typeof v === \"string\");\n return parts.length > 0 ? parts.join(\" | \") : undefined;\n }\n return undefined;\n}\n\nfunction scoreTool(input: {\n query: string;\n queryTokens: string[];\n name: string;\n source?: string;\n description: string;\n parameters: ToolParameterSummary[];\n kind: \"action\" | \"mcp\";\n}): number {\n if (input.queryTokens.length === 0) return 1;\n\n const name = searchableText(input.name);\n const source = searchableText(input.source ?? \"\");\n const description = searchableText(input.description);\n const params = searchableText(\n input.parameters\n .map((p) => `${p.name} ${p.type ?? \"\"} ${p.description ?? \"\"}`)\n .join(\" \"),\n );\n const all = `${name} ${source} ${description} ${params} ${input.kind}`;\n const phrase = searchableText(input.query);\n\n let score = 0;\n if (name.includes(phrase)) score += 14;\n if (source && source.includes(phrase)) score += 10;\n if (description.includes(phrase)) score += 8;\n if (params.includes(phrase)) score += 5;\n\n for (const token of input.queryTokens) {\n if (name.split(\" \").includes(token)) score += 9;\n else if (name.includes(token)) score += 6;\n\n if (source) {\n if (source.split(\" \").includes(token)) score += 6;\n else if (source.includes(token)) score += 3;\n }\n\n if (description.includes(token)) score += 3;\n if (params.includes(token)) score += 2;\n if (all.includes(token)) score += 1;\n }\n\n return score;\n}\n\nfunction tokenize(value: string): string[] {\n const seen = new Set<string>();\n for (const token of searchableText(value).split(\" \")) {\n if (token.length > 0) seen.add(token);\n }\n return Array.from(seen);\n}\n\nfunction searchableText(value: string): string {\n return value\n .replace(/([a-z0-9])([A-Z])/g, \"$1 $2\")\n .toLowerCase()\n .replace(/[^a-z0-9]+/g, \" \")\n .trim();\n}\n\nfunction normalizeWhitespace(value: string): string {\n return value.replace(/\\s+/g, \" \").trim();\n}\n"]}
|
package/dist/catalog.json
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"@tabler/icons-react": "^3.41.1",
|
|
3
3
|
"@tailwindcss/vite": "^4.2.4",
|
|
4
|
-
"@typescript/native-preview": "7.0.0-dev.20260624.1",
|
|
5
4
|
"@types/react": "^19.2.14",
|
|
6
5
|
"@types/react-dom": "^19.2.3",
|
|
7
6
|
"@vitejs/plugin-react": "^6.0.3",
|
|
@@ -12,7 +11,8 @@
|
|
|
12
11
|
"react-dom": "^19.2.7",
|
|
13
12
|
"tailwindcss": "^4.2.4",
|
|
14
13
|
"tsx": "^4.20.3",
|
|
15
|
-
"typescript": "
|
|
14
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
15
|
+
"typescript-7": "npm:typescript@^7.0.2",
|
|
16
16
|
"vite": "8.1.0",
|
|
17
17
|
"vitest": "^4.1.5"
|
|
18
18
|
}
|
package/dist/cli/add.js
CHANGED
|
@@ -180,7 +180,7 @@ A new **${kind}** integration. ${kindGuidance}
|
|
|
180
180
|
|
|
181
181
|
## Verify
|
|
182
182
|
|
|
183
|
-
1. \`agent-native typecheck\` (or \`
|
|
183
|
+
1. \`agent-native typecheck\` (or \`tsc --noEmit\`) passes.
|
|
184
184
|
2. Add a focused \`*.spec.ts\` for the new surface and run it.
|
|
185
185
|
3. Exercise the real workflow end to end: invoke the new action from the agent
|
|
186
186
|
chat (and the UI if applicable), and confirm the external call round-trips
|
package/dist/cli/add.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/cli/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAazC;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAqB;IACzD,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAEnC,6EAA6E;IAC7E,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC/C,IAAI,KA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CAAC;QACnD,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,CAAC;QAChC,OAAO,CAAC,CAAC;IACX,CAAC;IAED,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,GAAG,MAAM,CAAC,WAAW,CAAC;IAE7C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,gBAAgB,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC7D,GAAG,CACD,QAAQ,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC9B,CAAC,CAAC,QAAQ,CAAC,QAAQ;YACnB,CAAC,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAC7B,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,kBAAkB,EAAE,CAAC;YACpC,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;YACtB,OAAO,CAAC,CAAC;QACX,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC","sourcesContent":["/**\n * `agent-native add <kind> [name|url]` — the **blueprint installer**.\n *\n * Borrowed from Flue's `flue add`: instead of being a dumb scaffolder that\n * writes files for you, this command emits a curated Markdown *integration\n * blueprint* to stdout. You pipe that blueprint into your own coding agent,\n * which applies the changes against the live repo:\n *\n * agent-native add provider stripe | claude\n * agent-native add channel discord | codex\n *\n * This fits the agent-applies-changes, filesystem-first house style: the\n * framework supplies the recipe (the canonical files to touch, the rules to\n * honor, the verification step), and the coding agent does the editing with\n * full repo context.\n *\n * A bare name resolves a curated blueprint from `blueprints/<kind>/<name>.md`.\n * A URL instead of a name emits a GENERIC \"research-and-integrate\" blueprint\n * for that kind with the URL embedded as the research starting point (mirrors\n * Flue: a URL is a research seed, not a known recipe).\n *\n * Blueprint `.md` files ship in the published package via the `blueprints`\n * entry in `package.json` `files`, so they live at\n * `node_modules/@agent-native/core/blueprints/**` at runtime. Resolution works\n * both from source (tsx: `src/cli` → `../../blueprints`) and from the compiled\n * package (`dist/cli` → `../../blueprints`), with an upward-walk fallback.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/** A coarse classification of what `add` resolved for a given invocation. */\nexport type AddBlueprintSource =\n | { kind: \"curated\"; blueprintKind: string; name: string; path: string }\n | { kind: \"generic-url\"; blueprintKind: string; url: string };\n\nexport interface ResolvedBlueprint {\n /** The Markdown to print to stdout (piped into a coding agent). */\n markdown: string;\n source: AddBlueprintSource;\n}\n\n/**\n * Locate the directory that holds the blueprint `.md` recipes.\n *\n * Both `src/cli` (tsx/source) and `dist/cli` (published) sit two levels under\n * the package root, where `blueprints/` lives, so `../../blueprints` from this\n * module's directory is the primary path. We additionally walk upward looking\n * for a `blueprints` directory as a resilience fallback (e.g. unusual bundler\n * layouts). An explicit override is honored for tests.\n */\nexport function resolveBlueprintsRoot(overrideRoot?: string): string {\n if (overrideRoot) return overrideRoot;\n\n const here = path.dirname(fileURLToPath(import.meta.url));\n const primary = path.resolve(here, \"../../blueprints\");\n if (isDir(primary)) return primary;\n\n // Fallback: walk up from this module looking for a sibling `blueprints` dir.\n let dir = here;\n for (let i = 0; i < 8; i += 1) {\n const candidate = path.join(dir, \"blueprints\");\n if (isDir(candidate)) return candidate;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n // Return the primary path even if missing so error messages are concrete.\n return primary;\n}\n\nfunction isDir(p: string): boolean {\n try {\n return fs.statSync(p).isDirectory();\n } catch {\n return false;\n }\n}\n\n/** True for an argument that should be treated as a research URL, not a name. */\nexport function looksLikeUrl(value: string): boolean {\n return /^https?:\\/\\//i.test(value.trim());\n}\n\n/** List the blueprint kinds (subdirectories) available, sorted. */\nexport function listKinds(root: string): string[] {\n if (!isDir(root)) return [];\n return fs\n .readdirSync(root, { withFileTypes: true })\n .filter((e) => e.isDirectory())\n .map((e) => e.name)\n .sort();\n}\n\n/** List the blueprint names available under a kind, sorted (no `.md`). */\nexport function listBlueprintNames(root: string, kind: string): string[] {\n const dir = path.join(root, kind);\n if (!isDir(dir)) return [];\n return fs\n .readdirSync(dir, { withFileTypes: true })\n .filter((e) => e.isFile() && e.name.endsWith(\".md\"))\n .map((e) => e.name.slice(0, -\".md\".length))\n .sort();\n}\n\n/** A flat catalog of every kind and its blueprint names. */\nexport function listCatalog(root: string): Array<{\n kind: string;\n names: string[];\n}> {\n return listKinds(root).map((kind) => ({\n kind,\n names: listBlueprintNames(root, kind),\n }));\n}\n\n/** Render the `--list` / no-args catalog text. */\nexport function formatCatalog(root: string): string {\n const catalog = listCatalog(root);\n const lines: string[] = [];\n lines.push(\"Available blueprints:\");\n lines.push(\"\");\n if (catalog.length === 0) {\n lines.push(\" (none found)\");\n } else {\n for (const { kind, names } of catalog) {\n const shown =\n names.length > 0 ? names.join(\", \") : \"(generic — pass a URL)\";\n lines.push(` ${kind.padEnd(10)} ${shown}`);\n }\n }\n lines.push(\"\");\n lines.push(\"Usage:\");\n lines.push(\n \" agent-native add <kind> <name> Print a curated blueprint\",\n );\n lines.push(\n \" agent-native add <kind> <https://docs…> Research-and-integrate from a URL\",\n );\n lines.push(\" agent-native add --list Show this list\");\n lines.push(\"\");\n lines.push(\"Pipe a blueprint into your coding agent to apply it:\");\n lines.push(\" agent-native add provider stripe | claude\");\n lines.push(\" agent-native add channel discord | codex\");\n return lines.join(\"\\n\");\n}\n\n/**\n * Build the generic \"research-and-integrate\" blueprint emitted when the user\n * passes a URL instead of a known blueprint name. Mirrors Flue: a URL is a\n * research seed. We keep this self-contained — the coding agent reading it has\n * no other context.\n */\nexport function buildGenericUrlBlueprint(kind: string, url: string): string {\n const kindGuidance = GENERIC_KIND_GUIDANCE[kind] ?? GENERIC_DEFAULT_GUIDANCE;\n return `# Blueprint: integrate a new ${kind} from a URL\n\nYou are a coding agent working inside an **agent-native** app (a repo built on\n\\`@agent-native/core\\`). Apply this blueprint as real source changes on the\ncurrent branch. Do not just describe the work — research, implement, then verify.\n\n## Research seed\n\nStart from this URL and follow it for the API/protocol/contract you need:\n\n ${url}\n\nFetch it (and the pages it links to) to learn the real endpoints, auth model,\npayload shapes, and any signature/verification requirements. Do not guess from\ntraining data — the docs are the source of truth, and package/API versions\ndrift. Confirm the current version before writing code.\n\n## What you're adding\n\nA new **${kind}** integration. ${kindGuidance}\n\n## How agent-native wants it built\n\n- **Actions are the single source of truth.** Add app operations in \\`actions/\\`\n with \\`defineAction\\` (Zod schema). The agent calls them as tools; the frontend\n calls the same action through \\`useActionQuery\\` / \\`useActionMutation\\`. Do NOT\n add \\`/api/*\\` or Nitro pass-through routes that just wrap an action.\n- **Prefer the provider-api substrate for external HTTP.** For ad-hoc reads\n against a third-party API, register the provider with\n \\`@agent-native/core/provider-api\\` and expose the\n \\`provider-api-catalog\\` / \\`provider-api-docs\\` / \\`provider-api-request\\` trio\n instead of one rigid action per endpoint. First-class actions are shortcuts,\n not capability limits.\n- **Read the relevant skill before editing** — \\`actions\\`,\n \\`integration-webhooks\\`, \\`secrets\\`, \\`onboarding\\`, \\`sharing\\`, \\`security\\` —\n for the area you're touching.\n- **Never hardcode secrets.** Read API keys / tokens / signing secrets from the\n secret store (\\`readAppSecret\\`, the provider credential adapter, OAuth token\n helpers) at call time. Use obviously-fake placeholders in any example\n (e.g. \\`sk_test_PLACEHOLDER_xxx\\`), never a real credential.\n- **Scope ownable data.** Tables with \\`ownableColumns()\\` require\n \\`accessFilter\\` / \\`resolveAccess\\` / \\`assertAccess\\`; fail closed.\n- **Changeset.** If you edit a publishable package's source\n (\\`packages/core\\`, \\`packages/dispatch\\`, \\`packages/scheduling\\`,\n \\`packages/pinpoint\\`), add a \\`.changeset/*.md\\`.\n\n## Verify\n\n1. \\`agent-native typecheck\\` (or \\`tsgo --noEmit\\`) passes.\n2. Add a focused \\`*.spec.ts\\` for the new surface and run it.\n3. Exercise the real workflow end to end: invoke the new action from the agent\n chat (and the UI if applicable), and confirm the external call round-trips\n with credentials injected and secrets redacted.\n`;\n}\n\nconst GENERIC_DEFAULT_GUIDANCE =\n \"Identify whether it is best modeled as an action, a provider-api integration, \" +\n \"an inbound channel adapter, or a sandbox backend, and follow that area's skill.\";\n\nconst GENERIC_KIND_GUIDANCE: Record<string, string> = {\n provider:\n \"Wire it into the provider-api substrate (`@agent-native/core/provider-api`): \" +\n \"register the base URL, auth style, credential key, and docs URLs, then expose \" +\n \"the `provider-api-catalog` / `provider-api-docs` / `provider-api-request` trio \" +\n \"so any endpoint is reachable without one action per endpoint.\",\n channel:\n \"Implement a `PlatformAdapter` (see \" +\n \"`packages/core/src/integrations/types.ts` and the adapters under \" +\n \"`packages/core/src/integrations/adapters/`) and register it in \" +\n \"`getDefaultAdapters()` in `packages/core/src/integrations/plugin.ts`. \" +\n \"Enqueue to SQL and return 200 fast; run the agent loop in the separate \" +\n \"`_process-task` execution. Read the `integration-webhooks` skill.\",\n sandbox:\n \"Implement the `SandboxAdapter` seam in \" +\n \"`packages/core/src/coding-tools/sandbox/` (mirror \" +\n \"`local-child-process-adapter.ts`) and select it via `AGENT_NATIVE_SANDBOX` \" +\n \"or `registerSandboxAdapter()`. The adapter only runs the already-prepared, \" +\n \"non-secret module source — it never sees app secrets.\",\n action:\n \"Add a single multi-surface `defineAction` in `actions/` with a Zod schema. \" +\n \"Keep the surface small and orthogonal (one CRUD-style `update` over N \" +\n \"per-field actions). Read the `actions` skill.\",\n};\n\n/**\n * Resolve a blueprint for a `kind` + optional `name`/`url`.\n *\n * - A known name → the curated `blueprints/<kind>/<name>.md`.\n * - A URL → the generic research-and-integrate blueprint for the kind.\n * - Unknown name → throws `AddResolutionError` listing what's available.\n */\nexport function resolveBlueprint(opts: {\n kind: string;\n nameOrUrl?: string;\n root: string;\n}): ResolvedBlueprint {\n const { kind, nameOrUrl, root } = opts;\n const kinds = listKinds(root);\n\n if (!kinds.includes(kind)) {\n throw new AddResolutionError(\n `Unknown blueprint kind: ${kind}\\n\\n${formatCatalog(root)}`,\n );\n }\n\n // A URL seed → generic blueprint for the kind.\n if (nameOrUrl && looksLikeUrl(nameOrUrl)) {\n return {\n markdown: buildGenericUrlBlueprint(kind, nameOrUrl.trim()),\n source: {\n kind: \"generic-url\",\n blueprintKind: kind,\n url: nameOrUrl.trim(),\n },\n };\n }\n\n const names = listBlueprintNames(root, kind);\n\n // No name given: if exactly one curated blueprint exists, use it; otherwise\n // ask the user to pick one (or pass a URL for the generic path).\n if (!nameOrUrl) {\n if (names.length === 1) {\n return loadCurated(root, kind, names[0]);\n }\n throw new AddResolutionError(\n `Specify a ${kind} blueprint name or a URL.\\n` +\n ` Available ${kind} blueprints: ${\n names.length ? names.join(\", \") : \"(none — pass a URL)\"\n }\\n` +\n ` Or research from a URL: agent-native add ${kind} https://…`,\n );\n }\n\n if (!names.includes(nameOrUrl)) {\n throw new AddResolutionError(\n `Unknown ${kind} blueprint: ${nameOrUrl}\\n` +\n ` Available ${kind} blueprints: ${\n names.length ? names.join(\", \") : \"(none)\"\n }\\n` +\n ` Or research from a URL: agent-native add ${kind} https://…`,\n );\n }\n\n return loadCurated(root, kind, nameOrUrl);\n}\n\nfunction loadCurated(\n root: string,\n kind: string,\n name: string,\n): ResolvedBlueprint {\n const filePath = path.join(root, kind, `${name}.md`);\n const markdown = fs.readFileSync(filePath, \"utf-8\");\n return {\n markdown,\n source: { kind: \"curated\", blueprintKind: kind, name, path: filePath },\n };\n}\n\n/** Thrown for an unknown kind/name; the CLI prints the message and exits 1. */\nexport class AddResolutionError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"AddResolutionError\";\n }\n}\n\ninterface ParsedAddArgs {\n list: boolean;\n help: boolean;\n /** Accepted as an explicit no-op alias for the default print behavior. */\n print: boolean;\n positionals: string[];\n}\n\nexport function parseAddArgs(argv: string[]): ParsedAddArgs {\n const out: ParsedAddArgs = {\n list: false,\n help: false,\n print: false,\n positionals: [],\n };\n for (const arg of argv) {\n if (arg === \"--\") continue;\n if (arg === \"--list\" || arg === \"-l\") out.list = true;\n else if (arg === \"--help\" || arg === \"-h\") out.help = true;\n else if (arg === \"--print\" || arg === \"-p\") out.print = true;\n else if (arg.startsWith(\"-\")) {\n // Ignore unknown flags rather than misparse them as a name.\n continue;\n } else out.positionals.push(arg);\n }\n return out;\n}\n\nconst HELP = `agent-native add — emit an integration blueprint for your coding agent.\n\nInstead of scaffolding files, \\`add\\` prints a curated Markdown recipe to stdout.\nPipe it into a coding agent (Claude Code, Codex, …) and it applies the changes\nagainst your live repo, the agent-native way.\n\nUsage:\n agent-native add <kind> <name> Print a curated blueprint\n agent-native add <kind> <https://docs…> Research-and-integrate from a URL\n agent-native add --list List available kinds and blueprints\n\nExamples:\n agent-native add provider stripe | claude\n agent-native add channel discord | codex\n agent-native add sandbox docker\n agent-native add action crud\n agent-native add provider https://docs.example.com/api | claude\n\nOptions:\n -l, --list List available blueprint kinds and names\n -p, --print Print the blueprint to stdout (the default; explicit no-op)\n -h, --help Show this help`;\n\n/**\n * CLI entry point. Returns the process exit code so the dispatcher / tests can\n * assert on it. Writes the blueprint Markdown to stdout and diagnostics to\n * stderr so `... | claude` only receives the blueprint.\n */\nexport function runAdd(\n argv: string[],\n io: {\n out?: (s: string) => void;\n err?: (s: string) => void;\n root?: string;\n } = {},\n): number {\n const out = io.out ?? ((s: string) => process.stdout.write(s));\n const err = io.err ?? ((s: string) => process.stderr.write(s));\n const root = resolveBlueprintsRoot(io.root);\n\n const parsed = parseAddArgs(argv);\n\n if (parsed.help) {\n out(HELP + \"\\n\");\n return 0;\n }\n\n // `--list` or no positionals → show the catalog (to stdout; this is the\n // requested output, not an error).\n if (parsed.list || parsed.positionals.length === 0) {\n out(formatCatalog(root) + \"\\n\");\n return 0;\n }\n\n const [kind, nameOrUrl] = parsed.positionals;\n\n try {\n const resolved = resolveBlueprint({ kind, nameOrUrl, root });\n out(\n resolved.markdown.endsWith(\"\\n\")\n ? resolved.markdown\n : resolved.markdown + \"\\n\",\n );\n return 0;\n } catch (e) {\n if (e instanceof AddResolutionError) {\n err(e.message + \"\\n\");\n return 1;\n }\n throw e;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"add.js","sourceRoot":"","sources":["../../src/cli/add.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAazC;;;;;;;;GAQG;AACH,MAAM,UAAU,qBAAqB,CAAC,YAAqB;IACzD,IAAI,YAAY;QAAE,OAAO,YAAY,CAAC;IAEtC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,kBAAkB,CAAC,CAAC;IACvD,IAAI,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,OAAO,CAAC;IAEnC,6EAA6E;IAC7E,IAAI,GAAG,GAAG,IAAI,CAAC;IACf,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC;QAC/C,IAAI,KAAK,CAAC,SAAS,CAAC;YAAE,OAAO,SAAS,CAAC;QACvC,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,0EAA0E;IAC1E,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,SAAS,KAAK,CAAC,CAAS;IACtB,IAAI,CAAC;QACH,OAAO,EAAE,C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Q,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC;YAC9B,CAAC,CAAC,QAAQ,CAAC,QAAQ;YACnB,CAAC,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAC7B,CAAC;QACF,OAAO,CAAC,CAAC;IACX,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,IAAI,CAAC,YAAY,kBAAkB,EAAE,CAAC;YACpC,GAAG,CAAC,CAAC,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;YACtB,OAAO,CAAC,CAAC;QACX,CAAC;QACD,MAAM,CAAC,CAAC;IACV,CAAC;AACH,CAAC","sourcesContent":["/**\n * `agent-native add <kind> [name|url]` — the **blueprint installer**.\n *\n * Borrowed from Flue's `flue add`: instead of being a dumb scaffolder that\n * writes files for you, this command emits a curated Markdown *integration\n * blueprint* to stdout. You pipe that blueprint into your own coding agent,\n * which applies the changes against the live repo:\n *\n * agent-native add provider stripe | claude\n * agent-native add channel discord | codex\n *\n * This fits the agent-applies-changes, filesystem-first house style: the\n * framework supplies the recipe (the canonical files to touch, the rules to\n * honor, the verification step), and the coding agent does the editing with\n * full repo context.\n *\n * A bare name resolves a curated blueprint from `blueprints/<kind>/<name>.md`.\n * A URL instead of a name emits a GENERIC \"research-and-integrate\" blueprint\n * for that kind with the URL embedded as the research starting point (mirrors\n * Flue: a URL is a research seed, not a known recipe).\n *\n * Blueprint `.md` files ship in the published package via the `blueprints`\n * entry in `package.json` `files`, so they live at\n * `node_modules/@agent-native/core/blueprints/**` at runtime. Resolution works\n * both from source (tsx: `src/cli` → `../../blueprints`) and from the compiled\n * package (`dist/cli` → `../../blueprints`), with an upward-walk fallback.\n */\n\nimport fs from \"node:fs\";\nimport path from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\n/** A coarse classification of what `add` resolved for a given invocation. */\nexport type AddBlueprintSource =\n | { kind: \"curated\"; blueprintKind: string; name: string; path: string }\n | { kind: \"generic-url\"; blueprintKind: string; url: string };\n\nexport interface ResolvedBlueprint {\n /** The Markdown to print to stdout (piped into a coding agent). */\n markdown: string;\n source: AddBlueprintSource;\n}\n\n/**\n * Locate the directory that holds the blueprint `.md` recipes.\n *\n * Both `src/cli` (tsx/source) and `dist/cli` (published) sit two levels under\n * the package root, where `blueprints/` lives, so `../../blueprints` from this\n * module's directory is the primary path. We additionally walk upward looking\n * for a `blueprints` directory as a resilience fallback (e.g. unusual bundler\n * layouts). An explicit override is honored for tests.\n */\nexport function resolveBlueprintsRoot(overrideRoot?: string): string {\n if (overrideRoot) return overrideRoot;\n\n const here = path.dirname(fileURLToPath(import.meta.url));\n const primary = path.resolve(here, \"../../blueprints\");\n if (isDir(primary)) return primary;\n\n // Fallback: walk up from this module looking for a sibling `blueprints` dir.\n let dir = here;\n for (let i = 0; i < 8; i += 1) {\n const candidate = path.join(dir, \"blueprints\");\n if (isDir(candidate)) return candidate;\n const parent = path.dirname(dir);\n if (parent === dir) break;\n dir = parent;\n }\n // Return the primary path even if missing so error messages are concrete.\n return primary;\n}\n\nfunction isDir(p: string): boolean {\n try {\n return fs.statSync(p).isDirectory();\n } catch {\n return false;\n }\n}\n\n/** True for an argument that should be treated as a research URL, not a name. */\nexport function looksLikeUrl(value: string): boolean {\n return /^https?:\\/\\//i.test(value.trim());\n}\n\n/** List the blueprint kinds (subdirectories) available, sorted. */\nexport function listKinds(root: string): string[] {\n if (!isDir(root)) return [];\n return fs\n .readdirSync(root, { withFileTypes: true })\n .filter((e) => e.isDirectory())\n .map((e) => e.name)\n .sort();\n}\n\n/** List the blueprint names available under a kind, sorted (no `.md`). */\nexport function listBlueprintNames(root: string, kind: string): string[] {\n const dir = path.join(root, kind);\n if (!isDir(dir)) return [];\n return fs\n .readdirSync(dir, { withFileTypes: true })\n .filter((e) => e.isFile() && e.name.endsWith(\".md\"))\n .map((e) => e.name.slice(0, -\".md\".length))\n .sort();\n}\n\n/** A flat catalog of every kind and its blueprint names. */\nexport function listCatalog(root: string): Array<{\n kind: string;\n names: string[];\n}> {\n return listKinds(root).map((kind) => ({\n kind,\n names: listBlueprintNames(root, kind),\n }));\n}\n\n/** Render the `--list` / no-args catalog text. */\nexport function formatCatalog(root: string): string {\n const catalog = listCatalog(root);\n const lines: string[] = [];\n lines.push(\"Available blueprints:\");\n lines.push(\"\");\n if (catalog.length === 0) {\n lines.push(\" (none found)\");\n } else {\n for (const { kind, names } of catalog) {\n const shown =\n names.length > 0 ? names.join(\", \") : \"(generic — pass a URL)\";\n lines.push(` ${kind.padEnd(10)} ${shown}`);\n }\n }\n lines.push(\"\");\n lines.push(\"Usage:\");\n lines.push(\n \" agent-native add <kind> <name> Print a curated blueprint\",\n );\n lines.push(\n \" agent-native add <kind> <https://docs…> Research-and-integrate from a URL\",\n );\n lines.push(\" agent-native add --list Show this list\");\n lines.push(\"\");\n lines.push(\"Pipe a blueprint into your coding agent to apply it:\");\n lines.push(\" agent-native add provider stripe | claude\");\n lines.push(\" agent-native add channel discord | codex\");\n return lines.join(\"\\n\");\n}\n\n/**\n * Build the generic \"research-and-integrate\" blueprint emitted when the user\n * passes a URL instead of a known blueprint name. Mirrors Flue: a URL is a\n * research seed. We keep this self-contained — the coding agent reading it has\n * no other context.\n */\nexport function buildGenericUrlBlueprint(kind: string, url: string): string {\n const kindGuidance = GENERIC_KIND_GUIDANCE[kind] ?? GENERIC_DEFAULT_GUIDANCE;\n return `# Blueprint: integrate a new ${kind} from a URL\n\nYou are a coding agent working inside an **agent-native** app (a repo built on\n\\`@agent-native/core\\`). Apply this blueprint as real source changes on the\ncurrent branch. Do not just describe the work — research, implement, then verify.\n\n## Research seed\n\nStart from this URL and follow it for the API/protocol/contract you need:\n\n ${url}\n\nFetch it (and the pages it links to) to learn the real endpoints, auth model,\npayload shapes, and any signature/verification requirements. Do not guess from\ntraining data — the docs are the source of truth, and package/API versions\ndrift. Confirm the current version before writing code.\n\n## What you're adding\n\nA new **${kind}** integration. ${kindGuidance}\n\n## How agent-native wants it built\n\n- **Actions are the single source of truth.** Add app operations in \\`actions/\\`\n with \\`defineAction\\` (Zod schema). The agent calls them as tools; the frontend\n calls the same action through \\`useActionQuery\\` / \\`useActionMutation\\`. Do NOT\n add \\`/api/*\\` or Nitro pass-through routes that just wrap an action.\n- **Prefer the provider-api substrate for external HTTP.** For ad-hoc reads\n against a third-party API, register the provider with\n \\`@agent-native/core/provider-api\\` and expose the\n \\`provider-api-catalog\\` / \\`provider-api-docs\\` / \\`provider-api-request\\` trio\n instead of one rigid action per endpoint. First-class actions are shortcuts,\n not capability limits.\n- **Read the relevant skill before editing** — \\`actions\\`,\n \\`integration-webhooks\\`, \\`secrets\\`, \\`onboarding\\`, \\`sharing\\`, \\`security\\` —\n for the area you're touching.\n- **Never hardcode secrets.** Read API keys / tokens / signing secrets from the\n secret store (\\`readAppSecret\\`, the provider credential adapter, OAuth token\n helpers) at call time. Use obviously-fake placeholders in any example\n (e.g. \\`sk_test_PLACEHOLDER_xxx\\`), never a real credential.\n- **Scope ownable data.** Tables with \\`ownableColumns()\\` require\n \\`accessFilter\\` / \\`resolveAccess\\` / \\`assertAccess\\`; fail closed.\n- **Changeset.** If you edit a publishable package's source\n (\\`packages/core\\`, \\`packages/dispatch\\`, \\`packages/scheduling\\`,\n \\`packages/pinpoint\\`), add a \\`.changeset/*.md\\`.\n\n## Verify\n\n1. \\`agent-native typecheck\\` (or \\`tsc --noEmit\\`) passes.\n2. Add a focused \\`*.spec.ts\\` for the new surface and run it.\n3. Exercise the real workflow end to end: invoke the new action from the agent\n chat (and the UI if applicable), and confirm the external call round-trips\n with credentials injected and secrets redacted.\n`;\n}\n\nconst GENERIC_DEFAULT_GUIDANCE =\n \"Identify whether it is best modeled as an action, a provider-api integration, \" +\n \"an inbound channel adapter, or a sandbox backend, and follow that area's skill.\";\n\nconst GENERIC_KIND_GUIDANCE: Record<string, string> = {\n provider:\n \"Wire it into the provider-api substrate (`@agent-native/core/provider-api`): \" +\n \"register the base URL, auth style, credential key, and docs URLs, then expose \" +\n \"the `provider-api-catalog` / `provider-api-docs` / `provider-api-request` trio \" +\n \"so any endpoint is reachable without one action per endpoint.\",\n channel:\n \"Implement a `PlatformAdapter` (see \" +\n \"`packages/core/src/integrations/types.ts` and the adapters under \" +\n \"`packages/core/src/integrations/adapters/`) and register it in \" +\n \"`getDefaultAdapters()` in `packages/core/src/integrations/plugin.ts`. \" +\n \"Enqueue to SQL and return 200 fast; run the agent loop in the separate \" +\n \"`_process-task` execution. Read the `integration-webhooks` skill.\",\n sandbox:\n \"Implement the `SandboxAdapter` seam in \" +\n \"`packages/core/src/coding-tools/sandbox/` (mirror \" +\n \"`local-child-process-adapter.ts`) and select it via `AGENT_NATIVE_SANDBOX` \" +\n \"or `registerSandboxAdapter()`. The adapter only runs the already-prepared, \" +\n \"non-secret module source — it never sees app secrets.\",\n action:\n \"Add a single multi-surface `defineAction` in `actions/` with a Zod schema. \" +\n \"Keep the surface small and orthogonal (one CRUD-style `update` over N \" +\n \"per-field actions). Read the `actions` skill.\",\n};\n\n/**\n * Resolve a blueprint for a `kind` + optional `name`/`url`.\n *\n * - A known name → the curated `blueprints/<kind>/<name>.md`.\n * - A URL → the generic research-and-integrate blueprint for the kind.\n * - Unknown name → throws `AddResolutionError` listing what's available.\n */\nexport function resolveBlueprint(opts: {\n kind: string;\n nameOrUrl?: string;\n root: string;\n}): ResolvedBlueprint {\n const { kind, nameOrUrl, root } = opts;\n const kinds = listKinds(root);\n\n if (!kinds.includes(kind)) {\n throw new AddResolutionError(\n `Unknown blueprint kind: ${kind}\\n\\n${formatCatalog(root)}`,\n );\n }\n\n // A URL seed → generic blueprint for the kind.\n if (nameOrUrl && looksLikeUrl(nameOrUrl)) {\n return {\n markdown: buildGenericUrlBlueprint(kind, nameOrUrl.trim()),\n source: {\n kind: \"generic-url\",\n blueprintKind: kind,\n url: nameOrUrl.trim(),\n },\n };\n }\n\n const names = listBlueprintNames(root, kind);\n\n // No name given: if exactly one curated blueprint exists, use it; otherwise\n // ask the user to pick one (or pass a URL for the generic path).\n if (!nameOrUrl) {\n if (names.length === 1) {\n return loadCurated(root, kind, names[0]);\n }\n throw new AddResolutionError(\n `Specify a ${kind} blueprint name or a URL.\\n` +\n ` Available ${kind} blueprints: ${\n names.length ? names.join(\", \") : \"(none — pass a URL)\"\n }\\n` +\n ` Or research from a URL: agent-native add ${kind} https://…`,\n );\n }\n\n if (!names.includes(nameOrUrl)) {\n throw new AddResolutionError(\n `Unknown ${kind} blueprint: ${nameOrUrl}\\n` +\n ` Available ${kind} blueprints: ${\n names.length ? names.join(\", \") : \"(none)\"\n }\\n` +\n ` Or research from a URL: agent-native add ${kind} https://…`,\n );\n }\n\n return loadCurated(root, kind, nameOrUrl);\n}\n\nfunction loadCurated(\n root: string,\n kind: string,\n name: string,\n): ResolvedBlueprint {\n const filePath = path.join(root, kind, `${name}.md`);\n const markdown = fs.readFileSync(filePath, \"utf-8\");\n return {\n markdown,\n source: { kind: \"curated\", blueprintKind: kind, name, path: filePath },\n };\n}\n\n/** Thrown for an unknown kind/name; the CLI prints the message and exits 1. */\nexport class AddResolutionError extends Error {\n constructor(message: string) {\n super(message);\n this.name = \"AddResolutionError\";\n }\n}\n\ninterface ParsedAddArgs {\n list: boolean;\n help: boolean;\n /** Accepted as an explicit no-op alias for the default print behavior. */\n print: boolean;\n positionals: string[];\n}\n\nexport function parseAddArgs(argv: string[]): ParsedAddArgs {\n const out: ParsedAddArgs = {\n list: false,\n help: false,\n print: false,\n positionals: [],\n };\n for (const arg of argv) {\n if (arg === \"--\") continue;\n if (arg === \"--list\" || arg === \"-l\") out.list = true;\n else if (arg === \"--help\" || arg === \"-h\") out.help = true;\n else if (arg === \"--print\" || arg === \"-p\") out.print = true;\n else if (arg.startsWith(\"-\")) {\n // Ignore unknown flags rather than misparse them as a name.\n continue;\n } else out.positionals.push(arg);\n }\n return out;\n}\n\nconst HELP = `agent-native add — emit an integration blueprint for your coding agent.\n\nInstead of scaffolding files, \\`add\\` prints a curated Markdown recipe to stdout.\nPipe it into a coding agent (Claude Code, Codex, …) and it applies the changes\nagainst your live repo, the agent-native way.\n\nUsage:\n agent-native add <kind> <name> Print a curated blueprint\n agent-native add <kind> <https://docs…> Research-and-integrate from a URL\n agent-native add --list List available kinds and blueprints\n\nExamples:\n agent-native add provider stripe | claude\n agent-native add channel discord | codex\n agent-native add sandbox docker\n agent-native add action crud\n agent-native add provider https://docs.example.com/api | claude\n\nOptions:\n -l, --list List available blueprint kinds and names\n -p, --print Print the blueprint to stdout (the default; explicit no-op)\n -h, --help Show this help`;\n\n/**\n * CLI entry point. Returns the process exit code so the dispatcher / tests can\n * assert on it. Writes the blueprint Markdown to stdout and diagnostics to\n * stderr so `... | claude` only receives the blueprint.\n */\nexport function runAdd(\n argv: string[],\n io: {\n out?: (s: string) => void;\n err?: (s: string) => void;\n root?: string;\n } = {},\n): number {\n const out = io.out ?? ((s: string) => process.stdout.write(s));\n const err = io.err ?? ((s: string) => process.stderr.write(s));\n const root = resolveBlueprintsRoot(io.root);\n\n const parsed = parseAddArgs(argv);\n\n if (parsed.help) {\n out(HELP + \"\\n\");\n return 0;\n }\n\n // `--list` or no positionals → show the catalog (to stdout; this is the\n // requested output, not an error).\n if (parsed.list || parsed.positionals.length === 0) {\n out(formatCatalog(root) + \"\\n\");\n return 0;\n }\n\n const [kind, nameOrUrl] = parsed.positionals;\n\n try {\n const resolved = resolveBlueprint({ kind, nameOrUrl, root });\n out(\n resolved.markdown.endsWith(\"\\n\")\n ? resolved.markdown\n : resolved.markdown + \"\\n\",\n );\n return 0;\n } catch (e) {\n if (e instanceof AddResolutionError) {\n err(e.message + \"\\n\");\n return 1;\n }\n throw e;\n }\n}\n"]}
|
package/dist/cli/create.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/cli/create.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAkB,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceR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;AACH,iBAAS,8BAA8B,IAAI,MAAM,EAAE,CASlD;AAED;;qDAEqD;AACrD,iBAAS,oBAAoB,IAAI,MAAM,CAEtC;AAuID,iBAAS,kBAAkB,CACzB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,YAAY,GAAG,WAAW,GAC/B,IAAI,CA8CN;AAkHD,iBAAS,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI1C;AAyED,iBAAS,uBAAuB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CA+BxE"}
|
package/dist/cli/create.js
CHANGED
|
@@ -22,7 +22,12 @@ const REACT_ROUTER_BUILD_DEPENDENCIES = [
|
|
|
22
22
|
"react-router",
|
|
23
23
|
"vite",
|
|
24
24
|
];
|
|
25
|
-
const
|
|
25
|
+
const MINIMUM_RELEASE_AGE_EXCLUDES = [
|
|
26
|
+
'"@typescript/*"',
|
|
27
|
+
'"@sentry/*"',
|
|
28
|
+
"typescript",
|
|
29
|
+
"typescript-7",
|
|
30
|
+
];
|
|
26
31
|
const FIRST_PARTY_TARBALL_SYMLINK_EXCLUDES = [
|
|
27
32
|
"*/CLAUDE.md",
|
|
28
33
|
"*/.claude/skills",
|
|
@@ -905,7 +910,7 @@ function postProcessStandalone(name, targetDir, templateName) {
|
|
|
905
910
|
JSON.stringify(localToolkit);
|
|
906
911
|
}
|
|
907
912
|
let updated = mergeWorkspaceYamlSections(existing, sections);
|
|
908
|
-
updated = mergeWorkspaceYamlListItems(updated, "minimumReleaseAgeExclude",
|
|
913
|
+
updated = mergeWorkspaceYamlListItems(updated, "minimumReleaseAgeExclude", MINIMUM_RELEASE_AGE_EXCLUDES);
|
|
909
914
|
if (updated !== existing) {
|
|
910
915
|
fs.writeFileSync(wsPath, updated);
|
|
911
916
|
}
|
|
@@ -955,7 +960,7 @@ function fixStandaloneTsconfig(targetDir, templateName) {
|
|
|
955
960
|
paths["@shared/*"] ??= ["./shared/*"];
|
|
956
961
|
}
|
|
957
962
|
// baseUrl is deprecated/errors in TS 6 (TS5101/TS5102) and removed in TS 7
|
|
958
|
-
// (
|
|
963
|
+
// (tsc, which CI runs). paths already resolve relative to this tsconfig,
|
|
959
964
|
// and the "*": ["./*"] entry replaces baseUrl's bare-specifier resolution,
|
|
960
965
|
// so never emit baseUrl into scaffolds.
|
|
961
966
|
delete tsconfig.compilerOptions.baseUrl;
|