@agent-native/core 0.131.5 → 0.131.6
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 +3 -3
- package/corpus/core/CHANGELOG.md +63 -0
- package/corpus/core/docs/content/agent-native-toolkit.mdx +13 -6
- package/corpus/core/docs/content/cloneable-saas.mdx +5 -5
- package/corpus/core/docs/content/creating-templates.mdx +9 -0
- package/corpus/core/docs/content/deployment.mdx +14 -10
- package/corpus/core/docs/content/doctor.mdx +8 -1
- package/corpus/core/docs/content/drop-in-agent.mdx +1 -1
- package/corpus/core/docs/content/extensions.mdx +18 -18
- package/corpus/core/docs/content/faq.mdx +4 -4
- package/corpus/core/docs/content/key-concepts.mdx +30 -21
- package/corpus/core/docs/content/template-brain-developers.mdx +4 -1
- package/corpus/core/docs/content/template-mail-developers.mdx +4 -1
- package/corpus/core/docs/content/what-is-agent-native.mdx +6 -6
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/client.ts +449 -66
- package/corpus/core/src/a2a/correlation.ts +31 -0
- package/corpus/core/src/a2a/types.ts +4 -0
- package/corpus/core/src/action.ts +3 -0
- package/corpus/core/src/agent/engine/registry.ts +45 -5
- package/corpus/core/src/agent/production-agent.ts +151 -18
- package/corpus/core/src/agent/run-loop-with-resume.ts +190 -3
- package/corpus/core/src/agent/run-manager.ts +117 -41
- package/corpus/core/src/agent/thread-debug-history.ts +86 -0
- package/corpus/core/src/agent/types.ts +3 -1
- package/corpus/core/src/cli/create.ts +11 -1
- package/corpus/core/src/cli/templates-meta.ts +2 -2
- package/corpus/core/src/client/agent-chat-adapter.ts +91 -13
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +11 -9
- package/corpus/core/src/client/sse-event-processor.ts +17 -3
- package/corpus/core/src/db/client.ts +57 -17
- package/corpus/core/src/integrations/adapters/slack.ts +8 -3
- package/corpus/core/src/localization/default-messages.ts +44 -0
- package/corpus/core/src/observability/traces.ts +78 -5
- package/corpus/core/src/scripts/call-agent.ts +290 -9
- package/corpus/core/src/scripts/describe-workspace-apps.ts +2 -2
- package/corpus/core/src/secrets/crypto.ts +126 -34
- package/corpus/core/src/secrets/storage.ts +61 -25
- package/corpus/core/src/server/agent-capabilities.ts +1 -1
- package/corpus/core/src/server/agent-chat/action-filters-a2a.ts +111 -7
- package/corpus/core/src/server/agent-chat/context-tools.ts +2 -0
- package/corpus/core/src/server/agent-chat/plugin-options.ts +34 -1
- package/corpus/core/src/server/agent-chat/prompt-resources.ts +1 -1
- package/corpus/core/src/server/agent-chat-plugin.ts +91 -59
- package/corpus/core/src/templates/default/.agents/skills/secrets/SKILL.md +14 -7
- package/corpus/core/src/templates/headless/.agents/skills/secrets/SKILL.md +14 -7
- package/corpus/core/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +18 -7
- package/corpus/core/src/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +15 -14
- package/corpus/core/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +14 -7
- package/corpus/core/src/vite/client.ts +1 -0
- package/corpus/templates/analytics/.agents/skills/dashboard-ops/SKILL.md +5 -4
- package/corpus/templates/analytics/.agents/skills/gong/SKILL.md +6 -4
- package/corpus/templates/analytics/AGENTS.md +6 -4
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +4 -3
- package/corpus/templates/analytics/changelog/2026-07-30-scheduled-dashboard-emails-complete-every-panel-without-pool.md +6 -0
- package/corpus/templates/analytics/scripts/emit-netlify-dashboard-report-cron.ts +28 -1
- package/corpus/templates/analytics/server/jobs/dashboard-report.ts +18 -11
- package/corpus/templates/analytics/server/lib/analytics-connector-catalog.ts +4 -4
- package/corpus/templates/analytics/server/lib/canonical-first-party-dashboard-repair.ts +9 -5
- package/corpus/templates/analytics/server/lib/dashboard-panel-query.ts +6 -2
- package/corpus/templates/analytics/server/lib/dashboard-panel-source-resolver.ts +11 -4
- package/corpus/templates/analytics/server/lib/dashboard-report-render.ts +49 -31
- package/corpus/templates/analytics/server/lib/first-party-analytics.ts +16 -8
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +9 -3
- package/corpus/templates/analytics/server/lib/production-serverless-runtime.ts +11 -0
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +3 -2
- package/corpus/templates/analytics/server/plugins/analytics-alert-jobs.ts +2 -1
- package/corpus/templates/analytics/server/plugins/dashboard-report-jobs.ts +2 -1
- package/corpus/templates/analytics/server/plugins/uptime-monitor-jobs.ts +1 -12
- package/corpus/templates/brain/.agents/skills/brain/RUNBOOK.md +54 -6
- package/corpus/templates/brain/.agents/skills/brain/SKILL.md +20 -9
- package/corpus/templates/brain/.agents/skills/ingestion-and-connectors/SKILL.md +33 -1
- package/corpus/templates/brain/AGENTS.md +3 -1
- package/corpus/templates/brain/README.md +4 -1
- package/corpus/templates/brain/actions/_schemas.ts +30 -8
- package/corpus/templates/brain/actions/ask-brain.ts +124 -14
- package/corpus/templates/brain/actions/create-source.ts +18 -2
- package/corpus/templates/brain/actions/enqueue-captures-distillation.ts +8 -123
- package/corpus/templates/brain/actions/enqueue-distillation.ts +6 -127
- package/corpus/templates/brain/actions/import-capture.ts +17 -5
- package/corpus/templates/brain/actions/import-transcript.ts +17 -5
- package/corpus/templates/brain/actions/update-source.ts +25 -5
- package/corpus/templates/brain/app/components/layout/Sidebar.tsx +1 -1
- package/corpus/templates/brain/changelog/2026-07-30-blessed-resources-can-feed-cited-company-answers.md +6 -0
- package/corpus/templates/brain/changelog/2026-07-30-the-left-sidebar-no-longer-shows-a-blank-organization-placeh.md +6 -0
- package/corpus/templates/brain/server/lib/brain.ts +49 -19
- package/corpus/templates/brain/server/lib/distillation-queue.ts +147 -0
- package/corpus/templates/brain/server/lib/source-policy.ts +264 -0
- package/corpus/templates/brain/server/plugins/agent-chat.ts +3 -2
- package/corpus/templates/brain/server/routes/api/_agent-native/brain/ingest.post.ts +116 -19
- package/corpus/templates/clips/app/components/meetings/google-oauth-identity-notice.tsx +51 -0
- package/corpus/templates/clips/app/i18n/en-US.ts +4 -0
- package/corpus/templates/clips/app/routes/_app.meetings._index.tsx +3 -1
- package/corpus/templates/clips/changelog/2026-07-30-google-calendar-warning.md +6 -0
- package/corpus/templates/content/app/components/editor/VisualEditor.tsx +72 -8
- package/corpus/templates/content/changelog/2026-07-30-the-slash-command-hint-now-stays-on-only-the-active-empty-li.md +6 -0
- package/corpus/templates/design/.generated/bridge/editor-chrome.generated.ts +506 -11
- package/corpus/templates/design/app/components/design/bridge/editor-chrome.bridge.ts +148 -17
- package/corpus/templates/design/app/components/design/canvas-interactions/design-canvas-interactions.ts +357 -0
- package/corpus/templates/design/app/components/design/inspector/ScrubInput.tsx +7 -466
- package/corpus/templates/design/app/components/design/inspector/scrub-input-utils.ts +15 -311
- package/corpus/templates/design/app/components/visual-editor/CanvasCommentPins.tsx +19 -997
- package/corpus/templates/design/app/components/visual-editor/DrawOverlay.tsx +8 -1216
- package/corpus/templates/design/app/hooks/useDesignHotkeys.ts +31 -38
- package/corpus/templates/design/package.json +0 -1
- package/corpus/templates/dispatch/AGENTS.md +8 -0
- package/corpus/templates/dispatch/DEVELOPING.md +29 -0
- package/corpus/templates/dispatch/actions/view-screen.ts +34 -2
- package/corpus/templates/dispatch/app/i18n-data.ts +457 -0
- package/corpus/templates/dispatch/changelog/2026-07-30-delegated-dispatch-work-continues-reliably-in-the-background.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-07-30-find-failed-runs-across-apps.md +6 -0
- package/corpus/templates/dispatch/netlify.toml +3 -0
- package/corpus/templates/slides/.agents/skills/analytics-data-for-decks/SKILL.md +8 -12
- package/corpus/templates/slides/AGENTS.md +4 -4
- package/corpus/templates/slides/actions/duplicate-deck.ts +19 -4
- package/corpus/templates/slides/app/components/deck/DeckCard.tsx +2 -10
- package/corpus/templates/slides/app/components/deck/MermaidRenderer.tsx +12 -1
- package/corpus/templates/slides/app/components/deck/SlideRenderer.tsx +30 -13
- package/corpus/templates/slides/app/components/editor/DeckEditorSkeleton.tsx +35 -0
- package/corpus/templates/slides/app/components/editor/EditorSidebar.tsx +63 -56
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +21 -76
- package/corpus/templates/slides/app/components/editor/SlideEditor.tsx +1110 -292
- package/corpus/templates/slides/app/components/editor/SlideOverflowWarning.tsx +53 -0
- package/corpus/templates/slides/app/components/editor/SlideStyleInspector.tsx +235 -18
- package/corpus/templates/slides/app/components/editor/SpeakerNotesPanel.tsx +4 -1
- package/corpus/templates/slides/app/components/editor/canvas-interactions/index.ts +11 -0
- package/corpus/templates/slides/app/components/editor/canvas-interactions/slides-canvas-adapter.ts +129 -0
- package/corpus/templates/slides/app/components/editor/selection-overlay-measurement.ts +70 -0
- package/corpus/templates/slides/app/components/editor/slide-object-interactions.ts +519 -65
- package/corpus/templates/slides/app/components/visual-editor/CanvasCommentPins.tsx +36 -426
- package/corpus/templates/slides/app/components/visual-editor/DrawOverlay.tsx +19 -458
- package/corpus/templates/slides/app/context/DeckContext.tsx +179 -72
- package/corpus/templates/slides/app/global.css +105 -0
- package/corpus/templates/slides/app/i18n/en-US.ts +8 -0
- package/corpus/templates/slides/app/lib/deck-editor-loading.ts +26 -0
- package/corpus/templates/slides/app/lib/mermaid-blocks.ts +27 -0
- package/corpus/templates/slides/app/pages/DeckEditor.tsx +71 -38
- package/corpus/templates/slides/app/pages/Index.tsx +98 -41
- package/corpus/templates/slides/changelog/2026-07-30-deck-loading-no-longer-flashes-an-unavailable-message.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-30-duplicating-a-deck-from-the-deck-list-now-opens-the-copy-imm.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-30-layout-overflow-warning-is-readable-and-dismissible.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-30-shared-canvas-annotations.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-30-slide-objects-can-be-moved-as-a-group-copied-and-pasted-with.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-30-slide-text-editing-and-object-controls-now-match-google-slides.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-30-style-panel-now-scrolls-with-speaker-notes-open-shows-the-sl.md +6 -0
- package/corpus/templates/slides/changelog/2026-07-30-top-toolbar-controls-now-use-consistent-sizing-with-undo-and.md +6 -0
- package/corpus/templates/slides/netlify.toml +3 -1
- package/corpus/templates/slides/package.json +0 -1
- package/corpus/templates/slides/server/lib/chat-attachments.ts +18 -0
- package/corpus/templates/slides/server/plugins/agent-chat.ts +5 -0
- package/corpus/templates/slides/vite.config.ts +0 -1
- package/corpus/toolkit/CHANGELOG.md +13 -0
- package/corpus/toolkit/README.md +19 -0
- package/corpus/toolkit/agent-native.eject.json +38 -0
- package/corpus/toolkit/package.json +29 -1
- package/corpus/toolkit/src/canvas-annotations/CanvasCommentPins.tsx +861 -0
- package/corpus/toolkit/src/canvas-annotations/DrawOverlay.tsx +1233 -0
- package/corpus/toolkit/src/canvas-annotations/index.ts +15 -0
- package/corpus/toolkit/src/canvas-annotations/types.ts +14 -0
- package/corpus/toolkit/src/canvas-interactions/canvas-interactions.ts +933 -0
- package/corpus/toolkit/src/canvas-interactions/index.ts +67 -0
- package/corpus/toolkit/src/design-tweaks/scrub-input-utils.ts +311 -0
- package/corpus/toolkit/src/design-tweaks/scrub-input.tsx +491 -0
- package/corpus/toolkit/src/design-tweaks/visual-style-controls.tsx +26 -171
- package/corpus/toolkit/src/index.ts +1 -0
- package/dist/a2a/client.d.ts +23 -0
- package/dist/a2a/client.d.ts.map +1 -1
- package/dist/a2a/client.js +309 -44
- package/dist/a2a/client.js.map +1 -1
- package/dist/a2a/correlation.d.ts +1 -0
- package/dist/a2a/correlation.d.ts.map +1 -1
- package/dist/a2a/correlation.js +27 -0
- package/dist/a2a/correlation.js.map +1 -1
- package/dist/a2a/types.d.ts +4 -0
- package/dist/a2a/types.d.ts.map +1 -1
- package/dist/a2a/types.js.map +1 -1
- package/dist/action.d.ts +3 -0
- package/dist/action.d.ts.map +1 -1
- package/dist/action.js.map +1 -1
- package/dist/agent/engine/registry.d.ts.map +1 -1
- package/dist/agent/engine/registry.js +34 -7
- package/dist/agent/engine/registry.js.map +1 -1
- package/dist/agent/production-agent.d.ts +40 -1
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +113 -15
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-loop-with-resume.d.ts +21 -0
- package/dist/agent/run-loop-with-resume.d.ts.map +1 -1
- package/dist/agent/run-loop-with-resume.js +163 -4
- package/dist/agent/run-loop-with-resume.js.map +1 -1
- package/dist/agent/run-manager.d.ts +16 -9
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +93 -42
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/thread-debug-history.d.ts +10 -0
- package/dist/agent/thread-debug-history.d.ts.map +1 -0
- package/dist/agent/thread-debug-history.js +68 -0
- package/dist/agent/thread-debug-history.js.map +1 -0
- package/dist/agent/types.d.ts +3 -1
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +6 -1
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/templates-meta.js +2 -2
- package/dist/cli/templates-meta.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +76 -13
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +1 -1
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +12 -3
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +48 -17
- package/dist/db/client.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/integrations/adapters/slack.js +7 -3
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/localization/default-messages.d.ts +43 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +43 -0
- package/dist/localization/default-messages.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 +6 -6
- package/dist/observability/traces.d.ts +3 -1
- package/dist/observability/traces.d.ts.map +1 -1
- package/dist/observability/traces.js +73 -4
- package/dist/observability/traces.js.map +1 -1
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +12 -12
- package/dist/provider-api/actions/provider-api.d.ts +13 -13
- package/dist/provider-api/corpus-jobs.d.ts +2 -2
- package/dist/scripts/call-agent.d.ts.map +1 -1
- package/dist/scripts/call-agent.js +233 -10
- package/dist/scripts/call-agent.js.map +1 -1
- package/dist/scripts/describe-workspace-apps.js +2 -2
- package/dist/scripts/describe-workspace-apps.js.map +1 -1
- package/dist/secrets/crypto.d.ts +31 -21
- package/dist/secrets/crypto.d.ts.map +1 -1
- package/dist/secrets/crypto.js +108 -33
- package/dist/secrets/crypto.js.map +1 -1
- package/dist/secrets/storage.d.ts +3 -5
- package/dist/secrets/storage.d.ts.map +1 -1
- package/dist/secrets/storage.js +40 -25
- package/dist/secrets/storage.js.map +1 -1
- package/dist/server/agent-capabilities.js +1 -1
- package/dist/server/agent-capabilities.js.map +1 -1
- package/dist/server/agent-chat/action-filters-a2a.d.ts +17 -3
- package/dist/server/agent-chat/action-filters-a2a.d.ts.map +1 -1
- package/dist/server/agent-chat/action-filters-a2a.js +92 -3
- package/dist/server/agent-chat/action-filters-a2a.js.map +1 -1
- package/dist/server/agent-chat/context-tools.d.ts.map +1 -1
- package/dist/server/agent-chat/context-tools.js +2 -0
- package/dist/server/agent-chat/context-tools.js.map +1 -1
- package/dist/server/agent-chat/plugin-options.d.ts +23 -0
- package/dist/server/agent-chat/plugin-options.d.ts.map +1 -1
- package/dist/server/agent-chat/plugin-options.js +4 -1
- package/dist/server/agent-chat/plugin-options.js.map +1 -1
- package/dist/server/agent-chat/prompt-resources.js +1 -1
- package/dist/server/agent-chat/prompt-resources.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts +2 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +79 -56
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/templates/default/.agents/skills/secrets/SKILL.md +14 -7
- package/dist/templates/headless/.agents/skills/secrets/SKILL.md +14 -7
- package/dist/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +18 -7
- package/dist/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +15 -14
- package/dist/templates/workspace-core/.agents/skills/secrets/SKILL.md +14 -7
- package/dist/vite/client.d.ts.map +1 -1
- package/dist/vite/client.js +1 -0
- package/dist/vite/client.js.map +1 -1
- package/docs/content/agent-native-toolkit.mdx +13 -6
- package/docs/content/cloneable-saas.mdx +5 -5
- package/docs/content/creating-templates.mdx +9 -0
- package/docs/content/deployment.mdx +14 -10
- package/docs/content/doctor.mdx +8 -1
- package/docs/content/drop-in-agent.mdx +1 -1
- package/docs/content/extensions.mdx +18 -18
- package/docs/content/faq.mdx +4 -4
- package/docs/content/key-concepts.mdx +30 -21
- package/docs/content/template-brain-developers.mdx +4 -1
- package/docs/content/template-mail-developers.mdx +4 -1
- package/docs/content/what-is-agent-native.mdx +6 -6
- package/package.json +2 -2
- package/src/a2a/client.ts +449 -66
- package/src/a2a/correlation.ts +31 -0
- package/src/a2a/types.ts +4 -0
- package/src/action.ts +3 -0
- package/src/agent/engine/registry.ts +45 -5
- package/src/agent/production-agent.ts +151 -18
- package/src/agent/run-loop-with-resume.ts +190 -3
- package/src/agent/run-manager.ts +117 -41
- package/src/agent/thread-debug-history.ts +86 -0
- package/src/agent/types.ts +3 -1
- package/src/cli/create.ts +11 -1
- package/src/cli/templates-meta.ts +2 -2
- package/src/client/agent-chat-adapter.ts +91 -13
- package/src/client/resources/McpIntegrationDialog.tsx +11 -9
- package/src/client/sse-event-processor.ts +17 -3
- package/src/db/client.ts +57 -17
- package/src/integrations/adapters/slack.ts +8 -3
- package/src/localization/default-messages.ts +44 -0
- package/src/observability/traces.ts +78 -5
- package/src/scripts/call-agent.ts +290 -9
- package/src/scripts/describe-workspace-apps.ts +2 -2
- package/src/secrets/crypto.ts +126 -34
- package/src/secrets/storage.ts +61 -25
- package/src/server/agent-capabilities.ts +1 -1
- package/src/server/agent-chat/action-filters-a2a.ts +111 -7
- package/src/server/agent-chat/context-tools.ts +2 -0
- package/src/server/agent-chat/plugin-options.ts +34 -1
- package/src/server/agent-chat/prompt-resources.ts +1 -1
- package/src/server/agent-chat-plugin.ts +91 -59
- package/src/templates/default/.agents/skills/secrets/SKILL.md +14 -7
- package/src/templates/headless/.agents/skills/secrets/SKILL.md +14 -7
- package/src/templates/workspace-core/.agents/skills/a2a-protocol/SKILL.md +18 -7
- package/src/templates/workspace-core/.agents/skills/composable-mini-apps/SKILL.md +15 -14
- package/src/templates/workspace-core/.agents/skills/secrets/SKILL.md +14 -7
- package/src/vite/client.ts +1 -0
|
@@ -775,17 +775,21 @@ export function isRetryableError(err) {
|
|
|
775
775
|
msg.includes("gateway error") ||
|
|
776
776
|
msg.includes("socket hang up") ||
|
|
777
777
|
msg.includes("connection reset") ||
|
|
778
|
-
|
|
779
|
-
// "Connection error." — Builder gateway often forwards it as a stop
|
|
780
|
-
// event with no structured code. Without this match the run fails in
|
|
781
|
-
// ~3s and the client recovery loop storms POSTs.
|
|
782
|
-
msg.includes("connection error") ||
|
|
778
|
+
hasProviderConnectionErrorMessage(msg) ||
|
|
783
779
|
msg.includes("too many requests") ||
|
|
784
780
|
msg.includes("timeout") ||
|
|
785
781
|
msg.includes("gateway timeout") ||
|
|
786
782
|
msg.includes("inactivity timeout") ||
|
|
787
783
|
msg.includes("too much time has passed without sending any data"));
|
|
788
784
|
}
|
|
785
|
+
function hasProviderConnectionErrorMessage(message) {
|
|
786
|
+
const normalized = message.toLowerCase();
|
|
787
|
+
// Anthropic's APIConnectionError uses "Connection error."; AI SDK wraps
|
|
788
|
+
// OpenAI TLS failures as "Cannot connect to API". Both can cross a worker
|
|
789
|
+
// boundary without their structured EngineError metadata.
|
|
790
|
+
return (normalized.includes("connection error") ||
|
|
791
|
+
normalized.includes("cannot connect to api"));
|
|
792
|
+
}
|
|
789
793
|
// ---------------------------------------------------------------------------
|
|
790
794
|
// Context-window overflow recovery
|
|
791
795
|
// ---------------------------------------------------------------------------
|
|
@@ -1384,11 +1388,13 @@ export function appendAgentLoopContinuation(messages, reason, options = {}) {
|
|
|
1384
1388
|
? "The previous stream ended before the agent sent a final completion signal."
|
|
1385
1389
|
: reason === "gateway_timeout"
|
|
1386
1390
|
? "The previous LLM call hit an upstream gateway timeout before the response finished streaming."
|
|
1387
|
-
: reason === "
|
|
1388
|
-
? "The previous LLM call was
|
|
1389
|
-
: reason === "
|
|
1390
|
-
? "The previous
|
|
1391
|
-
:
|
|
1391
|
+
: reason === "rate_limited"
|
|
1392
|
+
? "The previous LLM call was temporarily rate limited after exhausting its short provider retry budget."
|
|
1393
|
+
: reason === "network_interrupted"
|
|
1394
|
+
? "The previous LLM call was cut off by a transport-level interruption (socket dropped, connection reset, or stream closed unexpectedly)."
|
|
1395
|
+
: reason === "no_progress"
|
|
1396
|
+
? "The previous run stopped producing progress events while the connection stayed open."
|
|
1397
|
+
: "The previous run reached an internal execution budget.";
|
|
1392
1398
|
const actionInputNote = options.actionPreparationTool
|
|
1393
1399
|
? actionPreparationContinuationNote(options.actionPreparationTool)
|
|
1394
1400
|
: "";
|
|
@@ -1447,7 +1453,7 @@ export function isResumableEngineError(err) {
|
|
|
1447
1453
|
text.includes("econnaborted") ||
|
|
1448
1454
|
text.includes("fetch failed") ||
|
|
1449
1455
|
text.includes("network error") ||
|
|
1450
|
-
text
|
|
1456
|
+
hasProviderConnectionErrorMessage(text) ||
|
|
1451
1457
|
text.includes("connection reset") ||
|
|
1452
1458
|
text.includes("connection closed") ||
|
|
1453
1459
|
text.includes("stream closed") ||
|
|
@@ -1458,6 +1464,32 @@ export function isResumableEngineError(err) {
|
|
|
1458
1464
|
text.includes("too much time has passed without sending any data") ||
|
|
1459
1465
|
text.includes("terminated"));
|
|
1460
1466
|
}
|
|
1467
|
+
/**
|
|
1468
|
+
* True only for transient provider throttling that may recover after one
|
|
1469
|
+
* cooled-down background continuation. This is deliberately narrower than
|
|
1470
|
+
* `isRetryableError`: daily/account caps are terminal, and generic retryable
|
|
1471
|
+
* transport errors keep using the normal resumable-error path.
|
|
1472
|
+
*
|
|
1473
|
+
* The engine has already spent its short in-call retry budget before this
|
|
1474
|
+
* helper is consulted. Callers must add their own small continuation cap so a
|
|
1475
|
+
* sustained provider limit cannot turn into an unbounded request storm.
|
|
1476
|
+
*/
|
|
1477
|
+
export function isTransientProviderRateLimitError(err) {
|
|
1478
|
+
if (!(err instanceof EngineError))
|
|
1479
|
+
return false;
|
|
1480
|
+
const code = (err.errorCode ?? "").toLowerCase();
|
|
1481
|
+
const text = errorSearchText(err);
|
|
1482
|
+
if (code === "rate_limit_exceeded" ||
|
|
1483
|
+
text.includes("daily gateway request cap")) {
|
|
1484
|
+
return false;
|
|
1485
|
+
}
|
|
1486
|
+
if (err.statusCode === 429 || err.statusCode === 529) {
|
|
1487
|
+
return true;
|
|
1488
|
+
}
|
|
1489
|
+
if (code === "http_429" || code === "http_529")
|
|
1490
|
+
return true;
|
|
1491
|
+
return false;
|
|
1492
|
+
}
|
|
1461
1493
|
/**
|
|
1462
1494
|
* Map a resumable error to the most descriptive continuation reason. Used
|
|
1463
1495
|
* when surfacing the resume to the agent and to clients via the
|
|
@@ -2667,6 +2699,18 @@ function validateRawToolInput(entry, input) {
|
|
|
2667
2699
|
*/
|
|
2668
2700
|
export async function runAgentLoop(opts) {
|
|
2669
2701
|
const { engine, model, systemPrompt, tools, availableTools, messages, actions, send, signal, } = opts;
|
|
2702
|
+
let outcomeReported = false;
|
|
2703
|
+
const reportOutcome = (outcome) => {
|
|
2704
|
+
if (outcomeReported)
|
|
2705
|
+
return;
|
|
2706
|
+
outcomeReported = true;
|
|
2707
|
+
try {
|
|
2708
|
+
opts.onOutcome?.(outcome);
|
|
2709
|
+
}
|
|
2710
|
+
catch {
|
|
2711
|
+
// Outcome observers are telemetry/protocol adapters and cannot alter the run.
|
|
2712
|
+
}
|
|
2713
|
+
};
|
|
2670
2714
|
const budgetStartedAt = opts.budgetStartedAt ?? Date.now();
|
|
2671
2715
|
const finalResponseGuardRequestText = opts.finalResponseGuardRequestText ??
|
|
2672
2716
|
resolveFinalResponseGuardRequestText(messages);
|
|
@@ -2756,6 +2800,7 @@ export async function runAgentLoop(opts) {
|
|
|
2756
2800
|
// `loop_limit` and `done` share one terminal-event slot in run-manager, so a
|
|
2757
2801
|
// trailing `done` would overwrite the boundary the continuation logic reads.
|
|
2758
2802
|
let endedAtLoopLimit = false;
|
|
2803
|
+
let terminalActionStop = null;
|
|
2759
2804
|
// Overridden (raised tokens, lowered effort) only after an empty-final-
|
|
2760
2805
|
// response retry below — kept separate from `opts.maxOutputTokens`/
|
|
2761
2806
|
// `opts.reasoningEffort` so the very first attempt is unaffected and later
|
|
@@ -3720,9 +3765,12 @@ export async function runAgentLoop(opts) {
|
|
|
3720
3765
|
const toolTimeoutMs = runToolTimeoutCeilingMs > 0
|
|
3721
3766
|
? Math.min(requestedToolTimeoutMs, runToolTimeoutCeilingMs)
|
|
3722
3767
|
: requestedToolTimeoutMs;
|
|
3723
|
-
const
|
|
3768
|
+
const configuredToolMaxResultChars = actionEntry.maxResultChars ??
|
|
3724
3769
|
opts.toolLimits?.maxResultChars ??
|
|
3725
3770
|
DEFAULT_TOOL_RESULT_CHARS;
|
|
3771
|
+
const toolMaxResultChars = typeof opts.toolLimits?.hardMaxResultChars === "number"
|
|
3772
|
+
? Math.min(configuredToolMaxResultChars, opts.toolLimits.hardMaxResultChars)
|
|
3773
|
+
: configuredToolMaxResultChars;
|
|
3726
3774
|
// TOOL-CALL JOURNAL HARD-BLOCK (resume safety, tool-layer enforcement).
|
|
3727
3775
|
// The prompt-level resume journal already TELLS a resuming model not to
|
|
3728
3776
|
// re-run completed tool calls; this enforces it at the tool layer so a
|
|
@@ -4029,6 +4077,8 @@ export async function runAgentLoop(opts) {
|
|
|
4029
4077
|
networkProtocol: opts.networkProtocol,
|
|
4030
4078
|
networkId: opts.networkId,
|
|
4031
4079
|
networkPeer: opts.networkPeer,
|
|
4080
|
+
delegationDepth: opts.delegationDepth,
|
|
4081
|
+
visitedApps: opts.visitedApps,
|
|
4032
4082
|
attachments: opts.attachments,
|
|
4033
4083
|
signal,
|
|
4034
4084
|
// Audit attribution: the action name + the agent thread/turn that
|
|
@@ -4292,6 +4342,7 @@ export async function runAgentLoop(opts) {
|
|
|
4292
4342
|
if (requestedActionStop) {
|
|
4293
4343
|
// TypeScript can't track ??= through async closures; cast to known type.
|
|
4294
4344
|
const stop = requestedActionStop;
|
|
4345
|
+
terminalActionStop = stop;
|
|
4295
4346
|
send({ type: "text", text: stop.message });
|
|
4296
4347
|
break;
|
|
4297
4348
|
}
|
|
@@ -4301,6 +4352,9 @@ export async function runAgentLoop(opts) {
|
|
|
4301
4352
|
// ended on a guardrail, not a clean turn. The result hook still fires below
|
|
4302
4353
|
// so processors can observe the (halted) final text.
|
|
4303
4354
|
if (tripwire) {
|
|
4355
|
+
// TypeScript cannot see assignments performed by the processor callback
|
|
4356
|
+
// inside the loop, so preserve the runtime narrowing explicitly here.
|
|
4357
|
+
const terminalTripwire = tripwire;
|
|
4304
4358
|
if (processorChain) {
|
|
4305
4359
|
try {
|
|
4306
4360
|
await processorChain.runResult(collectTextParts(messages.flatMap((m) => (m.role === "assistant" ? m.content : []))));
|
|
@@ -4311,9 +4365,22 @@ export async function runAgentLoop(opts) {
|
|
|
4311
4365
|
// A result-hook abort is a no-op: the run is already halting.
|
|
4312
4366
|
}
|
|
4313
4367
|
}
|
|
4368
|
+
reportOutcome({
|
|
4369
|
+
state: "failed",
|
|
4370
|
+
code: terminalTripwire.processor === "run-input-token-budget"
|
|
4371
|
+
? "budget_exhausted"
|
|
4372
|
+
: terminalTripwire.processor
|
|
4373
|
+
? `guardrail:${terminalTripwire.processor}`
|
|
4374
|
+
: "guardrail",
|
|
4375
|
+
// Re-running the same request with the same deterministic guardrail
|
|
4376
|
+
// would reproduce the stop. A caller can issue a smaller follow-up, but
|
|
4377
|
+
// must not automatically replay this turn.
|
|
4378
|
+
retryable: false,
|
|
4379
|
+
message: terminalTripwire.message,
|
|
4380
|
+
});
|
|
4314
4381
|
return usage;
|
|
4315
4382
|
}
|
|
4316
|
-
if (!signal.aborted && !endedAtLoopLimit) {
|
|
4383
|
+
if (!signal.aborted && !endedAtLoopLimit && !terminalActionStop) {
|
|
4317
4384
|
// In-loop processor seam (result hook). Fires once at clean run end with the
|
|
4318
4385
|
// final assistant text so processors (e.g. a proof-of-done gate) can record
|
|
4319
4386
|
// a verdict. A result-hook abort cannot un-finish a completed run, so a
|
|
@@ -4352,6 +4419,35 @@ export async function runAgentLoop(opts) {
|
|
|
4352
4419
|
}
|
|
4353
4420
|
}
|
|
4354
4421
|
}
|
|
4422
|
+
if (signal.aborted) {
|
|
4423
|
+
reportOutcome({ state: "canceled", message: "Agent run was aborted." });
|
|
4424
|
+
}
|
|
4425
|
+
else if (endedAtLoopLimit) {
|
|
4426
|
+
reportOutcome({
|
|
4427
|
+
state: "failed",
|
|
4428
|
+
code: "loop_limit",
|
|
4429
|
+
retryable: false,
|
|
4430
|
+
message: `Agent stopped after ${maxIterations} iterations.`,
|
|
4431
|
+
});
|
|
4432
|
+
}
|
|
4433
|
+
else if (terminalActionStop?.errorCode === "needs-approval") {
|
|
4434
|
+
reportOutcome({
|
|
4435
|
+
state: "input_required",
|
|
4436
|
+
code: "needs_approval",
|
|
4437
|
+
message: terminalActionStop.message,
|
|
4438
|
+
});
|
|
4439
|
+
}
|
|
4440
|
+
else if (terminalActionStop) {
|
|
4441
|
+
reportOutcome({
|
|
4442
|
+
state: "failed",
|
|
4443
|
+
code: terminalActionStop.errorCode ?? "tool_failed",
|
|
4444
|
+
retryable: false,
|
|
4445
|
+
message: terminalActionStop.message,
|
|
4446
|
+
});
|
|
4447
|
+
}
|
|
4448
|
+
else {
|
|
4449
|
+
reportOutcome({ state: "completed" });
|
|
4450
|
+
}
|
|
4355
4451
|
return usage;
|
|
4356
4452
|
}
|
|
4357
4453
|
function backgroundChatProgressRunId(turnId) {
|
|
@@ -4379,7 +4475,7 @@ function isRecoverableContinuationError(event) {
|
|
|
4379
4475
|
code === "http_529" ||
|
|
4380
4476
|
code === "run_timeout" ||
|
|
4381
4477
|
message.includes("timeout") ||
|
|
4382
|
-
message
|
|
4478
|
+
hasProviderConnectionErrorMessage(message) ||
|
|
4383
4479
|
message.includes("temporarily unavailable"));
|
|
4384
4480
|
}
|
|
4385
4481
|
function endsAtInternalContinuationBoundary(run) {
|
|
@@ -5311,7 +5407,9 @@ function progressStepFromAgentChatEvent(event) {
|
|
|
5311
5407
|
? `Calling ${event.agent}.`
|
|
5312
5408
|
: event.status === "done"
|
|
5313
5409
|
? `Finished ${event.agent}.`
|
|
5314
|
-
:
|
|
5410
|
+
: event.status === "pending"
|
|
5411
|
+
? `${event.agent} is still working.`
|
|
5412
|
+
: `${event.agent} failed.`;
|
|
5315
5413
|
case "agent_task":
|
|
5316
5414
|
return event.status === "running"
|
|
5317
5415
|
? "Started background task."
|