@agent-native/core 0.132.2 → 0.133.1
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 +181 -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 +61 -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 +49 -7
- package/corpus/core/src/agent/thread-data-builder.ts +36 -4
- 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/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 +30 -9
- 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-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/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/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/layout/Sidebar.tsx +21 -4
- 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-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 +51 -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 +38 -6
- 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/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/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/file-upload/actions/upload-image.d.ts +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/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/mcp/screen-memory-stdio.d.ts.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/observability/routes.d.ts +1 -1
- 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/resources/handlers.d.ts +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 +25 -7
- 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/agent-engine-api-key-route.d.ts +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/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 +61 -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 +49 -7
- package/src/agent/thread-data-builder.ts +36 -4
- 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/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 +30 -9
- 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,126 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import { resolveConnectorSecret } from "../server/connectors/credentials.js";
|
|
5
|
+
import {
|
|
6
|
+
requireWorkspaceMember,
|
|
7
|
+
workspaceMemberIdentityFromContext,
|
|
8
|
+
} from "../server/lib/require-workspace-member.js";
|
|
9
|
+
import { createAiServicesGitReadClient } from "../server/triage/ai-services-git.js";
|
|
10
|
+
import { reconcileBabysitState } from "../server/triage/pr-babysit.js";
|
|
11
|
+
import type {
|
|
12
|
+
ReviewCommentObservation,
|
|
13
|
+
BabysitProposal,
|
|
14
|
+
} from "../server/triage/pr-babysit.js";
|
|
15
|
+
import type { PullRequestCheckObservation } from "../server/triage/pr-monitor.js";
|
|
16
|
+
|
|
17
|
+
const checkSchema: z.ZodType<PullRequestCheckObservation> = z.object({
|
|
18
|
+
name: z.string().min(1),
|
|
19
|
+
state: z.enum(["queued", "in_progress", "passed", "failed", "cancelled"]),
|
|
20
|
+
observedAt: z.string().datetime(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export interface FetchReviewCommentsInput {
|
|
24
|
+
repo: string;
|
|
25
|
+
pullRequestNumber: number;
|
|
26
|
+
ownerEmail: string;
|
|
27
|
+
orgId: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export type FetchReviewComments = (input: FetchReviewCommentsInput) => Promise<{
|
|
31
|
+
comments: readonly ReviewCommentObservation[];
|
|
32
|
+
truncated: boolean;
|
|
33
|
+
}>;
|
|
34
|
+
|
|
35
|
+
// Same non-secret deployment endpoint/project id the Builder executor reads
|
|
36
|
+
// (server/triage/builder-executor.ts); that resolver is private to this file
|
|
37
|
+
// and out of scope to export, so this is a second, identical read site for
|
|
38
|
+
// the same two env vars rather than a new credential path.
|
|
39
|
+
function requiredAiServicesEnv(
|
|
40
|
+
name: "BUILDER_AI_SERVICES_URL" | "BUILDER_PROJECT_ID",
|
|
41
|
+
): string {
|
|
42
|
+
const value =
|
|
43
|
+
name === "BUILDER_AI_SERVICES_URL"
|
|
44
|
+
? process.env.BUILDER_AI_SERVICES_URL // guard:allow-env-credential - non-secret deployment endpoint
|
|
45
|
+
: process.env.BUILDER_PROJECT_ID; // guard:allow-env-credential - non-secret deployment project id
|
|
46
|
+
if (!value) {
|
|
47
|
+
throw new Error(
|
|
48
|
+
`review-comment fetch not configured: ${name} is required to read GitHub review comments.`,
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
return value;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const fetchReviewCommentsFromAiServices: FetchReviewComments = async ({
|
|
55
|
+
repo,
|
|
56
|
+
pullRequestNumber,
|
|
57
|
+
ownerEmail,
|
|
58
|
+
orgId,
|
|
59
|
+
}) => {
|
|
60
|
+
const baseUrl = requiredAiServicesEnv("BUILDER_AI_SERVICES_URL");
|
|
61
|
+
const projectId = requiredAiServicesEnv("BUILDER_PROJECT_ID");
|
|
62
|
+
const privateKey = await resolveConnectorSecret(
|
|
63
|
+
"BUILDER_PRIVATE_KEY",
|
|
64
|
+
ownerEmail,
|
|
65
|
+
{ orgId },
|
|
66
|
+
);
|
|
67
|
+
if (!privateKey) {
|
|
68
|
+
throw new Error(
|
|
69
|
+
"review-comment fetch not configured: no Builder executor credential (BUILDER_PRIVATE_KEY) is available for this workspace.",
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const client = createAiServicesGitReadClient({
|
|
74
|
+
baseUrl,
|
|
75
|
+
authorization: `Bearer ${privateKey.startsWith("bpk-") ? privateKey : `bpk-${privateKey}`}`,
|
|
76
|
+
});
|
|
77
|
+
// Review comments ride along on the reviews read; there is no separate
|
|
78
|
+
// comments endpoint in ai-services.
|
|
79
|
+
const snapshot = await client.fetchPullRequest({
|
|
80
|
+
projectId,
|
|
81
|
+
repo,
|
|
82
|
+
pullRequestNumber,
|
|
83
|
+
});
|
|
84
|
+
return {
|
|
85
|
+
comments: snapshot.comments,
|
|
86
|
+
truncated: snapshot.commentsTruncated,
|
|
87
|
+
};
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export function createBabysitPullRequestAction(
|
|
91
|
+
fetchComments: FetchReviewComments = fetchReviewCommentsFromAiServices,
|
|
92
|
+
) {
|
|
93
|
+
return defineAction({
|
|
94
|
+
description:
|
|
95
|
+
"Propose a babysit-PR status (unanswered review comments, failing/pending checks, missing changeset packages) for one pull request. Read-only and proposal-only: never replies, pushes, merges, assigns, or invokes an executor.",
|
|
96
|
+
schema: z.object({
|
|
97
|
+
repo: z.string().trim().min(1).max(256),
|
|
98
|
+
pullRequestNumber: z.number().int().positive(),
|
|
99
|
+
checks: z.array(checkSchema).max(500).default([]),
|
|
100
|
+
failingJobLog: z.string().max(50_000).optional(),
|
|
101
|
+
botAuthors: z.array(z.string().trim().min(1)).max(50).optional(),
|
|
102
|
+
}),
|
|
103
|
+
http: false,
|
|
104
|
+
readOnly: true,
|
|
105
|
+
run: async (input, context): Promise<BabysitProposal> => {
|
|
106
|
+
const { userEmail, orgId } = await requireWorkspaceMember(
|
|
107
|
+
workspaceMemberIdentityFromContext(context),
|
|
108
|
+
);
|
|
109
|
+
const { comments, truncated } = await fetchComments({
|
|
110
|
+
repo: input.repo,
|
|
111
|
+
pullRequestNumber: input.pullRequestNumber,
|
|
112
|
+
ownerEmail: userEmail,
|
|
113
|
+
orgId,
|
|
114
|
+
});
|
|
115
|
+
return reconcileBabysitState({
|
|
116
|
+
comments,
|
|
117
|
+
checks: input.checks,
|
|
118
|
+
failingJobLog: input.failingJobLog,
|
|
119
|
+
botAuthors: input.botAuthors,
|
|
120
|
+
commentsTruncated: truncated,
|
|
121
|
+
});
|
|
122
|
+
},
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export default createBabysitPullRequestAction();
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
|
|
3
|
+
import { defineAction } from "@agent-native/core/action";
|
|
4
|
+
import { classifyAgentFailure } from "@agent-native/core/agent/engine";
|
|
5
|
+
import { and, eq } from "drizzle-orm";
|
|
6
|
+
import { z } from "zod";
|
|
7
|
+
|
|
8
|
+
import { getDb } from "../server/db/index.js";
|
|
9
|
+
import {
|
|
10
|
+
triageDecisions,
|
|
11
|
+
triageItems,
|
|
12
|
+
triageRules,
|
|
13
|
+
} from "../server/db/schema.js";
|
|
14
|
+
import {
|
|
15
|
+
requireWorkspaceMember,
|
|
16
|
+
workspaceMemberIdentityFromContext,
|
|
17
|
+
} from "../server/lib/require-workspace-member.js";
|
|
18
|
+
import {
|
|
19
|
+
normalizeTriagePolicyGuards,
|
|
20
|
+
triageGuardCodeSchema,
|
|
21
|
+
} from "../server/triage/contracts.js";
|
|
22
|
+
import { evaluateStructuredGuards } from "../server/triage/guards.js";
|
|
23
|
+
|
|
24
|
+
export default defineAction({
|
|
25
|
+
description:
|
|
26
|
+
"Triage one Factory item against enabled rules and append structured guard decisions. This records proposals only and never changes a provider.",
|
|
27
|
+
schema: z.object({ itemId: z.string().min(1) }),
|
|
28
|
+
http: { method: "POST" },
|
|
29
|
+
run: async ({ itemId }, context) => {
|
|
30
|
+
const { userEmail, orgId } = await requireWorkspaceMember(
|
|
31
|
+
workspaceMemberIdentityFromContext(context),
|
|
32
|
+
);
|
|
33
|
+
const db = getDb();
|
|
34
|
+
const item = (
|
|
35
|
+
await db
|
|
36
|
+
.select()
|
|
37
|
+
.from(triageItems)
|
|
38
|
+
.where(and(eq(triageItems.id, itemId), eq(triageItems.orgId, orgId)))
|
|
39
|
+
.limit(1)
|
|
40
|
+
)[0];
|
|
41
|
+
if (!item) throw new Error("Triage item not found");
|
|
42
|
+
|
|
43
|
+
const rules = await db
|
|
44
|
+
.select()
|
|
45
|
+
.from(triageRules)
|
|
46
|
+
.where(and(eq(triageRules.orgId, orgId), eq(triageRules.enabled, 1)));
|
|
47
|
+
const metadata = parseMetadata(item.metadataJson);
|
|
48
|
+
const evidence = {
|
|
49
|
+
repository: item.repository ?? undefined,
|
|
50
|
+
changedFiles: parseStringArray(metadata.changedFiles),
|
|
51
|
+
diffLines: parseOptionalNumber(metadata.diffLines),
|
|
52
|
+
risk: item.risk,
|
|
53
|
+
categories: parseGuardCategories(metadata.categories),
|
|
54
|
+
};
|
|
55
|
+
const failureTaxonomy = classifyAgentFailure({
|
|
56
|
+
errorCode: metadata.errorCode,
|
|
57
|
+
errorDetail: [item.title, item.summary, metadata.failureText]
|
|
58
|
+
.filter((value): value is string => typeof value === "string")
|
|
59
|
+
.join("\n"),
|
|
60
|
+
terminalReason: metadata.terminalReason,
|
|
61
|
+
terminalEvent: metadata.terminalEvent,
|
|
62
|
+
regime:
|
|
63
|
+
metadata.regime === "scheduled" || metadata.regime === "interactive"
|
|
64
|
+
? metadata.regime
|
|
65
|
+
: undefined,
|
|
66
|
+
});
|
|
67
|
+
const taxonomyReason =
|
|
68
|
+
failureTaxonomy.code === "unknown"
|
|
69
|
+
? ""
|
|
70
|
+
: `Observed failure taxonomy: ${failureTaxonomy.label} (${failureTaxonomy.code}; ${failureTaxonomy.regime}). `;
|
|
71
|
+
|
|
72
|
+
if (rules.length === 0) {
|
|
73
|
+
return {
|
|
74
|
+
ok: true,
|
|
75
|
+
itemId,
|
|
76
|
+
evaluated: 0,
|
|
77
|
+
reason: "No enabled shadow rules.",
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const now = new Date().toISOString();
|
|
82
|
+
const decisions = rules.map((rule) => {
|
|
83
|
+
const guards = normalizeTriagePolicyGuards(
|
|
84
|
+
parseObject(JSON.parse(rule.guardsJson), "guards"),
|
|
85
|
+
);
|
|
86
|
+
const guardResults = evaluateStructuredGuards(guards, evidence);
|
|
87
|
+
const outcome = guardResults.every((guard) => guard.passed)
|
|
88
|
+
? "observe"
|
|
89
|
+
: "needs_manual";
|
|
90
|
+
return {
|
|
91
|
+
id: randomUUID(),
|
|
92
|
+
itemId,
|
|
93
|
+
ruleId: rule.id,
|
|
94
|
+
mode: rule.mode,
|
|
95
|
+
outcome,
|
|
96
|
+
reason:
|
|
97
|
+
taxonomyReason + guardResults.map((guard) => guard.reason).join(" "),
|
|
98
|
+
guardResultsJson: JSON.stringify(guardResults),
|
|
99
|
+
model: "structured-guards+failure-taxonomy",
|
|
100
|
+
promptVersion: rule.promptVersion,
|
|
101
|
+
createdAt: now,
|
|
102
|
+
ownerEmail: userEmail,
|
|
103
|
+
orgId,
|
|
104
|
+
};
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
await db.transaction(async (tx) => {
|
|
108
|
+
await tx.insert(triageDecisions).values(decisions);
|
|
109
|
+
await tx
|
|
110
|
+
.update(triageItems)
|
|
111
|
+
.set({
|
|
112
|
+
status: decisions.some(
|
|
113
|
+
(decision) => decision.outcome === "needs_manual",
|
|
114
|
+
)
|
|
115
|
+
? "needs_manual"
|
|
116
|
+
: "shadow_decided",
|
|
117
|
+
updatedAt: now,
|
|
118
|
+
})
|
|
119
|
+
.where(and(eq(triageItems.id, itemId), eq(triageItems.orgId, orgId)));
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
return {
|
|
123
|
+
ok: true,
|
|
124
|
+
itemId,
|
|
125
|
+
evaluated: decisions.length,
|
|
126
|
+
decisionIds: decisions.map((decision) => decision.id),
|
|
127
|
+
};
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
function parseMetadata(value: string): Record<string, unknown> {
|
|
132
|
+
let parsed: unknown;
|
|
133
|
+
try {
|
|
134
|
+
parsed = JSON.parse(value);
|
|
135
|
+
} catch {
|
|
136
|
+
throw new Error("Triage item metadata is unreadable.");
|
|
137
|
+
}
|
|
138
|
+
return parseObject(parsed, "metadata");
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function parseObject(value: unknown, label: string): Record<string, unknown> {
|
|
142
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
143
|
+
throw new Error(`Triage ${label} must be an object.`);
|
|
144
|
+
}
|
|
145
|
+
return value as Record<string, unknown>;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function parseStringArray(value: unknown): string[] | undefined {
|
|
149
|
+
if (value === undefined) return undefined;
|
|
150
|
+
if (
|
|
151
|
+
!Array.isArray(value) ||
|
|
152
|
+
!value.every((entry) => typeof entry === "string")
|
|
153
|
+
) {
|
|
154
|
+
throw new Error("Triage changedFiles metadata is unreadable.");
|
|
155
|
+
}
|
|
156
|
+
return value;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
function parseOptionalNumber(value: unknown): number | undefined {
|
|
160
|
+
if (value === undefined) return undefined;
|
|
161
|
+
if (typeof value !== "number" || !Number.isFinite(value)) {
|
|
162
|
+
throw new Error("Triage diffLines metadata is unreadable.");
|
|
163
|
+
}
|
|
164
|
+
return value;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function parseGuardCategories(value: unknown) {
|
|
168
|
+
if (value === undefined) return undefined;
|
|
169
|
+
if (!Array.isArray(value))
|
|
170
|
+
throw new Error("Triage categories metadata is unreadable.");
|
|
171
|
+
return value.map((entry) => triageGuardCodeSchema.parse(entry));
|
|
172
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
defaultFactoryDefinition,
|
|
6
|
+
DEFAULT_FACTORY_ID,
|
|
7
|
+
parseFactoryGraph,
|
|
8
|
+
readFactoryDefinition,
|
|
9
|
+
readFactoryMetrics,
|
|
10
|
+
} from "../server/factory-graph/store.js";
|
|
11
|
+
import {
|
|
12
|
+
requireWorkspaceMember,
|
|
13
|
+
workspaceMemberIdentityFromContext,
|
|
14
|
+
} from "../server/lib/require-workspace-member.js";
|
|
15
|
+
|
|
16
|
+
export default defineAction({
|
|
17
|
+
description:
|
|
18
|
+
"Read the selected Factory's deterministic graph, version, comments target, and live evidence metrics.",
|
|
19
|
+
schema: z.object({
|
|
20
|
+
factoryId: z.string().trim().min(1).max(120).default(DEFAULT_FACTORY_ID),
|
|
21
|
+
}),
|
|
22
|
+
http: { method: "GET" },
|
|
23
|
+
readOnly: true,
|
|
24
|
+
run: async ({ factoryId }, context) => {
|
|
25
|
+
const { orgId } = await requireWorkspaceMember(
|
|
26
|
+
workspaceMemberIdentityFromContext(context),
|
|
27
|
+
);
|
|
28
|
+
const row = await readFactoryDefinition(orgId, factoryId);
|
|
29
|
+
const fallback = defaultFactoryDefinition();
|
|
30
|
+
const graph = row ? parseFactoryGraph(row.graphJson) : fallback.graph;
|
|
31
|
+
const metrics = await readFactoryMetrics(orgId);
|
|
32
|
+
|
|
33
|
+
const metricValues: Record<string, number> = {
|
|
34
|
+
items: metrics.totalItems,
|
|
35
|
+
slack: metrics.slackItems,
|
|
36
|
+
github: metrics.githubItems,
|
|
37
|
+
decisions: metrics.decisions,
|
|
38
|
+
needs_manual: metrics.manualItems,
|
|
39
|
+
runs: metrics.runs,
|
|
40
|
+
completed: metrics.completedRuns,
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
return {
|
|
44
|
+
factory: {
|
|
45
|
+
id: factoryId,
|
|
46
|
+
name: row?.name ?? fallback.name,
|
|
47
|
+
description: row?.description ?? fallback.description,
|
|
48
|
+
prompt: row?.prompt ?? fallback.prompt,
|
|
49
|
+
graphVersion: row?.graphVersion ?? graph.version,
|
|
50
|
+
virtual: !row,
|
|
51
|
+
},
|
|
52
|
+
graph,
|
|
53
|
+
metrics,
|
|
54
|
+
nodeMetrics: Object.fromEntries(
|
|
55
|
+
graph.nodes.map((node) => [
|
|
56
|
+
node.id,
|
|
57
|
+
metricValues[node.metricsKey ?? ""] ?? 0,
|
|
58
|
+
]),
|
|
59
|
+
),
|
|
60
|
+
};
|
|
61
|
+
},
|
|
62
|
+
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { eq } from "drizzle-orm";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { getDb } from "../server/db/index.js";
|
|
6
|
+
import { triageConfig } from "../server/db/schema.js";
|
|
7
|
+
import {
|
|
8
|
+
requireWorkspaceMember,
|
|
9
|
+
workspaceMemberIdentityFromContext,
|
|
10
|
+
} from "../server/lib/require-workspace-member.js";
|
|
11
|
+
|
|
12
|
+
export default defineAction({
|
|
13
|
+
description:
|
|
14
|
+
"Read Factory observation settings for the active workspace. Secret values are never returned.",
|
|
15
|
+
schema: z.object({}),
|
|
16
|
+
http: { method: "GET" },
|
|
17
|
+
readOnly: true,
|
|
18
|
+
run: async (_, context) => {
|
|
19
|
+
const { orgId } = await requireWorkspaceMember(
|
|
20
|
+
workspaceMemberIdentityFromContext(context),
|
|
21
|
+
);
|
|
22
|
+
const row = (
|
|
23
|
+
await getDb()
|
|
24
|
+
.select()
|
|
25
|
+
.from(triageConfig)
|
|
26
|
+
.where(eq(triageConfig.id, orgId))
|
|
27
|
+
.limit(1)
|
|
28
|
+
)[0];
|
|
29
|
+
if (!row) {
|
|
30
|
+
return {
|
|
31
|
+
slackWorkspace: "primary",
|
|
32
|
+
slackChannelId: null,
|
|
33
|
+
slackChannelName: null,
|
|
34
|
+
pollingEnabled: false,
|
|
35
|
+
lastSlackTs: null,
|
|
36
|
+
slackHistoryCursor: null,
|
|
37
|
+
repository: null,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return { ...row, pollingEnabled: row.pollingEnabled === 1 };
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { and, asc, eq } from "drizzle-orm";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
|
|
5
|
+
import { getDb } from "../server/db/index.js";
|
|
6
|
+
import {
|
|
7
|
+
triageDecisions,
|
|
8
|
+
triageFeedback,
|
|
9
|
+
triageItems,
|
|
10
|
+
triageRuns,
|
|
11
|
+
} from "../server/db/schema.js";
|
|
12
|
+
import {
|
|
13
|
+
requireWorkspaceMember,
|
|
14
|
+
workspaceMemberIdentityFromContext,
|
|
15
|
+
} from "../server/lib/require-workspace-member.js";
|
|
16
|
+
|
|
17
|
+
export default defineAction({
|
|
18
|
+
description:
|
|
19
|
+
"Inspect one Factory item, including its append-only shadow decisions, feedback, and run reconciliation state.",
|
|
20
|
+
schema: z.object({ itemId: z.string().min(1) }),
|
|
21
|
+
http: { method: "GET" },
|
|
22
|
+
readOnly: true,
|
|
23
|
+
run: async ({ itemId }, context) => {
|
|
24
|
+
const { orgId } = await requireWorkspaceMember(
|
|
25
|
+
workspaceMemberIdentityFromContext(context),
|
|
26
|
+
);
|
|
27
|
+
const db = getDb();
|
|
28
|
+
const item = (
|
|
29
|
+
await db
|
|
30
|
+
.select()
|
|
31
|
+
.from(triageItems)
|
|
32
|
+
.where(and(eq(triageItems.id, itemId), eq(triageItems.orgId, orgId)))
|
|
33
|
+
.limit(1)
|
|
34
|
+
)[0];
|
|
35
|
+
if (!item) throw new Error("Triage item not found");
|
|
36
|
+
|
|
37
|
+
const decisions = await db
|
|
38
|
+
.select()
|
|
39
|
+
.from(triageDecisions)
|
|
40
|
+
.where(
|
|
41
|
+
and(
|
|
42
|
+
eq(triageDecisions.itemId, itemId),
|
|
43
|
+
eq(triageDecisions.orgId, orgId),
|
|
44
|
+
),
|
|
45
|
+
)
|
|
46
|
+
.orderBy(asc(triageDecisions.createdAt));
|
|
47
|
+
const feedback = await db
|
|
48
|
+
.select()
|
|
49
|
+
.from(triageFeedback)
|
|
50
|
+
.where(eq(triageFeedback.orgId, orgId))
|
|
51
|
+
.orderBy(asc(triageFeedback.createdAt));
|
|
52
|
+
const runs = await db
|
|
53
|
+
.select()
|
|
54
|
+
.from(triageRuns)
|
|
55
|
+
.where(and(eq(triageRuns.itemId, itemId), eq(triageRuns.orgId, orgId)))
|
|
56
|
+
.orderBy(asc(triageRuns.startedAt));
|
|
57
|
+
|
|
58
|
+
return {
|
|
59
|
+
...item,
|
|
60
|
+
decisions: decisions.map((decision) => ({
|
|
61
|
+
decisionId: decision.id,
|
|
62
|
+
outcome: decision.outcome,
|
|
63
|
+
summary: decision.reason,
|
|
64
|
+
reason: decision.reason,
|
|
65
|
+
mode: decision.mode,
|
|
66
|
+
createdAt: decision.createdAt,
|
|
67
|
+
})),
|
|
68
|
+
feedback: feedback.filter((entry) =>
|
|
69
|
+
decisions.some((decision) => decision.id === entry.decisionId),
|
|
70
|
+
),
|
|
71
|
+
runs,
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
export default defineAction({
|
|
5
|
+
description: "Return a friendly greeting.",
|
|
6
|
+
schema: z.object({
|
|
7
|
+
name: z.string().default("world").describe("Name to greet"),
|
|
8
|
+
}),
|
|
9
|
+
http: { method: "GET" },
|
|
10
|
+
run: async ({ name }) => {
|
|
11
|
+
return { message: `Hello, ${name}!` };
|
|
12
|
+
},
|
|
13
|
+
});
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import { getDb } from "../server/db/index.js";
|
|
5
|
+
import { triageItems } from "../server/db/schema.js";
|
|
6
|
+
import {
|
|
7
|
+
requireWorkspaceMember,
|
|
8
|
+
workspaceMemberIdentityFromContext,
|
|
9
|
+
} from "../server/lib/require-workspace-member.js";
|
|
10
|
+
import { pullRequestSnapshotToEnvelope } from "../server/triage/github-ingestion.js";
|
|
11
|
+
import { itemDedupeKey } from "../server/triage/ids.js";
|
|
12
|
+
import type {
|
|
13
|
+
PullRequestCheckObservation,
|
|
14
|
+
PullRequestReviewObservation,
|
|
15
|
+
} from "../server/triage/pr-monitor.js";
|
|
16
|
+
|
|
17
|
+
const reviewSchema: z.ZodType<PullRequestReviewObservation> = z.object({
|
|
18
|
+
author: z.string().min(1),
|
|
19
|
+
state: z.enum(["approved", "changes_requested", "commented", "pending"]),
|
|
20
|
+
observedAt: z.string().datetime(),
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
const checkSchema: z.ZodType<PullRequestCheckObservation> = z.object({
|
|
24
|
+
name: z.string().min(1),
|
|
25
|
+
state: z.enum(["queued", "in_progress", "passed", "failed", "cancelled"]),
|
|
26
|
+
observedAt: z.string().datetime(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export default defineAction({
|
|
30
|
+
description:
|
|
31
|
+
"Ingest one read-only GitHub pull-request observation from the existing ai-services boundary into Factory. This action records evidence only and never writes to GitHub.",
|
|
32
|
+
schema: z.object({
|
|
33
|
+
repo: z.string().trim().min(1).max(256),
|
|
34
|
+
pullRequestNumber: z.number().int().positive(),
|
|
35
|
+
headSha: z.string().trim().min(1).max(128),
|
|
36
|
+
title: z.string().trim().min(1).max(500),
|
|
37
|
+
sourceUrl: z.string().url().optional(),
|
|
38
|
+
summary: z.string().trim().max(4_000).optional(),
|
|
39
|
+
changedFiles: z.array(z.string().max(500)).max(500).optional(),
|
|
40
|
+
diffLines: z.number().int().nonnegative().optional(),
|
|
41
|
+
coverage: z.enum(["complete", "partial", "unknown", "unavailable"]),
|
|
42
|
+
reviews: z.array(reviewSchema).max(500).default([]),
|
|
43
|
+
checks: z.array(checkSchema).max(500).default([]),
|
|
44
|
+
observedAt: z.string().datetime(),
|
|
45
|
+
}),
|
|
46
|
+
http: false,
|
|
47
|
+
agentTool: false,
|
|
48
|
+
run: async (input, context) => {
|
|
49
|
+
const { userEmail, orgId } = await requireWorkspaceMember(
|
|
50
|
+
workspaceMemberIdentityFromContext(context),
|
|
51
|
+
);
|
|
52
|
+
const envelope = pullRequestSnapshotToEnvelope(input);
|
|
53
|
+
const id = itemDedupeKey(envelope, orgId);
|
|
54
|
+
const now = new Date().toISOString();
|
|
55
|
+
const db = getDb();
|
|
56
|
+
|
|
57
|
+
await db
|
|
58
|
+
.insert(triageItems)
|
|
59
|
+
.values({
|
|
60
|
+
id,
|
|
61
|
+
source: envelope.source,
|
|
62
|
+
externalId: envelope.externalId,
|
|
63
|
+
sourceUrl: envelope.sourceUrl ?? null,
|
|
64
|
+
title: envelope.title,
|
|
65
|
+
summary: envelope.summary ?? null,
|
|
66
|
+
status: "evidence_ready",
|
|
67
|
+
risk: "unknown",
|
|
68
|
+
repository: envelope.repository ?? null,
|
|
69
|
+
pullRequestNumber: envelope.pullRequestNumber ?? null,
|
|
70
|
+
headSha: envelope.headSha ?? null,
|
|
71
|
+
coverage: envelope.coverage,
|
|
72
|
+
dedupeKey: id,
|
|
73
|
+
metadataJson: JSON.stringify(envelope.metadata ?? {}),
|
|
74
|
+
lastSeenAt: envelope.receivedAt,
|
|
75
|
+
createdAt: now,
|
|
76
|
+
updatedAt: now,
|
|
77
|
+
ownerEmail: userEmail,
|
|
78
|
+
orgId,
|
|
79
|
+
})
|
|
80
|
+
.onConflictDoUpdate({
|
|
81
|
+
target: triageItems.id,
|
|
82
|
+
set: {
|
|
83
|
+
sourceUrl: envelope.sourceUrl ?? null,
|
|
84
|
+
title: envelope.title,
|
|
85
|
+
summary: envelope.summary ?? null,
|
|
86
|
+
coverage: envelope.coverage,
|
|
87
|
+
metadataJson: JSON.stringify(envelope.metadata ?? {}),
|
|
88
|
+
lastSeenAt: envelope.receivedAt,
|
|
89
|
+
updatedAt: now,
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
return {
|
|
94
|
+
ok: true,
|
|
95
|
+
id,
|
|
96
|
+
source: envelope.source,
|
|
97
|
+
coverage: envelope.coverage,
|
|
98
|
+
};
|
|
99
|
+
},
|
|
100
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import {
|
|
5
|
+
defaultFactoryDefinition,
|
|
6
|
+
listFactoryDefinitions,
|
|
7
|
+
} from "../server/factory-graph/store.js";
|
|
8
|
+
import {
|
|
9
|
+
requireWorkspaceMember,
|
|
10
|
+
workspaceMemberIdentityFromContext,
|
|
11
|
+
} from "../server/lib/require-workspace-member.js";
|
|
12
|
+
|
|
13
|
+
export default defineAction({
|
|
14
|
+
description:
|
|
15
|
+
"List the saved Factory definitions in the active workspace, including the default product-feedback Factory when it has not been persisted yet.",
|
|
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 listFactoryDefinitions(orgId);
|
|
24
|
+
if (rows.some((row) => row.id === defaultFactoryDefinition().id)) {
|
|
25
|
+
return rows;
|
|
26
|
+
}
|
|
27
|
+
return [
|
|
28
|
+
{
|
|
29
|
+
id: defaultFactoryDefinition().id,
|
|
30
|
+
name: defaultFactoryDefinition().name,
|
|
31
|
+
description: defaultFactoryDefinition().description,
|
|
32
|
+
prompt: defaultFactoryDefinition().prompt,
|
|
33
|
+
graphVersion: 1,
|
|
34
|
+
updatedAt: null,
|
|
35
|
+
virtual: true,
|
|
36
|
+
},
|
|
37
|
+
...rows,
|
|
38
|
+
];
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,40 @@
|
|
|
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 { factoryComments } from "../server/db/schema.js";
|
|
7
|
+
import { DEFAULT_FACTORY_ID } from "../server/factory-graph/store.js";
|
|
8
|
+
import {
|
|
9
|
+
requireWorkspaceMember,
|
|
10
|
+
workspaceMemberIdentityFromContext,
|
|
11
|
+
} from "../server/lib/require-workspace-member.js";
|
|
12
|
+
|
|
13
|
+
export default defineAction({
|
|
14
|
+
description:
|
|
15
|
+
"List comments attached to the selected Factory canvas, node, or edge.",
|
|
16
|
+
schema: z.object({
|
|
17
|
+
factoryId: z.string().trim().min(1).max(120).default(DEFAULT_FACTORY_ID),
|
|
18
|
+
graphVersion: z.coerce.number().int().positive().optional(),
|
|
19
|
+
}),
|
|
20
|
+
http: { method: "GET" },
|
|
21
|
+
readOnly: true,
|
|
22
|
+
run: async ({ factoryId, graphVersion }, context) => {
|
|
23
|
+
const { orgId } = await requireWorkspaceMember(
|
|
24
|
+
workspaceMemberIdentityFromContext(context),
|
|
25
|
+
);
|
|
26
|
+
return getDb()
|
|
27
|
+
.select()
|
|
28
|
+
.from(factoryComments)
|
|
29
|
+
.where(
|
|
30
|
+
and(
|
|
31
|
+
eq(factoryComments.factoryId, factoryId),
|
|
32
|
+
eq(factoryComments.orgId, orgId),
|
|
33
|
+
...(graphVersion
|
|
34
|
+
? [eq(factoryComments.graphVersion, graphVersion)]
|
|
35
|
+
: []),
|
|
36
|
+
),
|
|
37
|
+
)
|
|
38
|
+
.orderBy(desc(factoryComments.createdAt));
|
|
39
|
+
},
|
|
40
|
+
});
|