@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,10 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable user-facing changes to Chat are documented here. Open it any
|
|
4
|
+
time from the command menu (Cmd+K → "What's new").
|
|
5
|
+
|
|
6
|
+
## 2026-06-23
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
|
|
10
|
+
- See what's new right inside Chat — a changelog now lives in the command menu (Cmd+K).
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
# factory - Development Guide
|
|
2
|
+
|
|
3
|
+
This guide is for development-mode agents editing this app's source code. For app operations and tools, see AGENTS.md.
|
|
4
|
+
|
|
5
|
+
## Tech Stack
|
|
6
|
+
|
|
7
|
+
- **Framework:** @agent-native/core + React Router v8 (framework mode)
|
|
8
|
+
- **Frontend:** React 19, Vite, TailwindCSS, shadcn/ui
|
|
9
|
+
- **Routing:** File-based via `flatRoutes()` — SSR shell + client rendering
|
|
10
|
+
- **Backend:** Nitro (via @agent-native/core) — file-based API routing, server plugins, deploy-anywhere presets
|
|
11
|
+
- **State:** SQL-backed (SSE for real-time updates)
|
|
12
|
+
|
|
13
|
+
## Commands
|
|
14
|
+
|
|
15
|
+
- **Dev:** `pnpm dev` (Vite dev server with both React Router + Nitro plugins)
|
|
16
|
+
- **Build:** `pnpm build` (React Router build — client + SSR + Nitro server)
|
|
17
|
+
- **Start:** `node .output/server/index.mjs` (production)
|
|
18
|
+
|
|
19
|
+
## Directory Structure
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
app/ # React frontend
|
|
23
|
+
root.tsx # HTML shell + global providers
|
|
24
|
+
entry.client.tsx # Client hydration entry
|
|
25
|
+
routes.ts # Route config — flatRoutes()
|
|
26
|
+
routes/ # File-based page routes (auto-discovered)
|
|
27
|
+
_index.tsx # / (chat page)
|
|
28
|
+
components/ # UI components
|
|
29
|
+
hooks/ # React hooks
|
|
30
|
+
lib/ # Utilities (cn, etc)
|
|
31
|
+
|
|
32
|
+
server/ # Nitro API server
|
|
33
|
+
routes/
|
|
34
|
+
api/ # Route-only endpoints (uploads, webhooks, OAuth, streaming)
|
|
35
|
+
[...page].get.ts # SSR catch-all (delegates to React Router)
|
|
36
|
+
plugins/ # Server plugins (startup logic)
|
|
37
|
+
lib/ # Shared server modules
|
|
38
|
+
|
|
39
|
+
shared/ # Isomorphic code (imported by both client & server)
|
|
40
|
+
|
|
41
|
+
actions/ # Shared app operations (defineAction; UI uses action hooks)
|
|
42
|
+
run.ts # Script dispatcher
|
|
43
|
+
*.ts # Individual actions (pnpm action <name>)
|
|
44
|
+
|
|
45
|
+
data/ # Local development database fallback
|
|
46
|
+
|
|
47
|
+
react-router.config.ts # React Router framework config
|
|
48
|
+
.agents/skills/ # Agent skills — detailed guidance for each rule
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Framework Basics
|
|
52
|
+
|
|
53
|
+
**SSR-first framework, CSR-by-default content:** This app uses React Router v8 framework mode with `ssr: true`. But virtually every route renders only an SSR shell (loading spinner + meta tags). Normal app data fetching happens on the client via action hooks. Server-side data fetching is the exception — only used for public pages that need SEO/OG tags.
|
|
54
|
+
|
|
55
|
+
## Chat-First Shape
|
|
56
|
+
|
|
57
|
+
The `/` route is the app's primary chat surface. Keep it on
|
|
58
|
+
`AgentChatSurface` unless you are intentionally replacing the whole chat
|
|
59
|
+
experience. The left sidebar owns the durable thread list through
|
|
60
|
+
`useChatThreads`; app-specific screens can be added alongside it as nav items
|
|
61
|
+
when they become useful.
|
|
62
|
+
|
|
63
|
+
For a headless app that later needs UI, this template is the intended landing
|
|
64
|
+
zone: bring the existing actions over, keep their names stable, and let the chat
|
|
65
|
+
call them before adding extra screens. For a custom agent backend, keep the app
|
|
66
|
+
shell and swap the chat runtime with an `AgentChatRuntime` connector instead of
|
|
67
|
+
rewriting the composer/transcript UI.
|
|
68
|
+
|
|
69
|
+
## Adding a Page
|
|
70
|
+
|
|
71
|
+
Create a file in `app/routes/`. The filename determines the URL path:
|
|
72
|
+
|
|
73
|
+
```
|
|
74
|
+
app/routes/_index.tsx → /
|
|
75
|
+
app/routes/settings.tsx → /settings
|
|
76
|
+
app/routes/inbox.tsx → /inbox
|
|
77
|
+
app/routes/inbox.$threadId.tsx → /inbox/:threadId
|
|
78
|
+
app/routes/$id.tsx → /:id (dynamic param)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
Each route file exports a default component, optional `meta()`, and optional `HydrateFallback()`:
|
|
82
|
+
|
|
83
|
+
```tsx
|
|
84
|
+
import MyPage from "@/pages/MyPage";
|
|
85
|
+
|
|
86
|
+
export function meta() {
|
|
87
|
+
return [{ title: "My Page" }];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
export function HydrateFallback() {
|
|
91
|
+
return (
|
|
92
|
+
<div className="flex items-center justify-center h-screen">
|
|
93
|
+
<div className="animate-spin rounded-full h-8 w-8 border-b-2 border-foreground" />
|
|
94
|
+
</div>
|
|
95
|
+
);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export default function MyPageRoute() {
|
|
99
|
+
return <MyPage />;
|
|
100
|
+
}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Do NOT fetch data server-side** in route loaders unless the page genuinely needs SEO/OG content. The standard pattern is: SSR renders the shell, client hydrates, and React reads/writes normal app data through actions with `useActionQuery` / `useActionMutation`.
|
|
104
|
+
|
|
105
|
+
## Adding App Data
|
|
106
|
+
|
|
107
|
+
Normal app data starts as an action, not a custom route. Add `actions/<verb>-<resource>.ts` with `defineAction`, mark reads with `http: { method: "GET" }`, and call reads/writes from React with `useActionQuery` / `useActionMutation` from `@agent-native/core/client`. This keeps the UI and agent on one contract and lets mutating actions refresh action-backed queries automatically.
|
|
108
|
+
|
|
109
|
+
## Adding a Route-Only Endpoint
|
|
110
|
+
|
|
111
|
+
Use `server/routes/api/` only for protocols that cannot be modeled as JSON actions: multipart uploads, streaming/SSE/WebSocket, webhooks, OAuth callbacks/redirects, public SEO/OG endpoints, or binary/static asset serving. Do not add `/api/*` routes for normal CRUD, data queries, or pass-through wrappers around actions; the action endpoint already exists at `/_agent-native/actions/:name`.
|
|
112
|
+
|
|
113
|
+
Each route-only endpoint still exports a default `defineEventHandler`, but keep shared app logic in actions or server libraries so agent and UI behavior do not fork.
|
|
114
|
+
|
|
115
|
+
## Adding a Server Plugin
|
|
116
|
+
|
|
117
|
+
Startup logic (auth, SSE, etc.) lives in `server/plugins/`. Use `defineNitroPlugin` from core:
|
|
118
|
+
|
|
119
|
+
```ts
|
|
120
|
+
import { defineNitroPlugin } from "@agent-native/core";
|
|
121
|
+
|
|
122
|
+
export default defineNitroPlugin(async (nitroApp) => {
|
|
123
|
+
// Runs once at server startup
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Key Imports from `@agent-native/core`
|
|
128
|
+
|
|
129
|
+
| Import | Purpose |
|
|
130
|
+
| -------------------------------------------- | -------------------------------------------------------------------------- |
|
|
131
|
+
| `defineNitroPlugin` | Define a server plugin (re-exported from Nitro) |
|
|
132
|
+
| `createDefaultSSEHandler` | Create SSE endpoint for DB change events (server) |
|
|
133
|
+
| `readAppState`, `writeAppState` | Read/write application state (from `@agent-native/core/application-state`) |
|
|
134
|
+
| `readSetting`, `writeSetting` | Read/write settings (from `@agent-native/core/settings`) |
|
|
135
|
+
| `defineEventHandler`, `readBody`, `getQuery` | H3 route handler utilities (re-exported) |
|
|
136
|
+
| `sendToAgentChat` | Send messages to agent from UI (client-side) |
|
|
137
|
+
| `agentChat` | Send messages to agent from scripts (server-side) |
|
|
138
|
+
|
|
139
|
+
## Adding an Action
|
|
140
|
+
|
|
141
|
+
Create `actions/<verb>-<resource>.ts` with `defineAction`. Run with `pnpm action <name> --id value`; React callers should use `useActionQuery` for GET actions and `useActionMutation` for mutating actions, not a matching `/api/*` wrapper.
|
|
142
|
+
|
|
143
|
+
**Sending to agent chat from UI:**
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { sendToAgentChat } from "@agent-native/core/client";
|
|
147
|
+
sendToAgentChat({
|
|
148
|
+
message: "Generate something",
|
|
149
|
+
context: "...",
|
|
150
|
+
submit: true,
|
|
151
|
+
});
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
**Sending to agent chat from scripts:**
|
|
155
|
+
|
|
156
|
+
```ts
|
|
157
|
+
import { agentChat } from "@agent-native/core";
|
|
158
|
+
agentChat.submit("Generate something");
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Database & Environment Variables
|
|
162
|
+
|
|
163
|
+
Local development defaults to a SQLite file at `data/app.db`. That local file is for development; containers, previews, and serverless deploys can reset their filesystem. For production/cloud deployment, set `DATABASE_URL` to point to a persistent SQL database. Turso is optional, not required; common choices include Neon, Supabase, Turso/libSQL, plain Postgres, durable SQLite, D1 bindings, and Builder.io-managed environments when available.
|
|
164
|
+
|
|
165
|
+
Real credential values belong only in local `.env` files, deployment configuration, or registered secrets/settings UI. Never commit, document, log, return, paste, or include real keys, tokens, webhook URLs, signing secrets, or private data in examples; use empty values or obvious placeholders.
|
|
166
|
+
|
|
167
|
+
When adding app data, define tables with `@agent-native/core/db/schema` helpers and use Drizzle's query builder for reads/writes. Do not import dialect-specific schema helpers from `drizzle-orm/sqlite-core` or `drizzle-orm/pg-core`, and do not write raw SQL in normal actions or handlers when Drizzle can express the query. Raw SQL belongs in additive migrations, health checks, or carefully scoped maintenance.
|
|
168
|
+
|
|
169
|
+
| Variable | Required | Description |
|
|
170
|
+
| --------------------- | ------------------------------- | -------------------------------------------------------------------------- |
|
|
171
|
+
| `DATABASE_URL` | Production yes, local dev no | Persistent SQL connection string (local dev default: `file:./data/app.db`) |
|
|
172
|
+
| `DATABASE_AUTH_TOKEN` | Only when the provider needs it | Auth token for providers such as Turso/libSQL |
|
|
173
|
+
| `AUTH_DISABLED` | Optional | Set to `true` or `1` to skip login/signup (local dev/preview only) |
|
|
174
|
+
|
|
175
|
+
## Extensions (Framework Feature)
|
|
176
|
+
|
|
177
|
+
The framework provides **Extensions** — mini sandboxed Alpine.js apps that run inside iframes. Extensions let users (or the agent) create interactive widgets, dashboards, and utilities without modifying the app's source code. They appear in the sidebar under an "Extensions" section. (Distinct from LLM tools — the function-calling primitives the agent invokes.)
|
|
178
|
+
|
|
179
|
+
- **Creating extensions**: Via the sidebar "+" button, agent chat, or `POST /_agent-native/extensions`
|
|
180
|
+
- **API calls**: Extensions use `extensionFetch()` (legacy alias `toolFetch`) which proxies requests through the server with `${keys.NAME}` secret injection
|
|
181
|
+
- **Styling**: Extensions inherit the main app's Tailwind v4 theme automatically
|
|
182
|
+
- **Sharing**: Private by default, shareable with org or specific users (same model as other ownable resources)
|
|
183
|
+
- **Security**: Iframe sandbox + CSP + SSRF protection on the proxy
|
|
184
|
+
|
|
185
|
+
See the `extensions` skill in `.agents/skills/extensions/SKILL.md` for full implementation details.
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
# Factory
|
|
2
|
+
|
|
3
|
+
Factory is the inspectable foundation for building agent factories: work goes
|
|
4
|
+
in one end, governed agent work and shipped changes come out the other, with
|
|
5
|
+
human intervention points you control. It can start with Slack feedback and
|
|
6
|
+
pull-request evidence, then grow to orchestrate product workflows such as
|
|
7
|
+
PRD -> design -> engineering -> release.
|
|
8
|
+
|
|
9
|
+
## What it does
|
|
10
|
+
|
|
11
|
+
- Polls a configured Slack channel and records new messages with thread and
|
|
12
|
+
coverage metadata.
|
|
13
|
+
- Ingests read-only pull-request evidence from the existing ai-services read
|
|
14
|
+
boundary.
|
|
15
|
+
- Evaluates editable prompt rules with hard structured guards and stores every
|
|
16
|
+
decision append-only.
|
|
17
|
+
- Lets a human correct a decision, tune a rule, or explicitly approve bounded
|
|
18
|
+
work from the Factory UI or the generic Agent-Native Slack bot.
|
|
19
|
+
- Starts configured Builder or harness work only through an approval action,
|
|
20
|
+
deduped by Factory item, and reconciles signed callbacks and provider state.
|
|
21
|
+
- Surfaces missed callbacks, incomplete evidence, and timeouts as explicit
|
|
22
|
+
states rather than plausible success.
|
|
23
|
+
|
|
24
|
+
The current implementation is deliberately observe-first and shadow-only.
|
|
25
|
+
Sensitive work remains human-gated: auth/session/identity, credentials/vault,
|
|
26
|
+
migrations, payments, security, and publishable `packages/*` changes. Factory
|
|
27
|
+
does not silently auto-merge, assign, or claim a provider action succeeded
|
|
28
|
+
without a terminal record.
|
|
29
|
+
|
|
30
|
+
## Configure Slack
|
|
31
|
+
|
|
32
|
+
Set `WORKSPACE_OWNER_EMAIL` to an existing workspace member for the deployment-
|
|
33
|
+
owned scheduler job. Connect Slack in Settings -> Messaging; Factory resolves
|
|
34
|
+
the workspace credential through the vault resolver and only uses
|
|
35
|
+
`SLACK_BOT_TOKEN` as the resolver's deployment fallback. Do not add a second
|
|
36
|
+
env-only read.
|
|
37
|
+
|
|
38
|
+
In Factory, set the Slack workspace, channel ID, channel name, repository, and
|
|
39
|
+
polling switch. The default scheduler polls once per minute, evaluates a
|
|
40
|
+
bounded page, and preserves errors for reconciliation.
|
|
41
|
+
|
|
42
|
+
The generic Slack bot is wired to Factory. Mention `@agent-native` in a feedback
|
|
43
|
+
thread to inspect the linked item, explain its decision, tune a rule, or say
|
|
44
|
+
"do it now" to create an approval-gated run. The bot replies with an
|
|
45
|
+
inspectable Factory link when a human decision is required.
|
|
46
|
+
|
|
47
|
+
## Hosting
|
|
48
|
+
|
|
49
|
+
Production expects a direct PostgreSQL `DATABASE_URL`,
|
|
50
|
+
`WORKSPACE_OWNER_EMAIL`, and `FACTORY_PUBLIC_URL`. The Builder executor also
|
|
51
|
+
needs `BUILDER_AI_SERVICES_URL` and `BUILDER_PROJECT_ID`; its private key and
|
|
52
|
+
signed callback secret belong in workspace credentials and are resolved at
|
|
53
|
+
runtime. The app remains observe-only until a human explicitly approves a
|
|
54
|
+
Factory item.
|
|
55
|
+
|
|
56
|
+
## Development
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pnpm install
|
|
60
|
+
pnpm --filter factory dev
|
|
61
|
+
pnpm --filter factory typecheck
|
|
62
|
+
pnpm --filter factory test
|
|
63
|
+
pnpm --filter factory build
|
|
64
|
+
```
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# React Router generated types
|
|
2
|
+
.react-router/
|
|
3
|
+
|
|
4
|
+
# Logs
|
|
5
|
+
logs
|
|
6
|
+
*.log
|
|
7
|
+
npm-debug.log*
|
|
8
|
+
pnpm-debug.log*
|
|
9
|
+
|
|
10
|
+
node_modules
|
|
11
|
+
build/
|
|
12
|
+
dist
|
|
13
|
+
dist-ssr
|
|
14
|
+
.output/
|
|
15
|
+
*.local
|
|
16
|
+
|
|
17
|
+
# Editor directories and files
|
|
18
|
+
.vscode/*
|
|
19
|
+
!.vscode/extensions.json
|
|
20
|
+
.idea
|
|
21
|
+
.DS_Store
|
|
22
|
+
*.suo
|
|
23
|
+
*.ntvs*
|
|
24
|
+
*.njsproj
|
|
25
|
+
*.sln
|
|
26
|
+
*.sw?
|
|
27
|
+
|
|
28
|
+
# Environment
|
|
29
|
+
.env
|
|
30
|
+
.env.*
|
|
31
|
+
!.env.example
|
|
32
|
+
|
|
33
|
+
# Data
|
|
34
|
+
data/uploads/
|
|
35
|
+
data/settings.json
|
|
36
|
+
data/.sessions.json
|
|
37
|
+
|
|
38
|
+
# Learnings (personal preferences and memory — use learnings.defaults.md for tracked defaults)
|
|
39
|
+
learnings.md
|
|
40
|
+
|
|
41
|
+
.vercel/
|
|
42
|
+
.agent-native/
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { defineAction } from "@agent-native/core/action";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
import { getDb } from "../server/db/index.js";
|
|
5
|
+
import { factoryComments } from "../server/db/schema.js";
|
|
6
|
+
import { DEFAULT_FACTORY_ID } from "../server/factory-graph/store.js";
|
|
7
|
+
import {
|
|
8
|
+
requireWorkspaceMember,
|
|
9
|
+
workspaceMemberIdentityFromContext,
|
|
10
|
+
} from "../server/lib/require-workspace-member.js";
|
|
11
|
+
import { stableId } from "../server/triage/ids.js";
|
|
12
|
+
|
|
13
|
+
export default defineAction({
|
|
14
|
+
description:
|
|
15
|
+
"Add a review comment to a Factory canvas, node, or edge. Comments are durable collaboration context and do not change or execute the Factory.",
|
|
16
|
+
schema: z.object({
|
|
17
|
+
factoryId: z.string().trim().min(1).max(120).default(DEFAULT_FACTORY_ID),
|
|
18
|
+
graphVersion: z.coerce.number().int().positive(),
|
|
19
|
+
targetType: z.enum(["canvas", "node", "edge"]).default("canvas"),
|
|
20
|
+
targetId: z.string().trim().max(120).optional(),
|
|
21
|
+
body: z.string().trim().min(1).max(4_000),
|
|
22
|
+
}),
|
|
23
|
+
run: async (
|
|
24
|
+
{ factoryId, graphVersion, targetType, targetId, body },
|
|
25
|
+
context,
|
|
26
|
+
) => {
|
|
27
|
+
const { userEmail, orgId } = await requireWorkspaceMember(
|
|
28
|
+
workspaceMemberIdentityFromContext(context),
|
|
29
|
+
);
|
|
30
|
+
const id = stableId(
|
|
31
|
+
"factory-comment",
|
|
32
|
+
orgId,
|
|
33
|
+
factoryId,
|
|
34
|
+
String(graphVersion),
|
|
35
|
+
targetType,
|
|
36
|
+
targetId ?? "canvas",
|
|
37
|
+
body,
|
|
38
|
+
new Date().toISOString(),
|
|
39
|
+
);
|
|
40
|
+
await getDb()
|
|
41
|
+
.insert(factoryComments)
|
|
42
|
+
.values({
|
|
43
|
+
id,
|
|
44
|
+
factoryId,
|
|
45
|
+
graphVersion,
|
|
46
|
+
targetType,
|
|
47
|
+
targetId: targetId ?? null,
|
|
48
|
+
body,
|
|
49
|
+
createdAt: new Date().toISOString(),
|
|
50
|
+
ownerEmail: userEmail,
|
|
51
|
+
orgId,
|
|
52
|
+
});
|
|
53
|
+
return { ok: true, id, factoryId, graphVersion, targetType, targetId };
|
|
54
|
+
},
|
|
55
|
+
});
|
|
@@ -0,0 +1,214 @@
|
|
|
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
|
+
triageItems,
|
|
9
|
+
triageRuns,
|
|
10
|
+
} from "../server/db/schema.js";
|
|
11
|
+
import {
|
|
12
|
+
requireWorkspaceMember,
|
|
13
|
+
workspaceMemberIdentityFromContext,
|
|
14
|
+
} from "../server/lib/require-workspace-member.js";
|
|
15
|
+
import { startBuilderRun } from "../server/triage/builder-executor.js";
|
|
16
|
+
import { stableId } from "../server/triage/ids.js";
|
|
17
|
+
|
|
18
|
+
export default defineAction({
|
|
19
|
+
description:
|
|
20
|
+
"Explicitly approve one Factory item and start one deduplicated Builder coding run. The approver, decision, guard results, and callback state are recorded before provider work is considered successful.",
|
|
21
|
+
schema: z.object({
|
|
22
|
+
itemId: z.string().min(1),
|
|
23
|
+
decisionId: z.string().min(1).optional(),
|
|
24
|
+
confirm: z.literal(true),
|
|
25
|
+
}),
|
|
26
|
+
// Slack content and scheduled observations are untrusted. A provider run
|
|
27
|
+
// must remain paused until a human approves this exact agent tool call.
|
|
28
|
+
needsApproval: true,
|
|
29
|
+
http: { method: "POST" },
|
|
30
|
+
run: async ({ itemId, decisionId, confirm }, context) => {
|
|
31
|
+
if (!confirm) throw new Error("Explicit confirmation is required.");
|
|
32
|
+
const { userEmail, orgId } = await requireWorkspaceMember(
|
|
33
|
+
workspaceMemberIdentityFromContext(context),
|
|
34
|
+
);
|
|
35
|
+
const db = getDb();
|
|
36
|
+
const item = (
|
|
37
|
+
await db
|
|
38
|
+
.select()
|
|
39
|
+
.from(triageItems)
|
|
40
|
+
.where(and(eq(triageItems.id, itemId), eq(triageItems.orgId, orgId)))
|
|
41
|
+
.limit(1)
|
|
42
|
+
)[0];
|
|
43
|
+
if (!item) throw new Error("Factory item not found.");
|
|
44
|
+
|
|
45
|
+
const decisions = await db
|
|
46
|
+
.select()
|
|
47
|
+
.from(triageDecisions)
|
|
48
|
+
.where(
|
|
49
|
+
and(
|
|
50
|
+
eq(triageDecisions.orgId, orgId),
|
|
51
|
+
eq(triageDecisions.itemId, itemId),
|
|
52
|
+
),
|
|
53
|
+
)
|
|
54
|
+
.orderBy(asc(triageDecisions.createdAt));
|
|
55
|
+
const decision = decisionId
|
|
56
|
+
? decisions.find((entry) => entry.id === decisionId)
|
|
57
|
+
: decisions[decisions.length - 1];
|
|
58
|
+
if (!decision)
|
|
59
|
+
throw new Error("Evaluate the Factory item before approving it.");
|
|
60
|
+
|
|
61
|
+
const guardResults = parseGuardResults(decision.guardResultsJson);
|
|
62
|
+
const blocked = guardResults.filter((result) => result.passed === false);
|
|
63
|
+
if (blocked.length > 0) {
|
|
64
|
+
throw new Error(
|
|
65
|
+
`Factory approval blocked by hard guards: ${blocked.map((result) => result.reason).join(" ")}`,
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const dedupeKey = stableId("builder", orgId, itemId, decision.id);
|
|
70
|
+
const runId = stableId("run", dedupeKey);
|
|
71
|
+
const existing = (
|
|
72
|
+
await db
|
|
73
|
+
.select()
|
|
74
|
+
.from(triageRuns)
|
|
75
|
+
.where(and(eq(triageRuns.id, runId), eq(triageRuns.orgId, orgId)))
|
|
76
|
+
.limit(1)
|
|
77
|
+
)[0];
|
|
78
|
+
if (
|
|
79
|
+
existing &&
|
|
80
|
+
["submitted", "acknowledged", "running", "completed"].includes(
|
|
81
|
+
existing.status,
|
|
82
|
+
)
|
|
83
|
+
) {
|
|
84
|
+
return { ok: true, deduplicated: true, run: existing };
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const now = new Date().toISOString();
|
|
88
|
+
await db
|
|
89
|
+
.insert(triageRuns)
|
|
90
|
+
.values({
|
|
91
|
+
id: runId,
|
|
92
|
+
itemId,
|
|
93
|
+
source: item.source,
|
|
94
|
+
provider: "builder-http",
|
|
95
|
+
dedupeKey,
|
|
96
|
+
approvalEmail: userEmail,
|
|
97
|
+
status: "submitted",
|
|
98
|
+
progressLogJson: JSON.stringify([
|
|
99
|
+
{
|
|
100
|
+
at: now,
|
|
101
|
+
state: "submitted",
|
|
102
|
+
reason: "Explicit Factory approval recorded.",
|
|
103
|
+
},
|
|
104
|
+
]),
|
|
105
|
+
dispatchAttempts: (existing?.dispatchAttempts ?? 0) + 1,
|
|
106
|
+
needsContinuation: 0,
|
|
107
|
+
startedAt: now,
|
|
108
|
+
heartbeatAt: now,
|
|
109
|
+
completedAt: null,
|
|
110
|
+
error: null,
|
|
111
|
+
ownerEmail: item.ownerEmail,
|
|
112
|
+
orgId,
|
|
113
|
+
})
|
|
114
|
+
.onConflictDoNothing();
|
|
115
|
+
|
|
116
|
+
const run = (
|
|
117
|
+
await db
|
|
118
|
+
.select()
|
|
119
|
+
.from(triageRuns)
|
|
120
|
+
.where(and(eq(triageRuns.id, runId), eq(triageRuns.orgId, orgId)))
|
|
121
|
+
.limit(1)
|
|
122
|
+
)[0];
|
|
123
|
+
if (!run) throw new Error("Factory run could not be recorded.");
|
|
124
|
+
if (run.status !== "submitted")
|
|
125
|
+
return { ok: true, deduplicated: true, run };
|
|
126
|
+
|
|
127
|
+
try {
|
|
128
|
+
const result = await startBuilderRun({
|
|
129
|
+
runId,
|
|
130
|
+
itemId,
|
|
131
|
+
ownerEmail: userEmail,
|
|
132
|
+
orgId,
|
|
133
|
+
repository: item.repository,
|
|
134
|
+
summary: item.summary,
|
|
135
|
+
sourceUrl: item.sourceUrl,
|
|
136
|
+
});
|
|
137
|
+
const progress = [
|
|
138
|
+
{
|
|
139
|
+
at: now,
|
|
140
|
+
state: "submitted",
|
|
141
|
+
reason: "Explicit Factory approval recorded.",
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
at: new Date().toISOString(),
|
|
145
|
+
state: "acknowledged",
|
|
146
|
+
reason:
|
|
147
|
+
"Builder accepted the fire-and-forget request; waiting for signed callback.",
|
|
148
|
+
},
|
|
149
|
+
];
|
|
150
|
+
await db
|
|
151
|
+
.update(triageRuns)
|
|
152
|
+
.set({
|
|
153
|
+
status: "acknowledged",
|
|
154
|
+
providerTaskId: result.providerTaskId ?? null,
|
|
155
|
+
progressLogJson: JSON.stringify(progress),
|
|
156
|
+
heartbeatAt: new Date().toISOString(),
|
|
157
|
+
})
|
|
158
|
+
.where(and(eq(triageRuns.id, runId), eq(triageRuns.orgId, orgId)));
|
|
159
|
+
await db
|
|
160
|
+
.update(triageItems)
|
|
161
|
+
.set({ status: "classified", updatedAt: new Date().toISOString() })
|
|
162
|
+
.where(and(eq(triageItems.id, itemId), eq(triageItems.orgId, orgId)));
|
|
163
|
+
return {
|
|
164
|
+
ok: true,
|
|
165
|
+
deduplicated: false,
|
|
166
|
+
runId,
|
|
167
|
+
branchName: result.branchName,
|
|
168
|
+
};
|
|
169
|
+
} catch (error) {
|
|
170
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
171
|
+
await db
|
|
172
|
+
.update(triageRuns)
|
|
173
|
+
.set({
|
|
174
|
+
status: "failed",
|
|
175
|
+
error: message,
|
|
176
|
+
completedAt: new Date().toISOString(),
|
|
177
|
+
heartbeatAt: new Date().toISOString(),
|
|
178
|
+
})
|
|
179
|
+
.where(and(eq(triageRuns.id, runId), eq(triageRuns.orgId, orgId)));
|
|
180
|
+
throw new Error(
|
|
181
|
+
`Factory approval was recorded, but Builder dispatch failed: ${message}`,
|
|
182
|
+
);
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
function parseGuardResults(
|
|
188
|
+
value: string,
|
|
189
|
+
): Array<{ passed: boolean; reason: string }> {
|
|
190
|
+
let parsed: unknown;
|
|
191
|
+
try {
|
|
192
|
+
parsed = JSON.parse(value);
|
|
193
|
+
} catch {
|
|
194
|
+
throw new Error("Factory decision guard results are unreadable.");
|
|
195
|
+
}
|
|
196
|
+
if (!Array.isArray(parsed))
|
|
197
|
+
throw new Error("Factory decision guard results are unreadable.");
|
|
198
|
+
return parsed.map((entry) => {
|
|
199
|
+
if (
|
|
200
|
+
!entry ||
|
|
201
|
+
typeof entry !== "object" ||
|
|
202
|
+
typeof (entry as { passed?: unknown }).passed !== "boolean"
|
|
203
|
+
) {
|
|
204
|
+
throw new Error("Factory decision guard results are unreadable.");
|
|
205
|
+
}
|
|
206
|
+
return {
|
|
207
|
+
passed: (entry as { passed: boolean }).passed,
|
|
208
|
+
reason: String(
|
|
209
|
+
(entry as { reason?: unknown }).reason ??
|
|
210
|
+
"Guard did not provide a reason.",
|
|
211
|
+
),
|
|
212
|
+
};
|
|
213
|
+
});
|
|
214
|
+
}
|