@agent-native/core 0.98.4 → 0.98.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 +2 -2
- package/corpus/core/CHANGELOG.md +28 -0
- package/corpus/core/docs/content/durable-background-runs.mdx +37 -0
- package/corpus/core/docs/content/external-agents.mdx +62 -7
- package/corpus/core/docs/content/locales/ar-SA/external-agents.mdx +38 -7
- package/corpus/core/docs/content/locales/ar-SA/tracking.mdx +2 -0
- package/corpus/core/docs/content/locales/de-DE/external-agents.mdx +39 -7
- package/corpus/core/docs/content/locales/de-DE/tracking.mdx +2 -0
- package/corpus/core/docs/content/locales/es-ES/external-agents.mdx +39 -7
- package/corpus/core/docs/content/locales/es-ES/tracking.mdx +2 -0
- package/corpus/core/docs/content/locales/fr-FR/external-agents.mdx +39 -7
- package/corpus/core/docs/content/locales/fr-FR/tracking.mdx +4 -2
- package/corpus/core/docs/content/locales/hi-IN/external-agents.mdx +38 -7
- package/corpus/core/docs/content/locales/hi-IN/tracking.mdx +2 -0
- package/corpus/core/docs/content/locales/ja-JP/external-agents.mdx +38 -7
- package/corpus/core/docs/content/locales/ja-JP/tracking.mdx +2 -0
- package/corpus/core/docs/content/locales/ko-KR/external-agents.mdx +38 -7
- package/corpus/core/docs/content/locales/ko-KR/tracking.mdx +2 -0
- package/corpus/core/docs/content/locales/pt-BR/external-agents.mdx +39 -7
- package/corpus/core/docs/content/locales/pt-BR/tracking.mdx +2 -0
- package/corpus/core/docs/content/locales/zh-CN/external-agents.mdx +37 -7
- package/corpus/core/docs/content/locales/zh-CN/tracking.mdx +2 -0
- package/corpus/core/docs/content/locales/zh-TW/durable-background-runs.mdx +14 -0
- package/corpus/core/docs/content/locales/zh-TW/external-agents.mdx +37 -7
- package/corpus/core/docs/content/locales/zh-TW/tracking.mdx +2 -0
- package/corpus/core/docs/content/tracking.mdx +2 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/a2a/handlers.ts +95 -21
- package/corpus/core/src/a2a/task-store.ts +65 -3
- package/corpus/core/src/agent/durable-background.ts +16 -16
- package/corpus/core/src/agent/engine/ai-sdk-engine.ts +25 -8
- package/corpus/core/src/agent/engine/anthropic-engine.ts +17 -3
- package/corpus/core/src/agent/engine/output-tokens.ts +6 -6
- package/corpus/core/src/agent/production-agent.ts +200 -27
- package/corpus/core/src/agent/run-manager.ts +81 -1
- package/corpus/core/src/agent/run-store.ts +301 -41
- package/corpus/core/src/client/AgentPanel.tsx +6 -2
- package/corpus/core/src/client/AssistantChat.tsx +364 -69
- package/corpus/core/src/client/agent-chat-adapter.ts +169 -1
- package/corpus/core/src/client/chat/message-components.tsx +3 -0
- package/corpus/core/src/client/chat/tool-call-display.tsx +20 -36
- package/corpus/core/src/client/conversation/use-near-bottom-autoscroll.ts +7 -0
- package/corpus/core/src/client/extensions/AgentNativeExtensionFrame.tsx +2 -0
- package/corpus/core/src/client/extensions/EmbeddedExtension.tsx +2 -0
- package/corpus/core/src/client/extensions/ExtensionEditor.tsx +9 -2
- package/corpus/core/src/client/extensions/ExtensionViewer.tsx +2 -0
- package/corpus/core/src/client/extensions/InlineExtensionFrame.tsx +2 -0
- package/corpus/core/src/client/extensions/portable-extension.ts +2 -0
- package/corpus/core/src/client/session-replay.ts +361 -29
- package/corpus/core/src/client/sse-event-processor.ts +43 -1
- package/corpus/core/src/demo/actions/toggle-demo-mode.ts +1 -1
- package/corpus/core/src/demo/config.ts +6 -6
- package/corpus/core/src/demo/fetch-interceptor.ts +13 -4
- package/corpus/core/src/demo/redact.ts +13 -149
- package/corpus/core/src/extensions/html-shell.ts +3 -0
- package/corpus/core/src/extensions/session-replay-iframe.ts +131 -0
- package/corpus/core/src/integrations/adapters/slack.ts +123 -13
- package/corpus/core/src/integrations/identity-links-store.ts +210 -0
- package/corpus/core/src/integrations/identity.ts +132 -0
- package/corpus/core/src/integrations/index.ts +6 -0
- package/corpus/core/src/integrations/plugin.ts +58 -1
- package/corpus/core/src/integrations/types.ts +7 -0
- package/corpus/core/src/mcp/build-server.ts +127 -22
- package/corpus/core/src/mcp/external-agent-policy.ts +18 -0
- package/corpus/core/src/mcp/index.ts +1 -0
- package/corpus/core/src/scripts/agent-engines/list-agent-engines.ts +1 -20
- package/corpus/core/src/server/agent-chat/plugin-options.ts +12 -1
- package/corpus/core/src/server/agent-chat/script-entries.ts +20 -3
- package/corpus/core/src/server/agent-chat-plugin.ts +3 -0
- package/corpus/core/src/session-replay-iframe-protocol.ts +58 -0
- package/corpus/core/src/shared/reasoning-effort.ts +35 -0
- package/corpus/core/src/styles/agent-conversation.css +26 -0
- package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +34 -5
- package/corpus/core/src/templates/workspace-core/.agents/skills/observability/SKILL.md +0 -15
- package/corpus/templates/analytics/.agents/skills/session-replay/SKILL.md +30 -21
- package/corpus/templates/analytics/AGENTS.md +27 -0
- package/corpus/templates/analytics/actions/create-session-replay-agent-link.ts +0 -1
- package/corpus/templates/analytics/actions/get-error-issue.ts +1 -0
- package/corpus/templates/analytics/actions/get-session-replay-summary.ts +1 -0
- package/corpus/templates/analytics/actions/get-session-replay-timeline.ts +40 -0
- package/corpus/templates/analytics/actions/list-error-issues.ts +13 -0
- package/corpus/templates/analytics/actions/list-session-recordings.ts +1 -0
- package/corpus/templates/analytics/actions/query-agent-native-analytics.ts +4 -0
- package/corpus/templates/analytics/app/global.css +2 -2
- package/corpus/templates/analytics/app/hooks/use-dashboard-chat-context.ts +41 -4
- package/corpus/templates/analytics/app/pages/sessions/SessionDetailPage.tsx +52 -203
- package/corpus/templates/analytics/app/pages/sessions/SessionsPage.tsx +69 -16
- package/corpus/templates/analytics/changelog/2026-07-12-analytics-chat-retries-before-showing-a-generic-no-data-mess.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-12-analytics-sessions-search-no-longer-loses-fast-keystrokes-an.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-12-chart-selection-respects-chat-state.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-12-connected-external-agents-can-now-look-up-sessions-error-iss.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-12-demo-mode-anonymizes-error-reporting-emails.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-12-session-identities-stay-visible-when-demo-mode-is-off.md +6 -0
- package/corpus/templates/analytics/changelog/2026-07-12-session-replays-show-iframe-content.md +6 -0
- package/corpus/templates/analytics/netlify.toml +0 -3
- package/corpus/templates/analytics/server/lib/analytics-connector-catalog.ts +14 -0
- package/corpus/templates/analytics/server/lib/error-capture.ts +101 -2
- package/corpus/templates/analytics/server/lib/real-data-actions.ts +24 -0
- package/corpus/templates/analytics/server/lib/session-replay-agent-context.ts +49 -17
- package/corpus/templates/analytics/server/lib/session-replay.ts +18 -16
- package/corpus/templates/analytics/server/plugins/agent-chat.ts +43 -6
- package/corpus/templates/analytics/server/plugins/db.ts +15 -0
- package/corpus/templates/assets/app/global.css +1 -1
- package/corpus/templates/brain/app/global.css +2 -2
- package/corpus/templates/brain/changelog/2026-07-12-fix-long-response-progress.md +6 -0
- package/corpus/templates/forms/app/components/CloudUpgrade.tsx +1 -1
- package/corpus/templates/forms/app/components/ThemeToggle.tsx +22 -6
- package/corpus/templates/forms/app/components/builder/FieldPropertiesPanel.tsx +5 -5
- package/corpus/templates/forms/app/components/builder/FieldRenderer.tsx +3 -3
- package/corpus/templates/forms/app/components/layout/Sidebar.tsx +16 -16
- package/corpus/templates/forms/app/global.css +164 -13
- package/corpus/templates/forms/app/pages/AskPage.tsx +35 -13
- package/corpus/templates/forms/app/pages/FormBuilderPage.tsx +143 -67
- package/corpus/templates/forms/app/pages/FormFillPage.tsx +44 -11
- package/corpus/templates/forms/app/pages/FormsListPage.tsx +42 -24
- package/corpus/templates/forms/app/pages/ResponseInsightsPage.tsx +28 -15
- package/corpus/templates/forms/app/pages/ResponsesPage.tsx +46 -20
- package/corpus/templates/forms/app/routes/_app.settings.tsx +1 -1
- package/corpus/templates/forms/changelog/2026-07-12-ask-forms-suggestions-now-sit-beneath-the-composer-for-a-tig.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-12-builder-response-tables-now-fill-the-view-without-a-redundan.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-12-form-builder-surfaces-are-calmer-fields-stay-stable-on-hover.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-12-response-tables-now-fill-the-available-pane-with-a-flexible-.md +6 -0
- package/corpus/templates/forms/changelog/2026-07-12-smoother-more-tactile-controls-throughout-animated-icon-and-.md +6 -0
- package/corpus/templates/mail/AGENTS.md +3 -1
- package/corpus/templates/mail/app/components/email/EmailThread.tsx +21 -13
- package/corpus/templates/mail/app/components/email/email-iframe-document.ts +18 -0
- package/corpus/templates/mail/server/lib/mail-integrations.ts +3 -0
- package/dist/a2a/handlers.d.ts.map +1 -1
- package/dist/a2a/handlers.js +84 -15
- package/dist/a2a/handlers.js.map +1 -1
- package/dist/a2a/task-store.d.ts +20 -1
- package/dist/a2a/task-store.d.ts.map +1 -1
- package/dist/a2a/task-store.js +57 -4
- package/dist/a2a/task-store.js.map +1 -1
- package/dist/agent/durable-background.d.ts +10 -10
- package/dist/agent/durable-background.d.ts.map +1 -1
- package/dist/agent/durable-background.js +16 -16
- package/dist/agent/durable-background.js.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.d.ts.map +1 -1
- package/dist/agent/engine/ai-sdk-engine.js +19 -8
- package/dist/agent/engine/ai-sdk-engine.js.map +1 -1
- package/dist/agent/engine/anthropic-engine.d.ts.map +1 -1
- package/dist/agent/engine/anthropic-engine.js +11 -3
- package/dist/agent/engine/anthropic-engine.js.map +1 -1
- package/dist/agent/engine/output-tokens.js +6 -6
- package/dist/agent/engine/output-tokens.js.map +1 -1
- package/dist/agent/production-agent.d.ts +52 -0
- package/dist/agent/production-agent.d.ts.map +1 -1
- package/dist/agent/production-agent.js +154 -26
- package/dist/agent/production-agent.js.map +1 -1
- package/dist/agent/run-manager.d.ts +9 -0
- package/dist/agent/run-manager.d.ts.map +1 -1
- package/dist/agent/run-manager.js +71 -1
- package/dist/agent/run-manager.js.map +1 -1
- package/dist/agent/run-store.d.ts +9 -0
- package/dist/agent/run-store.d.ts.map +1 -1
- package/dist/agent/run-store.js +243 -48
- package/dist/agent/run-store.js.map +1 -1
- package/dist/client/AgentPanel.d.ts.map +1 -1
- package/dist/client/AgentPanel.js +6 -2
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +21 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +298 -67
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/agent-chat-adapter.d.ts.map +1 -1
- package/dist/client/agent-chat-adapter.js +146 -1
- package/dist/client/agent-chat-adapter.js.map +1 -1
- package/dist/client/chat/message-components.d.ts.map +1 -1
- package/dist/client/chat/message-components.js +2 -1
- package/dist/client/chat/message-components.js.map +1 -1
- package/dist/client/chat/tool-call-display.d.ts +3 -1
- package/dist/client/chat/tool-call-display.d.ts.map +1 -1
- package/dist/client/chat/tool-call-display.js +13 -37
- package/dist/client/chat/tool-call-display.js.map +1 -1
- package/dist/client/conversation/use-near-bottom-autoscroll.d.ts +1 -0
- package/dist/client/conversation/use-near-bottom-autoscroll.d.ts.map +1 -1
- package/dist/client/conversation/use-near-bottom-autoscroll.js +6 -0
- package/dist/client/conversation/use-near-bottom-autoscroll.js.map +1 -1
- package/dist/client/extensions/AgentNativeExtensionFrame.d.ts.map +1 -1
- package/dist/client/extensions/AgentNativeExtensionFrame.js +2 -1
- package/dist/client/extensions/AgentNativeExtensionFrame.js.map +1 -1
- package/dist/client/extensions/EmbeddedExtension.d.ts.map +1 -1
- package/dist/client/extensions/EmbeddedExtension.js +2 -1
- package/dist/client/extensions/EmbeddedExtension.js.map +1 -1
- package/dist/client/extensions/ExtensionEditor.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionEditor.js +5 -2
- package/dist/client/extensions/ExtensionEditor.js.map +1 -1
- package/dist/client/extensions/ExtensionViewer.d.ts.map +1 -1
- package/dist/client/extensions/ExtensionViewer.js +2 -1
- package/dist/client/extensions/ExtensionViewer.js.map +1 -1
- package/dist/client/extensions/InlineExtensionFrame.d.ts.map +1 -1
- package/dist/client/extensions/InlineExtensionFrame.js +2 -1
- package/dist/client/extensions/InlineExtensionFrame.js.map +1 -1
- package/dist/client/extensions/portable-extension.d.ts.map +1 -1
- package/dist/client/extensions/portable-extension.js +2 -0
- package/dist/client/extensions/portable-extension.js.map +1 -1
- package/dist/client/session-replay.d.ts.map +1 -1
- package/dist/client/session-replay.js +308 -29
- package/dist/client/session-replay.js.map +1 -1
- package/dist/client/sse-event-processor.d.ts +5 -0
- package/dist/client/sse-event-processor.d.ts.map +1 -1
- package/dist/client/sse-event-processor.js +37 -1
- package/dist/client/sse-event-processor.js.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/demo/actions/toggle-demo-mode.js +1 -1
- package/dist/demo/actions/toggle-demo-mode.js.map +1 -1
- package/dist/demo/config.js +6 -6
- package/dist/demo/config.js.map +1 -1
- package/dist/demo/fetch-interceptor.d.ts.map +1 -1
- package/dist/demo/fetch-interceptor.js +13 -4
- package/dist/demo/fetch-interceptor.js.map +1 -1
- package/dist/demo/redact.d.ts +7 -7
- package/dist/demo/redact.d.ts.map +1 -1
- package/dist/demo/redact.js +8 -145
- package/dist/demo/redact.js.map +1 -1
- package/dist/extensions/html-shell.d.ts.map +1 -1
- package/dist/extensions/html-shell.js +2 -0
- package/dist/extensions/html-shell.js.map +1 -1
- package/dist/extensions/session-replay-iframe.d.ts +10 -0
- package/dist/extensions/session-replay-iframe.d.ts.map +1 -0
- package/dist/extensions/session-replay-iframe.js +121 -0
- package/dist/extensions/session-replay-iframe.js.map +1 -0
- 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 +98 -13
- package/dist/integrations/adapters/slack.js.map +1 -1
- package/dist/integrations/identity-links-store.d.ts +23 -0
- package/dist/integrations/identity-links-store.d.ts.map +1 -0
- package/dist/integrations/identity-links-store.js +158 -0
- package/dist/integrations/identity-links-store.js.map +1 -0
- package/dist/integrations/identity.d.ts +11 -0
- package/dist/integrations/identity.d.ts.map +1 -0
- package/dist/integrations/identity.js +100 -0
- package/dist/integrations/identity.js.map +1 -0
- package/dist/integrations/index.d.ts +2 -0
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +2 -0
- package/dist/integrations/index.js.map +1 -1
- package/dist/integrations/plugin.d.ts.map +1 -1
- package/dist/integrations/plugin.js +43 -1
- package/dist/integrations/plugin.js.map +1 -1
- package/dist/integrations/types.d.ts +6 -0
- package/dist/integrations/types.d.ts.map +1 -1
- package/dist/integrations/types.js.map +1 -1
- package/dist/mcp/build-server.d.ts +9 -2
- package/dist/mcp/build-server.d.ts.map +1 -1
- package/dist/mcp/build-server.js +97 -20
- package/dist/mcp/build-server.js.map +1 -1
- package/dist/mcp/external-agent-policy.d.ts +19 -0
- package/dist/mcp/external-agent-policy.d.ts.map +1 -0
- package/dist/mcp/external-agent-policy.js +2 -0
- package/dist/mcp/external-agent-policy.js.map +1 -0
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js.map +1 -1
- package/dist/notifications/routes.d.ts +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.d.ts.map +1 -1
- package/dist/scripts/agent-engines/list-agent-engines.js +1 -19
- package/dist/scripts/agent-engines/list-agent-engines.js.map +1 -1
- package/dist/server/agent-chat/plugin-options.d.ts +11 -1
- package/dist/server/agent-chat/plugin-options.d.ts.map +1 -1
- package/dist/server/agent-chat/plugin-options.js.map +1 -1
- package/dist/server/agent-chat/script-entries.d.ts.map +1 -1
- package/dist/server/agent-chat/script-entries.js +16 -2
- package/dist/server/agent-chat/script-entries.js.map +1 -1
- package/dist/server/agent-chat-plugin.d.ts.map +1 -1
- package/dist/server/agent-chat-plugin.js +3 -0
- package/dist/server/agent-chat-plugin.js.map +1 -1
- package/dist/server/agent-engine-api-key-route.d.ts +1 -1
- package/dist/server/transcribe-voice.d.ts +1 -1
- package/dist/session-replay-iframe-protocol.d.ts +36 -0
- package/dist/session-replay-iframe-protocol.d.ts.map +1 -0
- package/dist/session-replay-iframe-protocol.js +24 -0
- package/dist/session-replay-iframe-protocol.js.map +1 -0
- package/dist/shared/reasoning-effort.d.ts +11 -0
- package/dist/shared/reasoning-effort.d.ts.map +1 -1
- package/dist/shared/reasoning-effort.js +36 -0
- package/dist/shared/reasoning-effort.js.map +1 -1
- package/dist/styles/agent-conversation.css +26 -0
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +34 -5
- package/dist/templates/workspace-core/.agents/skills/observability/SKILL.md +0 -15
- package/docs/content/durable-background-runs.mdx +37 -0
- package/docs/content/external-agents.mdx +62 -7
- package/docs/content/locales/ar-SA/external-agents.mdx +38 -7
- package/docs/content/locales/ar-SA/tracking.mdx +2 -0
- package/docs/content/locales/de-DE/external-agents.mdx +39 -7
- package/docs/content/locales/de-DE/tracking.mdx +2 -0
- package/docs/content/locales/es-ES/external-agents.mdx +39 -7
- package/docs/content/locales/es-ES/tracking.mdx +2 -0
- package/docs/content/locales/fr-FR/external-agents.mdx +39 -7
- package/docs/content/locales/fr-FR/tracking.mdx +4 -2
- package/docs/content/locales/hi-IN/external-agents.mdx +38 -7
- package/docs/content/locales/hi-IN/tracking.mdx +2 -0
- package/docs/content/locales/ja-JP/external-agents.mdx +38 -7
- package/docs/content/locales/ja-JP/tracking.mdx +2 -0
- package/docs/content/locales/ko-KR/external-agents.mdx +38 -7
- package/docs/content/locales/ko-KR/tracking.mdx +2 -0
- package/docs/content/locales/pt-BR/external-agents.mdx +39 -7
- package/docs/content/locales/pt-BR/tracking.mdx +2 -0
- package/docs/content/locales/zh-CN/external-agents.mdx +37 -7
- package/docs/content/locales/zh-CN/tracking.mdx +2 -0
- package/docs/content/locales/zh-TW/durable-background-runs.mdx +14 -0
- package/docs/content/locales/zh-TW/external-agents.mdx +37 -7
- package/docs/content/locales/zh-TW/tracking.mdx +2 -0
- package/docs/content/tracking.mdx +2 -0
- package/package.json +2 -2
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +34 -5
- package/src/templates/workspace-core/.agents/skills/observability/SKILL.md +0 -15
- package/corpus/core/src/observability/hosted-model-experiment.ts +0 -118
- package/dist/observability/hosted-model-experiment.d.ts +0 -39
- package/dist/observability/hosted-model-experiment.d.ts.map +0 -1
- package/dist/observability/hosted-model-experiment.js +0 -90
- package/dist/observability/hosted-model-experiment.js.map +0 -1
|
@@ -237,6 +237,8 @@ Privacy defaults are intentionally conservative but still useful for playback:
|
|
|
237
237
|
- URLs are scrubbed with the same `scrubUrl()` helper used by browser analytics.
|
|
238
238
|
- Replay capture is web-only and opt-in; it does not record native desktop screens.
|
|
239
239
|
|
|
240
|
+
Framework-owned iframes, including extensions and rendered email content, are included in replay capture. The same masking and blocking selectors apply inside recorded frames. A third-party cross-origin iframe remains opaque unless its own document runs a compatible rrweb recorder with cross-origin iframe recording enabled; browser origin boundaries cannot be bypassed from the parent page.
|
|
241
|
+
|
|
240
242
|
While recording, session replay also captures browser console output (`log`, `info`, `warn`, `error`, `debug`, plus window `error` / `unhandledrejection`) and network request metadata (`fetch` and XHR) as tagged rrweb custom events, so agents and the replay viewer can debug user-reported issues. Capture is on by default when replay is enabled; tune or disable it with the `sessionReplay.console` and `sessionReplay.network` options, each accepting a boolean or an options object (`{ maxEvents?: number }`, with `network` additionally accepting `captureErrorBodies` and `maxErrorBodyLength`). Request bodies and headers are never captured; response bodies are captured only as a bounded, redacted snippet for 5xx (server error) responses (`captureErrorBodies`, default true, capped at `maxErrorBodyLength` chars, default 2048) — non-5xx and network-failure responses never carry a body. URLs are scrubbed, messages are truncated, the recorder's own ingest/tracking traffic is excluded, and per-session budgets (1000 console / 2000 network events) add a truncation notice when exceeded.
|
|
241
243
|
|
|
242
244
|
The Analytics template stores replay metadata in SQL (`session_recordings`) and stores chunks through private blob refs (`session_replay_chunks`). Browsers and agents never receive provider URLs. Playback goes through scoped server routes and the default agent tools return summaries or bounded replay events, not raw chunk table access.
|
package/corpus/core/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-native/core",
|
|
3
|
-
"version": "0.98.
|
|
3
|
+
"version": "0.98.6",
|
|
4
4
|
"description": "Framework for agent-native application development — where AI agents and UI share SQL state, actions, and context",
|
|
5
5
|
"homepage": "https://github.com/BuilderIO/agent-native#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
claimA2ATaskForProcessing,
|
|
23
23
|
getA2ATaskDispatchState,
|
|
24
24
|
failStuckA2ATask,
|
|
25
|
+
failStuckQueuedA2ATask,
|
|
25
26
|
touchQueuedA2ATaskDispatch,
|
|
26
27
|
touchProcessingA2ATask,
|
|
27
28
|
} from "./task-store.js";
|
|
@@ -43,6 +44,34 @@ const A2A_QUEUED_DISPATCH_STUCK_AFTER_MS = 10_000;
|
|
|
43
44
|
const A2A_PROCESSING_STUCK_AFTER_MS = 5 * 60 * 1000;
|
|
44
45
|
const A2A_PROCESSING_HEARTBEAT_MS = 30_000;
|
|
45
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Hard cap on how long a task may sit in submitted/working (never reaching
|
|
49
|
+
* `processing`) before the dispatch-retry loop in
|
|
50
|
+
* `refireStuckAsyncTaskIfNeeded` gives up and fails it. Without this, a
|
|
51
|
+
* persistently failing dispatch (missing background function, bad A2A
|
|
52
|
+
* secret, 404) throttles-and-retries forever — the queued bucket otherwise
|
|
53
|
+
* has no terminal state. Override with A2A_QUEUED_LIFETIME_MAX_MS.
|
|
54
|
+
*/
|
|
55
|
+
function a2aQueuedLifetimeMaxMs(): number {
|
|
56
|
+
const raw = Number(process.env.A2A_QUEUED_LIFETIME_MAX_MS);
|
|
57
|
+
if (Number.isFinite(raw) && raw > 0) return raw;
|
|
58
|
+
return 3 * 60 * 1000;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Hard cap on total time a task may spend in `processing`, independent of
|
|
63
|
+
* the liveness heartbeat. `A2A_PROCESSING_STUCK_AFTER_MS` alone only catches
|
|
64
|
+
* a dead process — a hung await inside a still-alive process keeps
|
|
65
|
+
* `updated_at` fresh via the heartbeat forever. This bounds that case
|
|
66
|
+
* without cutting off legitimately long runs under it. Override with
|
|
67
|
+
* A2A_PROCESSING_LIFETIME_MAX_MS.
|
|
68
|
+
*/
|
|
69
|
+
function a2aProcessingLifetimeMaxMs(): number {
|
|
70
|
+
const raw = Number(process.env.A2A_PROCESSING_LIFETIME_MAX_MS);
|
|
71
|
+
if (Number.isFinite(raw) && raw > 0) return raw;
|
|
72
|
+
return 30 * 60 * 1000;
|
|
73
|
+
}
|
|
74
|
+
|
|
46
75
|
/**
|
|
47
76
|
* Dispatch an async A2A task to a fresh function execution. Apps that opted
|
|
48
77
|
* into durable background runs reuse the emitted Netlify 15-minute worker;
|
|
@@ -52,6 +81,7 @@ async function fireProcessTaskDispatch(
|
|
|
52
81
|
event: any,
|
|
53
82
|
taskId: string,
|
|
54
83
|
config: A2AConfig,
|
|
84
|
+
options?: { awaitResponse?: boolean },
|
|
55
85
|
): Promise<void> {
|
|
56
86
|
const backgroundPath = resolveAgentChatProcessRunDispatchPath();
|
|
57
87
|
const useBackgroundWorker =
|
|
@@ -70,6 +100,13 @@ async function fireProcessTaskDispatch(
|
|
|
70
100
|
},
|
|
71
101
|
}
|
|
72
102
|
: {}),
|
|
103
|
+
// Only Netlify's background-function URL acknowledges enqueue with 202.
|
|
104
|
+
// The portable framework route keeps its HTTP response open until the
|
|
105
|
+
// processor completes, so awaiting that response would turn async
|
|
106
|
+
// message/send into a long synchronous request (or a 15s timeout).
|
|
107
|
+
...(options?.awaitResponse && useBackgroundWorker
|
|
108
|
+
? { awaitResponse: true }
|
|
109
|
+
: {}),
|
|
73
110
|
});
|
|
74
111
|
}
|
|
75
112
|
|
|
@@ -483,9 +520,22 @@ async function handleSend(
|
|
|
483
520
|
);
|
|
484
521
|
const working = await updateTask(task.id, { state: "working" });
|
|
485
522
|
|
|
486
|
-
|
|
523
|
+
// Awaited, not fire-and-forget: this handler is about to return, and a
|
|
524
|
+
// detached dispatch fetch racing only a short settle timer can be killed
|
|
525
|
+
// mid-flight when the serverless response is flushed WITHOUT rejecting —
|
|
526
|
+
// see the `awaitResponse` doc on `fireInternalDispatch` in
|
|
527
|
+
// server/self-dispatch.ts. `awaitResponse: true` requests the stronger
|
|
528
|
+
// guarantee; `fireProcessTaskDispatch` only honors it for the Netlify
|
|
529
|
+
// background-worker path (fast 202 ack) and falls back to the settle
|
|
530
|
+
// race for the portable route, which holds its response open until the
|
|
531
|
+
// handler finishes.
|
|
532
|
+
try {
|
|
533
|
+
await fireProcessTaskDispatch(event, task.id, config, {
|
|
534
|
+
awaitResponse: true,
|
|
535
|
+
});
|
|
536
|
+
} catch (err) {
|
|
487
537
|
console.error("[a2a] Failed to dispatch process-task:", err);
|
|
488
|
-
}
|
|
538
|
+
}
|
|
489
539
|
|
|
490
540
|
return { ...jsonRpcResult(0, working ?? task), _id: 0 };
|
|
491
541
|
}
|
|
@@ -750,30 +800,54 @@ async function refireStuckAsyncTaskIfNeeded(
|
|
|
750
800
|
if (!state.metadata?.__a2a_processor) return false;
|
|
751
801
|
|
|
752
802
|
const now = Date.now();
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
803
|
+
|
|
804
|
+
if (state.statusState === "submitted" || state.statusState === "working") {
|
|
805
|
+
const queuedLifetimeCutoff = now - a2aQueuedLifetimeMaxMs();
|
|
806
|
+
if (state.createdAt <= queuedLifetimeCutoff) {
|
|
807
|
+
// Dispatch has kept failing (or was never delivered) long enough that
|
|
808
|
+
// retrying further would just repeat the same failure forever — stop
|
|
809
|
+
// refiring and surface a terminal error instead of throttling forever.
|
|
810
|
+
return failStuckQueuedA2ATask(
|
|
811
|
+
taskId,
|
|
812
|
+
queuedLifetimeCutoff,
|
|
813
|
+
"The async A2A task could not be started because dispatch kept failing. Please retry the request.",
|
|
814
|
+
);
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
if (state.updatedAt <= now - A2A_QUEUED_DISPATCH_STUCK_AFTER_MS) {
|
|
818
|
+
if (!(await touchQueuedA2ATaskDispatch(taskId))) return false;
|
|
819
|
+
try {
|
|
820
|
+
await fireProcessTaskDispatch(event, taskId, config);
|
|
821
|
+
} catch (err) {
|
|
822
|
+
console.error(
|
|
823
|
+
"[a2a] Failed to refire stuck queued task dispatch:",
|
|
824
|
+
err,
|
|
825
|
+
);
|
|
826
|
+
return false;
|
|
827
|
+
}
|
|
759
828
|
return true;
|
|
760
829
|
}
|
|
761
830
|
return false;
|
|
762
831
|
}
|
|
763
832
|
|
|
764
|
-
if (
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
833
|
+
if (state.statusState === "processing") {
|
|
834
|
+
const processingStuckCutoff = now - A2A_PROCESSING_STUCK_AFTER_MS;
|
|
835
|
+
const processingLifetimeCutoff = now - a2aProcessingLifetimeMaxMs();
|
|
836
|
+
const isStale = state.updatedAt <= processingStuckCutoff;
|
|
837
|
+
const isOverLifetime = state.createdAt <= processingLifetimeCutoff;
|
|
838
|
+
if (isStale || isOverLifetime) {
|
|
839
|
+
// A processor that died mid-handler may have already performed
|
|
840
|
+
// side-effectful work. Retrying from the top can duplicate artifacts, so
|
|
841
|
+
// fail deterministically and let the caller issue an intentional retry.
|
|
842
|
+
return failStuckA2ATask(
|
|
843
|
+
taskId,
|
|
844
|
+
processingStuckCutoff,
|
|
845
|
+
isStale
|
|
846
|
+
? "The async A2A processor timed out before completing. Please retry the request."
|
|
847
|
+
: "The async A2A processor exceeded its maximum run time. Please retry the request.",
|
|
848
|
+
processingLifetimeCutoff,
|
|
849
|
+
);
|
|
850
|
+
}
|
|
777
851
|
}
|
|
778
852
|
|
|
779
853
|
return false;
|
|
@@ -200,11 +200,12 @@ export async function getA2ATaskDispatchState(id: string): Promise<{
|
|
|
200
200
|
statusState: string;
|
|
201
201
|
metadata: Record<string, unknown> | undefined;
|
|
202
202
|
updatedAt: number;
|
|
203
|
+
createdAt: number;
|
|
203
204
|
} | null> {
|
|
204
205
|
await ensureTable();
|
|
205
206
|
const client = getDbExec();
|
|
206
207
|
const { rows } = await client.execute({
|
|
207
|
-
sql: `SELECT id, status_state, metadata, updated_at FROM a2a_tasks WHERE id = ?`,
|
|
208
|
+
sql: `SELECT id, status_state, metadata, created_at, updated_at FROM a2a_tasks WHERE id = ?`,
|
|
208
209
|
args: [id],
|
|
209
210
|
});
|
|
210
211
|
const row = rows[0] as any;
|
|
@@ -214,6 +215,7 @@ export async function getA2ATaskDispatchState(id: string): Promise<{
|
|
|
214
215
|
statusState: row.status_state as string,
|
|
215
216
|
metadata: row.metadata ? JSON.parse(row.metadata as string) : undefined,
|
|
216
217
|
updatedAt: Number(row.updated_at ?? 0),
|
|
218
|
+
createdAt: Number(row.created_at ?? 0),
|
|
217
219
|
};
|
|
218
220
|
}
|
|
219
221
|
|
|
@@ -269,10 +271,21 @@ export async function resetStuckA2ATaskForRetry(
|
|
|
269
271
|
return affected !== 0;
|
|
270
272
|
}
|
|
271
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Fail a processing task once it is stuck. Two independent conditions can
|
|
276
|
+
* trigger this, either of which alone is sufficient:
|
|
277
|
+
* - `updated_at <= processingCutoff`: no heartbeat/progress touch in a
|
|
278
|
+
* while — the processor likely died.
|
|
279
|
+
* - `created_at <= createdAtCutoff` — a hard wall on total run time. A
|
|
280
|
+
* hung await inside a still-alive process keeps `updated_at` fresh via
|
|
281
|
+
* the liveness heartbeat forever, so staleness alone never trips; age
|
|
282
|
+
* since creation is the only bound that catches it.
|
|
283
|
+
*/
|
|
272
284
|
export async function failStuckA2ATask(
|
|
273
285
|
id: string,
|
|
274
286
|
processingCutoff: number,
|
|
275
287
|
reason: string,
|
|
288
|
+
createdAtCutoff?: number,
|
|
276
289
|
): Promise<boolean> {
|
|
277
290
|
await ensureTable();
|
|
278
291
|
const client = getDbExec();
|
|
@@ -282,6 +295,10 @@ export async function failStuckA2ATask(
|
|
|
282
295
|
role: "agent",
|
|
283
296
|
parts: [{ type: "text", text: reason }],
|
|
284
297
|
};
|
|
298
|
+
const ageCondition =
|
|
299
|
+
createdAtCutoff !== undefined
|
|
300
|
+
? `AND (updated_at <= ? OR created_at <= ?)`
|
|
301
|
+
: `AND updated_at <= ?`;
|
|
285
302
|
const result = await client.execute({
|
|
286
303
|
sql: `UPDATE a2a_tasks
|
|
287
304
|
SET status_state = 'failed',
|
|
@@ -290,8 +307,53 @@ export async function failStuckA2ATask(
|
|
|
290
307
|
updated_at = ?
|
|
291
308
|
WHERE id = ?
|
|
292
309
|
AND status_state = 'processing'
|
|
293
|
-
|
|
294
|
-
args:
|
|
310
|
+
${ageCondition}`,
|
|
311
|
+
args:
|
|
312
|
+
createdAtCutoff !== undefined
|
|
313
|
+
? [
|
|
314
|
+
JSON.stringify(message),
|
|
315
|
+
timestamp,
|
|
316
|
+
now,
|
|
317
|
+
id,
|
|
318
|
+
processingCutoff,
|
|
319
|
+
createdAtCutoff,
|
|
320
|
+
]
|
|
321
|
+
: [JSON.stringify(message), timestamp, now, id, processingCutoff],
|
|
322
|
+
});
|
|
323
|
+
const affected = getAffectedRowCount(result);
|
|
324
|
+
return affected !== 0;
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Fail a queued (submitted/working) task whose age since creation exceeds
|
|
329
|
+
* `createdAtCutoff` — the dispatch-retry loop kept throttling/refiring
|
|
330
|
+
* without ever reaching `processing`. Mirrors `failStuckA2ATask` but is
|
|
331
|
+
* gated on the queued state set and on `created_at` (queued tasks have no
|
|
332
|
+
* heartbeat, so staleness of `updated_at` isn't a meaningful signal here).
|
|
333
|
+
*/
|
|
334
|
+
export async function failStuckQueuedA2ATask(
|
|
335
|
+
id: string,
|
|
336
|
+
createdAtCutoff: number,
|
|
337
|
+
reason: string,
|
|
338
|
+
): Promise<boolean> {
|
|
339
|
+
await ensureTable();
|
|
340
|
+
const client = getDbExec();
|
|
341
|
+
const now = Date.now();
|
|
342
|
+
const timestamp = new Date().toISOString();
|
|
343
|
+
const message: Message = {
|
|
344
|
+
role: "agent",
|
|
345
|
+
parts: [{ type: "text", text: reason }],
|
|
346
|
+
};
|
|
347
|
+
const result = await client.execute({
|
|
348
|
+
sql: `UPDATE a2a_tasks
|
|
349
|
+
SET status_state = 'failed',
|
|
350
|
+
status_message = ?,
|
|
351
|
+
status_timestamp = ?,
|
|
352
|
+
updated_at = ?
|
|
353
|
+
WHERE id = ?
|
|
354
|
+
AND status_state IN ('submitted', 'working')
|
|
355
|
+
AND created_at <= ?`,
|
|
356
|
+
args: [JSON.stringify(message), timestamp, now, id, createdAtCutoff],
|
|
295
357
|
});
|
|
296
358
|
const affected = getAffectedRowCount(result);
|
|
297
359
|
return affected !== 0;
|
|
@@ -364,17 +364,18 @@ export function isAgentChatDurableBackgroundEnabled(options?: {
|
|
|
364
364
|
}
|
|
365
365
|
|
|
366
366
|
/**
|
|
367
|
-
* Env flag for the FOREGROUND server-driven self-chain. DEFAULT-
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
*
|
|
367
|
+
* Env flag for the FOREGROUND server-driven self-chain. DEFAULT-OFF: a hosted
|
|
368
|
+
* app must explicitly opt in with a truthy value (`true`/`1`/`yes`/`on`). A
|
|
369
|
+
* regular Netlify function has a fixed 60-second wall, and a self-dispatched
|
|
370
|
+
* successor can otherwise be killed before it persists its next continuation.
|
|
371
|
+
* Keep this separate from `AGENT_CHAT_DURABLE_BACKGROUND` so the experimental
|
|
372
|
+
* regular-function chain can be enabled independently after its deployment is
|
|
373
|
+
* proven safe.
|
|
373
374
|
*/
|
|
374
375
|
export const AGENT_CHAT_FOREGROUND_SELF_CHAIN_ENV =
|
|
375
376
|
"AGENT_CHAT_FOREGROUND_SELF_CHAIN";
|
|
376
377
|
|
|
377
|
-
function
|
|
378
|
+
function isForegroundSelfChainExplicitlyEnabled(): boolean {
|
|
378
379
|
// Read the literal key (not `process.env[CONST]`) so guard:no-env-credentials
|
|
379
380
|
// can statically verify it against the allowlisted `AGENT_*` prefix. Keep this
|
|
380
381
|
// in sync with AGENT_CHAT_FOREGROUND_SELF_CHAIN_ENV.
|
|
@@ -382,10 +383,10 @@ function isForegroundSelfChainExplicitlyDisabled(): boolean {
|
|
|
382
383
|
if (raw == null) return false;
|
|
383
384
|
const normalized = raw.trim().toLowerCase();
|
|
384
385
|
return (
|
|
385
|
-
normalized === "
|
|
386
|
-
normalized === "
|
|
387
|
-
normalized === "
|
|
388
|
-
normalized === "
|
|
386
|
+
normalized === "1" ||
|
|
387
|
+
normalized === "true" ||
|
|
388
|
+
normalized === "yes" ||
|
|
389
|
+
normalized === "on"
|
|
389
390
|
);
|
|
390
391
|
}
|
|
391
392
|
|
|
@@ -395,10 +396,9 @@ function isForegroundSelfChainExplicitlyDisabled(): boolean {
|
|
|
395
396
|
* server-side self-dispatch on the REGULAR function (not a Netlify
|
|
396
397
|
* `-background` function) instead of depending on the client to re-POST
|
|
397
398
|
* `auto_continue`. Composes exactly like `isAgentChatDurableBackgroundEnabled`:
|
|
398
|
-
* true when the
|
|
399
|
-
* handoff authenticates the
|
|
400
|
-
*
|
|
401
|
-
* `auto_continue` re-POST path is used unchanged, byte-for-byte.
|
|
399
|
+
* true only when the env flag is explicitly truthy, the runtime is hosted, and
|
|
400
|
+
* `A2A_SECRET` is configured (the HMAC handoff authenticates the dispatch).
|
|
401
|
+
* False means the existing client-driven `auto_continue` re-POST path is used.
|
|
402
402
|
*
|
|
403
403
|
* Deliberately independent of `isAgentChatDurableBackgroundEnabled`: an app can
|
|
404
404
|
* use this narrower capability without opting into the full 15-min
|
|
@@ -410,7 +410,7 @@ function isForegroundSelfChainExplicitlyDisabled(): boolean {
|
|
|
410
410
|
*/
|
|
411
411
|
export function isAgentChatForegroundSelfChainEnabled(): boolean {
|
|
412
412
|
return (
|
|
413
|
-
|
|
413
|
+
isForegroundSelfChainExplicitlyEnabled() &&
|
|
414
414
|
isHostedRuntimeForDurableBackground() &&
|
|
415
415
|
hasConfiguredA2ASecret()
|
|
416
416
|
);
|
|
@@ -17,7 +17,11 @@ import {
|
|
|
17
17
|
readDeployCredentialEnv,
|
|
18
18
|
recordProviderCredentialAuthFailure,
|
|
19
19
|
} from "../../server/credential-provider.js";
|
|
20
|
-
import {
|
|
20
|
+
import {
|
|
21
|
+
anthropicManualThinkingBudget,
|
|
22
|
+
normalizeReasoningEffortForModel,
|
|
23
|
+
supportsClaudeAdaptiveThinking,
|
|
24
|
+
} from "../../shared/reasoning-effort.js";
|
|
21
25
|
import { AI_SDK_MODEL_CONFIG, type AISDKProvider } from "../model-config.js";
|
|
22
26
|
import {
|
|
23
27
|
clampThinkingBudgetTokens,
|
|
@@ -316,13 +320,26 @@ class AISDKEngine implements AgentEngine {
|
|
|
316
320
|
const explicitThinking = (
|
|
317
321
|
providerOpts.anthropic as { thinking?: unknown } | undefined
|
|
318
322
|
)?.thinking;
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
323
|
+
if (explicitThinking || supportsClaudeAdaptiveThinking(opts.model)) {
|
|
324
|
+
providerOpts.anthropic = {
|
|
325
|
+
...((providerOpts.anthropic as object) ?? {}),
|
|
326
|
+
thinking: explicitThinking ?? { type: "adaptive" },
|
|
327
|
+
...(explicitThinking
|
|
328
|
+
? {}
|
|
329
|
+
: { outputConfig: { effort: reasoningEffort } }),
|
|
330
|
+
};
|
|
331
|
+
} else {
|
|
332
|
+
const budgetTokens = clampThinkingBudgetTokens(
|
|
333
|
+
anthropicManualThinkingBudget(reasoningEffort),
|
|
334
|
+
resolvedMaxOutputTokens,
|
|
335
|
+
);
|
|
336
|
+
providerOpts.anthropic = {
|
|
337
|
+
...((providerOpts.anthropic as object) ?? {}),
|
|
338
|
+
...(budgetTokens === undefined
|
|
339
|
+
? {}
|
|
340
|
+
: { thinking: { type: "enabled", budgetTokens } }),
|
|
341
|
+
};
|
|
342
|
+
}
|
|
326
343
|
} else if (this.provider === "openai") {
|
|
327
344
|
providerOpts.openai = {
|
|
328
345
|
...((providerOpts.openai as object) ?? {}),
|
|
@@ -13,7 +13,11 @@ import {
|
|
|
13
13
|
readDeployCredentialEnv,
|
|
14
14
|
recordProviderCredentialAuthFailure,
|
|
15
15
|
} from "../../server/credential-provider.js";
|
|
16
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
anthropicManualThinkingBudget,
|
|
18
|
+
normalizeReasoningEffortForModel,
|
|
19
|
+
supportsClaudeAdaptiveThinking,
|
|
20
|
+
} from "../../shared/reasoning-effort.js";
|
|
17
21
|
import { ANTHROPIC_MODEL_CONFIG } from "../model-config.js";
|
|
18
22
|
import {
|
|
19
23
|
LLM_MISSING_CREDENTIALS_ERROR_CODE,
|
|
@@ -105,8 +109,18 @@ class AnthropicEngine implements AgentEngine {
|
|
|
105
109
|
opts.reasoningEffort,
|
|
106
110
|
);
|
|
107
111
|
if (reasoningEffort && !extra.thinking) {
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
if (supportsClaudeAdaptiveThinking(opts.model)) {
|
|
113
|
+
extra.thinking = { type: "adaptive" };
|
|
114
|
+
extra.output_config = { effort: reasoningEffort };
|
|
115
|
+
} else {
|
|
116
|
+
const budgetTokens = clampThinkingBudgetTokens(
|
|
117
|
+
anthropicManualThinkingBudget(reasoningEffort),
|
|
118
|
+
resolvedMaxOutputTokens,
|
|
119
|
+
);
|
|
120
|
+
if (budgetTokens !== undefined) {
|
|
121
|
+
extra.thinking = { type: "enabled", budget_tokens: budgetTokens };
|
|
122
|
+
}
|
|
123
|
+
}
|
|
110
124
|
}
|
|
111
125
|
|
|
112
126
|
// Apply prompt caching to the system prompt and tools by default.
|
|
@@ -71,12 +71,12 @@ export function resolveEmptyResponseRetryMaxOutputTokens(
|
|
|
71
71
|
// room for the actual visible completion. This clamp guarantees at least
|
|
72
72
|
// max(8000, 40% of maxOutputTokens) tokens of non-thinking headroom.
|
|
73
73
|
//
|
|
74
|
-
// Note: this
|
|
75
|
-
//
|
|
76
|
-
//
|
|
77
|
-
//
|
|
78
|
-
//
|
|
79
|
-
// maxOutputTokens ceiling
|
|
74
|
+
// Note: this applies to every numeric-budget "enabled" config, including the
|
|
75
|
+
// compatibility fallback for Claude models that do not support adaptive
|
|
76
|
+
// thinking. Anthropic's `type: "adaptive"` config (used by the
|
|
77
|
+
// reasoningEffort -> output_config.effort mapping for supported models) has
|
|
78
|
+
// NO budget_tokens field at all per the SDK types, so there is nothing to
|
|
79
|
+
// clamp there — those callers rely on the raised maxOutputTokens ceiling.
|
|
80
80
|
// ---------------------------------------------------------------------------
|
|
81
81
|
|
|
82
82
|
/** Anthropic's documented minimum extended-thinking budget. */
|