mixdog 1.2.5 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSES/simple-icons-CC0-1.0.txt +30 -0
- package/NOTICE.md +19 -0
- package/package.json +4 -1
- package/scripts/check-model-recommendations.mjs +89 -0
- package/scripts/gate-local.mjs +7 -0
- package/scripts/lib/gate-scheduler.mjs +2 -2
- package/scripts/lib/isolated-test-env.mjs +16 -0
- package/scripts/lib/run-node-tests.mjs +5 -14
- package/scripts/provider-pingpong-live.mjs +9 -9
- package/src/agents/advisor/AGENT.md +4 -4
- package/src/agents/advisor/agent.json +1 -1
- package/src/agents/reviewer/AGENT.md +5 -4
- package/src/agents/reviewer/agent.json +1 -1
- package/src/defaults/shipped-history.json +17 -0
- package/src/defaults/skills/browser-use/SKILL.md +7 -1
- package/src/defaults/skills/computer-use/SKILL.md +3 -1
- package/src/defaults/skills/memory-management/SKILL.md +4 -1
- package/src/defaults/skills/setup/references/actions.md +11 -4
- package/src/defaults/skills/setup-guide/SKILL.md +175 -0
- package/src/defaults/skills/setup-guide/model-recommendations.json +333 -0
- package/src/defaults/skills/visualize/SKILL.md +3 -2
- package/src/lib/rules-builder.cjs +56 -7
- package/src/output-styles/common.md +22 -6
- package/src/output-styles/detailed.md +7 -5
- package/src/output-styles/minimal.md +7 -3
- package/src/output-styles/simple.md +2 -3
- package/src/rules/agent/AGENT.md +7 -1
- package/src/rules/agent-mode/AGENT_MODE.md +24 -0
- package/src/rules/agent-mode/MIXY.md +21 -0
- package/src/rules/agent-mode/ROUTINE.md +6 -0
- package/src/rules/lead/LEAD.md +9 -4
- package/src/rules/shared/10-tool-workflow.md +2 -1
- package/src/rules/shared/60-verification.md +4 -5
- package/src/rules/shared/70-delivery.md +3 -0
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +2 -1
- package/src/runtime/agent/orchestrator/agent-runtime/room-supervisor-completion.mjs +86 -0
- package/src/runtime/agent/orchestrator/config.mjs +6 -0
- package/src/runtime/agent/orchestrator/context/deferred-tools.mjs +77 -14
- package/src/runtime/agent/orchestrator/context/role-instructions.mjs +182 -13
- package/src/runtime/agent/orchestrator/context/skill-catalog.mjs +5 -3
- package/src/runtime/agent/orchestrator/internal-agents.mjs +10 -0
- package/src/runtime/agent/orchestrator/mcp/agent-connectors.mjs +215 -0
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +58 -64
- package/src/runtime/agent/orchestrator/mcp/client-transport.mjs +10 -1
- package/src/runtime/agent/orchestrator/mcp/client.mjs +122 -15
- package/src/runtime/agent/orchestrator/mcp/oauth-account.mjs +97 -0
- package/src/runtime/agent/orchestrator/mcp/oauth-callback.mjs +2 -3
- package/src/runtime/agent/orchestrator/mcp/oauth-client.mjs +49 -0
- package/src/runtime/agent/orchestrator/mcp/oauth-credentials.mjs +59 -9
- package/src/runtime/agent/orchestrator/mcp/oauth-login.mjs +32 -7
- package/src/runtime/agent/orchestrator/mcp/oauth-provider.mjs +45 -6
- package/src/runtime/agent/orchestrator/mcp/oauth.mjs +195 -6
- package/src/runtime/agent/orchestrator/mcp/server-connectors.mjs +17 -0
- package/src/runtime/agent/orchestrator/providers/account-pool.mjs +9 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +41 -19
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +3 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events/content-block-start.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn/turn-events.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-sse-turn.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +2 -1
- package/src/runtime/agent/orchestrator/providers/anthropic.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth-login.mjs +11 -5
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth-tokens.mjs +4 -0
- package/src/runtime/agent/orchestrator/providers/catalog-deadline.mjs +163 -0
- package/src/runtime/agent/orchestrator/providers/catalog-failures.mjs +34 -0
- package/src/runtime/agent/orchestrator/providers/cursor-client-version.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +38 -14
- package/src/runtime/agent/orchestrator/providers/lib/oauth-page.mjs +100 -26
- package/src/runtime/agent/orchestrator/providers/lib/send-callbacks.mjs +24 -0
- package/src/runtime/agent/orchestrator/providers/oauth-credential-probes.mjs +13 -0
- package/src/runtime/agent/orchestrator/providers/oauth-usage.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 +4 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-models.mjs +49 -4
- package/src/runtime/agent/orchestrator/providers/openai-compat-presets.mjs +0 -7
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses-events.mjs +7 -1
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai-send.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-error-contract.mjs +17 -12
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +5 -1
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state.mjs +11 -2
- package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-oauth-login.mjs +45 -16
- package/src/runtime/agent/orchestrator/providers/openai-oauth-tokens.mjs +10 -0
- package/src/runtime/agent/orchestrator/providers/openai-oauth-ws.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-connect.mjs +196 -0
- package/src/runtime/agent/orchestrator/providers/openai-ws-pool.mjs +74 -9
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream/event-switch.mjs +14 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +2 -0
- package/src/runtime/agent/orchestrator/providers/opencode-go-oauth-login.mjs +194 -0
- package/src/runtime/agent/orchestrator/providers/opencode-go-oauth-tokens.mjs +353 -0
- package/src/runtime/agent/orchestrator/providers/opencode-go-oauth.mjs +293 -0
- package/src/runtime/agent/orchestrator/providers/opencode-go-usage.mjs +33 -100
- package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +23 -14
- package/src/runtime/agent/orchestrator/providers/registry.mjs +41 -27
- package/src/runtime/agent/orchestrator/runtime-core/ask-user-tool-defs.mjs +98 -4
- package/src/runtime/agent/orchestrator/runtime-core/context-status-shape.mjs +4 -0
- package/src/runtime/agent/orchestrator/runtime-core/extension-scopes.mjs +6 -4
- package/src/runtime/agent/orchestrator/runtime-core/orchestration.mjs +15 -8
- package/src/runtime/agent/orchestrator/runtime-core/plugin-mcp.mjs +1 -0
- package/src/runtime/agent/orchestrator/runtime-core/tool-bridge.mjs +12 -6
- package/src/runtime/agent/orchestrator/runtime-core/tool-catalog.mjs +32 -5
- package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +10 -4
- package/src/runtime/agent/orchestrator/runtime-core/workflow/agents.mjs +4 -1
- package/src/runtime/agent/orchestrator/runtime-core/workflow/context.mjs +50 -20
- package/src/runtime/agent/orchestrator/runtime-core/workflow-ids.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/agent-home.d.mts +4 -0
- package/src/runtime/agent/orchestrator/session/agent-home.mjs +33 -0
- package/src/runtime/agent/orchestrator/session/agent-mode.mjs +62 -0
- package/src/runtime/agent/orchestrator/session/agent-pool-progress.mjs +15 -3
- package/src/runtime/agent/orchestrator/session/agent-room-supervisor.d.mts +31 -0
- package/src/runtime/agent/orchestrator/session/agent-room-supervisor.mjs +241 -0
- package/src/runtime/agent/orchestrator/session/agent-room.d.mts +162 -0
- package/src/runtime/agent/orchestrator/session/agent-room.mjs +641 -0
- package/src/runtime/agent/orchestrator/session/catalog-db/schema.mjs +7 -1
- package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +74 -13
- package/src/runtime/agent/orchestrator/session/compact/forked-summary.mjs +102 -0
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +8 -2
- package/src/runtime/agent/orchestrator/session/compact/summary.mjs +16 -0
- package/src/runtime/agent/orchestrator/session/compact/user-message-kind.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/compaction-archive-capture.mjs +6 -2
- package/src/runtime/agent/orchestrator/session/human-gate/gate.mjs +165 -0
- package/src/runtime/agent/orchestrator/session/human-gate/held-message.mjs +95 -0
- package/src/runtime/agent/orchestrator/session/human-gate/outbound-policy.mjs +221 -0
- package/src/runtime/agent/orchestrator/session/human-gate/requests.mjs +195 -0
- package/src/runtime/agent/orchestrator/session/human-gate/store.mjs +167 -0
- package/src/runtime/agent/orchestrator/session/lifecycle-scan.mjs +9 -0
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +39 -2
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +10 -0
- package/src/runtime/agent/orchestrator/session/loop/send-phase.mjs +16 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/before-hook.mjs +82 -33
- package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +11 -4
- package/src/runtime/agent/orchestrator/session/loop/tool-exposure-migration.mjs +5 -4
- package/src/runtime/agent/orchestrator/session/loop/tool-helpers.mjs +13 -3
- package/src/runtime/agent/orchestrator/session/loop/usage.mjs +7 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-execute.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-loop-options.mjs +6 -1
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-prepare.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-steering-drain.mjs +13 -5
- package/src/runtime/agent/orchestrator/session/manager/pending-lifecycle-epoch.mjs +0 -8
- package/src/runtime/agent/orchestrator/session/manager/pending-message-entry.mjs +10 -7
- package/src/runtime/agent/orchestrator/session/manager/pending-messages.mjs +62 -22
- package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +44 -16
- package/src/runtime/agent/orchestrator/session/manager/rules-cache.mjs +22 -5
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +23 -1
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +81 -34
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +39 -4
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +27 -5
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +55 -8
- package/src/runtime/agent/orchestrator/session/manager/session-record.mjs +16 -0
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +3 -2
- package/src/runtime/agent/orchestrator/session/manager/usage-metrics.mjs +6 -0
- package/src/runtime/agent/orchestrator/session/manager/workflow-switch-notice.mjs +58 -0
- package/src/runtime/agent/orchestrator/session/manager.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/mixy-name.mjs +24 -0
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +32 -5
- package/src/runtime/agent/orchestrator/session/request-fork.mjs +47 -0
- package/src/runtime/agent/orchestrator/session/routine-result.d.mts +70 -0
- package/src/runtime/agent/orchestrator/session/routine-result.mjs +277 -0
- package/src/runtime/agent/orchestrator/session/side-question-store.mjs +16 -1
- package/src/runtime/agent/orchestrator/session/side-question.mjs +5 -43
- package/src/runtime/agent/orchestrator/session/store/fs-probe.mjs +10 -0
- package/src/runtime/agent/orchestrator/session/store/lifecycle-barriers.mjs +73 -6
- package/src/runtime/agent/orchestrator/session/store/load-session.mjs +40 -0
- package/src/runtime/agent/orchestrator/session/store/save-fault.mjs +15 -0
- package/src/runtime/agent/orchestrator/session/store/session-paths.mjs +12 -0
- package/src/runtime/agent/orchestrator/session/store/sweep/sweep-row.mjs +8 -0
- package/src/runtime/agent/orchestrator/session/store-agent-worker-header.mjs +36 -0
- package/src/runtime/agent/orchestrator/session/store-agent-worker-rows.mjs +258 -43
- package/src/runtime/agent/orchestrator/session/store-record-strict-scan.mjs +325 -0
- package/src/runtime/agent/orchestrator/session/store-summary-catalog.mjs +84 -21
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +44 -12
- package/src/runtime/agent/orchestrator/session/store-summary-last-message.mjs +46 -0
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +46 -30
- package/src/runtime/agent/orchestrator/session/store-summary-visibility.mjs +0 -4
- package/src/runtime/agent/orchestrator/session/store-transcript-cache.mjs +144 -45
- package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +32 -13
- package/src/runtime/agent/orchestrator/session/store-transcript-worker.mjs +364 -38
- package/src/runtime/agent/orchestrator/session/store.mjs +9 -2
- package/src/runtime/agent/orchestrator/session/task-wait-control.mjs +43 -12
- package/src/runtime/agent/orchestrator/session/tool-result-offload.mjs +23 -6
- package/src/runtime/agent/orchestrator/session/transcript-restore/restore.mjs +44 -1
- package/src/runtime/agent/orchestrator/tools/builtin/arg-guard.mjs +12 -6
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/backgrounded-result.mjs +13 -7
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/bashism-rewrite.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/benign-exit.mjs +7 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/completed-result.mjs +40 -7
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/deadline-plan.mjs +37 -34
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/inline-hoist.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/spawn-env.mjs +0 -4
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +6 -0
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +29 -27
- package/src/runtime/agent/orchestrator/tools/builtin/external-tool-adapters.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/find-files-tool.mjs +28 -11
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-policy.mjs +12 -3
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +203 -101
- package/src/runtime/agent/orchestrator/tools/builtin/git-repo-rw-lock.mjs +90 -41
- package/src/runtime/agent/orchestrator/tools/builtin/lib/list-helpers.mjs +17 -1
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-delivery.mjs +199 -0
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-records.mjs +12 -0
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-task-output.mjs +165 -39
- package/src/runtime/agent/orchestrator/tools/builtin/list-tool.mjs +25 -13
- package/src/runtime/agent/orchestrator/tools/builtin/native-search-client.mjs +113 -5
- package/src/runtime/agent/orchestrator/tools/builtin/read-batch.mjs +7 -6
- package/src/runtime/agent/orchestrator/tools/builtin/read-formatting.mjs +19 -4
- package/src/runtime/agent/orchestrator/tools/builtin/read-line-collector.mjs +5 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-render.mjs +25 -7
- package/src/runtime/agent/orchestrator/tools/builtin/read-special-files.mjs +2 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-render.mjs +3 -1
- package/src/runtime/agent/orchestrator/tools/builtin/search-glob-tool.mjs +12 -5
- package/src/runtime/agent/orchestrator/tools/builtin/search-grep-tool.mjs +61 -22
- package/src/runtime/agent/orchestrator/tools/builtin/search-path-diagnostics.mjs +32 -8
- package/src/runtime/agent/orchestrator/tools/builtin/shell-analysis.mjs +193 -19
- package/src/runtime/agent/orchestrator/tools/builtin/shell-direct-exe.mjs +57 -7
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +123 -32
- package/src/runtime/agent/orchestrator/tools/builtin/shell-lossless-compact.mjs +26 -1
- package/src/runtime/agent/orchestrator/tools/builtin/shell-output.mjs +13 -28
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +90 -11
- package/src/runtime/agent/orchestrator/tools/builtin/wait-budgets.mjs +23 -0
- package/src/runtime/agent/orchestrator/tools/builtin.mjs +54 -10
- package/src/runtime/agent/orchestrator/tools/code-graph/build.mjs +22 -28
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch.mjs +11 -7
- package/src/runtime/agent/orchestrator/tools/destructive-warning.mjs +126 -9
- package/src/runtime/agent/orchestrator/tools/graph-manifest.json +13 -13
- package/src/runtime/agent/orchestrator/tools/lib/owned-shell-trees.mjs +15 -6
- package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +64 -2
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promote-job.mjs +10 -2
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promotion-results.mjs +13 -3
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-settle.mjs +8 -0
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +6 -1
- package/src/runtime/agent/orchestrator/tools/patch/v4a-convert.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +104 -55
- package/src/runtime/agent/orchestrator/tools/shell-policy.mjs +7 -2
- package/src/runtime/agent/orchestrator/tools/shell-powershell.mjs +39 -23
- package/src/runtime/agent/orchestrator/tools/shell-snapshot.mjs +6 -2
- package/src/runtime/agent/orchestrator/tools/spawn-manifest.json +13 -13
- package/src/runtime/attachments/office-extract.mjs +11 -9
- package/src/runtime/browser-bridge/client.mjs +24 -0
- package/src/runtime/channels/lib/scheduler.mjs +40 -12
- package/src/runtime/channels/lib/schedules-db.mjs +71 -12
- package/src/runtime/channels/lib/webhook/session-dispatch.mjs +36 -16
- package/src/runtime/channels/lib/webhook.mjs +0 -1
- package/src/runtime/channels/lib/webhooks-db.mjs +100 -10
- package/src/runtime/channels/lib/worker-main.mjs +17 -20
- package/src/runtime/computer-bridge/client.mjs +28 -1
- package/src/runtime/connectors/gmail-app-password.mjs +690 -0
- package/src/runtime/connectors/google-mcp.mjs +446 -0
- package/src/runtime/memory/lib/core-memory-access.mjs +69 -0
- package/src/runtime/memory/lib/core-memory-file.mjs +16 -8
- package/src/runtime/memory/lib/core-memory-index.mjs +15 -9
- package/src/runtime/memory/lib/core-memory-management.mjs +10 -4
- package/src/runtime/memory/lib/core-memory-store.mjs +53 -30
- package/src/runtime/memory/lib/core-memory-uniqueness.mjs +10 -6
- package/src/runtime/memory/lib/embedding-tokenizer.mjs +32 -18
- package/src/runtime/memory/lib/http-router/session-routes.mjs +3 -2
- package/src/runtime/memory/lib/memory-action-handlers/core-actions.mjs +44 -14
- package/src/runtime/memory/lib/memory-schema/core-and-meta.mjs +11 -0
- package/src/runtime/memory/lib/memory.mjs +7 -1
- package/src/runtime/memory/lib/query-core-recall.mjs +9 -1
- package/src/runtime/memory/lib/query-hybrid-search.mjs +2 -0
- package/src/runtime/memory/lib/runtime-fetcher.mjs +1 -1
- package/src/runtime/memory/lib/tool-call-handler.mjs +9 -5
- package/src/runtime/memory/tool-defs.mjs +5 -0
- package/src/runtime/office/authoring/pptx-script-normalize.mjs +11 -8
- package/src/runtime/office/core/tabular.mjs +1 -1
- package/src/runtime/office/design/library/design-template-inspect.mjs +7 -4
- package/src/runtime/office/portable/docx-formatting.mjs +1 -1
- package/src/runtime/office/portable/docx-runs.mjs +1 -1
- package/src/runtime/office/portable/docx-tracked-edits.mjs +2 -2
- package/src/runtime/office/portable/portable-docx-edits.mjs +11 -10
- package/src/runtime/office/portable/portable-docx-operations.mjs +21 -17
- package/src/runtime/office/portable/portable-docx-parts.mjs +15 -9
- package/src/runtime/office/portable/portable-docx-styles.mjs +4 -1
- package/src/runtime/office/portable/portable-docx-xml.mjs +9 -9
- package/src/runtime/office/portable/portable-opc.mjs +27 -13
- package/src/runtime/office/portable/portable-pivot.mjs +3 -3
- package/src/runtime/office/portable/portable-pptx-chart.mjs +3 -3
- package/src/runtime/office/portable/portable-pptx-charts.mjs +24 -18
- package/src/runtime/office/portable/portable-pptx-core.mjs +5 -5
- package/src/runtime/office/portable/portable-pptx-deck.mjs +8 -4
- package/src/runtime/office/portable/portable-pptx-package.mjs +7 -4
- package/src/runtime/office/portable/portable-pptx-shapes.mjs +18 -9
- package/src/runtime/office/portable/portable-sheet-parts.mjs +9 -3
- package/src/runtime/office/portable/portable-sheet-xml.mjs +5 -5
- package/src/runtime/office/portable/portable-xlsx-charts.mjs +4 -1
- package/src/runtime/office/portable/portable-xlsx-drawings.mjs +10 -6
- package/src/runtime/office/portable/portable-xlsx-operations.mjs +8 -5
- package/src/runtime/office/portable/portable-xlsx-pivot-ops.mjs +1 -1
- package/src/runtime/office/portable/portable-xlsx-reference-shift.mjs +11 -7
- package/src/runtime/office/portable/portable-xlsx-sheet-edits.mjs +6 -3
- package/src/runtime/office/portable/portable-xml.mjs +1 -1
- package/src/runtime/shared/agent-avatar-sprites.mjs +445 -0
- package/src/runtime/shared/agent-avatar.d.mts +64 -0
- package/src/runtime/shared/agent-avatar.mjs +320 -0
- package/src/runtime/shared/agent-route-config.d.mts +3 -0
- package/src/runtime/shared/agent-route-config.mjs +16 -0
- package/src/runtime/shared/atomic-file.mjs +36 -14
- package/src/runtime/shared/background-tasks.mjs +60 -20
- package/src/runtime/shared/child-spawn-gate.mjs +26 -16
- package/src/runtime/shared/config.mjs +8 -11
- package/src/runtime/shared/connector-accounts.mjs +15 -0
- package/src/runtime/shared/connector-catalog.d.mts +52 -0
- package/src/runtime/shared/connector-catalog.mjs +230 -0
- package/src/runtime/shared/connector-triggers.d.mts +3 -0
- package/src/runtime/shared/connector-triggers.mjs +43 -0
- package/src/runtime/shared/file-lock.mjs +7 -1
- package/src/runtime/shared/file-permissions-worker.mjs +38 -0
- package/src/runtime/shared/file-permissions.d.mts +19 -4
- package/src/runtime/shared/file-permissions.mjs +310 -4
- package/src/runtime/shared/git-runner-worker.mjs +6 -78
- package/src/runtime/shared/google-oauth-client.mjs +24 -0
- package/src/runtime/shared/held-request-host.d.mts +12 -0
- package/src/runtime/shared/held-request-host.mjs +71 -0
- package/src/runtime/shared/llm/http-agent.mjs +7 -3
- package/src/runtime/shared/llm/provider-catalog-registry.mjs +10 -0
- package/src/runtime/shared/llm/usage-accounting.mjs +2 -0
- package/src/runtime/shared/llm/usage-ledger-import.mjs +32 -3
- package/src/runtime/shared/llm/usage-ledger-rollup.mjs +12 -5
- package/src/runtime/shared/llm/usage-ledger-worker.mjs +1 -1
- package/src/runtime/shared/llm/usage-ledger.mjs +20 -5
- package/src/runtime/shared/memory-snapshot.mjs +5 -1
- package/src/runtime/shared/notify-trace.mjs +8 -1
- package/src/runtime/shared/plain-preview.d.mts +1 -0
- package/src/runtime/shared/plain-preview.mjs +28 -0
- package/src/runtime/shared/pristine-execution-contract.json +5 -1
- package/src/runtime/shared/process-runner-worker.mjs +7 -0
- package/src/runtime/shared/process-runner.mjs +38 -0
- package/src/runtime/shared/provider-accounts.mjs +2 -1
- package/src/runtime/shared/provider-api-key.mjs +0 -1
- package/src/runtime/shared/read-row-numbers.mjs +1 -1
- package/src/runtime/shared/resource-admission.mjs +60 -18
- package/src/runtime/shared/routine-limits.d.mts +11 -0
- package/src/runtime/shared/routine-limits.mjs +21 -0
- package/src/runtime/shared/routine-trigger.d.mts +10 -0
- package/src/runtime/shared/routine-trigger.mjs +44 -0
- package/src/runtime/shared/run-child.mjs +84 -0
- package/src/runtime/shared/schedule-model-ref.mjs +9 -10
- package/src/runtime/shared/session-activity-signal.mjs +23 -0
- package/src/runtime/shared/shell-output-summary.mjs +23 -0
- package/src/runtime/shared/singleton-owner.mjs +126 -42
- package/src/runtime/shared/slow-span.mjs +4 -12
- package/src/runtime/shared/statusline/statusline-segments.mjs +13 -1
- package/src/runtime/shared/tool-output-limit.mjs +4 -2
- package/src/runtime/shared/tool-output-marker.mjs +58 -0
- package/src/runtime/shared/transcript-metadata.mjs +10 -0
- package/src/runtime/shared/turn-changes.mjs +0 -8
- package/src/runtime/shared/usage-readout-totals.mjs +56 -0
- package/src/runtime/shared/user-data-guard.mjs +131 -34
- package/src/runtime/shared/worktrees/activity-gate.mjs +33 -8
- package/src/runtime/shared/worktrees/git-head.mjs +20 -2
- package/src/runtime/shared/worktrees/lock.mjs +3 -2
- package/src/runtime/terminal-bridge/tool-defs.mjs +1 -1
- package/src/runtime/tidy/runners/biome.mjs +3 -1
- package/src/runtime/tidy/shadow.mjs +2 -1
- package/src/runtime/web-search/index.mjs +5 -7
- package/src/runtime/web-search/lib/formatter.mjs +42 -6
- package/src/runtime/web-search/tool-defs.mjs +6 -1
- package/src/session-runtime/agent-home-delivery.mjs +459 -0
- package/src/session-runtime/agent-profile-changes.mjs +21 -0
- package/src/session-runtime/agent-room-delivery.mjs +92 -0
- package/src/session-runtime/agent-task-sessions.mjs +200 -0
- package/src/session-runtime/boot/apis.mjs +50 -18
- package/src/session-runtime/boot/facade.mjs +5 -8
- package/src/session-runtime/boot/infrastructure.mjs +28 -17
- package/src/session-runtime/boot/tools.mjs +3 -0
- package/src/session-runtime/channel-config-api.mjs +53 -5
- package/src/session-runtime/cwd-plugins/core-memory-context.mjs +36 -20
- package/src/session-runtime/cwd-plugins/plugin-status.mjs +6 -1
- package/src/session-runtime/held-requests.mjs +228 -0
- package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +121 -0
- package/src/session-runtime/internal-tool-executor/feature-tools.mjs +5 -1
- package/src/session-runtime/internal-tool-executor/knowledge-tools.mjs +31 -2
- package/src/session-runtime/internal-tool-executor/workspace-tools.mjs +31 -2
- package/src/session-runtime/internal-tool-executor.mjs +2 -0
- package/src/session-runtime/lifecycle/session-catalog.mjs +9 -0
- package/src/session-runtime/lifecycle/session-switch/context-switch.mjs +4 -3
- package/src/session-runtime/lifecycle/session-switch/resume.mjs +11 -4
- package/src/session-runtime/lifecycle/session-switch/session-delete.mjs +3 -3
- package/src/session-runtime/lifecycle/shared.mjs +25 -2
- package/src/session-runtime/lifecycle/teardown/session-close.mjs +2 -0
- package/src/session-runtime/lifecycle/teardown.mjs +5 -2
- package/src/session-runtime/lifecycle-api.mjs +3 -1
- package/src/session-runtime/mcp-glue/server-catalog.mjs +8 -0
- package/src/session-runtime/mcp-glue/server-input.mjs +3 -0
- package/src/session-runtime/mcp-oauth-login.mjs +112 -15
- package/src/session-runtime/model-route/set-route.mjs +14 -3
- package/src/session-runtime/owned-automation-run.mjs +229 -0
- package/src/session-runtime/provider-auth/login.mjs +10 -6
- package/src/session-runtime/provider-auth/setup.mjs +19 -2
- package/src/session-runtime/provider-catalog-cache.mjs +101 -25
- package/src/session-runtime/provider-models/catalog-load.mjs +14 -3
- package/src/session-runtime/provider-models/row-hydration.mjs +4 -0
- package/src/session-runtime/provider-models.mjs +76 -10
- package/src/session-runtime/provider-readiness.mjs +4 -0
- package/src/session-runtime/resource-api.mjs +5 -0
- package/src/session-runtime/resource-mcp-api.mjs +107 -13
- package/src/session-runtime/resource-skills-api.mjs +12 -0
- package/src/session-runtime/room-member-gate.mjs +48 -0
- package/src/session-runtime/routine-home-turn.mjs +156 -0
- package/src/session-runtime/routine-owner.mjs +48 -0
- package/src/session-runtime/schedule-session-run.mjs +30 -64
- package/src/session-runtime/services/agent-tool/close-flow.mjs +2 -1
- package/src/session-runtime/services/agent-tool/helpers.mjs +10 -0
- package/src/session-runtime/services/agent-tool/job-views/agent-list.mjs +10 -2
- package/src/session-runtime/services/agent-tool/job-views/session-progress.mjs +13 -4
- package/src/session-runtime/services/agent-tool/notify.mjs +15 -4
- package/src/session-runtime/services/agent-tool/restart-notify.mjs +134 -0
- package/src/session-runtime/services/agent-tool/send-flow.mjs +24 -1
- package/src/session-runtime/services/agent-tool/spawn-flow/deferred-spawn.mjs +2 -1
- package/src/session-runtime/services/agent-tool/spawn-flow/job-start.mjs +4 -3
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-plan.mjs +19 -4
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-prep.mjs +2 -0
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +5 -1
- package/src/session-runtime/services/agent-tool/tag-registry/tag-lookup.mjs +8 -3
- package/src/session-runtime/services/agent-tool/tag-registry.mjs +3 -0
- package/src/session-runtime/services/agent-tool/worker-index/row-shape.mjs +4 -0
- package/src/session-runtime/services/agent-tool/worker-index.mjs +44 -10
- package/src/session-runtime/services/agent-tool.mjs +20 -0
- package/src/session-runtime/services/channel-admin.mjs +93 -24
- package/src/session-runtime/services/memory-access.mjs +37 -0
- package/src/session-runtime/services/provider-admin.mjs +166 -59
- package/src/session-runtime/services/schedule-access.mjs +91 -0
- package/src/session-runtime/services/usage-dashboard-model.mjs +2 -2
- package/src/session-runtime/services/usage-dashboard.mjs +27 -69
- package/src/session-runtime/session-create/session-options.mjs +34 -7
- package/src/session-runtime/session-hooks.mjs +16 -8
- package/src/session-runtime/setup-tool/executor.mjs +68 -6
- package/src/session-runtime/setup-tool/extended-actions.mjs +72 -14
- package/src/session-runtime/setup-tool/settings-contract.mjs +8 -6
- package/src/session-runtime/setup-tool/tool-defs.mjs +8 -0
- package/src/session-runtime/skills-api.mjs +16 -1
- package/src/session-runtime/tool-policy-refresh.mjs +238 -29
- package/src/session-runtime/turn/session-ops.mjs +10 -3
- package/src/session-runtime/turn/turn-run/ask-callbacks.mjs +11 -2
- package/src/session-runtime/turn/turn-run/turn-prepare.mjs +3 -0
- package/src/session-runtime/usage-stats-api.mjs +6 -1
- package/src/session-runtime/webhook-session-run.mjs +49 -67
- package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +239 -0
- package/src/session-runtime/workflow-agents-api/agent-editor.mjs +556 -22
- package/src/session-runtime/workflow-agents-api/workflow-packs.mjs +11 -1
- package/src/session-runtime/workflow-agents-api.mjs +4 -1
- package/src/standalone/channel-transport/http-routes.mjs +10 -9
- package/src/standalone/daemon-agent-control.mjs +1 -8
- package/src/standalone/daemon-desktop-runtime.mjs +20 -7
- package/src/standalone/daemon-owner.mjs +117 -25
- package/src/standalone/daemon-session-control.mjs +11 -2
- package/src/standalone/daemon.mjs +61 -17
- package/src/standalone/session-call-cache.mjs +6 -0
- package/src/standalone/session-protocol.mjs +28 -1
- package/src/standalone/session-service/retention/busy.mjs +7 -2
- package/src/standalone/session-service/session-calls/session-turns.mjs +9 -0
- package/src/standalone/session-service.mjs +19 -0
- package/src/standalone/session-transport/routes.mjs +7 -6
- package/src/tui/app/model-options.mjs +39 -2
- package/src/tui/app/model-picker.mjs +16 -2
- package/src/tui/app/provider-setup-picker.mjs +1 -2
- package/src/tui/app/slash-commands.mjs +20 -0
- package/src/tui/dist/index.mjs +487 -128
- package/src/tui/session/context-state.mjs +6 -1
- package/src/tui/session/notice-surface.mjs +35 -4
- package/src/tui/session/notice-text.mjs +0 -1
- package/src/tui/session/queue-helpers.mjs +2 -1
- package/src/tui/session/session-api/extensions.mjs +4 -0
- package/src/tui/session/session-api/intake/submission.mjs +12 -13
- package/src/tui/session/session-api/integrations.mjs +9 -5
- package/src/tui/session/session-api/lifecycle/session-reset.mjs +13 -3
- package/src/tui/session/session-api/lifecycle.mjs +17 -1
- package/src/tui/session/session-api/routes.mjs +48 -3
- package/src/tui/session/session-flow/drain.mjs +20 -3
- package/src/tui/session/session-flow/queue/entry-shape.mjs +2 -1
- package/src/tui/session/session-flow/queue/take-entries.mjs +3 -2
- package/src/tui/session/session-flow/steering.mjs +104 -24
- package/src/tui/session/session-flow.mjs +2 -0
- package/src/tui/session/tool-approval.mjs +26 -5
- package/src/tui/session/transcript-intake.mjs +6 -2
- package/src/tui/session/transcript-spill.mjs +5 -1
- package/src/tui/session/tui-steering-persist.mjs +65 -42
- package/src/tui/session/turn-live-call.mjs +56 -0
- package/src/tui/session/turn-stream.mjs +33 -0
- package/src/tui/session/turn.mjs +50 -7
- package/src/ui/statusline.mjs +1 -6
- package/src/ui/streaming-markdown-heal.mjs +24 -7
- package/src/vendor/statusline/bin/statusline-route.mjs +0 -1
- package/src/vendor/statusline/src/gateway/route-meta.mjs +0 -1
- package/src/workflows/default/WORKFLOW.md +9 -13
- package/src/session-runtime/automation-agents.mjs +0 -94
- package/src/session-runtime/automation-workflow.mjs +0 -59
|
@@ -8,6 +8,7 @@ import { noEnabledProvidersError } from './registry-errors.mjs';
|
|
|
8
8
|
import { providerTakesNativePdf } from '../../../attachments/store.mjs';
|
|
9
9
|
import { modelProxyClientMode } from '../../../shared/model-proxy-mode.mjs';
|
|
10
10
|
import { getModelProxyChannel } from './model-proxy-channel.mjs';
|
|
11
|
+
import { boundedProviderCatalogOp } from './catalog-deadline.mjs';
|
|
11
12
|
// OpenAI-compat provider names are self-declared by openai-compat-presets.mjs via
|
|
12
13
|
// OPENAI_COMPAT_PRESETS. No parallel list maintained here.
|
|
13
14
|
const providers = new Map();
|
|
@@ -33,6 +34,7 @@ export const OAUTH_PROVIDER_NAMES = new Set([
|
|
|
33
34
|
'mimo-oauth',
|
|
34
35
|
'cursor-oauth',
|
|
35
36
|
'antigravity-oauth',
|
|
37
|
+
'opencode-go-oauth',
|
|
36
38
|
]);
|
|
37
39
|
// Providers the most recently applied config declared with enabled:false for a
|
|
38
40
|
// USER reason. A deliberate opt-out (logout / disable in settings) must survive
|
|
@@ -178,7 +180,7 @@ const PROVIDER_MODULES = {
|
|
|
178
180
|
'cursor-api': ['./cursor.mjs', 'CursorApiProvider'],
|
|
179
181
|
openai: ['./openai-ws.mjs', 'OpenAIDirectProvider'],
|
|
180
182
|
'mixdog-local': ['./mixdog-local.mjs', 'MixdogLocalProvider'],
|
|
181
|
-
'opencode-go': ['./opencode-go.mjs', '
|
|
183
|
+
'opencode-go-oauth': ['./opencode-go-oauth.mjs', 'OpenCodeGoOAuthProvider'],
|
|
182
184
|
// Multi-wire preset gateways (wire-route.mjs picks the wire per model).
|
|
183
185
|
openrouter: ['./openrouter.mjs', 'OpenRouterProvider'],
|
|
184
186
|
deepseek: ['./deepseek.mjs', 'DeepSeekProvider'],
|
|
@@ -288,6 +290,8 @@ async function _initProvidersUnsynchronized(config, signal = null, proxyChannel
|
|
|
288
290
|
const enabledResults = await Promise.all(
|
|
289
291
|
entries.map(async ([name, cfg]) => {
|
|
290
292
|
if (!cfg.enabled) return null;
|
|
293
|
+
// A retired provider's saved config is inert: its replacement is its own entry.
|
|
294
|
+
if (Object.hasOwn(RETIRED_PROVIDER_ALIASES, name)) return null;
|
|
291
295
|
// Idempotent reuse: an enabled provider whose config signature is
|
|
292
296
|
// unchanged from the live registry is carried forward as-is. Only
|
|
293
297
|
// added or changed providers are (re)constructed below.
|
|
@@ -438,7 +442,14 @@ function _scheduleOAuthSelfHeal(name) {
|
|
|
438
442
|
_oauthSelfHealLoads.delete(name);
|
|
439
443
|
});
|
|
440
444
|
}
|
|
441
|
-
|
|
445
|
+
// Provider ids that were retired: a saved route or session naming one is served
|
|
446
|
+
// by its replacement account. When that account is not connected the lookup
|
|
447
|
+
// misses like any other unconnected provider.
|
|
448
|
+
const RETIRED_PROVIDER_ALIASES = Object.freeze({ 'opencode-go': 'opencode-go-oauth' });
|
|
449
|
+
export function getProvider(requestedName) {
|
|
450
|
+
const name = Object.hasOwn(RETIRED_PROVIDER_ALIASES, requestedName)
|
|
451
|
+
? RETIRED_PROVIDER_ALIASES[requestedName]
|
|
452
|
+
: requestedName;
|
|
442
453
|
const cached = providers.get(name);
|
|
443
454
|
if (cached) return cached;
|
|
444
455
|
// OAuth lazy fallback. Covers the boot-time race where the credential probe
|
|
@@ -560,10 +571,23 @@ export async function _withRegisteredProviderForTestAsync(name, instance, fn) {
|
|
|
560
571
|
// Shared by the startup refresh and the 24h/forced refresh below.
|
|
561
572
|
function providerCatalogRefreshFn(provider) {
|
|
562
573
|
if (typeof provider?._refreshModelCache === 'function') return () => provider._refreshModelCache();
|
|
563
|
-
if (typeof provider?.listModels === 'function') return () => provider.listModels();
|
|
574
|
+
if (typeof provider?.listModels === 'function') return (signal) => provider.listModels({ signal });
|
|
564
575
|
return null;
|
|
565
576
|
}
|
|
566
577
|
|
|
578
|
+
// One provider's refresh, bounded per provider (catalog-deadline.mjs): a hung
|
|
579
|
+
// or offline provider is reported and left out after the deadline, so the
|
|
580
|
+
// refresh epoch still completes for everyone else. Its late answer lands in
|
|
581
|
+
// its own model cache; the session catalog retries its listing after the
|
|
582
|
+
// partial-catalog backoff.
|
|
583
|
+
function boundedCatalogRefresh(name, provider, refreshFn, label) {
|
|
584
|
+
return boundedProviderCatalogOp({ name, provider, kind: 'refresh', run: refreshFn }).then(({ error }) => {
|
|
585
|
+
if (!error) return;
|
|
586
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
587
|
+
process.stderr.write(`[provider:${name}] ${label} failed: ${msg}\n`);
|
|
588
|
+
});
|
|
589
|
+
}
|
|
590
|
+
|
|
567
591
|
function armNextCatalogRefresh(startedAt = Date.now()) {
|
|
568
592
|
_catalogRefreshNotBefore = startedAt + CATALOG_REFRESH_INTERVAL_MS;
|
|
569
593
|
if (_catalogRefreshTimer) clearTimeout(_catalogRefreshTimer);
|
|
@@ -589,14 +613,7 @@ export function refreshProviderCatalogsOnStartup() {
|
|
|
589
613
|
for (const [name, provider] of providers) {
|
|
590
614
|
const refreshFn = providerCatalogRefreshFn(provider);
|
|
591
615
|
if (!refreshFn) continue;
|
|
592
|
-
pending.push(
|
|
593
|
-
Promise.resolve()
|
|
594
|
-
.then(() => refreshFn())
|
|
595
|
-
.catch((err) => {
|
|
596
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
597
|
-
process.stderr.write(`[provider:${name}] startup catalog refresh failed: ${msg}\n`);
|
|
598
|
-
})
|
|
599
|
-
);
|
|
616
|
+
pending.push(boundedCatalogRefresh(name, provider, refreshFn, 'startup catalog refresh'));
|
|
600
617
|
}
|
|
601
618
|
// Returns a completion promise so callers can invalidate stale model
|
|
602
619
|
// caches once the fresh catalogs land. Still fire-and-forget: unawaited
|
|
@@ -621,25 +638,22 @@ export function refreshCatalogs(options = {}) {
|
|
|
621
638
|
}
|
|
622
639
|
armNextCatalogRefresh();
|
|
623
640
|
const pending = [];
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
641
|
+
// The shared metadata fetch is bounded the same way: providers wait for it
|
|
642
|
+
// at most one deadline before refreshing without fresh metadata.
|
|
643
|
+
const metadataReady = boundedProviderCatalogOp({
|
|
644
|
+
name: '(model-metadata)',
|
|
645
|
+
provider: null,
|
|
646
|
+
kind: 'refresh',
|
|
647
|
+
run: () => refreshMetadataCatalog(),
|
|
648
|
+
}).then(({ error }) => {
|
|
649
|
+
if (!error) return;
|
|
650
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
651
|
+
process.stderr.write(`[model-catalog] metadata refresh failed: ${msg}\n`);
|
|
652
|
+
});
|
|
631
653
|
for (const [name, provider] of providers) {
|
|
632
654
|
const refreshFn = providerCatalogRefreshFn(provider);
|
|
633
655
|
if (!refreshFn) continue;
|
|
634
|
-
pending.push(
|
|
635
|
-
Promise.resolve()
|
|
636
|
-
.then(() => metadataReady)
|
|
637
|
-
.then(() => refreshFn())
|
|
638
|
-
.catch((err) => {
|
|
639
|
-
const msg = err instanceof Error ? err.message : String(err);
|
|
640
|
-
process.stderr.write(`[provider:${name}] catalog refresh failed: ${msg}\n`);
|
|
641
|
-
})
|
|
642
|
-
);
|
|
656
|
+
pending.push(metadataReady.then(() => boundedCatalogRefresh(name, provider, refreshFn, 'catalog refresh')));
|
|
643
657
|
}
|
|
644
658
|
// Completion promise: lets callers drop stale model caches after refresh.
|
|
645
659
|
_catalogRefreshPromise = Promise.allSettled([metadataReady, ...pending])
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import { loginPageUrl } from '../session/human-gate/requests.mjs';
|
|
2
|
+
|
|
3
|
+
const ASK_USER_MAX_QUESTIONS = 4;
|
|
2
4
|
export const ASK_USER_MAX_TEXT = 4000;
|
|
3
|
-
export const ASK_USER_MAX_LABEL = 80;
|
|
4
5
|
|
|
5
6
|
export const ASK_USER_TOOL_DEFS = Object.freeze([
|
|
6
7
|
{
|
|
@@ -9,7 +10,7 @@ export const ASK_USER_TOOL_DEFS = Object.freeze([
|
|
|
9
10
|
trigger:
|
|
10
11
|
'Ask the user 1–4 multiple-choice questions and wait; when a plan needs the user to pick between clear options, instead of listing them in chat.',
|
|
11
12
|
description:
|
|
12
|
-
'Ask the user multiple-choice questions and wait. Only
|
|
13
|
+
'Ask the user multiple-choice questions and wait. Only for a decision only the user can make, with clear options; never for minor choices or approval of requested work, and open questions go in chat. Do not repeat the options in your message.',
|
|
13
14
|
annotations: {
|
|
14
15
|
title: 'Ask User',
|
|
15
16
|
readOnlyHint: true,
|
|
@@ -51,13 +52,106 @@ export const ASK_USER_TOOL_DEFS = Object.freeze([
|
|
|
51
52
|
required: ['question', 'header', 'options'],
|
|
52
53
|
},
|
|
53
54
|
},
|
|
55
|
+
handoff: {
|
|
56
|
+
type: 'object',
|
|
57
|
+
description:
|
|
58
|
+
'Instead of questions: secret = the user types a password/token into the focused field (you never see it; result provided/skipped/timeout); takeover = the user does a step (sign-in, CAPTCHA, 2FA) and says done.',
|
|
59
|
+
properties: {
|
|
60
|
+
kind: { type: 'string', enum: ['secret', 'takeover'] },
|
|
61
|
+
surface: { type: 'string', enum: ['browser', 'computer'] },
|
|
62
|
+
target: { type: 'string', maxLength: 200, description: 'Site/app and form.' },
|
|
63
|
+
field: { type: 'string', maxLength: 80, description: 'secret: field label.' },
|
|
64
|
+
instructions: { type: 'string', maxLength: 2000, description: 'takeover: what to do.' },
|
|
65
|
+
need: {
|
|
66
|
+
type: 'string',
|
|
67
|
+
enum: ['sign_in', 'action', 'confirmation'],
|
|
68
|
+
description:
|
|
69
|
+
'takeover: sign_in (sign-in, 2FA), action (CAPTCHA, other step), confirmation (identity/payment check). Default action.',
|
|
70
|
+
},
|
|
71
|
+
purpose: {
|
|
72
|
+
type: 'string',
|
|
73
|
+
enum: ['login'],
|
|
74
|
+
description: 'browser takeover: login = sign-in window on url.',
|
|
75
|
+
},
|
|
76
|
+
url: { type: 'string', maxLength: 2048, description: 'login: sign-in page (https).' },
|
|
77
|
+
tab: { type: 'string', maxLength: 64, description: 'browser takeover: page ID from list_tabs.' },
|
|
78
|
+
window_id: { type: 'string', maxLength: 128, description: 'computer takeover: exact window id.' },
|
|
79
|
+
app: { type: 'string', maxLength: 120, description: 'computer takeover: app name.' },
|
|
80
|
+
},
|
|
81
|
+
required: ['kind', 'surface'],
|
|
82
|
+
additionalProperties: false,
|
|
83
|
+
},
|
|
54
84
|
},
|
|
55
|
-
required: ['questions'],
|
|
56
85
|
additionalProperties: false,
|
|
57
86
|
},
|
|
58
87
|
},
|
|
59
88
|
]);
|
|
60
89
|
|
|
90
|
+
/** The handoff of an ask_user call ({ kind, surface, target, field, instructions }), or null. */
|
|
91
|
+
export function validateAskUserHandoff(args) {
|
|
92
|
+
const handoff = args?.handoff;
|
|
93
|
+
if (handoff == null) return null;
|
|
94
|
+
if (args.questions != null) throw new Error('ask_user takes questions or a handoff, not both');
|
|
95
|
+
if (typeof handoff !== 'object' || Array.isArray(handoff)) throw new Error('ask_user handoff must be an object');
|
|
96
|
+
if (handoff.kind !== 'secret' && handoff.kind !== 'takeover') {
|
|
97
|
+
throw new Error('ask_user handoff kind is secret or takeover');
|
|
98
|
+
}
|
|
99
|
+
if (handoff.surface !== 'browser' && handoff.surface !== 'computer') {
|
|
100
|
+
throw new Error('ask_user handoff surface is browser or computer');
|
|
101
|
+
}
|
|
102
|
+
const text = (key, limit) => (typeof handoff[key] === 'string' ? handoff[key].trim().slice(0, limit) : '');
|
|
103
|
+
if (handoff.kind === 'takeover' && !text('instructions', 2000)) {
|
|
104
|
+
throw new Error('ask_user takeover needs instructions');
|
|
105
|
+
}
|
|
106
|
+
const login = handoffLogin(handoff);
|
|
107
|
+
let need = login ? 'sign_in' : 'action';
|
|
108
|
+
if (['sign_in', 'action', 'confirmation'].includes(handoff.need)) need = handoff.need;
|
|
109
|
+
return {
|
|
110
|
+
kind: handoff.kind,
|
|
111
|
+
surface: handoff.surface,
|
|
112
|
+
target: text('target', 200),
|
|
113
|
+
field: text('field', 80),
|
|
114
|
+
instructions: text('instructions', 2000),
|
|
115
|
+
...(handoff.kind === 'takeover' ? { need, identity: handoffIdentity(handoff), ...(login ? { login } : {}) } : {}),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/** A login takeover's sign-in page ({ url, origin }); null without the
|
|
120
|
+
* explicit purpose, so every other takeover keeps the side panel. */
|
|
121
|
+
function handoffLogin(handoff) {
|
|
122
|
+
if (handoff.purpose == null) return null;
|
|
123
|
+
if (handoff.purpose !== 'login' || handoff.kind !== 'takeover' || handoff.surface !== 'browser') {
|
|
124
|
+
throw new Error('ask_user purpose login is a browser takeover');
|
|
125
|
+
}
|
|
126
|
+
const page = loginPageUrl(handoff.url);
|
|
127
|
+
if (!page) throw new Error('ask_user login needs an https url (http only on localhost)');
|
|
128
|
+
return page;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** The window a takeover is about, validated per surface: a browser page ID
|
|
132
|
+
* (list_tabs p1, v1 or a page name) or a computer window id and app. Shapes
|
|
133
|
+
* that are not plain tokens are dropped, never passed on. */
|
|
134
|
+
const TOKEN = /^[\w.:#@-]+$/;
|
|
135
|
+
function handoffIdentity(handoff) {
|
|
136
|
+
const token = (key, limit) => {
|
|
137
|
+
const value = typeof handoff[key] === 'string' ? handoff[key].trim() : '';
|
|
138
|
+
return value && value.length <= limit && TOKEN.test(value) ? value : '';
|
|
139
|
+
};
|
|
140
|
+
if (handoff.surface === 'browser') {
|
|
141
|
+
const tab = token('tab', 64);
|
|
142
|
+
return tab ? { tab } : {};
|
|
143
|
+
}
|
|
144
|
+
const windowId = token('window_id', 128);
|
|
145
|
+
const app =
|
|
146
|
+
typeof handoff.app === 'string'
|
|
147
|
+
? handoff.app
|
|
148
|
+
.replace(/[\r\n]+/g, ' ')
|
|
149
|
+
.trim()
|
|
150
|
+
.slice(0, 120)
|
|
151
|
+
: '';
|
|
152
|
+
return { ...(windowId ? { windowId } : {}), ...(app ? { app } : {}) };
|
|
153
|
+
}
|
|
154
|
+
|
|
61
155
|
/** Throws a clear error when the questions are malformed; returns the list. */
|
|
62
156
|
export function validateAskUserQuestions(args) {
|
|
63
157
|
const questions = args?.questions;
|
|
@@ -46,6 +46,7 @@ export function sessionTokenCounters(session) {
|
|
|
46
46
|
totalOutputTokens: Number(session?.totalOutputTokens || 0),
|
|
47
47
|
totalCachedReadTokens: Number(session?.totalCachedReadTokens || 0),
|
|
48
48
|
totalCacheWriteTokens: Number(session?.totalCacheWriteTokens || 0),
|
|
49
|
+
usageReadout: session?.usageReadout || null,
|
|
49
50
|
compactBoundaryTokens: Number(session?.compactBoundaryTokens || 0),
|
|
50
51
|
};
|
|
51
52
|
}
|
|
@@ -64,6 +65,9 @@ function sessionUsageCounters(session, lastContextTokens) {
|
|
|
64
65
|
totalOutputTokens: Number(session?.totalOutputTokens || 0),
|
|
65
66
|
totalCachedReadTokens: Number(session?.totalCachedReadTokens || 0),
|
|
66
67
|
totalCacheWriteTokens: Number(session?.totalCacheWriteTokens || 0),
|
|
68
|
+
// Session-cumulative cache/speed totals behind the composer readout; null
|
|
69
|
+
// until the session has a call recorded.
|
|
70
|
+
usageReadout: session?.usageReadout || null,
|
|
67
71
|
};
|
|
68
72
|
}
|
|
69
73
|
|
|
@@ -48,12 +48,14 @@ export function filterMcpToolsForCwd(tools, scopes, cwd) {
|
|
|
48
48
|
});
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
/** The MCP tools a session at `cwd` may see. No scopes configured → input
|
|
52
|
-
*
|
|
51
|
+
/** The MCP tools a session at `cwd` may see. No scopes configured → the input
|
|
52
|
+
* as-is, so the global-only fast path costs one config read. An agent's
|
|
53
|
+
* connectors never narrow this list: the schema and the BP2 manifest stay
|
|
54
|
+
* identical across agents (one shared cache prefix), and the connector policy
|
|
55
|
+
* is enforced at dispatch (pre-dispatch-deny / connector approval). */
|
|
53
56
|
export function filterMcpToolsForSession(tools, cwd, config = null) {
|
|
54
57
|
const list = Array.isArray(tools) ? tools : [];
|
|
55
58
|
if (!list.length) return list;
|
|
56
59
|
const scopes = extensionScopesFromConfig(config || loadConfig({ secrets: false }));
|
|
57
|
-
|
|
58
|
-
return filterMcpToolsForCwd(list, scopes, cwd);
|
|
60
|
+
return hasExtensionScopes(scopes) ? filterMcpToolsForCwd(list, scopes, cwd) : list;
|
|
59
61
|
}
|
|
@@ -19,6 +19,18 @@ Lead executes all work directly and never delegates on its own judgment.
|
|
|
19
19
|
Only when the user explicitly asks for delegation, load the deferred \`agent\`
|
|
20
20
|
tool and brief each agent as the Lead rules describe.`;
|
|
21
21
|
|
|
22
|
+
/** Agent mode's fixed delegation block, in place of the orchestration mode. */
|
|
23
|
+
export const AGENT_MODE_DELEGATION = `# Delegation
|
|
24
|
+
|
|
25
|
+
Handle conversation yourself. Delegate specialised work to sub-agents. Hand
|
|
26
|
+
substantial coding to a new coding-mode task session (\`session create\`) with
|
|
27
|
+
a self-contained brief: start it when already requested, otherwise suggest it. Then relay the
|
|
28
|
+
result in your own words.`;
|
|
29
|
+
|
|
30
|
+
/** Mixy only: it also routes requests to the user's contact agents. */
|
|
31
|
+
export const MIXY_CONTACTS_INTRO = `You also coordinate the user's contact agents: route a request to the
|
|
32
|
+
contact best suited for it with the same kind of brief.`;
|
|
33
|
+
|
|
22
34
|
export function orchestrationInstructions(value) {
|
|
23
35
|
const mode = normalizeOrchestrationMode(value);
|
|
24
36
|
if (mode === 'none') return SOLO;
|
|
@@ -29,8 +41,7 @@ ${BATCHING[mode]}
|
|
|
29
41
|
The mode sets how work splits; an agent's description sets its role and when
|
|
30
42
|
it runs. Splitting applies to every role alike — implementation, review,
|
|
31
43
|
investigation, writing — by file, module, commit range or risk area.
|
|
32
|
-
If the plan has only one implementation scope, Lead executes it directly
|
|
33
|
-
role tied to a point in the work, such as the final check, still runs then.
|
|
44
|
+
If the plan has only one implementation scope, Lead executes it directly.
|
|
34
45
|
|
|
35
46
|
Delegation is for work whose size justifies a brief. When the brief would have
|
|
36
47
|
to spell out the edits themselves — a few localized changes whose sites Lead
|
|
@@ -41,11 +52,7 @@ Dispatch all ready independent scopes in one turn. Only a scope that requires
|
|
|
41
52
|
another's output waits. Brief each agent as the Lead rules describe.
|
|
42
53
|
A running agent receives only changes within its own scope; a new independent
|
|
43
54
|
need goes to a new agent. When scopes touch the same file, name one owner for
|
|
44
|
-
that file in each brief.
|
|
45
|
-
Lead runs the full suite once after integration.
|
|
55
|
+
that file in each brief.
|
|
46
56
|
Use only available agents; when none fits a role, Lead does that work itself
|
|
47
|
-
and never changes settings to enable one
|
|
48
|
-
unavailable, Lead alone reviews the result against the approved scope and
|
|
49
|
-
performs the required verification, without a substitute agent; never skip
|
|
50
|
-
review or describe Lead's own review as independent.`;
|
|
57
|
+
and never changes settings to enable one.`;
|
|
51
58
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
deferredCatalogUnion,
|
|
15
15
|
filterSessionToolPolicy,
|
|
16
16
|
isReadonlySelectable,
|
|
17
|
+
mcpServerSelection,
|
|
17
18
|
toolSearchMatches,
|
|
18
19
|
} from './tool-catalog.mjs';
|
|
19
20
|
import { parseToolSelection, sortedCatalogByMeasuredUsage } from './tool-catalog-schema.mjs';
|
|
@@ -249,8 +250,9 @@ function describeNames(raw) {
|
|
|
249
250
|
return names;
|
|
250
251
|
}
|
|
251
252
|
|
|
252
|
-
// Requested names → available tools; an alias that names no
|
|
253
|
-
// its members (existing load_tool alias compatibility).
|
|
253
|
+
// Requested names → available tools; an alias or `mcp__<server>` that names no
|
|
254
|
+
// tool expands to its members (existing load_tool alias compatibility).
|
|
255
|
+
// Definitions past the continuation target cap are listed as omitted.
|
|
254
256
|
function resolveDescribeTargets(session, names, mode, available) {
|
|
255
257
|
const eagerNames = eagerToolNames(session);
|
|
256
258
|
const targets = [];
|
|
@@ -271,13 +273,15 @@ function resolveDescribeTargets(session, names, mode, available) {
|
|
|
271
273
|
add(tool);
|
|
272
274
|
continue;
|
|
273
275
|
}
|
|
274
|
-
const
|
|
276
|
+
const aliased = (DEFERRED_SELECT_ALIASES[requested.toLowerCase()] || [])
|
|
275
277
|
.map((member) => lookupByName(available, member))
|
|
276
278
|
.filter(Boolean);
|
|
279
|
+
const members = aliased.length ? aliased : mcpServerSelection(available, requested);
|
|
277
280
|
if (members.length) members.forEach(add);
|
|
278
281
|
else missing.push(requested);
|
|
279
282
|
}
|
|
280
|
-
|
|
283
|
+
const omitted = targets.splice(BRIDGE_LIMITS.continuationMaxTargets).map((tool) => clean(tool?.name));
|
|
284
|
+
return { targets, missing, blocked, omitted };
|
|
281
285
|
}
|
|
282
286
|
|
|
283
287
|
const SEARCH_MAX_MATCHES = 20;
|
|
@@ -367,6 +371,7 @@ export function describeBridgeTools(session, args = {}, { mode } = {}) {
|
|
|
367
371
|
let missing = [];
|
|
368
372
|
let blocked = [];
|
|
369
373
|
let matches = [];
|
|
374
|
+
let omitted = [];
|
|
370
375
|
if (continuation) {
|
|
371
376
|
targets = continuationTargets(session, continuation.indexes, available, mode);
|
|
372
377
|
if (!targets) return catalogChanged();
|
|
@@ -378,10 +383,11 @@ export function describeBridgeTools(session, args = {}, { mode } = {}) {
|
|
|
378
383
|
`names must be 1-${BRIDGE_LIMITS.describeMaxNames} exact tool names of at most ${BRIDGE_LIMITS.nameMaxChars} characters.${syntaxHint}`
|
|
379
384
|
);
|
|
380
385
|
}
|
|
381
|
-
({ targets, missing, blocked } = resolveDescribeTargets(session, names, mode, available));
|
|
386
|
+
({ targets, missing, blocked, omitted } = resolveDescribeTargets(session, names, mode, available));
|
|
382
387
|
({ matches, missing } = searchKeywords(session, missing, mode, available));
|
|
383
388
|
}
|
|
384
|
-
|
|
389
|
+
// Omitted names are described by a later request naming them.
|
|
390
|
+
const found = { ...(matches.length ? { matches } : {}), ...(omitted.length ? { omitted } : {}) };
|
|
385
391
|
const docs = targets.map((tool) => {
|
|
386
392
|
const document = toolDocument(tool);
|
|
387
393
|
return {
|
|
@@ -4,6 +4,8 @@
|
|
|
4
4
|
import { clean } from './session-text.mjs';
|
|
5
5
|
import { mergePendingDeferredToolDelta } from './deferred-tool-delta.mjs';
|
|
6
6
|
import { applyInitialDeferredToolManifestToBp2 } from '../context/collect.mjs';
|
|
7
|
+
import { listedDeferredToolNames } from '../context/deferred-tools.mjs';
|
|
8
|
+
import { parseMcpToolName } from '../../../shared/tool-primitives.mjs';
|
|
7
9
|
import { getMcpServerInstructionsMap, getMcpTools, getMcpToolGeneration } from '../mcp/client.mjs';
|
|
8
10
|
import { filterMcpToolsForSession } from './extension-scopes.mjs';
|
|
9
11
|
import { isDeferredToolAvailable, isToolPermittedBySessionPolicy } from './deferred-tool-availability.mjs';
|
|
@@ -259,6 +261,17 @@ function expandSelectionNames(names) {
|
|
|
259
261
|
return [...new Set(out)];
|
|
260
262
|
}
|
|
261
263
|
|
|
264
|
+
/**
|
|
265
|
+
* The tools of `tools` that `mcp__<server>` stands for (the deferred manifest
|
|
266
|
+
* lists MCP servers, not their tools); [] for any other name. Callers try an
|
|
267
|
+
* exact tool name first.
|
|
268
|
+
*/
|
|
269
|
+
export function mcpServerSelection(tools, requested) {
|
|
270
|
+
const server = /^mcp__(.+)$/i.exec(clean(requested))?.[1]?.toLowerCase();
|
|
271
|
+
if (!server) return [];
|
|
272
|
+
return (tools || []).filter((tool) => String(parseMcpToolName(tool)?.server || '').toLowerCase() === server);
|
|
273
|
+
}
|
|
274
|
+
|
|
262
275
|
function storedDeferredToolNames(session) {
|
|
263
276
|
for (const source of [session?.deferredDiscoveredTools, session?.deferredSelectedTools]) {
|
|
264
277
|
const names = parseToolSelection(source);
|
|
@@ -430,8 +443,11 @@ export function applyDeferredToolSurface(session, mode, extraTools = [], options
|
|
|
430
443
|
// manifest, or the bridge roster + guidance. History stays as is.
|
|
431
444
|
session.mcpServerInstructions = getMcpServerInstructionsMap(session.mcpScopeId);
|
|
432
445
|
applyInitialDeferredToolManifestToBp2(session, deferredPoolToolNames(session), { rebuild: true });
|
|
433
|
-
|
|
434
|
-
|
|
446
|
+
session.deferredAnnouncedTools = listedDeferredToolNames(
|
|
447
|
+
session,
|
|
448
|
+
deferredPoolToolNames(session),
|
|
449
|
+
renderedDeferredManifest(session)
|
|
450
|
+
);
|
|
435
451
|
}
|
|
436
452
|
if (!session.deferredToolBp2Applied && session.messages?.some((m) => m?.role === 'system')) {
|
|
437
453
|
if (!session.mcpServerInstructions || typeof session.mcpServerInstructions !== 'object') {
|
|
@@ -519,8 +535,11 @@ export function refreshInitialDeferredMcpSurface(session, liveMcpTools) {
|
|
|
519
535
|
// Pre-mark ONLY the names that ACTUALLY landed in the rebuilt BP2 manifest as
|
|
520
536
|
// announced; anything the manifest could not advertise stays un-announced so
|
|
521
537
|
// the turn-boundary late reminder can still surface it.
|
|
522
|
-
|
|
523
|
-
|
|
538
|
+
session.deferredAnnouncedTools = listedDeferredToolNames(
|
|
539
|
+
session,
|
|
540
|
+
deferredPoolToolNames(session),
|
|
541
|
+
renderedDeferredManifest(session)
|
|
542
|
+
);
|
|
524
543
|
session.updatedAt = Date.now();
|
|
525
544
|
return true;
|
|
526
545
|
}
|
|
@@ -726,7 +745,15 @@ export function selectDeferredTools(session, names, mode, { exact = false } = {}
|
|
|
726
745
|
const already = [];
|
|
727
746
|
const blocked = [];
|
|
728
747
|
const missing = [];
|
|
729
|
-
|
|
748
|
+
const requested = exact
|
|
749
|
+
? names
|
|
750
|
+
: expandSelectionNames(names).flatMap((raw) => {
|
|
751
|
+
const key = clean(raw);
|
|
752
|
+
if (byName.has(key) || byName.has(key.toLowerCase())) return [key];
|
|
753
|
+
const members = mcpServerSelection(catalog, key).map((tool) => clean(tool?.name));
|
|
754
|
+
return members.length ? members : [key];
|
|
755
|
+
});
|
|
756
|
+
for (const rawName of new Set(requested)) {
|
|
730
757
|
const requestedName = clean(rawName);
|
|
731
758
|
const tool = byName.get(requestedName) || byName.get(requestedName.toLowerCase());
|
|
732
759
|
const name = clean(tool?.name);
|
|
@@ -17,7 +17,8 @@ export const TOOL_SEARCH_TOOL = {
|
|
|
17
17
|
openWorldHint: false,
|
|
18
18
|
agentHidden: true,
|
|
19
19
|
},
|
|
20
|
-
description:
|
|
20
|
+
description:
|
|
21
|
+
'Load full schemas for missing deferred tool names/aliases; a connector name loads all its tools; batch needed names in one call.',
|
|
21
22
|
inputSchema: {
|
|
22
23
|
type: 'object',
|
|
23
24
|
properties: {
|
|
@@ -72,7 +73,7 @@ export const SESSION_TOOL = {
|
|
|
72
73
|
openWorldHint: false,
|
|
73
74
|
agentHidden: true,
|
|
74
75
|
},
|
|
75
|
-
trigger: 'Session lookup/control, title, compact, fork, Project and worktrees.',
|
|
76
|
+
trigger: 'Session lookup/control, coding task sessions, title, compact, fork, Project and worktrees.',
|
|
76
77
|
description:
|
|
77
78
|
'Inspect sessions or control another by exact ID, never a guessed one. send acknowledges queue intake, not completion. Cancel/delete and worktree actions require the user’s request. Other actions affect only the current session.',
|
|
78
79
|
inputSchema: {
|
|
@@ -87,6 +88,7 @@ export const SESSION_TOOL = {
|
|
|
87
88
|
'send',
|
|
88
89
|
'cancel',
|
|
89
90
|
'delete',
|
|
91
|
+
'create',
|
|
90
92
|
'rename',
|
|
91
93
|
'compact',
|
|
92
94
|
'fork',
|
|
@@ -100,9 +102,9 @@ export const SESSION_TOOL = {
|
|
|
100
102
|
'prune-worktrees',
|
|
101
103
|
],
|
|
102
104
|
description:
|
|
103
|
-
'status defaults to current; list pages sessions; read returns latest items; send queues prompt; cancel stops the turn; delete removes the session. compact runs after this turn; fork copies it without switching. merge-worktree merges into the Project’s checked-out branch; remove-worktree returns to the Project (repeat on WORKTREE_REMOVAL_INCOMPLETE); list-worktrees includes retaining sessions; prune-worktrees removes only clean, merged, unretained worktrees.',
|
|
105
|
+
'status defaults to current; list pages sessions; read returns latest items; send queues prompt; cancel stops the turn; delete removes the session. create (agent conversations) starts a visible coding task session from brief and reports its turns back; unknown Project: list-projects first, still ambiguous: ask the user. compact runs after this turn; fork copies it without switching. merge-worktree merges into the Project’s checked-out branch; remove-worktree returns to the Project (repeat on WORKTREE_REMOVAL_INCOMPLETE); list-worktrees includes retaining sessions; prune-worktrees removes only clean, merged, unretained worktrees.',
|
|
104
106
|
},
|
|
105
|
-
title: { type: 'string', description: 'rename: new current-session title.' },
|
|
107
|
+
title: { type: 'string', description: 'rename: new current-session title; create: task title.' },
|
|
106
108
|
session_id: {
|
|
107
109
|
type: 'string',
|
|
108
110
|
description:
|
|
@@ -143,6 +145,10 @@ export const SESSION_TOOL = {
|
|
|
143
145
|
description: 'remove-worktree: allow uncommitted/unmerged work only when explicitly requested.',
|
|
144
146
|
},
|
|
145
147
|
value: { type: 'boolean', description: 'favorite/archive: on or off.' },
|
|
148
|
+
brief: { type: 'string', description: 'create: self-contained instruction, the first message.' },
|
|
149
|
+
project: { type: 'string', description: 'create: registered Project name or existing directory.' },
|
|
150
|
+
model: { type: 'string', description: 'create: provider/model or preset; default route otherwise.' },
|
|
151
|
+
notify: { type: 'boolean', description: 'create: report results back, default true.' },
|
|
146
152
|
},
|
|
147
153
|
additionalProperties: false,
|
|
148
154
|
},
|
|
@@ -29,7 +29,8 @@ function* scanCustomAgentIds(userRoot, shippedRoot) {
|
|
|
29
29
|
for (const entry of entries) {
|
|
30
30
|
if (!entry.isDirectory()) continue;
|
|
31
31
|
const id = normalizeWorkflowId(entry.name);
|
|
32
|
-
|
|
32
|
+
// `lead` is Mixy's own folder (PERSONA.md, AGENT.md), never an agent.
|
|
33
|
+
if (!id || id === 'lead' || AGENT_ROLE_IDS.has(id) || isHiddenAgent(id)) continue;
|
|
33
34
|
if (root !== userRoot && (yield { op: 'exists', path: join(userRoot, id, AGENT_DELETED_MARKER) })) continue;
|
|
34
35
|
if (!(yield { op: 'exists', path: join(root, entry.name, 'AGENT.md') })) continue;
|
|
35
36
|
ids.add(id);
|
|
@@ -101,6 +102,8 @@ export function createWorkflowAgents({ rootDir, dataDir, readMarkdownDocument, n
|
|
|
101
102
|
permission: normalizeAgentPermissionOrNone(doc.frontmatter.permission),
|
|
102
103
|
frontmatter: doc.frontmatter,
|
|
103
104
|
body,
|
|
105
|
+
// Optional PERSONA.md beside AGENT.md (same dir, same cache entry).
|
|
106
|
+
persona: (readTextSafe(join(d, 'PERSONA.md')) || '').trim(),
|
|
104
107
|
};
|
|
105
108
|
setAgentDefinitionCache(cacheKey, definition);
|
|
106
109
|
return definition;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// (active pack + orchestration instructions + delegatable agent catalog).
|
|
3
3
|
import { clean } from '../session-text.mjs';
|
|
4
4
|
import { configuredOrchestrationMode } from '../../../../shared/orchestration.mjs';
|
|
5
|
-
import { orchestrationInstructions } from '../orchestration.mjs';
|
|
6
|
-
import { DEFAULT_WORKFLOW_ID, normalizeWorkflowId } from '../workflow-ids.mjs';
|
|
5
|
+
import { AGENT_MODE_DELEGATION, MIXY_CONTACTS_INTRO, orchestrationInstructions } from '../orchestration.mjs';
|
|
6
|
+
import { DEFAULT_WORKFLOW_ID, isContactAgentId, normalizeWorkflowId } from '../workflow-ids.mjs';
|
|
7
7
|
|
|
8
8
|
export function createWorkflowContext({ packs, agents }) {
|
|
9
9
|
function workflowSummary(pack, { hasAgents = true } = {}) {
|
|
@@ -43,26 +43,53 @@ export function createWorkflowContext({ packs, agents }) {
|
|
|
43
43
|
return lines.join('\n\n');
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
// Name + description only: the AGENT.md body is the worker's own system
|
|
47
|
+
// prompt and rides in the worker session at spawn time — repeating it in
|
|
48
|
+
// the Lead prompt only bloats context. Lead picks agents by description
|
|
49
|
+
// (a when-to-use signal); orchestration carries the delegation rules.
|
|
50
|
+
function agentCatalog(dir, ids) {
|
|
51
|
+
return ids
|
|
52
|
+
.map((id) => agents.loadAgentDefinition(dir, id))
|
|
53
|
+
.filter(Boolean)
|
|
54
|
+
.map((agent) => `- ${agent.name} (${agent.id})${agent.description ? `: ${agent.description}` : ''}`)
|
|
55
|
+
.join('\n');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// A Lead's workflow slices for BP3 (composeSystemPrompt orders them):
|
|
59
|
+
// - coding: the orchestration mode block and the full agent catalog;
|
|
60
|
+
// - agent mode: the fixed delegation block (no per-agent setting) and the
|
|
61
|
+
// sub-agent catalog — identical for every agent, so their prompts share
|
|
62
|
+
// it — plus, for Mixy only, the contact-agent catalog.
|
|
63
|
+
function leadPromptParts(config, dir, { agentMode = false, mixy = false } = {}) {
|
|
47
64
|
const mode = configuredOrchestrationMode(config);
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
// the Lead prompt only bloats context. Lead picks agents by description
|
|
58
|
-
// (a when-to-use signal); orchestration carries the delegation rules.
|
|
59
|
-
lines.push(
|
|
60
|
-
agentBlocks
|
|
61
|
-
.map((agent) => `- ${agent.name} (${agent.id})${agent.description ? `: ${agent.description}` : ''}`)
|
|
62
|
-
.join('\n')
|
|
63
|
-
);
|
|
65
|
+
const ids = agents.delegatableAgentIds(config, dir);
|
|
66
|
+
if (!agentMode) {
|
|
67
|
+
const catalog = agentCatalog(dir, ids);
|
|
68
|
+
return {
|
|
69
|
+
// Solo without agents has nothing to delegate to on request either.
|
|
70
|
+
orchestrationContext: mode === 'none' && !ids.length ? '' : orchestrationInstructions(mode),
|
|
71
|
+
agentCatalogContext: catalog ? `# Available Agents\n\n${catalog}` : '',
|
|
72
|
+
contactCatalogContext: '',
|
|
73
|
+
};
|
|
64
74
|
}
|
|
65
|
-
|
|
75
|
+
const isContact = (id) => isContactAgentId(id, agents.loadAgentDefinition(dir, id)?.frontmatter?.kind);
|
|
76
|
+
const subAgents = agentCatalog(
|
|
77
|
+
dir,
|
|
78
|
+
ids.filter((id) => !isContact(id))
|
|
79
|
+
);
|
|
80
|
+
const contacts = mixy ? agentCatalog(dir, ids.filter(isContact)) : '';
|
|
81
|
+
return {
|
|
82
|
+
// An agent-mode Lead without agents has no one to delegate to at all.
|
|
83
|
+
orchestrationContext: subAgents || contacts ? AGENT_MODE_DELEGATION : '',
|
|
84
|
+
agentCatalogContext: subAgents ? `# Available Agents\n\n${subAgents}` : '',
|
|
85
|
+
contactCatalogContext: contacts ? `# Contact Agents\n\n${MIXY_CONTACTS_INTRO}\n\n${contacts}` : '',
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// The coding Lead's combined block (orchestration + catalog), as before.
|
|
90
|
+
function orchestrationContextBlock(config, dir) {
|
|
91
|
+
const { orchestrationContext, agentCatalogContext } = leadPromptParts(config, dir);
|
|
92
|
+
return [orchestrationContext, agentCatalogContext].filter(Boolean).join('\n\n');
|
|
66
93
|
}
|
|
67
94
|
|
|
68
95
|
// Single-pass variant: loads the active WORKFLOW.md pack once and derives both
|
|
@@ -81,6 +108,9 @@ export function createWorkflowContext({ packs, agents }) {
|
|
|
81
108
|
// orchestration instructions / agent catalog.
|
|
82
109
|
packContext,
|
|
83
110
|
context: [packContext, orchestrationContextBlock(config, dir)].filter(Boolean).join('\n\n'),
|
|
111
|
+
// A Lead's BP3 slices beside the pack: `{ agentMode, mixy }` picks the
|
|
112
|
+
// coding, agent or Mixy variant (session/agent-mode.mjs).
|
|
113
|
+
leadPromptParts: (options) => leadPromptParts(config, dir, options),
|
|
84
114
|
};
|
|
85
115
|
}
|
|
86
116
|
|
|
@@ -15,6 +15,8 @@ export const BUILTIN_SLOT_AGENT_IDS = new Set(
|
|
|
15
15
|
FIXED_AGENT_SLOTS.filter((agent) => agent.workflowSlot).map((agent) => agent.id)
|
|
16
16
|
);
|
|
17
17
|
export const STARTER_AGENT_ORDER = new Map(DEFAULT_DISABLED_AGENT_IDS.map((id, index) => [id, index]));
|
|
18
|
+
// Only Mixy delegates to contacts (agent-route-config.mjs isContactAgentId).
|
|
19
|
+
export { isContactAgentId } from '../../../shared/agent-route-config.mjs';
|
|
18
20
|
export const DEFAULT_WORKFLOW_ID = 'default';
|
|
19
21
|
|
|
20
22
|
// Loaded AGENT.md definitions, keyed `${dir}\n${agentId}`.
|