mixdog 1.4.2 → 1.4.4
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/package.json +2 -2
- package/scripts/build-shipped-history.mjs +15 -5
- package/scripts/gate-local.mjs +65 -19
- package/scripts/graph-parity.mjs +8 -3
- package/scripts/lib/gate-scheduler.mjs +2 -1
- package/scripts/lib/run-node-tests.mjs +17 -5
- package/scripts/lib/test-failure-summary.mjs +1 -8
- package/scripts/lib/test-spawn-ledger.mjs +33 -2
- package/scripts/post-release-check.mjs +26 -16
- package/scripts/provider-pingpong-live.mjs +1 -1
- package/scripts/prune-embedding-runtime.mjs +3 -1
- package/scripts/release-paths.mjs +7 -1
- package/src/defaults/shipped-history.json +24 -0
- package/src/defaults/skills/computer-use/SKILL.md +14 -3
- package/src/defaults/skills/memory-management/SKILL.md +10 -5
- package/src/defaults/skills/setup/SKILL.md +2 -2
- package/src/defaults/skills/setup/references/actions.md +17 -4
- package/src/defaults/skills/setup/references/surfaces.md +3 -0
- package/src/defaults/skills/setup-guide/SKILL.md +6 -1
- package/src/lib/instruction-text.cjs +36 -0
- package/src/lib/rules-builder.cjs +34 -20
- package/src/orchestration/balanced.md +23 -0
- package/src/orchestration/focused.md +22 -0
- package/src/orchestration/none.md +5 -0
- package/src/orchestration/swarm.md +24 -0
- package/src/rules/agent-mode/AGENT_MODE.md +3 -1
- package/src/rules/agent-mode/MIXY.md +5 -3
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/session-prep.mjs +3 -3
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +0 -1
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +4 -2
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +0 -9
- package/src/runtime/agent/orchestrator/agent-runtime/heartbeat-completion.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-runtime/session-builder.mjs +67 -0
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +1 -0
- package/src/runtime/agent/orchestrator/context/role-instructions.mjs +4 -4
- package/src/runtime/agent/orchestrator/mcp/agent-connectors.mjs +3 -1
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +199 -46
- package/src/runtime/agent/orchestrator/mcp/client-config.mjs +3 -5
- package/src/runtime/agent/orchestrator/mcp/client-transport.mjs +9 -3
- package/src/runtime/agent/orchestrator/mcp/client.mjs +3 -5
- package/src/runtime/agent/orchestrator/mcp/oauth-client.mjs +1 -1
- package/src/runtime/agent/orchestrator/mcp/oauth-credentials.mjs +8 -2
- package/src/runtime/agent/orchestrator/mcp/oauth-probe.mjs +1 -1
- package/src/runtime/agent/orchestrator/mcp/oauth-provider.mjs +14 -0
- package/src/runtime/agent/orchestrator/mcp/oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +11 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-start.mjs +4 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-stop.mjs +3 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-outcome.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/custom-provider-config.mjs +121 -9
- package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/gemini-thinking.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/lib/generation-window.mjs +9 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +9 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-result.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +5 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-options.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-response-normalization.mjs +6 -6
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses-head-parity.json +2784 -2872
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +10 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +5 -8
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-outcome.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/openai-responses-payload-parity.fixture.json +288 -300
- package/src/runtime/agent/orchestrator/providers/openai-ws-response-state.mjs +9 -2
- package/src/runtime/agent/orchestrator/providers/openrouter-provider-routing.mjs +28 -0
- package/src/runtime/agent/orchestrator/providers/openrouter.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/registry.mjs +30 -25
- package/src/runtime/agent/orchestrator/providers/vertex-ai.mjs +10 -1
- package/src/runtime/agent/orchestrator/providers/xai-tool-search-head-parity.json +10 -30
- package/src/runtime/agent/orchestrator/runtime-core/ask-user-result.mjs +66 -0
- package/src/runtime/agent/orchestrator/runtime-core/builtin-features.mjs +30 -0
- package/src/runtime/agent/orchestrator/runtime-core/config-helpers.mjs +0 -11
- package/src/runtime/agent/orchestrator/runtime-core/deferred-tool-availability.mjs +8 -0
- package/src/runtime/agent/orchestrator/runtime-core/deferred-tool-delta.mjs +17 -3
- package/src/runtime/agent/orchestrator/runtime-core/goal-control.mjs +47 -27
- package/src/runtime/agent/orchestrator/runtime-core/goal-deadlines.mjs +141 -10
- package/src/runtime/agent/orchestrator/runtime-core/goal-mutations.mjs +26 -63
- package/src/runtime/agent/orchestrator/runtime-core/goal-reminder.mjs +28 -3
- package/src/runtime/agent/orchestrator/runtime-core/goal-runtime.mjs +36 -11
- package/src/runtime/agent/orchestrator/runtime-core/goal-state.mjs +88 -56
- package/src/runtime/agent/orchestrator/runtime-core/goal-storage.mjs +4 -1
- package/src/runtime/agent/orchestrator/runtime-core/goal-store.mjs +51 -32
- package/src/runtime/agent/orchestrator/runtime-core/goal-text.mjs +45 -145
- package/src/runtime/agent/orchestrator/runtime-core/goal-tool-defs.mjs +15 -98
- package/src/runtime/agent/orchestrator/runtime-core/goal-tool-exec.mjs +32 -99
- package/src/runtime/agent/orchestrator/runtime-core/goal-turns.mjs +23 -78
- package/src/runtime/agent/orchestrator/runtime-core/orchestration.mjs +69 -48
- package/src/runtime/agent/orchestrator/runtime-core/todo-list.mjs +367 -0
- package/src/runtime/agent/orchestrator/runtime-core/todo-tool-defs.mjs +47 -0
- package/src/runtime/agent/orchestrator/runtime-core/tool-availability.mjs +155 -0
- package/src/runtime/agent/orchestrator/runtime-core/tool-catalog-data.mjs +9 -0
- package/src/runtime/agent/orchestrator/runtime-core/tool-catalog.mjs +119 -35
- package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +1 -1
- package/src/runtime/agent/orchestrator/runtime-core/workflow/context.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/agent-loop.mjs +28 -22
- package/src/runtime/agent/orchestrator/session/agent-pool-progress.mjs +30 -0
- package/src/runtime/agent/orchestrator/session/attachment-preflight.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache-warm.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/catalog-db/index.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/catalog-db/schema.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/compact/summary-route.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +8 -12
- package/src/runtime/agent/orchestrator/session/conversation-import/claude.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/conversation-import/codex.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/conversation-import/convert.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/conversation-import/imported-session.mjs +7 -3
- package/src/runtime/agent/orchestrator/session/human-gate/held-message.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/human-gate/requests.mjs +1 -2
- package/src/runtime/agent/orchestrator/session/human-gate/run-policy.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/image-strip-recovery.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/completion-guards.mjs +11 -1
- package/src/runtime/agent/orchestrator/session/loop/context-overflow.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/loop-state.mjs +8 -1
- package/src/runtime/agent/orchestrator/session/loop/no-tool-turn/todo-check.mjs +196 -0
- package/src/runtime/agent/orchestrator/session/loop/no-tool-turn.mjs +116 -50
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +8 -1
- package/src/runtime/agent/orchestrator/session/loop/provider-tool-exclusions.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/route-fallback.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/loop/stored-tool-args.mjs +5 -6
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/before-hook.mjs +6 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/dispatch.mjs +16 -2
- package/src/runtime/agent/orchestrator/session/loop/turn-report.mjs +35 -0
- package/src/runtime/agent/orchestrator/session/loop/usage.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +57 -26
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-auto-effort.mjs +9 -7
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-execute.mjs +21 -3
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-failure.mjs +27 -11
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-open.mjs +37 -34
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-prepare.mjs +15 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +25 -15
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-state.mjs +79 -24
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-steering-drain.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +12 -1
- package/src/runtime/agent/orchestrator/session/manager/context-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/idle-cleanup.mjs +6 -1
- package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +9 -1
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-path.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/manager/pending-spool-shard.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/prompt-settings.mjs +598 -0
- package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +19 -0
- package/src/runtime/agent/orchestrator/session/manager/rules-cache.mjs +19 -10
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +8 -1
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +5 -0
- package/src/runtime/agent/orchestrator/session/manager/session-fallback-title.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +31 -0
- package/src/runtime/agent/orchestrator/session/manager/session-lock.mjs +31 -0
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +42 -6
- package/src/runtime/agent/orchestrator/session/manager/session-record.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +11 -1
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-context.mjs +8 -9
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +339 -88
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-recovery.mjs +135 -11
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +377 -104
- package/src/runtime/agent/orchestrator/session/manager/turn-durability.mjs +144 -0
- package/src/runtime/agent/orchestrator/session/manager/turn-interruption.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +4 -0
- package/src/runtime/agent/orchestrator/session/manager.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/mixy-name.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +8 -1
- package/src/runtime/agent/orchestrator/session/save-session-worker.mjs +5 -1
- package/src/runtime/agent/orchestrator/session/store/canonical-reader.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store/liveness-veto.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +23 -2
- package/src/runtime/agent/orchestrator/session/store/sweep/sub-agent-retention.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/store/transcript-durability.mjs +88 -0
- package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +5 -0
- package/src/runtime/agent/orchestrator/session/store-summary-log.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +14 -5
- package/src/runtime/agent/orchestrator/session/store-transcript-worker.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/store.mjs +17 -6
- package/src/runtime/agent/orchestrator/session/synthetic-user-envelope.mjs +7 -1
- package/src/runtime/agent/orchestrator/session/tail-reminder-rules.mjs +9 -1
- package/src/runtime/agent/orchestrator/session/transcript-restore/agent-envelope.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/transcript-restore/restore.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/transcript-restore/user-text.mjs +2 -2
- package/src/runtime/agent/orchestrator/stall-policy.mjs +3 -5
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/backgrounded-result.mjs +4 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/misuse-guard.mjs +21 -3
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/result-format.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/worktree-add-guard.mjs +77 -0
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +0 -1
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +7 -3
- package/src/runtime/agent/orchestrator/tools/builtin/git-worktree-tool.mjs +27 -9
- package/src/runtime/agent/orchestrator/tools/builtin/lib/search-input-helpers.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-output-silence.mjs +64 -0
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +20 -6
- package/src/runtime/agent/orchestrator/tools/builtin/read-range-index.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-fast-paths.mjs +0 -1
- package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +0 -10
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +1 -2
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +12 -1
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +1 -24
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary/child-kill.mjs +4 -3
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary.mjs +1 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/modes/calls.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/modes/symbols.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/search.mjs +4 -5
- package/src/runtime/agent/orchestrator/tools/code-graph/symbol-index.mjs +3 -4
- package/src/runtime/agent/orchestrator/tools/code-graph.mjs +4 -22
- package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +0 -4
- package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +0 -1
- package/src/runtime/attachments/attachment-reference.mjs +1 -1
- package/src/runtime/attachments/pdf-extract.mjs +1 -1
- package/src/runtime/attachments/store.d.mts +1 -0
- package/src/runtime/attachments/store.mjs +2 -2
- package/src/runtime/channels/lib/config-reload-watch.mjs +42 -0
- package/src/runtime/channels/lib/owned-runtime/config-reload.mjs +29 -9
- package/src/runtime/channels/lib/routines-db.mjs +35 -0
- package/src/runtime/channels/lib/scheduler.mjs +33 -0
- package/src/runtime/channels/lib/schedules-db.mjs +15 -4
- package/src/runtime/channels/lib/webhook/session-dispatch.mjs +4 -1
- package/src/runtime/channels/lib/webhooks-db.mjs +13 -3
- package/src/runtime/channels/lib/whisper-server.mjs +12 -12
- package/src/runtime/channels/lib/worker-main.mjs +9 -31
- package/src/runtime/computer-bridge/action-schema.mjs +2 -2
- package/src/runtime/computer-bridge/core-actions.mjs +16 -2
- package/src/runtime/computer-bridge/linux-readiness.mjs +10 -14
- package/src/runtime/computer-bridge/result-canonical.mjs +6 -0
- package/src/runtime/connectors/connector-accounts-mcp.mjs +169 -33
- package/src/runtime/connectors/gmail-app-password.mjs +2 -2
- package/src/runtime/connectors/google-mcp.mjs +1 -1
- package/src/runtime/effort-judge/judge-client.mjs +2 -2
- package/src/runtime/effort-judge/judge-input.mjs +4 -4
- package/src/runtime/explore/explorer.mjs +0 -5
- package/src/runtime/explore/tool.mjs +3 -3
- package/src/runtime/local-provider/hardware.mjs +1 -1
- package/src/runtime/media/adapters/codex-image.mjs +3 -3
- package/src/runtime/media/adapters/gemini-video.mjs +1 -1
- package/src/runtime/media/media-usage.mjs +1 -1
- package/src/runtime/media/store.mjs +1 -1
- package/src/runtime/memory/index.mjs +11 -1
- package/src/runtime/memory/lib/embedding-reindex.mjs +27 -0
- package/src/runtime/memory/lib/memory-embed.mjs +83 -14
- package/src/runtime/memory/lib/memory-process-lock.mjs +159 -36
- package/src/runtime/memory/lib/memory-text-utils.mjs +6 -1
- package/src/runtime/memory/lib/memory.mjs +17 -0
- package/src/runtime/memory/lib/pg/process.mjs +1 -1
- package/src/runtime/memory/lib/pg/supervisor.mjs +16 -96
- package/src/runtime/memory/lib/recall-hybrid/hybrid-sql.mjs +12 -3
- package/src/runtime/memory/tool-defs.mjs +1 -1
- package/src/runtime/office/authoring/docx-html-runner.mjs +1 -1
- package/src/runtime/office/authoring/pptx-author-action.mjs +1 -1
- package/src/runtime/office/authoring/xlsx-html-build.mjs +1 -1
- package/src/runtime/office/authoring/xlsx-html-runner.mjs +1 -1
- package/src/runtime/office/capabilities.mjs +1 -1
- package/src/runtime/office/core/office-core.mjs +1 -1
- package/src/runtime/office/design/content-model.mjs +3 -3
- package/src/runtime/office/design/docx/design-docx/section.mjs +6 -6
- package/src/runtime/office/design/xlsx/design-xlsx-components.mjs +1 -1
- package/src/runtime/office/design/xlsx/design-xlsx.mjs +1 -1
- package/src/runtime/office/pdf/ocr-engine.mjs +1 -1
- package/src/runtime/office/pdf/pdf-writer.mjs +4 -4
- package/src/runtime/office/portable/portable-docx-operations.mjs +2 -2
- package/src/runtime/office/portable/portable-soffice.mjs +8 -6
- package/src/runtime/office/portable/xlsx-contract.mjs +1 -1
- package/src/runtime/shared/atomic-file.d.mts +8 -0
- package/src/runtime/shared/background-tasks.mjs +22 -4
- package/src/runtime/shared/background-wait.mjs +66 -0
- package/src/runtime/shared/child-guardian.mjs +17 -7
- package/src/runtime/shared/config.mjs +313 -16
- package/src/runtime/shared/connector-catalog.d.mts +4 -5
- package/src/runtime/shared/connector-catalog.mjs +11 -1
- package/src/runtime/shared/file-lock.mjs +8 -3
- package/src/runtime/shared/git-runner.mjs +7 -2
- package/src/runtime/shared/idle-gc.mjs +30 -7
- package/src/runtime/shared/llm/http-agent.mjs +8 -5
- package/src/runtime/shared/llm/system-proxy.mjs +2 -1
- package/src/runtime/shared/llm/usage-accounting.mjs +110 -19
- package/src/runtime/shared/llm/usage-context.mjs +1 -1
- package/src/runtime/shared/llm/usage-ledger-quota.mjs +33 -12
- package/src/runtime/shared/llm/usage-ledger-requests.mjs +183 -0
- package/src/runtime/shared/llm/usage-ledger-rollup.mjs +90 -10
- package/src/runtime/shared/llm/usage-ledger-worker.mjs +2 -0
- package/src/runtime/shared/llm/usage-ledger.mjs +60 -1
- package/src/runtime/shared/llm/usage-request-status.mjs +48 -0
- package/src/runtime/shared/llm/usage-rollup.mjs +48 -0
- package/src/runtime/shared/maintenance-schedule.mjs +109 -0
- package/src/runtime/shared/process-runner.mjs +8 -4
- package/src/runtime/shared/routine-trigger.d.mts +13 -0
- package/src/runtime/shared/routine-trigger.mjs +34 -0
- package/src/runtime/shared/run-child.d.mts +2 -1
- package/src/runtime/shared/run-child.mjs +70 -18
- package/src/runtime/shared/session-scratch.mjs +14 -2
- package/src/runtime/shared/shipped-definitions.mjs +7 -1
- package/src/runtime/shared/tool-card-model.golden.json +3 -12
- package/src/runtime/shared/tool-execution-contract.mjs +2 -0
- package/src/runtime/shared/tool-result-summary.mjs +1 -1
- package/src/runtime/shared/tool-work-units.mjs +31 -6
- package/src/runtime/shared/turn-snapshot.mjs +26 -4
- package/src/runtime/shared/turn-worktree-snapshot.mjs +6 -11
- package/src/runtime/shared/worker-requests.mjs +17 -3
- package/src/runtime/shared/worktrees/branch-management.mjs +1 -5
- package/src/runtime/shared/worktrees/contract.mjs +16 -6
- package/src/runtime/shared/worktrees/dependencies.mjs +127 -89
- package/src/runtime/shared/worktrees/disk.mjs +79 -2
- package/src/runtime/shared/worktrees/git.mjs +44 -11
- package/src/runtime/shared/worktrees/include.mjs +6 -4
- package/src/runtime/shared/worktrees/maintenance.mjs +422 -30
- package/src/runtime/shared/worktrees/manager.mjs +772 -75
- package/src/runtime/shared/worktrees/settings.mjs +33 -7
- package/src/runtime/shared/worktrees/test-support.mjs +5 -1
- package/src/runtime/shared/worktrees/worker-snapshots.mjs +82 -0
- package/src/runtime/tidy/process.mjs +2 -1
- package/src/runtime/web-search/index.mjs +3 -22
- package/src/runtime/web-search/lib/web-tools.mjs +2 -2
- package/src/runtime/web-search/tool-defs.mjs +17 -26
- package/src/session-runtime/agent-home-delivery.mjs +76 -8
- package/src/session-runtime/agent-profile-changes.mjs +55 -4
- package/src/session-runtime/agent-task-sessions.mjs +63 -22
- package/src/session-runtime/boot/apis.mjs +42 -4
- package/src/session-runtime/boot/begin.mjs +2 -0
- package/src/session-runtime/boot/config.mjs +10 -1
- package/src/session-runtime/boot/facade.mjs +1 -0
- package/src/session-runtime/boot/providers.mjs +70 -3
- package/src/session-runtime/boot/session.mjs +2 -0
- package/src/session-runtime/boot/tools.mjs +75 -25
- package/src/session-runtime/channel-config-api.mjs +1 -0
- package/src/session-runtime/config-change-effects.mjs +179 -0
- package/src/session-runtime/config-lifecycle/config-writers.mjs +1 -0
- package/src/session-runtime/config-lifecycle.mjs +160 -24
- package/src/session-runtime/conversation-import/discovery.mjs +86 -7
- package/src/session-runtime/conversation-import/service.mjs +3 -2
- package/src/session-runtime/goal-facade-api.mjs +49 -3
- package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +5 -57
- package/src/session-runtime/internal-tool-executor/bridge-tools.mjs +3 -2
- package/src/session-runtime/internal-tool-executor/feature-tools.mjs +3 -11
- package/src/session-runtime/internal-tool-executor/workspace-tools.mjs +18 -4
- package/src/session-runtime/internal-tool-executor.mjs +12 -19
- package/src/session-runtime/lifecycle/cold-heir.mjs +7 -0
- package/src/session-runtime/lifecycle/memory-ingest.mjs +3 -3
- package/src/session-runtime/lifecycle/session-switch/session-delete.mjs +53 -5
- package/src/session-runtime/lifecycle/session-switch.mjs +13 -2
- package/src/session-runtime/lifecycle/teardown/session-close.mjs +4 -4
- package/src/session-runtime/lifecycle-api.mjs +1 -0
- package/src/session-runtime/mcp-glue/server-catalog.mjs +14 -3
- package/src/session-runtime/mcp-glue/server-connection.mjs +34 -8
- package/src/session-runtime/model-route/route-persist.mjs +12 -4
- package/src/session-runtime/model-route/set-route.mjs +40 -7
- package/src/session-runtime/native-web-search/routes.mjs +3 -3
- package/src/session-runtime/provider-auth/refresh.mjs +6 -3
- package/src/session-runtime/provider-auth/setup.mjs +1 -1
- package/src/session-runtime/provider-models/row-hydration.mjs +2 -0
- package/src/session-runtime/provider-readiness.mjs +53 -4
- package/src/session-runtime/resource-api.mjs +1 -1
- package/src/session-runtime/resource-extension-sync.mjs +4 -8
- package/src/session-runtime/resource-mcp-connector-accounts.mjs +5 -1
- package/src/session-runtime/resource-mcp-secrets.mjs +3 -3
- package/src/session-runtime/resource-plugins-api.mjs +4 -0
- package/src/session-runtime/routine-executor.mjs +152 -0
- package/src/session-runtime/routine-home-turn.mjs +46 -5
- package/src/session-runtime/routine-owner.mjs +9 -3
- package/src/session-runtime/runtime-facade.mjs +5 -0
- package/src/session-runtime/runtime-feature-gates.mjs +2 -11
- package/src/session-runtime/schedule-session-run.mjs +1 -0
- package/src/session-runtime/services/agent-task-status.mjs +29 -1
- package/src/session-runtime/services/agent-tool/job-task-reconcile.mjs +6 -1
- package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +10 -0
- package/src/session-runtime/services/agent-tool/render.mjs +6 -1
- package/src/session-runtime/services/agent-tool/send-flow.mjs +110 -6
- package/src/session-runtime/services/agent-tool/spawn-flow/job-start.mjs +12 -0
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-plan.mjs +5 -0
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +24 -6
- package/src/session-runtime/services/agent-tool.mjs +51 -1
- package/src/session-runtime/services/channel-admin.mjs +62 -3
- package/src/session-runtime/services/hook-bus/command-handler.mjs +7 -11
- package/src/session-runtime/services/plugin-admin.mjs +50 -7
- package/src/session-runtime/services/provider-admin.mjs +5 -0
- package/src/session-runtime/services/seeds.mjs +7 -0
- package/src/session-runtime/services/usage-stats-model.mjs +32 -11
- package/src/session-runtime/session-create/materialize.mjs +4 -2
- package/src/session-runtime/session-create/session-options.mjs +2 -0
- package/src/session-runtime/settings-builtin-tools-api.mjs +1 -9
- package/src/session-runtime/setup-tool/agent-settings-actions.mjs +1 -1
- package/src/session-runtime/setup-tool/connector-widen-approval.mjs +1 -1
- package/src/session-runtime/setup-tool/executor.mjs +9 -2
- package/src/session-runtime/setup-tool/extended-actions.mjs +3 -1
- package/src/session-runtime/setup-tool/settings-contract.mjs +30 -2
- package/src/session-runtime/setup-tool/tool-defs.mjs +26 -1
- package/src/session-runtime/tool-policy/agent-profile-fold.mjs +40 -43
- package/src/session-runtime/tool-policy/mode-switch.mjs +1 -1
- package/src/session-runtime/tool-policy/policy-stage.mjs +106 -8
- package/src/session-runtime/tool-policy/workflow-overlay.mjs +2 -1
- package/src/session-runtime/tool-policy-refresh.mjs +182 -5
- package/src/session-runtime/tool-surface.mjs +38 -1
- package/src/session-runtime/turn/agent-ops.mjs +10 -2
- package/src/session-runtime/turn/session-ops.mjs +2 -0
- package/src/session-runtime/turn/turn-run/turn-prepare.mjs +5 -0
- package/src/session-runtime/turn/turn-run.mjs +1 -1
- package/src/session-runtime/usage-stats-api.mjs +117 -1
- package/src/session-runtime/webhook-session-run.mjs +2 -0
- package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +37 -33
- package/src/session-runtime/workflow-agents-api/agent-editor.mjs +183 -23
- package/src/session-runtime/workflow-agents-api/agent-route.mjs +3 -10
- package/src/session-runtime/workflow-agents-api/instruction-files.mjs +165 -0
- package/src/session-runtime/workflow-agents-api/style-and-mode.mjs +5 -4
- package/src/session-runtime/workflow-agents-api/workflow-packs.mjs +2 -3
- package/src/session-runtime/workflow-agents-api.mjs +2 -0
- package/src/session-runtime/workspace/project-branches.mjs +1 -1
- package/src/session-runtime/workspace/session-view.mjs +1 -1
- package/src/session-runtime/workspace/transitions.mjs +20 -4
- package/src/session-runtime/workspace/worktree-maintenance.mjs +126 -6
- package/src/session-runtime/workspace/worktree-setup.mjs +13 -1
- package/src/session-runtime/workspace/worktree-tool.mjs +16 -0
- package/src/standalone/daemon-agent-control.mjs +25 -8
- package/src/standalone/daemon-desktop-runtime.mjs +6 -2
- package/src/standalone/daemon-lag-profiler.mjs +7 -7
- package/src/standalone/daemon.mjs +54 -2
- package/src/standalone/local-session-runtime.mjs +16 -0
- package/src/standalone/session-client/daemon-unavailable.mjs +1 -1
- package/src/standalone/session-protocol.mjs +12 -0
- package/src/standalone/session-service/agent-route-follow.mjs +23 -20
- package/src/standalone/session-service/agent-tree/agent-turns.mjs +18 -6
- package/src/standalone/session-service/quota-resume.mjs +9 -0
- package/src/standalone/session-service/retention/busy.mjs +3 -2
- package/src/standalone/session-service/session-calls/session-action.mjs +51 -1
- package/src/standalone/session-service/session-calls/session-turns.mjs +37 -18
- package/src/standalone/session-service/session-calls/turn-gate.mjs +34 -0
- package/src/standalone/session-service/session-calls.mjs +2 -1
- package/src/tui/App.jsx +8 -0
- package/src/tui/app/clipboard.mjs +1 -1
- package/src/tui/app/create-app-pickers.mjs +2 -0
- package/src/tui/app/doctor.mjs +2 -2
- package/src/tui/app/model-picker/model-footer.mjs +1 -1
- package/src/tui/app/model-picker/provider-models-list.mjs +7 -3
- package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +23 -3
- package/src/tui/app/model-picker/route-selection.mjs +1 -0
- package/src/tui/app/panel-signature.mjs +1 -1
- package/src/tui/app/settings-picker.mjs +53 -8
- package/src/tui/app/shell-layout/row-budgets.mjs +2 -2
- package/src/tui/app/slash-commands.mjs +1 -1
- package/src/tui/app/slash-dispatch/route-commands.mjs +1 -1
- package/src/tui/app/slash-dispatch/session-commands.mjs +1 -1
- package/src/tui/app/use-prompt-queue-history.mjs +2 -2
- package/src/tui/app/use-transcript-activity.mjs +1 -1
- package/src/tui/app/use-transcript-window/geometry.mjs +1 -1
- package/src/tui/components/prompt-input/escape-policy.d.mts +0 -1
- package/src/tui/components/prompt-input/escape-policy.mjs +1 -1
- package/src/tui/components/question-panel-model.mjs +4 -4
- package/src/tui/components/tool-execution/standard-card.jsx +3 -4
- package/src/tui/components/user-message-skills.mjs +1 -1
- package/src/tui/dist/index.mjs +350 -37
- package/src/tui/markdown/render-ansi.mjs +1 -1
- package/src/tui/session/agent-job-feed/notification-router.mjs +10 -0
- package/src/tui/session/agent-job-feed.mjs +2 -0
- package/src/tui/session/context-state.mjs +3 -0
- package/src/tui/session/quota-resume.mjs +1 -1
- package/src/tui/session/session-api/integrations.mjs +3 -0
- package/src/tui/session/session-api/lifecycle/dispose.mjs +1 -0
- package/src/tui/session/session-api/lifecycle/session-reset.mjs +7 -0
- package/src/tui/session/session-api/routes-agent-definitions.mjs +5 -0
- package/src/tui/session/session-api/worktree.mjs +13 -1
- package/src/tui/session/session-flow/drain.mjs +11 -14
- package/src/tui/session/tool-approval-settle.mjs +24 -4
- package/src/tui/session/tool-approval.mjs +35 -10
- package/src/tui/session/tool-card-results/grouped-result.mjs +2 -2
- package/src/tui/session/turn-quiet.mjs +1 -1
- package/src/tui/session/turn.mjs +3 -0
- package/src/tui/session/worktree-setup-notice.mjs +1 -1
- package/src/tui/spinner-meta.mjs +3 -3
- package/src/tui/spinner-verbs.mjs +2 -2
- package/src/defaults/skills/goal-management/SKILL.md +0 -169
- package/src/runtime/agent/orchestrator/runtime-core/goal-tasks.mjs +0 -156
- package/src/session-runtime/goal-tasks.mjs +0 -1
|
@@ -6,9 +6,12 @@
|
|
|
6
6
|
// grandchildren (uv.exe -> mcp-for-unity.exe -> python.exe) orphaned. This
|
|
7
7
|
// module implements the MCP spec shutdown order over the whole process tree:
|
|
8
8
|
// close stdin -> grace wait for voluntary exit -> force-kill the recorded
|
|
9
|
-
// tree (
|
|
10
|
-
// POSIX). No external dependencies.
|
|
11
|
-
|
|
9
|
+
// tree (the creation-checked tree kill below on Windows, SIGTERM->SIGKILL of
|
|
10
|
+
// every descendant on POSIX). No external dependencies.
|
|
11
|
+
//
|
|
12
|
+
// It also owns Mixdog's one Windows process-tree kill (treeKillCommand), which
|
|
13
|
+
// every other Windows tree kill runs, sync, async or detached.
|
|
14
|
+
import { spawn, spawnSync } from 'node:child_process';
|
|
12
15
|
import { runProcessOffThread } from '../../../shared/process-runner.mjs';
|
|
13
16
|
import { detachedSpawnOpts } from '../../../shared/spawn-flags.mjs';
|
|
14
17
|
|
|
@@ -49,13 +52,21 @@ export const ENUMERATION_DEADLINE_MS = 20_000;
|
|
|
49
52
|
// Output bound of one helper command: a process table is tens of KB.
|
|
50
53
|
const HELPER_MAX_BYTES = 64 * 1024 * 1024;
|
|
51
54
|
|
|
52
|
-
// Run a helper command
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
//
|
|
55
|
+
// Run a helper command (a process-table read or a tree kill) off the event
|
|
56
|
+
// loop (process-runner.mjs: under load one PowerShell start blocked the
|
|
57
|
+
// daemon's loop for seconds). Past `timeoutMs` the helper itself is killed
|
|
58
|
+
// directly: it starts nothing worth walking, and a tree kill of it would be
|
|
59
|
+
// one more pass on the same stuck table read, with a deadline of its own.
|
|
60
|
+
function runHelper(cmd, args, timeoutMs) {
|
|
61
|
+
return runProcessOffThread(cmd, args, { timeoutMs, maxBytes: HELPER_MAX_BYTES, killTree: false });
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// A process-table helper's stdout. Past `timeoutMs` (default
|
|
65
|
+
// ENUMERATION_DEADLINE_MS) the helper is killed and the call settles. Strict:
|
|
66
|
+
// a failed, non-zero or timed-out run rejects; otherwise it resolves ''
|
|
67
|
+
// (non-zero exits keep their stdout).
|
|
57
68
|
function run(cmd, args, { strict = false, timeoutMs = ENUMERATION_DEADLINE_MS } = {}) {
|
|
58
|
-
return
|
|
69
|
+
return runHelper(cmd, args, timeoutMs).then(
|
|
59
70
|
({ code, stdout }) => {
|
|
60
71
|
if (strict && code !== 0) throw new Error(`Process enumeration failed (${code}).`);
|
|
61
72
|
return stdout;
|
|
@@ -147,27 +158,41 @@ export function readProcessTable() {
|
|
|
147
158
|
return nextTable;
|
|
148
159
|
}
|
|
149
160
|
|
|
161
|
+
// Windows keeps a dead parent's pid in its children and hands that pid to new
|
|
162
|
+
// processes, so an older process can look like a newer one's child: wininit.exe
|
|
163
|
+
// still names its boot-time parent's pid, and a tree walked from whatever holds
|
|
164
|
+
// that pid now reaches services.exe and every service host under it. A child is
|
|
165
|
+
// never created before its parent, so on Windows a link is followed only from a
|
|
166
|
+
// process whose creation time is known, to one created no earlier. POSIX
|
|
167
|
+
// reparents orphans, so its links never dangle.
|
|
168
|
+
const createdTicks = (token) => (typeof token === 'string' && /^\d+$/.test(token) ? BigInt(token) : null);
|
|
169
|
+
|
|
150
170
|
// Walk every descendant pid of rootPid (excludes rootPid).
|
|
151
|
-
function descendantsOf(childrenOf, rootPid) {
|
|
171
|
+
function descendantsOf(childrenOf, rootPid, tokenOf) {
|
|
152
172
|
const result = [];
|
|
153
173
|
const seen = new Set([rootPid]);
|
|
154
174
|
const stack = [rootPid];
|
|
155
175
|
while (stack.length) {
|
|
156
176
|
const cur = stack.pop();
|
|
177
|
+
const parentCreated = isWin ? createdTicks(tokenOf.get(cur)) : null;
|
|
178
|
+
if (isWin && parentCreated == null) continue;
|
|
157
179
|
for (const child of childrenOf.get(cur) ?? []) {
|
|
158
|
-
if (
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
180
|
+
if (seen.has(child)) continue;
|
|
181
|
+
if (isWin) {
|
|
182
|
+
const childCreated = createdTicks(tokenOf.get(child));
|
|
183
|
+
if (childCreated == null || childCreated < parentCreated) continue;
|
|
162
184
|
}
|
|
185
|
+
seen.add(child);
|
|
186
|
+
result.push(child);
|
|
187
|
+
stack.push(child);
|
|
163
188
|
}
|
|
164
189
|
}
|
|
165
190
|
return result;
|
|
166
191
|
}
|
|
167
192
|
|
|
168
193
|
async function collectDescendants(rootPid) {
|
|
169
|
-
const { childrenOf } = await enumerate();
|
|
170
|
-
return descendantsOf(childrenOf, rootPid);
|
|
194
|
+
const { childrenOf, tokenOf } = await enumerate();
|
|
195
|
+
return descendantsOf(childrenOf, rootPid, tokenOf);
|
|
171
196
|
}
|
|
172
197
|
|
|
173
198
|
/** Descendant pids WITH their image names and identity tokens (creation
|
|
@@ -177,24 +202,163 @@ export async function collectDescendantProcesses(rootPid, { strict = false } = {
|
|
|
177
202
|
const { childrenOf, nameOf, tokenOf } = strict
|
|
178
203
|
? await snapshot
|
|
179
204
|
: await snapshot.catch(() => ({ childrenOf: new Map(), nameOf: new Map(), tokenOf: new Map() }));
|
|
180
|
-
return descendantsOf(childrenOf, rootPid).map((pid) => ({
|
|
205
|
+
return descendantsOf(childrenOf, rootPid, tokenOf).map((pid) => ({
|
|
181
206
|
pid,
|
|
182
207
|
name: nameOf.get(pid) || '',
|
|
183
208
|
token: tokenOf.get(pid) ?? null,
|
|
184
209
|
}));
|
|
185
210
|
}
|
|
186
211
|
|
|
187
|
-
|
|
188
|
-
|
|
212
|
+
const positivePids = (pids) => [...new Set((pids || []).map(Number).filter((pid) => Number.isInteger(pid) && pid > 0))];
|
|
213
|
+
|
|
214
|
+
// The Windows tree kill, one PowerShell pass. taskkill /T is never used: it
|
|
215
|
+
// walks parent ids with no creation times, so it follows the dangling links
|
|
216
|
+
// descendantsOf refuses (on 2026-10-30 one such kill ended every user-owned
|
|
217
|
+
// service host and sihost.exe). A root counts only if it was created no later
|
|
218
|
+
// than -AliveAt (a pid taken over after the caller saw its process is not
|
|
219
|
+
// that process); a descendant only if created no earlier than its parent.
|
|
220
|
+
// Each process is ended through a handle whose start time matches the table.
|
|
221
|
+
// Exit: 0 ended, 128 no root matched (gone or a different process), 1 a root
|
|
222
|
+
// survived; a failed or timed-out table read fails the pass. The table read
|
|
223
|
+
// times out on its own (a pass detached from an exiting caller still ends);
|
|
224
|
+
// every spawn from Node is also held to TREE_KILL_DEADLINE_MS. -Table/-List: tests only, a
|
|
225
|
+
// stand-in table whose member pids are printed instead of ended.
|
|
226
|
+
export const TREE_KILL_SCRIPT = `param([int[]]$Pids, [long]$AliveAt, [object[]]$Table, [switch]$List)
|
|
227
|
+
$ErrorActionPreference = 'Stop'
|
|
228
|
+
$limit = [DateTime]::FromFileTimeUtc($AliveAt)
|
|
229
|
+
if ($Table) {
|
|
230
|
+
$rows = @(foreach ($t in $Table) { [pscustomobject]@{ Id = [int]$t.Id; Parent = [int]$t.Parent; Created = [DateTime]::FromFileTimeUtc([long]$t.Created) } })
|
|
231
|
+
} else {
|
|
232
|
+
$rows = @(Get-CimInstance Win32_Process -OperationTimeoutSec 10 | Where-Object CreationDate | ForEach-Object { [pscustomobject]@{ Id = [int]$_.ProcessId; Parent = [int]$_.ParentProcessId; Created = $_.CreationDate.ToUniversalTime() } })
|
|
233
|
+
}
|
|
234
|
+
$byId = @{}
|
|
235
|
+
$byParent = @{}
|
|
236
|
+
foreach ($r in $rows) {
|
|
237
|
+
$byId[$r.Id] = $r
|
|
238
|
+
if (-not $byParent.ContainsKey($r.Parent)) { $byParent[$r.Parent] = [Collections.Generic.List[object]]::new() }
|
|
239
|
+
$byParent[$r.Parent].Add($r)
|
|
240
|
+
}
|
|
241
|
+
$members = [Collections.Generic.List[object]]::new()
|
|
242
|
+
foreach ($id in $Pids) {
|
|
243
|
+
$r = $byId[$id]
|
|
244
|
+
if ($r -and $r.Created -le $limit -and -not $members.Contains($r)) { $members.Add($r) }
|
|
245
|
+
}
|
|
246
|
+
$roots = $members.Count
|
|
247
|
+
if ($roots -eq 0) { exit 128 }
|
|
248
|
+
for ($i = 0; $i -lt $members.Count; $i++) {
|
|
249
|
+
$parent = $members[$i]
|
|
250
|
+
if (-not $byParent.ContainsKey($parent.Id)) { continue }
|
|
251
|
+
foreach ($child in $byParent[$parent.Id]) {
|
|
252
|
+
if ($child.Created -ge $parent.Created -and -not $members.Contains($child)) { $members.Add($child) }
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
if ($List) { foreach ($m in $members) { $m.Id }; exit 0 }
|
|
256
|
+
$survived = $false
|
|
257
|
+
for ($i = 0; $i -lt $members.Count; $i++) {
|
|
258
|
+
$m = $members[$i]
|
|
259
|
+
try { $p = [Diagnostics.Process]::GetProcessById($m.Id) } catch { continue }
|
|
260
|
+
try { $same = [math]::Abs(($p.StartTime.ToUniversalTime() - $m.Created).TotalMilliseconds) -lt 1 } catch { $same = $null }
|
|
261
|
+
if ($same -eq $false) { continue }
|
|
262
|
+
# A start time that cannot be read proves nothing: the process is left alone,
|
|
263
|
+
# and a root left alone counts as surviving.
|
|
264
|
+
if ($null -eq $same) { if ($i -lt $roots) { $survived = $true }; continue }
|
|
265
|
+
try { $p.Kill() } catch {}
|
|
266
|
+
if ($i -lt $roots) { try { if (-not $p.WaitForExit(2000)) { $survived = $true } } catch { $survived = $true } }
|
|
267
|
+
}
|
|
268
|
+
if ($survived) { exit 1 }
|
|
269
|
+
exit 0`;
|
|
270
|
+
|
|
271
|
+
const fileTime = (ms) => BigInt(Math.floor(Number(ms))) * 10_000n + 116_444_736_000_000_000n;
|
|
272
|
+
|
|
273
|
+
/** The command of one Windows tree kill of `pids` (see TREE_KILL_SCRIPT), for
|
|
274
|
+
* callers that spawn it themselves: awaited, synchronous, or detached and
|
|
275
|
+
* unref'd so it outlives an exiting caller. `aliveAt` (epoch ms): when the
|
|
276
|
+
* caller last knew each pid was its process (a live child handle: now; a
|
|
277
|
+
* pid file: when it was written). `table`: tests only, rows { pid, ppid,
|
|
278
|
+
* created (epoch ms) } standing in for the live table; the command then
|
|
279
|
+
* prints the member pids instead of ending them. */
|
|
280
|
+
export function treeKillCommand(pids, { aliveAt = Date.now(), table = null } = {}) {
|
|
281
|
+
const rows = table
|
|
282
|
+
? ` -List -Table @(${table.map((row) => `@{Id=${row.pid};Parent=${row.ppid};Created=${fileTime(row.created)}}`).join(',')})`
|
|
283
|
+
: '';
|
|
284
|
+
const source = `& {\n${TREE_KILL_SCRIPT}\n} -Pids @(${positivePids(pids).join(',')}) -AliveAt ${fileTime(aliveAt)}${rows}`;
|
|
285
|
+
const systemRoot = process.env.SystemRoot || process.env.WINDIR || 'C:\\Windows';
|
|
286
|
+
return {
|
|
287
|
+
command: `${systemRoot}\\System32\\WindowsPowerShell\\v1.0\\powershell.exe`,
|
|
288
|
+
args: ['-NoProfile', '-NonInteractive', '-EncodedCommand', Buffer.from(source, 'utf16le').toString('base64')],
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
/** The hard lifetime of one tree-kill pass, enforced from Node whatever the
|
|
293
|
+
* table read does (its own timeout is 10 s). */
|
|
294
|
+
export const TREE_KILL_DEADLINE_MS = 15_000;
|
|
295
|
+
|
|
296
|
+
/** The tree kill run synchronously (Windows only): its exit status (see
|
|
297
|
+
* TREE_KILL_SCRIPT), or null when it could not run or outlived `timeoutMs`. */
|
|
298
|
+
export function killProcessTreesSync(pids, { aliveAt = Date.now(), timeoutMs = TREE_KILL_DEADLINE_MS } = {}) {
|
|
299
|
+
const { command, args } = treeKillCommand(pids, { aliveAt });
|
|
300
|
+
return spawnSync(command, args, { stdio: 'ignore', windowsHide: true, timeout: timeoutMs }).status;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/** The tree kill spawned (Windows only) and held to TREE_KILL_DEADLINE_MS:
|
|
304
|
+
* past it the pass is killed. `root`: the caller's own ChildProcess, alive
|
|
305
|
+
* now; it is killed directly once the pass has ended, failed or run out of
|
|
306
|
+
* time, so a hung pass never keeps it alive. `detached`: the pass outlives
|
|
307
|
+
* an exiting caller and is bounded only by its own table-read timeout.
|
|
308
|
+
* Neither the pass nor its deadline keeps the caller's event loop alive.
|
|
309
|
+
* Returns the pass's ChildProcess, or null when it could not be spawned. */
|
|
310
|
+
export function spawnTreeKill(pids, { aliveAt = Date.now(), root = null, detached = false } = {}) {
|
|
311
|
+
const killRoot = () => {
|
|
312
|
+
try {
|
|
313
|
+
root?.kill();
|
|
314
|
+
} catch {
|
|
315
|
+
/* already gone */
|
|
316
|
+
}
|
|
317
|
+
};
|
|
318
|
+
let pass;
|
|
319
|
+
try {
|
|
320
|
+
const { command, args } = treeKillCommand(pids, { aliveAt });
|
|
321
|
+
pass = spawn(command, args, { stdio: 'ignore', ...detachedSpawnOpts });
|
|
322
|
+
} catch {
|
|
323
|
+
killRoot();
|
|
324
|
+
return null;
|
|
325
|
+
}
|
|
326
|
+
pass.unref?.();
|
|
327
|
+
if (detached) {
|
|
328
|
+
pass.once('error', killRoot);
|
|
329
|
+
return pass;
|
|
330
|
+
}
|
|
331
|
+
const deadline = setTimeout(() => {
|
|
332
|
+
try {
|
|
333
|
+
pass.kill();
|
|
334
|
+
} catch {
|
|
335
|
+
/* already gone */
|
|
336
|
+
}
|
|
337
|
+
killRoot();
|
|
338
|
+
}, TREE_KILL_DEADLINE_MS);
|
|
339
|
+
deadline.unref?.();
|
|
340
|
+
const settle = () => {
|
|
341
|
+
clearTimeout(deadline);
|
|
342
|
+
killRoot();
|
|
343
|
+
};
|
|
344
|
+
pass.once('error', settle);
|
|
345
|
+
pass.once('exit', settle);
|
|
346
|
+
return pass;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** Force-kill whole process trees by pid. Windows runs the tree kill off the
|
|
350
|
+
* event loop and resolves to its exit status (null: it could not run or
|
|
351
|
+
* timed out); POSIX escalates SIGTERM → SIGKILL. Best-effort: the caller
|
|
189
352
|
* verifies liveness afterwards rather than trusting the signal. */
|
|
190
|
-
export async function killProcessTrees(pids) {
|
|
191
|
-
const targets =
|
|
192
|
-
if (targets.length === 0) return;
|
|
353
|
+
export async function killProcessTrees(pids, { aliveAt = Date.now() } = {}) {
|
|
354
|
+
const targets = positivePids(pids);
|
|
355
|
+
if (targets.length === 0) return isWin ? 128 : undefined;
|
|
193
356
|
if (isWin) {
|
|
194
|
-
const args =
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
357
|
+
const { command, args } = treeKillCommand(targets, { aliveAt });
|
|
358
|
+
return runHelper(command, args, TREE_KILL_DEADLINE_MS).then(
|
|
359
|
+
({ code }) => code,
|
|
360
|
+
() => null
|
|
361
|
+
);
|
|
198
362
|
}
|
|
199
363
|
for (const pid of targets) signalQuietly(pid, 'SIGTERM');
|
|
200
364
|
await delay(300);
|
|
@@ -206,10 +370,10 @@ export async function killProcessTrees(pids) {
|
|
|
206
370
|
/**
|
|
207
371
|
* Immediate, non-blocking tree kill for a transport whose MCP handshake never
|
|
208
372
|
* completed (shutdown-during-connect). Unlike shutdownStdioChild there is no
|
|
209
|
-
* grace wait and no
|
|
210
|
-
*
|
|
211
|
-
*
|
|
212
|
-
* hold the caller's event loop open (the caller is a process about to exit).
|
|
373
|
+
* grace wait and no enumeration here — the ChildProcess handle is live, so the
|
|
374
|
+
* pid is current, and a detached tree kill reaps the still-parented tree after
|
|
375
|
+
* the caller is gone. Everything is unref'd/fire-and-forget so the kill can
|
|
376
|
+
* never hold the caller's event loop open (the caller is a process about to exit).
|
|
213
377
|
*/
|
|
214
378
|
export function killStdioChildTreeFast(transport) {
|
|
215
379
|
const proc = transport?._process;
|
|
@@ -234,15 +398,7 @@ export function killStdioChildTreeFast(transport) {
|
|
|
234
398
|
}
|
|
235
399
|
}
|
|
236
400
|
if (isWin) {
|
|
237
|
-
|
|
238
|
-
const cp = spawn('taskkill', ['/PID', String(pid), '/T', '/F'], {
|
|
239
|
-
stdio: 'ignore',
|
|
240
|
-
...detachedSpawnOpts,
|
|
241
|
-
});
|
|
242
|
-
cp.unref();
|
|
243
|
-
} catch {
|
|
244
|
-
/* ignore */
|
|
245
|
-
}
|
|
401
|
+
spawnTreeKill([pid], { root: proc, detached: true });
|
|
246
402
|
return true;
|
|
247
403
|
}
|
|
248
404
|
// POSIX: cheap ps enumerate, then SIGKILL descendants + root. Best-effort
|
|
@@ -308,11 +464,8 @@ async function killVerified(pids, snapshotToken, currentTokens) {
|
|
|
308
464
|
const verified = pids.filter((pid) => stillSame(pid, snapshotToken, currentTokens));
|
|
309
465
|
if (verified.length === 0) return;
|
|
310
466
|
if (isWin) {
|
|
311
|
-
//
|
|
312
|
-
|
|
313
|
-
const args = ['/F', '/T'];
|
|
314
|
-
for (const p of verified) args.push('/PID', String(p));
|
|
315
|
-
await run('taskkill', args);
|
|
467
|
+
// Every listed pid was identity-checked just above.
|
|
468
|
+
await killProcessTrees(verified);
|
|
316
469
|
return;
|
|
317
470
|
}
|
|
318
471
|
// POSIX: terminate, brief wait, then hard-kill survivors. Re-verify with a
|
|
@@ -339,7 +492,7 @@ export async function shutdownStdioChild(transport, { graceMs = 2000 } = {}) {
|
|
|
339
492
|
// Snapshot #1: tree + identity tokens while it is still fully intact.
|
|
340
493
|
// Covers children that later get re-parented/orphaned during shutdown.
|
|
341
494
|
const before = await enumerate().catch(() => empty);
|
|
342
|
-
const initial = descendantsOf(before.childrenOf, pid);
|
|
495
|
+
const initial = descendantsOf(before.childrenOf, pid, before.tokenOf);
|
|
343
496
|
snapshotToken.set(pid, before.tokenOf.get(pid) ?? null);
|
|
344
497
|
for (const d of initial) snapshotToken.set(d, before.tokenOf.get(d) ?? null);
|
|
345
498
|
// 1. Close stdin to request a voluntary shutdown.
|
|
@@ -353,7 +506,7 @@ export async function shutdownStdioChild(transport, { graceMs = 2000 } = {}) {
|
|
|
353
506
|
// 3. Snapshot #2 after the grace: catches children spawned late during
|
|
354
507
|
// shutdown that were absent from the first snapshot.
|
|
355
508
|
const after = await enumerate().catch(() => empty);
|
|
356
|
-
const fresh = descendantsOf(after.childrenOf, pid);
|
|
509
|
+
const fresh = descendantsOf(after.childrenOf, pid, after.tokenOf);
|
|
357
510
|
for (const d of fresh) {
|
|
358
511
|
if (!snapshotToken.has(d)) snapshotToken.set(d, after.tokenOf.get(d) ?? null);
|
|
359
512
|
}
|
|
@@ -8,11 +8,9 @@ import { rememberMcpToolIdentity } from '../../../shared/tool-primitives.mjs';
|
|
|
8
8
|
|
|
9
9
|
/** Known auto-detect targets: the discovery-advert service name and the MCP
|
|
10
10
|
* endpoint path on its port.
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* in-process through agent's toolExecutor (see orchestrator/internal-tools),
|
|
15
|
-
* so this registry is for genuinely external port-based MCP targets only. */
|
|
11
|
+
* The plugin's own tools are injected in-process through agent's
|
|
12
|
+
* toolExecutor (see orchestrator/internal-tools), so this registry is for
|
|
13
|
+
* genuinely external port-based MCP targets only. */
|
|
16
14
|
export const AUTO_DETECT_PORTS = {
|
|
17
15
|
'mixdog-memory': { discovery: 'memory', endpoint: '/mcp' },
|
|
18
16
|
};
|
|
@@ -10,6 +10,8 @@ import { googleMcpService, withGoogleMcp } from '../../../connectors/google-mcp.
|
|
|
10
10
|
import { gmailAppPasswordService, withGmailAppPasswordMcp } from '../../../connectors/gmail-app-password.mjs';
|
|
11
11
|
import { withConnectorAccountsMcp } from '../../../connectors/connector-accounts-mcp.mjs';
|
|
12
12
|
import {
|
|
13
|
+
connectorAccountEnabled,
|
|
14
|
+
connectorAccountId,
|
|
13
15
|
connectorAccountsOf,
|
|
14
16
|
connectorLiveAccountServers,
|
|
15
17
|
gmailAppPasswordAccount,
|
|
@@ -271,9 +273,13 @@ function missingEnvWarnings(name, cfg, strictEnv, log) {
|
|
|
271
273
|
// A connector server: one server, every account behind it (its account choice
|
|
272
274
|
// on `connectorAccounts`); closing the transport closes every account client.
|
|
273
275
|
function connectorAccountsTransport({ name, cfg, Transport, url, accountServers, sdk, oauthOptions, log }) {
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
)
|
|
276
|
+
// `accountServers` are the switched-on stored accounts, in order.
|
|
277
|
+
const stored = connectorAccountsOf(cfg).filter(connectorAccountEnabled);
|
|
278
|
+
const accounts = accountServers.map((accountCfg, index) => {
|
|
279
|
+
const account = connectorAccountClient(name, accountCfg, { sdk, log, oauthOptions });
|
|
280
|
+
account.id = connectorAccountId(cfg, stored[index]);
|
|
281
|
+
return account;
|
|
282
|
+
});
|
|
277
283
|
const fetchImpl = withConnectorAccountsMcp({ connector: cfg.connector, accounts });
|
|
278
284
|
const transport = new Transport(new URL(url), { fetch: fetchImpl });
|
|
279
285
|
transport.connectorAccounts = fetchImpl.connectorAccounts;
|
|
@@ -54,8 +54,9 @@ import {
|
|
|
54
54
|
export { probeMcpServerAuth } from './oauth-probe.mjs';
|
|
55
55
|
|
|
56
56
|
// Config interpretation (transport kind, URL policy, env expansion, headers,
|
|
57
|
-
// timeouts, log scrubbing) lives in client-config.mjs;
|
|
58
|
-
//
|
|
57
|
+
// timeouts, log scrubbing) lives in client-config.mjs; the names importers
|
|
58
|
+
// use (including through namespace loads such as boot.mcpClient) are
|
|
59
|
+
// re-exported here.
|
|
59
60
|
export {
|
|
60
61
|
normalizeMcpTransportUrl,
|
|
61
62
|
mcpUrlForLog,
|
|
@@ -64,9 +65,6 @@ export {
|
|
|
64
65
|
resolveMcpHttpHeaders,
|
|
65
66
|
resolveMcpTransportKind,
|
|
66
67
|
resolveMcpStartupTimeoutMs,
|
|
67
|
-
resolveMcpCallTimeoutMs,
|
|
68
|
-
resolveMcpMaxTotalTimeoutMs,
|
|
69
|
-
resolveMcpRequestTimeouts,
|
|
70
68
|
} from './client-config.mjs';
|
|
71
69
|
const servers = new Map();
|
|
72
70
|
const reconnects = createKeyedSingleflight();
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// - else the catalog connector's (connector-catalog.mjs `oauthClient`), with
|
|
7
7
|
// its scopes and the provider's offline-access parameter.
|
|
8
8
|
import { createHash } from 'node:crypto';
|
|
9
|
-
import keychain from '
|
|
9
|
+
import { keychainSecretStore as keychain } from '../../../shared/config.mjs';
|
|
10
10
|
import { connectorById, connectorOfServer, gmailAppPasswordAccount } from '../../../shared/connector-catalog.mjs';
|
|
11
11
|
import { GOOGLE_AUTH_PARAMS, googleOAuthClient } from '../../../shared/google-oauth-client.mjs';
|
|
12
12
|
import { normalizeMcpTransportUrl } from './client-config.mjs';
|
|
@@ -145,11 +145,16 @@ export function createCredentialCache({ url, credentialStore, account }) {
|
|
|
145
145
|
}
|
|
146
146
|
exists = Boolean(saved);
|
|
147
147
|
}
|
|
148
|
+
const signedIn = Boolean(creds.tokens);
|
|
148
149
|
change();
|
|
149
150
|
hold();
|
|
151
|
+
// Other processes follow a refresh through the revision marker; only a
|
|
152
|
+
// sign-in or sign-out is announced as a settings change (it may let a
|
|
153
|
+
// server that needed sign-in connect, or end its connection).
|
|
154
|
+
const announce = remove ? signedIn : Boolean(creds.tokens) !== signedIn;
|
|
150
155
|
if (remove) {
|
|
151
156
|
await writeRevisionMarker(account, null);
|
|
152
|
-
if (exists) await credentialStore.deleteSecretAsync(account);
|
|
157
|
+
if (exists) await credentialStore.deleteSecretAsync(account, { announce });
|
|
153
158
|
await writeIdentityFile(account, null);
|
|
154
159
|
creds.observed = null;
|
|
155
160
|
} else {
|
|
@@ -158,7 +163,8 @@ export function createCredentialCache({ url, credentialStore, account }) {
|
|
|
158
163
|
const { tokens, clientInformation, redirectUrl, discovery, identity } = creds;
|
|
159
164
|
await credentialStore.setSecretAsync(
|
|
160
165
|
account,
|
|
161
|
-
JSON.stringify({ url, revision, tokens, clientInformation, redirectUrl, discovery, identity })
|
|
166
|
+
JSON.stringify({ url, revision, tokens, clientInformation, redirectUrl, discovery, identity }),
|
|
167
|
+
{ announce }
|
|
162
168
|
);
|
|
163
169
|
await writeIdentityFile(account, creds);
|
|
164
170
|
creds.observed = revision;
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from './client-config.mjs';
|
|
13
13
|
import { hasConfiguredMcpAuth } from './client-transport.mjs';
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
const MCP_AUTH_PROBE_TIMEOUT_MS = 10_000;
|
|
16
16
|
|
|
17
17
|
const INITIALIZE_PROBE = JSON.stringify({
|
|
18
18
|
jsonrpc: '2.0',
|
|
@@ -145,6 +145,20 @@ export function createOAuthProvider({ cache, flow, lifetimeSignal, client = null
|
|
|
145
145
|
// access_type=offline, without which no refresh token is issued).
|
|
146
146
|
if (client?.scopes) target.searchParams.set('scope', client.scopes.join(' '));
|
|
147
147
|
for (const [key, value] of Object.entries(client?.authParams || {})) target.searchParams.set(key, value);
|
|
148
|
+
// A dynamically registered client asks for offline access when the
|
|
149
|
+
// authorization server lists it (MCP SEP-2207): the SDK sends only the
|
|
150
|
+
// resource's scopes (Vercel's `openid`), and without `offline_access`
|
|
151
|
+
// such a server issues no refresh token, so the sign-in ends within the
|
|
152
|
+
// hour. `prompt=consent` is what the SDK adds beside that scope. An
|
|
153
|
+
// empty scope stays empty: the server's default scopes would be lost.
|
|
154
|
+
if (!client) {
|
|
155
|
+
const scope = target.searchParams.get('scope');
|
|
156
|
+
const offered = creds.discovery?.authorizationServerMetadata?.scopes_supported;
|
|
157
|
+
if (scope && offered?.includes('offline_access') && !scope.split(' ').includes('offline_access')) {
|
|
158
|
+
target.searchParams.set('scope', `${scope} offline_access`);
|
|
159
|
+
target.searchParams.append('prompt', 'consent');
|
|
160
|
+
}
|
|
161
|
+
}
|
|
148
162
|
// The explicit sign-in's account mode (mcp-oauth-login.mjs) decides the
|
|
149
163
|
// provider's documented account-choice parameter, if any.
|
|
150
164
|
await flow.launchBrowser(withAccountParams(target.href, flow.launchBrowser.accountMode || 'connect').href);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createHash, randomBytes } from 'node:crypto';
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
|
-
import keychain from '
|
|
3
|
+
import { keychainSecretStore as keychain } from '../../../shared/config.mjs';
|
|
4
4
|
import { openInBrowser } from '../../../shared/open-url.mjs';
|
|
5
5
|
import { normalizeMcpTransportUrl } from './client-config.mjs';
|
|
6
6
|
import {
|
|
@@ -601,7 +601,8 @@ export function wrapProviderAdmission(provider, providerName, scheduler = provid
|
|
|
601
601
|
return accountProviderSend(
|
|
602
602
|
providerName,
|
|
603
603
|
this,
|
|
604
|
-
|
|
604
|
+
// Accounting hands back the options with its first-output probe.
|
|
605
|
+
(accountedOpts) => originalSend.call(this, messages, model, tools, accountedOpts),
|
|
605
606
|
model,
|
|
606
607
|
admittedOpts
|
|
607
608
|
);
|
|
@@ -20,6 +20,7 @@ import { applyAnthropicServerFallback } from './anthropic-server-fallback.mjs';
|
|
|
20
20
|
import { fastModeAvailable } from './anthropic-fast-mode.mjs';
|
|
21
21
|
import { applyAnthropicEffortToBody, shouldIncludeEffortBeta } from './anthropic-effort.mjs';
|
|
22
22
|
import { isCustomProviderName, resolveCustomReasoning } from './custom-reasoning.mjs';
|
|
23
|
+
import { applyCustomRequestBody, customRequestHeaders } from './custom-provider-config.mjs';
|
|
23
24
|
import {
|
|
24
25
|
anthropicThinkingActive,
|
|
25
26
|
anthropicTurnScopedReminders,
|
|
@@ -73,6 +74,8 @@ export async function buildAnthropicApiRequest({
|
|
|
73
74
|
capabilityModel = useModel,
|
|
74
75
|
// A gateway-supplied output limit for the model; wins over the Anthropic catalog.
|
|
75
76
|
modelMaxOutputTokens = opts?.modelMaxOutputTokens ?? null,
|
|
77
|
+
// A custom provider's normalized config: its extra request JSON and headers.
|
|
78
|
+
customConfig = null,
|
|
76
79
|
}) {
|
|
77
80
|
// A user-defined provider's reasoning comes from its own model row only:
|
|
78
81
|
// the global by-model-id capability index and the Claude-id ladders are
|
|
@@ -171,6 +174,11 @@ export async function buildAnthropicApiRequest({
|
|
|
171
174
|
gatewayEffort,
|
|
172
175
|
effortProjection,
|
|
173
176
|
});
|
|
177
|
+
// User-defined extra fields (e.g. `thinking`) go over the body before the
|
|
178
|
+
// tool_choice guard, so a forced choice is still dropped while the merged
|
|
179
|
+
// body has thinking on. The app-owned keys (model, messages, tools, stream,
|
|
180
|
+
// tool_choice, …) are refused inside.
|
|
181
|
+
if (isCustom && customConfig) applyCustomRequestBody(params, customConfig, useModel);
|
|
174
182
|
if (params.tools) resolveRequestToolChoice(params, opts, config);
|
|
175
183
|
// Fast mode → speed: "fast" on models Anthropic marks as speed-capable.
|
|
176
184
|
// Suppressed while the fast capacity pool is cooling down.
|
|
@@ -197,7 +205,9 @@ export async function buildAnthropicApiRequest({
|
|
|
197
205
|
capabilityModel,
|
|
198
206
|
effortProjection,
|
|
199
207
|
});
|
|
200
|
-
const
|
|
208
|
+
const appHeaders = requestHeadersFor(betas, { config, opts });
|
|
209
|
+
const requestHeaders =
|
|
210
|
+
isCustom && customConfig ? customRequestHeaders(customConfig, useModel, appHeaders) : appHeaders;
|
|
201
211
|
|
|
202
212
|
// `betas`: the selected beta names, whether or not this route sends them as a header.
|
|
203
213
|
return { params, requestHeaders, betas, knownToolNames, fastModeLatched: fastLatched };
|
|
@@ -10,7 +10,7 @@ import { createNpmVersionSource, maxSemver } from './npm-cli-version.mjs';
|
|
|
10
10
|
// source release just to advance the user-agent version.
|
|
11
11
|
// Claude Opus 5.5 requires 2.1.280 or newer. The release workflow raises this
|
|
12
12
|
// to the published CLI version (scripts/sync-client-version-floors.mjs).
|
|
13
|
-
export const DEFAULT_CLI_VERSION = '2.1.
|
|
13
|
+
export const DEFAULT_CLI_VERSION = '2.1.316';
|
|
14
14
|
export const CLAUDE_CLI_NPM_PACKAGE = '@anthropic-ai/claude-code';
|
|
15
15
|
|
|
16
16
|
const CACHE_SCHEMA_VERSION = 1;
|
|
@@ -63,6 +63,10 @@ export function createContentBlockStart({ turn, blocks, state, progress, seedTex
|
|
|
63
63
|
// The call opened; its input still streams before onToolCall.
|
|
64
64
|
reportStreamItemStart(onStreamItemStart, { kind: 'tool' });
|
|
65
65
|
}
|
|
66
|
+
// Any output block opening starts the generation (generation-window.mjs),
|
|
67
|
+
// a thinking block above all: under omitted or "updates" thinking display
|
|
68
|
+
// it streams nothing until its signature at the end.
|
|
69
|
+
if (block?.type && !fallback) turn.firstOutputAt ||= Date.now();
|
|
66
70
|
if (block?.type === 'text') {
|
|
67
71
|
// Seed the ordered text slot. An empty block still needs its slot (it
|
|
68
72
|
// separates thinking runs); a non-empty opening `text` is model output
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
import { makeInvalidToolArgsMarker } from '../../lib/openai-tool-args.mjs';
|
|
8
8
|
import { OAUTH_STREAM_LABELS } from '../../lib/anthropic-stream-labels.mjs';
|
|
9
9
|
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
10
|
+
// A bare JSON.parse would throw into the surrounding broad catch, which
|
|
11
|
+
// swallows the whole tool_call — the loop never sees it and the assistant
|
|
12
|
+
// turn ends with an unmatched tool_use id. A malformed input still
|
|
13
13
|
// produces a tool_call (with an invalid-args marker and a logged error)
|
|
14
14
|
// instead of a silent drop or accidental `{}` dispatch. Tool arguments must
|
|
15
15
|
// be a plain object: Anthropic's tool_use input is always a JSON object, but
|
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { stampStreamOutcome, STREAM_TRANSPORTS } from '../lib/stream-outcome.mjs';
|
|
9
9
|
import { createProviderReplay } from '../lib/provider-replay.mjs';
|
|
10
|
+
import { generationWindow } from '../lib/generation-window.mjs';
|
|
10
11
|
import { OAUTH_STREAM_LABELS } from '../lib/anthropic-stream-labels.mjs';
|
|
11
12
|
import { anthropicFallbackProviderMetadata } from '../anthropic-server-fallback.mjs';
|
|
12
13
|
|
|
@@ -155,6 +156,7 @@ export function createTurnOutcome({ turn, blocks, state, labels = OAUTH_STREAM_L
|
|
|
155
156
|
assistantBlocks,
|
|
156
157
|
providerReplay: createProviderReplay('anthropic', assistantBlocks),
|
|
157
158
|
providerMetadata: anthropicFallbackProviderMetadata(turn.fallbackEvents),
|
|
159
|
+
...generationWindow(turn.firstOutputAt),
|
|
158
160
|
};
|
|
159
161
|
};
|
|
160
162
|
|
|
@@ -83,6 +83,8 @@ export function buildAnthropicTurnResult(parseResult, { provider, useModel, opts
|
|
|
83
83
|
...(parseResult.providerMetadata && typeof parseResult.providerMetadata === 'object'
|
|
84
84
|
? { providerMetadata: parseResult.providerMetadata }
|
|
85
85
|
: {}),
|
|
86
|
+
// The answering stream's own generation window (generation-window.mjs).
|
|
87
|
+
...(parseResult.generationMs != null ? { generationMs: parseResult.generationMs } : {}),
|
|
86
88
|
usage: {
|
|
87
89
|
inputTokens: input,
|
|
88
90
|
outputTokens: output,
|
|
@@ -186,6 +186,7 @@ export class AnthropicProvider {
|
|
|
186
186
|
fastModeLatched: this.fastModeBetaHeaderLatched,
|
|
187
187
|
modelInfo: isCustomProviderName(this.name) ? this.getCachedModelInfo?.(model) || null : null,
|
|
188
188
|
capabilityModel: this._capabilityModel(model),
|
|
189
|
+
customConfig: this.customConfig ?? null,
|
|
189
190
|
});
|
|
190
191
|
return sendAnthropicCacheWarm({
|
|
191
192
|
providerName: this.name,
|
|
@@ -229,6 +230,7 @@ export class AnthropicProvider {
|
|
|
229
230
|
// Custom providers carry per-model reasoning settings on their own rows.
|
|
230
231
|
modelInfo: isCustomProviderName(this.name) ? this.getCachedModelInfo?.(useModel) || null : null,
|
|
231
232
|
capabilityModel: this._capabilityModel(useModel),
|
|
233
|
+
customConfig: this.customConfig ?? null,
|
|
232
234
|
});
|
|
233
235
|
this.fastModeBetaHeaderLatched = fastModeLatched;
|
|
234
236
|
|
|
@@ -20,7 +20,7 @@ import { createNpmVersionSource, maxSemver } from './npm-cli-version.mjs';
|
|
|
20
20
|
// version (gpt-6.1-sol requires >= 0.159.0, measured 2026-10-09), so the
|
|
21
21
|
// release workflow raises this to the published CLI version on every release
|
|
22
22
|
// (scripts/sync-client-version-floors.mjs).
|
|
23
|
-
export const CODEX_CLIENT_VERSION_FLOOR = '0.
|
|
23
|
+
export const CODEX_CLIENT_VERSION_FLOOR = '0.166.0';
|
|
24
24
|
export const CODEX_CLI_NPM_PACKAGE = '@openai/codex';
|
|
25
25
|
const live = createNpmVersionSource(CODEX_CLI_NPM_PACKAGE, { persistKey: 'codex-cli' });
|
|
26
26
|
|