@agent-native/core 0.132.1 → 0.133.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/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +198 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/correlation.ts +11 -1
- package/corpus/core/src/a2a/types.ts +11 -3
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +33 -46
- package/corpus/core/src/agent/engine/builder-engine.ts +22 -10
- package/corpus/core/src/agent/engine/error-detail.ts +184 -3
- package/corpus/core/src/agent/engine/failure-taxonomy.ts +123 -0
- package/corpus/core/src/agent/engine/index.ts +8 -0
- package/corpus/core/src/agent/engine/registry.ts +92 -8
- package/corpus/core/src/agent/engine/translate-ai-sdk.ts +17 -2
- package/corpus/core/src/agent/production-agent.ts +13 -33
- package/corpus/core/src/agent/run-loop-with-resume.ts +1 -1
- package/corpus/core/src/agent/run-manager.ts +43 -14
- package/corpus/core/src/agent/run-store.ts +30 -3
- package/corpus/core/src/agent/thread-data-builder.ts +36 -4
- package/corpus/core/src/chat-threads/store.ts +42 -0
- package/corpus/core/src/cli/templates-meta.ts +13 -0
- package/corpus/core/src/cli/workspace-dev.ts +1 -0
- package/corpus/core/src/client/error-format.ts +12 -0
- package/corpus/core/src/client/use-chat-threads.ts +76 -16
- package/corpus/core/src/credentials/index.ts +51 -12
- package/corpus/core/src/extensions/url-safety.ts +46 -12
- package/corpus/core/src/integrations/adapters/slack.ts +32 -10
- package/corpus/core/src/integrations/google-docs-poller.ts +12 -1
- package/corpus/core/src/integrations/installations-store.ts +30 -0
- package/corpus/core/src/integrations/plugin.ts +5 -5
- package/corpus/core/src/integrations/types.ts +7 -0
- package/corpus/core/src/integrations/webhook-handler.ts +24 -1
- package/corpus/core/src/jobs/background-automation-runner.ts +38 -1
- package/corpus/core/src/provider-api/index.ts +8 -2
- package/corpus/core/src/scripts/call-agent.ts +6 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +46 -10
- package/corpus/core/src/server/agent-discovery.ts +2 -0
- package/corpus/core/src/server/builder-design-systems.ts +21 -0
- package/corpus/core/src/server/credential-provider.ts +51 -12
- package/corpus/core/src/server/index.ts +1 -0
- package/corpus/core/src/server/onboarding-html.ts +37 -2
- package/corpus/core/src/shared/reasoning-effort.ts +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +6 -2
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +39 -19
- package/corpus/templates/assets/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +30 -3
- package/corpus/templates/brain/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +54 -25
- package/corpus/templates/calendar/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +30 -3
- package/corpus/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/clips/app/components/library/library-layout.tsx +37 -21
- package/corpus/templates/clips/changelog/2026-07-30-meeting-microphone-transcription-works-reliably-from-the-fir.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/clips/desktop/src/hooks/useMediaDevices.ts +1 -1
- package/corpus/templates/clips/desktop/src/lib/media-capture-constraints.ts +1 -1
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +13 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +2 -0
- package/corpus/templates/clips/desktop/src-tauri/src/system_audio.rs +25 -132
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +34 -17
- package/corpus/templates/content/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +6 -2
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +5 -0
- package/corpus/templates/design/actions/create-design-system.ts +1 -0
- package/corpus/templates/design/actions/set-default-design-system.ts +34 -26
- package/corpus/templates/design/app/components/design/KeyboardShortcutsPanel.tsx +5 -3
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +23 -0
- package/corpus/templates/design/app/components/design/keyboard-shortcuts.ts +3 -0
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +21 -4
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +11 -7
- package/corpus/templates/design/app/i18n-data.ts +39 -0
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +229 -12
- package/corpus/templates/design/app/pages/DesignSystems.tsx +10 -4
- package/corpus/templates/design/changelog/2026-07-30-fixed-the-keyboard-shortcuts-panel-not-opening-with-ctrl-shi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/design/changelog/2026-07-31-design-system-indexing-keeps-your-chosen-name-when-you-uploa.md +6 -0
- package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +19 -4
- package/corpus/templates/dispatch/AGENTS.md +4 -0
- package/corpus/templates/factory/.agents/skills/actions/SKILL.md +562 -0
- package/corpus/templates/factory/.agents/skills/adding-a-feature/SKILL.md +198 -0
- package/corpus/templates/factory/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/factory/.agents/skills/agent-native-toolkit/SKILL.md +182 -0
- package/corpus/templates/factory/.agents/skills/capture-learnings/SKILL.md +89 -0
- package/corpus/templates/factory/.agents/skills/create-skill/SKILL.md +221 -0
- package/corpus/templates/factory/.agents/skills/customizing-agent-native/SKILL.md +220 -0
- package/corpus/templates/factory/.agents/skills/delegate-to-agent/SKILL.md +263 -0
- package/corpus/templates/factory/.agents/skills/factory-graphs/SKILL.md +52 -0
- package/corpus/templates/factory/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +174 -0
- package/corpus/templates/factory/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/templates/factory/.agents/skills/security/SKILL.md +324 -0
- package/corpus/templates/factory/.agents/skills/self-modifying-code/SKILL.md +119 -0
- package/corpus/templates/factory/.agents/skills/shadcn-ui/SKILL.md +123 -0
- package/corpus/templates/factory/.agents/skills/sharing/SKILL.md +232 -0
- package/corpus/templates/factory/.agents/skills/storing-data/SKILL.md +178 -0
- package/corpus/templates/factory/.agents/skills/upgrade-agent-native/SKILL.md +122 -0
- package/corpus/templates/factory/.env.example +24 -0
- package/corpus/templates/factory/.ignore +0 -0
- package/corpus/templates/factory/.oxfmtrc.json +8 -0
- package/corpus/templates/factory/AGENTS.md +90 -0
- package/corpus/templates/factory/CHANGELOG.md +10 -0
- package/corpus/templates/factory/DEVELOPING.md +185 -0
- package/corpus/templates/factory/README.md +64 -0
- package/corpus/templates/factory/_gitignore +42 -0
- package/corpus/templates/factory/actions/add-factory-comment.ts +55 -0
- package/corpus/templates/factory/actions/approve-factory-item.ts +214 -0
- package/corpus/templates/factory/actions/babysit-pull-request.ts +126 -0
- package/corpus/templates/factory/actions/evaluate-triage-item.ts +172 -0
- package/corpus/templates/factory/actions/get-factory-graph.ts +62 -0
- package/corpus/templates/factory/actions/get-triage-config.ts +42 -0
- package/corpus/templates/factory/actions/get-triage-item.ts +74 -0
- package/corpus/templates/factory/actions/hello.ts +13 -0
- package/corpus/templates/factory/actions/ingest-github-observation.ts +100 -0
- package/corpus/templates/factory/actions/list-factories.ts +40 -0
- package/corpus/templates/factory/actions/list-factory-comments.ts +40 -0
- package/corpus/templates/factory/actions/list-triage-items.ts +85 -0
- package/corpus/templates/factory/actions/list-triage-rules.ts +44 -0
- package/corpus/templates/factory/actions/navigate.ts +41 -0
- package/corpus/templates/factory/actions/poll-slack-channel.ts +118 -0
- package/corpus/templates/factory/actions/reconcile-triage-run.ts +179 -0
- package/corpus/templates/factory/actions/record-triage-feedback.ts +58 -0
- package/corpus/templates/factory/actions/run.ts +2 -0
- package/corpus/templates/factory/actions/save-factory-graph.ts +129 -0
- package/corpus/templates/factory/actions/save-triage-config.ts +67 -0
- package/corpus/templates/factory/actions/save-triage-rule.ts +89 -0
- package/corpus/templates/factory/actions/suggest-factory-rules.ts +70 -0
- package/corpus/templates/factory/actions/view-screen.ts +73 -0
- package/corpus/templates/factory/app/components/factory/FactoryCanvas.tsx +441 -0
- package/corpus/templates/factory/app/components/factory/FactoryInspector.tsx +388 -0
- package/corpus/templates/factory/app/components/layout/Header.tsx +60 -0
- package/corpus/templates/factory/app/components/layout/Layout.tsx +190 -0
- package/corpus/templates/factory/app/components/layout/Sidebar.tsx +538 -0
- package/corpus/templates/factory/app/components/triage/triage-status-pill.tsx +28 -0
- package/corpus/templates/factory/app/components/ui/button.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/card.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/input.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/label.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/templates/factory/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/factory/app/design-system.ts +3 -0
- package/corpus/templates/factory/app/entry.client.tsx +22 -0
- package/corpus/templates/factory/app/entry.server.tsx +10 -0
- package/corpus/templates/factory/app/global.css +93 -0
- package/corpus/templates/factory/app/hooks/use-navigation-state.ts +113 -0
- package/corpus/templates/factory/app/i18n/en-US.ts +211 -0
- package/corpus/templates/factory/app/i18n/index.ts +34 -0
- package/corpus/templates/factory/app/i18n-data.ts +556 -0
- package/corpus/templates/factory/app/lib/agent-page.tsx +49 -0
- package/corpus/templates/factory/app/lib/app-config.ts +11 -0
- package/corpus/templates/factory/app/lib/tab-id.ts +1 -0
- package/corpus/templates/factory/app/lib/utils.ts +1 -0
- package/corpus/templates/factory/app/root.tsx +175 -0
- package/corpus/templates/factory/app/routes/_index.tsx +94 -0
- package/corpus/templates/factory/app/routes/agent.tsx +24 -0
- package/corpus/templates/factory/app/routes/chat.$threadId.tsx +1 -0
- package/corpus/templates/factory/app/routes/database.tsx +17 -0
- package/corpus/templates/factory/app/routes/extensions.$id.$slug.tsx +2 -0
- package/corpus/templates/factory/app/routes/extensions.$id.tsx +11 -0
- package/corpus/templates/factory/app/routes/extensions._index.tsx +11 -0
- package/corpus/templates/factory/app/routes/extensions.tsx +5 -0
- package/corpus/templates/factory/app/routes/factory.tsx +1003 -0
- package/corpus/templates/factory/app/routes/observability.tsx +19 -0
- package/corpus/templates/factory/app/routes/settings.tsx +89 -0
- package/corpus/templates/factory/app/routes/team.tsx +11 -0
- package/corpus/templates/factory/app/routes.ts +4 -0
- package/corpus/templates/factory/app/vite-env.d.ts +6 -0
- package/corpus/templates/factory/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/factory/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-recent-chats-are-easier-to-scan-and-expand.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-23-full-page-chat-is-better-centered-with-quieter-chat-history-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-31-added-an-inspectable-observe-only-factory-queue-for-slack-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/factory/components.json +20 -0
- package/corpus/templates/factory/data/sync-config.json +1 -0
- package/corpus/templates/factory/learnings.defaults.md +5 -0
- package/corpus/templates/factory/netlify.toml +10 -0
- package/corpus/templates/factory/package.json +105 -0
- package/corpus/templates/factory/public/agent-native-icon-dark.svg +10 -0
- package/corpus/templates/factory/public/agent-native-icon-light.svg +10 -0
- package/corpus/templates/factory/public/agent-native-logo-dark.svg +21 -0
- package/corpus/templates/factory/public/agent-native-logo-light.svg +21 -0
- package/corpus/templates/factory/public/favicon.svg +1 -0
- package/corpus/templates/factory/public/icon-180.svg +1 -0
- package/corpus/templates/factory/public/icon-192.svg +1 -0
- package/corpus/templates/factory/public/icon-512.svg +1 -0
- package/corpus/templates/factory/public/manifest.json +21 -0
- package/corpus/templates/factory/react-router.config.ts +7 -0
- package/corpus/templates/factory/server/connectors/credentials.ts +129 -0
- package/corpus/templates/factory/server/connectors/slack.ts +129 -0
- package/corpus/templates/factory/server/db/index.ts +6 -0
- package/corpus/templates/factory/server/db/schema.ts +193 -0
- package/corpus/templates/factory/server/factory-graph/contracts.ts +212 -0
- package/corpus/templates/factory/server/factory-graph/store.ts +121 -0
- package/corpus/templates/factory/server/lib/require-workspace-member.ts +55 -0
- package/corpus/templates/factory/server/middleware/auth.ts +15 -0
- package/corpus/templates/factory/server/plugins/agent-chat.ts +58 -0
- package/corpus/templates/factory/server/plugins/auth.ts +14 -0
- package/corpus/templates/factory/server/plugins/factory-migrations.ts +247 -0
- package/corpus/templates/factory/server/plugins/factory-scheduler-job.ts +116 -0
- package/corpus/templates/factory/server/plugins/integrations.ts +46 -0
- package/corpus/templates/factory/server/routes/[...page].get.ts +5 -0
- package/corpus/templates/factory/server/routes/_agent-native/factory/builder-callback.post.ts +116 -0
- package/corpus/templates/factory/server/triage/ai-services-git.ts +197 -0
- package/corpus/templates/factory/server/triage/builder-executor.ts +118 -0
- package/corpus/templates/factory/server/triage/contracts.ts +164 -0
- package/corpus/templates/factory/server/triage/github-ingestion.ts +35 -0
- package/corpus/templates/factory/server/triage/guards.ts +121 -0
- package/corpus/templates/factory/server/triage/ids.ts +27 -0
- package/corpus/templates/factory/server/triage/pr-babysit.ts +100 -0
- package/corpus/templates/factory/server/triage/pr-monitor.ts +220 -0
- package/corpus/templates/factory/server/triage/slack-client.ts +55 -0
- package/corpus/templates/factory/server/triage/slack-poller.ts +152 -0
- package/corpus/templates/factory/ssr-entry.ts +15 -0
- package/corpus/templates/factory/tsconfig.json +21 -0
- package/corpus/templates/factory/vite.config.ts +19 -0
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +55 -5
- package/corpus/templates/forms/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +6 -2
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +21 -6
- package/corpus/templates/plan/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +12 -0
- package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +9 -0
- package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +11 -0
- package/corpus/templates/slides/AGENTS.md +5 -6
- package/corpus/templates/slides/actions/_await-fit-check.ts +20 -10
- package/corpus/templates/slides/actions/add-slide.ts +17 -4
- package/corpus/templates/slides/actions/create-design-system.ts +16 -4
- package/corpus/templates/slides/actions/delete-design-system.ts +18 -2
- package/corpus/templates/slides/actions/get-layout-overflows.ts +88 -0
- package/corpus/templates/slides/actions/import-file.ts +1 -0
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +8 -0
- package/corpus/templates/slides/actions/patch-deck.ts +48 -16
- package/corpus/templates/slides/actions/set-default-design-system.ts +49 -19
- package/corpus/templates/slides/actions/update-slide.ts +13 -3
- package/corpus/templates/slides/actions/view-screen.ts +87 -10
- package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +155 -28
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +21 -17
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +849 -341
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +102 -2
- package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +13 -16
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +60 -12
- package/corpus/templates/slides/app/components/editor/SlideOverflowWarning.tsx +11 -1
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +66 -19
- package/corpus/templates/slides/app/i18n/en-US.ts +23 -0
- package/corpus/templates/slides/app/lib/normalize-slide-padding.ts +8 -15
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +4 -3
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +4 -3
- package/corpus/templates/slides/app/pages/Index.tsx +1 -1
- package/corpus/templates/slides/changelog/2026-07-31-design-system-details-now-show-their-source-and-indexing-sta.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-design-system-indexing-keeps-your-chosen-name-when-you-uploa.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-design-system-setup-keeps-focus-rings-visible-and-uses-a-sim.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-skip-prompt-is-now-available-in-the-new-deck-prompt-header.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-slides-now-detect-real-text-and-box-overflow-across-the-deck.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/slides/server/handlers/design-systems.ts +1 -0
- package/corpus/templates/slides/server/handlers/index-design-system-sources.ts +1 -0
- package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +23 -4
- package/corpus/templates/slides/server/plugins/agent-chat.ts +5 -0
- package/corpus/templates/slides/server/plugins/creative-context.ts +16 -3
- package/corpus/templates/slides/server/workspace-defaults.ts +5 -1
- package/corpus/templates/slides/shared/slide-fit.ts +26 -0
- package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +30 -3
- package/corpus/templates/tasks/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/dist/a2a/correlation.d.ts +4 -1
- package/dist/a2a/correlation.d.ts.map +1 -1
- package/dist/a2a/correlation.js +8 -1
- package/dist/a2a/correlation.js.map +1 -1
- package/dist/a2a/types.d.ts +11 -3
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +27 -41
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +18 -8
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/error-detail.d.ts +61 -0
- package/dist/agent/engine/error-detail.d.ts.map +1 -1
- package/dist/agent/engine/error-detail.js +145 -3
- package/dist/agent/engine/error-detail.js.map +1 -1
- package/dist/agent/engine/failure-taxonomy.d.ts +24 -0
- package/dist/agent/engine/failure-taxonomy.d.ts.map +1 -0
- package/dist/agent/engine/failure-taxonomy.js +88 -0
- package/dist/agent/engine/failure-taxonomy.js.map +1 -0
- package/dist/agent/engine/index.d.ts +2 -1
- package/dist/agent/engine/index.d.ts.map +1 -1
- package/dist/agent/engine/index.js +2 -1
- package/dist/agent/engine/index.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +16 -0
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +71 -6
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/engine/translate-ai-sdk.d.ts.map +1 -1
- package/dist/agent/engine/translate-ai-sdk.js +14 -2
- package/dist/agent/engine/translate-ai-sdk.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +13 -24
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.js +1 -1
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +39 -10
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +10 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +20 -3
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +28 -4
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/chat-threads/store.d.ts +13 -0
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +35 -0
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +13 -0
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +1 -0
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/error-format.d.ts.map +1 -1
- package/dist/client/error-format.js +10 -0
- package/dist/client/error-format.js.map +1 -1
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +66 -16
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/credentials/index.d.ts +9 -2
- package/dist/credentials/index.d.ts.map +1 -1
- package/dist/credentials/index.js +50 -8
- package/dist/credentials/index.js.map +1 -1
- package/dist/extensions/url-safety.d.ts.map +1 -1
- package/dist/extensions/url-safety.js +38 -12
- package/dist/extensions/url-safety.js.map +1 -1
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +25 -8
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/google-docs-poller.d.ts.map +1 -1
- package/dist/integrations/google-docs-poller.js +13 -1
- package/dist/integrations/google-docs-poller.js.map +1 -1
- package/dist/integrations/installations-store.d.ts +10 -0
- package/dist/integrations/installations-store.d.ts.map +1 -1
- package/dist/integrations/installations-store.js +24 -0
- package/dist/integrations/installations-store.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +6 -5
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/types.d.ts +7 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +16 -1
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/background-automation-runner.d.ts.map +1 -1
- package/dist/jobs/background-automation-runner.js +35 -2
- package/dist/jobs/background-automation-runner.js.map +1 -1
- package/dist/notifications/routes.d.ts +6 -6
- package/dist/observability/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +14 -14
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/provider-api/index.js +7 -3
- package/dist/provider-api/index.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +6 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +38 -9
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts +2 -0
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/builder-design-systems.d.ts +4 -1
- package/dist/server/builder-design-systems.d.ts.map +1 -1
- package/dist/server/builder-design-systems.js +11 -1
- package/dist/server/builder-design-systems.js.map +1 -1
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +49 -12
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +37 -2
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/reasoning-effort.d.ts +1 -0
- package/dist/shared/reasoning-effort.d.ts.map +1 -1
- package/dist/shared/reasoning-effort.js +1 -1
- package/dist/shared/reasoning-effort.js.map +1 -1
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +30 -3
- package/dist/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
- package/package.json +1 -1
- package/src/a2a/correlation.ts +11 -1
- package/src/a2a/types.ts +11 -3
- package/src/agent/engine/ai-sdk-engine.ts +33 -46
- package/src/agent/engine/builder-engine.ts +22 -10
- package/src/agent/engine/error-detail.ts +184 -3
- package/src/agent/engine/failure-taxonomy.ts +123 -0
- package/src/agent/engine/index.ts +8 -0
- package/src/agent/engine/registry.ts +92 -8
- package/src/agent/engine/translate-ai-sdk.ts +17 -2
- package/src/agent/production-agent.ts +13 -33
- package/src/agent/run-loop-with-resume.ts +1 -1
- package/src/agent/run-manager.ts +43 -14
- package/src/agent/run-store.ts +30 -3
- package/src/agent/thread-data-builder.ts +36 -4
- package/src/chat-threads/store.ts +42 -0
- package/src/cli/templates-meta.ts +13 -0
- package/src/cli/workspace-dev.ts +1 -0
- package/src/client/error-format.ts +12 -0
- package/src/client/use-chat-threads.ts +76 -16
- package/src/credentials/index.ts +51 -12
- package/src/extensions/url-safety.ts +46 -12
- package/src/integrations/adapters/slack.ts +32 -10
- package/src/integrations/google-docs-poller.ts +12 -1
- package/src/integrations/installations-store.ts +30 -0
- package/src/integrations/plugin.ts +5 -5
- package/src/integrations/types.ts +7 -0
- package/src/integrations/webhook-handler.ts +24 -1
- package/src/jobs/background-automation-runner.ts +38 -1
- package/src/provider-api/index.ts +8 -2
- package/src/scripts/call-agent.ts +6 -0
- package/src/server/agent-chat-plugin.ts +46 -10
- package/src/server/agent-discovery.ts +2 -0
- package/src/server/builder-design-systems.ts +21 -0
- package/src/server/credential-provider.ts +51 -12
- package/src/server/index.ts +1 -0
- package/src/server/onboarding-html.ts +37 -2
- package/src/shared/reasoning-effort.ts +1 -1
- package/src/templates/chat/app/components/layout/Sidebar.tsx +30 -3
- package/src/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
- package/corpus/templates/clips/desktop/src/lib/media-device-selection.ts +0 -157
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { and, desc, eq } from "drizzle-orm";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { getDb } from "../server/db/index.js";
|
|
6
|
+
import { triageItems, triageDecisions } from "../server/db/schema.js";
|
|
7
|
+
import {
|
|
8
|
+
requireWorkspaceMember,
|
|
9
|
+
workspaceMemberIdentityFromContext,
|
|
10
|
+
} from "../server/lib/require-workspace-member.js";
|
|
11
|
+
import { triageItemStatusSchema } from "../server/triage/contracts.js";
|
|
12
|
+
|
|
13
|
+
export default defineAction({
|
|
14
|
+
description:
|
|
15
|
+
"List the Factory observation queue. Results are scoped to the active workspace and include the latest shadow decision summary.",
|
|
16
|
+
schema: z.object({
|
|
17
|
+
status: triageItemStatusSchema.optional(),
|
|
18
|
+
limit: z.coerce.number().int().min(1).max(100).default(50),
|
|
19
|
+
}),
|
|
20
|
+
http: { method: "GET" },
|
|
21
|
+
readOnly: true,
|
|
22
|
+
run: async ({ status, limit }, context) => {
|
|
23
|
+
const { orgId } = await requireWorkspaceMember(
|
|
24
|
+
workspaceMemberIdentityFromContext(context),
|
|
25
|
+
);
|
|
26
|
+
const db = getDb();
|
|
27
|
+
const items = await db
|
|
28
|
+
.select()
|
|
29
|
+
.from(triageItems)
|
|
30
|
+
.where(
|
|
31
|
+
and(
|
|
32
|
+
eq(triageItems.orgId, orgId),
|
|
33
|
+
status ? eq(triageItems.status, status) : undefined,
|
|
34
|
+
),
|
|
35
|
+
)
|
|
36
|
+
.orderBy(desc(triageItems.updatedAt))
|
|
37
|
+
.limit(limit);
|
|
38
|
+
|
|
39
|
+
const decisions = await db
|
|
40
|
+
.select()
|
|
41
|
+
.from(triageDecisions)
|
|
42
|
+
.where(eq(triageDecisions.orgId, orgId))
|
|
43
|
+
.orderBy(desc(triageDecisions.createdAt))
|
|
44
|
+
.limit(500);
|
|
45
|
+
const latestByItem = new Map<string, (typeof decisions)[number]>();
|
|
46
|
+
for (const decision of decisions) {
|
|
47
|
+
if (!latestByItem.has(decision.itemId)) {
|
|
48
|
+
latestByItem.set(decision.itemId, decision);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return items.map((item) => {
|
|
53
|
+
const latestDecision = latestByItem.get(item.id);
|
|
54
|
+
return {
|
|
55
|
+
id: item.id,
|
|
56
|
+
itemId: item.id,
|
|
57
|
+
source: item.source,
|
|
58
|
+
sourceName: item.source,
|
|
59
|
+
externalId: item.externalId,
|
|
60
|
+
sourceUrl: item.sourceUrl,
|
|
61
|
+
title: item.title,
|
|
62
|
+
summary: item.summary,
|
|
63
|
+
status: item.status,
|
|
64
|
+
risk: item.risk,
|
|
65
|
+
coverage: item.coverage,
|
|
66
|
+
repository: item.repository,
|
|
67
|
+
pullRequestNumber: item.pullRequestNumber,
|
|
68
|
+
headSha: item.headSha,
|
|
69
|
+
createdAt: item.createdAt,
|
|
70
|
+
updatedAt: item.updatedAt,
|
|
71
|
+
reason: latestDecision?.reason ?? null,
|
|
72
|
+
decisionSummary: latestDecision?.reason ?? null,
|
|
73
|
+
latestDecision: latestDecision
|
|
74
|
+
? {
|
|
75
|
+
id: latestDecision.id,
|
|
76
|
+
outcome: latestDecision.outcome,
|
|
77
|
+
reason: latestDecision.reason,
|
|
78
|
+
mode: latestDecision.mode,
|
|
79
|
+
createdAt: latestDecision.createdAt,
|
|
80
|
+
}
|
|
81
|
+
: null,
|
|
82
|
+
};
|
|
83
|
+
});
|
|
84
|
+
},
|
|
85
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { desc, eq } from "drizzle-orm";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { getDb } from "../server/db/index.js";
|
|
6
|
+
import { triageRules } from "../server/db/schema.js";
|
|
7
|
+
import {
|
|
8
|
+
requireWorkspaceMember,
|
|
9
|
+
workspaceMemberIdentityFromContext,
|
|
10
|
+
} from "../server/lib/require-workspace-member.js";
|
|
11
|
+
import { normalizeTriagePolicyGuards } from "../server/triage/contracts.js";
|
|
12
|
+
|
|
13
|
+
export default defineAction({
|
|
14
|
+
description:
|
|
15
|
+
"List editable Factory rules for the active workspace. Rules are disabled or shadow-only until the owner explicitly promotes them.",
|
|
16
|
+
schema: z.object({}),
|
|
17
|
+
http: { method: "GET" },
|
|
18
|
+
readOnly: true,
|
|
19
|
+
run: async (_, context) => {
|
|
20
|
+
const { orgId } = await requireWorkspaceMember(
|
|
21
|
+
workspaceMemberIdentityFromContext(context),
|
|
22
|
+
);
|
|
23
|
+
const rows = await getDb()
|
|
24
|
+
.select()
|
|
25
|
+
.from(triageRules)
|
|
26
|
+
.where(eq(triageRules.orgId, orgId))
|
|
27
|
+
.orderBy(desc(triageRules.updatedAt));
|
|
28
|
+
return rows.map((row) => ({
|
|
29
|
+
...row,
|
|
30
|
+
enabled: row.enabled === 1,
|
|
31
|
+
guards: parseGuards(row.guardsJson),
|
|
32
|
+
}));
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
function parseGuards(value: string) {
|
|
37
|
+
try {
|
|
38
|
+
return normalizeTriagePolicyGuards(JSON.parse(value));
|
|
39
|
+
} catch (error) {
|
|
40
|
+
throw new Error(
|
|
41
|
+
`Triage rule guards are unreadable: ${error instanceof Error ? error.message : String(error)}`,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Navigate the UI to a view.
|
|
3
|
+
*
|
|
4
|
+
* Writes a navigate command to application state which the UI reads and auto-deletes.
|
|
5
|
+
*
|
|
6
|
+
* Usage:
|
|
7
|
+
* pnpm action navigate --view=chat
|
|
8
|
+
* pnpm action navigate --path=/some/route
|
|
9
|
+
*
|
|
10
|
+
* Options:
|
|
11
|
+
* --view View name to navigate to
|
|
12
|
+
* --path URL path to navigate to
|
|
13
|
+
* --threadId Chat thread ID to open on the chat route
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
import { defineAction } from "@agent-native/core/action";
|
|
17
|
+
import { writeAppState } from "@agent-native/core/application-state";
|
|
18
|
+
import { z } from "zod";
|
|
19
|
+
|
|
20
|
+
export default defineAction({
|
|
21
|
+
description:
|
|
22
|
+
"Navigate the UI to a specific view or path. Writes a navigate command to application state which the UI reads and auto-deletes.",
|
|
23
|
+
schema: z.object({
|
|
24
|
+
view: z.string().optional().describe("View name to navigate to"),
|
|
25
|
+
path: z.string().optional().describe("URL path to navigate to"),
|
|
26
|
+
threadId: z.string().optional().describe("Chat thread ID to open"),
|
|
27
|
+
}),
|
|
28
|
+
http: false,
|
|
29
|
+
run: async (args) => {
|
|
30
|
+
if (!args.view && !args.path) {
|
|
31
|
+
throw new Error("At least --view or --path is required.");
|
|
32
|
+
}
|
|
33
|
+
const nav: Record<string, string> = {};
|
|
34
|
+
if (args.view) nav.view = args.view;
|
|
35
|
+
if (args.path) nav.path = args.path;
|
|
36
|
+
if (args.threadId) nav.threadId = args.threadId;
|
|
37
|
+
nav._writeId = `${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
38
|
+
await writeAppState("navigate", nav);
|
|
39
|
+
return `Navigating to ${args.view || args.path}`;
|
|
40
|
+
},
|
|
41
|
+
});
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { and, eq } from "drizzle-orm";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { getDb } from "../server/db/index.js";
|
|
6
|
+
import { triageConfig, triageItems } from "../server/db/schema.js";
|
|
7
|
+
import {
|
|
8
|
+
requireWorkspaceMember,
|
|
9
|
+
workspaceMemberIdentityFromContext,
|
|
10
|
+
} from "../server/lib/require-workspace-member.js";
|
|
11
|
+
import { itemDedupeKey } from "../server/triage/ids.js";
|
|
12
|
+
import { pollSlackChannel } from "../server/triage/slack-poller.js";
|
|
13
|
+
|
|
14
|
+
export default defineAction({
|
|
15
|
+
description:
|
|
16
|
+
"Poll the configured Slack channel and append new messages to the Factory queue. This action only observes and never posts, replies, starts work, or changes a provider.",
|
|
17
|
+
schema: z.object({
|
|
18
|
+
channelId: z.string().trim().min(1).max(128).optional(),
|
|
19
|
+
}),
|
|
20
|
+
http: { method: "POST" },
|
|
21
|
+
run: async ({ channelId: requestedChannelId }, context) => {
|
|
22
|
+
const { userEmail, orgId } = await requireWorkspaceMember(
|
|
23
|
+
workspaceMemberIdentityFromContext(context),
|
|
24
|
+
);
|
|
25
|
+
const db = getDb();
|
|
26
|
+
const config = (
|
|
27
|
+
await db
|
|
28
|
+
.select()
|
|
29
|
+
.from(triageConfig)
|
|
30
|
+
.where(eq(triageConfig.id, orgId))
|
|
31
|
+
.limit(1)
|
|
32
|
+
)[0];
|
|
33
|
+
const channelId = requestedChannelId ?? config?.slackChannelId;
|
|
34
|
+
if (!channelId) {
|
|
35
|
+
throw new Error("Configure a Slack channel before polling.");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const result = await pollSlackChannel({
|
|
39
|
+
workspace:
|
|
40
|
+
config?.slackWorkspace === "secondary" ? "secondary" : "primary",
|
|
41
|
+
channelId,
|
|
42
|
+
priorLastSlackTs: config?.lastSlackTs ?? "0",
|
|
43
|
+
historyCursor: config?.slackHistoryCursor,
|
|
44
|
+
ownerEmail: userEmail,
|
|
45
|
+
orgId,
|
|
46
|
+
});
|
|
47
|
+
const now = new Date().toISOString();
|
|
48
|
+
|
|
49
|
+
await db.transaction(async (tx) => {
|
|
50
|
+
for (const envelope of result.envelopes) {
|
|
51
|
+
const id = itemDedupeKey(envelope, orgId);
|
|
52
|
+
await tx
|
|
53
|
+
.insert(triageItems)
|
|
54
|
+
.values({
|
|
55
|
+
id,
|
|
56
|
+
source: envelope.source,
|
|
57
|
+
externalId: envelope.externalId,
|
|
58
|
+
sourceUrl: envelope.sourceUrl ?? null,
|
|
59
|
+
title: envelope.title,
|
|
60
|
+
summary: envelope.summary ?? null,
|
|
61
|
+
status: "received",
|
|
62
|
+
risk: "unknown",
|
|
63
|
+
channelId: envelope.channelId ?? null,
|
|
64
|
+
threadTs: envelope.threadTs ?? null,
|
|
65
|
+
repository: envelope.repository ?? null,
|
|
66
|
+
pullRequestNumber: envelope.pullRequestNumber ?? null,
|
|
67
|
+
headSha: envelope.headSha ?? null,
|
|
68
|
+
coverage: envelope.coverage,
|
|
69
|
+
dedupeKey: id,
|
|
70
|
+
metadataJson: JSON.stringify(envelope.metadata ?? {}),
|
|
71
|
+
lastSeenAt: now,
|
|
72
|
+
createdAt: now,
|
|
73
|
+
updatedAt: now,
|
|
74
|
+
ownerEmail: userEmail,
|
|
75
|
+
orgId,
|
|
76
|
+
})
|
|
77
|
+
.onConflictDoUpdate({
|
|
78
|
+
target: triageItems.id,
|
|
79
|
+
set: {
|
|
80
|
+
sourceUrl: envelope.sourceUrl ?? null,
|
|
81
|
+
title: envelope.title,
|
|
82
|
+
summary: envelope.summary ?? null,
|
|
83
|
+
channelId: envelope.channelId ?? null,
|
|
84
|
+
threadTs: envelope.threadTs ?? null,
|
|
85
|
+
coverage: envelope.coverage,
|
|
86
|
+
metadataJson: JSON.stringify(envelope.metadata ?? {}),
|
|
87
|
+
lastSeenAt: now,
|
|
88
|
+
updatedAt: now,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
if (config) {
|
|
94
|
+
await tx
|
|
95
|
+
.update(triageConfig)
|
|
96
|
+
.set({
|
|
97
|
+
lastSlackTs: result.nextLastSlackTs,
|
|
98
|
+
slackHistoryCursor: result.nextHistoryCursor,
|
|
99
|
+
updatedAt: now,
|
|
100
|
+
})
|
|
101
|
+
.where(
|
|
102
|
+
and(eq(triageConfig.id, orgId), eq(triageConfig.orgId, orgId)),
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
return {
|
|
108
|
+
ok: true,
|
|
109
|
+
source: "slack",
|
|
110
|
+
channelId,
|
|
111
|
+
observed: result.envelopes.length,
|
|
112
|
+
hasMore: result.hasMore,
|
|
113
|
+
nextLastSlackTs: result.nextLastSlackTs,
|
|
114
|
+
nextHistoryCursor: result.nextHistoryCursor,
|
|
115
|
+
coverage: result.hasMore ? "partial" : "complete",
|
|
116
|
+
};
|
|
117
|
+
},
|
|
118
|
+
});
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { and, eq } from "drizzle-orm";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { getDb } from "../server/db/index.js";
|
|
6
|
+
import { triageItems, triageRuns } from "../server/db/schema.js";
|
|
7
|
+
import {
|
|
8
|
+
requireWorkspaceMember,
|
|
9
|
+
workspaceMemberIdentityFromContext,
|
|
10
|
+
} from "../server/lib/require-workspace-member.js";
|
|
11
|
+
import {
|
|
12
|
+
executorStateSchema,
|
|
13
|
+
triageSourceSchema,
|
|
14
|
+
} from "../server/triage/contracts.js";
|
|
15
|
+
import { stableId } from "../server/triage/ids.js";
|
|
16
|
+
import {
|
|
17
|
+
reconcilePullRequestRun,
|
|
18
|
+
type PullRequestObservation,
|
|
19
|
+
} from "../server/triage/pr-monitor.js";
|
|
20
|
+
|
|
21
|
+
const reviewSchema = z.object({
|
|
22
|
+
author: z.string(),
|
|
23
|
+
state: z.enum(["approved", "changes_requested", "commented", "pending"]),
|
|
24
|
+
observedAt: z.string().datetime(),
|
|
25
|
+
});
|
|
26
|
+
const checkSchema = z.object({
|
|
27
|
+
name: z.string(),
|
|
28
|
+
state: z.enum(["queued", "in_progress", "passed", "failed", "cancelled"]),
|
|
29
|
+
observedAt: z.string().datetime(),
|
|
30
|
+
});
|
|
31
|
+
const observationSchema: z.ZodType<PullRequestObservation> = z.object({
|
|
32
|
+
repo: z.string(),
|
|
33
|
+
pullRequestNumber: z.number().int().positive(),
|
|
34
|
+
headSha: z.string(),
|
|
35
|
+
reviews: z.array(reviewSchema),
|
|
36
|
+
checks: z.array(checkSchema),
|
|
37
|
+
observedAt: z.string().datetime(),
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
export default defineAction({
|
|
41
|
+
description:
|
|
42
|
+
"Reconcile an observe-only pull-request monitoring run from ai-services callback and provider observations. Missing callbacks or provider reads remain typed failure states; no executor or GitHub write occurs.",
|
|
43
|
+
schema: z.object({
|
|
44
|
+
itemId: z.string().min(1),
|
|
45
|
+
runId: z.string().min(1),
|
|
46
|
+
source: triageSourceSchema.default("github"),
|
|
47
|
+
callback: z
|
|
48
|
+
.object({
|
|
49
|
+
state: executorStateSchema,
|
|
50
|
+
observedAt: z.string().datetime(),
|
|
51
|
+
terminalReason: z.string().optional(),
|
|
52
|
+
})
|
|
53
|
+
.optional(),
|
|
54
|
+
providerObservation: observationSchema.optional(),
|
|
55
|
+
heartbeatAt: z.string().datetime().optional(),
|
|
56
|
+
timeoutMs: z
|
|
57
|
+
.number()
|
|
58
|
+
.int()
|
|
59
|
+
.positive()
|
|
60
|
+
.default(15 * 60_000),
|
|
61
|
+
}),
|
|
62
|
+
http: { method: "POST" },
|
|
63
|
+
agentTool: false,
|
|
64
|
+
run: async (
|
|
65
|
+
{
|
|
66
|
+
itemId,
|
|
67
|
+
runId,
|
|
68
|
+
source,
|
|
69
|
+
callback,
|
|
70
|
+
providerObservation,
|
|
71
|
+
heartbeatAt,
|
|
72
|
+
timeoutMs,
|
|
73
|
+
},
|
|
74
|
+
context,
|
|
75
|
+
) => {
|
|
76
|
+
const { userEmail, orgId } = await requireWorkspaceMember(
|
|
77
|
+
workspaceMemberIdentityFromContext(context),
|
|
78
|
+
);
|
|
79
|
+
const now = new Date().toISOString();
|
|
80
|
+
const databaseRunId = stableId("run", orgId, runId);
|
|
81
|
+
const result = reconcilePullRequestRun({
|
|
82
|
+
triageItemId: itemId,
|
|
83
|
+
runId,
|
|
84
|
+
callback,
|
|
85
|
+
providerObservation,
|
|
86
|
+
heartbeatAt,
|
|
87
|
+
now,
|
|
88
|
+
timeoutMs,
|
|
89
|
+
});
|
|
90
|
+
const db = getDb();
|
|
91
|
+
const existingRun = (
|
|
92
|
+
await db
|
|
93
|
+
.select({ progressLogJson: triageRuns.progressLogJson })
|
|
94
|
+
.from(triageRuns)
|
|
95
|
+
.where(
|
|
96
|
+
and(eq(triageRuns.id, databaseRunId), eq(triageRuns.orgId, orgId)),
|
|
97
|
+
)
|
|
98
|
+
.limit(1)
|
|
99
|
+
)[0];
|
|
100
|
+
const progressLog = appendProgressLog(existingRun?.progressLogJson, {
|
|
101
|
+
at: now,
|
|
102
|
+
state: result.state,
|
|
103
|
+
reason: result.reason,
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
await db.transaction(async (tx) => {
|
|
107
|
+
await tx
|
|
108
|
+
.insert(triageRuns)
|
|
109
|
+
.values({
|
|
110
|
+
id: databaseRunId,
|
|
111
|
+
itemId,
|
|
112
|
+
source,
|
|
113
|
+
status: result.state,
|
|
114
|
+
progressLogJson: JSON.stringify(progressLog),
|
|
115
|
+
dispatchAttempts: 0,
|
|
116
|
+
needsContinuation: result.state === "reconciliation_required" ? 1 : 0,
|
|
117
|
+
startedAt: callback?.observedAt ?? now,
|
|
118
|
+
heartbeatAt: now,
|
|
119
|
+
completedAt: result.terminalState ? now : null,
|
|
120
|
+
error:
|
|
121
|
+
result.state === "failed" ||
|
|
122
|
+
result.state === "timed_out" ||
|
|
123
|
+
result.state === "reconciliation_required"
|
|
124
|
+
? result.reason
|
|
125
|
+
: null,
|
|
126
|
+
ownerEmail: userEmail,
|
|
127
|
+
orgId,
|
|
128
|
+
})
|
|
129
|
+
.onConflictDoUpdate({
|
|
130
|
+
target: triageRuns.id,
|
|
131
|
+
set: {
|
|
132
|
+
status: result.state,
|
|
133
|
+
progressLogJson: JSON.stringify(progressLog),
|
|
134
|
+
needsContinuation:
|
|
135
|
+
result.state === "reconciliation_required" ? 1 : 0,
|
|
136
|
+
heartbeatAt: now,
|
|
137
|
+
completedAt: result.terminalState ? now : null,
|
|
138
|
+
error:
|
|
139
|
+
result.state === "failed" ||
|
|
140
|
+
result.state === "timed_out" ||
|
|
141
|
+
result.state === "reconciliation_required"
|
|
142
|
+
? result.reason
|
|
143
|
+
: null,
|
|
144
|
+
},
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
if (result.triageItemPatch) {
|
|
148
|
+
await tx
|
|
149
|
+
.update(triageItems)
|
|
150
|
+
.set(result.triageItemPatch)
|
|
151
|
+
.where(and(eq(triageItems.id, itemId), eq(triageItems.orgId, orgId)));
|
|
152
|
+
} else if (result.state === "reconciliation_required") {
|
|
153
|
+
await tx
|
|
154
|
+
.update(triageItems)
|
|
155
|
+
.set({ status: "reconciliation_required", updatedAt: now })
|
|
156
|
+
.where(and(eq(triageItems.id, itemId), eq(triageItems.orgId, orgId)));
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
return result;
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
function appendProgressLog(
|
|
165
|
+
value: string | undefined,
|
|
166
|
+
entry: { at: string; state: string; reason: string },
|
|
167
|
+
) {
|
|
168
|
+
if (!value) return [entry];
|
|
169
|
+
let parsed: unknown;
|
|
170
|
+
try {
|
|
171
|
+
parsed = JSON.parse(value);
|
|
172
|
+
} catch {
|
|
173
|
+
throw new Error("Triage run progress log is unreadable.");
|
|
174
|
+
}
|
|
175
|
+
if (!Array.isArray(parsed)) {
|
|
176
|
+
throw new Error("Triage run progress log is unreadable.");
|
|
177
|
+
}
|
|
178
|
+
return [...parsed, entry].slice(-100);
|
|
179
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { defineAction } from "@agent-native/core/action";
|
|
4
|
+
import { and, eq } from "drizzle-orm";
|
|
5
|
+
import { z } from "zod";
|
|
6
|
+
|
|
7
|
+
import { getDb } from "../server/db/index.js";
|
|
8
|
+
import { triageDecisions, triageFeedback } from "../server/db/schema.js";
|
|
9
|
+
import {
|
|
10
|
+
requireWorkspaceMember,
|
|
11
|
+
workspaceMemberIdentityFromContext,
|
|
12
|
+
} from "../server/lib/require-workspace-member.js";
|
|
13
|
+
|
|
14
|
+
const verdictSchema = z.enum(["correct", "incorrect", "uncertain"]);
|
|
15
|
+
|
|
16
|
+
export default defineAction({
|
|
17
|
+
description:
|
|
18
|
+
"Record human feedback on a Factory shadow decision. Feedback is append-only and changes no provider or executor state.",
|
|
19
|
+
schema: z.object({
|
|
20
|
+
decisionId: z.string().min(1),
|
|
21
|
+
verdict: verdictSchema,
|
|
22
|
+
note: z.string().trim().max(2_000).optional(),
|
|
23
|
+
}),
|
|
24
|
+
http: { method: "POST" },
|
|
25
|
+
run: async ({ decisionId, verdict, note }, context) => {
|
|
26
|
+
const { userEmail, orgId } = await requireWorkspaceMember(
|
|
27
|
+
workspaceMemberIdentityFromContext(context),
|
|
28
|
+
);
|
|
29
|
+
const decision = (
|
|
30
|
+
await getDb()
|
|
31
|
+
.select({ id: triageDecisions.id })
|
|
32
|
+
.from(triageDecisions)
|
|
33
|
+
.where(
|
|
34
|
+
and(
|
|
35
|
+
eq(triageDecisions.id, decisionId),
|
|
36
|
+
eq(triageDecisions.orgId, orgId),
|
|
37
|
+
),
|
|
38
|
+
)
|
|
39
|
+
.limit(1)
|
|
40
|
+
)[0];
|
|
41
|
+
if (!decision) throw new Error("Triage decision not found");
|
|
42
|
+
|
|
43
|
+
const createdAt = new Date().toISOString();
|
|
44
|
+
const id = randomUUID();
|
|
45
|
+
await getDb()
|
|
46
|
+
.insert(triageFeedback)
|
|
47
|
+
.values({
|
|
48
|
+
id,
|
|
49
|
+
decisionId,
|
|
50
|
+
verdict,
|
|
51
|
+
note: note ?? null,
|
|
52
|
+
createdAt,
|
|
53
|
+
ownerEmail: userEmail,
|
|
54
|
+
orgId,
|
|
55
|
+
});
|
|
56
|
+
return { ok: true, id };
|
|
57
|
+
},
|
|
58
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { buildDeepLink } from "@agent-native/core/server";
|
|
3
|
+
import { and, eq } from "drizzle-orm";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
import { getDb } from "../server/db/index.js";
|
|
7
|
+
import {
|
|
8
|
+
factoryDefinitions,
|
|
9
|
+
factoryGraphVersions,
|
|
10
|
+
} from "../server/db/schema.js";
|
|
11
|
+
import {
|
|
12
|
+
factoryGraphSchema,
|
|
13
|
+
normalizeFactoryGraph,
|
|
14
|
+
} from "../server/factory-graph/contracts.js";
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_FACTORY_ID,
|
|
17
|
+
readFactoryDefinition,
|
|
18
|
+
} from "../server/factory-graph/store.js";
|
|
19
|
+
import {
|
|
20
|
+
requireWorkspaceMember,
|
|
21
|
+
workspaceMemberIdentityFromContext,
|
|
22
|
+
} from "../server/lib/require-workspace-member.js";
|
|
23
|
+
import { stableId } from "../server/triage/ids.js";
|
|
24
|
+
|
|
25
|
+
export default defineAction({
|
|
26
|
+
description:
|
|
27
|
+
"Create or update a Factory's versioned visual graph. Use source=ai for an agent-proposed graph and source=manual for a direct editor save. This changes configuration only; it never starts provider work.",
|
|
28
|
+
schema: z.object({
|
|
29
|
+
factoryId: z
|
|
30
|
+
.string()
|
|
31
|
+
.trim()
|
|
32
|
+
.min(1)
|
|
33
|
+
.max(120)
|
|
34
|
+
.regex(/^[a-z0-9][a-z0-9-]*$/)
|
|
35
|
+
.default(DEFAULT_FACTORY_ID),
|
|
36
|
+
name: z.string().trim().min(1).max(120),
|
|
37
|
+
description: z.string().trim().max(500).default(""),
|
|
38
|
+
prompt: z.string().trim().max(10_000).default(""),
|
|
39
|
+
source: z.enum(["manual", "ai", "seed"]).default("manual"),
|
|
40
|
+
changeSummary: z.string().trim().max(500).default(""),
|
|
41
|
+
graph: factoryGraphSchema,
|
|
42
|
+
}),
|
|
43
|
+
link: ({ result }) => ({
|
|
44
|
+
url: buildDeepLink({
|
|
45
|
+
app: "factory",
|
|
46
|
+
view: "factory",
|
|
47
|
+
params: { factoryId: result.factoryId },
|
|
48
|
+
}),
|
|
49
|
+
label: `Open ${result.name} in Factory`,
|
|
50
|
+
}),
|
|
51
|
+
run: async (
|
|
52
|
+
{ factoryId, name, description, prompt, source, changeSummary, graph },
|
|
53
|
+
context,
|
|
54
|
+
) => {
|
|
55
|
+
const { userEmail, orgId } = await requireWorkspaceMember(
|
|
56
|
+
workspaceMemberIdentityFromContext(context),
|
|
57
|
+
);
|
|
58
|
+
const db = getDb();
|
|
59
|
+
const existing = await readFactoryDefinition(orgId, factoryId);
|
|
60
|
+
const nextVersion = (existing?.graphVersion ?? 0) + 1;
|
|
61
|
+
const normalizedGraph = normalizeFactoryGraph({
|
|
62
|
+
...graph,
|
|
63
|
+
version: nextVersion,
|
|
64
|
+
name,
|
|
65
|
+
description,
|
|
66
|
+
});
|
|
67
|
+
const now = new Date().toISOString();
|
|
68
|
+
const versionId = stableId(
|
|
69
|
+
"factory-graph",
|
|
70
|
+
orgId,
|
|
71
|
+
factoryId,
|
|
72
|
+
String(nextVersion),
|
|
73
|
+
);
|
|
74
|
+
|
|
75
|
+
await db.insert(factoryGraphVersions).values({
|
|
76
|
+
id: versionId,
|
|
77
|
+
factoryId,
|
|
78
|
+
version: nextVersion,
|
|
79
|
+
graphJson: JSON.stringify(normalizedGraph),
|
|
80
|
+
source,
|
|
81
|
+
changeSummary,
|
|
82
|
+
createdAt: now,
|
|
83
|
+
createdBy: userEmail,
|
|
84
|
+
ownerEmail: userEmail,
|
|
85
|
+
orgId,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (existing) {
|
|
89
|
+
await db
|
|
90
|
+
.update(factoryDefinitions)
|
|
91
|
+
.set({
|
|
92
|
+
name,
|
|
93
|
+
description,
|
|
94
|
+
prompt,
|
|
95
|
+
graphVersion: nextVersion,
|
|
96
|
+
graphJson: JSON.stringify(normalizedGraph),
|
|
97
|
+
updatedAt: now,
|
|
98
|
+
ownerEmail: userEmail,
|
|
99
|
+
})
|
|
100
|
+
.where(
|
|
101
|
+
and(
|
|
102
|
+
eq(factoryDefinitions.id, factoryId),
|
|
103
|
+
eq(factoryDefinitions.orgId, orgId),
|
|
104
|
+
),
|
|
105
|
+
);
|
|
106
|
+
} else {
|
|
107
|
+
await db.insert(factoryDefinitions).values({
|
|
108
|
+
id: factoryId,
|
|
109
|
+
name,
|
|
110
|
+
description,
|
|
111
|
+
prompt,
|
|
112
|
+
graphVersion: nextVersion,
|
|
113
|
+
graphJson: JSON.stringify(normalizedGraph),
|
|
114
|
+
createdAt: now,
|
|
115
|
+
updatedAt: now,
|
|
116
|
+
ownerEmail: userEmail,
|
|
117
|
+
orgId,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
return {
|
|
122
|
+
ok: true,
|
|
123
|
+
factoryId,
|
|
124
|
+
name,
|
|
125
|
+
graphVersion: nextVersion,
|
|
126
|
+
source,
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
});
|