mixdog 1.4.1 → 1.4.3
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 +4 -3
- package/scripts/build-shipped-history.mjs +125 -33
- package/scripts/gate-local.mjs +220 -63
- package/scripts/graph-parity.mjs +8 -3
- package/scripts/lib/gate-scheduler.mjs +139 -32
- package/scripts/lib/gate-timing-reporter.mjs +16 -0
- package/scripts/lib/run-node-tests.mjs +71 -34
- package/scripts/lib/scoped-temp.mjs +1 -0
- package/scripts/lib/test-failure-records.mjs +14 -1
- package/scripts/lib/test-failure-summary.mjs +9 -4
- package/scripts/lib/test-spawn-ledger.mjs +43 -3
- package/scripts/post-release-check.mjs +26 -16
- package/scripts/pptx-kit-index.mjs +5 -6
- package/scripts/provider-pingpong-live.mjs +1 -1
- package/scripts/prune-embedding-runtime.mjs +3 -1
- package/scripts/release-paths.mjs +7 -1
- package/scripts/suite-health.mjs +110 -28
- package/scripts/test.mjs +9 -14
- package/src/agents/advisor/AGENT.md +4 -4
- package/src/agents/advisor/agent.json +1 -1
- package/src/agents/explore/AGENT.md +22 -0
- package/src/agents/explore/agent.json +6 -0
- package/src/cli.mjs +7 -0
- package/src/defaults/agents.json +7 -0
- package/src/defaults/shipped-history.json +38 -2
- package/src/defaults/skills/browser-use/SKILL.md +4 -1
- package/src/defaults/skills/code-tidy/SKILL.md +71 -102
- package/src/defaults/skills/code-tidy/references/agent-cleanup.md +66 -114
- package/src/defaults/skills/code-tidy/references/cleanup-report.md +19 -35
- package/src/defaults/skills/code-tidy/references/dead-code.md +3 -9
- package/src/defaults/skills/code-tidy/references/test-suite-slop.md +16 -27
- package/src/defaults/skills/computer-use/SKILL.md +12 -2
- package/src/defaults/skills/setup/SKILL.md +2 -2
- package/src/defaults/skills/setup/references/actions.md +28 -9
- package/src/defaults/skills/setup/references/surfaces.md +5 -2
- package/src/defaults/skills/setup-guide/SKILL.md +11 -3
- package/src/defaults/skills/setup-guide/model-recommendations.json +13 -0
- package/src/defaults/skills/skill-creator/SKILL.md +85 -190
- package/src/defaults/skills/skill-creator/references/design.md +70 -162
- package/src/defaults/skills/skill-creator/references/evaluation.md +33 -92
- package/src/defaults/skills/test-suite/SKILL.md +194 -0
- package/src/defaults/skills/test-suite/references/case-management.md +51 -0
- package/src/defaults/skills/test-suite/references/flaky-policy.md +39 -0
- package/src/defaults/skills/test-suite/references/reliability.md +49 -0
- package/src/defaults/skills/test-suite/references/suite-design.md +78 -0
- package/src/defaults/skills/test-suite/scripts/inventory.mjs +335 -0
- package/src/defaults/skills/visualize/SKILL.md +6 -2
- package/src/lib/instruction-text.cjs +36 -0
- package/src/lib/rules-builder.cjs +40 -50
- 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 +2 -2
- package/src/rules/lead/LEAD.md +3 -3
- package/src/rules/shared/20-research.md +3 -6
- package/src/rules/shared/40-editing.md +1 -0
- package/src/rules/shared/60-verification.md +10 -9
- package/src/rules/shared/70-delivery.md +4 -3
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/abort-link.mjs +5 -1
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/session-prep.mjs +3 -3
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +10 -2
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +132 -21
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +13 -9
- package/src/runtime/agent/orchestrator/agent-runtime/heartbeat-completion.mjs +2 -2
- package/src/runtime/agent/orchestrator/agent-runtime/maintenance-route.mjs +4 -1
- 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/config.mjs +12 -7
- package/src/runtime/agent/orchestrator/context/deferred-tools.mjs +7 -7
- package/src/runtime/agent/orchestrator/context/role-instructions.mjs +9 -30
- package/src/runtime/agent/orchestrator/internal-agents.mjs +3 -14
- package/src/runtime/agent/orchestrator/mcp/agent-connectors.mjs +124 -12
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +204 -49
- package/src/runtime/agent/orchestrator/mcp/client-config.mjs +16 -7
- package/src/runtime/agent/orchestrator/mcp/client-transport.mjs +157 -57
- package/src/runtime/agent/orchestrator/mcp/client.mjs +54 -23
- 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-login.mjs +83 -52
- 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 +43 -27
- package/src/runtime/agent/orchestrator/providers/account-pool.mjs +43 -8
- package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +30 -28
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +31 -21
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-stop.mjs +3 -3
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth-login.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth-tokens.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/command-code-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/custom-provider-config.mjs +40 -0
- package/src/runtime/agent/orchestrator/providers/custom-provider-keys.mjs +34 -0
- package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/devin-auth.mjs +14 -7
- package/src/runtime/agent/orchestrator/providers/devin-wire-transport.mjs +3 -2
- package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/gemini-thinking.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +48 -31
- package/src/runtime/agent/orchestrator/providers/lib/oauth-page.mjs +0 -18
- package/src/runtime/agent/orchestrator/providers/lib/oauth-token-utils.mjs +138 -6
- package/src/runtime/agent/orchestrator/providers/mimo-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/model-cache.mjs +100 -33
- package/src/runtime/agent/orchestrator/providers/muse-code-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/oauth-secret-fields.fixtures.mjs +45 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-response-normalization.mjs +4 -6
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses-head-parity.json +2784 -2872
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai.mjs +5 -8
- package/src/runtime/agent/orchestrator/providers/openai-oauth-login.mjs +26 -28
- package/src/runtime/agent/orchestrator/providers/openai-responses-payload-parity.fixture.json +288 -300
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream/event-switch.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-watchdogs.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/opencode-go-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/registry.mjs +33 -2
- package/src/runtime/agent/orchestrator/providers/vertex-ai-auth.mjs +622 -0
- package/src/runtime/agent/orchestrator/providers/vertex-ai-maas.mjs +185 -0
- package/src/runtime/agent/orchestrator/providers/vertex-ai-models.mjs +445 -0
- package/src/runtime/agent/orchestrator/providers/vertex-ai.mjs +576 -0
- package/src/runtime/agent/orchestrator/providers/xai-tool-search-head-parity.json +10 -30
- package/src/runtime/agent/orchestrator/runtime-core/builtin-features.mjs +32 -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 -47
- 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 +12 -0
- package/src/runtime/agent/orchestrator/runtime-core/tool-catalog.mjs +119 -35
- package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +4 -1
- package/src/runtime/agent/orchestrator/runtime-core/workflow/context.mjs +15 -6
- package/src/runtime/agent/orchestrator/runtime-core/workflow-ids.mjs +1 -0
- 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/agent-room.d.mts +30 -5
- package/src/runtime/agent/orchestrator/session/agent-room.mjs +171 -37
- package/src/runtime/agent/orchestrator/session/attachment-preflight.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/cache-warm.mjs +94 -10
- 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 +4 -4
- package/src/runtime/agent/orchestrator/session/conversation-import/codex.mjs +11 -6
- package/src/runtime/agent/orchestrator/session/conversation-import/convert.mjs +6 -6
- package/src/runtime/agent/orchestrator/session/conversation-import/imported-session.mjs +7 -3
- package/src/runtime/agent/orchestrator/session/conversation-import/turns.mjs +11 -1
- package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +4 -3
- package/src/runtime/agent/orchestrator/session/human-gate/held-message.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/human-gate/requests.mjs +37 -8
- 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/fresh-context.mjs +5 -3
- 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 +27 -3
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/dispatch.mjs +18 -2
- package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +23 -1
- package/src/runtime/agent/orchestrator/session/loop/turn-limits.mjs +13 -8
- 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 +103 -50
- 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 +20 -0
- package/src/runtime/agent/orchestrator/session/manager/rules-cache.mjs +22 -14
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +12 -0
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +15 -0
- package/src/runtime/agent/orchestrator/session/manager/session-fallback-title.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +56 -14
- package/src/runtime/agent/orchestrator/session/manager/session-lock.mjs +31 -0
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +59 -20
- package/src/runtime/agent/orchestrator/session/manager/session-record.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/manager/session-scratch-environment.mjs +70 -0
- package/src/runtime/agent/orchestrator/session/manager/session-tool-surface.mjs +0 -3
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +18 -4
- 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 +48 -30
- package/src/runtime/agent/orchestrator/session/manager/turn-reap.mjs +125 -0
- 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 +12 -6
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +8 -1
- package/src/runtime/agent/orchestrator/session/restart-prefix-parity.fixture.mjs +1 -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-summary-reader.mjs +243 -38
- package/src/runtime/agent/orchestrator/session/store-transcript-cache.mjs +163 -64
- package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +177 -8
- package/src/runtime/agent/orchestrator/session/store-transcript-worker.mjs +142 -18
- package/src/runtime/agent/orchestrator/session/store.mjs +5 -0
- 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/completed-result.mjs +6 -2
- 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 +42 -28
- package/src/runtime/agent/orchestrator/tools/builtin/git-worktree-tool.mjs +30 -14
- package/src/runtime/agent/orchestrator/tools/builtin/lib/search-input-helpers.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-records.mjs +58 -20
- 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/runtime-capabilities.mjs +20 -15
- package/src/runtime/agent/orchestrator/tools/builtin/search-tool.mjs +0 -10
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +95 -20
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +59 -10
- 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/graph-manifest.json +13 -13
- package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.mjs +99 -2
- package/src/runtime/agent/orchestrator/tools/lib/owned-shell-trees.mjs +2 -0
- package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +105 -15
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promote-job.mjs +3 -1
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-settle.mjs +49 -15
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-spawn.mjs +45 -27
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +35 -11
- package/src/runtime/agent/orchestrator/tools/lib/shell-warm-standby.mjs +2 -0
- package/src/runtime/agent/orchestrator/tools/lib/wait-until-fixture.mjs +26 -0
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +7 -6
- package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +0 -1
- package/src/runtime/agent/orchestrator/tools/spawn-manifest.json +13 -13
- 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/scheduler.mjs +33 -0
- package/src/runtime/channels/lib/schedules-db.mjs +11 -4
- package/src/runtime/channels/lib/webhook/session-dispatch.mjs +4 -1
- package/src/runtime/channels/lib/webhooks-db.mjs +9 -3
- package/src/runtime/channels/lib/whisper-port.mjs +19 -10
- package/src/runtime/channels/lib/whisper-server.mjs +22 -13
- package/src/runtime/channels/lib/worker-main.mjs +9 -31
- package/src/runtime/computer-bridge/linux-readiness.mjs +10 -14
- package/src/runtime/connectors/connector-accounts-mcp.mjs +372 -103
- package/src/runtime/connectors/gmail-app-password.mjs +4 -4
- 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 +88 -0
- package/src/runtime/explore/tool-defs.mjs +35 -0
- package/src/runtime/explore/tool.mjs +123 -0
- 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 +15 -1
- package/src/runtime/memory/lib/embedding-provider.mjs +4 -1
- package/src/runtime/memory/lib/embedding-reindex.mjs +27 -0
- package/src/runtime/memory/lib/embedding-worker.mjs +4 -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/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/office/quality/assurance-structure-docx.mjs +1 -1
- package/src/runtime/shared/agent-route-config.mjs +17 -2
- package/src/runtime/shared/atomic-file.d.mts +8 -0
- package/src/runtime/shared/atomic-file.mjs +103 -2
- package/src/runtime/shared/background-tasks.mjs +37 -10
- 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-accounts.mjs +5 -5
- package/src/runtime/shared/connector-catalog.d.mts +14 -8
- package/src/runtime/shared/connector-catalog.mjs +70 -52
- package/src/runtime/shared/custom-provider-keys.mjs +20 -0
- package/src/runtime/shared/file-has-data.mjs +26 -2
- package/src/runtime/shared/file-lock.mjs +21 -18
- package/src/runtime/shared/git-launch.d.mts +9 -0
- package/src/runtime/shared/git-launch.mjs +213 -0
- package/src/runtime/shared/git-runner-worker.mjs +2 -1
- package/src/runtime/shared/git-runner.mjs +7 -2
- package/src/runtime/shared/idle-gc.mjs +30 -7
- package/src/runtime/shared/llm/cost.mjs +6 -1
- package/src/runtime/shared/llm/http-agent.mjs +316 -29
- package/src/runtime/shared/llm/model-catalog-projection.mjs +3 -2
- package/src/runtime/shared/llm/model-catalog.mjs +46 -6
- package/src/runtime/shared/llm/provider-catalog-registry.mjs +3 -0
- package/src/runtime/shared/llm/system-proxy.mjs +453 -0
- package/src/runtime/shared/llm/usage-ledger-quota.mjs +31 -12
- package/src/runtime/shared/llm/usage-ledger-rollup.mjs +84 -8
- package/src/runtime/shared/llm/usage-ledger.mjs +3 -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/provider-accounts.mjs +52 -2
- 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/staged-install-worker.mjs +5 -0
- package/src/runtime/shared/staged-update.mjs +47 -2
- 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-surface.mjs +110 -36
- package/src/runtime/shared/tool-work-units.mjs +35 -6
- package/src/runtime/shared/turn-snapshot.mjs +26 -4
- package/src/runtime/shared/turn-worktree-snapshot.mjs +409 -54
- package/src/runtime/shared/worker-requests.mjs +17 -3
- package/src/runtime/shared/worktrees/activity-gate.mjs +215 -318
- package/src/runtime/shared/worktrees/activity-ledger-worker.mjs +56 -0
- package/src/runtime/shared/worktrees/activity-ledger.mjs +391 -0
- package/src/runtime/shared/worktrees/branch-management.mjs +5 -3
- 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 +97 -7
- 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 +962 -197
- 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/install.mjs +95 -15
- package/src/runtime/tidy/languages.mjs +17 -15
- package/src/runtime/tidy/process.mjs +9 -5
- package/src/runtime/tidy/resolve.mjs +19 -16
- package/src/runtime/tidy/runners/biome.mjs +3 -3
- package/src/runtime/tidy/tool.mjs +1 -1
- package/src/runtime/tidy/worktree.mjs +10 -6
- package/src/runtime/visualize-bridge/client.mjs +4 -1
- package/src/runtime/visualize-bridge/tool-defs.mjs +7 -2
- package/src/runtime/web-search/index.mjs +4 -23
- 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-profile-changes.mjs +55 -4
- package/src/session-runtime/agent-task-sessions.mjs +410 -353
- package/src/session-runtime/boot/apis.mjs +27 -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 +71 -25
- package/src/session-runtime/bot-status.mjs +103 -103
- 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/connector-merge-migration.mjs +18 -15
- package/src/session-runtime/conversation-import/discovery.mjs +245 -47
- package/src/session-runtime/conversation-import/service.mjs +12 -5
- package/src/session-runtime/goal-facade-api.mjs +49 -3
- package/src/session-runtime/handoff-attachments.mjs +1 -1
- package/src/session-runtime/held-requests.mjs +3 -1
- package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +3 -0
- package/src/session-runtime/internal-tool-executor/bridge-tools.mjs +3 -2
- package/src/session-runtime/internal-tool-executor/feature-tools.mjs +5 -11
- package/src/session-runtime/internal-tool-executor/knowledge-tools.mjs +8 -0
- package/src/session-runtime/internal-tool-executor/workspace-tools.mjs +161 -120
- 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 +10 -5
- package/src/session-runtime/lifecycle/teardown.mjs +1 -1
- package/src/session-runtime/lifecycle-api.mjs +1 -0
- package/src/session-runtime/mcp-glue/server-catalog.mjs +27 -10
- package/src/session-runtime/mcp-glue/server-connection.mjs +34 -8
- package/src/session-runtime/mcp-glue/server-input.mjs +4 -1
- package/src/session-runtime/mixy-heartbeat.mjs +1 -1
- 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/login.mjs +2 -2
- 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-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-api.mjs +98 -35
- package/src/session-runtime/resource-mcp-connector-accounts.mjs +49 -32
- package/src/session-runtime/resource-mcp-secrets.mjs +27 -10
- package/src/session-runtime/resource-mcp-servers.mjs +5 -4
- 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/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-tool/job-task-reconcile.mjs +6 -1
- package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +7 -0
- package/src/session-runtime/services/agent-tool/send-flow.mjs +120 -8
- 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-prep.mjs +8 -3
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +28 -7
- package/src/session-runtime/services/agent-tool.mjs +51 -1
- package/src/session-runtime/services/agent-watchdog-registry.mjs +32 -4
- package/src/session-runtime/services/channel-admin.mjs +18 -0
- package/src/session-runtime/services/channel-worker/daemon-spawn.mjs +2 -0
- package/src/session-runtime/services/daemon-candidate.mjs +4 -1
- package/src/session-runtime/services/hook-bus/command-handler.mjs +7 -11
- package/src/session-runtime/services/memory-runtime-proxy/daemon-spawn.mjs +4 -0
- package/src/session-runtime/services/plugin-admin.mjs +14 -6
- package/src/session-runtime/services/provider-admin.mjs +281 -10
- 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/session-turn-api.mjs +2 -0
- package/src/session-runtime/settings-builtin-tools-api.mjs +5 -10
- package/src/session-runtime/settings-system-api.mjs +1 -1
- package/src/session-runtime/setup-tool/agent-settings-actions.mjs +13 -3
- package/src/session-runtime/setup-tool/connector-widen-approval.mjs +96 -0
- package/src/session-runtime/setup-tool/executor.mjs +14 -3
- package/src/session-runtime/setup-tool/extended-actions.mjs +2 -0
- package/src/session-runtime/setup-tool/settings-contract.mjs +28 -0
- package/src/session-runtime/setup-tool/tool-defs.mjs +28 -2
- 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 +33 -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/webhook-session-run.mjs +2 -0
- package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +46 -11
- package/src/session-runtime/workflow-agents-api/agent-route.mjs +2 -0
- 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/activity-guards.mjs +176 -0
- package/src/session-runtime/workspace/project-branches.mjs +1 -1
- package/src/session-runtime/workspace/session-view.mjs +149 -0
- package/src/session-runtime/workspace/side-checkouts.mjs +203 -0
- package/src/session-runtime/workspace/transition-runner.mjs +188 -0
- package/src/session-runtime/workspace/transitions.mjs +128 -1070
- package/src/session-runtime/workspace/workspace-merge.mjs +132 -0
- package/src/session-runtime/workspace/worktree-intents.mjs +242 -0
- package/src/session-runtime/workspace/worktree-maintenance.mjs +200 -0
- package/src/session-runtime/workspace/worktree-setup.mjs +97 -0
- package/src/session-runtime/workspace/worktree-tool.mjs +70 -54
- package/src/standalone/daemon-agent-control.mjs +25 -8
- package/src/standalone/daemon-desktop-runtime.mjs +8 -2
- package/src/standalone/daemon-lag-profiler.mjs +7 -7
- package/src/standalone/daemon-session-control.mjs +151 -136
- package/src/standalone/daemon.mjs +61 -2
- package/src/standalone/desktop-service-registry.mjs +9 -0
- package/src/standalone/local-session-runtime.mjs +21 -1
- package/src/standalone/session-client/daemon-unavailable.mjs +4 -1
- package/src/standalone/session-client.mjs +5 -1
- package/src/standalone/session-frame-stream.mjs +83 -11
- package/src/standalone/session-protocol.mjs +15 -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/agent-tree.mjs +45 -9
- package/src/standalone/session-service/projection/transcript-window.mjs +700 -64
- package/src/standalone/session-service/quota-resume.mjs +9 -0
- 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/session-views.mjs +160 -104
- package/src/standalone/session-service/session-calls/turn-gate.mjs +34 -0
- package/src/standalone/session-service/session-calls.mjs +2 -1
- package/src/standalone/session-service/stored-reader.mjs +127 -40
- package/src/tui/App.jsx +162 -164
- package/src/tui/app/app-view/floating-panel.jsx +3 -0
- package/src/tui/app/app-view/text-entry-labels.mjs +1 -0
- package/src/tui/app/clipboard.mjs +22 -11
- package/src/tui/app/create-app-pickers.mjs +2 -0
- package/src/tui/app/doctor.mjs +2 -2
- package/src/tui/app/panel-signature.mjs +1 -1
- package/src/tui/app/prompt-handlers/use-prompt-history-nav.mjs +1 -1
- package/src/tui/app/prompt-handlers/use-prompt-interrupt.mjs +3 -0
- package/src/tui/app/prompt-submit/provider-prompts.mjs +3 -1
- package/src/tui/app/provider-setup/api-key-actions.mjs +31 -1
- package/src/tui/app/provider-setup/oauth-actions.mjs +25 -6
- package/src/tui/app/provider-setup-picker.mjs +20 -13
- package/src/tui/app/settings-picker.mjs +53 -8
- package/src/tui/app/shell-layout/row-budgets.mjs +14 -12
- package/src/tui/app/slash-commands.mjs +2 -1
- package/src/tui/app/slash-dispatch/route-commands.mjs +1 -1
- package/src/tui/app/slash-dispatch/session-commands.mjs +47 -1
- package/src/tui/app/slash-dispatch.mjs +1 -1
- package/src/tui/app/use-btw-panel.mjs +29 -0
- package/src/tui/app/use-context-panel-refresh.mjs +31 -0
- package/src/tui/app/use-model-catalog-cache.mjs +13 -10
- package/src/tui/app/use-mouse-input.mjs +11 -0
- package/src/tui/app/use-onboarding-start.mjs +8 -3
- package/src/tui/app/use-panel-transition.mjs +10 -1
- package/src/tui/app/use-pasted-buffers.mjs +28 -20
- package/src/tui/app/use-prompt-draft-flow.mjs +7 -0
- package/src/tui/app/use-prompt-layout-rows.mjs +3 -3
- package/src/tui/app/use-prompt-queue-history.mjs +5 -4
- package/src/tui/app/use-selection-focus.mjs +11 -2
- package/src/tui/app/use-selection-geometry.mjs +18 -9
- package/src/tui/app/use-selection-paint.mjs +4 -4
- package/src/tui/app/use-selection-stitch.mjs +3 -3
- package/src/tui/app/use-slash-palette.mjs +62 -0
- package/src/tui/app/use-terminal-chrome.mjs +2 -2
- package/src/tui/app/use-transcript-activity.mjs +48 -33
- package/src/tui/app/use-transcript-follow.mjs +12 -4
- package/src/tui/app/use-transcript-scroll.mjs +46 -17
- package/src/tui/app/use-transcript-swap-reset.mjs +27 -0
- package/src/tui/app/use-transcript-window/geometry.mjs +20 -6
- package/src/tui/app/use-transcript-window/instance-state.mjs +4 -0
- package/src/tui/app/use-transcript-window/selection-shift.mjs +5 -1
- package/src/tui/app/use-transcript-window.mjs +21 -11
- package/src/tui/app/use-tui-ready.mjs +18 -0
- package/src/tui/app/use-welcome-prompt-hint.mjs +5 -0
- package/src/tui/app/use-workflow-tab-cycle.mjs +5 -3
- package/src/tui/components/Picker.jsx +27 -3
- package/src/tui/components/SignInUrl.jsx +68 -0
- package/src/tui/components/TextEntryPanel.jsx +76 -46
- 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/sign-in-url-layout.mjs +24 -0
- 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 +2205 -1371
- 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/goal-turn-state.mjs +6 -2
- package/src/tui/session/quota-resume.mjs +1 -1
- package/src/tui/session/session-api/controls.mjs +4 -0
- package/src/tui/session/session-api/extensions.mjs +8 -0
- package/src/tui/session/session-api/intake/abort.mjs +2 -1
- package/src/tui/session/session-api/intake.mjs +2 -0
- package/src/tui/session/session-api/integrations.mjs +2 -2
- 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 +6 -0
- package/src/tui/session/session-api/settings.mjs +2 -2
- 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-card-results/grouped-result.mjs +2 -2
- package/src/tui/session/transcript-spill/spill-writer.mjs +15 -0
- package/src/tui/session/transcript-spill.mjs +92 -4
- package/src/tui/session/transcript-store.mjs +2 -0
- 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/defaults/skills/skill-creator/references/source-review.md +0 -94
- package/src/runtime/agent/orchestrator/runtime-core/goal-tasks.mjs +0 -156
- package/src/session-runtime/goal-tasks.mjs +0 -1
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
// manager/turn-durability.mjs
|
|
2
|
+
// One unsettled turn per session. A finished (or failed) turn stays
|
|
3
|
+
// unsettled — its checkpoint kept — until a landed save of its session
|
|
4
|
+
// carries the turn's coverage token (store/transcript-durability.mjs); only
|
|
5
|
+
// that acknowledgement deletes the checkpoint. The next turn of the session
|
|
6
|
+
// waits for it before it opens its own checkpoint or touches the session, and
|
|
7
|
+
// a save that cannot land blocks that turn with a TurnPersistenceError
|
|
8
|
+
// instead of releasing it. A settled promise, an idle queue or a coalesced,
|
|
9
|
+
// cancelled or dropped write is never an acknowledgement. Sessions are
|
|
10
|
+
// independent: nothing here waits on another session's saves.
|
|
11
|
+
import { readSessionLifecycleFromDisk, saveSessionAsync } from '../store.mjs';
|
|
12
|
+
import { landedTranscript, landedTranscriptMatches, mintTranscriptEpoch } from '../store/transcript-durability.mjs';
|
|
13
|
+
import { clearTurnCheckpoint } from './turn-checkpoint.mjs';
|
|
14
|
+
|
|
15
|
+
const _unsettled = new Map(); // sessionId → { session, turnToken, generation, ack, error }
|
|
16
|
+
|
|
17
|
+
export class TurnPersistenceError extends Error {
|
|
18
|
+
constructor(sessionId, message, cause = null) {
|
|
19
|
+
super(`Session ${sessionId}: ${message}${cause ? ` (${cause.message || cause})` : ''}`);
|
|
20
|
+
this.name = 'TurnPersistenceError';
|
|
21
|
+
this.code = 'ETURNNOTDURABLE';
|
|
22
|
+
this.sessionId = sessionId;
|
|
23
|
+
if (cause) this.cause = cause;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// Split-brain re-adoption: another surface (e.g. desktop click-through
|
|
28
|
+
// of a session still actively owned by this process) may have
|
|
29
|
+
// resumed-and-detached this session, bumping the ON-DISK generation
|
|
30
|
+
// while the conversation kept going here. Every save from this process
|
|
31
|
+
// would then be silently dropped by _shouldDrop's ownership rule and
|
|
32
|
+
// the on-disk transcript would freeze at the last landed save. A new
|
|
33
|
+
// ask on a NON-closed session is an explicit ownership claim: adopt
|
|
34
|
+
// the disk generation so this turn's commits land and heal the file.
|
|
35
|
+
export function adoptDiskGeneration(session, sessionId) {
|
|
36
|
+
const diskLifecycle = readSessionLifecycleFromDisk(sessionId);
|
|
37
|
+
if (
|
|
38
|
+
diskLifecycle &&
|
|
39
|
+
diskLifecycle.closed !== true &&
|
|
40
|
+
diskLifecycle.generation > (typeof session.generation === 'number' ? session.generation : 0)
|
|
41
|
+
) {
|
|
42
|
+
session.generation = diskLifecycle.generation;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/** Whether a landed save of `session` carries `turnToken`'s coverage. */
|
|
47
|
+
export function turnCoveredOnDisk(session, turnToken) {
|
|
48
|
+
return landedTranscript(session)?.coverage === turnToken;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function release(sessionId, entry) {
|
|
52
|
+
if (_unsettled.get(sessionId) !== entry) return;
|
|
53
|
+
_unsettled.delete(sessionId);
|
|
54
|
+
clearTurnCheckpoint(sessionId, entry.turnToken);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/** Keep `turnToken` (already the session's `turnCoverage`) unsettled until a
|
|
58
|
+
* landed save covers it; `save` is the save expected to. Resolves whether
|
|
59
|
+
* it did. */
|
|
60
|
+
export function holdTurnUntilDurable({ sessionId, session, turnToken, generation, save }) {
|
|
61
|
+
const entry = { session, turnToken, generation, error: null, ack: null };
|
|
62
|
+
_unsettled.set(sessionId, entry);
|
|
63
|
+
entry.ack = Promise.resolve(save)
|
|
64
|
+
.then(
|
|
65
|
+
() => turnCoveredOnDisk(session, turnToken),
|
|
66
|
+
(error) => {
|
|
67
|
+
entry.error = error;
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
.then((covered) => {
|
|
72
|
+
if (covered) release(sessionId, entry);
|
|
73
|
+
return covered;
|
|
74
|
+
});
|
|
75
|
+
return entry.ack;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/** Whether this process holds a turn of `sessionId` not yet durable. */
|
|
79
|
+
export function hasUnsettledTurn(sessionId) {
|
|
80
|
+
return _unsettled.has(sessionId);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/** A closed or deleted session: nothing will open on it again. */
|
|
84
|
+
export function forgetUnsettledTurn(sessionId) {
|
|
85
|
+
_unsettled.delete(sessionId);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Resolves once the previous turn of `sessionId` is durably covered (its
|
|
89
|
+
* checkpoint then deleted). When its own save did not land it, one fresh
|
|
90
|
+
* save of the finalized transcript is attempted; if that does not land
|
|
91
|
+
* either, throws TurnPersistenceError and the checkpoint stays. A save the
|
|
92
|
+
* ownership guard refused because another surface moved the disk generation
|
|
93
|
+
* is retried under that generation: this ask is the ownership claim that
|
|
94
|
+
* adoptDiskGeneration describes, and the retry stays guarded by it, so a
|
|
95
|
+
* closed session or a further handoff still refuses it. */
|
|
96
|
+
export async function awaitPreviousTurnDurable(sessionId) {
|
|
97
|
+
const entry = _unsettled.get(sessionId);
|
|
98
|
+
if (!entry || (await entry.ack)) return;
|
|
99
|
+
adoptDiskGeneration(entry.session, sessionId);
|
|
100
|
+
entry.generation = Math.max(entry.generation, entry.session.generation);
|
|
101
|
+
try {
|
|
102
|
+
await saveSessionAsync(entry.session, { expectedGeneration: entry.generation });
|
|
103
|
+
} catch (error) {
|
|
104
|
+
entry.error = error;
|
|
105
|
+
}
|
|
106
|
+
if (!turnCoveredOnDisk(entry.session, entry.turnToken)) {
|
|
107
|
+
throw new TurnPersistenceError(
|
|
108
|
+
sessionId,
|
|
109
|
+
'the previous turn is not saved to disk, so the next turn cannot start',
|
|
110
|
+
entry.error
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
release(sessionId, entry);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Make `session`'s current transcript durable, so a turn opening on it
|
|
117
|
+
* names a base that is on disk. A transcript that is not a pure extension
|
|
118
|
+
* of the last landed one (an unsaved rewrite) starts a new epoch first. */
|
|
119
|
+
export async function ensureDurableTranscript(session) {
|
|
120
|
+
if (landedTranscriptMatches(session)) return;
|
|
121
|
+
const landed = landedTranscript(session);
|
|
122
|
+
const messages = Array.isArray(session.messages) ? session.messages : [];
|
|
123
|
+
const extendsLanded =
|
|
124
|
+
landed &&
|
|
125
|
+
landed.epoch === session.transcriptEpoch &&
|
|
126
|
+
landed.refs.length <= messages.length &&
|
|
127
|
+
landed.refs.every((message, index) => message === messages[index]);
|
|
128
|
+
if (typeof session.transcriptEpoch !== 'string' || (landed && !extendsLanded)) {
|
|
129
|
+
session.transcriptEpoch = mintTranscriptEpoch();
|
|
130
|
+
}
|
|
131
|
+
let failure = null;
|
|
132
|
+
try {
|
|
133
|
+
await saveSessionAsync(session, { expectedGeneration: session.generation });
|
|
134
|
+
} catch (error) {
|
|
135
|
+
failure = error;
|
|
136
|
+
}
|
|
137
|
+
if (!landedTranscriptMatches(session)) {
|
|
138
|
+
throw new TurnPersistenceError(
|
|
139
|
+
session.id,
|
|
140
|
+
'the conversation is not saved to disk, so the next turn cannot start',
|
|
141
|
+
failure
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -195,8 +195,8 @@ function appendObservedTurnOutput(
|
|
|
195
195
|
}
|
|
196
196
|
}
|
|
197
197
|
|
|
198
|
-
|
|
199
|
-
|
|
198
|
+
function newInterruptionState() {
|
|
199
|
+
return {
|
|
200
200
|
responseStarted: false,
|
|
201
201
|
partialAssistantContent: '',
|
|
202
202
|
tombstonedAssistantContent: '',
|
|
@@ -213,7 +213,10 @@ export function createTurnInterruptionTracker() {
|
|
|
213
213
|
tombEpoch: 0,
|
|
214
214
|
callsEpoch: 0,
|
|
215
215
|
};
|
|
216
|
+
}
|
|
216
217
|
|
|
218
|
+
/** Streamed assistant text, including the tombstone of a retracted attempt. */
|
|
219
|
+
function textBufferMethods(state) {
|
|
217
220
|
return {
|
|
218
221
|
recordTextDelta(chunk) {
|
|
219
222
|
const value = String(chunk ?? '');
|
|
@@ -222,7 +225,7 @@ export function createTurnInterruptionTracker() {
|
|
|
222
225
|
// The replayed attempt has started producing its OWN text, so the
|
|
223
226
|
// retracted tail it replaces is no longer what the user is looking
|
|
224
227
|
// at. Dropping it here keeps exactly one copy of the opening
|
|
225
|
-
// instead of one per retry (a 3-retry stall
|
|
228
|
+
// instead of one per retry (a 3-retry stall would persist four
|
|
226
229
|
// copies of the same first sentence). Reference agents never
|
|
227
230
|
// commit a replayed attempt's discarded stream at all; the
|
|
228
231
|
// tombstone exists only for the window between a retraction and
|
|
@@ -263,33 +266,12 @@ export function createTurnInterruptionTracker() {
|
|
|
263
266
|
state.tombEpoch += 1;
|
|
264
267
|
return true;
|
|
265
268
|
},
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
state.responseStarted = true;
|
|
273
|
-
state.partialReasoningContent += value;
|
|
274
|
-
},
|
|
275
|
-
recordAssistantText(text) {
|
|
276
|
-
const value = String(text ?? '');
|
|
277
|
-
if (!value.trim()) return;
|
|
278
|
-
state.responseStarted = true;
|
|
279
|
-
// Buffered providers report the whole segment here; streaming
|
|
280
|
-
// providers already accumulated the same segment via text deltas.
|
|
281
|
-
if (!state.partialAssistantContent.trim()) state.partialAssistantContent += value;
|
|
282
|
-
},
|
|
283
|
-
markAssistantMessageCommitted() {
|
|
284
|
-
state.partialAssistantContent = '';
|
|
285
|
-
state.tombstonedAssistantContent = '';
|
|
286
|
-
state.partialReasoningContent = '';
|
|
287
|
-
state.observedToolCalls.clear();
|
|
288
|
-
state.textEpoch += 1;
|
|
289
|
-
state.reasoningEpoch += 1;
|
|
290
|
-
state.tombEpoch += 1;
|
|
291
|
-
state.callsEpoch += 1;
|
|
292
|
-
},
|
|
269
|
+
};
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
/** Tool calls and early-notified results observed during the turn. */
|
|
273
|
+
function toolObservationMethods(state) {
|
|
274
|
+
return {
|
|
293
275
|
recordToolCalls(calls, { eagerStarted = false } = {}) {
|
|
294
276
|
for (const call of Array.isArray(calls) ? calls : []) {
|
|
295
277
|
if (!call?.id) continue;
|
|
@@ -317,6 +299,42 @@ export function createTurnInterruptionTracker() {
|
|
|
317
299
|
state.observedToolResults.delete(callId);
|
|
318
300
|
}
|
|
319
301
|
},
|
|
302
|
+
};
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
export function createTurnInterruptionTracker() {
|
|
306
|
+
const state = newInterruptionState();
|
|
307
|
+
|
|
308
|
+
return {
|
|
309
|
+
...textBufferMethods(state),
|
|
310
|
+
...toolObservationMethods(state),
|
|
311
|
+
hasResponseStarted() {
|
|
312
|
+
return state.responseStarted;
|
|
313
|
+
},
|
|
314
|
+
recordReasoningDelta(chunk) {
|
|
315
|
+
const value = String(chunk ?? '');
|
|
316
|
+
if (!value) return;
|
|
317
|
+
state.responseStarted = true;
|
|
318
|
+
state.partialReasoningContent += value;
|
|
319
|
+
},
|
|
320
|
+
recordAssistantText(text) {
|
|
321
|
+
const value = String(text ?? '');
|
|
322
|
+
if (!value.trim()) return;
|
|
323
|
+
state.responseStarted = true;
|
|
324
|
+
// Buffered providers report the whole segment here; streaming
|
|
325
|
+
// providers already accumulated the same segment via text deltas.
|
|
326
|
+
if (!state.partialAssistantContent.trim()) state.partialAssistantContent += value;
|
|
327
|
+
},
|
|
328
|
+
markAssistantMessageCommitted() {
|
|
329
|
+
state.partialAssistantContent = '';
|
|
330
|
+
state.tombstonedAssistantContent = '';
|
|
331
|
+
state.partialReasoningContent = '';
|
|
332
|
+
state.observedToolCalls.clear();
|
|
333
|
+
state.textEpoch += 1;
|
|
334
|
+
state.reasoningEpoch += 1;
|
|
335
|
+
state.tombEpoch += 1;
|
|
336
|
+
state.callsEpoch += 1;
|
|
337
|
+
},
|
|
320
338
|
markProviderSendStarted() {
|
|
321
339
|
state.phase = 'streaming';
|
|
322
340
|
},
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
// manager/turn-reap.mjs
|
|
2
|
+
// A turn abandoned by a timeout or stall stops the background shell work that
|
|
3
|
+
// turn started — a job auto-promoted during it, and the survivors its commands
|
|
4
|
+
// left running. Only those: a user cancel, a steering interrupt, a normal
|
|
5
|
+
// finish, and jobs from earlier turns keep their jobs. Only the entry's own
|
|
6
|
+
// turn start is armed, and a new turn clears it, so a reap that runs late
|
|
7
|
+
// never touches a newer turn's work.
|
|
8
|
+
import { cancelBackgroundTasks, getBackgroundTask } from '../../../../shared/background-tasks.mjs';
|
|
9
|
+
import { runtimeState } from './runtime-state.mjs';
|
|
10
|
+
|
|
11
|
+
// Timeout ownership is explicit and turn-scoped: the code that makes a timeout
|
|
12
|
+
// WIN (the watchdog's own abort, the provider's terminal error) arms the reap
|
|
13
|
+
// itself, and only while nothing else has stopped the turn. An abort that
|
|
14
|
+
// arrives first stays a cancel; an error chain is never read afterwards.
|
|
15
|
+
|
|
16
|
+
// Codes of the runtime's own timeout/stall errors (stall-policy's
|
|
17
|
+
// streamStalledError / providerTimeoutError, the Gemini stream timeout).
|
|
18
|
+
const PROVIDER_TIMEOUT_CODES = new Set(['ESTREAMSTALL', 'EPROVIDERTIMEOUT', 'EGEMINITIMEOUT']);
|
|
19
|
+
|
|
20
|
+
/** A timeout is the first thing to stop this session's turn: arm its reap now,
|
|
21
|
+
* before the abort propagates. No-op when the turn's controller is already
|
|
22
|
+
* aborted (a cancel, interrupt or close won) or no turn runs. */
|
|
23
|
+
export function armTurnTimeout(id) {
|
|
24
|
+
const entry = runtimeState.get(id);
|
|
25
|
+
if (!entry || entry.controller?.signal.aborted) return;
|
|
26
|
+
armTurnShellReap(id, entry);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** The turn ended with a provider timeout/stall error that no retry recovered
|
|
30
|
+
* from: arm only while the turn's own signal is un-aborted and the error
|
|
31
|
+
* itself carries a timeout code or the producer's own `streamStalled` flag. */
|
|
32
|
+
export function armTurnTimeoutOnProviderError(id, entry, turnSignal, err) {
|
|
33
|
+
if (turnSignal?.aborted) return;
|
|
34
|
+
if (!PROVIDER_TIMEOUT_CODES.has(err?.code) && err?.streamStalled !== true) return;
|
|
35
|
+
armTurnShellReap(id, entry);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// session id -> jobs stopped by a timeout reap, until the owner's handoff
|
|
39
|
+
// reports them (or the session's next turn starts).
|
|
40
|
+
const stoppedJobs = new Map();
|
|
41
|
+
|
|
42
|
+
// What the cancel path already produces, read without waiting: a task whose
|
|
43
|
+
// own cancel hook kills (survivors of a finished command) answers with its
|
|
44
|
+
// kill outcome; a promoted job is over once its process tree is no longer
|
|
45
|
+
// tracked.
|
|
46
|
+
function trackStoppedJob(taskId) {
|
|
47
|
+
const job = { taskId, outcome: null, terminated: false };
|
|
48
|
+
const kill = getBackgroundTask(taskId)?.cancelOutcome;
|
|
49
|
+
if (kill) {
|
|
50
|
+
job.outcome = kill;
|
|
51
|
+
Promise.resolve(kill).then(
|
|
52
|
+
(result) => {
|
|
53
|
+
job.terminated = result?.terminated === true;
|
|
54
|
+
},
|
|
55
|
+
() => {}
|
|
56
|
+
);
|
|
57
|
+
}
|
|
58
|
+
return job;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// shell-jobs depends on the session manager, which loads this module, so it is
|
|
62
|
+
// loaded at the first reap. The classification awaits only this module load,
|
|
63
|
+
// never a process; a probe that cannot be loaded leaves a job "still stopping".
|
|
64
|
+
let shellJobProbe = null;
|
|
65
|
+
function loadShellJobProbe() {
|
|
66
|
+
shellJobProbe ??= import('../../tools/builtin/shell-jobs.mjs').then(
|
|
67
|
+
(shellJobs) => shellJobs.isShellJobRunning,
|
|
68
|
+
() => null
|
|
69
|
+
);
|
|
70
|
+
return shellJobProbe;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Confirmed by the runtime's own state, never assumed: a task whose cancel hook
|
|
74
|
+
// kills is confirmed by that kill's `terminated`; a promoted job once neither
|
|
75
|
+
// its native task nor its process-tree tracker is live. Without the probe
|
|
76
|
+
// (shell-jobs not loaded) nothing is confirmed.
|
|
77
|
+
function isConfirmedGone(job, isRunning) {
|
|
78
|
+
if (job.outcome) return job.terminated;
|
|
79
|
+
return Boolean(isRunning) && !isRunning(job.taskId);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
function reap(id, entry) {
|
|
83
|
+
loadShellJobProbe();
|
|
84
|
+
const { taskIds } = cancelBackgroundTasks({
|
|
85
|
+
surface: 'shell',
|
|
86
|
+
executionSessionId: id,
|
|
87
|
+
startedSinceMs: entry.shellReapSince,
|
|
88
|
+
reason: 'turn-timeout',
|
|
89
|
+
notify: false,
|
|
90
|
+
});
|
|
91
|
+
if (taskIds.length > 0) stoppedJobs.set(id, [...(stoppedJobs.get(id) || []), ...taskIds.map(trackStoppedJob)]);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** The turn is being abandoned by a timeout: remember when it started and stop
|
|
95
|
+
* what it has started so far. A settled (idle) entry has no turn to reap. */
|
|
96
|
+
export function armTurnShellReap(id, entry) {
|
|
97
|
+
if (!(entry?.askStartedAt > 0) || entry.closed) return;
|
|
98
|
+
entry.shellReapSince = entry.askStartedAt;
|
|
99
|
+
reap(id, entry);
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
/** The abandoned turn has unwound: sweep what it registered while stopping
|
|
103
|
+
* (survivors of its aborted commands). No-op unless this turn was armed. */
|
|
104
|
+
export function reapTurnShellJobs(id, entry) {
|
|
105
|
+
if (entry?.shellReapSince > 0 && !entry.closed && runtimeState.get(id) === entry) reap(id, entry);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/** A new turn owns the session: nothing earlier may be reaped on its account. */
|
|
109
|
+
export function resetTurnShellReap(id, entry) {
|
|
110
|
+
entry.shellReapSince = null;
|
|
111
|
+
stoppedJobs.delete(id);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** The jobs the reap stopped, split by what is known now: `stopped` are
|
|
115
|
+
* confirmed gone, `stopping` were killed but their processes are not yet
|
|
116
|
+
* confirmed gone (they keep being terminated). */
|
|
117
|
+
export async function takeStoppedShellJobs(id) {
|
|
118
|
+
const jobs = stoppedJobs.get(id) || [];
|
|
119
|
+
stoppedJobs.delete(id);
|
|
120
|
+
if (jobs.length === 0) return { stopped: [], stopping: [] };
|
|
121
|
+
const isRunning = await loadShellJobProbe();
|
|
122
|
+
const taskIds = (confirmed) =>
|
|
123
|
+
jobs.filter((job) => isConfirmedGone(job, isRunning) === confirmed).map((job) => job.taskId);
|
|
124
|
+
return { stopped: taskIds(true), stopping: taskIds(false) };
|
|
125
|
+
}
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { providerInputExcludesCache } from '../../providers/registry.mjs';
|
|
9
9
|
import { reasoningUsage, combineReasoningUsage } from '../../../../shared/llm/reasoning-usage.mjs';
|
|
10
10
|
import { foldUsageReadout } from '../../../../shared/usage-readout-totals.mjs';
|
|
11
|
+
import { emitSessionActivityChange } from '../../../../shared/session-activity-signal.mjs';
|
|
11
12
|
import {
|
|
12
13
|
loadSession,
|
|
13
14
|
saveSessionAsync,
|
|
@@ -560,6 +561,9 @@ export async function persistIterationMetrics(delta) {
|
|
|
560
561
|
// saved before this field began at their first call after it.
|
|
561
562
|
session.usageReadout = foldUsageReadout(session.usageReadout, delta, delta.requestMs);
|
|
562
563
|
recordLastContextTokens(session, iterationContext(delta));
|
|
564
|
+
// The Agents pool shows each agent's running totals from this live
|
|
565
|
+
// counter: it re-reads on this pulse instead of the next throttled save.
|
|
566
|
+
emitSessionActivityChange(sessionId);
|
|
563
567
|
}
|
|
564
568
|
session.lastIterationIndex = iterationIndex;
|
|
565
569
|
session.updatedAt = ts || Date.now();
|
|
@@ -65,7 +65,12 @@ export {
|
|
|
65
65
|
settlePendingMessageWrites,
|
|
66
66
|
markCompletionEntry,
|
|
67
67
|
COMPLETION_NOTIFICATION_KIND,
|
|
68
|
+
hasPendingMessages,
|
|
68
69
|
} from './manager/pending-messages.mjs';
|
|
70
|
+
// The per-session ask mutex every turn holds, tried without waiting, and the
|
|
71
|
+
// unsettled-turn check: the idle-only delete (session-delete.mjs) acts under them.
|
|
72
|
+
export { tryAcquireSessionLock, sessionLockContended } from './manager/session-lock.mjs';
|
|
73
|
+
export { hasUnsettledTurn } from './manager/turn-durability.mjs';
|
|
69
74
|
|
|
70
75
|
// ── Usage-metrics surface — re-exported unchanged so loop.mjs / smoke scripts
|
|
71
76
|
// keep resolving these through the facade. ────────────────────────────────
|
|
@@ -96,6 +101,7 @@ export { prewarmAgentLoop } from './manager/runtime-loaders.mjs';
|
|
|
96
101
|
export {
|
|
97
102
|
createSession,
|
|
98
103
|
updateSessionRoute,
|
|
104
|
+
holdSessionRoute,
|
|
99
105
|
prefetchSession,
|
|
100
106
|
prepareSessionProjection,
|
|
101
107
|
resumeSession,
|
|
@@ -3,15 +3,19 @@
|
|
|
3
3
|
// Every model- or user-facing string that names it reads this, re-read on each
|
|
4
4
|
// use so a rename applies at once. Text shared across agents (tool schemas,
|
|
5
5
|
// other agents' shared prompt block) says "the representative agent" instead,
|
|
6
|
-
// so a rename never changes cached bytes.
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// so a rename never changes those cached bytes. Each other bot's own contact
|
|
7
|
+
// catalog (workflow/context.mjs) names her, so a request naming her finds her.
|
|
8
|
+
// Light imports only: the prompt's contact catalog (workflow/context.mjs) reads
|
|
9
|
+
// the name too, and must not pull the skill catalog and config in with it.
|
|
10
|
+
import { readFileSync } from 'node:fs';
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { resolvePluginData } from '../../../shared/plugin-paths.mjs';
|
|
9
13
|
import { mixyIdentityDir } from '../../../shared/agent-store.mjs';
|
|
10
14
|
|
|
11
15
|
export const DEFAULT_MIXY_NAME = 'Mixy';
|
|
12
16
|
|
|
13
17
|
/** The display name in a lead manifest (agent.json), else Mixy. */
|
|
14
|
-
|
|
18
|
+
function mixyNameOf(manifest) {
|
|
15
19
|
const name = typeof manifest?.name === 'string' ? manifest.name.replace(/\s+/g, ' ').trim() : '';
|
|
16
20
|
return name || DEFAULT_MIXY_NAME;
|
|
17
21
|
}
|
|
@@ -19,9 +23,11 @@ export function mixyNameOf(manifest) {
|
|
|
19
23
|
export function mixyDisplayName() {
|
|
20
24
|
try {
|
|
21
25
|
// bots/mixy once Mixy is its own bot, agents/lead before (agent-store.mjs).
|
|
22
|
-
const dir = mixyIdentityDir(
|
|
23
|
-
return mixyNameOf(JSON.parse(
|
|
26
|
+
const dir = mixyIdentityDir(resolvePluginData());
|
|
27
|
+
return mixyNameOf(JSON.parse(readFileSync(join(dir, 'agent.json'), 'utf8')));
|
|
24
28
|
} catch {
|
|
29
|
+
// Never throws: prompt composition calls this unguarded, and the name only labels Mixy.
|
|
30
|
+
// A missing, empty, unreadable or malformed agent.json is the unrenamed default.
|
|
25
31
|
return DEFAULT_MIXY_NAME;
|
|
26
32
|
}
|
|
27
33
|
}
|
|
@@ -41,6 +41,7 @@ import {
|
|
|
41
41
|
snapshotPendingGoalReminder,
|
|
42
42
|
} from '../runtime-core/goal-reminder.mjs';
|
|
43
43
|
import { rearmLateDeferredTools } from '../runtime-core/tool-catalog.mjs';
|
|
44
|
+
import { rearmPromptSettingsNotice } from './manager/prompt-settings.mjs';
|
|
44
45
|
|
|
45
46
|
async function setStage(opts, stage) {
|
|
46
47
|
try {
|
|
@@ -437,7 +438,12 @@ function adoptCompactedTranscript(ctx, run) {
|
|
|
437
438
|
// The system prompt is rebuilt from current sources outside a running turn
|
|
438
439
|
// (session-runtime agent-profile-fold.mjs): the next cold point folds it in
|
|
439
440
|
// instead of adding a break to the turn that is already warm again.
|
|
440
|
-
|
|
441
|
+
// The fold runs at the next turn start (compactionFoldPending): it lists the
|
|
442
|
+
// late tools and the settings this compaction dropped the notices of.
|
|
443
|
+
if (sessionRef) {
|
|
444
|
+
sessionRef.promptFoldPending = true;
|
|
445
|
+
sessionRef.compactionFoldPending = true;
|
|
446
|
+
}
|
|
441
447
|
resetReadStateAfterCompaction(sessionId);
|
|
442
448
|
// Cross-turn receipts reference tool results that compaction just removed
|
|
443
449
|
// from context; a stub for them would point at nothing. Clear in place so
|
|
@@ -573,6 +579,7 @@ async function compactBeforeSend(ctx) {
|
|
|
573
579
|
// The adopted compaction strips late MCP tool announcements from older turns.
|
|
574
580
|
try {
|
|
575
581
|
rearmLateDeferredTools(sessionRef);
|
|
582
|
+
rearmPromptSettingsNotice(sessionRef);
|
|
576
583
|
} catch {
|
|
577
584
|
/* best-effort, like the Goal reminder: a tool reminder never fails the compaction */
|
|
578
585
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// Child process of restart-prefix-parity.test.mjs: one phase of a scripted
|
|
1
|
+
// Child process of restart-prefix-parity.slow.test.mjs: one phase of a scripted
|
|
2
2
|
// anthropic-oauth session in its own process, so a "restart" is a real new
|
|
3
3
|
// process reading the data dir the previous one left. The fake provider
|
|
4
4
|
// records the request body the real OAuth builder makes for every main-loop
|
|
@@ -60,9 +60,13 @@ parentPort.on('message', (message) => {
|
|
|
60
60
|
}
|
|
61
61
|
return;
|
|
62
62
|
}
|
|
63
|
-
const { session, delta, id, opts, reqId } = message || {};
|
|
63
|
+
const { session, delta, id, opts, reqId, dataDir } = message || {};
|
|
64
64
|
let full = session;
|
|
65
65
|
try {
|
|
66
|
+
// This realm's env was copied when the worker spawned; the parent's data
|
|
67
|
+
// dir may have moved since (save-worker.mjs _postAsyncWrite), and every
|
|
68
|
+
// path below resolves it from the env at call time.
|
|
69
|
+
if (dataDir) process.env.MIXDOG_DATA_DIR = dataDir;
|
|
66
70
|
const sessionId = id ?? session?.id;
|
|
67
71
|
if (!full && delta) {
|
|
68
72
|
const base = _baseMessages.get(sessionId);
|
|
@@ -190,7 +190,7 @@ export function withdrawPendingOwnCommit(target, scratchStamp) {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
/** Read-only lifecycle verdict of a pending peer commit whose identity `stamp` carries. */
|
|
193
|
-
|
|
193
|
+
function pendingOwnCommittedLifecycle(target, stamp) {
|
|
194
194
|
_absorbPeerCommits();
|
|
195
195
|
const pending = _pendingOwnCommits.get(target);
|
|
196
196
|
return pending && _sameScratchIdentity(pending.stamp, stamp) ? pending.value : null;
|
|
@@ -17,7 +17,7 @@ import { probePath, readTextFile, PROBE_PRESENT } from './fs-probe.mjs';
|
|
|
17
17
|
export const LEGACY_MARKER_SUFFIXES = ['.hb', '.own'];
|
|
18
18
|
// An older live owner rewrote `.hb` every ≤5s mid-turn and `.own` every ~20s
|
|
19
19
|
// while holding the session open; one untouched this long holds nothing.
|
|
20
|
-
|
|
20
|
+
const LEGACY_MARKER_FRESH_MS = 2 * 60 * 1000;
|
|
21
21
|
|
|
22
22
|
function processAlive(pid) {
|
|
23
23
|
try {
|
|
@@ -47,7 +47,7 @@ export function readLegacyMarker(path, now = Date.now()) {
|
|
|
47
47
|
|
|
48
48
|
/** Whether a legacy marker of the session names a live owner pid with a
|
|
49
49
|
* fresh heartbeat: that session is driven by another live process. */
|
|
50
|
-
|
|
50
|
+
function _legacyOwnerLivenessVeto(id, now = Date.now()) {
|
|
51
51
|
if (typeof id !== 'string' || !/^[A-Za-z0-9_-]+$/.test(id)) return false;
|
|
52
52
|
const dir = getStoreDir();
|
|
53
53
|
return LEGACY_MARKER_SUFFIXES.some((suffix) => {
|
|
@@ -18,6 +18,8 @@ import {
|
|
|
18
18
|
_acquireSessionIncarnation,
|
|
19
19
|
_releaseSessionIncarnation,
|
|
20
20
|
_isCurrentSessionIncarnation,
|
|
21
|
+
SAVE_OUTCOME_SAVED,
|
|
22
|
+
SAVE_OUTCOME_DROPPED,
|
|
21
23
|
SAVE_OUTCOME_STALE,
|
|
22
24
|
} from './live-state.mjs';
|
|
23
25
|
import {
|
|
@@ -33,6 +35,8 @@ import {
|
|
|
33
35
|
_sessionStoreTestMode,
|
|
34
36
|
} from './save-fault.mjs';
|
|
35
37
|
import { connectOwnCommitPeer } from './canonical-reader.mjs';
|
|
38
|
+
import { getPluginData } from '../../config.mjs';
|
|
39
|
+
import { captureTranscriptSnapshot, recordLandedTranscript } from './transcript-durability.mjs';
|
|
36
40
|
|
|
37
41
|
// ── Worker-thread async save ──────────────────────────────────────────────────
|
|
38
42
|
// Single long-lived Worker serializes all saveSessionAsync calls.
|
|
@@ -278,6 +282,7 @@ function _settleLandedWrite(
|
|
|
278
282
|
// built — never a row re-derived from the live session, which
|
|
279
283
|
// may already carry a newer (unwritten, possibly failing) turn.
|
|
280
284
|
_queueSessionSummaryUpsertRow(summaryRow, summaryVersion);
|
|
285
|
+
recordLandedTranscript(p.session, p.transcript, epoch);
|
|
281
286
|
// ONLY a landed write proves durability, so this is the only
|
|
282
287
|
// place the save-failure flag may be cleared — and only when
|
|
283
288
|
// THIS payload is at least as new as the newest failed/dropped
|
|
@@ -304,7 +309,14 @@ function _settleLandedWrite(
|
|
|
304
309
|
_rollbackCachedSessionSummary(id, summaryVersion);
|
|
305
310
|
_recordSaveDrop(id, epoch);
|
|
306
311
|
}
|
|
307
|
-
|
|
312
|
+
// Callers that act only on a durable write (e.g. a migration deleting its
|
|
313
|
+
// source) read this outcome; every other resolution leaves it undefined.
|
|
314
|
+
const settled = saved
|
|
315
|
+
? SAVE_OUTCOME_SAVED
|
|
316
|
+
: outcome === SAVE_OUTCOME_STALE
|
|
317
|
+
? SAVE_OUTCOME_STALE
|
|
318
|
+
: SAVE_OUTCOME_DROPPED;
|
|
319
|
+
for (const w of waiters) w.resolve(settled);
|
|
308
320
|
}
|
|
309
321
|
|
|
310
322
|
/**
|
|
@@ -531,6 +543,9 @@ function _postAsyncWrite(
|
|
|
531
543
|
{ forceFull = false, retriedFull = false } = {}
|
|
532
544
|
) {
|
|
533
545
|
const reqId = ++_saveWorkerReqId;
|
|
546
|
+
// Before the bytes are built: what this write will prove durable once it
|
|
547
|
+
// lands (store/transcript-durability.mjs).
|
|
548
|
+
const transcript = captureTranscriptSnapshot(session);
|
|
534
549
|
// The wire payload is built at POST time from the live session: N calls
|
|
535
550
|
// coalesced behind one in-flight write project ONCE (newest state), and a
|
|
536
551
|
// pure-append turn ships only the tail (see _buildWirePayload).
|
|
@@ -548,6 +563,7 @@ function _postAsyncWrite(
|
|
|
548
563
|
_saveWorkerPending.set(reqId, {
|
|
549
564
|
id,
|
|
550
565
|
session,
|
|
566
|
+
transcript,
|
|
551
567
|
attempt,
|
|
552
568
|
opts,
|
|
553
569
|
summaryVersion,
|
|
@@ -567,7 +583,12 @@ function _postAsyncWrite(
|
|
|
567
583
|
// Cheap key compare; posts only when the fault config/env moved.
|
|
568
584
|
_syncFaultToWorker(w);
|
|
569
585
|
const { attempt: _attempt, ...wireForPost } = wire;
|
|
570
|
-
|
|
586
|
+
// The worker's process.env is a copy taken at spawn, so a data dir that
|
|
587
|
+
// moved since (a pristine headless run per page) would otherwise keep
|
|
588
|
+
// receiving writes in the first run's removed directory. The dir current
|
|
589
|
+
// at POST time travels with the write: a write still queued in the worker
|
|
590
|
+
// when the env flips lands where its own session lives.
|
|
591
|
+
w.postMessage({ ...wireForPost, id, opts, reqId, dataDir: getPluginData() });
|
|
571
592
|
// Ref AFTER successful postMessage so a queue/throw failure path does
|
|
572
593
|
// not leave the worker held alive with no pending message. Paired with
|
|
573
594
|
// the unref in the message handler when count hits 0.
|
|
@@ -16,12 +16,12 @@ import { deleteSession } from '../session-delete.mjs';
|
|
|
16
16
|
import { readSweepRecord } from './sweep-record.mjs';
|
|
17
17
|
|
|
18
18
|
const DAY_MS = 24 * 60 * 60 * 1000;
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
const SUB_AGENT_ARCHIVE_AFTER_MS = 3 * DAY_MS;
|
|
20
|
+
const SUB_AGENT_DELETE_AFTER_MS = 30 * DAY_MS;
|
|
21
21
|
const PERMANENT_ID = /^sess_(?:home|room|rmem)_/;
|
|
22
22
|
// The desktop change an automatic archive applies: that one session, no
|
|
23
23
|
// cascade (an explicit archive of a parent takes its sub-agents along).
|
|
24
|
-
|
|
24
|
+
const SUB_AGENT_AUTO_ARCHIVE = Object.freeze({ archived: true, cascade: false });
|
|
25
25
|
|
|
26
26
|
const positive = (value) => (Number(value) > 0 ? Number(value) : 0);
|
|
27
27
|
|