@agent-native/core 0.132.1 → 0.133.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/corpus/README.md +2 -2
- package/corpus/core/CHANGELOG.md +198 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/correlation.ts +11 -1
- package/corpus/core/src/a2a/types.ts +11 -3
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +33 -46
- package/corpus/core/src/agent/engine/builder-engine.ts +22 -10
- package/corpus/core/src/agent/engine/error-detail.ts +184 -3
- package/corpus/core/src/agent/engine/failure-taxonomy.ts +123 -0
- package/corpus/core/src/agent/engine/index.ts +8 -0
- package/corpus/core/src/agent/engine/registry.ts +92 -8
- package/corpus/core/src/agent/engine/translate-ai-sdk.ts +17 -2
- package/corpus/core/src/agent/production-agent.ts +13 -33
- package/corpus/core/src/agent/run-loop-with-resume.ts +1 -1
- package/corpus/core/src/agent/run-manager.ts +43 -14
- package/corpus/core/src/agent/run-store.ts +30 -3
- package/corpus/core/src/agent/thread-data-builder.ts +36 -4
- package/corpus/core/src/chat-threads/store.ts +42 -0
- package/corpus/core/src/cli/templates-meta.ts +13 -0
- package/corpus/core/src/cli/workspace-dev.ts +1 -0
- package/corpus/core/src/client/error-format.ts +12 -0
- package/corpus/core/src/client/use-chat-threads.ts +76 -16
- package/corpus/core/src/credentials/index.ts +51 -12
- package/corpus/core/src/extensions/url-safety.ts +46 -12
- package/corpus/core/src/integrations/adapters/slack.ts +32 -10
- package/corpus/core/src/integrations/google-docs-poller.ts +12 -1
- package/corpus/core/src/integrations/installations-store.ts +30 -0
- package/corpus/core/src/integrations/plugin.ts +5 -5
- package/corpus/core/src/integrations/types.ts +7 -0
- package/corpus/core/src/integrations/webhook-handler.ts +24 -1
- package/corpus/core/src/jobs/background-automation-runner.ts +38 -1
- package/corpus/core/src/provider-api/index.ts +8 -2
- package/corpus/core/src/scripts/call-agent.ts +6 -0
- package/corpus/core/src/server/agent-chat-plugin.ts +46 -10
- package/corpus/core/src/server/agent-discovery.ts +2 -0
- package/corpus/core/src/server/builder-design-systems.ts +21 -0
- package/corpus/core/src/server/credential-provider.ts +51 -12
- package/corpus/core/src/server/index.ts +1 -0
- package/corpus/core/src/server/onboarding-html.ts +37 -2
- package/corpus/core/src/shared/reasoning-effort.ts +1 -1
- package/corpus/core/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +6 -2
- package/corpus/templates/assets/app/components/layout/Sidebar.tsx +39 -19
- package/corpus/templates/assets/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +30 -3
- package/corpus/templates/brain/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/calendar/app/components/layout/AppLayout.tsx +1 -1
- package/corpus/templates/calendar/app/components/layout/Sidebar.tsx +54 -25
- package/corpus/templates/calendar/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/chat/app/components/layout/Sidebar.tsx +30 -3
- package/corpus/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/clips/app/components/library/library-layout.tsx +37 -21
- package/corpus/templates/clips/changelog/2026-07-30-meeting-microphone-transcription-works-reliably-from-the-fir.md +6 -0
- package/corpus/templates/clips/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/clips/desktop/src/hooks/useMediaDevices.ts +1 -1
- package/corpus/templates/clips/desktop/src/lib/media-capture-constraints.ts +1 -1
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +13 -0
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen.rs +2 -0
- package/corpus/templates/clips/desktop/src-tauri/src/system_audio.rs +25 -132
- package/corpus/templates/content/app/components/sidebar/DocumentSidebar.tsx +34 -17
- package/corpus/templates/content/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/design/.agents/skills/design-systems/SKILL.md +6 -2
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +5 -0
- package/corpus/templates/design/actions/create-design-system.ts +1 -0
- package/corpus/templates/design/actions/set-default-design-system.ts +34 -26
- package/corpus/templates/design/app/components/design/KeyboardShortcutsPanel.tsx +5 -3
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +23 -0
- package/corpus/templates/design/app/components/design/keyboard-shortcuts.ts +3 -0
- package/corpus/templates/design/app/components/layout/Sidebar.tsx +21 -4
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +11 -7
- package/corpus/templates/design/app/i18n-data.ts +39 -0
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +229 -12
- package/corpus/templates/design/app/pages/DesignSystems.tsx +10 -4
- package/corpus/templates/design/changelog/2026-07-30-fixed-the-keyboard-shortcuts-panel-not-opening-with-ctrl-shi.md +6 -0
- package/corpus/templates/design/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/design/changelog/2026-07-31-design-system-indexing-keeps-your-chosen-name-when-you-uploa.md +6 -0
- package/corpus/templates/design/server/lib/builder-design-system-proxy.ts +19 -4
- package/corpus/templates/dispatch/AGENTS.md +4 -0
- package/corpus/templates/factory/.agents/skills/actions/SKILL.md +562 -0
- package/corpus/templates/factory/.agents/skills/adding-a-feature/SKILL.md +198 -0
- package/corpus/templates/factory/.agents/skills/agent-native-docs/SKILL.md +115 -0
- package/corpus/templates/factory/.agents/skills/agent-native-toolkit/SKILL.md +182 -0
- package/corpus/templates/factory/.agents/skills/capture-learnings/SKILL.md +89 -0
- package/corpus/templates/factory/.agents/skills/create-skill/SKILL.md +221 -0
- package/corpus/templates/factory/.agents/skills/customizing-agent-native/SKILL.md +220 -0
- package/corpus/templates/factory/.agents/skills/delegate-to-agent/SKILL.md +263 -0
- package/corpus/templates/factory/.agents/skills/factory-graphs/SKILL.md +52 -0
- package/corpus/templates/factory/.agents/skills/feature-flags/SKILL.md +169 -0
- package/corpus/templates/factory/.agents/skills/frontend-design/SKILL.md +174 -0
- package/corpus/templates/factory/.agents/skills/real-time-sync/SKILL.md +232 -0
- package/corpus/templates/factory/.agents/skills/security/SKILL.md +324 -0
- package/corpus/templates/factory/.agents/skills/self-modifying-code/SKILL.md +119 -0
- package/corpus/templates/factory/.agents/skills/shadcn-ui/SKILL.md +123 -0
- package/corpus/templates/factory/.agents/skills/sharing/SKILL.md +232 -0
- package/corpus/templates/factory/.agents/skills/storing-data/SKILL.md +178 -0
- package/corpus/templates/factory/.agents/skills/upgrade-agent-native/SKILL.md +122 -0
- package/corpus/templates/factory/.env.example +24 -0
- package/corpus/templates/factory/.ignore +0 -0
- package/corpus/templates/factory/.oxfmtrc.json +8 -0
- package/corpus/templates/factory/AGENTS.md +90 -0
- package/corpus/templates/factory/CHANGELOG.md +10 -0
- package/corpus/templates/factory/DEVELOPING.md +185 -0
- package/corpus/templates/factory/README.md +64 -0
- package/corpus/templates/factory/_gitignore +42 -0
- package/corpus/templates/factory/actions/add-factory-comment.ts +55 -0
- package/corpus/templates/factory/actions/approve-factory-item.ts +214 -0
- package/corpus/templates/factory/actions/babysit-pull-request.ts +126 -0
- package/corpus/templates/factory/actions/evaluate-triage-item.ts +172 -0
- package/corpus/templates/factory/actions/get-factory-graph.ts +62 -0
- package/corpus/templates/factory/actions/get-triage-config.ts +42 -0
- package/corpus/templates/factory/actions/get-triage-item.ts +74 -0
- package/corpus/templates/factory/actions/hello.ts +13 -0
- package/corpus/templates/factory/actions/ingest-github-observation.ts +100 -0
- package/corpus/templates/factory/actions/list-factories.ts +40 -0
- package/corpus/templates/factory/actions/list-factory-comments.ts +40 -0
- package/corpus/templates/factory/actions/list-triage-items.ts +85 -0
- package/corpus/templates/factory/actions/list-triage-rules.ts +44 -0
- package/corpus/templates/factory/actions/navigate.ts +41 -0
- package/corpus/templates/factory/actions/poll-slack-channel.ts +118 -0
- package/corpus/templates/factory/actions/reconcile-triage-run.ts +179 -0
- package/corpus/templates/factory/actions/record-triage-feedback.ts +58 -0
- package/corpus/templates/factory/actions/run.ts +2 -0
- package/corpus/templates/factory/actions/save-factory-graph.ts +129 -0
- package/corpus/templates/factory/actions/save-triage-config.ts +67 -0
- package/corpus/templates/factory/actions/save-triage-rule.ts +89 -0
- package/corpus/templates/factory/actions/suggest-factory-rules.ts +70 -0
- package/corpus/templates/factory/actions/view-screen.ts +73 -0
- package/corpus/templates/factory/app/components/factory/FactoryCanvas.tsx +441 -0
- package/corpus/templates/factory/app/components/factory/FactoryInspector.tsx +388 -0
- package/corpus/templates/factory/app/components/layout/Header.tsx +60 -0
- package/corpus/templates/factory/app/components/layout/Layout.tsx +190 -0
- package/corpus/templates/factory/app/components/layout/Sidebar.tsx +538 -0
- package/corpus/templates/factory/app/components/triage/triage-status-pill.tsx +28 -0
- package/corpus/templates/factory/app/components/ui/button.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/card.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/dropdown-menu.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/input.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/label.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/sheet.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/textarea.tsx +1 -0
- package/corpus/templates/factory/app/components/ui/toolkit-provider.tsx +17 -0
- package/corpus/templates/factory/app/components/ui/tooltip.tsx +1 -0
- package/corpus/templates/factory/app/design-system.ts +3 -0
- package/corpus/templates/factory/app/entry.client.tsx +22 -0
- package/corpus/templates/factory/app/entry.server.tsx +10 -0
- package/corpus/templates/factory/app/global.css +93 -0
- package/corpus/templates/factory/app/hooks/use-navigation-state.ts +113 -0
- package/corpus/templates/factory/app/i18n/en-US.ts +211 -0
- package/corpus/templates/factory/app/i18n/index.ts +34 -0
- package/corpus/templates/factory/app/i18n-data.ts +556 -0
- package/corpus/templates/factory/app/lib/agent-page.tsx +49 -0
- package/corpus/templates/factory/app/lib/app-config.ts +11 -0
- package/corpus/templates/factory/app/lib/tab-id.ts +1 -0
- package/corpus/templates/factory/app/lib/utils.ts +1 -0
- package/corpus/templates/factory/app/root.tsx +175 -0
- package/corpus/templates/factory/app/routes/_index.tsx +94 -0
- package/corpus/templates/factory/app/routes/agent.tsx +24 -0
- package/corpus/templates/factory/app/routes/chat.$threadId.tsx +1 -0
- package/corpus/templates/factory/app/routes/database.tsx +17 -0
- package/corpus/templates/factory/app/routes/extensions.$id.$slug.tsx +2 -0
- package/corpus/templates/factory/app/routes/extensions.$id.tsx +11 -0
- package/corpus/templates/factory/app/routes/extensions._index.tsx +11 -0
- package/corpus/templates/factory/app/routes/extensions.tsx +5 -0
- package/corpus/templates/factory/app/routes/factory.tsx +1003 -0
- package/corpus/templates/factory/app/routes/observability.tsx +19 -0
- package/corpus/templates/factory/app/routes/settings.tsx +89 -0
- package/corpus/templates/factory/app/routes/team.tsx +11 -0
- package/corpus/templates/factory/app/routes.ts +4 -0
- package/corpus/templates/factory/app/vite-env.d.ts +6 -0
- package/corpus/templates/factory/changelog/2026-06-24-a-new-settings-page-gives-quick-access-to-language-workspace.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-24-added-a-language-picker-and-localized-app-chrome-for-support.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-27-traditional-chinese-copy-uses-taiwan-terminology.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-28-left-sidebar-collapse-motion-and-footer-chrome-are-quieter.md +6 -0
- package/corpus/templates/factory/changelog/2026-06-29-chat-layouts-adapt-when-the-agent-sidebar-is-open.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-08-settings-are-cleaner-and-searchable.md +5 -0
- package/corpus/templates/factory/changelog/2026-07-10-chat-now-makes-ai-connection-setup-clear-without-shifting-th.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-13-a-full-agent-page-now-brings-context-files-connections-jobs-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-14-chat-opens-reliably-on-hosted-deployments-instead-of-failing.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-14-fixed-chat-template-startup-with-older-core-versions.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-15-chat-navigation-focuses-on-chat-and-agent.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-17-the-agent-chat-sidebar-stays-closed-until-you-open-it-or-sta.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-compact-sidebar-footer.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-full-page-chat-keeps-the-active-conversation-when-moving-to-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-manage-agent-navigation-now-uses-the-connected-nodes-icon.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-22-recent-chats-are-easier-to-scan-and-expand.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-23-full-page-chat-is-better-centered-with-quieter-chat-history-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-24-borderless-secondary-surfaces.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-24-sidebar-footer-controls-follow-a-consistent-order.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-25-settings-navigation-now-keeps-manage-agent-as-a-dedicated-li.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-29-sidebar-footers-now-keep-feedback-search-and-collapse-togeth.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-31-added-an-inspectable-observe-only-factory-queue-for-slack-.md +6 -0
- package/corpus/templates/factory/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/factory/components.json +20 -0
- package/corpus/templates/factory/data/sync-config.json +1 -0
- package/corpus/templates/factory/learnings.defaults.md +5 -0
- package/corpus/templates/factory/netlify.toml +10 -0
- package/corpus/templates/factory/package.json +105 -0
- package/corpus/templates/factory/public/agent-native-icon-dark.svg +10 -0
- package/corpus/templates/factory/public/agent-native-icon-light.svg +10 -0
- package/corpus/templates/factory/public/agent-native-logo-dark.svg +21 -0
- package/corpus/templates/factory/public/agent-native-logo-light.svg +21 -0
- package/corpus/templates/factory/public/favicon.svg +1 -0
- package/corpus/templates/factory/public/icon-180.svg +1 -0
- package/corpus/templates/factory/public/icon-192.svg +1 -0
- package/corpus/templates/factory/public/icon-512.svg +1 -0
- package/corpus/templates/factory/public/manifest.json +21 -0
- package/corpus/templates/factory/react-router.config.ts +7 -0
- package/corpus/templates/factory/server/connectors/credentials.ts +129 -0
- package/corpus/templates/factory/server/connectors/slack.ts +129 -0
- package/corpus/templates/factory/server/db/index.ts +6 -0
- package/corpus/templates/factory/server/db/schema.ts +193 -0
- package/corpus/templates/factory/server/factory-graph/contracts.ts +212 -0
- package/corpus/templates/factory/server/factory-graph/store.ts +121 -0
- package/corpus/templates/factory/server/lib/require-workspace-member.ts +55 -0
- package/corpus/templates/factory/server/middleware/auth.ts +15 -0
- package/corpus/templates/factory/server/plugins/agent-chat.ts +58 -0
- package/corpus/templates/factory/server/plugins/auth.ts +14 -0
- package/corpus/templates/factory/server/plugins/factory-migrations.ts +247 -0
- package/corpus/templates/factory/server/plugins/factory-scheduler-job.ts +116 -0
- package/corpus/templates/factory/server/plugins/integrations.ts +46 -0
- package/corpus/templates/factory/server/routes/[...page].get.ts +5 -0
- package/corpus/templates/factory/server/routes/_agent-native/factory/builder-callback.post.ts +116 -0
- package/corpus/templates/factory/server/triage/ai-services-git.ts +197 -0
- package/corpus/templates/factory/server/triage/builder-executor.ts +118 -0
- package/corpus/templates/factory/server/triage/contracts.ts +164 -0
- package/corpus/templates/factory/server/triage/github-ingestion.ts +35 -0
- package/corpus/templates/factory/server/triage/guards.ts +121 -0
- package/corpus/templates/factory/server/triage/ids.ts +27 -0
- package/corpus/templates/factory/server/triage/pr-babysit.ts +100 -0
- package/corpus/templates/factory/server/triage/pr-monitor.ts +220 -0
- package/corpus/templates/factory/server/triage/slack-client.ts +55 -0
- package/corpus/templates/factory/server/triage/slack-poller.ts +152 -0
- package/corpus/templates/factory/ssr-entry.ts +15 -0
- package/corpus/templates/factory/tsconfig.json +21 -0
- package/corpus/templates/factory/vite.config.ts +19 -0
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +55 -5
- package/corpus/templates/forms/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/macros/app/components/layout/AppLayout.tsx +6 -2
- package/corpus/templates/plan/app/components/layout/Sidebar.tsx +21 -6
- package/corpus/templates/plan/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/corpus/templates/slides/.agents/skills/create-deck/SKILL.md +12 -0
- package/corpus/templates/slides/.agents/skills/design-systems/SKILL.md +9 -0
- package/corpus/templates/slides/.agents/skills/slide-editing/SKILL.md +11 -0
- package/corpus/templates/slides/AGENTS.md +5 -6
- package/corpus/templates/slides/actions/_await-fit-check.ts +20 -10
- package/corpus/templates/slides/actions/add-slide.ts +17 -4
- package/corpus/templates/slides/actions/create-design-system.ts +16 -4
- package/corpus/templates/slides/actions/delete-design-system.ts +18 -2
- package/corpus/templates/slides/actions/get-layout-overflows.ts +88 -0
- package/corpus/templates/slides/actions/import-file.ts +1 -0
- package/corpus/templates/slides/actions/index-design-system-with-builder.ts +8 -0
- package/corpus/templates/slides/actions/patch-deck.ts +48 -16
- package/corpus/templates/slides/actions/set-default-design-system.ts +49 -19
- package/corpus/templates/slides/actions/update-slide.ts +13 -3
- package/corpus/templates/slides/actions/view-screen.ts +87 -10
- package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +155 -28
- package/corpus/templates/slides/app/components/design-system/DesignSystemCard.tsx +21 -17
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +849 -341
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +102 -2
- package/corpus/templates/slides/app/components/editor/PromptDialog.tsx +13 -16
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +60 -12
- package/corpus/templates/slides/app/components/editor/SlideOverflowWarning.tsx +11 -1
- package/corpus/templates/slides/app/components/layout/Sidebar.tsx +66 -19
- package/corpus/templates/slides/app/i18n/en-US.ts +23 -0
- package/corpus/templates/slides/app/lib/normalize-slide-padding.ts +8 -15
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +4 -3
- package/corpus/templates/slides/app/pages/DesignSystems.tsx +4 -3
- package/corpus/templates/slides/app/pages/Index.tsx +1 -1
- package/corpus/templates/slides/changelog/2026-07-31-design-system-details-now-show-their-source-and-indexing-sta.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-design-system-indexing-keeps-your-chosen-name-when-you-uploa.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-design-system-setup-keeps-focus-rings-visible-and-uses-a-sim.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-skip-prompt-is-now-available-in-the-new-deck-prompt-header.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-slides-now-detect-real-text-and-box-overflow-across-the-deck.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-31-the-agent-native-logo-stays-visible-when-the-sidebar-is-coll.md +6 -0
- package/corpus/templates/slides/server/handlers/design-systems.ts +1 -0
- package/corpus/templates/slides/server/handlers/index-design-system-sources.ts +1 -0
- package/corpus/templates/slides/server/lib/builder-design-system-proxy.ts +23 -4
- package/corpus/templates/slides/server/plugins/agent-chat.ts +5 -0
- package/corpus/templates/slides/server/plugins/creative-context.ts +16 -3
- package/corpus/templates/slides/server/workspace-defaults.ts +5 -1
- package/corpus/templates/slides/shared/slide-fit.ts +26 -0
- package/corpus/templates/tasks/app/components/layout/Sidebar.tsx +30 -3
- package/corpus/templates/tasks/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/dist/a2a/correlation.d.ts +4 -1
- package/dist/a2a/correlation.d.ts.map +1 -1
- package/dist/a2a/correlation.js +8 -1
- package/dist/a2a/correlation.js.map +1 -1
- package/dist/a2a/types.d.ts +11 -3
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +27 -41
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/builder-engine.d.ts.map +1 -1
- package/dist/agent/engine/builder-engine.js +18 -8
- package/dist/agent/engine/builder-engine.js.map +1 -1
- package/dist/agent/engine/error-detail.d.ts +61 -0
- package/dist/agent/engine/error-detail.d.ts.map +1 -1
- package/dist/agent/engine/error-detail.js +145 -3
- package/dist/agent/engine/error-detail.js.map +1 -1
- package/dist/agent/engine/failure-taxonomy.d.ts +24 -0
- package/dist/agent/engine/failure-taxonomy.d.ts.map +1 -0
- package/dist/agent/engine/failure-taxonomy.js +88 -0
- package/dist/agent/engine/failure-taxonomy.js.map +1 -0
- package/dist/agent/engine/index.d.ts +2 -1
- package/dist/agent/engine/index.d.ts.map +1 -1
- package/dist/agent/engine/index.js +2 -1
- package/dist/agent/engine/index.js.map +1 -1
- package/dist/agent/engine/registry.d.ts +16 -0
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +71 -6
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/engine/translate-ai-sdk.d.ts.map +1 -1
- package/dist/agent/engine/translate-ai-sdk.js +14 -2
- package/dist/agent/engine/translate-ai-sdk.js.map +1 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +13 -24
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.js +1 -1
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +39 -10
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +10 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +20 -3
- package/dist/agent/run-store.js.map +1 -1
- package/dist/agent/thread-data-builder.d.ts.map +1 -1
- package/dist/agent/thread-data-builder.js +28 -4
- package/dist/agent/thread-data-builder.js.map +1 -1
- package/dist/chat-threads/store.d.ts +13 -0
- package/dist/chat-threads/store.d.ts.map +1 -1
- package/dist/chat-threads/store.js +35 -0
- package/dist/chat-threads/store.js.map +1 -1
- package/dist/cli/templates-meta.d.ts.map +1 -1
- package/dist/cli/templates-meta.js +13 -0
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +1 -0
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/error-format.d.ts.map +1 -1
- package/dist/client/error-format.js +10 -0
- package/dist/client/error-format.js.map +1 -1
- package/dist/client/use-chat-threads.d.ts.map +1 -1
- package/dist/client/use-chat-threads.js +66 -16
- package/dist/client/use-chat-threads.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/credentials/index.d.ts +9 -2
- package/dist/credentials/index.d.ts.map +1 -1
- package/dist/credentials/index.js +50 -8
- package/dist/credentials/index.js.map +1 -1
- package/dist/extensions/url-safety.d.ts.map +1 -1
- package/dist/extensions/url-safety.js +38 -12
- package/dist/extensions/url-safety.js.map +1 -1
- package/dist/integrations/adapters/slack.d.ts.map +1 -1
- package/dist/integrations/adapters/slack.js +25 -8
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/google-docs-poller.d.ts.map +1 -1
- package/dist/integrations/google-docs-poller.js +13 -1
- package/dist/integrations/google-docs-poller.js.map +1 -1
- package/dist/integrations/installations-store.d.ts +10 -0
- package/dist/integrations/installations-store.d.ts.map +1 -1
- package/dist/integrations/installations-store.js +24 -0
- package/dist/integrations/installations-store.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +6 -5
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/types.d.ts +7 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/integrations/webhook-handler.d.ts.map +1 -1
- package/dist/integrations/webhook-handler.js +16 -1
- package/dist/integrations/webhook-handler.js.map +1 -1
- package/dist/jobs/background-automation-runner.d.ts.map +1 -1
- package/dist/jobs/background-automation-runner.js +35 -2
- package/dist/jobs/background-automation-runner.js.map +1 -1
- package/dist/notifications/routes.d.ts +6 -6
- package/dist/observability/routes.d.ts +3 -3
- package/dist/provider-api/actions/custom-provider-registration.d.ts +14 -14
- package/dist/provider-api/actions/provider-api.d.ts +8 -8
- package/dist/provider-api/index.js +7 -3
- package/dist/provider-api/index.js.map +1 -1
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +6 -1
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +38 -9
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-discovery.d.ts +2 -0
- package/dist/server/agent-discovery.d.ts.map +1 -1
- package/dist/server/agent-discovery.js.map +1 -1
- package/dist/server/builder-design-systems.d.ts +4 -1
- package/dist/server/builder-design-systems.d.ts.map +1 -1
- package/dist/server/builder-design-systems.js +11 -1
- package/dist/server/builder-design-systems.js.map +1 -1
- package/dist/server/credential-provider.d.ts.map +1 -1
- package/dist/server/credential-provider.js +49 -12
- package/dist/server/credential-provider.js.map +1 -1
- package/dist/server/index.d.ts +1 -1
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/server/onboarding-html.d.ts.map +1 -1
- package/dist/server/onboarding-html.js +37 -2
- package/dist/server/onboarding-html.js.map +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/shared/reasoning-effort.d.ts +1 -0
- package/dist/shared/reasoning-effort.d.ts.map +1 -1
- package/dist/shared/reasoning-effort.js +1 -1
- package/dist/shared/reasoning-effort.js.map +1 -1
- package/dist/templates/chat/app/components/layout/Sidebar.tsx +30 -3
- package/dist/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
- package/package.json +1 -1
- package/src/a2a/correlation.ts +11 -1
- package/src/a2a/types.ts +11 -3
- package/src/agent/engine/ai-sdk-engine.ts +33 -46
- package/src/agent/engine/builder-engine.ts +22 -10
- package/src/agent/engine/error-detail.ts +184 -3
- package/src/agent/engine/failure-taxonomy.ts +123 -0
- package/src/agent/engine/index.ts +8 -0
- package/src/agent/engine/registry.ts +92 -8
- package/src/agent/engine/translate-ai-sdk.ts +17 -2
- package/src/agent/production-agent.ts +13 -33
- package/src/agent/run-loop-with-resume.ts +1 -1
- package/src/agent/run-manager.ts +43 -14
- package/src/agent/run-store.ts +30 -3
- package/src/agent/thread-data-builder.ts +36 -4
- package/src/chat-threads/store.ts +42 -0
- package/src/cli/templates-meta.ts +13 -0
- package/src/cli/workspace-dev.ts +1 -0
- package/src/client/error-format.ts +12 -0
- package/src/client/use-chat-threads.ts +76 -16
- package/src/credentials/index.ts +51 -12
- package/src/extensions/url-safety.ts +46 -12
- package/src/integrations/adapters/slack.ts +32 -10
- package/src/integrations/google-docs-poller.ts +12 -1
- package/src/integrations/installations-store.ts +30 -0
- package/src/integrations/plugin.ts +5 -5
- package/src/integrations/types.ts +7 -0
- package/src/integrations/webhook-handler.ts +24 -1
- package/src/jobs/background-automation-runner.ts +38 -1
- package/src/provider-api/index.ts +8 -2
- package/src/scripts/call-agent.ts +6 -0
- package/src/server/agent-chat-plugin.ts +46 -10
- package/src/server/agent-discovery.ts +2 -0
- package/src/server/builder-design-systems.ts +21 -0
- package/src/server/credential-provider.ts +51 -12
- package/src/server/index.ts +1 -0
- package/src/server/onboarding-html.ts +37 -2
- package/src/shared/reasoning-effort.ts +1 -1
- package/src/templates/chat/app/components/layout/Sidebar.tsx +30 -3
- package/src/templates/chat/changelog/2026-07-31-clicking-the-agent-native-logo-now-toggles-the-app-sidebar.md +6 -0
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +11 -0
- package/corpus/templates/clips/desktop/src/lib/media-device-selection.ts +0 -157
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import type { PullRequestCheckObservation } from "./pr-monitor.js";
|
|
2
|
+
|
|
3
|
+
export interface ReviewCommentObservation {
|
|
4
|
+
id: string;
|
|
5
|
+
author: string;
|
|
6
|
+
inReplyToId: string | null;
|
|
7
|
+
body: string;
|
|
8
|
+
path?: string;
|
|
9
|
+
line?: number;
|
|
10
|
+
createdAt: string;
|
|
11
|
+
// Provider thread resolution. `undefined` means the provider could not tell
|
|
12
|
+
// us — its lookup can fail or page out — so it is unknown, never resolved.
|
|
13
|
+
isResolved?: boolean;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface BabysitInput {
|
|
17
|
+
comments: readonly ReviewCommentObservation[];
|
|
18
|
+
checks: readonly PullRequestCheckObservation[];
|
|
19
|
+
failingJobLog?: string;
|
|
20
|
+
botAuthors?: readonly string[];
|
|
21
|
+
commentsTruncated?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface BabysitProposal {
|
|
25
|
+
unansweredComments: ReviewCommentObservation[];
|
|
26
|
+
failingChecks: PullRequestCheckObservation[];
|
|
27
|
+
missingChangesetPackages: string[];
|
|
28
|
+
pendingChecks: PullRequestCheckObservation[];
|
|
29
|
+
commentsTruncated: boolean;
|
|
30
|
+
isClean: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const MISSING_CHANGESET_LINE = /^MISSING_CHANGESET_PACKAGES:\s*(.*)$/m;
|
|
34
|
+
|
|
35
|
+
function parseMissingChangesetPackages(log: string | undefined): string[] {
|
|
36
|
+
const match = log ? MISSING_CHANGESET_LINE.exec(log) : null;
|
|
37
|
+
if (!match) return [];
|
|
38
|
+
return match[1]
|
|
39
|
+
.split(",")
|
|
40
|
+
.map((pkg) => pkg.trim())
|
|
41
|
+
.filter((pkg) => pkg.length > 0);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Provider resolution wins when the provider knows it. `undefined` falls back
|
|
45
|
+
// to reply state rather than clearing the thread: treating unknown as resolved
|
|
46
|
+
// would silently mark every open thread handled whenever the provider's
|
|
47
|
+
// resolution lookup fails.
|
|
48
|
+
function isAnswered(
|
|
49
|
+
comment: ReviewCommentObservation,
|
|
50
|
+
repliedToIds: ReadonlySet<string>,
|
|
51
|
+
): boolean {
|
|
52
|
+
if (comment.isResolved !== undefined) return comment.isResolved;
|
|
53
|
+
return repliedToIds.has(comment.id);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export function reconcileBabysitState(input: BabysitInput): BabysitProposal {
|
|
57
|
+
const botAuthors = new Set(input.botAuthors ?? []);
|
|
58
|
+
// Reply state, not a timestamp: a comment with any reply anywhere in the
|
|
59
|
+
// set is answered, regardless of when it was posted relative to a prior
|
|
60
|
+
// check. Filtering by "since" would re-hide an earlier unanswered round.
|
|
61
|
+
const repliedToIds = new Set(
|
|
62
|
+
input.comments
|
|
63
|
+
.map((comment) => comment.inReplyToId)
|
|
64
|
+
.filter((id): id is string => id !== null),
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const unansweredComments = input.comments.filter(
|
|
68
|
+
(comment) =>
|
|
69
|
+
comment.inReplyToId === null &&
|
|
70
|
+
!isAnswered(comment, repliedToIds) &&
|
|
71
|
+
!botAuthors.has(comment.author),
|
|
72
|
+
);
|
|
73
|
+
const failingChecks = input.checks.filter(
|
|
74
|
+
(check) => check.state === "failed",
|
|
75
|
+
);
|
|
76
|
+
const pendingChecks = input.checks.filter(
|
|
77
|
+
(check) => check.state === "queued" || check.state === "in_progress",
|
|
78
|
+
);
|
|
79
|
+
const missingChangesetPackages = parseMissingChangesetPackages(
|
|
80
|
+
input.failingJobLog,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
// A capped comment page hides unanswered threads beyond it, which reads as
|
|
84
|
+
// clean — the same false all-clear a "since" filter produces.
|
|
85
|
+
const commentsTruncated = input.commentsTruncated === true;
|
|
86
|
+
|
|
87
|
+
return {
|
|
88
|
+
unansweredComments,
|
|
89
|
+
failingChecks,
|
|
90
|
+
missingChangesetPackages,
|
|
91
|
+
pendingChecks,
|
|
92
|
+
commentsTruncated,
|
|
93
|
+
isClean:
|
|
94
|
+
!commentsTruncated &&
|
|
95
|
+
unansweredComments.length === 0 &&
|
|
96
|
+
failingChecks.length === 0 &&
|
|
97
|
+
missingChangesetPackages.length === 0 &&
|
|
98
|
+
pendingChecks.length === 0,
|
|
99
|
+
};
|
|
100
|
+
}
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import type { ExecutorState, TriageItemStatus } from "./contracts.js";
|
|
2
|
+
|
|
3
|
+
export type PullRequestReviewState =
|
|
4
|
+
| "approved"
|
|
5
|
+
| "changes_requested"
|
|
6
|
+
| "commented"
|
|
7
|
+
| "pending";
|
|
8
|
+
|
|
9
|
+
export interface PullRequestReviewObservation {
|
|
10
|
+
author: string;
|
|
11
|
+
state: PullRequestReviewState;
|
|
12
|
+
observedAt: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type PullRequestCheckState =
|
|
16
|
+
| "queued"
|
|
17
|
+
| "in_progress"
|
|
18
|
+
| "passed"
|
|
19
|
+
| "failed"
|
|
20
|
+
| "cancelled";
|
|
21
|
+
|
|
22
|
+
export interface PullRequestCheckObservation {
|
|
23
|
+
name: string;
|
|
24
|
+
state: PullRequestCheckState;
|
|
25
|
+
observedAt: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PullRequestObservation {
|
|
29
|
+
readonly repo: string;
|
|
30
|
+
readonly pullRequestNumber: number;
|
|
31
|
+
readonly headSha: string;
|
|
32
|
+
readonly reviews: readonly PullRequestReviewObservation[];
|
|
33
|
+
readonly checks: readonly PullRequestCheckObservation[];
|
|
34
|
+
readonly observedAt: string;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export interface PullRequestMonitorCallback {
|
|
38
|
+
state: ExecutorState;
|
|
39
|
+
observedAt: string;
|
|
40
|
+
terminalReason?: string;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface PullRequestMonitorInput {
|
|
44
|
+
triageItemId: string;
|
|
45
|
+
runId: string;
|
|
46
|
+
callback?: PullRequestMonitorCallback;
|
|
47
|
+
providerObservation?: PullRequestObservation;
|
|
48
|
+
heartbeatAt?: string;
|
|
49
|
+
now: string;
|
|
50
|
+
timeoutMs: number;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export type PullRequestMonitorTerminalState = Extract<
|
|
54
|
+
ExecutorState,
|
|
55
|
+
"completed" | "failed" | "cancelled" | "timed_out" | "reconciliation_required"
|
|
56
|
+
>;
|
|
57
|
+
|
|
58
|
+
export interface TriageItemPatch {
|
|
59
|
+
repository: string;
|
|
60
|
+
pullRequestNumber: number;
|
|
61
|
+
headSha: string;
|
|
62
|
+
coverage: "complete" | "partial" | "unknown" | "unavailable";
|
|
63
|
+
status: TriageItemStatus;
|
|
64
|
+
metadataJson: string;
|
|
65
|
+
lastSeenAt: string;
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface PullRequestMonitorResult {
|
|
70
|
+
triageItemId: string;
|
|
71
|
+
runId: string;
|
|
72
|
+
state: ExecutorState;
|
|
73
|
+
terminalState: PullRequestMonitorTerminalState | null;
|
|
74
|
+
triageItemPatch: TriageItemPatch | null;
|
|
75
|
+
reason: string;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function isTerminalCheck(
|
|
79
|
+
check: PullRequestCheckObservation,
|
|
80
|
+
): check is PullRequestCheckObservation & {
|
|
81
|
+
state: "passed" | "failed" | "cancelled";
|
|
82
|
+
} {
|
|
83
|
+
return (
|
|
84
|
+
check.state === "passed" ||
|
|
85
|
+
check.state === "failed" ||
|
|
86
|
+
check.state === "cancelled"
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
function getProviderTerminalState(
|
|
91
|
+
observation: PullRequestObservation,
|
|
92
|
+
): Exclude<
|
|
93
|
+
PullRequestMonitorTerminalState,
|
|
94
|
+
"timed_out" | "reconciliation_required"
|
|
95
|
+
> | null {
|
|
96
|
+
if (
|
|
97
|
+
observation.checks.length === 0 ||
|
|
98
|
+
!observation.checks.every(isTerminalCheck)
|
|
99
|
+
) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
if (observation.checks.some((check) => check.state === "failed")) {
|
|
103
|
+
return "failed";
|
|
104
|
+
}
|
|
105
|
+
if (observation.checks.some((check) => check.state === "cancelled")) {
|
|
106
|
+
return "cancelled";
|
|
107
|
+
}
|
|
108
|
+
return "completed";
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function isTimedOut(input: PullRequestMonitorInput): boolean {
|
|
112
|
+
if (input.timeoutMs < 0 || !input.heartbeatAt) {
|
|
113
|
+
return false;
|
|
114
|
+
}
|
|
115
|
+
const heartbeatAge = Date.parse(input.now) - Date.parse(input.heartbeatAt);
|
|
116
|
+
return Number.isFinite(heartbeatAge) && heartbeatAge >= input.timeoutMs;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
function buildPatch(
|
|
120
|
+
observation: PullRequestObservation,
|
|
121
|
+
state: ExecutorState,
|
|
122
|
+
now: string,
|
|
123
|
+
): TriageItemPatch {
|
|
124
|
+
return {
|
|
125
|
+
repository: observation.repo,
|
|
126
|
+
pullRequestNumber: observation.pullRequestNumber,
|
|
127
|
+
headSha: observation.headSha,
|
|
128
|
+
coverage: "complete",
|
|
129
|
+
status:
|
|
130
|
+
state === "reconciliation_required"
|
|
131
|
+
? "reconciliation_required"
|
|
132
|
+
: state === "failed" || state === "cancelled" || state === "timed_out"
|
|
133
|
+
? "failed"
|
|
134
|
+
: "evidence_ready",
|
|
135
|
+
metadataJson: JSON.stringify({
|
|
136
|
+
checks: observation.checks,
|
|
137
|
+
reviews: observation.reviews,
|
|
138
|
+
monitorState: state,
|
|
139
|
+
}),
|
|
140
|
+
lastSeenAt: observation.observedAt,
|
|
141
|
+
updatedAt: now,
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export function reconcilePullRequestRun(
|
|
146
|
+
input: PullRequestMonitorInput,
|
|
147
|
+
): PullRequestMonitorResult {
|
|
148
|
+
const providerState = input.providerObservation
|
|
149
|
+
? getProviderTerminalState(input.providerObservation)
|
|
150
|
+
: null;
|
|
151
|
+
const callback = input.callback;
|
|
152
|
+
const timedOut = isTimedOut(input);
|
|
153
|
+
let state: ExecutorState;
|
|
154
|
+
let reason: string;
|
|
155
|
+
|
|
156
|
+
if (timedOut && !providerState) {
|
|
157
|
+
state = "timed_out";
|
|
158
|
+
reason =
|
|
159
|
+
"The run heartbeat exceeded its timeout without a terminal provider observation.";
|
|
160
|
+
} else if (providerState) {
|
|
161
|
+
state = providerState;
|
|
162
|
+
reason = "The provider observation supplies a terminal result for the run.";
|
|
163
|
+
} else if (callback?.state === "completed") {
|
|
164
|
+
state = "reconciliation_required";
|
|
165
|
+
reason =
|
|
166
|
+
"The callback claims completion, but no terminal provider observation was observed.";
|
|
167
|
+
} else if (
|
|
168
|
+
callback?.state === "failed" ||
|
|
169
|
+
callback?.state === "cancelled" ||
|
|
170
|
+
callback?.state === "timed_out" ||
|
|
171
|
+
callback?.state === "reconciliation_required"
|
|
172
|
+
) {
|
|
173
|
+
state = callback.state;
|
|
174
|
+
reason =
|
|
175
|
+
callback.terminalReason ?? "The callback supplied a terminal run state.";
|
|
176
|
+
} else if (callback) {
|
|
177
|
+
state = callback.state;
|
|
178
|
+
reason =
|
|
179
|
+
input.providerObservation && !providerState
|
|
180
|
+
? "The provider observation is not terminal; continue monitoring the run."
|
|
181
|
+
: "The run has a non-terminal callback and remains in progress.";
|
|
182
|
+
} else if (!input.providerObservation) {
|
|
183
|
+
state = "reconciliation_required";
|
|
184
|
+
reason =
|
|
185
|
+
"No callback or provider observation was available to reconcile the run.";
|
|
186
|
+
} else {
|
|
187
|
+
state = "reconciliation_required";
|
|
188
|
+
reason =
|
|
189
|
+
"The callback was missed and the provider observation is not terminal.";
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
triageItemId: input.triageItemId,
|
|
194
|
+
runId: input.runId,
|
|
195
|
+
state,
|
|
196
|
+
terminalState:
|
|
197
|
+
state === "submitted" || state === "acknowledged" || state === "running"
|
|
198
|
+
? null
|
|
199
|
+
: state,
|
|
200
|
+
triageItemPatch: input.providerObservation
|
|
201
|
+
? buildPatch(input.providerObservation, state, input.now)
|
|
202
|
+
: null,
|
|
203
|
+
reason,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export function dedupePullRequestMonitorResults(
|
|
208
|
+
results: readonly PullRequestMonitorResult[],
|
|
209
|
+
): PullRequestMonitorResult[] {
|
|
210
|
+
const seen = new Set<string>();
|
|
211
|
+
const deduped: PullRequestMonitorResult[] = [];
|
|
212
|
+
for (const result of results) {
|
|
213
|
+
const key = result.triageItemId;
|
|
214
|
+
if (!seen.has(key)) {
|
|
215
|
+
seen.add(key);
|
|
216
|
+
deduped.push(result);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return deduped;
|
|
220
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { resolveConnectorSecret } from "../connectors/credentials.js";
|
|
2
|
+
import {
|
|
3
|
+
getChannelHistory as readChannelHistory,
|
|
4
|
+
getTeamInfo as readTeamInfo,
|
|
5
|
+
type ChannelHistoryResult,
|
|
6
|
+
type SlackTeamInfo,
|
|
7
|
+
type SlackTokenResolver,
|
|
8
|
+
type Workspace,
|
|
9
|
+
} from "../connectors/slack.js";
|
|
10
|
+
|
|
11
|
+
export interface SlackReaderIdentity {
|
|
12
|
+
ownerEmail: string;
|
|
13
|
+
orgId?: string | null;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function createTokenResolver({
|
|
17
|
+
ownerEmail,
|
|
18
|
+
orgId,
|
|
19
|
+
}: SlackReaderIdentity): SlackTokenResolver {
|
|
20
|
+
return async (workspace) => {
|
|
21
|
+
const key =
|
|
22
|
+
workspace === "secondary" ? "SLACK_BOT_TOKEN_2" : "SLACK_BOT_TOKEN";
|
|
23
|
+
const token = await resolveConnectorSecret(key, ownerEmail, { orgId });
|
|
24
|
+
if (!token) {
|
|
25
|
+
throw new Error(
|
|
26
|
+
`No Slack bot token configured. Connect Slack in Settings → Messaging, or set ${key}.`,
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
return token;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export function createSlackReader(identity: SlackReaderIdentity) {
|
|
34
|
+
const tokenResolver = createTokenResolver(identity);
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
getChannelHistory(
|
|
38
|
+
workspace: Workspace,
|
|
39
|
+
channelId: string,
|
|
40
|
+
limit?: number,
|
|
41
|
+
cursor?: string,
|
|
42
|
+
): Promise<ChannelHistoryResult> {
|
|
43
|
+
return readChannelHistory(
|
|
44
|
+
workspace,
|
|
45
|
+
channelId,
|
|
46
|
+
limit,
|
|
47
|
+
cursor,
|
|
48
|
+
tokenResolver,
|
|
49
|
+
);
|
|
50
|
+
},
|
|
51
|
+
getTeamInfo(workspace: Workspace): Promise<SlackTeamInfo> {
|
|
52
|
+
return readTeamInfo(workspace, tokenResolver);
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import type { SlackMessage, Workspace } from "../connectors/slack.js";
|
|
2
|
+
import type { IngestionEnvelope } from "./contracts";
|
|
3
|
+
import { createSlackReader } from "./slack-client";
|
|
4
|
+
|
|
5
|
+
const SLACK_HISTORY_LIMIT = 100;
|
|
6
|
+
const MAX_HISTORY_PAGES = 5;
|
|
7
|
+
const MAX_SUMMARY_LENGTH = 500;
|
|
8
|
+
|
|
9
|
+
export interface SlackPollInput {
|
|
10
|
+
workspace: Workspace;
|
|
11
|
+
channelId: string;
|
|
12
|
+
priorLastSlackTs: string;
|
|
13
|
+
historyCursor?: string | null;
|
|
14
|
+
ownerEmail: string;
|
|
15
|
+
orgId?: string | null;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface SlackPollResult {
|
|
19
|
+
envelopes: IngestionEnvelope[];
|
|
20
|
+
nextLastSlackTs: string;
|
|
21
|
+
nextHistoryCursor: string | null;
|
|
22
|
+
hasMore: boolean;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function numericTs(ts: string): number {
|
|
26
|
+
const value = Number(ts);
|
|
27
|
+
if (!Number.isFinite(value)) {
|
|
28
|
+
throw new Error(`Slack message has an invalid timestamp: ${ts}`);
|
|
29
|
+
}
|
|
30
|
+
return value;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function compactText(text: string): string {
|
|
34
|
+
const compact = text.replace(/\s+/g, " ").trim();
|
|
35
|
+
return compact.length > MAX_SUMMARY_LENGTH
|
|
36
|
+
? `${compact.slice(0, MAX_SUMMARY_LENGTH - 1)}…`
|
|
37
|
+
: compact;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function messageLabel(message: SlackMessage): string {
|
|
41
|
+
if (message.bot_id || message.username) {
|
|
42
|
+
return `Slack bot ${message.username ?? message.bot_id ?? "unknown"}`;
|
|
43
|
+
}
|
|
44
|
+
return `Slack user ${message.user ?? "unknown"}`;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
function toEnvelope(
|
|
48
|
+
channelId: string,
|
|
49
|
+
message: SlackMessage,
|
|
50
|
+
teamDomain?: string,
|
|
51
|
+
): IngestionEnvelope {
|
|
52
|
+
const threadTs = message.thread_ts ?? message.ts;
|
|
53
|
+
const suppliedPermalink = (message as SlackMessage & { permalink?: string })
|
|
54
|
+
.permalink;
|
|
55
|
+
const sourceUrl =
|
|
56
|
+
suppliedPermalink ??
|
|
57
|
+
(teamDomain
|
|
58
|
+
? `https://${teamDomain}.slack.com/archives/${channelId}/p${message.ts.replace(".", "")}${threadTs !== message.ts ? `?thread_ts=${threadTs}` : ""}`
|
|
59
|
+
: undefined);
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
source: "slack",
|
|
63
|
+
externalId: `${channelId}:${message.ts}`,
|
|
64
|
+
receivedAt: new Date().toISOString(),
|
|
65
|
+
...(sourceUrl ? { sourceUrl } : {}),
|
|
66
|
+
title: messageLabel(message),
|
|
67
|
+
summary: compactText(message.text),
|
|
68
|
+
channelId,
|
|
69
|
+
threadTs,
|
|
70
|
+
coverage:
|
|
71
|
+
message.reply_count && message.reply_count > 0 ? "partial" : "complete",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export async function pollSlackChannel({
|
|
76
|
+
workspace,
|
|
77
|
+
channelId,
|
|
78
|
+
priorLastSlackTs,
|
|
79
|
+
historyCursor,
|
|
80
|
+
ownerEmail,
|
|
81
|
+
orgId,
|
|
82
|
+
}: SlackPollInput): Promise<SlackPollResult> {
|
|
83
|
+
const slack = createSlackReader({ ownerEmail, orgId });
|
|
84
|
+
const priorTs = numericTs(priorLastSlackTs);
|
|
85
|
+
const messages: SlackMessage[] = [];
|
|
86
|
+
let cursor = historyCursor ?? undefined;
|
|
87
|
+
let nextHistoryCursor: string | null = null;
|
|
88
|
+
let hasMore = false;
|
|
89
|
+
|
|
90
|
+
for (let page = 0; page < MAX_HISTORY_PAGES; page += 1) {
|
|
91
|
+
const history = cursor
|
|
92
|
+
? await slack.getChannelHistory(
|
|
93
|
+
workspace,
|
|
94
|
+
channelId,
|
|
95
|
+
SLACK_HISTORY_LIMIT,
|
|
96
|
+
cursor,
|
|
97
|
+
)
|
|
98
|
+
: await slack.getChannelHistory(
|
|
99
|
+
workspace,
|
|
100
|
+
channelId,
|
|
101
|
+
SLACK_HISTORY_LIMIT,
|
|
102
|
+
);
|
|
103
|
+
messages.push(...history.messages);
|
|
104
|
+
|
|
105
|
+
const reachedPriorMessage = history.messages.some(
|
|
106
|
+
(message) => numericTs(message.ts) <= priorTs,
|
|
107
|
+
);
|
|
108
|
+
if (!history.has_more || reachedPriorMessage || !history.next_cursor) {
|
|
109
|
+
nextHistoryCursor = null;
|
|
110
|
+
hasMore = false;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
nextHistoryCursor = history.next_cursor;
|
|
115
|
+
hasMore = page === MAX_HISTORY_PAGES - 1;
|
|
116
|
+
if (hasMore) break;
|
|
117
|
+
cursor = history.next_cursor;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
let teamDomain: string | undefined;
|
|
121
|
+
try {
|
|
122
|
+
const team = await slack.getTeamInfo(workspace);
|
|
123
|
+
teamDomain = team.domain
|
|
124
|
+
.replace(/^https?:\/\//, "")
|
|
125
|
+
.replace(/\.slack\.com\/?$/, "")
|
|
126
|
+
.replace(/\/$/, "");
|
|
127
|
+
// coercion-ok: workspace metadata is optional; fetched channel history remains valid without it.
|
|
128
|
+
} catch {
|
|
129
|
+
// History remains useful when Slack does not expose workspace metadata.
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const newMessages = messages
|
|
133
|
+
.map((message) => ({ message, ts: numericTs(message.ts) }))
|
|
134
|
+
.filter(({ ts }) => ts > priorTs)
|
|
135
|
+
.sort((a, b) => a.ts - b.ts);
|
|
136
|
+
const maxSeen = messages.reduce(
|
|
137
|
+
(max, message) => {
|
|
138
|
+
const ts = numericTs(message.ts);
|
|
139
|
+
return ts > max.value ? { value: ts, raw: message.ts } : max;
|
|
140
|
+
},
|
|
141
|
+
{ value: priorTs, raw: priorLastSlackTs },
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
return {
|
|
145
|
+
envelopes: newMessages.map(({ message }) =>
|
|
146
|
+
toEnvelope(channelId, message, teamDomain),
|
|
147
|
+
),
|
|
148
|
+
nextLastSlackTs: maxSeen.raw,
|
|
149
|
+
nextHistoryCursor,
|
|
150
|
+
hasMore,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SSR entry point for Nitro.
|
|
3
|
+
* Wraps React Router's request handler so Nitro can use it as a service.
|
|
4
|
+
*/
|
|
5
|
+
import { createRequestHandler } from "react-router";
|
|
6
|
+
|
|
7
|
+
const handler = createRequestHandler(
|
|
8
|
+
() => import("virtual:react-router/server-build"),
|
|
9
|
+
);
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
async fetch(request: Request) {
|
|
13
|
+
return handler(request);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "@agent-native/core/tsconfig.base.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"ignoreDeprecations": "6.0",
|
|
5
|
+
"rootDirs": [".", "./.react-router/types"],
|
|
6
|
+
"paths": {
|
|
7
|
+
"*": ["./*"],
|
|
8
|
+
"@/*": ["./app/*"],
|
|
9
|
+
"@shared/*": ["./shared/*"]
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"include": [
|
|
13
|
+
"app/**/*",
|
|
14
|
+
"server/**/*",
|
|
15
|
+
"shared/**/*",
|
|
16
|
+
"vite.config.ts",
|
|
17
|
+
"react-router.config.ts",
|
|
18
|
+
".react-router/types/**/*",
|
|
19
|
+
".generated/**/*"
|
|
20
|
+
]
|
|
21
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { agentNative } from "@agent-native/core/vite";
|
|
2
|
+
import { reactRouter } from "@react-router/dev/vite";
|
|
3
|
+
import { defineConfig } from "vite";
|
|
4
|
+
|
|
5
|
+
const reactRouterPlugins = reactRouter as unknown as () => any[];
|
|
6
|
+
const agentNativePlugins = agentNative as unknown as (
|
|
7
|
+
options?: Parameters<typeof agentNative>[0],
|
|
8
|
+
) => any[];
|
|
9
|
+
|
|
10
|
+
export default defineConfig({
|
|
11
|
+
plugins: [
|
|
12
|
+
...reactRouterPlugins(),
|
|
13
|
+
...agentNativePlugins({
|
|
14
|
+
// shiki only runs in AssistantChat's useEffect — keep it out of the
|
|
15
|
+
// CF Pages Functions bundle (25 MiB limit).
|
|
16
|
+
ssrStubs: ["shiki"],
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
});
|
|
@@ -180,6 +180,14 @@ export function Sidebar() {
|
|
|
180
180
|
navigateWithAgentChatViewTransition(navigate, "/ask");
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
function handleBrandClick() {
|
|
184
|
+
if (isMobile) {
|
|
185
|
+
toggleLogoView();
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
setCollapsed((value) => !value);
|
|
189
|
+
}
|
|
190
|
+
|
|
183
191
|
const newFormButton = (
|
|
184
192
|
<PopoverTrigger asChild>
|
|
185
193
|
<button className="forms-sidebar-nav-item flex min-h-[44px] w-full cursor-pointer items-center gap-2.5 rounded-lg px-3 py-2 text-sm text-muted-foreground active:scale-[0.96] transition-[background-color,box-shadow,color,transform] hover:bg-accent/50 hover:text-foreground">
|
|
@@ -250,6 +258,37 @@ export function Sidebar() {
|
|
|
250
258
|
const sidebarContent = effectiveCollapsed ? (
|
|
251
259
|
<div className="agent-layout-left-drawer flex h-screen w-12 min-w-0 shrink-0 flex-col items-center overflow-hidden border-e border-border bg-sidebar py-2 transition-[width] duration-200 ease-out">
|
|
252
260
|
<TooltipProvider delayDuration={0}>
|
|
261
|
+
<Tooltip>
|
|
262
|
+
<TooltipTrigger asChild>
|
|
263
|
+
<button
|
|
264
|
+
type="button"
|
|
265
|
+
onClick={handleBrandClick}
|
|
266
|
+
aria-label={t("sidebar.expandSidebar")}
|
|
267
|
+
className="flex size-8 shrink-0 items-center justify-center rounded-lg outline-none transition-[background-color,box-shadow,transform] hover:bg-accent/50 focus-visible:ring-2 focus-visible:ring-ring"
|
|
268
|
+
data-sidebar-brand-toggle
|
|
269
|
+
>
|
|
270
|
+
<img
|
|
271
|
+
src={appPath("/agent-native-icon-light.svg")}
|
|
272
|
+
alt=""
|
|
273
|
+
aria-hidden="true"
|
|
274
|
+
width={28}
|
|
275
|
+
height={16}
|
|
276
|
+
className="block h-4 w-7 shrink-0 object-contain object-center dark:hidden"
|
|
277
|
+
/>
|
|
278
|
+
<img
|
|
279
|
+
src={appPath("/agent-native-icon-dark.svg")}
|
|
280
|
+
alt=""
|
|
281
|
+
aria-hidden="true"
|
|
282
|
+
width={28}
|
|
283
|
+
height={16}
|
|
284
|
+
className="hidden h-4 w-7 shrink-0 object-contain object-center dark:block"
|
|
285
|
+
/>
|
|
286
|
+
</button>
|
|
287
|
+
</TooltipTrigger>
|
|
288
|
+
<TooltipContent side="right">
|
|
289
|
+
{t("sidebar.expandSidebar")}
|
|
290
|
+
</TooltipContent>
|
|
291
|
+
</Tooltip>
|
|
253
292
|
<nav className="mt-1 flex min-h-0 flex-1 flex-col items-center gap-1 overflow-y-auto">
|
|
254
293
|
<Tooltip>
|
|
255
294
|
<TooltipTrigger asChild>
|
|
@@ -356,27 +395,38 @@ export function Sidebar() {
|
|
|
356
395
|
<TooltipTrigger asChild>
|
|
357
396
|
<button
|
|
358
397
|
type="button"
|
|
359
|
-
aria-label={
|
|
398
|
+
aria-label={
|
|
399
|
+
isMobile
|
|
400
|
+
? t("sidebar.openAskFullScreen")
|
|
401
|
+
: t("sidebar.collapseSidebar")
|
|
402
|
+
}
|
|
360
403
|
className="flex min-h-10 min-w-0 items-center gap-2 rounded-lg px-2 text-base font-semibold tracking-tight text-muted-foreground/80 active:scale-[0.96] transition-[color,transform] hover:text-foreground/80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring"
|
|
361
|
-
onClick={
|
|
404
|
+
onClick={handleBrandClick}
|
|
405
|
+
data-sidebar-brand-toggle
|
|
362
406
|
>
|
|
363
407
|
<img
|
|
364
408
|
src={appPath("/agent-native-icon-light.svg")}
|
|
365
409
|
alt=""
|
|
366
410
|
aria-hidden="true"
|
|
367
|
-
|
|
411
|
+
width={28}
|
|
412
|
+
height={16}
|
|
413
|
+
className="block h-4 w-7 shrink-0 object-contain object-center dark:hidden"
|
|
368
414
|
/>
|
|
369
415
|
<img
|
|
370
416
|
src={appPath("/agent-native-icon-dark.svg")}
|
|
371
417
|
alt=""
|
|
372
418
|
aria-hidden="true"
|
|
373
|
-
|
|
419
|
+
width={28}
|
|
420
|
+
height={16}
|
|
421
|
+
className="hidden h-4 w-7 shrink-0 object-contain object-center dark:block"
|
|
374
422
|
/>
|
|
375
423
|
<span className="truncate">{t("navigation.brand")}</span>
|
|
376
424
|
</button>
|
|
377
425
|
</TooltipTrigger>
|
|
378
426
|
<TooltipContent side="right">
|
|
379
|
-
{
|
|
427
|
+
{isMobile
|
|
428
|
+
? t("sidebar.openAskFullScreen")
|
|
429
|
+
: t("sidebar.collapseSidebar")}
|
|
380
430
|
</TooltipContent>
|
|
381
431
|
</Tooltip>
|
|
382
432
|
</TooltipProvider>
|