mixdog 1.4.0 → 1.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +3 -2
- package/scripts/build-shipped-history.mjs +115 -33
- package/scripts/check-voice-runtime-inputs.mjs +25 -0
- package/scripts/gate-local.mjs +183 -63
- package/scripts/latest-guard.mjs +21 -9
- package/scripts/lib/gate-scheduler.mjs +138 -32
- package/scripts/lib/gate-timing-reporter.mjs +16 -0
- package/scripts/lib/isolated-test-env.mjs +10 -5
- package/scripts/lib/run-node-tests.mjs +91 -66
- package/scripts/lib/scoped-temp.d.mts +16 -0
- package/scripts/lib/scoped-temp.mjs +124 -0
- package/scripts/lib/stale-temp.mjs +44 -0
- package/scripts/lib/test-failure-records.mjs +14 -1
- package/scripts/lib/test-failure-summary.mjs +16 -4
- package/scripts/lib/test-spawn-ledger.mjs +12 -3
- package/scripts/post-release-check.mjs +1 -6
- package/scripts/pptx-kit-index.mjs +17 -5
- package/scripts/suite-health.mjs +115 -24
- package/scripts/test-data-dir.mjs +10 -7
- package/scripts/test.mjs +9 -14
- package/src/agents/advisor/AGENT.md +4 -4
- package/src/agents/advisor/agent.json +1 -1
- package/src/agents/explore/AGENT.md +22 -0
- package/src/agents/explore/agent.json +6 -0
- package/src/app.mjs +4 -0
- package/src/cli.mjs +7 -0
- package/src/defaults/agents.json +7 -0
- package/src/defaults/shipped-history.json +23 -2
- package/src/defaults/skills/browser-use/SKILL.md +10 -5
- package/src/defaults/skills/code-tidy/SKILL.md +71 -102
- package/src/defaults/skills/code-tidy/references/agent-cleanup.md +66 -114
- package/src/defaults/skills/code-tidy/references/cleanup-report.md +19 -35
- package/src/defaults/skills/code-tidy/references/dead-code.md +3 -9
- package/src/defaults/skills/code-tidy/references/test-suite-slop.md +16 -27
- package/src/defaults/skills/computer-use/SKILL.md +16 -4
- package/src/defaults/skills/goal-management/SKILL.md +1 -1
- package/src/defaults/skills/setup/references/actions.md +12 -6
- package/src/defaults/skills/setup/references/surfaces.md +2 -2
- package/src/defaults/skills/setup-guide/SKILL.md +5 -2
- package/src/defaults/skills/setup-guide/model-recommendations.json +13 -0
- package/src/defaults/skills/skill-creator/SKILL.md +85 -190
- package/src/defaults/skills/skill-creator/references/design.md +70 -162
- package/src/defaults/skills/skill-creator/references/evaluation.md +33 -92
- package/src/defaults/skills/test-suite/SKILL.md +194 -0
- package/src/defaults/skills/test-suite/references/case-management.md +51 -0
- package/src/defaults/skills/test-suite/references/flaky-policy.md +39 -0
- package/src/defaults/skills/test-suite/references/reliability.md +49 -0
- package/src/defaults/skills/test-suite/references/suite-design.md +78 -0
- package/src/defaults/skills/test-suite/scripts/inventory.mjs +335 -0
- package/src/defaults/skills/visualize/SKILL.md +6 -2
- package/src/lib/rules-builder.cjs +35 -42
- package/src/output-styles/common.md +2 -2
- package/src/output-styles/simple.md +1 -1
- package/src/rules/agent/AGENT.md +5 -4
- package/src/rules/lead/LEAD.md +12 -7
- package/src/rules/shared/10-tool-workflow.md +3 -1
- package/src/rules/shared/20-research.md +3 -6
- package/src/rules/shared/40-editing.md +1 -0
- package/src/rules/shared/45-destructive.md +0 -2
- package/src/rules/shared/50-execution.md +2 -0
- package/src/rules/shared/60-verification.md +10 -9
- package/src/rules/shared/70-delivery.md +8 -9
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch/abort-link.mjs +5 -1
- package/src/runtime/agent/orchestrator/agent-runtime/agent-dispatch.mjs +10 -1
- package/src/runtime/agent/orchestrator/agent-runtime/agent-progress-watchdog.mjs +156 -24
- package/src/runtime/agent/orchestrator/agent-runtime/cache-strategy.mjs +13 -0
- package/src/runtime/agent/orchestrator/agent-runtime/maintenance-route.mjs +4 -1
- package/src/runtime/agent/orchestrator/cache-break-trace.mjs +2 -0
- package/src/runtime/agent/orchestrator/config.mjs +12 -7
- package/src/runtime/agent/orchestrator/context/deferred-tools.mjs +8 -8
- package/src/runtime/agent/orchestrator/context/role-instructions.mjs +5 -26
- package/src/runtime/agent/orchestrator/context/skill-catalog.mjs +3 -1
- package/src/runtime/agent/orchestrator/internal-agents.mjs +3 -14
- package/src/runtime/agent/orchestrator/mcp/agent-connectors.mjs +122 -12
- package/src/runtime/agent/orchestrator/mcp/child-tree.mjs +5 -3
- package/src/runtime/agent/orchestrator/mcp/client-config.mjs +13 -2
- package/src/runtime/agent/orchestrator/mcp/client-transport.mjs +152 -58
- package/src/runtime/agent/orchestrator/mcp/client.mjs +51 -18
- package/src/runtime/agent/orchestrator/mcp/oauth-login.mjs +88 -54
- package/src/runtime/agent/orchestrator/mcp/oauth.mjs +42 -26
- package/src/runtime/agent/orchestrator/providers/account-pool.mjs +54 -8
- package/src/runtime/agent/orchestrator/providers/anthropic-api-recovery.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-api-request.mjs +37 -31
- package/src/runtime/agent/orchestrator/providers/anthropic-api-transport.mjs +8 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-max-tokens-recovery.mjs +6 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-messages.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-client-version.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-credentials.mjs +31 -21
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth-request/initial-status.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/anthropic-oauth.mjs +14 -3
- package/src/runtime/agent/orchestrator/providers/anthropic-sse.mjs +6 -0
- package/src/runtime/agent/orchestrator/providers/anthropic-turn-result.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth-login.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/antigravity-oauth-tokens.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/codex-client-meta.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/command-code-oauth-login.mjs +1 -10
- package/src/runtime/agent/orchestrator/providers/command-code-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/cursor.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/custom-provider-config.mjs +40 -0
- package/src/runtime/agent/orchestrator/providers/custom-provider-keys.mjs +34 -0
- package/src/runtime/agent/orchestrator/providers/custom-provider.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/devin-auth.mjs +14 -7
- package/src/runtime/agent/orchestrator/providers/devin-wire-transport.mjs +3 -2
- package/src/runtime/agent/orchestrator/providers/devin.mjs +3 -0
- package/src/runtime/agent/orchestrator/providers/gemini-response.mjs +2 -2
- package/src/runtime/agent/orchestrator/providers/gemini-stream.mjs +4 -1
- package/src/runtime/agent/orchestrator/providers/grok-oauth-login.mjs +248 -41
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-prefix-trace.mjs +76 -11
- package/src/runtime/agent/orchestrator/providers/lib/anthropic-request-utils.mjs +45 -6
- package/src/runtime/agent/orchestrator/providers/lib/first-output-window.mjs +58 -0
- package/src/runtime/agent/orchestrator/providers/lib/listen-on.mjs +14 -0
- package/src/runtime/agent/orchestrator/providers/lib/oauth-page.mjs +0 -18
- package/src/runtime/agent/orchestrator/providers/lib/oauth-token-utils.mjs +138 -6
- package/src/runtime/agent/orchestrator/providers/mimo-oauth-login.mjs +1 -10
- package/src/runtime/agent/orchestrator/providers/mimo-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/model-cache.mjs +100 -33
- package/src/runtime/agent/orchestrator/providers/muse-code-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/oauth-secret-fields.fixtures.mjs +45 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-send.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/chunk-events.mjs +9 -2
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream/stream-state.mjs +7 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-chat-stream.mjs +14 -3
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses-events.mjs +4 -2
- package/src/runtime/agent/orchestrator/providers/openai-compat-responses.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream-common.mjs +5 -3
- package/src/runtime/agent/orchestrator/providers/openai-compat-stream.mjs +16 -3
- package/src/runtime/agent/orchestrator/providers/openai-compat-xai-send.mjs +1 -0
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events/output-items.mjs +5 -2
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state/response-events.mjs +13 -3
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-response-state.mjs +13 -2
- package/src/runtime/agent/orchestrator/providers/openai-http-sse-watchdogs.mjs +81 -42
- package/src/runtime/agent/orchestrator/providers/openai-oauth-http-sse.mjs +8 -0
- package/src/runtime/agent/orchestrator/providers/openai-oauth-login.mjs +160 -31
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream/event-switch.mjs +22 -12
- package/src/runtime/agent/orchestrator/providers/openai-ws-stream.mjs +7 -1
- package/src/runtime/agent/orchestrator/providers/openai-ws-watchdogs.mjs +49 -22
- package/src/runtime/agent/orchestrator/providers/opencode-go-oauth.mjs +1 -1
- package/src/runtime/agent/orchestrator/providers/opencode-go.mjs +3 -1
- package/src/runtime/agent/orchestrator/providers/registry.mjs +45 -2
- package/src/runtime/agent/orchestrator/providers/vertex-ai-auth.mjs +622 -0
- package/src/runtime/agent/orchestrator/providers/vertex-ai-maas.mjs +185 -0
- package/src/runtime/agent/orchestrator/providers/vertex-ai-models.mjs +445 -0
- package/src/runtime/agent/orchestrator/providers/vertex-ai.mjs +567 -0
- package/src/runtime/agent/orchestrator/runtime-core/ask-user-tool-defs.mjs +41 -13
- package/src/runtime/agent/orchestrator/runtime-core/builtin-features.mjs +2 -0
- package/src/runtime/agent/orchestrator/runtime-core/orchestration.mjs +8 -6
- package/src/runtime/agent/orchestrator/runtime-core/session-text.mjs +7 -3
- package/src/runtime/agent/orchestrator/runtime-core/tool-catalog-data.mjs +3 -0
- package/src/runtime/agent/orchestrator/runtime-core/tool-defs.mjs +6 -1
- package/src/runtime/agent/orchestrator/runtime-core/workflow/context.mjs +14 -5
- package/src/runtime/agent/orchestrator/runtime-core/workflow-ids.mjs +1 -0
- package/src/runtime/agent/orchestrator/runtime-core/workflow.mjs +5 -2
- package/src/runtime/agent/orchestrator/session/agent-room.d.mts +30 -5
- package/src/runtime/agent/orchestrator/session/agent-room.mjs +171 -37
- package/src/runtime/agent/orchestrator/session/cache/scoped-cache.mjs +1 -3
- package/src/runtime/agent/orchestrator/session/cache-warm.mjs +102 -12
- package/src/runtime/agent/orchestrator/session/catalog-db/schema.mjs +4 -1
- package/src/runtime/agent/orchestrator/session/compact/execution-tail.mjs +1 -8
- package/src/runtime/agent/orchestrator/session/compact/messages.mjs +23 -0
- package/src/runtime/agent/orchestrator/session/compact/observation-supersession.mjs +103 -23
- package/src/runtime/agent/orchestrator/session/compact/runner.mjs +160 -36
- package/src/runtime/agent/orchestrator/session/context-utils.mjs +13 -1
- package/src/runtime/agent/orchestrator/session/conversation-import/claude.mjs +164 -23
- package/src/runtime/agent/orchestrator/session/conversation-import/codex.mjs +139 -19
- package/src/runtime/agent/orchestrator/session/conversation-import/convert.mjs +38 -7
- package/src/runtime/agent/orchestrator/session/conversation-import/imported-session.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/conversation-import/turns.mjs +100 -22
- package/src/runtime/agent/orchestrator/session/eager-dispatch.mjs +4 -3
- package/src/runtime/agent/orchestrator/session/human-gate/requests.mjs +36 -6
- package/src/runtime/agent/orchestrator/session/loop/compact-policy.mjs +33 -3
- package/src/runtime/agent/orchestrator/session/loop/fresh-context.mjs +9 -2
- package/src/runtime/agent/orchestrator/session/loop/pre-dispatch-deny.mjs +1 -1
- package/src/runtime/agent/orchestrator/session/loop/provider-tool-exclusions.mjs +13 -5
- package/src/runtime/agent/orchestrator/session/loop/route-fallback.mjs +14 -0
- package/src/runtime/agent/orchestrator/session/loop/send-phase.mjs +13 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/before-hook.mjs +23 -4
- package/src/runtime/agent/orchestrator/session/loop/tool-exec/dispatch.mjs +2 -0
- package/src/runtime/agent/orchestrator/session/loop/tool-exec.mjs +23 -1
- package/src/runtime/agent/orchestrator/session/loop/tool-exposure-migration.mjs +39 -21
- package/src/runtime/agent/orchestrator/session/loop/turn-limits.mjs +13 -8
- package/src/runtime/agent/orchestrator/session/manager/ask-session.mjs +50 -28
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-loop-options.mjs +3 -3
- package/src/runtime/agent/orchestrator/session/manager/ask-turn-settle.mjs +3 -1
- package/src/runtime/agent/orchestrator/session/manager/owner-route-fallbacks.mjs +2 -2
- package/src/runtime/agent/orchestrator/session/manager/prompt-utils.mjs +1 -0
- package/src/runtime/agent/orchestrator/session/manager/route-fallback-chain.mjs +2 -1
- package/src/runtime/agent/orchestrator/session/manager/rules-cache.mjs +30 -13
- package/src/runtime/agent/orchestrator/session/manager/runtime-liveness.mjs +63 -6
- package/src/runtime/agent/orchestrator/session/manager/session-close.mjs +7 -0
- package/src/runtime/agent/orchestrator/session/manager/session-crud.mjs +15 -0
- package/src/runtime/agent/orchestrator/session/manager/session-lifecycle.mjs +35 -13
- package/src/runtime/agent/orchestrator/session/manager/session-prompt-composition.mjs +24 -14
- package/src/runtime/agent/orchestrator/session/manager/session-scratch-environment.mjs +70 -0
- package/src/runtime/agent/orchestrator/session/manager/session-tool-surface.mjs +0 -3
- package/src/runtime/agent/orchestrator/session/manager/tool-resolution.mjs +10 -6
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint-context.mjs +4 -0
- package/src/runtime/agent/orchestrator/session/manager/turn-checkpoint.mjs +3 -0
- package/src/runtime/agent/orchestrator/session/manager/turn-interruption.mjs +56 -29
- package/src/runtime/agent/orchestrator/session/manager/turn-reap.mjs +125 -0
- package/src/runtime/agent/orchestrator/session/mixy-name.mjs +11 -5
- package/src/runtime/agent/orchestrator/session/pre-send-compact.mjs +5 -1
- package/src/runtime/agent/orchestrator/session/prompt-cache-touch-store.mjs +30 -7
- package/src/runtime/agent/orchestrator/session/restart-prefix-parity.fixture.mjs +154 -0
- package/src/runtime/agent/orchestrator/session/store/session-delete.mjs +7 -0
- package/src/runtime/agent/orchestrator/session/store-summary-catalog.mjs +4 -0
- package/src/runtime/agent/orchestrator/session/store-summary-fields.mjs +15 -0
- package/src/runtime/agent/orchestrator/session/store-summary-index.mjs +37 -8
- package/src/runtime/agent/orchestrator/session/store-summary-reader.mjs +252 -39
- package/src/runtime/agent/orchestrator/session/store-transcript-cache.mjs +163 -64
- package/src/runtime/agent/orchestrator/session/store-transcript-projection.mjs +164 -4
- package/src/runtime/agent/orchestrator/session/store-transcript-worker.mjs +142 -18
- package/src/runtime/agent/orchestrator/session/transcript-restore/restore.mjs +61 -2
- package/src/runtime/agent/orchestrator/stall-policy.mjs +23 -0
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/completed-result.mjs +6 -2
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/invocation-plan.mjs +2 -2
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool/spawn-env.mjs +4 -2
- package/src/runtime/agent/orchestrator/tools/builtin/bash-tool.mjs +6 -1
- package/src/runtime/agent/orchestrator/tools/builtin/builtin-tools.mjs +46 -20
- package/src/runtime/agent/orchestrator/tools/builtin/cache-layers.mjs +7 -1
- package/src/runtime/agent/orchestrator/tools/builtin/git-command-tool.mjs +67 -31
- package/src/runtime/agent/orchestrator/tools/builtin/git-worktree-tool.mjs +25 -13
- package/src/runtime/agent/orchestrator/tools/builtin/lib/scoped-search-flight.mjs +9 -5
- package/src/runtime/agent/orchestrator/tools/builtin/lib/shell-job-records.mjs +58 -20
- package/src/runtime/agent/orchestrator/tools/builtin/read-single-stream.mjs +7 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-streaming.mjs +6 -3
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-dispatch.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-publication.mjs +23 -12
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool/batch-snapshot.mjs +6 -1
- package/src/runtime/agent/orchestrator/tools/builtin/read-tool.mjs +1 -8
- package/src/runtime/agent/orchestrator/tools/builtin/runtime-capabilities.mjs +20 -15
- package/src/runtime/agent/orchestrator/tools/builtin/shell-jobs.mjs +96 -20
- package/src/runtime/agent/orchestrator/tools/builtin/task-tool.mjs +59 -10
- package/src/runtime/agent/orchestrator/tools/code-graph/dispatch/federation.mjs +3 -1
- package/src/runtime/agent/orchestrator/tools/code-graph-tool-defs.mjs +1 -1
- package/src/runtime/agent/orchestrator/tools/graph-manifest.json +13 -13
- package/src/runtime/agent/orchestrator/tools/lib/isolated-test-env.mjs +4 -3
- package/src/runtime/agent/orchestrator/tools/lib/native-spawn-client.mjs +99 -2
- package/src/runtime/agent/orchestrator/tools/lib/owned-shell-trees.mjs +2 -0
- package/src/runtime/agent/orchestrator/tools/lib/shell-descendants.mjs +103 -13
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-background/promote-job.mjs +3 -1
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-settle.mjs +49 -15
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-spawn.mjs +45 -27
- package/src/runtime/agent/orchestrator/tools/lib/shell-run-state.mjs +34 -10
- package/src/runtime/agent/orchestrator/tools/lib/shell-warm-standby.mjs +28 -4
- package/src/runtime/agent/orchestrator/tools/lib/wait-until-fixture.mjs +26 -0
- package/src/runtime/agent/orchestrator/tools/shell-command.mjs +7 -2
- package/src/runtime/agent/orchestrator/tools/spawn-manifest.json +13 -13
- package/src/runtime/channels/lib/webhook/signature.mjs +4 -1
- package/src/runtime/channels/lib/whisper-port.mjs +29 -11
- package/src/runtime/channels/lib/whisper-server.mjs +10 -1
- package/src/runtime/computer-bridge/action-schema.mjs +2 -2
- package/src/runtime/computer-bridge/core-actions.mjs +2 -2
- package/src/runtime/computer-bridge/error-recovery.mjs +5 -4
- package/src/runtime/computer-bridge/linux-action-capabilities.mjs +24 -5
- package/src/runtime/computer-bridge/linux-readiness.d.mts +7 -2
- package/src/runtime/connectors/connector-accounts-mcp.mjs +236 -103
- package/src/runtime/connectors/gmail-app-password.mjs +3 -3
- package/src/runtime/explore/explorer.mjs +93 -0
- package/src/runtime/explore/tool-defs.mjs +35 -0
- package/src/runtime/explore/tool.mjs +123 -0
- package/src/runtime/local-provider/server-process.mjs +2 -1
- package/src/runtime/media/adapters/gemini-video.mjs +4 -1
- package/src/runtime/media/adapters/xai-media.mjs +2 -1
- package/src/runtime/memory/index.mjs +4 -0
- package/src/runtime/memory/lib/embedding-provider.mjs +4 -1
- package/src/runtime/memory/lib/embedding-worker.mjs +10 -3
- package/src/runtime/memory/lib/memory-action-handlers/cycle-backfill-action.mjs +1 -7
- package/src/runtime/memory/lib/memory-chunk-quality.mjs +1 -6
- package/src/runtime/office/authoring/pdf-author-action.mjs +1 -6
- package/src/runtime/office/design/design-art-direction.mjs +29 -27
- package/src/runtime/office/pdf/pdf-writer.mjs +6 -1
- package/src/runtime/office/portable/portable-snapshot-docx.mjs +7 -1
- package/src/runtime/office/portable/portable-snapshot-shared.mjs +6 -1
- package/src/runtime/office/quality/assurance-rendered.mjs +9 -2
- package/src/runtime/office/quality/assurance-structure-docx.mjs +4 -2
- package/src/runtime/office/quality/design-review.mjs +1 -5
- package/src/runtime/office/quality/document-brief.mjs +1 -5
- package/src/runtime/office/quality/forced-break-pages.mjs +9 -6
- package/src/runtime/office/quality/quality-pipeline.mjs +1 -1
- package/src/runtime/shared/agent-route-config.mjs +17 -2
- package/src/runtime/shared/atomic-file.mjs +103 -2
- package/src/runtime/shared/background-tasks.mjs +15 -6
- package/src/runtime/shared/bot-owned-work.mjs +56 -0
- package/src/runtime/shared/connector-accounts.mjs +5 -5
- package/src/runtime/shared/connector-catalog.d.mts +11 -4
- package/src/runtime/shared/connector-catalog.mjs +60 -52
- package/src/runtime/shared/custom-provider-keys.mjs +20 -0
- package/src/runtime/shared/defaults-separation.mjs +1 -4
- package/src/runtime/shared/fetch-safe-listen.d.mts +16 -0
- package/src/runtime/shared/fetch-safe-listen.mjs +50 -0
- package/src/runtime/shared/file-has-data.mjs +26 -2
- package/src/runtime/shared/file-lock.mjs +13 -15
- package/src/runtime/shared/git-launch.d.mts +9 -0
- package/src/runtime/shared/git-launch.mjs +213 -0
- package/src/runtime/shared/git-runner-worker.mjs +2 -1
- package/src/runtime/shared/handoff-artifacts.d.mts +2 -1
- package/src/runtime/shared/handoff-artifacts.mjs +18 -8
- package/src/runtime/shared/idle-auto-clear-gate.mjs +29 -7
- package/src/runtime/shared/llm/cost.mjs +11 -2
- package/src/runtime/shared/llm/http-agent.mjs +313 -29
- package/src/runtime/shared/llm/model-catalog-projection.mjs +3 -2
- package/src/runtime/shared/llm/model-catalog.mjs +46 -6
- package/src/runtime/shared/llm/provider-catalog-registry.mjs +3 -0
- package/src/runtime/shared/llm/system-proxy.mjs +452 -0
- package/src/runtime/shared/loopback-listener.mjs +25 -2
- package/src/runtime/shared/model-route-chain.d.mts +7 -2
- package/src/runtime/shared/model-route-chain.mjs +22 -4
- package/src/runtime/shared/open-url.mjs +10 -0
- package/src/runtime/shared/provider-accounts.mjs +52 -2
- package/src/runtime/shared/session-activity-signal.mjs +14 -0
- package/src/runtime/shared/session-scratch.mjs +37 -0
- package/src/runtime/shared/staged-install-worker.mjs +5 -0
- package/src/runtime/shared/staged-update.mjs +47 -2
- package/src/runtime/shared/tool-card-model/agent-surface.mjs +1 -3
- package/src/runtime/shared/tool-card-model/card-status.mjs +15 -2
- package/src/runtime/shared/tool-result-summary.mjs +1 -1
- package/src/runtime/shared/tool-surface.mjs +113 -36
- package/src/runtime/shared/tool-work-units.mjs +6 -0
- package/src/runtime/shared/turn-snapshot-store.mjs +13 -6
- package/src/runtime/shared/turn-worktree-snapshot.mjs +414 -54
- package/src/runtime/shared/worktrees/activity-gate.mjs +215 -318
- package/src/runtime/shared/worktrees/activity-ledger-worker.mjs +56 -0
- package/src/runtime/shared/worktrees/activity-ledger.mjs +391 -0
- package/src/runtime/shared/worktrees/branch-management.mjs +9 -3
- package/src/runtime/shared/worktrees/contract.mjs +4 -1
- package/src/runtime/shared/worktrees/git.mjs +72 -0
- package/src/runtime/shared/worktrees/manager.mjs +285 -168
- package/src/runtime/shared/worktrees/test-support.mjs +6 -10
- package/src/runtime/tidy/install.mjs +95 -15
- package/src/runtime/tidy/languages.mjs +17 -15
- package/src/runtime/tidy/process.mjs +7 -4
- package/src/runtime/tidy/resolve.mjs +19 -16
- package/src/runtime/tidy/runners/biome.mjs +3 -3
- package/src/runtime/tidy/tool.mjs +1 -1
- package/src/runtime/tidy/worktree.mjs +10 -6
- package/src/runtime/visualize-bridge/client.mjs +6 -1
- package/src/runtime/visualize-bridge/tool-defs.mjs +7 -2
- package/src/runtime/web-search/index.mjs +1 -1
- package/src/session-runtime/agent-home-delivery.mjs +41 -0
- package/src/session-runtime/agent-task-sessions.mjs +458 -312
- package/src/session-runtime/agent-tool-routing.mjs +8 -41
- package/src/session-runtime/boot/tools.mjs +7 -1
- package/src/session-runtime/bot-status.mjs +107 -101
- package/src/session-runtime/bot-target.mjs +38 -0
- package/src/session-runtime/channel-config-api.mjs +6 -1
- package/src/session-runtime/connector-merge-migration.mjs +18 -15
- package/src/session-runtime/conversation-import/codex-titles.mjs +88 -0
- package/src/session-runtime/conversation-import/discovery.mjs +401 -36
- package/src/session-runtime/conversation-import/service.mjs +35 -8
- package/src/session-runtime/handoff-attachments.mjs +82 -31
- package/src/session-runtime/held-requests.mjs +3 -1
- package/src/session-runtime/internal-tool-executor/ask-user-tool.mjs +12 -13
- package/src/session-runtime/internal-tool-executor/bridge-tools.mjs +1 -0
- package/src/session-runtime/internal-tool-executor/feature-tools.mjs +2 -0
- package/src/session-runtime/internal-tool-executor/knowledge-tools.mjs +8 -0
- package/src/session-runtime/internal-tool-executor/reaction-tool.mjs +4 -1
- package/src/session-runtime/internal-tool-executor/workspace-tools.mjs +145 -112
- package/src/session-runtime/lifecycle/cold-heir.mjs +11 -6
- package/src/session-runtime/lifecycle/session-catalog.mjs +9 -1
- package/src/session-runtime/lifecycle/teardown/session-close.mjs +6 -1
- package/src/session-runtime/lifecycle/teardown.mjs +1 -1
- package/src/session-runtime/mcp-glue/server-catalog.mjs +16 -10
- package/src/session-runtime/mcp-glue/server-input.mjs +4 -1
- package/src/session-runtime/mixy-heartbeat.mjs +1 -1
- package/src/session-runtime/model-route/set-route.mjs +11 -2
- package/src/session-runtime/provider-auth/login.mjs +2 -2
- package/src/session-runtime/provider-catalog-cache.mjs +82 -36
- package/src/session-runtime/provider-models/catalog-load.mjs +23 -6
- package/src/session-runtime/provider-models.mjs +4 -2
- package/src/session-runtime/resource-mcp-api.mjs +98 -35
- package/src/session-runtime/resource-mcp-connector-accounts.mjs +44 -31
- package/src/session-runtime/resource-mcp-secrets.mjs +28 -11
- package/src/session-runtime/resource-mcp-servers.mjs +5 -4
- package/src/session-runtime/resource-recall-api.mjs +6 -1
- package/src/session-runtime/runtime-feature-gates.mjs +5 -1
- package/src/session-runtime/services/agent-tool/execute.mjs +14 -9
- package/src/session-runtime/services/agent-tool/job-views/agent-list.mjs +20 -4
- package/src/session-runtime/services/agent-tool/model-select.mjs +48 -7
- package/src/session-runtime/services/agent-tool/render.mjs +71 -17
- package/src/session-runtime/services/agent-tool/send-flow.mjs +10 -2
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-prep.mjs +8 -3
- package/src/session-runtime/services/agent-tool/spawn-flow/spawn-run.mjs +4 -1
- package/src/session-runtime/services/agent-tool/spawn-preset.mjs +6 -2
- package/src/session-runtime/services/agent-tool/tool-def.mjs +9 -9
- package/src/session-runtime/services/agent-watchdog-registry.mjs +32 -4
- package/src/session-runtime/services/channel-worker/daemon-spawn.mjs +2 -0
- package/src/session-runtime/services/daemon-candidate.mjs +4 -1
- package/src/session-runtime/services/memory-runtime-proxy/daemon-spawn.mjs +4 -0
- package/src/session-runtime/services/plugin-admin.mjs +10 -6
- package/src/session-runtime/services/provider-admin.mjs +283 -11
- package/src/session-runtime/session-turn-api.mjs +2 -0
- package/src/session-runtime/settings-builtin-tools-api.mjs +4 -1
- package/src/session-runtime/settings-system-api.mjs +1 -1
- package/src/session-runtime/setup-tool/agent-settings-actions.mjs +13 -3
- package/src/session-runtime/setup-tool/connector-widen-approval.mjs +96 -0
- package/src/session-runtime/setup-tool/executor.mjs +6 -2
- package/src/session-runtime/setup-tool/tool-defs.mjs +2 -1
- package/src/session-runtime/tool-policy/policy-stage.mjs +1 -0
- package/src/session-runtime/turn/agent-ops.mjs +23 -0
- package/src/session-runtime/workflow-agents-api/agent-connectors.mjs +49 -11
- package/src/session-runtime/workflow-agents-api/agent-editor.mjs +5 -1
- package/src/session-runtime/workflow-agents-api/agent-route.mjs +25 -5
- package/src/session-runtime/workflow-agents-api/onboarding.mjs +3 -3
- package/src/session-runtime/workspace/activity-guards.mjs +176 -0
- package/src/session-runtime/workspace/session-view.mjs +149 -0
- package/src/session-runtime/workspace/side-checkouts.mjs +203 -0
- package/src/session-runtime/workspace/transition-runner.mjs +188 -0
- package/src/session-runtime/workspace/transitions.mjs +108 -1041
- package/src/session-runtime/workspace/workspace-merge.mjs +132 -0
- package/src/session-runtime/workspace/worktree-intents.mjs +242 -0
- package/src/session-runtime/workspace/worktree-maintenance.mjs +80 -0
- package/src/session-runtime/workspace/worktree-setup.mjs +85 -0
- package/src/session-runtime/workspace/worktree-tool.mjs +73 -56
- package/src/standalone/daemon-desktop-runtime.mjs +2 -0
- package/src/standalone/daemon-session-control.mjs +169 -138
- package/src/standalone/daemon.mjs +7 -0
- package/src/standalone/desktop-service-registry.mjs +9 -0
- package/src/standalone/local-session-runtime.mjs +5 -1
- package/src/standalone/session-client/daemon-unavailable.mjs +3 -0
- package/src/standalone/session-client.mjs +5 -1
- package/src/standalone/session-frame-stream.mjs +83 -11
- package/src/standalone/session-protocol.mjs +4 -0
- package/src/standalone/session-service/agent-tree/agent-turns.mjs +16 -12
- package/src/standalone/session-service/agent-tree.mjs +45 -9
- package/src/standalone/session-service/projection/transcript-window.mjs +700 -64
- package/src/standalone/session-service/session-calls/session-action.mjs +10 -3
- package/src/standalone/session-service/session-calls/session-views.mjs +160 -104
- package/src/standalone/session-service/stored-reader.mjs +127 -40
- package/src/standalone/session-transport/client-registry/client-grace.mjs +12 -9
- package/src/tui/App.jsx +154 -164
- package/src/tui/app/app-view/floating-panel.jsx +10 -4
- package/src/tui/app/app-view/text-entry-labels.mjs +1 -0
- package/src/tui/app/clipboard.mjs +21 -10
- package/src/tui/app/model-picker/route-selection/fast-parameters.mjs +1 -3
- package/src/tui/app/model-picker/route-selection.mjs +5 -6
- package/src/tui/app/prompt-handlers/use-prompt-history-nav.mjs +1 -1
- package/src/tui/app/prompt-handlers/use-prompt-interrupt.mjs +3 -0
- package/src/tui/app/prompt-submit/provider-prompts.mjs +3 -1
- package/src/tui/app/provider-setup/api-key-actions.mjs +31 -1
- package/src/tui/app/provider-setup/oauth-actions.mjs +58 -21
- package/src/tui/app/provider-setup/provider-items.mjs +8 -2
- package/src/tui/app/provider-setup-picker.mjs +29 -18
- package/src/tui/app/shell-layout/row-budgets.mjs +12 -10
- package/src/tui/app/slash-commands.mjs +1 -0
- package/src/tui/app/slash-dispatch/session-commands.mjs +46 -0
- package/src/tui/app/slash-dispatch.mjs +1 -1
- package/src/tui/app/use-btw-panel.mjs +29 -0
- package/src/tui/app/use-context-panel-refresh.mjs +31 -0
- package/src/tui/app/use-model-catalog-cache.mjs +13 -10
- package/src/tui/app/use-mouse-input.mjs +11 -0
- package/src/tui/app/use-onboarding-start.mjs +8 -3
- package/src/tui/app/use-panel-transition.mjs +10 -1
- package/src/tui/app/use-pasted-buffers.mjs +28 -20
- package/src/tui/app/use-prompt-draft-flow.mjs +7 -0
- package/src/tui/app/use-prompt-layout-rows.mjs +3 -3
- package/src/tui/app/use-prompt-queue-history.mjs +3 -2
- package/src/tui/app/use-selection-focus.mjs +11 -2
- package/src/tui/app/use-selection-geometry.mjs +18 -9
- package/src/tui/app/use-selection-paint.mjs +4 -4
- package/src/tui/app/use-selection-stitch.mjs +3 -3
- package/src/tui/app/use-slash-palette.mjs +62 -0
- package/src/tui/app/use-terminal-chrome.mjs +2 -2
- package/src/tui/app/use-transcript-activity.mjs +47 -32
- package/src/tui/app/use-transcript-follow.mjs +12 -4
- package/src/tui/app/use-transcript-scroll.mjs +46 -17
- package/src/tui/app/use-transcript-swap-reset.mjs +27 -0
- package/src/tui/app/use-transcript-window/geometry.mjs +19 -5
- package/src/tui/app/use-transcript-window/instance-state.mjs +4 -0
- package/src/tui/app/use-transcript-window/selection-shift.mjs +5 -1
- package/src/tui/app/use-transcript-window.mjs +21 -11
- package/src/tui/app/use-tui-ready.mjs +18 -0
- package/src/tui/app/use-welcome-prompt-hint.mjs +5 -0
- package/src/tui/app/use-workflow-tab-cycle.mjs +5 -3
- package/src/tui/components/Picker.jsx +27 -3
- package/src/tui/components/QuestionPanel.jsx +13 -4
- package/src/tui/components/SignInUrl.jsx +68 -0
- package/src/tui/components/TextEntryPanel.jsx +76 -46
- package/src/tui/components/sign-in-url-layout.mjs +24 -0
- package/src/tui/dist/index.mjs +1963 -1361
- package/src/tui/session/goal-turn-state.mjs +6 -2
- package/src/tui/session/session-api/controls.mjs +4 -0
- package/src/tui/session/session-api/extensions.mjs +8 -0
- package/src/tui/session/session-api/intake/abort.mjs +2 -1
- package/src/tui/session/session-api/intake.mjs +2 -0
- package/src/tui/session/session-api/integrations.mjs +2 -2
- package/src/tui/session/session-api/routes-agent-definitions.mjs +1 -0
- package/src/tui/session/session-api/settings.mjs +2 -2
- package/src/tui/session/session-flow/queue/take-entries.mjs +11 -0
- package/src/tui/session/transcript-spill/spill-writer.mjs +15 -0
- package/src/tui/session/transcript-spill.mjs +92 -4
- package/src/tui/session/transcript-store.mjs +2 -0
- package/src/ui/statusline-agents.mjs +1 -3
- package/src/defaults/skills/skill-creator/references/source-review.md +0 -94
|
@@ -3,18 +3,19 @@
|
|
|
3
3
|
- Check required behavior, exact outputs and essential integrity, security,
|
|
4
4
|
compatibility and buildability. Expected values come from sources or
|
|
5
5
|
independent invariants, never from the output itself or from recall.
|
|
6
|
-
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
- Match checks to the change: inspection for nonbehavioral edits, focused
|
|
7
|
+
tests for local behavior, broader lanes only for shared contracts. Run them
|
|
8
|
+
once after planned edits, heavy ones in sequence; never reread your writes.
|
|
9
|
+
- Read full logs; rerun only after a relevant fix, never masking a failure
|
|
10
|
+
with retries, timeout bumps or skips; reuse valid passes.
|
|
11
|
+
After two failed fixes, report and stop. Stop processes you started.
|
|
11
12
|
- Unexpected result: confirm the check sees the live artifact, not a cache or
|
|
12
13
|
stale copy, before blaming the system.
|
|
13
|
-
- Use supplied commands unchanged except inputs
|
|
14
|
-
|
|
15
|
-
to release.
|
|
14
|
+
- Use supplied commands unchanged except inputs; no stricter flags or
|
|
15
|
+
unrequested suites.
|
|
16
16
|
- Warnings or blocked checks never justify editing passing code. Fix obsolete
|
|
17
|
-
expectations, not valid requirements
|
|
17
|
+
expectations, not valid requirements. A bug fix gets one regression test;
|
|
18
|
+
tests assert behavior, never removals, constants or copied code.
|
|
18
19
|
- Missing dependencies block verification; use only evidenced recovery routes.
|
|
19
20
|
Report verified results and blockers.
|
|
20
21
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
# Delivery
|
|
2
2
|
|
|
3
3
|
- Unless the user explicitly requests them, do not author separate record-keeping
|
|
4
|
-
artifacts (reports, progress logs, notes, or checklists).
|
|
5
|
-
|
|
4
|
+
artifacts (reports, progress logs, notes, or checklists).
|
|
5
|
+
<!-- tools: lead -->
|
|
6
|
+
Report progress and results in the conversation instead.
|
|
6
7
|
- Reference files and folders in inline code by a Project-root-relative or
|
|
7
8
|
absolute path, optionally `:line[:column]` (`deliverables/report.docx`,
|
|
8
9
|
`src/app.ts:42`); files outside the Project always by absolute path; never a
|
|
@@ -11,14 +12,12 @@
|
|
|
11
12
|
and give their path; never open them in the system browser or paste their
|
|
12
13
|
source unless the user asks.
|
|
13
14
|
<!-- tools: visualize -->
|
|
14
|
-
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
- Show every finished visual artifact with `visualize open`, loading its schema
|
|
16
|
+
first if deferred: images, video, HTML, documents, decks, mockups, diagrams.
|
|
17
|
+
A summary, plan or report of your own work stays in the chat, never a
|
|
18
|
+
visualize page. `open` shows the user a deliverable; to check your own
|
|
19
|
+
work (`check`, `inspect`, `capture`, `export`), open with `verify: true`.
|
|
18
20
|
|
|
19
21
|
<!-- tools: git -->
|
|
20
22
|
- A commit request includes selecting and staging its changes; a stage-only
|
|
21
23
|
request stops before commit. Do not stage changes without either request.
|
|
22
|
-
<!-- tools: git -->
|
|
23
|
-
- Stage selected diff changes with `git` using `action:"stage"`. Keep this
|
|
24
|
-
internal step within the requested commit workflow, not a separate approval.
|
|
@@ -3,13 +3,17 @@
|
|
|
3
3
|
// cancellation sources, so collapse them before installing that one link.
|
|
4
4
|
// The first already-aborted source wins (in declaration order), retaining its
|
|
5
5
|
// original reason instead of replacing it with a generic AbortError.
|
|
6
|
-
|
|
6
|
+
// `onWinner(signal)` runs once, with the source that won, before the composite
|
|
7
|
+
// aborts: the owner of a timeout source arms its own bookkeeping there, and a
|
|
8
|
+
// source that fires after another already won is never reported.
|
|
9
|
+
export function composeAgentDispatchAbortSignal(signals, onWinner = null) {
|
|
7
10
|
const sources = (Array.isArray(signals) ? signals : []).filter((signal) => signal instanceof AbortSignal);
|
|
8
11
|
if (sources.length === 0) return { signal: null, dispose: () => {} };
|
|
9
12
|
const controller = new AbortController();
|
|
10
13
|
const listeners = [];
|
|
11
14
|
const abortFrom = (signal) => {
|
|
12
15
|
if (controller.signal.aborted) return;
|
|
16
|
+
onWinner?.(signal);
|
|
13
17
|
try {
|
|
14
18
|
controller.abort(signal.reason);
|
|
15
19
|
} catch {
|
|
@@ -34,6 +34,7 @@ import {
|
|
|
34
34
|
getSession,
|
|
35
35
|
linkParentSignalToSession,
|
|
36
36
|
} from '../session/manager.mjs';
|
|
37
|
+
import { armTurnTimeout } from '../session/manager/turn-reap.mjs';
|
|
37
38
|
import { resolveAgentWatchdogPolicy } from './agent-progress-watchdog.mjs';
|
|
38
39
|
import { resourceAdmission } from '../../../shared/resource-admission.mjs';
|
|
39
40
|
import { composeAgentDispatchAbortSignal } from './agent-dispatch/abort-link.mjs';
|
|
@@ -160,7 +161,15 @@ async function dispatchAdmitted(agent, opts, callArgs, { prepare, ask, updateSta
|
|
|
160
161
|
// each link replaces the previous listener in runtime-liveness. One
|
|
161
162
|
// composite survives askSession's controller swap and makes every source
|
|
162
163
|
// reach the provider call.
|
|
163
|
-
|
|
164
|
+
// The watchdog arms this session's own timeout reap only when it is the
|
|
165
|
+
// source that stops the turn; an inherited parent abort that won first is a
|
|
166
|
+
// cancel for this child and never arms it.
|
|
167
|
+
const abortLink = composeAgentDispatchAbortSignal(
|
|
168
|
+
[opts.parentSignal, callParentSignal, watchdog.signal],
|
|
169
|
+
(source) => {
|
|
170
|
+
if (source === watchdog.signal) armTurnTimeout(session.id);
|
|
171
|
+
}
|
|
172
|
+
);
|
|
164
173
|
if (abortLink.signal) {
|
|
165
174
|
try {
|
|
166
175
|
linkParentSignalToSession(session.id, abortLink.signal);
|
|
@@ -8,8 +8,9 @@
|
|
|
8
8
|
* and never while the turn waits on the user's approval (`awaitingUser`).
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { appendAgentTrace } from '../agent-trace-io.mjs';
|
|
11
|
+
import { appendAgentTrace, normalizeSessionId, _appendToolFailureRow } from '../agent-trace-io.mjs';
|
|
12
12
|
import { getHiddenAgent } from '../internal-agents.mjs';
|
|
13
|
+
import { PACKAGE_VERSION } from '../../../web-search/lib/package-version.mjs';
|
|
13
14
|
import { envNonNegativeInt, envPresent } from '../../../shared/env.mjs';
|
|
14
15
|
import {
|
|
15
16
|
PROVIDER_FIRST_BYTE_TIMEOUT_MS,
|
|
@@ -126,22 +127,113 @@ export function partialHandoffTextFromSession(session, messageStartIndex = 0) {
|
|
|
126
127
|
/** Owner-facing handoff for a watchdog-stopped agent: the stop and its reason
|
|
127
128
|
* come first, so the owner never mistakes the partial text for a finished
|
|
128
129
|
* result or a user cancel. */
|
|
129
|
-
export function watchdogStoppedHandoff(error, partial) {
|
|
130
|
-
|
|
130
|
+
export function watchdogStoppedHandoff(error, partial, shellJobs) {
|
|
131
|
+
const note = stoppedShellJobsNote(shellJobs);
|
|
132
|
+
return `[Agent stopped by the progress watchdog: ${error.message}. The output below is partial.]${note ? `\n${note}` : ''}\n\n${partial}`;
|
|
131
133
|
}
|
|
132
134
|
|
|
133
|
-
|
|
135
|
+
// Jobs confirmed gone are "stopped"; the others were killed but their
|
|
136
|
+
// processes are not yet confirmed gone, so they are "still stopping".
|
|
137
|
+
function stoppedShellJobsNote({ stopped = [], stopping = [] } = {}) {
|
|
138
|
+
return [
|
|
139
|
+
stopped.length > 0 && `[Stopped its background shell jobs: ${stopped.join(', ')}.]`,
|
|
140
|
+
stopping.length > 0 && `[Still stopping its background shell jobs: ${stopping.join(', ')}.]`,
|
|
141
|
+
]
|
|
142
|
+
.filter(Boolean)
|
|
143
|
+
.join(' ');
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/** A stall with no partial output is rethrown as the error: name the stopped
|
|
147
|
+
* jobs in its text so the caller still learns them. */
|
|
148
|
+
export function noteStoppedShellJobsOnError(error, shellJobs) {
|
|
149
|
+
const note = stoppedShellJobsNote(shellJobs);
|
|
150
|
+
if (note && error && typeof error === 'object') error.message = `${error.message} ${note}`;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// The timestamp the stop was measured from, and which clock it is.
|
|
154
|
+
function resolveWatchdogAbortClock({ snapshot, policy, anchorTs, lastProgressAt }) {
|
|
134
155
|
if (snapshot && policy) {
|
|
135
156
|
if (snapshot.waitingForFirstSemantic) {
|
|
136
|
-
|
|
137
|
-
if (
|
|
157
|
+
if (snapshot.modelRequestStartedAt) return { at: snapshot.modelRequestStartedAt, field: 'model_request_started_at' };
|
|
158
|
+
if (snapshot.askStartedAt) return { at: snapshot.askStartedAt, field: 'ask_started_at' };
|
|
138
159
|
}
|
|
139
|
-
|
|
140
|
-
if (
|
|
160
|
+
if (snapshot.lastProgressAt) return { at: snapshot.lastProgressAt, field: 'last_progress_at' };
|
|
161
|
+
if (snapshot.firstActivityAt) return { at: snapshot.firstActivityAt, field: 'first_activity_at' };
|
|
141
162
|
}
|
|
142
|
-
|
|
143
|
-
if (
|
|
144
|
-
return null;
|
|
163
|
+
if (lastProgressAt) return { at: lastProgressAt, field: 'reported_progress_at' };
|
|
164
|
+
if (anchorTs) return { at: anchorTs, field: 'anchor_ts' };
|
|
165
|
+
return { at: null, field: null };
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
// Which deadline fired, read from the abort message. `idle_bare` is the form
|
|
169
|
+
// the registry/dispatch fallback throws when no progress snapshot existed.
|
|
170
|
+
function watchdogAbortKind(message) {
|
|
171
|
+
const limit = Number(/\((\d+)ms/.exec(message)?.[1]) || null;
|
|
172
|
+
if (/^agent first transport stale/.test(message)) return { window: 'first_response', form: 'first_transport', limit };
|
|
173
|
+
if (/^agent first semantic response stale/.test(message)) return { window: 'first_output', form: 'first_semantic', limit };
|
|
174
|
+
if (/^agent task stale \(\d+ms without stream\/tool progress\)/.test(message)) {
|
|
175
|
+
return { window: 'idle', form: 'idle_progress', limit };
|
|
176
|
+
}
|
|
177
|
+
if (/^agent task stale/.test(message)) return { window: 'idle', form: 'idle_bare', limit };
|
|
178
|
+
if (/^agent progress checks failed/.test(message)) return { window: 'idle', form: 'checks_failed', limit: null };
|
|
179
|
+
return { window: null, form: 'other', limit: null };
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// Shipped builds keep no agent trace, so a stop could not be audited after the
|
|
183
|
+
// fact (was the agent really silent?). The tool-failure log stays on in ship
|
|
184
|
+
// mode; the row holds clocks and names only, never prompt or output text.
|
|
185
|
+
// `observation` says how the snapshot was obtained: a wire-safe runtime is
|
|
186
|
+
// sampled asynchronously and the watchdog may judge a cached read, so
|
|
187
|
+
// `snapshot_present` alone does not prove the clocks are current. Only an error
|
|
188
|
+
// name/code is kept from a failed read, never its message.
|
|
189
|
+
function recordAgentWatchdogAbortRow({
|
|
190
|
+
sessionId,
|
|
191
|
+
agent,
|
|
192
|
+
error,
|
|
193
|
+
snapshot,
|
|
194
|
+
policy,
|
|
195
|
+
clock,
|
|
196
|
+
elapsed,
|
|
197
|
+
anchorTs,
|
|
198
|
+
lastProgressAt,
|
|
199
|
+
iteration,
|
|
200
|
+
observation,
|
|
201
|
+
registrationId,
|
|
202
|
+
}) {
|
|
203
|
+
if (process.env.MIXDOG_AGENT_TRACE_DISABLE === '1') return;
|
|
204
|
+
const message = typeof error.message === 'string' ? error.message : '';
|
|
205
|
+
const { window, form, limit } = watchdogAbortKind(message);
|
|
206
|
+
_appendToolFailureRow({
|
|
207
|
+
ts: Date.now(),
|
|
208
|
+
kind: 'stall_abort',
|
|
209
|
+
category: 'agent-stall',
|
|
210
|
+
build_version: PACKAGE_VERSION,
|
|
211
|
+
registration_id: registrationId || null,
|
|
212
|
+
session_id: normalizeSessionId(sessionId),
|
|
213
|
+
iteration: iteration ?? null,
|
|
214
|
+
agent: agent || null,
|
|
215
|
+
stage: snapshot?.stage ?? null,
|
|
216
|
+
window,
|
|
217
|
+
limit_ms: limit ?? policy?.idleStaleMs ?? null,
|
|
218
|
+
form,
|
|
219
|
+
compared_field: clock.field,
|
|
220
|
+
compared_at: clock.at,
|
|
221
|
+
elapsed_ms: elapsed,
|
|
222
|
+
snapshot_present: Boolean(snapshot),
|
|
223
|
+
snapshot_source: snapshot ? observation?.source || 'direct' : null,
|
|
224
|
+
last_read_ok_at: observation?.lastReadOkAt || null,
|
|
225
|
+
read_pending_since: observation?.readPendingSince || null,
|
|
226
|
+
last_read_error: observation?.lastReadError || null,
|
|
227
|
+
ask_started_at: snapshot?.askStartedAt || null,
|
|
228
|
+
model_request_started_at: snapshot?.modelRequestStartedAt || null,
|
|
229
|
+
waiting_for_transport: snapshot ? Boolean(snapshot.waitingForTransport) : null,
|
|
230
|
+
waiting_for_first_semantic: snapshot ? Boolean(snapshot.waitingForFirstSemantic) : null,
|
|
231
|
+
awaiting_user: snapshot?.awaitingUser || null,
|
|
232
|
+
last_progress_at: snapshot?.lastProgressAt || lastProgressAt || null,
|
|
233
|
+
last_keepalive_at: snapshot?.lastKeepaliveAt || null,
|
|
234
|
+
anchor_ts: anchorTs || null,
|
|
235
|
+
current_tool: snapshot?.currentTool || null,
|
|
236
|
+
});
|
|
145
237
|
}
|
|
146
238
|
|
|
147
239
|
function recordAgentWatchdogAbort({
|
|
@@ -154,15 +246,14 @@ function recordAgentWatchdogAbort({
|
|
|
154
246
|
anchorTs = 0,
|
|
155
247
|
lastProgressAt = 0,
|
|
156
248
|
iteration = null,
|
|
249
|
+
observation = null,
|
|
250
|
+
registrationId = null,
|
|
251
|
+
comparedClock = null,
|
|
157
252
|
}) {
|
|
158
253
|
if (!sessionId || !error) return;
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
now,
|
|
163
|
-
anchorTs,
|
|
164
|
-
lastProgressAt,
|
|
165
|
-
});
|
|
254
|
+
// A caller that decided on its own clock (the failed-checks stop) names it.
|
|
255
|
+
const clock = comparedClock || resolveWatchdogAbortClock({ snapshot, policy, anchorTs, lastProgressAt });
|
|
256
|
+
const elapsed = clock.at ? Math.max(0, now - clock.at) : null;
|
|
166
257
|
try {
|
|
167
258
|
appendAgentTrace({
|
|
168
259
|
sessionId,
|
|
@@ -178,6 +269,24 @@ function recordAgentWatchdogAbort({
|
|
|
178
269
|
} catch {
|
|
179
270
|
/* best-effort */
|
|
180
271
|
}
|
|
272
|
+
try {
|
|
273
|
+
recordAgentWatchdogAbortRow({
|
|
274
|
+
sessionId,
|
|
275
|
+
agent,
|
|
276
|
+
error,
|
|
277
|
+
snapshot,
|
|
278
|
+
policy,
|
|
279
|
+
clock,
|
|
280
|
+
elapsed,
|
|
281
|
+
anchorTs,
|
|
282
|
+
lastProgressAt,
|
|
283
|
+
iteration,
|
|
284
|
+
observation,
|
|
285
|
+
registrationId,
|
|
286
|
+
});
|
|
287
|
+
} catch {
|
|
288
|
+
/* best-effort */
|
|
289
|
+
}
|
|
181
290
|
}
|
|
182
291
|
|
|
183
292
|
export function abortAgentProgressWatchdog(controller, ctx) {
|
|
@@ -243,11 +352,13 @@ export function resolveAgentWatchdogPolicy(agent, overrides = {}) {
|
|
|
243
352
|
// Role budget, floored so the provider recovery window always wins.
|
|
244
353
|
idleStaleMs = Math.max(abort * 1000, PROVIDER_RECOVERY_FLOOR_MS);
|
|
245
354
|
} else {
|
|
246
|
-
// Part B: the
|
|
247
|
-
//
|
|
248
|
-
//
|
|
249
|
-
// the
|
|
250
|
-
// provider layer would
|
|
355
|
+
// Part B: the provider-level idle abort is the first mid-stream catch, but
|
|
356
|
+
// it is transport-based for Anthropic (pings reset it; other providers
|
|
357
|
+
// judge semantic idle). This public-agent idle is a BACKSTOP only, so it
|
|
358
|
+
// must not exceed the stall abort (600s default): a ping-only wedge that
|
|
359
|
+
// slipped past the provider layer would otherwise hang the owner for half
|
|
360
|
+
// an hour. Anthropic pings extend it only up to
|
|
361
|
+
// KEEPALIVE_MAX_IDLE_MULTIPLIER times (evaluateAgentWatchdogAbort). Cap it at
|
|
251
362
|
// the stall abort while keeping 30 min as an absolute ceiling. Long tool
|
|
252
363
|
// calls refresh progress through the activity heartbeat, so they never
|
|
253
364
|
// trip this backstop.
|
|
@@ -270,6 +381,23 @@ export function resolveAgentWatchdogPolicy(agent, overrides = {}) {
|
|
|
270
381
|
};
|
|
271
382
|
}
|
|
272
383
|
|
|
384
|
+
// How far keepalives may extend liveness past the last real progress, as a
|
|
385
|
+
// multiple of the idle budget. Anthropic pings across legitimate generation
|
|
386
|
+
// gaps (adaptive thinking, a buffered tool input), but a wedged stream that
|
|
387
|
+
// pings forever must still die.
|
|
388
|
+
export const KEEPALIVE_MAX_IDLE_MULTIPLIER = 3;
|
|
389
|
+
|
|
390
|
+
// A keepalive newer than the last real progress holds the idle abort while it
|
|
391
|
+
// is itself fresh and the silence is within the cap. The runtime records one
|
|
392
|
+
// only after the request's first semantic event, so a ping before it never
|
|
393
|
+
// reaches here (the first-output window owns that phase).
|
|
394
|
+
function keepaliveHoldsIdle(snapshot, last, now, idleStaleMs) {
|
|
395
|
+
const keepaliveAt = snapshot.lastKeepaliveAt || 0;
|
|
396
|
+
return (
|
|
397
|
+
keepaliveAt > last && now - keepaliveAt <= idleStaleMs && now - last <= idleStaleMs * KEEPALIVE_MAX_IDLE_MULTIPLIER
|
|
398
|
+
);
|
|
399
|
+
}
|
|
400
|
+
|
|
273
401
|
export function evaluateAgentWatchdogAbort(snapshot, now, policy) {
|
|
274
402
|
if (!snapshot || !policy) return null;
|
|
275
403
|
// A turn blocked on the user's tool approval (its own, or a sub-agent's that
|
|
@@ -285,7 +413,10 @@ export function evaluateAgentWatchdogAbort(snapshot, now, policy) {
|
|
|
285
413
|
const firstSemanticMs = policy.firstSemanticMs ?? policy.firstVisibleCeilingMs ?? 0;
|
|
286
414
|
// Independent fixed deadlines from request start. Transport can satisfy
|
|
287
415
|
// only the transport deadline; it never switches, extends, or resets the
|
|
288
|
-
// semantic-response deadline.
|
|
416
|
+
// semantic-response deadline. Both are judged per logical model request
|
|
417
|
+
// (runtime-liveness): the request that carries tool results gets the same
|
|
418
|
+
// first-output allowance as the turn's first request, while a retry of a
|
|
419
|
+
// request keeps that request's clock and marks.
|
|
289
420
|
if (snapshot.waitingForTransport && firstTransportMs > 0 && startedAt && now - startedAt > firstTransportMs) {
|
|
290
421
|
return new AgentStallAbortError(`agent first transport stale (${firstTransportMs}ms)`);
|
|
291
422
|
}
|
|
@@ -298,6 +429,7 @@ export function evaluateAgentWatchdogAbort(snapshot, now, policy) {
|
|
|
298
429
|
|
|
299
430
|
const last = snapshot.lastProgressAt || snapshot.firstActivityAt;
|
|
300
431
|
if (policy.idleStaleMs > 0 && last && now - last > policy.idleStaleMs) {
|
|
432
|
+
if (keepaliveHoldsIdle(snapshot, last, now, policy.idleStaleMs)) return null;
|
|
301
433
|
return new AgentStallAbortError(`agent task stale (${policy.idleStaleMs}ms without stream/tool progress)`);
|
|
302
434
|
}
|
|
303
435
|
|
|
@@ -563,6 +563,19 @@ function oneShotPromptCacheOpts(agent) {
|
|
|
563
563
|
return isOneShotMaintenanceAgent(agent) ? { promptCacheScope: 'shared' } : null;
|
|
564
564
|
}
|
|
565
565
|
|
|
566
|
+
/**
|
|
567
|
+
* Cache send options for a session-less loop whose system prompt and tool
|
|
568
|
+
* schemas are the same bytes on every call (the explore tool's explorers):
|
|
569
|
+
* keyed on that prefix, never per call, on the default 5m tier. The parallel
|
|
570
|
+
* explorers of a fan-out and the next calls minutes later are its only
|
|
571
|
+
* readers, so the Lead's 1h / 12h tiers would only raise the write price.
|
|
572
|
+
*/
|
|
573
|
+
export function sharedPrefixProviderCacheOpts(provider) {
|
|
574
|
+
const shared = { promptCacheScope: 'shared' };
|
|
575
|
+
if (cacheCapabilityForProvider(provider) !== 'explicit-breakpoint') return shared;
|
|
576
|
+
return { ...shared, cacheStrategy: { tools: 'none', system: '5m', tier3: 'none', messages: '5m' } };
|
|
577
|
+
}
|
|
578
|
+
|
|
566
579
|
/**
|
|
567
580
|
* Cache send options for a role's requests on `provider`: the breakpoint
|
|
568
581
|
* strategy on explicit-breakpoint providers, the Lead-class 12h prefix TTL on
|
|
@@ -3,6 +3,9 @@ import { normalizeContextTokens } from '../../../shared/llm/default-context-wind
|
|
|
3
3
|
import { loadConfig } from '../config.mjs';
|
|
4
4
|
import { getHiddenAgent } from '../internal-agents.mjs';
|
|
5
5
|
|
|
6
|
+
// The settings agent whose route a hidden role runs on.
|
|
7
|
+
const ROLE_BY_MAINT_KEY = Object.freeze({ memory: 'maintainer', explore: 'explore' });
|
|
8
|
+
|
|
6
9
|
function normalizeMaintenanceCandidate(candidate) {
|
|
7
10
|
if (!candidate || typeof candidate !== 'object' || Array.isArray(candidate)) return candidate || null;
|
|
8
11
|
const provider = String(candidate.provider || '').trim();
|
|
@@ -38,7 +41,7 @@ export function resolveMaintenanceRoute({ preset, optsPreset, agent, config: cfg
|
|
|
38
41
|
try {
|
|
39
42
|
const config = cfgIn || loadConfig({ secrets: false });
|
|
40
43
|
const key = hidden.maintKey || hidden.slot;
|
|
41
|
-
const role = key
|
|
44
|
+
const role = ROLE_BY_MAINT_KEY[key] || '';
|
|
42
45
|
if (!role) return config?.maintenance?.[key] ?? null;
|
|
43
46
|
// A disabled agent must not silently fall back to the Main model:
|
|
44
47
|
// "off" means the maintenance role does not run at all.
|
|
@@ -53,6 +53,7 @@ export function buildCacheBreakPayload(record = {}) {
|
|
|
53
53
|
input_prefix_mismatch_actual_hash: cleanHash(record.inputPrefixMismatchActualHash),
|
|
54
54
|
changed_blocks: cleanText(record.changedBlocks),
|
|
55
55
|
system_markers_changed: typeof record.markersChanged === 'boolean' ? record.markersChanged : null,
|
|
56
|
+
lost_message_breakpoints: cleanText(record.lostMessageBreakpoints),
|
|
56
57
|
};
|
|
57
58
|
return Object.fromEntries(Object.entries(payload).filter(([, value]) => value !== null));
|
|
58
59
|
}
|
|
@@ -81,6 +82,7 @@ function formatCacheBreakLine(record = {}) {
|
|
|
81
82
|
['noGuardBaseline', payload.missing_prefix_guard_baseline],
|
|
82
83
|
['changedBlocks', payload.changed_blocks],
|
|
83
84
|
['systemMarkersChanged', payload.system_markers_changed],
|
|
85
|
+
['lostMessageBreakpoints', payload.lost_message_breakpoints],
|
|
84
86
|
].filter(([, value]) => value !== null && value !== undefined);
|
|
85
87
|
return `[cache-break] ${fields.map(([key, value]) => (typeof value === 'string' ? `${key}=${JSON.stringify(value)}` : `${key}=${value}`)).join(' ')}`;
|
|
86
88
|
}
|
|
@@ -78,6 +78,10 @@ export function buildDefaultConfig(options = {}) {
|
|
|
78
78
|
apiKey: apiKey || undefined,
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
|
+
// authMode: 'service-account' (the stored key), 'adc' (the gcloud login or a
|
|
82
|
+
// metadata server, nothing stored) or 'api-key' (an express-mode key). No
|
|
83
|
+
// location: unset follows the environment's region, then global.
|
|
84
|
+
providers['vertex-ai'] = { enabled: false, authMode: 'service-account' };
|
|
81
85
|
// OAuth provider detection uses lightweight credential probes so config
|
|
82
86
|
// load does not import provider runtimes or SDKs.
|
|
83
87
|
//
|
|
@@ -299,13 +303,13 @@ export function loadConfig(options = {}) {
|
|
|
299
303
|
recap: recapConfig,
|
|
300
304
|
// The model may title the session (session tool, action=rename); default on.
|
|
301
305
|
aiSessionTitles: raw.aiSessionTitles !== false,
|
|
302
|
-
// Mixy's heartbeat check (session-runtime/mixy-heartbeat.mjs); default
|
|
303
|
-
heartbeat: raw.heartbeat
|
|
306
|
+
// Mixy's heartbeat check (session-runtime/mixy-heartbeat.mjs); default off.
|
|
307
|
+
heartbeat: raw.heartbeat === true,
|
|
304
308
|
// Minutes between its checks, one of a fixed set (shared/heartbeat-interval.mjs);
|
|
305
309
|
// anything else reads as the default.
|
|
306
310
|
heartbeatIntervalMinutes: normalizeHeartbeatIntervalMinutes(raw.heartbeatIntervalMinutes),
|
|
307
|
-
// Prompt-cache warming (session/cache-warm.mjs); default
|
|
308
|
-
promptCacheWarming: raw?.promptCacheWarming
|
|
311
|
+
// Prompt-cache warming (session/cache-warm.mjs); default off.
|
|
312
|
+
promptCacheWarming: raw?.promptCacheWarming === true,
|
|
309
313
|
// Bots may leave an emoji reaction on the user's message (react tool); default on.
|
|
310
314
|
reactions: raw.reactions !== false,
|
|
311
315
|
// Bots page layout (order, hidden groups, pins, retention) and the shared
|
|
@@ -360,7 +364,7 @@ export function loadConfig(options = {}) {
|
|
|
360
364
|
shell: {},
|
|
361
365
|
update: {},
|
|
362
366
|
recap: { enabled: true },
|
|
363
|
-
promptCacheWarming:
|
|
367
|
+
promptCacheWarming: false,
|
|
364
368
|
worktree: normalizeWorktreeSettings(null),
|
|
365
369
|
developer: {},
|
|
366
370
|
modules: {},
|
|
@@ -490,7 +494,8 @@ function buildAgentSaveBuilder(config) {
|
|
|
490
494
|
// Default true lives in code: only the opt-out is stored.
|
|
491
495
|
if (config.aiSessionTitles === false) next.aiSessionTitles = false;
|
|
492
496
|
else delete next.aiSessionTitles;
|
|
493
|
-
|
|
497
|
+
// Default off lives in code: only the opt-in is stored.
|
|
498
|
+
if (config.heartbeat === true) next.heartbeat = true;
|
|
494
499
|
else delete next.heartbeat;
|
|
495
500
|
// Only a non-default choice is stored.
|
|
496
501
|
const heartbeatMinutes = normalizeHeartbeatIntervalMinutes(config.heartbeatIntervalMinutes);
|
|
@@ -498,7 +503,7 @@ function buildAgentSaveBuilder(config) {
|
|
|
498
503
|
else delete next.heartbeatIntervalMinutes;
|
|
499
504
|
if (config.reactions === false) next.reactions = false;
|
|
500
505
|
else delete next.reactions;
|
|
501
|
-
if (config.promptCacheWarming ===
|
|
506
|
+
if (config.promptCacheWarming === true) next.promptCacheWarming = true;
|
|
502
507
|
else delete next.promptCacheWarming;
|
|
503
508
|
if (Array.isArray(config.botOrder) && config.botOrder.length) next.botOrder = [...config.botOrder];
|
|
504
509
|
else delete next.botOrder;
|
|
@@ -100,7 +100,7 @@ export function buildDeferredToolManifest(entries) {
|
|
|
100
100
|
list.sort((a, b) => a.name.localeCompare(b.name));
|
|
101
101
|
return [
|
|
102
102
|
'<available-deferred-tools>',
|
|
103
|
-
'Deferred
|
|
103
|
+
'Deferred tools; load_tool loads their schemas.',
|
|
104
104
|
...list.map((entry) => (entry.description ? `- ${entry.name}: ${entry.description}` : `- ${entry.name}`)),
|
|
105
105
|
'</available-deferred-tools>',
|
|
106
106
|
].join('\n');
|
|
@@ -156,8 +156,8 @@ const firstSentence = (text) => {
|
|
|
156
156
|
};
|
|
157
157
|
|
|
158
158
|
// A catalog connector's curated when-to-use trigger; else the first sentence
|
|
159
|
-
// of the server's MCP instructions; else
|
|
160
|
-
// order); else its name. Never the account: that is part of the instruction
|
|
159
|
+
// of the server's MCP instructions; else the leading description of its first
|
|
160
|
+
// described tool (name order); else its name. Never the account: that is part of the instruction
|
|
161
161
|
// text delivered when the server's tools are loaded. Derived lines are
|
|
162
162
|
// compacted to at most 98 characters, ellipsis included.
|
|
163
163
|
function mcpServerTrigger(server, tools, instructions) {
|
|
@@ -168,11 +168,11 @@ function mcpServerTrigger(server, tools, instructions) {
|
|
|
168
168
|
const instruction = String(instructions?.[server] || '')
|
|
169
169
|
.replace(/[<>]/g, '')
|
|
170
170
|
.replace(/^\s*Account: \S+?\.\s+/, '');
|
|
171
|
-
const described =
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
171
|
+
const described =
|
|
172
|
+
[...tools]
|
|
173
|
+
.sort((a, b) => String(a?.name || '').localeCompare(String(b?.name || '')))
|
|
174
|
+
.map((tool) => firstSentence(String(tool?.description || '').replace(/[<>]/g, '')))
|
|
175
|
+
.find(Boolean) || '';
|
|
176
176
|
const derived = firstSentence(instruction) || described;
|
|
177
177
|
return derived ? compactPromptManifestText(derived, 98) : `${titleCaseMcpServer(server)} MCP server tools.`;
|
|
178
178
|
}
|
|
@@ -7,7 +7,7 @@ import { compareCodePoints } from '../../../shared/code-point-order.mjs';
|
|
|
7
7
|
import { BOTS_DIR, MIXY_BOT_ID, botStoreActive, isStoreBot, mixyIdentityDir } from '../../../shared/agent-store.mjs';
|
|
8
8
|
import { mixdogRoot } from '../../../shared/plugin-paths.mjs';
|
|
9
9
|
import { readMarkdownDocument } from '../../../shared/markdown-frontmatter.mjs';
|
|
10
|
-
import { listHiddenAgentsByKind
|
|
10
|
+
import { listHiddenAgentsByKind } from '../internal-agents.mjs';
|
|
11
11
|
import { mixdogGlobalDir, mtimeWithTtl, readSafe } from './skill-catalog.mjs';
|
|
12
12
|
import { mixyDisplayName } from '../session/mixy-name.mjs';
|
|
13
13
|
|
|
@@ -15,14 +15,14 @@ import { mixyDisplayName } from '../session/mixy-name.mjs';
|
|
|
15
15
|
// Emits a BP2 agent/system block scoped to the calling agent:
|
|
16
16
|
// - Public/custom agents: their own agents/<agent>.md when present,
|
|
17
17
|
// plus the public agent-worker contract.
|
|
18
|
-
// - Hidden agents: their own rules/agent/<agent>.md section only.
|
|
18
|
+
// - Hidden maintenance agents: their own rules/agent/<agent>.md section only.
|
|
19
19
|
// - Null agent: falls back to the full all-in-one block
|
|
20
20
|
// (explicit-cache unified-shard path).
|
|
21
21
|
//
|
|
22
22
|
// Agent-specific markdown intentionally rides BP2, behind the shared BP1 tool
|
|
23
23
|
// and skill manifest prefix, so agent changes do not disturb the common layer.
|
|
24
24
|
//
|
|
25
|
-
// Classification is dynamic — hidden
|
|
25
|
+
// Classification is dynamic — the hidden maintenance set comes from the
|
|
26
26
|
// `kind` field in internal-agents.mjs. Any other non-null agent is public/custom.
|
|
27
27
|
|
|
28
28
|
// One catalog/rules section; selectRoleInstructionSections matches sections
|
|
@@ -36,10 +36,7 @@ function loadAgentClassification() {
|
|
|
36
36
|
// listHiddenAgentsByKind now reads from the mtime-aware cache inside
|
|
37
37
|
// internal-agents.mjs so the classification always reflects the current
|
|
38
38
|
// agents.json on disk.
|
|
39
|
-
return {
|
|
40
|
-
retrieval: new Set(listHiddenAgentsByKind('retrieval')),
|
|
41
|
-
maintenance: new Set(listHiddenAgentsByKind('maintenance')),
|
|
42
|
-
};
|
|
39
|
+
return { maintenance: new Set(listHiddenAgentsByKind('maintenance')) };
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
const _scopedRoleInstructionsCache = new Map();
|
|
@@ -167,28 +164,13 @@ function selfHiddenRuleSection(hiddenPairs, agent) {
|
|
|
167
164
|
return self ? [roleSection(self.name, self.body)] : [];
|
|
168
165
|
}
|
|
169
166
|
|
|
170
|
-
function selectRoleInstructionSections({
|
|
171
|
-
useUnified,
|
|
172
|
-
agent,
|
|
173
|
-
classification,
|
|
174
|
-
agentSharesCatalog,
|
|
175
|
-
agentSections,
|
|
176
|
-
hiddenPairs,
|
|
177
|
-
}) {
|
|
167
|
+
function selectRoleInstructionSections({ useUnified, agent, classification, agentSections, hiddenPairs }) {
|
|
178
168
|
if (useUnified || !agent) {
|
|
179
169
|
return {
|
|
180
170
|
agentRuleSectionsToEmit: hiddenRuleSections(hiddenPairs),
|
|
181
171
|
agentSectionsToEmit: agentSections,
|
|
182
172
|
};
|
|
183
173
|
}
|
|
184
|
-
if (classification.retrieval.has(agent)) {
|
|
185
|
-
return {
|
|
186
|
-
agentRuleSectionsToEmit: selfHiddenRuleSection(hiddenPairs, agent),
|
|
187
|
-
agentSectionsToEmit: agentSections.filter((s) =>
|
|
188
|
-
[...agentSharesCatalog].some((name) => s.startsWith(`## ${name}\n`))
|
|
189
|
-
),
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
174
|
if (classification.maintenance.has(agent)) {
|
|
193
175
|
const selfRules = selfHiddenRuleSection(hiddenPairs, agent);
|
|
194
176
|
const fromAgent = agentSections.find((s) => s.startsWith(`## ${agent}\n`));
|
|
@@ -233,8 +215,6 @@ export function loadScopedRoleInstructions(agent, provider = null) {
|
|
|
233
215
|
// failures (malformed/missing agents.json) must propagate, not be
|
|
234
216
|
// silently swallowed by the file-IO catch below.
|
|
235
217
|
const classification = loadAgentClassification();
|
|
236
|
-
const agentSharesCatalog =
|
|
237
|
-
agent && classification.retrieval.has(agent) ? new Set(getAgentCatalogShareAgents(agent)) : new Set();
|
|
238
218
|
try {
|
|
239
219
|
const agentSections = loadAgentSections(pluginRoot);
|
|
240
220
|
const hiddenPairs = loadHiddenAgentSnippets(pluginRoot);
|
|
@@ -243,7 +223,6 @@ export function loadScopedRoleInstructions(agent, provider = null) {
|
|
|
243
223
|
useUnified,
|
|
244
224
|
agent,
|
|
245
225
|
classification,
|
|
246
|
-
agentSharesCatalog,
|
|
247
226
|
agentSections,
|
|
248
227
|
hiddenPairs,
|
|
249
228
|
});
|
|
@@ -669,7 +669,9 @@ export function buildSkillManifest(skills, { limit = 80, charBudget = SKILL_MANI
|
|
|
669
669
|
for (const skill of visible) skill.trigger = compactPromptManifestText(skill.trigger, triggerCap);
|
|
670
670
|
const lines = [
|
|
671
671
|
'# available-skills',
|
|
672
|
-
|
|
672
|
+
visible.some((skill) => skill.linkedTools.some((tool) => tool.startsWith('mcp:')))
|
|
673
|
+
? 'Selection triggers and linked tools. mcp:<server> denotes that server’s tools.'
|
|
674
|
+
: 'Selection triggers and linked tools.',
|
|
673
675
|
'<available_skills>',
|
|
674
676
|
...visible.map(
|
|
675
677
|
(skill) => (skill.trigger ? `- ${skill.name}: ${skill.trigger}` : `- ${skill.name}`) + toolSuffix(skill)
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
* found" error rather than silently mis-dispatching.
|
|
21
21
|
*
|
|
22
22
|
* Kind classification:
|
|
23
|
-
* - 'retrieval' : short-lived hidden retrieval agents.
|
|
24
23
|
* - 'maintenance' : background-trigger hidden agents (memory cycle and
|
|
25
24
|
* title generation). Receive only their own self section.
|
|
25
|
+
* An entry without a kind only names a route (the explore tool's
|
|
26
|
+
* `explore-agent`, which runs no session).
|
|
26
27
|
*
|
|
27
28
|
* Permission classification:
|
|
28
29
|
* - 'read' : read-only — apply_patch/shell blocked at loop.mjs runtime
|
|
@@ -185,7 +186,7 @@ export function listHiddenAgentNames() {
|
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
/**
|
|
188
|
-
* List hidden agent names matching a given kind ('
|
|
189
|
+
* List hidden agent names matching a given kind ('maintenance').
|
|
189
190
|
* Consumed by collect.mjs to drive BP2 agent classification dynamically
|
|
190
191
|
* instead of hard-coding agent-name sets.
|
|
191
192
|
*/
|
|
@@ -196,15 +197,3 @@ export function listHiddenAgentsByKind(kind) {
|
|
|
196
197
|
}
|
|
197
198
|
return out;
|
|
198
199
|
}
|
|
199
|
-
|
|
200
|
-
/**
|
|
201
|
-
* Return the agents/<name>.md sections a hidden agent shares in its BP2 catalog
|
|
202
|
-
* (in addition to its own self section). Drives hidden-role cache
|
|
203
|
-
* alignment declaratively instead of a hard-coded agent-name branch in
|
|
204
|
-
* collect.mjs. Returns [] when the agent declares none.
|
|
205
|
-
*/
|
|
206
|
-
export function getAgentCatalogShareAgents(name) {
|
|
207
|
-
const hidden = getHiddenAgent(name);
|
|
208
|
-
if (!hidden || !Array.isArray(hidden.catalogShareAgents)) return [];
|
|
209
|
-
return hidden.catalogShareAgents.map((n) => String(n || '').trim()).filter(Boolean);
|
|
210
|
-
}
|