mixdog 0.9.151 → 0.9.153
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/LICENSES/browser-import-NOTICE.txt +11 -0
- package/NOTICE.md +11 -0
- package/README.md +108 -68
- package/package.json +17 -4
- package/scripts/computer-task-cost-report.mjs +144 -0
- package/scripts/run-office-live-tests.mjs +32 -0
- package/scripts/tool-stress.mjs +0 -2
- package/src/agents/front-worker/AGENT.md +13 -0
- package/src/agents/front-worker/agent.json +6 -0
- package/src/agents/heavy-worker/AGENT.md +10 -11
- package/src/agents/heavy-worker/agent.json +1 -1
- package/src/agents/maintainer/AGENT.md +0 -2
- package/src/agents/reviewer/AGENT.md +9 -13
- package/src/agents/reviewer/agent.json +1 -1
- package/src/agents/security/AGENT.md +14 -0
- package/src/agents/security/agent.json +6 -0
- package/src/agents/worker/AGENT.md +8 -8
- package/src/agents/worker/agent.json +1 -1
- package/src/agents/writer/AGENT.md +14 -0
- package/src/agents/writer/agent.json +6 -0
- package/src/defaults/skills/setup/SKILL.md +18 -27
- package/src/headless-exec.mjs +3 -10
- package/src/headless-exec.test.mjs +2 -7
- package/src/rules/agent/00-common.md +4 -7
- package/src/rules/lead/01-general.md +0 -3
- package/src/rules/shared/10-tool-workflow.md +10 -2
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +183 -26
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.test.mjs +378 -0
- package/src/runtime/agent/orchestrator/agent-runtime/session-builder.mjs +4 -0
- package/src/runtime/agent/orchestrator/cache-break-trace.mjs +109 -0
- package/src/runtime/agent/orchestrator/cache-break-trace.test.mjs +115 -0
- package/src/runtime/agent/orchestrator/config.mjs +13 -68
- package/src/runtime/agent/orchestrator/context/collect-skills.test.mjs +153 -0
- package/src/runtime/agent/orchestrator/context/collect.mjs +49 -45
- package/src/runtime/agent/orchestrator/mcp/client.mjs +242 -15
- package/src/runtime/agent/orchestrator/mcp/features.test.mjs +66 -0
- package/src/runtime/agent/orchestrator/mcp/security.test.mjs +36 -20
- package/src/runtime/agent/orchestrator/providers/admission-scheduler-metrics.test.mjs +47 -0
- package/src/runtime/agent/orchestrator/providers/admission-scheduler.mjs +16 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +54 -33
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth.mjs +7 -0
- package/src/runtime/agent/orchestrator/providers/gemini-schema.mjs +7 -0
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +3 -8
- package/src/runtime/agent/orchestrator/providers/gemini.mjs +7 -0
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +19 -3
- package/src/runtime/agent/orchestrator/providers/lib/provider-replay.mjs +50 -0
- package/src/runtime/agent/orchestrator/providers/lib/sse-framing.mjs +93 -0
- package/src/runtime/agent/orchestrator/providers/media-normalization.mjs +30 -9
- package/src/runtime/agent/orchestrator/providers/media-parity.test.mjs +59 -0
- package/src/runtime/agent/orchestrator/providers/model-list-sanitize.mjs +3 -3
- package/src/runtime/agent/orchestrator/providers/openai-codex-identity.test.mjs +71 -0
- package/src/runtime/agent/orchestrator/providers/openai-codex-metadata.mjs +18 -26
- package/src/runtime/agent/orchestrator/providers/openai-compat-presets.mjs +8 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +7 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-wire.mjs +25 -2
- package/src/runtime/agent/orchestrator/providers/openai-compat.mjs +35 -4
- package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +47 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +103 -12
- package/src/runtime/agent/orchestrator/providers/openai-responses-payload.mjs +13 -0
- package/src/runtime/agent/orchestrator/providers/openai-turn-state.mjs +68 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-delta-parity.test.mjs +122 -6
- package/src/runtime/agent/orchestrator/providers/openai-ws-delta.mjs +36 -11
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +144 -93
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +18 -13
- package/src/runtime/agent/orchestrator/providers/provider-replay.test.mjs +288 -0
- package/src/runtime/agent/orchestrator/providers/sse-framing.test.mjs +719 -0
- package/src/runtime/agent/orchestrator/providers/stream-json-pool.mjs +399 -39
- package/src/runtime/agent/orchestrator/providers/stream-json-worker.mjs +26 -0
- package/src/runtime/agent/orchestrator/session/agent-loop.mjs +86 -7
- package/src/runtime/agent/orchestrator/session/agent-loop.test.mjs +222 -0
- package/src/runtime/agent/orchestrator/session/browser-snapshot-supersession.mjs +61 -0
- package/src/runtime/agent/orchestrator/session/browser-snapshot-supersession.test.mjs +83 -0
- package/src/runtime/agent/orchestrator/session/cache/read-cache.mjs +13 -0
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +26 -2
- package/src/runtime/agent/orchestrator/session/compact-policy.test.mjs +112 -0
- package/src/runtime/agent/orchestrator/session/compaction-read-reset.test.mjs +192 -0
- package/src/runtime/agent/orchestrator/session/context-usage-restart.test.mjs +72 -0
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +100 -15
- package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +17 -1
- package/src/runtime/agent/orchestrator/session/eager-dispatch.test.mjs +74 -0
- package/src/runtime/agent/orchestrator/session/image-strip-recovery.mjs +12 -8
- package/src/runtime/agent/orchestrator/session/image-strip-recovery.test.mjs +20 -1
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +110 -2
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +3 -16
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.test.mjs +28 -0
- package/src/runtime/agent/orchestrator/session/loop/recall-fasttrack.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/loop/steering.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +15 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +111 -39
- package/src/runtime/agent/orchestrator/session/manager/ask-session.test.mjs +46 -0
- package/src/runtime/agent/orchestrator/session/manager/compaction-runner.mjs +30 -6
- package/src/runtime/agent/orchestrator/session/manager/message-sanitize.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +27 -3
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +26 -54
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.test.mjs +63 -1
- package/src/runtime/agent/orchestrator/session/manager/status-telemetry.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +4 -110
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.mjs +580 -0
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-journal.test.mjs +593 -0
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +119 -190
- package/src/runtime/agent/orchestrator/session/manager/turn-interruption.mjs +115 -0
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +43 -8
- package/src/runtime/agent/orchestrator/session/provider-prefix-guard.mjs +129 -12
- package/src/runtime/agent/orchestrator/session/send-with-recovery.mjs +9 -2
- package/src/runtime/agent/orchestrator/session/store/listing.mjs +8 -1
- package/src/runtime/agent/orchestrator/session/store/save-worker.mjs +15 -1
- package/src/runtime/agent/orchestrator/session/store-live-publication.test.mjs +83 -0
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +36 -2
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +157 -30
- package/src/runtime/agent/orchestrator/session/store-summary-reader.test.mjs +64 -0
- package/src/runtime/agent/orchestrator/session/store-summary-visibility.mjs +57 -0
- package/src/runtime/agent/orchestrator/session/store-summary-visibility.test.mjs +219 -0
- package/src/runtime/agent/orchestrator/session/store.mjs +26 -2
- package/src/runtime/agent/orchestrator/session/tool-batch.mjs +22 -0
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool-cwd-env.test.mjs +14 -0
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +19 -10
- package/src/runtime/agent/orchestrator/tools/builtin/find-search-budget.test.mjs +30 -14
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.mjs +15 -4
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +73 -15
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.test.mjs +76 -2
- package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +24 -683
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +64 -72
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-runner.mjs +2 -5
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-transport.mjs +75 -0
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-transport.test.mjs +24 -0
- package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +6 -6
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +12 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/constants.mjs +4 -1
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +24 -5
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.test.mjs +44 -0
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-binary.mjs +12 -2
- package/src/runtime/agent/orchestrator/tools/code-graph/graph-model.mjs +35 -21
- package/src/runtime/agent/orchestrator/tools/code-graph/memory-cache.mjs +28 -13
- package/src/runtime/agent/orchestrator/tools/code-graph/memory-cache.test.mjs +54 -0
- package/src/runtime/agent/orchestrator/tools/graph-manifest.json +11 -11
- package/src/runtime/agent/orchestrator/tools/patch-manifest.json +11 -11
- package/src/runtime/agent/orchestrator/tools/progress-message.mjs +12 -0
- package/src/runtime/agent/orchestrator/tools/spawn-manifest.json +11 -11
- package/src/runtime/attachments/pdf-extract.mjs +3 -0
- package/src/runtime/attachments/pdfjs-runtime.mjs +13 -0
- package/src/runtime/bridge-clients.test.mjs +827 -0
- package/src/runtime/browser-bridge/action-schema.mjs +251 -0
- package/src/runtime/browser-bridge/client.mjs +152 -0
- package/src/runtime/browser-bridge/tool-defs.mjs +159 -0
- package/src/runtime/computer-bridge/action-schema.mjs +653 -0
- package/src/runtime/computer-bridge/client.mjs +231 -0
- package/src/runtime/computer-bridge/tool-defs.mjs +33 -0
- package/src/runtime/media/store.mjs +18 -8
- package/src/runtime/media/store.test.mjs +14 -0
- package/src/runtime/memory/index.mjs +1 -1
- package/src/runtime/memory/lib/transcript-ingest.mjs +8 -6
- package/src/runtime/memory/lib/transcript-ingest.test.mjs +52 -0
- package/src/runtime/office/assurance-benchmark.mjs +358 -0
- package/src/runtime/office/assurance.mjs +833 -0
- package/src/runtime/office/benchmark.mjs +496 -0
- package/src/runtime/office/capabilities.mjs +551 -0
- package/src/runtime/office/com-adapter.mjs +283 -0
- package/src/runtime/office/content-model.mjs +183 -0
- package/src/runtime/office/contract-benchmark.mjs +105 -0
- package/src/runtime/office/design-library.mjs +1562 -0
- package/src/runtime/office/design-system.mjs +1966 -0
- package/src/runtime/office/index.mjs +2413 -0
- package/src/runtime/office/journal.mjs +82 -0
- package/src/runtime/office/office-assurance.test.mjs +371 -0
- package/src/runtime/office/office-com-host.ps1 +3781 -0
- package/src/runtime/office/office-com-session-host.ps1 +855 -0
- package/src/runtime/office/office-live-runtime.test.mjs +819 -0
- package/src/runtime/office/office-runtime.test.mjs +2070 -0
- package/src/runtime/office/ooxml-validator.mjs +271 -0
- package/src/runtime/office/pagination.mjs +132 -0
- package/src/runtime/office/pdf-adapter.mjs +591 -0
- package/src/runtime/office/pdf-analysis.mjs +372 -0
- package/src/runtime/office/pdf-render.mjs +167 -0
- package/src/runtime/office/pdf-security.mjs +63 -0
- package/src/runtime/office/polish-benchmark.mjs +190 -0
- package/src/runtime/office/portable-ooxml.mjs +1867 -0
- package/src/runtime/office/quality-live-benchmark.mjs +486 -0
- package/src/runtime/office/quality-pipeline.mjs +136 -0
- package/src/runtime/office/tabular.mjs +302 -0
- package/src/runtime/office/templates/mixdog-executive.pptx +0 -0
- package/src/runtime/office/templates/mixdog-executive.pptx.mixdog.json +190 -0
- package/src/runtime/office/tool-defs.mjs +113 -0
- package/src/runtime/office/visual-diff.mjs +89 -0
- package/src/runtime/office/xlsx-assertions.mjs +172 -0
- package/src/runtime/office/xlsx-contract.mjs +147 -0
- package/src/runtime/shared/agent-route-config.mjs +9 -0
- package/src/runtime/shared/child-spawn-gate.mjs +17 -0
- package/src/runtime/shared/child-spawn-remote.mjs +69 -7
- package/src/runtime/shared/child-spawn-remote.test.mjs +124 -0
- package/src/runtime/shared/pristine-execution-contract.json +2 -1
- package/src/runtime/shared/provider-api-key.mjs +1 -0
- package/src/runtime/shared/session-runtime-health.mjs +91 -0
- package/src/runtime/shared/session-runtime-health.test.mjs +53 -0
- package/src/runtime/shared/skill-document.mjs +86 -0
- package/src/runtime/shared/skill-document.test.mjs +81 -0
- package/src/runtime/shared/tool-execution-contract.mjs +16 -0
- package/src/runtime/shared/tool-surface.mjs +27 -0
- package/src/runtime/shared/turn-snapshot-store.mjs +1 -0
- package/src/runtime/shared/turn-snapshot.mjs +32 -9
- package/src/runtime/shared/user-cwd.mjs +33 -14
- package/src/runtime/shared/user-cwd.test.mjs +43 -0
- package/src/session-runtime/agent-disable.test.mjs +20 -1
- package/src/session-runtime/context-status.mjs +9 -3
- package/src/session-runtime/cwd-plugins.mjs +26 -26
- package/src/session-runtime/cwd-plugins.test.mjs +75 -0
- package/src/session-runtime/cwd-tool-routing.test.mjs +5 -0
- package/src/session-runtime/deferred-tool-delta.mjs +104 -0
- package/src/session-runtime/deferred-tool-delta.test.mjs +40 -0
- package/src/session-runtime/global-extensions.mjs +26 -0
- package/src/session-runtime/global-extensions.test.mjs +28 -0
- package/src/session-runtime/global-settings-session-identity.test.mjs +76 -0
- package/src/session-runtime/goal-runtime.mjs +1141 -0
- package/src/session-runtime/goal-runtime.test.mjs +645 -0
- package/src/session-runtime/lifecycle-api.mjs +58 -11
- package/src/session-runtime/lifecycle-api.test.mjs +183 -0
- package/src/session-runtime/mcp-glue.mjs +49 -47
- package/src/session-runtime/plugin-mcp-standard.test.mjs +177 -0
- package/src/session-runtime/plugin-mcp.mjs +96 -22
- package/src/session-runtime/prewarm.mjs +1 -10
- package/src/session-runtime/provider-request-snapshot.mjs +33 -9
- package/src/session-runtime/provider-request-snapshot.test.mjs +27 -5
- package/src/session-runtime/resource-api-global.test.mjs +109 -0
- package/src/session-runtime/resource-api.mjs +168 -116
- package/src/session-runtime/runtime-core.mjs +208 -29
- package/src/session-runtime/runtime-tunables.mjs +6 -8
- package/src/session-runtime/session-lifecycle.mjs +34 -12
- package/src/session-runtime/session-title.mjs +2 -2
- package/src/session-runtime/session-turn-api.mjs +37 -25
- package/src/session-runtime/skills-api.mjs +79 -25
- package/src/session-runtime/skills-api.test.mjs +99 -0
- package/src/session-runtime/tool-catalog-data.mjs +1 -1
- package/src/session-runtime/tool-catalog-schema.mjs +0 -5
- package/src/session-runtime/tool-catalog.mjs +42 -112
- package/src/session-runtime/tool-defs.mjs +6 -1
- package/src/session-runtime/tool-policy-surface.test.mjs +93 -17
- package/src/session-runtime/tool-surface.mjs +30 -8
- package/src/session-runtime/workflow-agents-api.mjs +8 -25
- package/src/session-runtime/workflow.mjs +8 -6
- package/src/standalone/agent-dispatch-broker.mjs +5 -9
- package/src/standalone/agent-tool/helpers.mjs +2 -2
- package/src/standalone/agent-tool/job-views.mjs +3 -1
- package/src/standalone/agent-tool/notify.mjs +11 -9
- package/src/standalone/agent-tool/notify.test.mjs +37 -0
- package/src/standalone/agent-tool/render.mjs +3 -0
- package/src/standalone/agent-tool/spawn-flow.mjs +61 -16
- package/src/standalone/agent-tool/spawn-flow.test.mjs +41 -0
- package/src/standalone/agent-tool/tool-def.mjs +1 -1
- package/src/standalone/agent-tool/worker-index.mjs +123 -0
- package/src/standalone/agent-tool/worker-index.test.mjs +132 -0
- package/src/standalone/agent-tool/worker-rows.mjs +2 -1
- package/src/standalone/agent-tool.mjs +57 -10
- package/src/standalone/daemon.mjs +113 -15
- package/src/standalone/hook-bus/config.mjs +1 -0
- package/src/standalone/plugin-admin.mjs +17 -0
- package/src/standalone/plugin-admin.test.mjs +7 -0
- package/src/standalone/provider-admin.mjs +1 -0
- package/src/standalone/session-protocol.mjs +5 -0
- package/src/standalone/session-runtime-agent-control-client.mjs +133 -0
- package/src/standalone/session-runtime-agent-control-client.test.mjs +71 -0
- package/src/standalone/session-runtime-dispatch-cancel.test.mjs +139 -0
- package/src/standalone/session-runtime-host-factory.mjs +17 -0
- package/src/standalone/session-runtime-host-factory.test.mjs +31 -0
- package/src/standalone/session-runtime-host-health.test.mjs +5 -0
- package/src/standalone/session-runtime-host.mjs +709 -58
- package/src/standalone/session-runtime-inline-host.mjs +258 -0
- package/src/standalone/session-runtime-inline-host.test.mjs +385 -0
- package/src/standalone/session-runtime-provider-cooldown.mjs +78 -0
- package/src/standalone/session-runtime-provider-cooldown.test.mjs +80 -0
- package/src/standalone/session-runtime-shard-host.test.mjs +642 -0
- package/src/standalone/session-runtime-shard-router.mjs +149 -0
- package/src/standalone/session-runtime-shard-router.test.mjs +101 -0
- package/src/standalone/session-runtime-worker.mjs +302 -26
- package/src/standalone/session-service-agent-tree.test.mjs +984 -0
- package/src/standalone/session-service-goal-recovery.test.mjs +177 -0
- package/src/standalone/session-service.mjs +711 -11
- package/src/tui/app/app-view.jsx +1 -0
- package/src/tui/app/core-memory-picker.mjs +2 -0
- package/src/tui/app/extension-pickers.mjs +1 -1
- package/src/tui/app/maintenance-pickers.mjs +3 -3
- package/src/tui/app/model-options.mjs +2 -0
- package/src/tui/app/model-picker.mjs +14 -4
- package/src/tui/app/panel-handoff.test.mjs +311 -0
- package/src/tui/app/project-picker.mjs +1 -0
- package/src/tui/app/route-pickers.mjs +21 -6
- package/src/tui/app/settings-picker.mjs +26 -3
- package/src/tui/app/slash-commands.mjs +1 -0
- package/src/tui/app/slash-dispatch.mjs +73 -22
- package/src/tui/app/theme-effort-pickers.mjs +7 -2
- package/src/tui/components/Picker.jsx +10 -1
- package/src/tui/dist/index.mjs +187 -45
- package/src/tui/lib/voice-setup.mjs +4 -1
- package/src/tui/session/agent-message-source.test.mjs +37 -0
- package/src/tui/session/completion-card-restore.test.mjs +50 -0
- package/src/tui/session/context-state.mjs +3 -13
- package/src/tui/session/goal-continuation.mjs +141 -0
- package/src/tui/session/goal-continuation.test.mjs +203 -0
- package/src/tui/session/queue-helpers.mjs +5 -2
- package/src/tui/session/session-action-surface.test.mjs +190 -0
- package/src/tui/session/session-api-ext.mjs +48 -8
- package/src/tui/session/session-api.mjs +73 -1
- package/src/tui/session/session-flow.mjs +31 -1
- package/src/tui/session/turn.mjs +88 -15
- package/src/tui/session-local.mjs +39 -3
- package/src/vendor/statusline/src/gateway/route-meta.mjs +31 -0
- package/src/runtime/agent/orchestrator/tools/builtin/fuzzy-match.mjs +0 -301
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Security
|
|
3
|
+
description: Use for security audits, threat and risk reviews, vulnerability analysis, or explicitly requested security hardening.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Own the assigned security analysis or hardening task.
|
|
7
|
+
|
|
8
|
+
Trace the relevant attack surface, trust boundaries, permissions, inputs, and
|
|
9
|
+
data flow. Base every finding on concrete evidence and distinguish confirmed
|
|
10
|
+
vulnerabilities from residual risk. Do not modify files during an audit unless
|
|
11
|
+
the brief explicitly requests remediation.
|
|
12
|
+
|
|
13
|
+
Report severity, exploitability, evidence with `file:line`, impact, and the
|
|
14
|
+
smallest actionable recommendation. Avoid speculation and exaggerated claims.
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
2
|
+
name: Worker
|
|
3
|
+
description: Default implementation agent. Use for implementation work unless a specialized agent is clearly more appropriate.
|
|
3
4
|
---
|
|
4
5
|
|
|
5
|
-
# Worker
|
|
6
6
|
Scoped implementation agent.
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
Implement the assigned task directly. Keep changes focused on the requested
|
|
9
|
+
outcome, follow exact constraints and established project patterns, and avoid
|
|
10
|
+
unrelated cleanup or redesign.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
When blocked, stop at the first concrete boundary and report the blocker with
|
|
13
|
+
the relevant `file:line`.
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
Hand off the completed outcome and changed `file:line`.
|
|
16
16
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Writer
|
|
3
|
+
description: Use for translation, editing, rewriting, tone alignment, and final-copy polishing.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
Own the final text.
|
|
7
|
+
|
|
8
|
+
Preserve meaning, facts, terminology, formatting, and intended audience while
|
|
9
|
+
making the writing natural and consistent with the document's tone. Translate
|
|
10
|
+
idiomatically rather than word-for-word.
|
|
11
|
+
|
|
12
|
+
Do not invent facts, add commentary, or delegate the work. Return final copy
|
|
13
|
+
only unless the brief explicitly assigns file edits; then hand off changed
|
|
14
|
+
paths.
|
|
@@ -15,7 +15,7 @@ description: Use this skill only to inspect or modify a Mixdog user's persisted
|
|
|
15
15
|
|
|
16
16
|
- `<mixdogData>` 해석 순서: `MIXDOG_DATA_DIR` → `<MIXDOG_HOME|~/.mixdog>/data` (`src/runtime/shared/plugin-paths.mjs`)
|
|
17
17
|
- 통합 config: `<mixdogData>/mixdog-config.json`
|
|
18
|
-
- 프로젝트 config: `<cwd>/.
|
|
18
|
+
- 프로젝트 config: `<cwd>/.mixdog/hooks.json`
|
|
19
19
|
- TUI 명령 목록: `src/tui/app/slash-commands.mjs`
|
|
20
20
|
- TUI 설정 허브: `/setting` (별칭 `/settings`, `/config`) → `src/tui/app/settings-picker.mjs`
|
|
21
21
|
- Desktop 설정: `Ctrl+,` → General / Context / Output style / Providers / Git / Skills / MCP / Plugins / Hooks / Connection / System / Shortcuts / About
|
|
@@ -111,7 +111,8 @@ API 키·토큰·OAuth 자격은 config에 쓰지 않는다.
|
|
|
111
111
|
1. **확인**: Desktop **Settings → General → Web search**, TUI `/setting → Web search`.
|
|
112
112
|
2. **변경**: toggle → `setWebSearchEnabled()`.
|
|
113
113
|
3. **저장**: `agent.modules.webSearch.enabled`.
|
|
114
|
-
4.
|
|
114
|
+
4. **검색 범위**: 전역 `<mixdogData>/skills/`와 활성 Plugin skill만 사용한다. Project `.mixdog/skills/`는 읽지 않는다.
|
|
115
|
+
5. **검증**: 열린 runtime과 다음 세션의 tool surface.
|
|
115
116
|
|
|
116
117
|
### reasoning effort / Fast
|
|
117
118
|
|
|
@@ -263,18 +264,15 @@ TUI·Desktop interval 편집 UI는 없다.
|
|
|
263
264
|
|
|
264
265
|
### MCP 추가
|
|
265
266
|
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
1. **확인**: `/mcp` 또는 Desktop **Settings → MCP**, `mcpStatus()`, `<cwd>/.mcp.json`.
|
|
267
|
+
1. **확인**: `/mcp` 또는 Desktop **Settings → MCP**, `mcpStatus()`, `agent.mcpServers`.
|
|
269
268
|
2. **변경**:
|
|
270
|
-
-
|
|
271
|
-
-
|
|
269
|
+
- Desktop: **Settings → MCP → Add**
|
|
270
|
+
- 디스크: `agent.mcpServers.<name>` 편집
|
|
272
271
|
- API 자동화: `addMcpServer()`, `removeMcpServer()`, `reconnectMcp()`
|
|
273
272
|
3. **transport**:
|
|
274
273
|
- stdio: `type`, `command`, `args`, `cwd`, `env`
|
|
275
274
|
- URL: `http`, `sse`, `ws`와 `url`, 선택 `headers`
|
|
276
|
-
4.
|
|
277
|
-
5. **검증**: `connected`, `toolCount`, `source`, `transport`, `error`.
|
|
275
|
+
4. **검증**: `connected`, `toolCount`, `transport`, `error`.
|
|
278
276
|
|
|
279
277
|
파일을 직접 편집했다면 mixdog 재시작이 기본 적용 경로다.
|
|
280
278
|
|
|
@@ -282,17 +280,15 @@ UI에는 서버 추가·삭제·전체 재연결 액션이 없다.
|
|
|
282
280
|
|
|
283
281
|
TUI `/mcp`와 Desktop MCP 모두 서버별 toggle을 지원하며 live connection과 세션 tool surface를 재동기화한다.
|
|
284
282
|
|
|
285
|
-
-
|
|
286
|
-
-
|
|
287
|
-
- 즉, 전역 config 서버를 toggle해도 전역 `agent.mcpServers.<name>.enabled`를 바꾸지 않는다.
|
|
283
|
+
- 서버 정의는 유지하고 `agent.mcpServers.<name>.enabled`를 전역으로 변경한다.
|
|
284
|
+
- Project `.mcp.json`과 Project별 override는 읽지 않는다.
|
|
288
285
|
- turn 실행 중 toggle은 turn 종료 경계에서 세션을 재생성한다.
|
|
289
286
|
|
|
290
287
|
### MCP 진단
|
|
291
288
|
|
|
292
|
-
1. `/mcp`의
|
|
293
|
-
2.
|
|
294
|
-
3.
|
|
295
|
-
4. `connected:true`와 기대 tool 노출로 검증한다.
|
|
289
|
+
1. `/mcp`의 transport/error를 먼저 읽는다.
|
|
290
|
+
2. stdio는 command·args·cwd·자식 env, URL transport는 scheme·endpoint·headers·방화벽을 확인한다.
|
|
291
|
+
3. `connected:true`와 기대 tool 노출로 검증한다.
|
|
296
292
|
|
|
297
293
|
### Skills enable / disable
|
|
298
294
|
|
|
@@ -317,11 +313,11 @@ UI 생성 액션은 없다.
|
|
|
317
313
|
|
|
318
314
|
1. **확인**: `/plugins` 또는 Desktop **Settings → Plugins**.
|
|
319
315
|
2. **추가**: Git URL, `owner/repo`, 기존 local path → `addPlugin()`.
|
|
320
|
-
3. **관리**: update/metadata refresh, plugin MCP enable/reconfigure, root/MCP name 복사, uninstall.
|
|
316
|
+
3. **관리**: 전역 enable/disable, update/metadata refresh, plugin MCP enable/reconfigure, root/MCP name 복사, uninstall.
|
|
321
317
|
4. **저장**: `<mixdogData>/plugins/registry.json`; managed Git checkout은 `<mixdogData>/plugins/installed/`.
|
|
322
318
|
5. **검증**: `pluginsStatus()`, plugin skill 수, MCP server 노출.
|
|
323
319
|
|
|
324
|
-
|
|
320
|
+
Plugin toggle은 해당 Plugin의 Skills와 MCP를 전역으로 함께 활성화/비활성화한다. 개별 MCP와 Skill은 각 화면에서도 관리할 수 있다.
|
|
325
321
|
|
|
326
322
|
### Hooks
|
|
327
323
|
|
|
@@ -380,8 +376,8 @@ Discord/Telegram messaging은 제거됐다. schedules/webhooks 자동화와 voic
|
|
|
380
376
|
|
|
381
377
|
1. **확인**: 상태줄 cwd, `/project`, Desktop rail **Projects**.
|
|
382
378
|
2. **변경**: `/project [path]` 또는 picker. TUI picker는 등록·생성·rename도 지원한다.
|
|
383
|
-
3. **적용**: cwd
|
|
384
|
-
4. **검증**: cwd
|
|
379
|
+
3. **적용**: cwd 변경은 실행 경로만 바꾸며 전역 Skills·Plugins·MCP 상태는 유지한다.
|
|
380
|
+
4. **검증**: cwd와 실행 경로.
|
|
385
381
|
|
|
386
382
|
### Git (Desktop 전용)
|
|
387
383
|
|
|
@@ -438,11 +434,6 @@ Desktop과 현재 runtime에서 소비되지 않는 아래 key는 사용자 옵
|
|
|
438
434
|
"cwd": "<project-subdir>",
|
|
439
435
|
"env": {}
|
|
440
436
|
}
|
|
441
|
-
},
|
|
442
|
-
"mcpProjectOverrides": {
|
|
443
|
-
"<normalized-cwd>": {
|
|
444
|
-
"<name>": { "enabled": false }
|
|
445
|
-
}
|
|
446
437
|
}
|
|
447
438
|
}
|
|
448
439
|
}
|
|
@@ -466,8 +457,8 @@ URL transport는 `type` + `url` + 선택 `headers`를 사용한다.
|
|
|
466
457
|
|
|
467
458
|
### 우선순위와 금지
|
|
468
459
|
|
|
469
|
-
- MCP
|
|
470
|
-
- Skill 이름 충돌:
|
|
460
|
+
- MCP는 전역 `agent.mcpServers`만 사용한다.
|
|
461
|
+
- Skill 이름 충돌: global > plugin
|
|
471
462
|
- `Mixdog.md` 자동 프롬프트 로드는 없다. skill/core memory를 사용한다.
|
|
472
463
|
- 확인되지 않은 key는 추측하지 말고 TODO로 남긴다.
|
|
473
464
|
- UI에 없는 runtime API를 사용자 UI처럼 설명하지 않는다.
|
package/src/headless-exec.mjs
CHANGED
|
@@ -23,17 +23,10 @@ function clean(value) {
|
|
|
23
23
|
|
|
24
24
|
export async function prewarmHeadlessSearch(cwd, {
|
|
25
25
|
loadNativeSearch = () => import('./runtime/agent/orchestrator/tools/builtin/native-search-client.mjs'),
|
|
26
|
-
loadListTool = () => import('./runtime/agent/orchestrator/tools/builtin/list-tool.mjs'),
|
|
27
26
|
} = {}) {
|
|
28
|
-
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
loadListTool(),
|
|
32
|
-
]);
|
|
33
|
-
await Promise.all([
|
|
34
|
-
nativeSearch.warmNativeSearchServer(),
|
|
35
|
-
listTool.prewarmFindEnumeration(root),
|
|
36
|
-
]);
|
|
27
|
+
void cwd;
|
|
28
|
+
const nativeSearch = await loadNativeSearch();
|
|
29
|
+
await nativeSearch.warmNativeSearchServer();
|
|
37
30
|
}
|
|
38
31
|
|
|
39
32
|
function nonNegativeNumber(value) {
|
|
@@ -9,7 +9,7 @@ import { prewarmHeadlessSearch, runHeadlessExec } from './headless-exec.mjs';
|
|
|
9
9
|
import { resolveCursorOAuthAccessToken } from './runtime/agent/orchestrator/providers/cursor-auth.mjs';
|
|
10
10
|
import { createPristineExecutionBoundary } from './runtime/shared/pristine-execution.mjs';
|
|
11
11
|
|
|
12
|
-
test('headless search prewarm starts the native server
|
|
12
|
+
test('headless search prewarm starts only the canonical native server', async () => {
|
|
13
13
|
const calls = [];
|
|
14
14
|
await prewarmHeadlessSearch('/app/project', {
|
|
15
15
|
loadNativeSearch: async () => ({
|
|
@@ -18,13 +18,8 @@ test('headless search prewarm starts the native server and Project inventory tog
|
|
|
18
18
|
return true;
|
|
19
19
|
},
|
|
20
20
|
}),
|
|
21
|
-
loadListTool: async () => ({
|
|
22
|
-
async prewarmFindEnumeration(root) {
|
|
23
|
-
calls.push(`index:${root}`);
|
|
24
|
-
},
|
|
25
|
-
}),
|
|
26
21
|
});
|
|
27
|
-
assert.deepEqual(calls
|
|
22
|
+
assert.deepEqual(calls, ['server']);
|
|
28
23
|
});
|
|
29
24
|
|
|
30
25
|
test('pristine headless execution binds Cursor OAuth credentials in process', async () => {
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
# Public Agent Constraints
|
|
2
2
|
|
|
3
|
-
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
state; other agents never use it to explore, install, or change state beyond
|
|
8
|
-
the brief.
|
|
9
|
-
- Overflow goes to a file; hand off path + fragments.
|
|
3
|
+
- Unless an agent's own `AGENT.md` explicitly assigns a review or verification
|
|
4
|
+
procedure, do not review or verify: skip builds, tests, lint, runtime checks,
|
|
5
|
+
and independent regression review. Complete the assigned role task and hand
|
|
6
|
+
off; Lead or an explicitly verification-assigned agent owns verification.
|
|
@@ -5,9 +5,6 @@
|
|
|
5
5
|
- Before the first tool call, briefly state what you are about to do; add a
|
|
6
6
|
short update when you find something load-bearing, change direction, or
|
|
7
7
|
work a stretch without one. Do not use a colon before a tool call.
|
|
8
|
-
- Confirm destructive/hard-to-reverse actions against explicit validated paths;
|
|
9
|
-
never `~`, a root, or unresolved variables/globs; report material deletion
|
|
10
|
-
recoverability.
|
|
11
8
|
- Mid-task: replacement supersedes; addition folds in; status gets a brief
|
|
12
9
|
answer while work continues. After compaction, resume the summary.
|
|
13
10
|
- Periodic task reports stay in-turn: when `task wait` returns still-running,
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
# Tool Workflow
|
|
2
2
|
|
|
3
|
+
- Confirm destructive/hard-to-reverse actions against explicit validated paths;
|
|
4
|
+
never `~`, a root, or unresolved variables/globs; report material deletion
|
|
5
|
+
recoverability.
|
|
3
6
|
- Determine the required outcome and missing evidence; requirements are not
|
|
4
7
|
evidence. Trust internal and framework guarantees.
|
|
5
8
|
- Before exploration or implementation, consult prior work, current external
|
|
6
9
|
information, or repository state only when needed to choose the next action.
|
|
7
10
|
Start with the source most likely to decide it; consult another only if the
|
|
8
11
|
result leaves the decision unresolved.
|
|
9
|
-
-
|
|
10
|
-
|
|
12
|
+
- Exhaust known work into the largest supported parameterized call before
|
|
13
|
+
issuing it. Do not split one tool's known targets or operations by item,
|
|
14
|
+
file, page, or operation type; split only when a prior result is needed to
|
|
15
|
+
determine later input or a documented tool limit requires another call.
|
|
16
|
+
- Minimize model round-trips: when multiple calls are independently necessary
|
|
17
|
+
and every input is already known before the batch begins, issue them in the
|
|
18
|
+
same assistant turn. A call whose necessity or scope can change after
|
|
11
19
|
another result waits for that result.
|
|
12
20
|
- Respect tool/schema limits, never omit required fanout, and apply one analysis
|
|
13
21
|
to many targets as one parameterized call when supported.
|
|
@@ -179,20 +179,128 @@ function maintenanceRouteToPreset(routeOrName, agent) {
|
|
|
179
179
|
return out;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
const AGENT_DISPATCH_LIVE_CALLBACKS = Object.freeze([
|
|
183
|
+
'onSessionStart',
|
|
184
|
+
'onStageChange',
|
|
185
|
+
'onReasoningDelta',
|
|
186
|
+
'onTextDelta',
|
|
187
|
+
'onTextReset',
|
|
188
|
+
'onAssistantText',
|
|
189
|
+
'onAssistantMessageCommitted',
|
|
190
|
+
'onToolCall',
|
|
191
|
+
'onToolResult',
|
|
192
|
+
]);
|
|
193
|
+
|
|
194
|
+
function pickDispatchCallback(factoryOpts, callArgs, name) {
|
|
195
|
+
if (typeof callArgs?.[name] === 'function') return callArgs[name];
|
|
196
|
+
if (typeof factoryOpts?.[name] === 'function') return factoryOpts[name];
|
|
197
|
+
return undefined;
|
|
198
|
+
}
|
|
199
|
+
|
|
182
200
|
/**
|
|
183
|
-
*
|
|
201
|
+
* Resolve live Agent-dispatch callbacks.
|
|
184
202
|
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
*
|
|
190
|
-
* @param {
|
|
191
|
-
* @param {
|
|
192
|
-
*
|
|
193
|
-
|
|
194
|
-
|
|
203
|
+
* `liveProjection` is a send-opt. It is true when the caller explicitly
|
|
204
|
+
* sets it or supplies a live-text callback (onTextDelta / onAssistantText /
|
|
205
|
+
* onTextReset). Tool/stage/reasoning observers do not un-suppress provider
|
|
206
|
+
* streaming. The flag must never be written onto the session object.
|
|
207
|
+
*
|
|
208
|
+
* @param {object} [factoryOpts]
|
|
209
|
+
* @param {object} [callArgs]
|
|
210
|
+
* @returns {{ callbacks: object, liveProjection: boolean }}
|
|
211
|
+
*/
|
|
212
|
+
export function resolveAgentDispatchLiveCallbacks(factoryOpts = {}, callArgs = {}) {
|
|
213
|
+
const callbacks = {};
|
|
214
|
+
for (const name of AGENT_DISPATCH_LIVE_CALLBACKS) {
|
|
215
|
+
const fn = pickDispatchCallback(factoryOpts, callArgs, name);
|
|
216
|
+
if (fn) callbacks[name] = fn;
|
|
217
|
+
}
|
|
218
|
+
const liveProjection = factoryOpts.liveProjection === true
|
|
219
|
+
|| callArgs.liveProjection === true
|
|
220
|
+
|| typeof callbacks.onTextDelta === 'function'
|
|
221
|
+
|| typeof callbacks.onAssistantText === 'function'
|
|
222
|
+
|| typeof callbacks.onTextReset === 'function';
|
|
223
|
+
return { callbacks, liveProjection };
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Adapt askSession's session-less callback signatures to the host contract
|
|
228
|
+
* by prepending the prepared session on every call:
|
|
229
|
+
* onSessionStart(session)
|
|
230
|
+
* onStageChange(session, stage, detail)
|
|
231
|
+
* onReasoningDelta(session, chunk)
|
|
232
|
+
* onTextDelta(session, chunk)
|
|
233
|
+
* onTextReset(session, detail) — return value is passed through unchanged
|
|
234
|
+
* onAssistantText(session, text)
|
|
235
|
+
* onAssistantMessageCommitted(session)
|
|
236
|
+
* onToolCall(session, iteration, calls)
|
|
237
|
+
* onToolResult(session, message)
|
|
238
|
+
*/
|
|
239
|
+
export function bindAgentDispatchHostCallbacks(hostCallbacks = {}, session) {
|
|
240
|
+
const bound = {};
|
|
241
|
+
if (typeof hostCallbacks.onSessionStart === 'function') {
|
|
242
|
+
bound.onSessionStart = () => hostCallbacks.onSessionStart(session);
|
|
243
|
+
}
|
|
244
|
+
if (typeof hostCallbacks.onStageChange === 'function') {
|
|
245
|
+
bound.onStageChange = (stage, detail) => hostCallbacks.onStageChange(session, stage, detail);
|
|
246
|
+
}
|
|
247
|
+
if (typeof hostCallbacks.onReasoningDelta === 'function') {
|
|
248
|
+
bound.onReasoningDelta = (chunk) => hostCallbacks.onReasoningDelta(session, chunk);
|
|
249
|
+
}
|
|
250
|
+
if (typeof hostCallbacks.onTextDelta === 'function') {
|
|
251
|
+
bound.onTextDelta = (chunk) => hostCallbacks.onTextDelta(session, chunk);
|
|
252
|
+
}
|
|
253
|
+
if (typeof hostCallbacks.onTextReset === 'function') {
|
|
254
|
+
bound.onTextReset = (detail) => hostCallbacks.onTextReset(session, detail);
|
|
255
|
+
}
|
|
256
|
+
if (typeof hostCallbacks.onAssistantText === 'function') {
|
|
257
|
+
bound.onAssistantText = (text) => hostCallbacks.onAssistantText(session, text);
|
|
258
|
+
}
|
|
259
|
+
if (typeof hostCallbacks.onAssistantMessageCommitted === 'function') {
|
|
260
|
+
bound.onAssistantMessageCommitted = () => hostCallbacks.onAssistantMessageCommitted(session);
|
|
261
|
+
}
|
|
262
|
+
if (typeof hostCallbacks.onToolCall === 'function') {
|
|
263
|
+
bound.onToolCall = (iteration, calls) => hostCallbacks.onToolCall(session, iteration, calls);
|
|
264
|
+
}
|
|
265
|
+
if (typeof hostCallbacks.onToolResult === 'function') {
|
|
266
|
+
bound.onToolResult = (message) => hostCallbacks.onToolResult(session, message);
|
|
267
|
+
}
|
|
268
|
+
return bound;
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
/**
|
|
272
|
+
* Build the positional `onToolCall` + askOpts bag forwarded to askSession.
|
|
273
|
+
* `interactiveSessionSurface` is intentionally dropped — that in-memory
|
|
274
|
+
* hint is owned by the standalone surface and must not be persisted or
|
|
275
|
+
* re-homed onto a dispatch session.
|
|
195
276
|
*/
|
|
277
|
+
export function buildAgentDispatchAskSessionArgs(factoryOpts = {}, callArgs = {}, extraAskOpts = {}, session = null) {
|
|
278
|
+
const { callbacks, liveProjection } = resolveAgentDispatchLiveCallbacks(factoryOpts, callArgs);
|
|
279
|
+
const bound = session && typeof session === 'object'
|
|
280
|
+
? bindAgentDispatchHostCallbacks(callbacks, session)
|
|
281
|
+
: callbacks;
|
|
282
|
+
const onToolCall = typeof bound.onToolCall === 'function' ? bound.onToolCall : null;
|
|
283
|
+
const askOpts = { liveProjection };
|
|
284
|
+
for (const name of AGENT_DISPATCH_LIVE_CALLBACKS) {
|
|
285
|
+
if (name === 'onToolCall') continue;
|
|
286
|
+
if (typeof bound[name] === 'function') askOpts[name] = bound[name];
|
|
287
|
+
}
|
|
288
|
+
const extraCompact = extraAskOpts.onCompactEvent;
|
|
289
|
+
if (typeof extraCompact === 'function') {
|
|
290
|
+
const callerCompact = askOpts.onCompactEvent;
|
|
291
|
+
askOpts.onCompactEvent = (event) => {
|
|
292
|
+
extraCompact(event);
|
|
293
|
+
try { callerCompact?.(event); } catch { /* best-effort */ }
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
for (const [key, value] of Object.entries(extraAskOpts)) {
|
|
297
|
+
if (key === 'onCompactEvent' || key === 'liveProjection') continue;
|
|
298
|
+
if (key === 'interactiveSessionSurface') continue;
|
|
299
|
+
if (value !== undefined) askOpts[key] = value;
|
|
300
|
+
}
|
|
301
|
+
return { onToolCall, askOpts };
|
|
302
|
+
}
|
|
303
|
+
|
|
196
304
|
// runtime-liveness keeps one parent link per session because askSession swaps
|
|
197
305
|
// its controller at turn start. Agent dispatch can have several independent
|
|
198
306
|
// cancellation sources, so collapse them before installing that one link.
|
|
@@ -227,16 +335,59 @@ export function composeAgentDispatchAbortSignal(signals) {
|
|
|
227
335
|
};
|
|
228
336
|
}
|
|
229
337
|
|
|
338
|
+
/**
|
|
339
|
+
* Build an agent-backed dispatch callback.
|
|
340
|
+
*
|
|
341
|
+
* @param {object} opts
|
|
342
|
+
* @param {string} opts.agent — REQUIRED; canonical agent name (worker, cycle1-agent, ...)
|
|
343
|
+
* @param {string} [opts.taskType] — optional internal classification stamped on the session
|
|
344
|
+
* @param {string} [opts.preset] — explicit preset override (bypasses agent → preset lookup)
|
|
345
|
+
* @param {string} [opts.parentSessionId] — parent agent session for trace aggregation
|
|
346
|
+
* @param {string|null} [opts.ownerSessionId] — owning Mixdog session for statusline isolation
|
|
347
|
+
* @param {AbortSignal} [opts.parentSignal] — optional AbortSignal from the fan-out coordinator;
|
|
348
|
+
* when aborted the agent session's own controller is also aborted so the
|
|
349
|
+
* provider call tears down promptly (parent→child cascade).
|
|
350
|
+
* @param {boolean} [opts.liveProjection] — request provider onTextDelta / mid-turn
|
|
351
|
+
* text for this Agent. Never persisted on the session.
|
|
352
|
+
* @param {function} [opts.onSessionStart]
|
|
353
|
+
* @param {function} [opts.onStageChange]
|
|
354
|
+
* @param {function} [opts.onReasoningDelta]
|
|
355
|
+
* @param {function} [opts.onTextDelta]
|
|
356
|
+
* @param {function} [opts.onTextReset] — must return `true` to ack a retry retraction
|
|
357
|
+
* @param {function} [opts.onAssistantText]
|
|
358
|
+
* @param {function} [opts.onAssistantMessageCommitted]
|
|
359
|
+
* @param {function} [opts.onToolCall]
|
|
360
|
+
* @param {function} [opts.onToolResult]
|
|
361
|
+
* @returns {(args: { prompt, preset?, sourceName?, liveProjection?, onSessionStart?, onStageChange?, onReasoningDelta?, onTextDelta?, onTextReset?, onAssistantText?, onAssistantMessageCommitted?, onToolCall?, onToolResult? }) => Promise<string>}
|
|
362
|
+
*/
|
|
230
363
|
export function makeAgentDispatch(opts = {}) {
|
|
231
364
|
if (!opts.agent || typeof opts.agent !== 'string') {
|
|
232
365
|
throw new Error('[agent-dispatch] opts.agent is required');
|
|
233
366
|
}
|
|
234
367
|
const agent = opts.agent;
|
|
235
368
|
|
|
236
|
-
return async function agentDispatch(
|
|
369
|
+
return async function agentDispatch(callArgs = {}) {
|
|
370
|
+
const {
|
|
371
|
+
prompt,
|
|
372
|
+
preset: presetArg,
|
|
373
|
+
sourceName: sourceNameArg,
|
|
374
|
+
parentSignal: callParentSignal,
|
|
375
|
+
idleTimeoutMs: callIdleTimeoutMs,
|
|
376
|
+
cwd: callCwd,
|
|
377
|
+
sessionId: callSessionId,
|
|
378
|
+
} = callArgs;
|
|
237
379
|
if (typeof prompt !== 'string' || !prompt) {
|
|
238
380
|
throw new Error(`[agent-dispatch] prompt required for agent "${agent}"`);
|
|
239
381
|
}
|
|
382
|
+
const prepare = typeof opts.prepareAgentSession === 'function'
|
|
383
|
+
? opts.prepareAgentSession
|
|
384
|
+
: prepareAgentSession;
|
|
385
|
+
const ask = typeof opts.askSession === 'function' ? opts.askSession : askSession;
|
|
386
|
+
const updateStatus = typeof opts.updateSessionStatus === 'function'
|
|
387
|
+
? opts.updateSessionStatus
|
|
388
|
+
: updateSessionStatus;
|
|
389
|
+
const close = typeof opts.closeSession === 'function' ? opts.closeSession : closeSession;
|
|
390
|
+
const readSession = typeof opts.getSession === 'function' ? opts.getSession : getSession;
|
|
240
391
|
const admission = opts.resourceAdmission || resourceAdmission;
|
|
241
392
|
const admissionAbortLink = composeAgentDispatchAbortSignal([
|
|
242
393
|
opts.parentSignal,
|
|
@@ -334,7 +485,7 @@ export function makeAgentDispatch(opts = {}) {
|
|
|
334
485
|
// pooled or resumed. Cache prefix matching happens at the provider
|
|
335
486
|
// layer (account-level), not the session level.
|
|
336
487
|
const finalPrompt = prompt;
|
|
337
|
-
const { session } =
|
|
488
|
+
const { session } = prepare({
|
|
338
489
|
agent,
|
|
339
490
|
presetName,
|
|
340
491
|
preset,
|
|
@@ -359,7 +510,7 @@ export function makeAgentDispatch(opts = {}) {
|
|
|
359
510
|
process.stderr.write(`[agent-dispatch] agent=${agent} tool-list (${_toolNames.length}): ${_toolNames.join(',')}\n`);
|
|
360
511
|
} catch { /* best-effort diagnostic */ }
|
|
361
512
|
|
|
362
|
-
await
|
|
513
|
+
await updateStatus(session.id, 'running');
|
|
363
514
|
// Parent→child abort cascade: when opts.parentSignal (factory) or
|
|
364
515
|
// callParentSignal (per-call) fires, abort the sub-session's own
|
|
365
516
|
// controller so the provider call tears down promptly. Best-effort:
|
|
@@ -368,7 +519,7 @@ export function makeAgentDispatch(opts = {}) {
|
|
|
368
519
|
const _linkSignal = _managerMod?.linkParentSignalToSession;
|
|
369
520
|
const _getProgressSnapshot = _managerMod?.getSessionProgressSnapshot;
|
|
370
521
|
const _getLastProgressAt = _managerMod?.getSessionLastProgressAt;
|
|
371
|
-
const _getSession = _managerMod?.getSession ||
|
|
522
|
+
const _getSession = _managerMod?.getSession || readSession;
|
|
372
523
|
// Watchdog policy is split:
|
|
373
524
|
// - firstResponseTimeoutMs cuts quickly only when the model produces no
|
|
374
525
|
// first stream/tool activity at all.
|
|
@@ -442,12 +593,13 @@ export function makeAgentDispatch(opts = {}) {
|
|
|
442
593
|
: null;
|
|
443
594
|
if (_idleTimer && typeof _idleTimer.unref === 'function') _idleTimer.unref();
|
|
444
595
|
let terminalStatus = 'idle';
|
|
596
|
+
let closeReason = 'ephemeral-done';
|
|
445
597
|
process.stderr.write(`[agent-dispatch] agent=${agent} preset=${presetName} model=${preset.model} provider=${preset.provider} session=${session.id}\n`);
|
|
446
598
|
const _agentDispatchT0 = Date.now();
|
|
447
599
|
let _handoffMsgStart = 0;
|
|
448
600
|
try {
|
|
449
|
-
_handoffMsgStart = resolveHandoffMessageStartIndex(
|
|
450
|
-
const
|
|
601
|
+
_handoffMsgStart = resolveHandoffMessageStartIndex(readSession(session.id));
|
|
602
|
+
const { onToolCall, askOpts } = buildAgentDispatchAskSessionArgs(opts, callArgs, {
|
|
451
603
|
onCompactEvent: (event) => {
|
|
452
604
|
try {
|
|
453
605
|
const label = agentCompactEventLabel(event);
|
|
@@ -458,7 +610,10 @@ export function makeAgentDispatch(opts = {}) {
|
|
|
458
610
|
);
|
|
459
611
|
} catch { /* best-effort compact visibility */ }
|
|
460
612
|
},
|
|
461
|
-
});
|
|
613
|
+
}, session);
|
|
614
|
+
// liveProjection is a send-opt on askOpts only. Do not stamp it
|
|
615
|
+
// (or interactiveSessionSurface) onto `session`.
|
|
616
|
+
const result = await ask(session.id, finalPrompt, null, onToolCall, cwd, undefined, askOpts);
|
|
462
617
|
process.stderr.write(`[agent-dispatch] agent=${agent} session=${session.id} elapsed=${Date.now() - _agentDispatchT0}ms\n`);
|
|
463
618
|
const raw = result?.content || '';
|
|
464
619
|
// Brief cap. Agent role answers (recall/search)
|
|
@@ -468,25 +623,23 @@ export function makeAgentDispatch(opts = {}) {
|
|
|
468
623
|
// majority of answers untouched. Opt-out via `brief:false` when
|
|
469
624
|
// the caller explicitly wants the full synthesis.
|
|
470
625
|
if (opts.brief === false) {
|
|
471
|
-
try { closeSession(session.id, 'ephemeral-done'); } catch { /* ignore */ }
|
|
472
626
|
return raw;
|
|
473
627
|
}
|
|
474
628
|
const out = applyBriefCap(raw);
|
|
475
|
-
try { closeSession(session.id, 'ephemeral-done'); } catch { /* ignore */ }
|
|
476
629
|
return out;
|
|
477
630
|
} catch (err) {
|
|
478
|
-
|
|
631
|
+
terminalStatus = 'error';
|
|
632
|
+
closeReason = 'ephemeral-error';
|
|
633
|
+
const partial = watchdogPartialHandoffFromError(err, readSession(session.id), _handoffMsgStart)
|
|
479
634
|
?? (salvagePartialRequested(err, _abortLink?.signal)
|
|
480
|
-
? partialHandoffTextFromSession(
|
|
635
|
+
? partialHandoffTextFromSession(readSession(session.id), _handoffMsgStart)
|
|
481
636
|
: null);
|
|
482
637
|
if (partial) {
|
|
483
638
|
terminalStatus = 'idle';
|
|
484
|
-
|
|
639
|
+
closeReason = 'ephemeral-done';
|
|
485
640
|
if (opts.brief === false) return partial;
|
|
486
641
|
return applyBriefCap(partial);
|
|
487
642
|
}
|
|
488
|
-
terminalStatus = 'error';
|
|
489
|
-
try { closeSession(session.id, 'ephemeral-error'); } catch { /* ignore */ }
|
|
490
643
|
throw err;
|
|
491
644
|
} finally {
|
|
492
645
|
_abortLink.dispose();
|
|
@@ -496,7 +649,11 @@ export function makeAgentDispatch(opts = {}) {
|
|
|
496
649
|
// Always flip out of 'running' before returning so the sweep never
|
|
497
650
|
// leaves a stateless Pool C session stuck in 'running' when the
|
|
498
651
|
// try/catch falls through in unexpected ways.
|
|
499
|
-
try { await
|
|
652
|
+
try { await updateStatus(session.id, terminalStatus); } catch { /* ignore */ }
|
|
653
|
+
// closeSession plants a tombstone, after which status writes are
|
|
654
|
+
// rejected. Publish the terminal projection before closing so
|
|
655
|
+
// live Agent panes cannot retain their preceding busy:true state.
|
|
656
|
+
try { close(session.id, closeReason); } catch { /* ignore */ }
|
|
500
657
|
}
|
|
501
658
|
});
|
|
502
659
|
} finally {
|