mixdog 1.3.5 → 1.4.1
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/NOTICE.md +2 -2
- package/README.md +2 -2
- package/package.json +2 -11
- package/scripts/check-voice-runtime-inputs.mjs +25 -0
- package/scripts/daemon-stub.mjs +1 -1
- package/scripts/gate-local.mjs +16 -5
- package/scripts/latest-guard.mjs +21 -9
- package/scripts/lib/isolated-test-env.mjs +10 -5
- package/scripts/lib/run-node-tests.mjs +37 -37
- package/scripts/lib/scoped-temp.d.mts +16 -0
- package/scripts/lib/scoped-temp.mjs +123 -0
- package/scripts/lib/stale-temp.mjs +44 -0
- package/scripts/native-release-status.mjs +2 -2
- package/scripts/post-release-check.mjs +1 -6
- package/scripts/pptx-kit-index.mjs +17 -4
- package/scripts/recall-history-cases.json +1 -1
- package/scripts/suite-health.mjs +20 -2
- package/scripts/test-data-dir.mjs +10 -7
- package/scripts/test.mjs +7 -11
- package/src/agents/reviewer/AGENT.md +7 -11
- package/src/agents/reviewer/agent.json +1 -1
- package/src/app.mjs +4 -0
- package/src/defaults/shipped-history.json +22 -1
- package/src/defaults/skills/browser-use/SKILL.md +62 -12
- package/src/defaults/skills/code-tidy/SKILL.md +142 -270
- package/src/defaults/skills/code-tidy/references/agent-cleanup.md +4 -4
- package/src/defaults/skills/code-tidy/references/cleanup-report.md +31 -76
- package/src/defaults/skills/code-tidy/references/dead-code.md +6 -12
- package/src/defaults/skills/computer-use/SKILL.md +35 -9
- package/src/defaults/skills/setup/SKILL.md +22 -0
- package/src/defaults/skills/setup/references/actions.md +39 -5
- package/src/defaults/skills/setup/references/surfaces.md +11 -2
- package/src/defaults/skills/visualize/SKILL.md +2 -1
- package/src/lib/rules-builder.cjs +39 -20
- package/src/output-styles/common.md +2 -2
- package/src/output-styles/simple.md +1 -1
- package/src/rules/agent/AGENT.md +11 -10
- package/src/rules/lead/LEAD.md +23 -20
- package/src/rules/shared/05-tool-calls.md +5 -6
- package/src/rules/shared/10-tool-workflow.md +4 -0
- package/src/rules/shared/45-destructive.md +0 -2
- package/src/rules/shared/50-execution.md +2 -0
- package/src/rules/shared/60-verification.md +7 -5
- package/src/rules/shared/70-delivery.md +7 -9
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +29 -6
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +2 -3
- package/src/runtime/agent/orchestrator/agent-runtime/title-completion.mjs +3 -1
- package/src/runtime/agent/orchestrator/agent-trace-format.mjs +3 -1
- package/src/runtime/agent/orchestrator/cache-break-trace.mjs +2 -0
- package/src/runtime/agent/orchestrator/config.mjs +17 -1
- package/src/runtime/agent/orchestrator/context/collect.mjs +3 -0
- package/src/runtime/agent/orchestrator/context/deferred-tools.mjs +73 -68
- package/src/runtime/agent/orchestrator/context/skill-catalog.mjs +57 -2
- package/src/runtime/agent/orchestrator/mcp/agent-connectors.mjs +3 -3
- package/src/runtime/agent/orchestrator/mcp/client-transport.mjs +176 -72
- package/src/runtime/agent/orchestrator/mcp/client.mjs +19 -0
- package/src/runtime/agent/orchestrator/mcp/oauth-login.mjs +5 -2
- package/src/runtime/agent/orchestrator/providers/account-pool.mjs +192 -133
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +42 -6
- package/src/runtime/agent/orchestrator/providers/anthropic-api-recovery.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +7 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +8 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-cache-warm.mjs +165 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-max-tokens-recovery.mjs +6 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-request/gzip-post.mjs +14 -14
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-request/initial-status.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +159 -69
- package/src/runtime/agent/orchestrator/providers/anthropic-overload-fallback.mjs +25 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +70 -33
- package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +135 -87
- package/src/runtime/agent/orchestrator/providers/antigravity-transport.mjs +123 -102
- package/src/runtime/agent/orchestrator/providers/cache-warm-admission.mjs +90 -0
- package/src/runtime/agent/orchestrator/providers/command-code-oauth-login.mjs +1 -10
- package/src/runtime/agent/orchestrator/providers/cursor-wire-transport.mjs +25 -9
- package/src/runtime/agent/orchestrator/providers/cursor.mjs +25 -13
- package/src/runtime/agent/orchestrator/providers/devin-wire-transport.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/devin.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +210 -20
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-prefix-trace.mjs +76 -11
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +45 -6
- package/src/runtime/agent/orchestrator/providers/lib/first-output-window.mjs +58 -0
- package/src/runtime/agent/orchestrator/providers/lib/listen-on.mjs +14 -0
- package/src/runtime/agent/orchestrator/providers/lib/oauth-token-utils.mjs +17 -3
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +52 -10
- package/src/runtime/agent/orchestrator/providers/mimo-oauth-login.mjs +1 -10
- package/src/runtime/agent/orchestrator/providers/model-proxy-channel.d.mts +8 -1
- package/src/runtime/agent/orchestrator/providers/model-proxy-channel.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/npm-cli-version.mjs +11 -3
- package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/chunk-events.mjs +9 -2
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +7 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream.mjs +14 -3
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses-events.mjs +4 -2
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream-common.mjs +5 -3
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +16 -3
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai-send.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events/output-items.mjs +5 -2
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +13 -3
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state.mjs +13 -2
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-watchdogs.mjs +81 -42
- package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +8 -0
- package/src/runtime/agent/orchestrator/providers/openai-oauth-login.mjs +136 -5
- package/src/runtime/agent/orchestrator/providers/openai-oauth-tokens.mjs +10 -9
- package/src/runtime/agent/orchestrator/providers/openai-ws-send/send-context.mjs +22 -3
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/attempt-context.mjs +43 -5
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/handshake-failure.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-send-attempts/stream-failure.mjs +6 -3
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream/event-switch.mjs +20 -12
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +7 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-watchdogs.mjs +48 -22
- package/src/runtime/agent/orchestrator/providers/provider-error-kind.mjs +65 -1
- package/src/runtime/agent/orchestrator/providers/quota-reading.mjs +38 -12
- package/src/runtime/agent/orchestrator/providers/registry.mjs +38 -0
- package/src/runtime/agent/orchestrator/providers/retry-executor.mjs +39 -7
- package/src/runtime/agent/orchestrator/providers/statusline-route-meta.mjs +6 -0
- package/src/runtime/agent/orchestrator/runtime-core/ask-user-tool-defs.mjs +49 -16
- package/src/runtime/agent/orchestrator/runtime-core/compaction-config-keys.mjs +62 -0
- package/src/runtime/agent/orchestrator/runtime-core/config-helpers.mjs +37 -16
- package/src/runtime/agent/orchestrator/runtime-core/deferred-tool-delta.mjs +100 -23
- package/src/runtime/agent/orchestrator/runtime-core/orchestration.mjs +7 -6
- package/src/runtime/agent/orchestrator/runtime-core/session-text.mjs +9 -3
- package/src/runtime/agent/orchestrator/runtime-core/tool-bridge.mjs +19 -4
- package/src/runtime/agent/orchestrator/runtime-core/tool-catalog.mjs +125 -30
- package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +3 -1
- package/src/runtime/agent/orchestrator/runtime-core/workflow.mjs +5 -2
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +1 -3
- package/src/runtime/agent/orchestrator/session/cache-warm.mjs +798 -0
- package/src/runtime/agent/orchestrator/session/catalog-db/schema.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +1 -8
- package/src/runtime/agent/orchestrator/session/compact/messages.mjs +23 -0
- package/src/runtime/agent/orchestrator/session/compact/observation-supersession.mjs +103 -23
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +280 -45
- package/src/runtime/agent/orchestrator/session/compaction-archive-capture.mjs +475 -58
- package/src/runtime/agent/orchestrator/session/compaction-archive.mjs +42 -17
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +13 -1
- package/src/runtime/agent/orchestrator/session/conversation-import/claude.mjs +163 -22
- package/src/runtime/agent/orchestrator/session/conversation-import/codex.mjs +132 -17
- package/src/runtime/agent/orchestrator/session/conversation-import/convert.mjs +38 -7
- package/src/runtime/agent/orchestrator/session/conversation-import/imported-session.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/conversation-import/turns.mjs +90 -22
- package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/human-gate/gate.mjs +11 -5
- package/src/runtime/agent/orchestrator/session/human-gate/outbound-policy.mjs +0 -2
- package/src/runtime/agent/orchestrator/session/human-gate/requests.mjs +36 -4
- package/src/runtime/agent/orchestrator/session/human-gate/store.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +51 -25
- package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +37 -3
- package/src/runtime/agent/orchestrator/session/loop/loop-state.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/loop/no-tool-turn.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/provider-tool-exclusions.mjs +13 -5
- package/src/runtime/agent/orchestrator/session/loop/route-fallback.mjs +31 -3
- package/src/runtime/agent/orchestrator/session/loop/send-phase.mjs +20 -3
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/after-hook.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/before-hook.mjs +5 -4
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/dispatch.mjs +16 -2
- package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +16 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-exposure-migration.mjs +49 -21
- package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +3 -10
- package/src/runtime/agent/orchestrator/session/loop/tool-phase.mjs +12 -3
- package/src/runtime/agent/orchestrator/session/manager/ask-queue.mjs +12 -2
- package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +19 -1
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-execute.mjs +133 -90
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-loop-options.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-state.mjs +31 -4
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +30 -18
- package/src/runtime/agent/orchestrator/session/manager/owner-route-fallbacks.mjs +24 -14
- package/src/runtime/agent/orchestrator/session/manager/pending-message-entry.mjs +11 -2
- package/src/runtime/agent/orchestrator/session/manager/provider-replay.mjs +13 -0
- package/src/runtime/agent/orchestrator/session/manager/route-fallback-chain.mjs +130 -0
- package/src/runtime/agent/orchestrator/session/manager/rules-cache.mjs +27 -9
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +81 -8
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +27 -8
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +12 -5
- package/src/runtime/agent/orchestrator/session/manager/session-record.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +9 -4
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-context.mjs +4 -0
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +102 -15
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +21 -5
- package/src/runtime/agent/orchestrator/session/manager/turn-interruption.mjs +9 -0
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +24 -9
- package/src/runtime/agent/orchestrator/session/prompt-cache-idle-gaps.mjs +113 -0
- package/src/runtime/agent/orchestrator/session/prompt-cache-touch-store.mjs +150 -0
- package/src/runtime/agent/orchestrator/session/restart-prefix-parity.fixture.mjs +154 -0
- package/src/runtime/agent/orchestrator/session/routine-result.mjs +36 -9
- package/src/runtime/agent/orchestrator/session/sensitive-projection.mjs +100 -0
- package/src/runtime/agent/orchestrator/session/sensitive-values.mjs +257 -0
- package/src/runtime/agent/orchestrator/session/side-question-store.mjs +20 -7
- package/src/runtime/agent/orchestrator/session/side-question.mjs +18 -0
- package/src/runtime/agent/orchestrator/session/skill-update-notice.mjs +60 -0
- package/src/runtime/agent/orchestrator/session/store/live-state.mjs +6 -3
- package/src/runtime/agent/orchestrator/session/store/save-delta.mjs +9 -5
- package/src/runtime/agent/orchestrator/session/store/serialize.mjs +9 -8
- package/src/runtime/agent/orchestrator/session/store/session-delete.mjs +7 -0
- package/src/runtime/agent/orchestrator/session/store/session-persistence-events.mjs +29 -0
- package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +8 -6
- package/src/runtime/agent/orchestrator/session/store-summary-catalog.mjs +16 -2
- package/src/runtime/agent/orchestrator/session/store-summary-fields.mjs +15 -0
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +81 -22
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +92 -3
- package/src/runtime/agent/orchestrator/session/stored-attachment-history.mjs +32 -0
- package/src/runtime/agent/orchestrator/session/thinking-binding.mjs +108 -0
- package/src/runtime/agent/orchestrator/session/tool-batch/pre-dispatch.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/tool-batch/record-outcome.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/transcript-restore/restore.mjs +79 -3
- package/src/runtime/agent/orchestrator/session/transcript-restore/tool-result-status.mjs +9 -7
- package/src/runtime/agent/orchestrator/session/transcript-restore/tool-result-text.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/turn-failure.mjs +5 -1
- package/src/runtime/agent/orchestrator/stall-policy.mjs +23 -0
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +5 -2
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/backgrounded-result.mjs +12 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/invocation-plan.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/misuse-guard.mjs +240 -0
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/result-format.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/shell-cwd.mjs +38 -0
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/spawn-env.mjs +4 -2
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +31 -6
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +110 -26
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +7 -1
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +31 -5
- package/src/runtime/agent/orchestrator/tools/builtin/git-worktree-tool.mjs +22 -8
- package/src/runtime/agent/orchestrator/tools/builtin/lib/scoped-search-flight.mjs +9 -5
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-stream.mjs +7 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +6 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-dispatch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-publication.mjs +23 -12
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-snapshot.mjs +6 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +1 -8
- package/src/runtime/agent/orchestrator/tools/builtin/shell-runtime.mjs +7 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch/federation.mjs +3 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/graph-manifest.json +13 -13
- package/src/runtime/agent/orchestrator/tools/lib/isolated-test-env.mjs +4 -3
- package/src/runtime/agent/orchestrator/tools/lib/shell-warm-standby.mjs +26 -4
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +36 -13
- package/src/runtime/browser-bridge/action-schema.mjs +13 -2
- package/src/runtime/browser-bridge/client.mjs +73 -8
- package/src/runtime/browser-bridge/input-fields.mjs +8 -9
- package/src/runtime/browser-bridge/mail-links.mjs +107 -0
- package/src/runtime/browser-bridge/tool-defs.mjs +1 -1
- package/src/runtime/channels/lib/config.mjs +6 -61
- package/src/runtime/channels/lib/crash-log.mjs +1 -1
- package/src/runtime/channels/lib/event-pipeline.mjs +4 -19
- package/src/runtime/channels/lib/event-queue.mjs +3 -18
- package/src/runtime/channels/lib/owned-runtime/automation-services.mjs +2 -2
- package/src/runtime/channels/lib/owned-runtime/automation-start.mjs +3 -4
- package/src/runtime/channels/lib/owned-runtime/config-reload.mjs +4 -59
- package/src/runtime/channels/lib/owned-runtime/owned-start.mjs +33 -115
- package/src/runtime/channels/lib/owned-runtime/owned-stop.mjs +5 -22
- package/src/runtime/channels/lib/owned-runtime/state.mjs +2 -8
- package/src/runtime/channels/lib/owned-runtime.mjs +6 -23
- package/src/runtime/channels/lib/parent-bridge.mjs +2 -2
- package/src/runtime/channels/lib/runtime-paths.mjs +4 -43
- package/src/runtime/channels/lib/scheduler.mjs +33 -147
- package/src/runtime/channels/lib/schedules-db.mjs +34 -11
- package/src/runtime/channels/lib/status-snapshot.mjs +1 -1
- package/src/runtime/channels/lib/tool-dispatch.mjs +1 -2
- package/src/runtime/channels/lib/webhook/signature.mjs +4 -1
- package/src/runtime/channels/lib/webhooks-db.mjs +5 -9
- package/src/runtime/channels/lib/whisper-port.mjs +10 -1
- package/src/runtime/channels/lib/worker-bootstrap.mjs +0 -1
- package/src/runtime/channels/lib/worker-ipc.mjs +0 -1
- package/src/runtime/channels/lib/worker-main.mjs +10 -34
- package/src/runtime/computer-bridge/action-schema.mjs +42 -1
- package/src/runtime/computer-bridge/actions.mjs +9 -1
- package/src/runtime/computer-bridge/client.mjs +180 -8
- package/src/runtime/computer-bridge/core-actions.mjs +2 -2
- package/src/runtime/computer-bridge/error-recovery.mjs +28 -2
- package/src/runtime/computer-bridge/linux-action-capabilities.mjs +24 -5
- package/src/runtime/computer-bridge/linux-readiness.d.mts +7 -2
- package/src/runtime/computer-bridge/linux-readiness.mjs +65 -23
- package/src/runtime/computer-bridge/pending-continuation.mjs +1 -1
- package/src/runtime/connectors/connector-accounts-mcp.mjs +230 -0
- package/src/runtime/connectors/gmail-app-password.mjs +172 -39
- package/src/runtime/connectors/google-mcp.mjs +10 -12
- package/src/runtime/local-provider/server-process.mjs +2 -1
- package/src/runtime/media/adapters/gemini-video.mjs +4 -1
- package/src/runtime/media/adapters/xai-media.mjs +2 -1
- package/src/runtime/memory/lib/embedding-worker.mjs +6 -3
- package/src/runtime/memory/lib/memory-action-handlers/cycle-backfill-action.mjs +1 -7
- package/src/runtime/memory/lib/memory-chunk-quality.mjs +1 -6
- package/src/runtime/memory/lib/pg/adapter.mjs +77 -70
- package/src/runtime/memory/lib/pg/supervisor.mjs +24 -12
- package/src/runtime/memory/lib/runtime-fetcher.mjs +23 -5
- package/src/runtime/office/authoring/pdf-author-action.mjs +1 -6
- package/src/runtime/office/design/design-art-direction.mjs +29 -27
- package/src/runtime/office/pdf/pdf-writer.mjs +6 -1
- package/src/runtime/office/portable/portable-snapshot-docx.mjs +7 -1
- package/src/runtime/office/portable/portable-snapshot-shared.mjs +6 -1
- package/src/runtime/office/quality/assurance-rendered.mjs +9 -2
- package/src/runtime/office/quality/assurance-structure-docx.mjs +3 -1
- package/src/runtime/office/quality/design-review.mjs +1 -5
- package/src/runtime/office/quality/document-brief.mjs +1 -5
- package/src/runtime/office/quality/forced-break-pages.mjs +9 -6
- package/src/runtime/office/quality/quality-pipeline.mjs +1 -1
- package/src/runtime/session-search/session-search-db.mjs +73 -9
- package/src/runtime/session-search/session-search-ingest.mjs +110 -20
- package/src/runtime/shared/abort-race.mjs +89 -0
- package/src/runtime/shared/agent-avatar.d.mts +0 -1
- package/src/runtime/shared/agent-kind.mjs +4 -3
- package/src/runtime/shared/bot-owned-work.mjs +56 -0
- package/src/runtime/shared/bounded-download.mjs +8 -3
- package/src/runtime/shared/config.mjs +2 -13
- package/src/runtime/shared/connector-accounts.mjs +20 -10
- package/src/runtime/shared/connector-catalog.d.mts +29 -0
- package/src/runtime/shared/connector-catalog.mjs +150 -0
- package/src/runtime/shared/connector-triggers.mjs +22 -19
- package/src/runtime/shared/defaults-separation.mjs +2 -17
- package/src/runtime/shared/delegated-approval-host.mjs +103 -11
- package/src/runtime/shared/err-text.mjs +24 -15
- package/src/runtime/shared/fetch-safe-listen.d.mts +16 -0
- package/src/runtime/shared/fetch-safe-listen.mjs +50 -0
- package/src/runtime/shared/file-permissions.d.mts +0 -8
- package/src/runtime/shared/file-permissions.mjs +0 -11
- package/src/runtime/shared/git-direct.test-support.mjs +19 -0
- package/src/runtime/shared/handoff-artifacts.d.mts +2 -1
- package/src/runtime/shared/handoff-artifacts.mjs +18 -8
- package/src/runtime/shared/heartbeat-interval.d.mts +4 -0
- package/src/runtime/shared/heartbeat-interval.mjs +19 -0
- package/src/runtime/shared/idle-auto-clear-gate.mjs +126 -0
- package/src/runtime/shared/llm/cost.mjs +5 -1
- package/src/runtime/shared/llm/usage-rollup.mjs +1 -1
- package/src/runtime/shared/loopback-listener.mjs +25 -2
- package/src/runtime/shared/mixy-presence.mjs +22 -0
- package/src/runtime/shared/model-route-chain.d.mts +7 -2
- package/src/runtime/shared/model-route-chain.mjs +22 -4
- package/src/runtime/shared/open-url.mjs +10 -0
- package/src/runtime/shared/orchestration.d.mts +2 -0
- package/src/runtime/shared/pg-schema-db.mjs +27 -16
- package/src/runtime/shared/profile-config.cjs +1 -1
- package/src/runtime/shared/prompt-origin.d.mts +4 -0
- package/src/runtime/shared/prompt-origin.mjs +21 -0
- package/src/runtime/shared/provider-accounts.mjs +7 -1
- package/src/runtime/shared/provider-display-name.mjs +29 -0
- package/src/runtime/shared/provider-timeout-phase.mjs +2 -0
- package/src/runtime/shared/routine-trigger.d.mts +2 -0
- package/src/runtime/shared/routine-trigger.mjs +10 -0
- package/src/runtime/shared/sensitive-path-rules.d.mts +2 -10
- package/src/runtime/shared/sensitive-path-rules.mjs +19 -41
- package/src/runtime/shared/session-activity-signal.mjs +48 -1
- package/src/runtime/shared/session-scratch.mjs +37 -0
- package/src/runtime/shared/session-sidebar-host.d.mts +1 -1
- package/src/runtime/shared/session-sidebar-host.mjs +7 -3
- package/src/runtime/shared/session-turn-prelude.mjs +18 -0
- package/src/runtime/shared/tool-card-model/agent-surface.mjs +1 -3
- package/src/runtime/shared/tool-card-model/card-status.mjs +15 -2
- package/src/runtime/shared/tool-result-summary.mjs +2 -15
- package/src/runtime/shared/tool-surface.mjs +3 -0
- package/src/runtime/shared/tool-work-units.mjs +2 -0
- package/src/runtime/shared/turn-snapshot-store.mjs +13 -6
- package/src/runtime/shared/worktrees/contract.mjs +4 -1
- package/src/runtime/shared/worktrees/git.mjs +15 -0
- package/src/runtime/shared/worktrees/manager.mjs +87 -38
- package/src/runtime/shared/worktrees/test-support.mjs +14 -13
- package/src/runtime/terminal-bridge/client.mjs +10 -1
- package/src/runtime/visualize-bridge/client.mjs +29 -8
- package/src/runtime/visualize-bridge/tool-defs.mjs +22 -8
- package/src/runtime/visualize-bridge/tool-meta.d.mts +5 -0
- package/src/runtime/visualize-bridge/tool-meta.mjs +22 -0
- package/src/runtime/web-search/lib/fetch-pipeline.mjs +2 -2
- package/src/session-runtime/agent-home-delivery.mjs +489 -185
- package/src/session-runtime/agent-task-sessions.mjs +467 -229
- package/src/session-runtime/agent-tool-routing.mjs +8 -41
- package/src/session-runtime/boot/apis.mjs +9 -0
- package/src/session-runtime/boot/infrastructure.mjs +4 -0
- package/src/session-runtime/boot/providers.mjs +3 -0
- package/src/session-runtime/boot/tools.mjs +11 -2
- package/src/session-runtime/bot-status.mjs +12 -6
- package/src/session-runtime/bot-target.mjs +38 -0
- package/src/session-runtime/channel-config-api.mjs +6 -1
- package/src/session-runtime/config-lifecycle.mjs +6 -0
- package/src/session-runtime/connector-merge-migration.mjs +305 -0
- package/src/session-runtime/conversation-import/codex-titles.mjs +88 -0
- package/src/session-runtime/conversation-import/discovery.mjs +271 -25
- package/src/session-runtime/conversation-import/service.mjs +26 -5
- package/src/session-runtime/handoff-attachments.mjs +82 -31
- package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +144 -41
- package/src/session-runtime/internal-tool-executor/bridge-tools.mjs +3 -0
- package/src/session-runtime/internal-tool-executor/reaction-tool.mjs +4 -1
- package/src/session-runtime/internal-tool-executor/workspace-tools.mjs +8 -2
- package/src/session-runtime/lifecycle/cold-heir.mjs +11 -6
- package/src/session-runtime/lifecycle/inheritance.mjs +16 -3
- package/src/session-runtime/lifecycle/session-catalog.mjs +12 -2
- package/src/session-runtime/lifecycle/teardown/runtime-stops.mjs +50 -4
- package/src/session-runtime/lifecycle/teardown.mjs +23 -5
- package/src/session-runtime/mcp-glue/server-catalog.mjs +55 -3
- package/src/session-runtime/mcp-oauth-login.mjs +5 -3
- package/src/session-runtime/mixy-heartbeat.mjs +153 -33
- package/src/session-runtime/model-route/set-route.mjs +11 -2
- package/src/session-runtime/notification-bus.mjs +31 -117
- package/src/session-runtime/notification-completion-queue.mjs +54 -0
- package/src/session-runtime/notification-listeners.mjs +76 -0
- package/src/session-runtime/owned-automation-run.mjs +2 -1
- package/src/session-runtime/prewarm/channel-start.mjs +3 -7
- package/src/session-runtime/provider-catalog-cache.mjs +82 -36
- package/src/session-runtime/provider-models/catalog-load.mjs +23 -6
- package/src/session-runtime/provider-models.mjs +4 -2
- package/src/session-runtime/resource-mcp-api.mjs +143 -224
- package/src/session-runtime/resource-mcp-connector-accounts.mjs +163 -0
- package/src/session-runtime/resource-mcp-oauth-api.mjs +217 -0
- package/src/session-runtime/resource-mcp-secrets.mjs +82 -0
- package/src/session-runtime/resource-mcp-servers.mjs +78 -0
- package/src/session-runtime/resource-mcp-store.mjs +49 -0
- package/src/session-runtime/resource-recall-api.mjs +6 -1
- package/src/session-runtime/routine-owner.mjs +40 -9
- package/src/session-runtime/runtime-feature-gates.mjs +5 -1
- package/src/session-runtime/services/agent-tool/close-flow.mjs +3 -0
- package/src/session-runtime/services/agent-tool/execute.mjs +14 -9
- package/src/session-runtime/services/agent-tool/job-views/agent-list.mjs +20 -4
- package/src/session-runtime/services/agent-tool/model-select.mjs +48 -7
- package/src/session-runtime/services/agent-tool/render.mjs +71 -17
- package/src/session-runtime/services/agent-tool/spawn-preset.mjs +13 -4
- package/src/session-runtime/services/agent-tool/tag-registry.mjs +1 -0
- package/src/session-runtime/services/agent-tool/tool-def.mjs +9 -9
- package/src/session-runtime/services/agent-tool/worker-index/awaiting-user-sync.mjs +51 -0
- package/src/session-runtime/services/agent-tool/worker-index/disposal.mjs +55 -0
- package/src/session-runtime/services/agent-tool/worker-index/released-store.mjs +123 -0
- package/src/session-runtime/services/agent-tool/worker-index/restart-settlement.mjs +112 -0
- package/src/session-runtime/services/agent-tool/worker-index/row-reads.mjs +36 -0
- package/src/session-runtime/services/agent-tool/worker-index/row-shape.mjs +2 -0
- package/src/session-runtime/services/agent-tool/worker-index/row-store.mjs +17 -4
- package/src/session-runtime/services/agent-tool/worker-index/row-writes.mjs +58 -0
- package/src/session-runtime/services/agent-tool/worker-index.mjs +41 -241
- package/src/session-runtime/services/agent-tool/worker-rows.mjs +3 -0
- package/src/session-runtime/services/channel-admin.mjs +7 -13
- package/src/session-runtime/services/channel-session-router.mjs +4 -2
- package/src/session-runtime/services/provider-admin.mjs +2 -1
- package/src/session-runtime/services/seeds.mjs +0 -28
- package/src/session-runtime/session-compaction-sync.mjs +27 -0
- package/src/session-runtime/session-create/session-options.mjs +1 -0
- package/src/session-runtime/settings-builtin-tools-api.mjs +11 -0
- package/src/session-runtime/settings-compaction-api.mjs +2 -40
- package/src/session-runtime/settings-system-api.mjs +13 -1
- package/src/session-runtime/setup-tool/agent-settings-actions.mjs +65 -0
- package/src/session-runtime/setup-tool/executor.mjs +145 -22
- package/src/session-runtime/setup-tool/extended-actions.mjs +8 -3
- package/src/session-runtime/setup-tool/session-route-actions.mjs +152 -0
- package/src/session-runtime/setup-tool/settings-contract.mjs +4 -3
- package/src/session-runtime/setup-tool/tool-defs.mjs +64 -5
- package/src/session-runtime/tool-policy/agent-profile-fold.mjs +17 -13
- package/src/session-runtime/tool-policy/policy-stage.mjs +17 -2
- package/src/session-runtime/turn/turn-run/ask-callbacks.mjs +1 -0
- package/src/session-runtime/workflow-agents-api/agent-editor.mjs +5 -1
- package/src/session-runtime/workflow-agents-api/agent-route.mjs +15 -4
- package/src/session-runtime/workflow-agents-api/onboarding.mjs +3 -3
- package/src/session-runtime/workflow-agents-api/style-and-mode.mjs +4 -0
- package/src/session-runtime/workspace/transitions.mjs +25 -0
- package/src/session-runtime/workspace/worktree-tool.mjs +26 -9
- package/src/standalone/channel-transport/client-registry/client-records.mjs +65 -0
- package/src/standalone/channel-transport/client-registry/client-registration.mjs +118 -0
- package/src/standalone/channel-transport/client-registry.mjs +24 -163
- package/src/standalone/channel-transport.mjs +1 -1
- package/src/standalone/daemon-channels-loader.mjs +10 -8
- package/src/standalone/daemon-session-control/list-page.mjs +72 -0
- package/src/standalone/daemon-session-control/request.mjs +51 -0
- package/src/standalone/daemon-session-control/room-host.mjs +57 -0
- package/src/standalone/daemon-session-control/route-control.mjs +48 -0
- package/src/standalone/daemon-session-control/send-turn.mjs +60 -0
- package/src/standalone/daemon-session-control/worktree-control.mjs +40 -0
- package/src/standalone/daemon-session-control.mjs +142 -190
- package/src/standalone/daemon.mjs +26 -3
- package/src/standalone/session-client.mjs +7 -3
- package/src/standalone/session-protocol.mjs +5 -0
- package/src/standalone/session-service/agent-tree/agent-child.mjs +1 -0
- package/src/standalone/session-service/agent-tree/agent-turns.mjs +16 -12
- package/src/standalone/session-service/quota-resume.mjs +3 -0
- package/src/standalone/session-service/retention/busy.mjs +65 -1
- package/src/standalone/session-service/session-calls/session-action.mjs +30 -2
- package/src/standalone/session-service/session-calls/session-views.mjs +8 -0
- package/src/standalone/session-tool-output.mjs +15 -7
- package/src/standalone/session-transport/client-registry/client-grace.mjs +12 -9
- package/src/tui/app/app-view/floating-panel.jsx +7 -4
- package/src/tui/app/model-options.mjs +3 -28
- package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +1 -3
- package/src/tui/app/model-picker/route-selection.mjs +5 -6
- package/src/tui/app/provider-setup/oauth-actions.mjs +38 -20
- package/src/tui/app/provider-setup/provider-items.mjs +8 -2
- package/src/tui/app/provider-setup-picker.mjs +9 -5
- package/src/tui/components/QuestionPanel.jsx +13 -4
- package/src/tui/dist/index.mjs +133 -92
- package/src/tui/session/agent-job-feed/model-notification.mjs +3 -0
- package/src/tui/session/initial-state.mjs +3 -0
- package/src/tui/session/notice-surface.mjs +7 -1
- package/src/tui/session/queue-helpers.mjs +3 -42
- package/src/tui/session/session-api/routes-agent-definitions.mjs +14 -2
- package/src/tui/session/session-api/routes-write.mjs +5 -1
- package/src/tui/session/session-api/routes.mjs +1 -0
- package/src/tui/session/session-api/settings.mjs +17 -1
- package/src/tui/session/session-flow/auto-clear.mjs +4 -33
- package/src/tui/session/session-flow/drain-closed-queue.mjs +38 -0
- package/src/tui/session/session-flow/drain-enqueue.mjs +86 -0
- package/src/tui/session/session-flow/drain-retry.mjs +35 -0
- package/src/tui/session/session-flow/drain.mjs +118 -149
- package/src/tui/session/session-flow/queue/entry-shape.mjs +5 -0
- package/src/tui/session/session-flow/queue/take-entries.mjs +16 -2
- package/src/tui/session/tool-approval-delegation.mjs +64 -0
- package/src/tui/session/tool-approval-request.mjs +39 -0
- package/src/tui/session/tool-approval-settle.mjs +62 -0
- package/src/tui/session/tool-approval.mjs +69 -115
- package/src/tui/session/tui-steering-persist.mjs +8 -1
- package/src/tui/session/turn-stream.mjs +19 -2
- package/src/tui/session/turn.mjs +1 -0
- package/src/ui/statusline-agents.mjs +1 -3
- package/src/vendor/statusline/bin/statusline-route.mjs +1 -219
- package/src/vendor/statusline/src/gateway/route-meta.mjs +35 -13
- package/scripts/code-graph-description-contract.mjs +0 -188
- package/src/runtime/channels/lib/owned-runtime/ownership-refresh.mjs +0 -36
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
/** Setup actions that act on one running session rather than a setting: its
|
|
2
|
+
* fallback position (read in status model/agents), a return to its primary
|
|
3
|
+
* route, and its quota card's actions. The caller's own session changes
|
|
4
|
+
* through its runtime; another session through the daemon's configure lane
|
|
5
|
+
* (daemon-session-control/route-control.mjs), the lane the model picker and
|
|
6
|
+
* quota card use. */
|
|
7
|
+
import {
|
|
8
|
+
liveRouteFallbackPositions,
|
|
9
|
+
routeFallbackHopped,
|
|
10
|
+
routeFallbackPosition,
|
|
11
|
+
routeLeaf,
|
|
12
|
+
sessionChainSource,
|
|
13
|
+
sessionRoutePrimary,
|
|
14
|
+
} from '../../runtime/agent/orchestrator/session/manager/route-fallback-chain.mjs';
|
|
15
|
+
import { sameRouteModel } from '../../runtime/agent/orchestrator/session/manager/owner-route-fallbacks.mjs';
|
|
16
|
+
import { resolveSessionMode } from '../../runtime/agent/orchestrator/session/agent-mode.mjs';
|
|
17
|
+
import { agentHomeSessionId } from '../../runtime/agent/orchestrator/session/agent-home.mjs';
|
|
18
|
+
import { _liveSessions } from '../../runtime/agent/orchestrator/session/store/live-state.mjs';
|
|
19
|
+
import { assertOwnAgentSettings } from '../services/schedule-access.mjs';
|
|
20
|
+
import { clean } from '../../runtime/agent/orchestrator/runtime-core/session-text.mjs';
|
|
21
|
+
|
|
22
|
+
const modelOf = (route) => ({ provider: route?.provider || '', model: route?.model || '' });
|
|
23
|
+
|
|
24
|
+
/** The calling session's fallback position, and those of the other sessions
|
|
25
|
+
* held here that `keep` selects (status model: Leads; status agents: bots and agents). */
|
|
26
|
+
export function routePositionsStatus({ caller, config, keep }) {
|
|
27
|
+
return {
|
|
28
|
+
...(caller?.agent ? { session: routeFallbackPosition(caller, config) } : {}),
|
|
29
|
+
sessions: liveRouteFallbackPositions(config, (row) => row.sessionId !== caller?.id && keep(row)),
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/** The route a reset returns `session` to: the one it left at its first hop,
|
|
34
|
+
* else its settings' route when that is still its primary. */
|
|
35
|
+
function primaryRoute(session, config) {
|
|
36
|
+
if (session.routeFallbackPrimary?.provider) return routeLeaf(session.routeFallbackPrimary);
|
|
37
|
+
const primary = sessionRoutePrimary(session);
|
|
38
|
+
const source = sessionChainSource(session, config);
|
|
39
|
+
return source && sameRouteModel(source, primary) ? routeLeaf(source) : routeLeaf(primary);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const actingAgentOf = (session) => resolveSessionMode({ session }).agentId || clean(session?.agent);
|
|
43
|
+
|
|
44
|
+
function createSessionTargets(ctx) {
|
|
45
|
+
const { sessionId: callerId, caller, getSession, scope, executeSessionControl } = ctx;
|
|
46
|
+
const load = (id) => (id === callerId ? caller : getSession?.(id)) || null;
|
|
47
|
+
// A bot's thread acts only on its own sessions; the human's on any.
|
|
48
|
+
const assertTarget = (session, action) => {
|
|
49
|
+
if (scope) assertOwnAgentSettings(scope, actingAgentOf(session), action);
|
|
50
|
+
};
|
|
51
|
+
const target = (id, action, { other = false } = {}) => {
|
|
52
|
+
const sessionId = clean(id) || callerId;
|
|
53
|
+
if (!sessionId) throw new Error('sessionId is required');
|
|
54
|
+
if (other && sessionId === callerId) {
|
|
55
|
+
throw new Error(`${action} applies to another session: this one is running the setup call`);
|
|
56
|
+
}
|
|
57
|
+
const session = load(sessionId);
|
|
58
|
+
if (!session || session.closed === true) throw new Error(`session ${sessionId} not found`);
|
|
59
|
+
assertTarget(session, action);
|
|
60
|
+
return session;
|
|
61
|
+
};
|
|
62
|
+
const control = async (session, method, input) => {
|
|
63
|
+
if (typeof executeSessionControl !== 'function') {
|
|
64
|
+
throw new Error('Another session is reachable only through the Mixdog app or daemon; none hosts this runtime');
|
|
65
|
+
}
|
|
66
|
+
return executeSessionControl(
|
|
67
|
+
{ action: 'route', session_id: session.id, method, ...(input ? { input } : {}) },
|
|
68
|
+
{ callerSessionId: callerId }
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
return { load, target, control, assertTarget };
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export const SESSION_ROUTE_HANDLERS = {
|
|
75
|
+
async reset_route_fallback(rt, args, ctx) {
|
|
76
|
+
if (Object.hasOwn(args, 'sessionId') && Object.hasOwn(args, 'agent')) {
|
|
77
|
+
throw new Error('Pass sessionId or agent, not both');
|
|
78
|
+
}
|
|
79
|
+
const config = ctx.getConfig();
|
|
80
|
+
const sessions = createSessionTargets(ctx);
|
|
81
|
+
let targets;
|
|
82
|
+
if (Object.hasOwn(args, 'agent')) {
|
|
83
|
+
const agent = clean(args.agent);
|
|
84
|
+
if (!agent) throw new Error('agent is required');
|
|
85
|
+
if (ctx.scope) assertOwnAgentSettings(ctx.scope, agent, 'reset_route_fallback');
|
|
86
|
+
// Its chats held here (home, room seats) and its home thread from disk.
|
|
87
|
+
const byId = new Map();
|
|
88
|
+
for (const session of _liveSessions.values()) {
|
|
89
|
+
if (session?.id && session.closed !== true && resolveSessionMode({ session }).agentId === agent) {
|
|
90
|
+
byId.set(session.id, session);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
const home = agentHomeSessionId(agent);
|
|
94
|
+
if (home && !byId.has(home)) {
|
|
95
|
+
const stored = sessions.load(home);
|
|
96
|
+
if (stored && stored.closed !== true) byId.set(home, stored);
|
|
97
|
+
}
|
|
98
|
+
targets = [...byId.values()];
|
|
99
|
+
} else {
|
|
100
|
+
targets = [sessions.target(args.sessionId, 'reset_route_fallback')];
|
|
101
|
+
}
|
|
102
|
+
const reset = [];
|
|
103
|
+
const unchanged = [];
|
|
104
|
+
for (const session of targets) {
|
|
105
|
+
if (!routeFallbackHopped(session)) {
|
|
106
|
+
unchanged.push({ sessionId: session.id, current: modelOf(session) });
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
const route = primaryRoute(session, config);
|
|
110
|
+
// The session's own model pick, from its next turn: the switch restarts
|
|
111
|
+
// its chain (fallback index and failures cleared).
|
|
112
|
+
if (session.id === ctx.sessionId) {
|
|
113
|
+
await rt.setRoute(route, { sessionOnly: true, switchEstablished: true, deferUntilNextTurn: true });
|
|
114
|
+
} else {
|
|
115
|
+
await sessions.control(session, 'setRoute', route);
|
|
116
|
+
}
|
|
117
|
+
reset.push({ sessionId: session.id, from: modelOf(session), to: modelOf(route) });
|
|
118
|
+
}
|
|
119
|
+
return { scope: 'session', reset, ...(unchanged.length ? { alreadyOnPrimary: unchanged } : {}) };
|
|
120
|
+
},
|
|
121
|
+
async continue_in_model(_rt, args, ctx) {
|
|
122
|
+
const sessions = createSessionTargets(ctx);
|
|
123
|
+
const session = sessions.target(args.sessionId, 'continue_in_model', { other: true });
|
|
124
|
+
const route = routeLeaf(args.route);
|
|
125
|
+
const continued = (await sessions.control(session, 'continueSessionInModel', route)) !== false;
|
|
126
|
+
return {
|
|
127
|
+
scope: 'session',
|
|
128
|
+
sessionId: session.id,
|
|
129
|
+
continued,
|
|
130
|
+
route: modelOf(route),
|
|
131
|
+
note: 'The stopped turn is not resent: the user resumes it from that conversation (Resume, or a new message).',
|
|
132
|
+
};
|
|
133
|
+
},
|
|
134
|
+
async schedule_quota_resume(_rt, args, ctx) {
|
|
135
|
+
const sessions = createSessionTargets(ctx);
|
|
136
|
+
const session = sessions.target(args.sessionId, 'schedule_quota_resume', { other: true });
|
|
137
|
+
return {
|
|
138
|
+
scope: 'session',
|
|
139
|
+
sessionId: session.id,
|
|
140
|
+
scheduled: (await sessions.control(session, 'scheduleQuotaResume')) === true,
|
|
141
|
+
};
|
|
142
|
+
},
|
|
143
|
+
async cancel_quota_resume(_rt, args, ctx) {
|
|
144
|
+
const sessions = createSessionTargets(ctx);
|
|
145
|
+
const session = sessions.target(args.sessionId, 'cancel_quota_resume', { other: true });
|
|
146
|
+
return {
|
|
147
|
+
scope: 'session',
|
|
148
|
+
sessionId: session.id,
|
|
149
|
+
cancelled: (await sessions.control(session, 'cancelQuotaResume')) === true,
|
|
150
|
+
};
|
|
151
|
+
},
|
|
152
|
+
};
|
|
@@ -42,7 +42,7 @@ export const SETUP_EXTENDED_ACTION_FIELDS = Object.freeze({
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
/** Mirrors RULE_ACTIONS in services/hook-bus/rule-store.mjs. */
|
|
45
|
-
|
|
45
|
+
const SETUP_HOOK_RULE_ACTIONS = Object.freeze(['allow', 'deny', 'block', 'modify', 'rewrite', 'ask']);
|
|
46
46
|
|
|
47
47
|
/** Mirrors ACTIVITY_RAIL_PIN_IDS in apps/desktop/src/shared/activity-rail-pins.ts. */
|
|
48
48
|
export const SETUP_ACTIVITY_RAIL_PIN_IDS = Object.freeze([
|
|
@@ -224,7 +224,6 @@ export const SETUP_EXTENDED_PROPERTIES = Object.freeze({
|
|
|
224
224
|
desktop: object({
|
|
225
225
|
keepAwake: boolean,
|
|
226
226
|
runInBackground: boolean,
|
|
227
|
-
turnNotifications: boolean,
|
|
228
227
|
usagePinned: boolean,
|
|
229
228
|
usageRailShortLong: boolean,
|
|
230
229
|
usageAccountsExpanded: boolean,
|
|
@@ -232,6 +231,7 @@ export const SETUP_EXTENDED_PROPERTIES = Object.freeze({
|
|
|
232
231
|
usageRailSlotsAll: boolean,
|
|
233
232
|
computerObserveOnly: boolean,
|
|
234
233
|
browserAutoSignIn: boolean,
|
|
234
|
+
saveChatLogins: boolean,
|
|
235
235
|
notificationVolume: {
|
|
236
236
|
type: 'integer',
|
|
237
237
|
minimum: 0,
|
|
@@ -273,7 +273,8 @@ export const SETUP_EXTENDED_PROPERTIES = Object.freeze({
|
|
|
273
273
|
sidePanelPosition: {
|
|
274
274
|
type: 'string',
|
|
275
275
|
enum: ['right', 'bottom', 'auto'],
|
|
276
|
-
description:
|
|
276
|
+
description:
|
|
277
|
+
'Where the side dock sits on desktop: beside the chat, below it, or by window shape (default right).',
|
|
277
278
|
},
|
|
278
279
|
timeFormat: {
|
|
279
280
|
type: 'string',
|
|
@@ -6,10 +6,17 @@ import {
|
|
|
6
6
|
} from './settings-contract.mjs';
|
|
7
7
|
import { MEDIA_KINDS } from '../../runtime/media/tool-defs.mjs';
|
|
8
8
|
import { INSTRUCTION_FILES_MODES } from '../../runtime/shared/instruction-files-mode.mjs';
|
|
9
|
+
import {
|
|
10
|
+
DEFAULT_HEARTBEAT_INTERVAL_MINUTES,
|
|
11
|
+
HEARTBEAT_INTERVAL_CHOICES,
|
|
12
|
+
} from '../../runtime/shared/heartbeat-interval.mjs';
|
|
9
13
|
import { AUTO_EFFORT_BASES } from '../../runtime/agent/orchestrator/providers/auto-effort.mjs';
|
|
10
14
|
import { WORKTREE_NEW_TASK_DEFAULTS } from '../../runtime/shared/worktrees/settings.mjs';
|
|
11
15
|
import { CONNECTOR_IDS } from '../../runtime/shared/connector-catalog.mjs';
|
|
12
16
|
import { COMPACTION_SUMMARY_MODES } from '../../runtime/agent/orchestrator/session/compact/summary-mode.mjs';
|
|
17
|
+
import { ACTION_KINDS } from '../../runtime/agent/orchestrator/session/human-gate/outbound-policy.mjs';
|
|
18
|
+
import { PERMISSION_MODES } from '../../runtime/agent/orchestrator/session/human-gate/store.mjs';
|
|
19
|
+
import { CONNECTOR_PERMISSIONS } from '../../runtime/agent/orchestrator/mcp/agent-connectors.mjs';
|
|
13
20
|
|
|
14
21
|
/** Built-in `setup` tool: the model's handle on a Mixdog user's persisted
|
|
15
22
|
* configuration. The description is a contract only; how to use each action
|
|
@@ -104,6 +111,7 @@ export const SETUP_ACTION_FIELDS = Object.freeze({
|
|
|
104
111
|
set_quota_auto_resume: 'enabled',
|
|
105
112
|
set_model_preferences: 'provider model hidden? favorite?',
|
|
106
113
|
set_heartbeat_enabled: 'enabled',
|
|
114
|
+
set_heartbeat_interval: 'minutes',
|
|
107
115
|
set_reactions_enabled: 'enabled',
|
|
108
116
|
forget_provider_auth: 'name accountId?',
|
|
109
117
|
set_provider_account: 'name providerAccount',
|
|
@@ -121,6 +129,19 @@ export const SETUP_ACTION_FIELDS = Object.freeze({
|
|
|
121
129
|
enable_plugin_mcp: 'name',
|
|
122
130
|
connect_connector: 'connector',
|
|
123
131
|
set_worktree_settings: 'worktree',
|
|
132
|
+
reset_route_fallback: 'sessionId? agent?',
|
|
133
|
+
continue_in_model: 'sessionId route',
|
|
134
|
+
schedule_quota_resume: 'sessionId',
|
|
135
|
+
cancel_quota_resume: 'sessionId',
|
|
136
|
+
set_cache_warming_enabled: 'enabled',
|
|
137
|
+
read_agent_settings: 'agent',
|
|
138
|
+
read_project_connectors: 'projectPath',
|
|
139
|
+
set_agent_permission: 'agent actionKind permissionMode',
|
|
140
|
+
set_agent_connector: 'agent name enabled',
|
|
141
|
+
set_agent_connector_tool: 'agent name tool permission',
|
|
142
|
+
set_project_connector: 'projectPath name enabled',
|
|
143
|
+
restore_definition: 'definitionKind name',
|
|
144
|
+
set_bot_order: 'botOrder',
|
|
124
145
|
...SETUP_EXTENDED_ACTION_FIELDS,
|
|
125
146
|
});
|
|
126
147
|
|
|
@@ -170,7 +191,7 @@ const ROUTE_SCHEMA = {
|
|
|
170
191
|
ROUTE_SCHEMA.properties.fallbacks = {
|
|
171
192
|
type: 'array',
|
|
172
193
|
description:
|
|
173
|
-
'Lead (set_route), agent (bots included) and Web Search routes only: ordered fallback models tried when the model hits its usage limit or is unavailable; [] clears the list.',
|
|
194
|
+
'Lead (set_route), agent (bots included) and Web Search routes only: ordered fallback models tried when the model hits its usage limit or is unavailable, each on another provider; [] clears the list. Running sessions on that route read it at their next hop.',
|
|
174
195
|
items: {
|
|
175
196
|
type: 'object',
|
|
176
197
|
additionalProperties: false,
|
|
@@ -219,7 +240,11 @@ export const SETUP_TOOL_DEFS = Object.freeze([
|
|
|
219
240
|
description:
|
|
220
241
|
'Partial route update; omitted fields are preserved. Agent or Web Search provider "" restores Main inheritance. contextPercent and contextTokens apply to Main and agent routes only.',
|
|
221
242
|
},
|
|
222
|
-
agent: {
|
|
243
|
+
agent: {
|
|
244
|
+
type: 'string',
|
|
245
|
+
description:
|
|
246
|
+
'Agent or bot id (lead = Mixy): set_agent_route, read_agent_settings, set_agent_permission, set_agent_connector(_tool); reset_route_fallback: every chat of that bot.',
|
|
247
|
+
},
|
|
223
248
|
workflow: { type: 'string', description: 'set_workflow: pack id.' },
|
|
224
249
|
style: { type: 'string', description: 'set_output_style: style id.' },
|
|
225
250
|
profile: {
|
|
@@ -272,7 +297,7 @@ export const SETUP_TOOL_DEFS = Object.freeze([
|
|
|
272
297
|
enabled: {
|
|
273
298
|
type: 'boolean',
|
|
274
299
|
description:
|
|
275
|
-
'Boolean setters (set_*_enabled, set_compaction, set_auto_update, set_ai_session_titles, set_quota_auto_resume, set_heartbeat_enabled, set_mcp_enabled, set_plugin_enabled).',
|
|
300
|
+
'Boolean setters (set_*_enabled, set_compaction, set_auto_update, set_ai_session_titles, set_quota_auto_resume, set_heartbeat_enabled, set_mcp_enabled, set_plugin_enabled, set_agent_connector, set_project_connector).',
|
|
276
301
|
},
|
|
277
302
|
provider: { type: 'string', description: 'set_model_preferences: provider id.' },
|
|
278
303
|
hidden: {
|
|
@@ -297,12 +322,12 @@ export const SETUP_TOOL_DEFS = Object.freeze([
|
|
|
297
322
|
},
|
|
298
323
|
name: {
|
|
299
324
|
type: 'string',
|
|
300
|
-
description: `set_builtin_enabled: ${SETUP_BUILTIN_TOGGLE_FEATURES.join('|')}; install_builtin also accepts memory. Memory toggles use set_memory_enabled. revoke_linked_device: client id from status connection, not its display name; set_developer_option: option id from status developer; read_definition/delete_definition: the definition id; reconnect_mcp: optional MCP server name (omit for all); else MCP/plugin/provider id.`,
|
|
325
|
+
description: `set_builtin_enabled: ${SETUP_BUILTIN_TOGGLE_FEATURES.join('|')}; install_builtin also accepts memory. Memory toggles use set_memory_enabled. revoke_linked_device: client id from status connection, not its display name; set_developer_option: option id from status developer; read_definition/delete_definition: the definition id; reconnect_mcp: optional MCP server name (omit for all); set_agent_connector(_tool)/set_project_connector: connector (MCP server) id from read_agent_settings; restore_definition: archived agent id; else MCP/plugin/provider id.`,
|
|
301
326
|
},
|
|
302
327
|
accountId: {
|
|
303
328
|
type: 'string',
|
|
304
329
|
description:
|
|
305
|
-
|
|
330
|
+
"forget_provider_auth: OAuth account id from status providers with detail:true; required when the provider has several accounts. set_media_default: optional account of the OAuth lane to pin; omitted = the lane provider's selected account.",
|
|
306
331
|
},
|
|
307
332
|
providerAccount: {
|
|
308
333
|
type: 'object',
|
|
@@ -350,6 +375,11 @@ export const SETUP_TOOL_DEFS = Object.freeze([
|
|
|
350
375
|
maximum: 86400,
|
|
351
376
|
description: 'set_local_idle_ttl: unload after this many idle seconds, 0 disables; default 3600.',
|
|
352
377
|
},
|
|
378
|
+
minutes: {
|
|
379
|
+
type: 'integer',
|
|
380
|
+
enum: [...HEARTBEAT_INTERVAL_CHOICES],
|
|
381
|
+
description: `set_heartbeat_interval: minutes between Mixy's heartbeat checks; default ${DEFAULT_HEARTBEAT_INTERVAL_MINUTES}.`,
|
|
382
|
+
},
|
|
353
383
|
query: { type: 'string', description: 'search_local_models: Hugging Face GGUF search query.' },
|
|
354
384
|
repository: { type: 'string', description: 'inspect_hf_model: public Hugging Face owner/model repository.' },
|
|
355
385
|
filename: {
|
|
@@ -427,6 +457,35 @@ export const SETUP_TOOL_DEFS = Object.freeze([
|
|
|
427
457
|
},
|
|
428
458
|
description: 'set_worktree_settings: only the given fields change.',
|
|
429
459
|
},
|
|
460
|
+
sessionId: {
|
|
461
|
+
type: 'string',
|
|
462
|
+
description:
|
|
463
|
+
'reset_route_fallback (default: this session), continue_in_model, schedule_quota_resume, cancel_quota_resume: session id from status model/agents or the session tool. The last three take another session.',
|
|
464
|
+
},
|
|
465
|
+
actionKind: {
|
|
466
|
+
type: 'string',
|
|
467
|
+
enum: [...ACTION_KINDS],
|
|
468
|
+
description: "set_agent_permission: the action kind row of the agent's permission table.",
|
|
469
|
+
},
|
|
470
|
+
permissionMode: {
|
|
471
|
+
type: 'string',
|
|
472
|
+
enum: [...PERMISSION_MODES],
|
|
473
|
+
description:
|
|
474
|
+
'set_agent_permission: block or ask; allow (and any change that lets an agent do more without asking) is made by the person in the desktop app.',
|
|
475
|
+
},
|
|
476
|
+
tool: { type: 'string', description: 'set_agent_connector_tool: tool name within the connector `name`.' },
|
|
477
|
+
permission: {
|
|
478
|
+
type: 'string',
|
|
479
|
+
enum: [...CONNECTOR_PERMISSIONS],
|
|
480
|
+
description: 'set_agent_connector_tool: needs_approval or disabled; auto is made in the desktop app.',
|
|
481
|
+
},
|
|
482
|
+
botOrder: {
|
|
483
|
+
type: 'array',
|
|
484
|
+
items: { type: 'string', minLength: 1, pattern: '\\S' },
|
|
485
|
+
maxItems: 500,
|
|
486
|
+
description:
|
|
487
|
+
'set_bot_order: bot ids in display order (Mixy is always first and not listed); [] = default order.',
|
|
488
|
+
},
|
|
430
489
|
...SETUP_EXTENDED_PROPERTIES,
|
|
431
490
|
},
|
|
432
491
|
},
|
|
@@ -19,6 +19,8 @@ import {
|
|
|
19
19
|
} from '../../runtime/agent/orchestrator/mcp/agent-connectors.mjs';
|
|
20
20
|
import { agentListEntries } from '../../runtime/agent/orchestrator/session/manager/prompt-utils.mjs';
|
|
21
21
|
import { markToolSurfaceMigrated } from '../../runtime/agent/orchestrator/session/loop/tool-exposure-migration.mjs';
|
|
22
|
+
import { resetBp2StableContext } from '../../runtime/agent/orchestrator/context/collect.mjs';
|
|
23
|
+
import { requestPrefixIdentity } from '../../runtime/agent/orchestrator/session/thinking-binding.mjs';
|
|
22
24
|
import {
|
|
23
25
|
agentProfileRevision,
|
|
24
26
|
leadRosterRevision,
|
|
@@ -40,15 +42,6 @@ const PROMPT_FOLD_INTENT = 'prompt_fold';
|
|
|
40
42
|
// Cache-break intents that already rebuild the conversation's cached prefix.
|
|
41
43
|
const COLD_INTENTS = new Set(['post_turn_compaction', 'manual_compaction']);
|
|
42
44
|
|
|
43
|
-
// What the next request sends ahead of the conversation: the system blocks and tools.
|
|
44
|
-
const promptPrefix = (session) =>
|
|
45
|
-
JSON.stringify([
|
|
46
|
-
(Array.isArray(session.messages) ? session.messages : [])
|
|
47
|
-
.filter((message) => message?.role === 'system')
|
|
48
|
-
.map((message) => message.content),
|
|
49
|
-
session.tools,
|
|
50
|
-
]);
|
|
51
|
-
|
|
52
45
|
// A bot thread built from other shipped rules than these (a release changed one).
|
|
53
46
|
const rulesStale = (session) =>
|
|
54
47
|
sessionModeOf(session) === AGENT_MODE && session.rulesRevision !== promptRulesRevision();
|
|
@@ -208,7 +201,10 @@ export function createAgentProfileFold({
|
|
|
208
201
|
const config = configForSession(getConfig(), session.workflow?.id, currentMode(session));
|
|
209
202
|
const staged = await stagePolicy(session, identity, config, { conversation: true });
|
|
210
203
|
if (getSession?.() !== session) return false;
|
|
211
|
-
const before =
|
|
204
|
+
const before = requestPrefixIdentity(session);
|
|
205
|
+
// BP2 (profile meta, skill manifest) from current sources too; applyPolicy
|
|
206
|
+
// re-appends its deferred manifest.
|
|
207
|
+
if (typeof staged.stableContext === 'string') resetBp2StableContext(session, staged.stableContext);
|
|
212
208
|
applyPolicy(session, staged);
|
|
213
209
|
rewriteConversationBp3Core(session, staged.core);
|
|
214
210
|
if (session.agentProfileRevision !== undefined) {
|
|
@@ -218,17 +214,25 @@ export function createAgentProfileFold({
|
|
|
218
214
|
}
|
|
219
215
|
if (agentMode) session.rulesRevision = promptRulesRevision();
|
|
220
216
|
session.updatedAt = Date.now();
|
|
221
|
-
if (
|
|
217
|
+
if (requestPrefixIdentity(session) === before) return false;
|
|
222
218
|
markToolSurfaceMigrated(session, session.pendingCacheBreakIntent || intent);
|
|
223
219
|
return true;
|
|
224
220
|
}
|
|
225
221
|
|
|
226
222
|
/** Fold pending prompt changes (a switched workflow, a bot's moved tool
|
|
227
|
-
* gates, changed shipped rules) when the cache is cold anyway.
|
|
223
|
+
* gates, changed shipped rules) when the cache is cold anyway. A
|
|
224
|
+
* compaction rebuilds the prompt from current sources whether or not
|
|
225
|
+
* anything is known pending (an update can change shipped rules, skills
|
|
226
|
+
* and manifests no stamp tracks); an unchanged prompt stays byte-identical
|
|
227
|
+
* and adds no break. */
|
|
228
228
|
async function foldPromptIfCold() {
|
|
229
229
|
const session = getSession?.();
|
|
230
|
+
// Scope exception: delegated worker sessions (`owner: 'agent'`) keep the
|
|
231
|
+
// prompt they were created with; they are task-scoped, and their skill
|
|
232
|
+
// bodies are still restored from current sources at Compact.
|
|
230
233
|
if (!session?.id || !session.promptIdentity || isAgentOwner(session)) return false;
|
|
231
|
-
|
|
234
|
+
const compacted = COLD_INTENTS.has(session.pendingCacheBreakIntent);
|
|
235
|
+
if (!compacted && !(foldPending(session) && cacheCold(session))) return false;
|
|
232
236
|
return foldPrompt(session, PROMPT_FOLD_INTENT);
|
|
233
237
|
}
|
|
234
238
|
|
|
@@ -11,9 +11,14 @@ import {
|
|
|
11
11
|
import { deferredSurfaceModeForLead } from '../../runtime/agent/orchestrator/runtime-core/effort.mjs';
|
|
12
12
|
import {
|
|
13
13
|
applyInitialDeferredToolManifestToBp2,
|
|
14
|
+
buildSkillManifest,
|
|
15
|
+
collectPromptSkillsCached,
|
|
14
16
|
composeSystemPrompt,
|
|
15
17
|
} from '../../runtime/agent/orchestrator/context/collect.mjs';
|
|
16
|
-
import {
|
|
18
|
+
import {
|
|
19
|
+
_buildBaseRules,
|
|
20
|
+
_buildLeadMetaContext,
|
|
21
|
+
} from '../../runtime/agent/orchestrator/session/manager/rules-cache.mjs';
|
|
17
22
|
import { sessionRolePromptFields } from '../../runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs';
|
|
18
23
|
import {
|
|
19
24
|
delegationDisabled,
|
|
@@ -130,11 +135,17 @@ export function createPolicyStage({
|
|
|
130
135
|
: _buildBaseRules({
|
|
131
136
|
omitTools: [...denied, unusedModelEditToolName(getRoute()?.model)],
|
|
132
137
|
allowTools: schemaAllowedTools,
|
|
138
|
+
ownerIsAgent,
|
|
133
139
|
provider: getRoute()?.provider,
|
|
134
140
|
model: getRoute()?.model,
|
|
135
141
|
});
|
|
136
142
|
const coreMemoryContext = conversation ? '' : await leadCoreMemoryContext();
|
|
137
|
-
|
|
143
|
+
// BP2's stable part as session creation composes it
|
|
144
|
+
// (session-prompt-composition.mjs): the Lead meta context and the skill
|
|
145
|
+
// manifest of the skills in scope now.
|
|
146
|
+
const skipRules = identity.skipAgentRules || toolFreeRole;
|
|
147
|
+
const skills = schemaAllowedTools?.length === 0 ? [] : collectPromptSkillsCached(session.cwd);
|
|
148
|
+
const { sessionMarkerCore, stableSystemContext } = composeSystemPrompt({
|
|
138
149
|
...sessionRolePromptFields(identity, {
|
|
139
150
|
ownerIsAgent,
|
|
140
151
|
toolFreeRole,
|
|
@@ -149,6 +160,8 @@ export function createPolicyStage({
|
|
|
149
160
|
// setting; agent mode carries none.
|
|
150
161
|
instructionFilesContext:
|
|
151
162
|
conversation || toolFreeRole || agentMode ? null : loadInstructionFilesContext?.(session) || null,
|
|
163
|
+
metaContext: skipRules || ownerIsAgent ? undefined : _buildLeadMetaContext({ includeOutputStyle: !agentMode }),
|
|
164
|
+
skillManifest: buildSkillManifest(skills),
|
|
152
165
|
});
|
|
153
166
|
return {
|
|
154
167
|
workflow,
|
|
@@ -159,6 +172,8 @@ export function createPolicyStage({
|
|
|
159
172
|
ownerIsAgent,
|
|
160
173
|
baseRules,
|
|
161
174
|
core: conversation ? withPresentedWorkspaceSlices(session, sessionMarkerCore) : sessionMarkerCore,
|
|
175
|
+
// Without BP1 the BP2 block cannot be located: null leaves it as it is.
|
|
176
|
+
stableContext: skipRules ? null : stableSystemContext,
|
|
162
177
|
};
|
|
163
178
|
}
|
|
164
179
|
|
|
@@ -80,6 +80,7 @@ export function createAskCallbacks({ transcript, notifyFnForSession, scheduleSea
|
|
|
80
80
|
beforeToolExecution: () => turn.snapshot.promise || Promise.resolve(),
|
|
81
81
|
transcriptMeta: stampCheckpoint(options),
|
|
82
82
|
promptSource: options.promptSource,
|
|
83
|
+
...(options.promptOrigin ? { promptOrigin: options.promptOrigin } : {}),
|
|
83
84
|
// A routine turn's trusted selection text (its instructions only).
|
|
84
85
|
...(typeof options.skillSelection === 'string' ? { skillSelection: options.skillSelection } : {}),
|
|
85
86
|
retryFailedTurn: options.retryFailedTurn === true,
|
|
@@ -19,7 +19,11 @@ import {
|
|
|
19
19
|
writeJsonAtomicSync,
|
|
20
20
|
} from '../../runtime/shared/atomic-file.mjs';
|
|
21
21
|
import { clean } from '../../runtime/agent/orchestrator/runtime-core/session-text.mjs';
|
|
22
|
-
import {
|
|
22
|
+
import {
|
|
23
|
+
agentEntryFile,
|
|
24
|
+
agentEntryPath,
|
|
25
|
+
parseManifestText,
|
|
26
|
+
} from '../../runtime/agent/orchestrator/runtime-core/workflow/agents.mjs';
|
|
23
27
|
import { hasOwn } from '../../runtime/shared/object.mjs';
|
|
24
28
|
import { serializeFrontmatterDoc } from '../../runtime/shared/markdown-frontmatter.mjs';
|
|
25
29
|
import { isHiddenAgent } from '../../runtime/agent/orchestrator/internal-agents.mjs';
|
|
@@ -22,7 +22,11 @@ import {
|
|
|
22
22
|
|
|
23
23
|
/** Mixy's runtime id (agent-home.mjs MIXY_AGENT_ID). */
|
|
24
24
|
const MIXY_RUNTIME_ID = 'lead';
|
|
25
|
-
import {
|
|
25
|
+
import {
|
|
26
|
+
canonicalRouteProvider,
|
|
27
|
+
routeChain,
|
|
28
|
+
validateRouteChainProviders,
|
|
29
|
+
} from '../../runtime/shared/model-route-chain.mjs';
|
|
26
30
|
|
|
27
31
|
// Agent route persistence. Route-scope isolation: an agent route owns its
|
|
28
32
|
// model AND its effort/fast, stored in config.agents[<id>]. The shared
|
|
@@ -183,18 +187,25 @@ export function createAgentRouteApi(deps) {
|
|
|
183
187
|
}
|
|
184
188
|
if (!clean(requested.provider)) return clearOverride(id);
|
|
185
189
|
if (!clean(requested.model)) throw new Error('agent route requires provider and model');
|
|
190
|
+
// An explicit list is validated; the stored one may hold a fallback on the
|
|
191
|
+
// picked model's provider, which stays saved untouched and inactive.
|
|
192
|
+
const explicitFallbacks = hasOwn(requested, 'fallbacks');
|
|
186
193
|
const chain = routeChain({
|
|
187
194
|
...requested,
|
|
188
|
-
fallbacks:
|
|
195
|
+
fallbacks: explicitFallbacks ? requested.fallbacks : stored.fallbacks,
|
|
189
196
|
});
|
|
190
|
-
validateRouteChainProviders(chain);
|
|
197
|
+
validateRouteChainProviders(chain, { allowDuplicates: !explicitFallbacks });
|
|
191
198
|
const storedChain = routeChain(stored);
|
|
192
199
|
const resolved = [];
|
|
200
|
+
const usedProviders = new Set();
|
|
193
201
|
for (const entry of chain) {
|
|
202
|
+
const provider = canonicalRouteProvider(entry.provider);
|
|
203
|
+
const inactive = usedProviders.has(provider);
|
|
204
|
+
usedProviders.add(provider);
|
|
194
205
|
const previous = storedChain.find(
|
|
195
206
|
(candidate) => candidate.provider === entry.provider && candidate.model === entry.model
|
|
196
207
|
);
|
|
197
|
-
resolved.push(await resolveChainEntry(deps, entry, previous || {}));
|
|
208
|
+
resolved.push(inactive ? entry : await resolveChainEntry(deps, entry, previous || {}));
|
|
198
209
|
}
|
|
199
210
|
const [primary, ...fallbacks] = resolved;
|
|
200
211
|
const routeToSave = normalizeWorkflowRoute({ ...primary, fallbacks });
|
|
@@ -20,7 +20,7 @@ import { resolveDataDir } from './shared.mjs';
|
|
|
20
20
|
function applyWorkflowSlots(workflowInput, draft) {
|
|
21
21
|
for (const slot of WORKFLOW_ROUTE_SLOTS) {
|
|
22
22
|
if (!hasOwn(workflowInput, slot)) continue;
|
|
23
|
-
const normalized = normalizeWorkflowRoute(workflowInput[slot]);
|
|
23
|
+
const normalized = normalizeWorkflowRoute(workflowInput[slot], {}, { strict: true });
|
|
24
24
|
if (slot === 'lead') {
|
|
25
25
|
if (!normalized) continue;
|
|
26
26
|
draft.presets = upsertWorkflowPreset(draft.presets, 'lead', normalized);
|
|
@@ -40,7 +40,7 @@ function applyAgentRouteInput(agentInput, agentRoutes, configurableIds) {
|
|
|
40
40
|
const nextAgents = { ...agentRoutes };
|
|
41
41
|
for (const id of configurableIds) {
|
|
42
42
|
if (!hasOwn(agentInput, id)) continue;
|
|
43
|
-
const routeToSave = normalizeWorkflowRoute(agentInput[id]);
|
|
43
|
+
const routeToSave = normalizeWorkflowRoute(agentInput[id], {}, { strict: true });
|
|
44
44
|
if (routeToSave) nextAgents[id] = routeToSave;
|
|
45
45
|
else delete nextAgents[id];
|
|
46
46
|
}
|
|
@@ -67,7 +67,7 @@ export function createOnboardingApi(deps) {
|
|
|
67
67
|
const config = getConfig();
|
|
68
68
|
const nextConfig = { ...config };
|
|
69
69
|
const defaultRoute = hasOwn(payload, 'defaultRoute')
|
|
70
|
-
? normalizeWorkflowRoute(payload.defaultRoute, getRoute())
|
|
70
|
+
? normalizeWorkflowRoute(payload.defaultRoute, getRoute(), { strict: true })
|
|
71
71
|
: null;
|
|
72
72
|
const draft = {
|
|
73
73
|
presets: Array.isArray(nextConfig.presets) ? nextConfig.presets.slice() : [],
|
|
@@ -64,6 +64,10 @@ export function createStyleAndModeApi(deps) {
|
|
|
64
64
|
listOutputStyles: () => getOutputStyleStatusCached(),
|
|
65
65
|
setOutputStyle,
|
|
66
66
|
getOrchestrationMode: () => configuredOrchestrationMode(displayConfig()),
|
|
67
|
+
// The default new sessions inherit. The runtime facade's own
|
|
68
|
+
// getOrchestrationMode answers for the ACTIVE session when one exists, so a
|
|
69
|
+
// New Task composer reads this one: it never depends on which session is open.
|
|
70
|
+
getConfiguredOrchestrationMode: () => configuredOrchestrationMode(displayConfig()),
|
|
67
71
|
setOrchestrationMode,
|
|
68
72
|
};
|
|
69
73
|
}
|
|
@@ -752,6 +752,30 @@ export function createWorkspaceTransitions({
|
|
|
752
752
|
return maintenance.pruneWorktrees({ ...(await maintenanceScope()), repoCommonDir });
|
|
753
753
|
}
|
|
754
754
|
|
|
755
|
+
/**
|
|
756
|
+
* Remove managed worktree `entryId` whose owner is gone (listed `ownerLive:
|
|
757
|
+
* false, removable: true`), on an explicit request: no owner lane exists to
|
|
758
|
+
* do it. No stored or live session may still use the folder; the manager
|
|
759
|
+
* reads the retention again under the repository lock (an owner that came
|
|
760
|
+
* back refuses) and keeps its guards: dirty or unmerged work needs `force`,
|
|
761
|
+
* other sessions' references and retained recovery data refuse, and only
|
|
762
|
+
* the managed checkout is deleted.
|
|
763
|
+
*/
|
|
764
|
+
async function removeOrphanWorktree({ entryId, force = false } = {}) {
|
|
765
|
+
const row = (await listWorktrees()).find((item) => item.id === entryId);
|
|
766
|
+
if (!row) throw worktreeError('WORKTREE_MISSING', undefined, { entryId });
|
|
767
|
+
const removed = await withManagementFolders([row.path], true, async () => {
|
|
768
|
+
const { liveSessionIds, listSessionIds, manager: backendApi } = await maintenanceScope();
|
|
769
|
+
return backendApi.removeOrphanedWorktree({
|
|
770
|
+
entryId,
|
|
771
|
+
force: force === true,
|
|
772
|
+
liveSessionIds,
|
|
773
|
+
retainedSessionIds: await listSessionIds(),
|
|
774
|
+
});
|
|
775
|
+
});
|
|
776
|
+
return { removed, entryId, path: row.path };
|
|
777
|
+
}
|
|
778
|
+
|
|
755
779
|
/** After `sessionId` was deleted: autoCleanup removes its clean, merged worktree. */
|
|
756
780
|
async function cleanupDeletedSession(sessionId) {
|
|
757
781
|
// Its snapshots go with it below; no turn cleanup keeps retrying them.
|
|
@@ -1219,6 +1243,7 @@ export function createWorkspaceTransitions({
|
|
|
1219
1243
|
switchProject,
|
|
1220
1244
|
listWorktrees,
|
|
1221
1245
|
pruneWorktrees,
|
|
1246
|
+
removeOrphanWorktree,
|
|
1222
1247
|
cleanupDeletedSession,
|
|
1223
1248
|
onWorktreeSetup,
|
|
1224
1249
|
dispose,
|
|
@@ -27,12 +27,7 @@ const loadManager = () => import('../../runtime/shared/worktrees/manager.mjs');
|
|
|
27
27
|
* @param {((args: object, context: object) => Promise<any>)|null} [deps.executeSessionControl] Cross-session lane.
|
|
28
28
|
* @param {object|null} [deps.manager] Managed-worktree backend override (tests).
|
|
29
29
|
*/
|
|
30
|
-
export function createWorktreeToolHost({
|
|
31
|
-
getSession,
|
|
32
|
-
getWorkspaceApi,
|
|
33
|
-
executeSessionControl = null,
|
|
34
|
-
manager = null,
|
|
35
|
-
}) {
|
|
30
|
+
export function createWorktreeToolHost({ getSession, getWorkspaceApi, executeSessionControl = null, manager = null }) {
|
|
36
31
|
const backend = () => (manager ? Promise.resolve(manager) : loadManager());
|
|
37
32
|
|
|
38
33
|
function workspaceApi() {
|
|
@@ -102,7 +97,11 @@ export function createWorktreeToolHost({
|
|
|
102
97
|
'The project folder has no checked-out branch to return to (detached HEAD).'
|
|
103
98
|
);
|
|
104
99
|
}
|
|
105
|
-
return lane.call('selectBranch', {
|
|
100
|
+
return lane.call('selectBranch', {
|
|
101
|
+
branch: projectBranch,
|
|
102
|
+
expectedRevision: workspace.revision,
|
|
103
|
+
txId: request.txId,
|
|
104
|
+
});
|
|
106
105
|
}
|
|
107
106
|
|
|
108
107
|
/** The desktop's "merge": into the confirmed merge target, then the cleanup autoCleanup allows. */
|
|
@@ -116,6 +115,15 @@ export function createWorktreeToolHost({
|
|
|
116
115
|
});
|
|
117
116
|
}
|
|
118
117
|
|
|
118
|
+
/**
|
|
119
|
+
* The listed worktree matching `predicate` whose owner is gone and that the
|
|
120
|
+
* list reports removable, or null: no owner lane can remove it.
|
|
121
|
+
*/
|
|
122
|
+
async function orphan(predicate) {
|
|
123
|
+
const rows = await workspaceApi().listWorktrees();
|
|
124
|
+
return rows.find((row) => predicate(row) && row.ownerLive === false && row.removable === true) ?? null;
|
|
125
|
+
}
|
|
126
|
+
|
|
119
127
|
/**
|
|
120
128
|
* `git worktree remove <path>`: the managed removal of whichever owner
|
|
121
129
|
* holds it — this session's snapshot, or the worktree a session retains
|
|
@@ -129,6 +137,9 @@ export function createWorktreeToolHost({
|
|
|
129
137
|
);
|
|
130
138
|
}
|
|
131
139
|
if (entry.kind === 'snapshot') return workspaceApi().removeSnapshot({ path: entry.path, force: request.force });
|
|
140
|
+
if (entry.ownerSessionId !== callerSessionId && (await orphan((row) => row.id === entry.id))) {
|
|
141
|
+
return workspaceApi().removeOrphanWorktree({ entryId: entry.id, force: request.force === true });
|
|
142
|
+
}
|
|
132
143
|
if (!entry.ownerSessionId) {
|
|
133
144
|
throw new Error(
|
|
134
145
|
`git worktree remove: no session retains ${entry.path}; git worktree prune removes it once it is clean and merged`
|
|
@@ -161,8 +172,14 @@ export function createWorktreeToolHost({
|
|
|
161
172
|
return back(lane(), request);
|
|
162
173
|
case 'merge':
|
|
163
174
|
return merge(lane());
|
|
164
|
-
case 'remove':
|
|
165
|
-
|
|
175
|
+
case 'remove': {
|
|
176
|
+
const force = request.force === true;
|
|
177
|
+
if (request.sessionId && request.sessionId !== callerSessionId) {
|
|
178
|
+
const gone = await orphan((row) => row.ownerSessionId === request.sessionId);
|
|
179
|
+
if (gone) return workspaceApi().removeOrphanWorktree({ entryId: gone.id, force });
|
|
180
|
+
}
|
|
181
|
+
return lane().call('removeWorktree', { force });
|
|
182
|
+
}
|
|
166
183
|
case 'list':
|
|
167
184
|
return workspaceApi().listWorktrees({ includeSnapshots: true });
|
|
168
185
|
case 'prune':
|