@agent-native/core 0.221.0-same-host-mcp-20261027-20261027081850 → 0.221.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/dist/a2a/server.js +4 -4
- package/dist/a2a/task-lifecycle.d.ts +12 -12
- package/dist/a2a/task-lifecycle.js +10 -12
- package/dist/a2a/task-store.js +81 -228
- package/dist/action-caller.d.ts +3 -0
- package/dist/action-caller.js +8 -0
- package/dist/action.d.ts +1 -0
- package/dist/agent/engine/ai-sdk-engine.js +3 -3
- package/dist/agent/engine/anthropic-engine.js +3 -3
- package/dist/agent/engine/credential-owner.d.ts +3 -0
- package/dist/agent/engine/credential-owner.js +9 -0
- package/dist/agent/engine/registry.js +28 -2
- package/dist/agent/harness/acp-adapter.d.ts +1 -0
- package/dist/agent/harness/acp-adapter.js +36 -5
- package/dist/agent/harness/background.d.ts +5 -1
- package/dist/agent/harness/background.js +4 -3
- package/dist/agent/harness/lifecycle.d.ts +2 -0
- package/dist/agent/harness/lifecycle.js +452 -84
- package/dist/agent/harness/run-policy.d.ts +5 -0
- package/dist/agent/harness/run-policy.js +70 -0
- package/dist/agent/harness/runner.js +89 -73
- package/dist/agent/harness/store.d.ts +10 -1
- package/dist/agent/harness/store.js +91 -12
- package/dist/agent/harness/turn-driver.d.ts +12 -0
- package/dist/agent/harness/turn-driver.js +42 -0
- package/dist/agent/harness/types.d.ts +11 -0
- package/dist/agent/production-agent.d.ts +9 -0
- package/dist/agent/production-agent.js +153 -41
- package/dist/agent/run-manager.d.ts +4 -0
- package/dist/agent/run-manager.js +23 -7
- package/dist/agent/run-store.d.ts +3 -1
- package/dist/agent/run-store.fencing.native-harness.fixture.test.support.js +34 -0
- package/dist/agent/run-store.fencing.worker.test.support.d.ts +1 -0
- package/dist/agent/{run-store.fencing.worker.js → run-store.fencing.worker.test.support.js} +337 -4
- package/dist/agent/run-store.js +89 -17
- package/dist/app-config/clips.d.ts +10 -0
- package/dist/app-config/clips.js +24 -0
- package/dist/app-config/index.d.ts +1 -1
- package/dist/app-config/index.js +1 -1
- package/dist/app-config/schema.d.ts +1 -0
- package/dist/appearance/actions/set-theme-family.js +16 -2
- package/dist/appearance/theme-family.d.ts +11 -1
- package/dist/appearance/theme-family.js +21 -2
- package/dist/automations/outside-origin.d.ts +13 -0
- package/dist/automations/outside-origin.js +23 -0
- package/dist/automations/service.d.ts +4 -2
- package/dist/automations/service.js +11 -8
- package/dist/cli/code-agent-executor.js +5 -16
- package/dist/cli/create.d.ts +11 -2
- package/dist/cli/create.js +121 -32
- package/dist/cli/skills-content/turn-into-app-skill.d.ts +4 -3
- package/dist/cli/skills-content/turn-into-app-skill.js +143 -36
- package/dist/cli/skills.d.ts +3 -0
- package/dist/cli/skills.js +4 -1
- package/dist/cli/template-sync.js +4 -4
- package/dist/cli/upgrade.d.ts +1 -0
- package/dist/cli/upgrade.js +207 -2
- package/dist/client/chat/agentkit-agent-native.js +23 -3
- package/dist/client/mcp-approval.d.ts +53 -0
- package/dist/client/mcp-approval.js +81 -0
- package/dist/client/onboarding/use-onboarding.js +6 -4
- package/dist/client/resources/mcp-integration-catalog.js +19 -0
- package/dist/client/theme-family.d.ts +2 -1
- package/dist/client/theme-family.js +271 -32
- package/dist/client/theme.js +3 -2
- package/dist/code-agents/background-controller.js +1 -13
- package/dist/code-agents/prompt-attachments.d.ts +11 -0
- package/dist/code-agents/prompt-attachments.js +103 -6
- package/dist/collab/awareness-store.d.ts +8 -0
- package/dist/collab/awareness-store.js +9 -1
- package/dist/collab/index.d.ts +1 -1
- package/dist/collab/index.js +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/collab/struct-routes.d.ts +1 -1
- package/dist/config.d.ts +13 -3
- package/dist/config.js +64 -1
- package/dist/db/client.d.ts +8 -6
- package/dist/db/client.js +56 -17
- package/dist/db/create-get-db.js +6 -1
- package/dist/db/index.d.ts +2 -1
- package/dist/db/index.js +1 -0
- package/dist/db/schema-snapshot.generated.js +9 -2
- package/dist/db/sql.d.ts +28 -0
- package/dist/db/sql.js +186 -0
- package/dist/decisions/actions/decide.d.ts +4 -0
- package/dist/decisions/actions/decide.js +7 -0
- package/dist/decisions/decide.d.ts +1 -0
- package/dist/decisions/decide.js +21 -9
- package/dist/decisions/index.d.ts +4 -1
- package/dist/decisions/index.js +3 -0
- package/dist/decisions/response.d.ts +1 -0
- package/dist/decisions/response.js +36 -11
- package/dist/decisions/types.d.ts +5 -0
- package/dist/decisions/validation.js +6 -3
- package/dist/deploy/build.js +11 -5
- package/dist/file-upload/actions/upload-image.d.ts +2 -2
- package/dist/file-upload/attachment-text.d.ts +71 -0
- package/dist/file-upload/attachment-text.js +209 -0
- package/dist/file-upload/downscale-inline-image.d.ts +4 -0
- package/dist/file-upload/downscale-inline-image.js +27 -0
- package/dist/file-upload/inline-attachment-limits.d.ts +4 -0
- package/dist/file-upload/inline-attachment-limits.js +20 -1
- package/dist/file-upload/owned-attachment.d.ts +13 -1
- package/dist/file-upload/owned-attachment.js +52 -15
- package/dist/file-upload/pre-upload-attachments.js +74 -12
- package/dist/file-upload/registry.d.ts +1 -0
- package/dist/file-upload/registry.js +15 -7
- package/dist/file-upload/status.d.ts +19 -0
- package/dist/file-upload/status.js +49 -0
- package/dist/file-upload/thread-image-history.js +10 -2
- package/dist/index.browser.d.ts +1 -0
- package/dist/index.browser.js +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/ingestion/media.js +11 -5
- package/dist/jobs/actions/run-automation-now.js +2 -2
- package/dist/jobs/background-automation-runner.js +4 -4
- package/dist/jobs/frontmatter.d.ts +1 -1
- package/dist/jobs/frontmatter.js +5 -2
- package/dist/jobs/run-now.d.ts +2 -0
- package/dist/jobs/run-now.js +1 -1
- package/dist/jobs/scheduler.d.ts +2 -0
- package/dist/jobs/scheduler.js +1 -1
- package/dist/localization/automation-outcome-messages.js +22 -22
- package/dist/localization/core-messages/supplemental/ar-SA.js +1 -0
- package/dist/localization/core-messages/supplemental/de-DE.js +1 -0
- package/dist/localization/core-messages/supplemental/en-US.js +1 -0
- package/dist/localization/core-messages/supplemental/es-ES.js +1 -0
- package/dist/localization/core-messages/supplemental/fr-FR.js +1 -0
- package/dist/localization/core-messages/supplemental/hi-IN.js +1 -0
- package/dist/localization/core-messages/supplemental/ja-JP.js +1 -0
- package/dist/localization/core-messages/supplemental/ko-KR.js +1 -0
- package/dist/localization/core-messages/supplemental/pt-BR.js +1 -0
- package/dist/localization/core-messages/supplemental/zh-CN.js +1 -0
- package/dist/localization/core-messages/supplemental/zh-TW.js +1 -0
- package/dist/localization/mcp-approval-messages.d.ts +7 -1
- package/dist/localization/mcp-approval-messages.js +66 -0
- package/dist/localization/mcp-settings-messages.d.ts +1 -0
- package/dist/mcp/action-eligibility.d.ts +1 -0
- package/dist/mcp/action-eligibility.js +10 -5
- package/dist/mcp/analytics.d.ts +2 -0
- package/dist/mcp/analytics.js +10 -2
- package/dist/mcp/approval-route.d.ts +7 -0
- package/dist/mcp/approval-route.js +41 -16
- package/dist/mcp/approval-summary.d.ts +12 -2
- package/dist/mcp/approval-summary.js +128 -23
- package/dist/mcp/approval-time.d.ts +13 -3
- package/dist/mcp/approval-time.js +49 -5
- package/dist/mcp/build-server.d.ts +12 -1
- package/dist/mcp/build-server.js +157 -155
- package/dist/mcp/builtin-tools.d.ts +1 -0
- package/dist/mcp/builtin-tools.js +30 -14
- package/dist/mcp/direct-action-call.js +72 -27
- package/dist/mcp/embed-app.js +11 -6
- package/dist/mcp/embed-redaction.d.ts +10 -13
- package/dist/mcp/embed-redaction.js +227 -40
- package/dist/mcp/execute-action-call.d.ts +3 -2
- package/dist/mcp/execute-action-call.js +1 -4
- package/dist/mcp/framework-tools.d.ts +2 -2
- package/dist/mcp/oauth-route.js +102 -6
- package/dist/mcp/screen-memory-stdio.d.ts +3 -3
- package/dist/mcp/server.js +6 -0
- package/dist/mcp-client/oauth-routes.js +12 -2
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/observability/failure-context.js +1 -0
- package/dist/observability/traces.js +11 -1
- package/dist/onboarding/first-run-builder-credits-experiment.d.ts +12 -0
- package/dist/onboarding/first-run-builder-credits-experiment.js +91 -0
- package/dist/org/index.d.ts +1 -1
- package/dist/provider-api/actions/custom-provider-registration.d.ts +11 -11
- package/dist/provider-api/actions/provider-api.d.ts +12 -12
- package/dist/server/action-approval.d.ts +2 -2
- package/dist/server/action-approval.js +17 -10
- package/dist/server/action-discovery.js +2 -122
- package/dist/server/action-routes.d.ts +0 -1
- package/dist/server/action-routes.js +138 -58
- package/dist/server/agent-chat/action-filters-a2a.d.ts +1 -0
- package/dist/server/agent-chat/action-filters-a2a.js +11 -1
- package/dist/server/agent-chat/framework-prompts.d.ts +1 -0
- package/dist/server/agent-chat/framework-prompts.js +22 -1
- package/dist/server/agent-chat/mcp-options.d.ts +7 -0
- package/dist/server/agent-chat/mcp-options.js +1 -0
- package/dist/server/agent-chat/plugin-options.d.ts +23 -0
- package/dist/server/agent-chat/prompt-resources.d.ts +4 -2
- package/dist/server/agent-chat/prompt-resources.js +78 -32
- package/dist/server/agent-chat-plugin.js +214 -125
- package/dist/server/agent-engine-api-key-route.d.ts +2 -2
- package/dist/server/agent-engine-ollama-models-route.d.ts +1 -1
- package/dist/server/agent-run-context.js +4 -0
- package/dist/server/attachment-actions.d.ts +14 -7
- package/dist/server/attachment-actions.js +310 -65
- package/dist/server/attribution.d.ts +2 -0
- package/dist/server/auth.d.ts +2 -1
- package/dist/server/auth.js +84 -17
- package/dist/server/better-auth-instance.js +46 -12
- package/dist/server/builder-api-auth.d.ts +1 -0
- package/dist/server/builder-api-auth.js +8 -0
- package/dist/server/builder-browser.d.ts +5 -1
- package/dist/server/builder-browser.js +80 -4
- package/dist/server/cli-wrapper-flags.d.ts +27 -0
- package/dist/server/cli-wrapper-flags.js +500 -0
- package/dist/server/consent-route.d.ts +3 -0
- package/dist/server/consent-route.js +29 -10
- package/dist/server/core-routes-plugin.js +72 -60
- package/dist/server/credential-provider.js +26 -11
- package/dist/server/edge.d.ts +3 -2
- package/dist/server/edge.js +3 -2
- package/dist/server/embed-request-origin.d.ts +4 -0
- package/dist/server/embed-request-origin.js +28 -0
- package/dist/server/embed-route.js +4 -2
- package/dist/server/embed-session.d.ts +16 -4
- package/dist/server/embed-session.js +253 -145
- package/dist/server/embedded.d.ts +2 -1
- package/dist/server/embedded.js +9 -5
- package/dist/server/filesystem-action-entry.d.ts +15 -1
- package/dist/server/filesystem-action-entry.js +153 -23
- package/dist/server/first-touch-route.d.ts +1 -1
- package/dist/server/google-oauth.d.ts +7 -0
- package/dist/server/google-oauth.js +33 -6
- package/dist/server/index.d.ts +11 -6
- package/dist/server/index.js +8 -3
- package/dist/server/magic-link-attribution.d.ts +2 -0
- package/dist/server/magic-link-attribution.js +8 -2
- package/dist/server/mcp-signup-attribution.d.ts +23 -0
- package/dist/server/mcp-signup-attribution.js +135 -0
- package/dist/server/prompts/framework-core.js +2 -1
- package/dist/server/prompts/shared-rules.d.ts +2 -0
- package/dist/server/prompts/shared-rules.js +2 -0
- package/dist/server/realtime-voice.d.ts +65 -2
- package/dist/server/realtime-voice.js +235 -36
- package/dist/server/release-migrations.js +37 -10
- package/dist/server/request-context.d.ts +17 -0
- package/dist/server/request-context.js +4 -0
- package/dist/server/request-origin.d.ts +4 -6
- package/dist/server/request-origin.js +26 -28
- package/dist/server/session-resolution-unavailable.d.ts +22 -0
- package/dist/server/session-resolution-unavailable.js +65 -0
- package/dist/server/short-lived-token.d.ts +10 -2
- package/dist/server/short-lived-token.js +12 -4
- package/dist/server/ui-action-capability.js +18 -4
- package/dist/shared/first-run-builder-credits-experiment.d.ts +13 -0
- package/dist/shared/first-run-builder-credits-experiment.js +22 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/shared/mcp-approval-review.d.ts +19 -0
- package/dist/shared/mcp-approval-review.js +29 -0
- package/dist/shared/reasoning-effort.d.ts +4 -0
- package/dist/shared/reasoning-effort.js +20 -0
- package/dist/sharing/access.d.ts +11 -2
- package/dist/sharing/access.js +12 -7
- package/dist/state-machine/index.d.ts +5 -8
- package/dist/state-machine/index.js +6 -2
- package/dist/templates/builder-code-starter/app/components/layout/Layout.tsx.patch +48 -18
- package/dist/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +7 -6
- package/dist/templates/builder-code-starter/template-layer.json +1 -0
- package/dist/templates/chat/.agents/skills/storing-data/SKILL.md +18 -0
- package/dist/templates/chat/app/components/chat/ChatRouteContent.tsx +18 -4
- package/dist/templates/chat/app/components/home/HomePage.tsx +28 -69
- package/dist/templates/chat/app/components/layout/Layout.tsx +46 -14
- package/dist/templates/chat/app/i18n/ar-SA.ts +0 -4
- package/dist/templates/chat/app/i18n/de-DE.ts +0 -5
- package/dist/templates/chat/app/i18n/en-US.ts +0 -4
- package/dist/templates/chat/app/i18n/es-ES.ts +0 -5
- package/dist/templates/chat/app/i18n/fr-FR.ts +0 -5
- package/dist/templates/chat/app/i18n/hi-IN.ts +0 -5
- package/dist/templates/chat/app/i18n/ja-JP.ts +0 -5
- package/dist/templates/chat/app/i18n/ko-KR.ts +0 -5
- package/dist/templates/chat/app/i18n/pt-BR.ts +0 -5
- package/dist/templates/chat/app/i18n/zh-CN.ts +0 -4
- package/dist/templates/chat/app/i18n/zh-TW.ts +0 -4
- package/dist/templates/chat/app/lib/chat-paths.ts +36 -13
- package/dist/templates/chat/package.json +1 -0
- package/dist/templates/chat/server/plugins/agent-chat.ts +2 -1
- package/dist/templates/default/.agents/skills/storing-data/SKILL.md +18 -0
- package/dist/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +123 -33
- package/dist/templates/headless/.agents/skills/storing-data/SKILL.md +18 -0
- package/dist/templates/workspace-core/.agents/skills/storing-data/SKILL.md +18 -0
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +34 -29
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +12 -5
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/review-loop.md +3 -2
- package/dist/templates/workspace-core/.agents/skills/turn-into-app/references/where-it-runs.md +93 -0
- package/dist/tracking/registry.js +25 -0
- package/dist/triggers/actions/manage-automation.js +6 -2
- package/dist/triggers/actions.js +14 -2
- package/dist/triggers/index.d.ts +1 -0
- package/dist/triggers/index.js +1 -0
- package/dist/vite/client.js +5 -4
- package/docs/content/authentication.mdx +2 -0
- package/docs/content/components.mdx +1 -1
- package/docs/content/decisions.mdx +1 -1
- package/docs/content/recurring-jobs.mdx +15 -0
- package/docs/content/template-chat-developers.mdx +1 -1
- package/docs/content/template-chat-features.mdx +4 -4
- package/docs/content/turn-into-app.mdx +18 -10
- package/package.json +6 -4
- package/src/templates/builder-code-starter/app/components/layout/Layout.tsx.patch +48 -18
- package/src/templates/builder-code-starter/server/plugins/agent-chat.ts.patch +7 -6
- package/src/templates/builder-code-starter/template-layer.json +1 -0
- package/src/templates/chat/.agents/skills/storing-data/SKILL.md +18 -0
- package/src/templates/chat/app/components/chat/ChatRouteContent.tsx +18 -4
- package/src/templates/chat/app/components/home/HomePage.tsx +28 -69
- package/src/templates/chat/app/components/layout/Layout.tsx +46 -14
- package/src/templates/chat/app/i18n/ar-SA.ts +0 -4
- package/src/templates/chat/app/i18n/de-DE.ts +0 -5
- package/src/templates/chat/app/i18n/en-US.ts +0 -4
- package/src/templates/chat/app/i18n/es-ES.ts +0 -5
- package/src/templates/chat/app/i18n/fr-FR.ts +0 -5
- package/src/templates/chat/app/i18n/hi-IN.ts +0 -5
- package/src/templates/chat/app/i18n/ja-JP.ts +0 -5
- package/src/templates/chat/app/i18n/ko-KR.ts +0 -5
- package/src/templates/chat/app/i18n/pt-BR.ts +0 -5
- package/src/templates/chat/app/i18n/zh-CN.ts +0 -4
- package/src/templates/chat/app/i18n/zh-TW.ts +0 -4
- package/src/templates/chat/app/lib/chat-paths.ts +36 -13
- package/src/templates/chat/package.json +1 -0
- package/src/templates/chat/server/plugins/agent-chat.ts +2 -1
- package/src/templates/default/.agents/skills/storing-data/SKILL.md +18 -0
- package/src/templates/factory/.agents/skills/review-latest-feedback/SKILL.md +123 -33
- package/src/templates/headless/.agents/skills/storing-data/SKILL.md +18 -0
- package/src/templates/workspace-core/.agents/skills/storing-data/SKILL.md +18 -0
- package/src/templates/workspace-core/.agents/skills/turn-into-app/SKILL.md +34 -29
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/fresh-project.md +12 -5
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/review-loop.md +3 -2
- package/src/templates/workspace-core/.agents/skills/turn-into-app/references/where-it-runs.md +93 -0
- package/dist/automations/mcp-origin.d.ts +0 -2
- package/dist/automations/mcp-origin.js +0 -10
- /package/dist/agent/{run-store.fencing.worker.d.ts → run-store.fencing.native-harness.fixture.test.support.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ssrfSafeFetch } from "../../extensions/url-safety.js";
|
|
2
2
|
import { clearProviderCredentialAuthFailure, readDeployCredentialEnv, recordProviderCredentialAuthFailure, } from "../../server/credential-provider.js";
|
|
3
|
-
import { allowsSamplingParams, anthropicManualThinkingBudget, isGPTReasoningModel, isUnsetReasoningEffort, normalizeReasoningEffortForModel, supportsClaudeAdaptiveThinking, } from "../../shared/reasoning-effort.js";
|
|
3
|
+
import { allowsSamplingParams, anthropicManualThinkingBudget, claudeAdaptiveThinking, isGPTReasoningModel, isUnsetReasoningEffort, normalizeReasoningEffortForModel, supportsClaudeAdaptiveThinking, } from "../../shared/reasoning-effort.js";
|
|
4
4
|
import { isNodeRuntime } from "../../shared/runtime.js";
|
|
5
5
|
import { AI_SDK_MODEL_CONFIG } from "../model-config.js";
|
|
6
6
|
import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, } from "./credential-errors.js";
|
|
@@ -317,7 +317,7 @@ class AISDKEngine {
|
|
|
317
317
|
if (explicitThinking || supportsClaudeAdaptiveThinking(opts.model)) {
|
|
318
318
|
providerOpts.anthropic = {
|
|
319
319
|
...(providerOpts.anthropic ?? {}),
|
|
320
|
-
thinking: explicitThinking ??
|
|
320
|
+
thinking: explicitThinking ?? claudeAdaptiveThinking(opts.model),
|
|
321
321
|
...(explicitThinking
|
|
322
322
|
? {}
|
|
323
323
|
: { outputConfig: { effort: reasoningEffort } }),
|
|
@@ -373,7 +373,7 @@ class AISDKEngine {
|
|
|
373
373
|
// the model's own default level applies.
|
|
374
374
|
providerOpts.anthropic = {
|
|
375
375
|
...providerOpts.anthropic,
|
|
376
|
-
thinking:
|
|
376
|
+
thinking: claudeAdaptiveThinking(opts.model),
|
|
377
377
|
};
|
|
378
378
|
}
|
|
379
379
|
// @ai-sdk/openai infers reasoning models from its own id prefixes, which
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { clearProviderCredentialAuthFailure, readDeployCredentialEnv, recordProviderCredentialAuthFailure, } from "../../server/credential-provider.js";
|
|
2
|
-
import { allowsSamplingParams, anthropicManualThinkingBudget, isUnsetReasoningEffort, normalizeReasoningEffortForModel, supportsClaudeAdaptiveThinking, } from "../../shared/reasoning-effort.js";
|
|
2
|
+
import { allowsSamplingParams, anthropicManualThinkingBudget, claudeAdaptiveThinking, isUnsetReasoningEffort, normalizeReasoningEffortForModel, supportsClaudeAdaptiveThinking, } from "../../shared/reasoning-effort.js";
|
|
3
3
|
import { ANTHROPIC_MODEL_CONFIG } from "../model-config.js";
|
|
4
4
|
import { LLM_MISSING_CREDENTIALS_ERROR_CODE, LLM_MISSING_CREDENTIALS_MESSAGE, } from "./credential-errors.js";
|
|
5
5
|
import { describeErrorWithCauses, isBareProviderRejectionMessage, PROVIDER_TRANSIENT_REJECTION_ERROR_CODE, } from "./error-detail.js";
|
|
@@ -63,11 +63,11 @@ class AnthropicEngine {
|
|
|
63
63
|
supportsClaudeAdaptiveThinking(opts.model)) {
|
|
64
64
|
// No effort chosen: keep adaptive thinking on and send no effort, so
|
|
65
65
|
// the model's own default level applies.
|
|
66
|
-
extra.thinking =
|
|
66
|
+
extra.thinking = claudeAdaptiveThinking(opts.model);
|
|
67
67
|
}
|
|
68
68
|
if (reasoningEffort && !extra.thinking) {
|
|
69
69
|
if (supportsClaudeAdaptiveThinking(opts.model)) {
|
|
70
|
-
extra.thinking =
|
|
70
|
+
extra.thinking = claudeAdaptiveThinking(opts.model);
|
|
71
71
|
extra.output_config = { effort: reasoningEffort };
|
|
72
72
|
}
|
|
73
73
|
else {
|
|
@@ -5,5 +5,8 @@ import type { AgentEngine } from "./types.js";
|
|
|
5
5
|
* connected (user, org, or workspace scoped).
|
|
6
6
|
*/
|
|
7
7
|
export type EngineCredentialOwner = "builder" | "deployment" | "customer";
|
|
8
|
+
export type EngineLlmConnectionSource = "app_secrets" | "settings" | "env";
|
|
8
9
|
export declare function tagEngineCredentialOwner(engine: AgentEngine, owner: EngineCredentialOwner | undefined): void;
|
|
10
|
+
export declare function tagEngineLlmConnectionSource(engine: AgentEngine, source: EngineLlmConnectionSource | undefined): void;
|
|
9
11
|
export declare function getEngineCredentialOwner(engine: unknown): EngineCredentialOwner | undefined;
|
|
12
|
+
export declare function getEngineLlmConnectionSource(engine: unknown): EngineLlmConnectionSource | undefined;
|
|
@@ -1,7 +1,16 @@
|
|
|
1
1
|
const owners = new WeakMap();
|
|
2
|
+
const llmConnectionSources = new WeakMap();
|
|
2
3
|
export function tagEngineCredentialOwner(engine, owner) {
|
|
3
4
|
owners.set(engine, owner);
|
|
4
5
|
}
|
|
6
|
+
export function tagEngineLlmConnectionSource(engine, source) {
|
|
7
|
+
llmConnectionSources.set(engine, source);
|
|
8
|
+
}
|
|
5
9
|
export function getEngineCredentialOwner(engine) {
|
|
6
10
|
return engine && typeof engine === "object" ? owners.get(engine) : undefined;
|
|
7
11
|
}
|
|
12
|
+
export function getEngineLlmConnectionSource(engine) {
|
|
13
|
+
return engine && typeof engine === "object"
|
|
14
|
+
? llmConnectionSources.get(engine)
|
|
15
|
+
: undefined;
|
|
16
|
+
}
|
|
@@ -12,7 +12,7 @@ import { CHATGPT_SUBSCRIPTION_ENGINE_NAME } from "../chatgpt-subscription-contra
|
|
|
12
12
|
import { readDefaultAgentEngineSetting } from "../default-agent-engine.js";
|
|
13
13
|
import { normalizeModelForEngine } from "../model-version.js";
|
|
14
14
|
import { createProviderEndpointFetch } from "./ai-sdk-engine.js";
|
|
15
|
-
import { tagEngineCredentialOwner, } from "./credential-owner.js";
|
|
15
|
+
import { tagEngineCredentialOwner, tagEngineLlmConnectionSource, } from "./credential-owner.js";
|
|
16
16
|
import { AI_SDK_ANTHROPIC_DEFAULT_BASE_URL, OLLAMA_DEFAULT_BASE_URL, OLLAMA_BASE_URL_ENV_VAR, OPENAI_BASE_URL_ENV_VAR, OPENAI_DEFAULT_BASE_URL, isCustomOpenAiBaseUrl, } from "./openai-compatible-endpoint.js";
|
|
17
17
|
import { isLocalNetworkOllamaEndpoint, validateProviderBaseUrl, } from "./provider-endpoint-validation.js";
|
|
18
18
|
const require = createRequire(import.meta.url);
|
|
@@ -607,6 +607,7 @@ async function resolveUsableProviderSecretDetailed(key) {
|
|
|
607
607
|
value,
|
|
608
608
|
provenance: {
|
|
609
609
|
scope: source === "env" ? "deployment" : (source ?? "deployment"),
|
|
610
|
+
source: source === "env" ? "env" : "app_secrets",
|
|
610
611
|
...(resolved.scopeId ? { scopeId: resolved.scopeId } : {}),
|
|
611
612
|
},
|
|
612
613
|
};
|
|
@@ -687,13 +688,30 @@ export function credentialOwnerForEntry(entry, apiKey, provenance, config) {
|
|
|
687
688
|
return provenance.scope === "deployment" ? "deployment" : "customer";
|
|
688
689
|
}
|
|
689
690
|
async function createEngineForEntry(...args) {
|
|
690
|
-
const { config, credentialOwner } = await engineCreateConfigForEntry(...args);
|
|
691
|
+
const { config, credentialOwner, connectionSource } = await engineCreateConfigForEntry(...args);
|
|
691
692
|
const engine = args[0].create(config);
|
|
692
693
|
tagEngineCredentialOwner(engine, credentialOwner);
|
|
694
|
+
tagEngineLlmConnectionSource(engine, connectionSource);
|
|
693
695
|
return engine;
|
|
694
696
|
}
|
|
697
|
+
function connectionSourceForProvenance(provenance) {
|
|
698
|
+
if (provenance?.source === "app_secrets" ||
|
|
699
|
+
provenance?.source === "settings" ||
|
|
700
|
+
provenance?.source === "env") {
|
|
701
|
+
return provenance.source;
|
|
702
|
+
}
|
|
703
|
+
if (provenance?.scope === "deployment")
|
|
704
|
+
return "env";
|
|
705
|
+
if (provenance?.scope === "user" ||
|
|
706
|
+
provenance?.scope === "org" ||
|
|
707
|
+
provenance?.scope === "workspace") {
|
|
708
|
+
return "app_secrets";
|
|
709
|
+
}
|
|
710
|
+
return undefined;
|
|
711
|
+
}
|
|
695
712
|
async function engineCreateConfigForEntry(entry, apiKey, extra, credentialResolution = "explicit", apiKeyEnvVar, credentialIdentity, apiKeyProvenance) {
|
|
696
713
|
const safeExtra = { ...(extra ?? {}) };
|
|
714
|
+
let connectionSource = connectionSourceForProvenance(apiKeyProvenance);
|
|
697
715
|
if (entry.name === CHATGPT_SUBSCRIPTION_ENGINE_NAME) {
|
|
698
716
|
const email = identityUserEmail(credentialIdentity);
|
|
699
717
|
if (!email ||
|
|
@@ -756,6 +774,7 @@ async function engineCreateConfigForEntry(entry, apiKey, extra, credentialResolu
|
|
|
756
774
|
matchingApiKeyProvenance ??= resolvedMatchingCredential?.provenance;
|
|
757
775
|
}
|
|
758
776
|
}
|
|
777
|
+
connectionSource ??= connectionSourceForProvenance(matchingApiKeyProvenance);
|
|
759
778
|
const aiSdkProvider = entry.name.startsWith("ai-sdk:")
|
|
760
779
|
? entry.name.slice("ai-sdk:".length)
|
|
761
780
|
: undefined;
|
|
@@ -837,11 +856,18 @@ async function engineCreateConfigForEntry(entry, apiKey, extra, credentialResolu
|
|
|
837
856
|
lane: creds.lane,
|
|
838
857
|
};
|
|
839
858
|
}
|
|
859
|
+
connectionSource =
|
|
860
|
+
creds.source === "env" ? "env" : creds.source ? "app_secrets" : undefined;
|
|
840
861
|
}
|
|
841
862
|
const config = engineCreateConfig(entry, matchingApiKey, safeExtra);
|
|
842
863
|
return {
|
|
843
864
|
config,
|
|
844
865
|
credentialOwner: credentialOwnerForEntry(entry, matchingApiKey, matchingApiKeyProvenance, config),
|
|
866
|
+
connectionSource: connectionSource ??
|
|
867
|
+
(matchingApiKey === undefined &&
|
|
868
|
+
entry.requiredEnvVars.some((key) => canUseDeployCredentialFallbackForRequest(key))
|
|
869
|
+
? "env"
|
|
870
|
+
: undefined),
|
|
845
871
|
};
|
|
846
872
|
}
|
|
847
873
|
export function isStoredEngineUsable(stored, entry) {
|
|
@@ -58,6 +58,7 @@ export declare function acpAutoPermissionDecision(kind: string | undefined, mode
|
|
|
58
58
|
*/
|
|
59
59
|
export declare function selectAcpPermissionOption(options: AcpPermissionOption[], approved: boolean): string | undefined;
|
|
60
60
|
export declare function resolveAcpWorkspacePath(cwd: string, requestedPath: string): string;
|
|
61
|
+
export declare function resolveAcpResumeCwd(checkpointCwd: unknown, fallbackCwd: string): Promise<string>;
|
|
61
62
|
interface AcpContentBlock {
|
|
62
63
|
type: string;
|
|
63
64
|
text?: string;
|
|
@@ -141,7 +141,10 @@ class AcpHarnessSession {
|
|
|
141
141
|
});
|
|
142
142
|
this.supportsLoad = Boolean(initResponse?.agentCapabilities?.loadSession);
|
|
143
143
|
const resume = opts.resumeState;
|
|
144
|
-
if (resume?.sessionId
|
|
144
|
+
if (typeof resume?.sessionId === "string" &&
|
|
145
|
+
resume.sessionId.length > 0 &&
|
|
146
|
+
this.supportsLoad) {
|
|
147
|
+
this.cwd = await resolveAcpResumeCwd(resume.cwd, this.cwd);
|
|
145
148
|
try {
|
|
146
149
|
await this.connection.loadSession({
|
|
147
150
|
sessionId: resume.sessionId,
|
|
@@ -203,15 +206,23 @@ class AcpHarnessSession {
|
|
|
203
206
|
});
|
|
204
207
|
yield* queue;
|
|
205
208
|
}
|
|
206
|
-
|
|
209
|
+
approve(approval) {
|
|
207
210
|
const pending = this.pendingPermissions.get(approval.id);
|
|
208
|
-
if (!pending)
|
|
209
|
-
|
|
211
|
+
if (!pending) {
|
|
212
|
+
throw new Error(`[acp-harness] Approval ${approval.id} is not pending in this process.`);
|
|
213
|
+
}
|
|
210
214
|
this.pendingPermissions.delete(approval.id);
|
|
211
215
|
pending.resolve(buildAcpPermissionResponse(pending.options, approval.approved));
|
|
216
|
+
return Promise.resolve();
|
|
217
|
+
}
|
|
218
|
+
canResolveApproval(approval) {
|
|
219
|
+
return this.pendingPermissions.has(approval.id);
|
|
220
|
+
}
|
|
221
|
+
async checkpoint() {
|
|
222
|
+
return { sessionId: this.acpSessionId, cwd: this.cwd };
|
|
212
223
|
}
|
|
213
224
|
async detach() {
|
|
214
|
-
const state =
|
|
225
|
+
const state = await this.checkpoint();
|
|
215
226
|
await this.destroy();
|
|
216
227
|
return state;
|
|
217
228
|
}
|
|
@@ -547,6 +558,26 @@ export function resolveAcpWorkspacePath(cwd, requestedPath) {
|
|
|
547
558
|
}
|
|
548
559
|
return abs;
|
|
549
560
|
}
|
|
561
|
+
export async function resolveAcpResumeCwd(checkpointCwd, fallbackCwd) {
|
|
562
|
+
if (checkpointCwd === undefined || checkpointCwd === null) {
|
|
563
|
+
return path.resolve(fallbackCwd);
|
|
564
|
+
}
|
|
565
|
+
if (typeof checkpointCwd !== "string" || !path.isAbsolute(checkpointCwd)) {
|
|
566
|
+
throw new Error("[acp-harness] Checkpoint working directory must be an absolute path.");
|
|
567
|
+
}
|
|
568
|
+
const cwd = path.resolve(checkpointCwd);
|
|
569
|
+
let stats;
|
|
570
|
+
try {
|
|
571
|
+
stats = await fs.stat(cwd);
|
|
572
|
+
}
|
|
573
|
+
catch (error) {
|
|
574
|
+
throw new Error(`[acp-harness] Checkpoint working directory is not accessible: ${cwd}`, { cause: error });
|
|
575
|
+
}
|
|
576
|
+
if (!stats.isDirectory()) {
|
|
577
|
+
throw new Error(`[acp-harness] Checkpoint working directory is not a directory: ${cwd}`);
|
|
578
|
+
}
|
|
579
|
+
return cwd;
|
|
580
|
+
}
|
|
550
581
|
function sliceTextFile(content, line, limit) {
|
|
551
582
|
if (line == null && limit == null)
|
|
552
583
|
return content;
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import type { BackgroundAgentControlResult, BackgroundAgentController } from "../../code-agents/background-controller.js";
|
|
2
2
|
import type { BackgroundAgentRun, BackgroundAgentTranscriptEvent, ListBackgroundAgentRunsOptions } from "../../code-agents/background-run.js";
|
|
3
|
+
import type { ActiveRun } from "../run-manager.js";
|
|
3
4
|
import { type AgentHarnessOwnerScope } from "./lifecycle.js";
|
|
4
|
-
export declare function createAgentHarnessBackgroundAgentController(scope?: AgentHarnessOwnerScope
|
|
5
|
+
export declare function createAgentHarnessBackgroundAgentController(scope?: AgentHarnessOwnerScope, options?: {
|
|
6
|
+
/** Hosts use this to project child output and drain queued thread work. */
|
|
7
|
+
onRunComplete?: (run: ActiveRun) => void | Promise<void>;
|
|
8
|
+
}): BackgroundAgentController;
|
|
5
9
|
export declare const agentHarnessBackgroundAgentController: BackgroundAgentController;
|
|
6
10
|
export declare function listAgentHarnessBackgroundRuns(options?: ListBackgroundAgentRunsOptions & {
|
|
7
11
|
orgId?: string | null;
|
|
@@ -3,7 +3,7 @@ import { abortRunDurably } from "../run-manager.js";
|
|
|
3
3
|
import { getRunEventsSince } from "../run-store.js";
|
|
4
4
|
import { resolveAgentHarnessApproval, sendAgentHarnessFollowUp, stopAndPersistAgentHarnessSession, } from "./lifecycle.js";
|
|
5
5
|
import { getAgentHarnessSessionByRunId, listAgentHarnessSessionEvents, listAgentHarnessSessions, } from "./store.js";
|
|
6
|
-
export function createAgentHarnessBackgroundAgentController(scope = { ownerEmail: null }) {
|
|
6
|
+
export function createAgentHarnessBackgroundAgentController(scope = { ownerEmail: null }, options = {}) {
|
|
7
7
|
return {
|
|
8
8
|
list: (options) => listAgentHarnessBackgroundRuns({
|
|
9
9
|
...options,
|
|
@@ -12,7 +12,7 @@ export function createAgentHarnessBackgroundAgentController(scope = { ownerEmail
|
|
|
12
12
|
}),
|
|
13
13
|
get: (runId) => getAgentHarnessBackgroundRun(runId, scope),
|
|
14
14
|
transcript: (runId) => listAgentHarnessBackgroundTranscriptEvents(runId, scope),
|
|
15
|
-
sendFollowUp: (input) => sendAgentHarnessBackgroundFollowUp(input, scope),
|
|
15
|
+
sendFollowUp: (input) => sendAgentHarnessBackgroundFollowUp(input, scope, options.onRunComplete),
|
|
16
16
|
control: (input) => controlAgentHarnessBackgroundRun(input, scope),
|
|
17
17
|
};
|
|
18
18
|
}
|
|
@@ -341,12 +341,13 @@ function backgroundStatus(status, needsApproval) {
|
|
|
341
341
|
return "completed";
|
|
342
342
|
return "unknown";
|
|
343
343
|
}
|
|
344
|
-
async function sendAgentHarnessBackgroundFollowUp(input, scope) {
|
|
344
|
+
async function sendAgentHarnessBackgroundFollowUp(input, scope, onRunComplete) {
|
|
345
345
|
const result = await sendAgentHarnessFollowUp({
|
|
346
346
|
runId: input.runId,
|
|
347
347
|
prompt: input.prompt,
|
|
348
348
|
metadata: input.metadata,
|
|
349
349
|
scope,
|
|
350
|
+
onRunComplete,
|
|
350
351
|
});
|
|
351
352
|
const run = await getAgentHarnessBackgroundRun(input.runId, scope);
|
|
352
353
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ActiveRun } from "../run-manager.js";
|
|
1
2
|
import { type StoredAgentHarnessSession } from "./store.js";
|
|
2
3
|
import type { AgentHarnessAdapter, AgentHarnessApproval, AgentHarnessCreateSessionOptions, AgentHarnessEvent, AgentHarnessSession } from "./types.js";
|
|
3
4
|
export type AgentHarnessLifecycleErrorCode = "not_found" | "owner_mismatch" | "approval_mismatch" | "unavailable" | "invalid_input";
|
|
@@ -39,6 +40,7 @@ export declare function sendAgentHarnessFollowUp(input: {
|
|
|
39
40
|
scope: AgentHarnessOwnerScope;
|
|
40
41
|
metadata?: Record<string, unknown>;
|
|
41
42
|
onHarnessEvent?: (event: AgentHarnessEvent) => void | Promise<void>;
|
|
43
|
+
onRunComplete?: (run: ActiveRun) => void | Promise<void>;
|
|
42
44
|
}): Promise<AgentHarnessLifecycleResult>;
|
|
43
45
|
export declare function stopLiveAgentHarnessSession(input: {
|
|
44
46
|
sessionId: string;
|