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
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Read-only inventory of a project's test files across JS/TS, Python, Go and
|
|
3
|
+
// Rust: lane, area, risk markers and skip records. Prints Markdown, or JSON
|
|
4
|
+
// with --json. Never writes files, never follows links, never runs anything.
|
|
5
|
+
import { closeSync, openSync, readSync, readdirSync, statSync } from 'node:fs';
|
|
6
|
+
import { join, relative, sep } from 'node:path';
|
|
7
|
+
import { pathToFileURL } from 'node:url';
|
|
8
|
+
|
|
9
|
+
const SKIP_DIRS = new Set([
|
|
10
|
+
'node_modules',
|
|
11
|
+
'.git',
|
|
12
|
+
'.hg',
|
|
13
|
+
'.svn',
|
|
14
|
+
'dist',
|
|
15
|
+
'out',
|
|
16
|
+
'build',
|
|
17
|
+
'target',
|
|
18
|
+
'vendor',
|
|
19
|
+
'third_party',
|
|
20
|
+
'venv',
|
|
21
|
+
'.venv',
|
|
22
|
+
'site-packages',
|
|
23
|
+
'__pycache__',
|
|
24
|
+
'.tox',
|
|
25
|
+
'.nox',
|
|
26
|
+
'.mypy_cache',
|
|
27
|
+
'.pytest_cache',
|
|
28
|
+
'.ruff_cache',
|
|
29
|
+
'.next',
|
|
30
|
+
'.nuxt',
|
|
31
|
+
'.turbo',
|
|
32
|
+
'.cache',
|
|
33
|
+
'.runtime',
|
|
34
|
+
'coverage',
|
|
35
|
+
'.gradle',
|
|
36
|
+
]);
|
|
37
|
+
const MAX_FILES = 20_000;
|
|
38
|
+
const MAX_DIRS = 50_000;
|
|
39
|
+
const MAX_DEPTH = 40;
|
|
40
|
+
const MAX_BYTES = 1 << 20;
|
|
41
|
+
const LIST_LIMIT = 200;
|
|
42
|
+
|
|
43
|
+
const JS_EXT = '(?:m?[jt]s|c[jt]s|[jt]sx)';
|
|
44
|
+
const JS_TEST = new RegExp(`(?:\\.(?:test|spec)\\.${JS_EXT}|-test\\.m?js)$`);
|
|
45
|
+
const JS_FILE = new RegExp(`\\.${JS_EXT}$`);
|
|
46
|
+
const TYPES_FILE = /\.d\.[cm]?ts$/;
|
|
47
|
+
const RUST_TEST = /#\[\s*(?:cfg\(\s*test\s*\)|test|tokio::test|rstest)\b/;
|
|
48
|
+
|
|
49
|
+
// `skip: cond && 'reason'` keeps the reason after the last `&&`.
|
|
50
|
+
const JS_SKIP_REASON = /\bskip\s*(?::|\()\s*(?:[^\n]*?&&\s*)?(['"`])((?:(?!\1).)*)\1/g;
|
|
51
|
+
const JS_SKIP_BARE = /\b(?:(?:it|test|describe)\.skip|x(?:it|test|describe))\b|\.skip\s*\(\s*\)|\bskip\s*:\s*true\b/;
|
|
52
|
+
const JS_SKIP_IF = /\.skipIf\s*\(/;
|
|
53
|
+
const PY_SKIP =
|
|
54
|
+
/\b(?:pytest\.mark\.(skipif|skip|xfail)|unittest\.(skipIf|skipUnless|skip|expectedFailure)|pytest\.(importorskip|skip))\b/;
|
|
55
|
+
const PY_CONDITIONAL = new Set(['skipif', 'skipIf', 'skipUnless', 'importorskip']);
|
|
56
|
+
const GO_SKIP = /\.Skip(?:f|Now)?\s*\(/;
|
|
57
|
+
const RUST_IGNORE = /#\[\s*ignore\s*(?:=\s*(['"])((?:(?!\1).)*)\1)?\s*(?:\(.*?\))?\s*\]/;
|
|
58
|
+
const RUST_CFG_IGNORE = /#\[\s*cfg_attr\([^\]]*\bignore\b/;
|
|
59
|
+
|
|
60
|
+
const LANGS = {
|
|
61
|
+
js: {
|
|
62
|
+
comment: '//',
|
|
63
|
+
fake: /mock\.timers\.enable|useFakeTimers|installFakeClock|vi\.setSystemTime|jest\.setSystemTime/,
|
|
64
|
+
markers: {
|
|
65
|
+
timer: /\b(setTimeout|setInterval|sleep|delay)\s*\(/,
|
|
66
|
+
spawn: /\b(spawn|spawnSync|execFile|execFileSync|execSync|fork)\s*\(/,
|
|
67
|
+
port: /\.listen\(\s*[1-9]\d{2,4}\b/,
|
|
68
|
+
clock: /Date\.now\(\)|new Date\(\s*\)/,
|
|
69
|
+
'source-text': /readFile(Sync)?\([^)]*\.(m?js|tsx?|jsx)['"`]/,
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
python: {
|
|
73
|
+
comment: '#',
|
|
74
|
+
fake: /freezegun|freeze_time|time_machine|time-machine|monkeypatch\.setattr\([^)]*time|mock\.patch\([^)]*time/,
|
|
75
|
+
markers: {
|
|
76
|
+
timer: /\b(?:time|asyncio)\.sleep\(|\bsleep\(/,
|
|
77
|
+
spawn:
|
|
78
|
+
/\bsubprocess\.(?:run|Popen|call|check_output|check_call)\(|\bos\.(?:system|popen)\(|\bmultiprocessing\.Process\(/,
|
|
79
|
+
port: /\.bind\(\s*\([^)]*,\s*[1-9]\d{2,4}\s*\)|\bport\s*=\s*[1-9]\d{3,4}\b/,
|
|
80
|
+
clock: /\bdatetime\.(?:now|utcnow)\(|\bdate\.today\(|\btime\.time\(\)/,
|
|
81
|
+
'source-text': /inspect\.getsource\(|(?:open|Path)\(\s*['"][^'"]*\.(?:py|js|ts)['"]/,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
go: {
|
|
85
|
+
comment: '//',
|
|
86
|
+
fake: /clockwork|benbjohnson\/clock|synctest/,
|
|
87
|
+
markers: {
|
|
88
|
+
timer: /\btime\.(?:Sleep|After|NewTimer|NewTicker|Tick)\(/,
|
|
89
|
+
spawn: /\bexec\.Command(?:Context)?\(/,
|
|
90
|
+
port: /(?:net\.Listen|ListenAndServe)\(\s*(?:"tcp[46]?"\s*,\s*)?"[^"]*:[1-9]\d{2,4}"/,
|
|
91
|
+
clock: /\btime\.Now\(\)/,
|
|
92
|
+
'source-text': /os\.ReadFile\(\s*"[^"]*\.go"|parser\.ParseFile\(/,
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
rust: {
|
|
96
|
+
comment: '//',
|
|
97
|
+
fake: /tokio::time::pause|start_paused/,
|
|
98
|
+
markers: {
|
|
99
|
+
timer: /\bsleep\(/,
|
|
100
|
+
spawn: /\b(?:std::)?process::Command\b|\bCommand::new\(/,
|
|
101
|
+
port: /\bbind\(\s*"[^"]*:[1-9]\d{2,4}"/,
|
|
102
|
+
clock: /\b(?:SystemTime|Instant|Utc|Local)::now\(\)/,
|
|
103
|
+
'source-text': /include_str!\([^)]*\.rs"|read_to_string\([^)]*\.rs"/,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// A reason naming a missing capability of the host (platform, privilege,
|
|
109
|
+
// tool, build) is a capability skip; anything else reads as a defect skip.
|
|
110
|
+
const CAPABILITY =
|
|
111
|
+
/\bonly\b|unavailable|unsupported|not (available|permitted|enforced|built|supported|configured|granted|installed)|requires?\b|needs?\b|missing|denied|refused|does not (support|grant|allow)|insensitive|not found|has no|not run on|\bno local\b|\bno display\b|\bposix\b|\bno [\w ]+ (available|configured|is configured|installed)|\bnot on (the )?path\b|\bno [\w-]+ on this (host|machine|platform|runner)|\(\s*(?:e\.g\.|i\.e\.),?\s*running as (?:root|administrator|an? \w+ user)\s*\)|\bskip(?:ped)? (?:when|if|as|under) running as (?:root|administrator|an? \w+ user)\b|\b(?:is|are) an? (?:windows|posix|linux|macos|unix)[- ](?:behaviou?r|feature|semantics)\b/i;
|
|
112
|
+
const TRACKED = /#\d+/;
|
|
113
|
+
const UNTIL = /until (\d{4}-\d{2}-\d{2})/;
|
|
114
|
+
|
|
115
|
+
export function laneOf(file) {
|
|
116
|
+
const tag = /\.(slow|live|electron|e2e|integration)\.(?:test|spec)\./.exec(file);
|
|
117
|
+
return tag ? tag[1] : 'fast';
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export function areaOf(rel) {
|
|
121
|
+
const dirs = rel.split(sep).join('/').split('/').slice(0, -1);
|
|
122
|
+
if (dirs[0] === 'src') dirs.shift();
|
|
123
|
+
return dirs.slice(0, 2).join('/') || '.';
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Returns 'js' | 'python' | 'go' | 'rust' | 'rust?' (a .rs file whose text decides) | null.
|
|
127
|
+
function langOf(rel, name) {
|
|
128
|
+
if (JS_FILE.test(name) && !TYPES_FILE.test(name) && (JS_TEST.test(name) || `/${rel}`.includes('/__tests__/')))
|
|
129
|
+
return 'js';
|
|
130
|
+
if (/^test_.+\.py$|_test\.py$/.test(name)) return 'python';
|
|
131
|
+
if (name.endsWith('_test.go')) return 'go';
|
|
132
|
+
if (name.endsWith('.rs')) return `/${rel}`.includes('/tests/') ? 'rust' : 'rust?';
|
|
133
|
+
return null;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
// Links are never followed: a dangling or looping link cannot break the walk.
|
|
137
|
+
function walk(root) {
|
|
138
|
+
const found = [];
|
|
139
|
+
let dirs = 0;
|
|
140
|
+
const visit = (dir, depth) => {
|
|
141
|
+
if (depth > MAX_DEPTH)
|
|
142
|
+
throw new Error(`directories nested deeper than ${MAX_DEPTH} under ${root}; narrow the root`);
|
|
143
|
+
if (++dirs > MAX_DIRS) throw new Error(`more than ${MAX_DIRS} directories under ${root}; narrow the root`);
|
|
144
|
+
for (const entry of readdirSync(dir, { withFileTypes: true })) {
|
|
145
|
+
const full = join(dir, entry.name);
|
|
146
|
+
if (entry.isDirectory()) {
|
|
147
|
+
if (!SKIP_DIRS.has(entry.name)) visit(full, depth + 1);
|
|
148
|
+
} else if (entry.isFile()) {
|
|
149
|
+
const rel = relative(root, full).split(sep).join('/');
|
|
150
|
+
const lang = langOf(rel, entry.name);
|
|
151
|
+
if (!lang) continue;
|
|
152
|
+
found.push({ full, rel, lang });
|
|
153
|
+
if (found.length > MAX_FILES)
|
|
154
|
+
throw new Error(`more than ${MAX_FILES} test files under ${root}; narrow the root`);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
visit(root, 0);
|
|
159
|
+
return found;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
function readHead(path) {
|
|
163
|
+
const fd = openSync(path, 'r');
|
|
164
|
+
try {
|
|
165
|
+
const buffer = Buffer.alloc(Math.min(statSync(path).size, MAX_BYTES));
|
|
166
|
+
const length = readSync(fd, buffer, 0, buffer.length, 0);
|
|
167
|
+
return buffer.toString('utf8', 0, length);
|
|
168
|
+
} finally {
|
|
169
|
+
closeSync(fd);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
// The call's text from `from` to its closing parenthesis, across up to 6 lines.
|
|
174
|
+
function callText(lines, index, from) {
|
|
175
|
+
let text = lines[index].slice(from);
|
|
176
|
+
for (let next = index + 1; next < Math.min(lines.length, index + 6); next += 1) {
|
|
177
|
+
const open = (text.match(/\(/g) || []).length;
|
|
178
|
+
if (open > 0 && (text.match(/\)/g) || []).length >= open) break;
|
|
179
|
+
text += ` ${lines[next].trim()}`;
|
|
180
|
+
}
|
|
181
|
+
return text;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
function skipSites(lines, lang) {
|
|
185
|
+
const sites = [];
|
|
186
|
+
lines.forEach((line, index) => {
|
|
187
|
+
const add = (reason, conditional) => sites.push({ index, reason, conditional });
|
|
188
|
+
if (lang === 'js') {
|
|
189
|
+
const reasons = [...line.matchAll(JS_SKIP_REASON)];
|
|
190
|
+
for (const match of reasons) add(match[2], false);
|
|
191
|
+
if (!reasons.length) {
|
|
192
|
+
if (JS_SKIP_IF.test(line)) add('', true);
|
|
193
|
+
else if (JS_SKIP_BARE.test(line)) add('', false);
|
|
194
|
+
}
|
|
195
|
+
} else if (lang === 'python') {
|
|
196
|
+
const match = PY_SKIP.exec(line);
|
|
197
|
+
if (!match || /^\s*#/.test(line)) return;
|
|
198
|
+
const conditional = PY_CONDITIONAL.has(match[1] || match[2] || match[3]);
|
|
199
|
+
const call = callText(lines, index, match.index);
|
|
200
|
+
const keyword = /\breason\s*=\s*(['"])((?:(?!\1).)*)\1/.exec(call);
|
|
201
|
+
const positional = conditional
|
|
202
|
+
? /,\s*(['"])((?:(?!\1).)*)\1\s*\)?\s*$/.exec(call)
|
|
203
|
+
: /\(\s*(['"])((?:(?!\1).)*)\1/.exec(call);
|
|
204
|
+
add((keyword || positional)?.[2] || '', conditional);
|
|
205
|
+
} else if (lang === 'go') {
|
|
206
|
+
const match = GO_SKIP.exec(line);
|
|
207
|
+
if (match && !/^\s*\/\//.test(line))
|
|
208
|
+
add(/(['"`])((?:(?!\1).)*)\1/.exec(line.slice(match.index))?.[2] || '', false);
|
|
209
|
+
} else {
|
|
210
|
+
const match = RUST_IGNORE.exec(line);
|
|
211
|
+
if (match) add(match[2] || '', false);
|
|
212
|
+
else if (RUST_CFG_IGNORE.test(line)) add('', true);
|
|
213
|
+
}
|
|
214
|
+
});
|
|
215
|
+
return sites;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
function commentOf(line, token) {
|
|
219
|
+
const at = line.indexOf(token);
|
|
220
|
+
return at < 0 ? '' : line.slice(at + token.length).trim();
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function classify(reason, today, conditional) {
|
|
224
|
+
const until = UNTIL.exec(reason)?.[1] || '';
|
|
225
|
+
if (until && until < today) return 'expired';
|
|
226
|
+
if (TRACKED.test(reason)) return 'tracked';
|
|
227
|
+
if (!reason.trim()) return conditional ? 'capability' : 'untracked';
|
|
228
|
+
return CAPABILITY.test(reason) ? 'capability' : 'untracked';
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export function scanText(text, today, lang = 'js') {
|
|
232
|
+
const spec = LANGS[lang];
|
|
233
|
+
const fakeClock = spec.fake.test(text);
|
|
234
|
+
const markers = Object.entries(spec.markers)
|
|
235
|
+
.filter(([name, pattern]) => pattern.test(text) && !(fakeClock && (name === 'timer' || name === 'clock')))
|
|
236
|
+
.map(([name]) => name);
|
|
237
|
+
const lines = text.split(/\r?\n/);
|
|
238
|
+
const skips = skipSites(lines, lang).map(({ index, reason, conditional }) => {
|
|
239
|
+
const before =
|
|
240
|
+
index > 0 && lines[index - 1].trim().startsWith(spec.comment) ? commentOf(lines[index - 1], spec.comment) : '';
|
|
241
|
+
const note = [commentOf(lines[index], spec.comment), before].filter(Boolean).join(' ');
|
|
242
|
+
const full = [reason, note].filter(Boolean).join(' ');
|
|
243
|
+
return { line: index + 1, reason: reason || note, kind: classify(full, today, conditional) };
|
|
244
|
+
});
|
|
245
|
+
return { markers, skips };
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export function inventory(root, { today = new Date().toISOString().slice(0, 10) } = {}) {
|
|
249
|
+
if (!statSync(root, { throwIfNoEntry: false })?.isDirectory()) throw new Error(`not a directory: ${root}`);
|
|
250
|
+
const files = [];
|
|
251
|
+
for (const { full, rel, lang } of walk(root)) {
|
|
252
|
+
const text = readHead(full);
|
|
253
|
+
if (lang === 'rust?' && !RUST_TEST.test(text)) continue;
|
|
254
|
+
const language = lang === 'rust?' ? 'rust' : lang;
|
|
255
|
+
files.push({ file: rel, lang: language, lane: laneOf(rel), area: areaOf(rel), ...scanText(text, today, language) });
|
|
256
|
+
}
|
|
257
|
+
const areas = new Map();
|
|
258
|
+
for (const entry of files) {
|
|
259
|
+
const row = areas.get(entry.area) || {
|
|
260
|
+
area: entry.area,
|
|
261
|
+
files: 0,
|
|
262
|
+
fast: 0,
|
|
263
|
+
slow: 0,
|
|
264
|
+
other: 0,
|
|
265
|
+
langs: {},
|
|
266
|
+
markers: {},
|
|
267
|
+
skips: {},
|
|
268
|
+
};
|
|
269
|
+
row.files += 1;
|
|
270
|
+
if (entry.lane === 'fast') row.fast += 1;
|
|
271
|
+
else if (entry.lane === 'slow') row.slow += 1;
|
|
272
|
+
else row.other += 1;
|
|
273
|
+
row.langs[entry.lang] = (row.langs[entry.lang] || 0) + 1;
|
|
274
|
+
for (const marker of entry.markers) row.markers[marker] = (row.markers[marker] || 0) + 1;
|
|
275
|
+
for (const skip of entry.skips) row.skips[skip.kind] = (row.skips[skip.kind] || 0) + 1;
|
|
276
|
+
areas.set(entry.area, row);
|
|
277
|
+
}
|
|
278
|
+
const attention = files.flatMap((entry) =>
|
|
279
|
+
entry.skips.filter((skip) => skip.kind !== 'capability').map((skip) => ({ file: entry.file, ...skip }))
|
|
280
|
+
);
|
|
281
|
+
const fastRisk = files.filter(
|
|
282
|
+
(entry) => entry.lane === 'fast' && entry.markers.includes('timer') && entry.markers.includes('spawn')
|
|
283
|
+
);
|
|
284
|
+
return {
|
|
285
|
+
root,
|
|
286
|
+
today,
|
|
287
|
+
files: files.length,
|
|
288
|
+
areas: [...areas.values()].sort((a, b) => b.files - a.files || a.area.localeCompare(b.area)),
|
|
289
|
+
attentionTotal: attention.length,
|
|
290
|
+
attention: attention.slice(0, LIST_LIMIT),
|
|
291
|
+
fastRiskTotal: fastRisk.length,
|
|
292
|
+
fastRisk: fastRisk.slice(0, LIST_LIMIT).map((entry) => entry.file),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
function markdown(report) {
|
|
297
|
+
const cell = (counts) =>
|
|
298
|
+
Object.entries(counts)
|
|
299
|
+
.map(([key, count]) => `${key} ${count}`)
|
|
300
|
+
.join(', ') || '-';
|
|
301
|
+
const more = (total, shown) => (total > shown ? [`- … ${total - shown} more (use --json)`] : []);
|
|
302
|
+
const out = [`# Test inventory: ${report.root}`, '', `${report.files} test files, ${report.today}.`, ''];
|
|
303
|
+
out.push('| Area | Files | Fast | Slow | Other | Languages | Markers | Skips |', '|---|---|---|---|---|---|---|---|');
|
|
304
|
+
for (const row of report.areas) {
|
|
305
|
+
out.push(
|
|
306
|
+
`| ${row.area} | ${row.files} | ${row.fast} | ${row.slow} | ${row.other} | ${cell(row.langs)} | ${cell(row.markers)} | ${cell(row.skips)} |`
|
|
307
|
+
);
|
|
308
|
+
}
|
|
309
|
+
out.push('', `## Skips needing action (${report.attentionTotal})`, '');
|
|
310
|
+
for (const item of report.attention)
|
|
311
|
+
out.push(`- ${item.kind}: \`${item.file}:${item.line}\` — ${item.reason || '(no reason)'}`);
|
|
312
|
+
out.push(...more(report.attentionTotal, report.attention.length));
|
|
313
|
+
out.push('', `## Fast-lane files with timers and real processes (${report.fastRiskTotal})`, '');
|
|
314
|
+
for (const file of report.fastRisk) out.push(`- \`${file}\``);
|
|
315
|
+
out.push(...more(report.fastRiskTotal, report.fastRisk.length));
|
|
316
|
+
return out.join('\n');
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (import.meta.url === pathToFileURL(process.argv[1] || '').href) {
|
|
320
|
+
const args = process.argv.slice(2);
|
|
321
|
+
const json = args.includes('--json');
|
|
322
|
+
const unknown = args.find((arg) => arg.startsWith('--') && arg !== '--json');
|
|
323
|
+
const root = args.find((arg) => !arg.startsWith('--'));
|
|
324
|
+
if (!root || unknown) {
|
|
325
|
+
console.error(`${unknown ? `unknown option ${unknown}; ` : ''}usage: inventory.mjs <project-root> [--json]`);
|
|
326
|
+
process.exit(2);
|
|
327
|
+
}
|
|
328
|
+
try {
|
|
329
|
+
const report = inventory(root);
|
|
330
|
+
console.log(json ? JSON.stringify(report, null, 2) : markdown(report));
|
|
331
|
+
} catch (error) {
|
|
332
|
+
console.error(`inventory: ${error.message}`);
|
|
333
|
+
process.exit(1);
|
|
334
|
+
}
|
|
335
|
+
}
|
|
@@ -115,6 +115,10 @@ or radius are one option.
|
|
|
115
115
|
- Open a result once, when it is ready to look at, not at every intermediate
|
|
116
116
|
write. Long multi-step work shows the first reviewable state, then lets
|
|
117
117
|
reloads carry the rest.
|
|
118
|
+
- `open` shows the user a deliverable. To check your own work (`check`,
|
|
119
|
+
`inspect`, `capture`, `export`, before/after screenshots), `open` with
|
|
120
|
+
`verify: true`: the tab stays off the user's panel and chat and closes when
|
|
121
|
+
the turn ends. Opening the same target without it shows it.
|
|
118
122
|
- Decks and documents: the panel shows the converted pages; still run the
|
|
119
123
|
owning skill's own render review — the panel is for the user, not your QC.
|
|
120
124
|
- Close tabs that no longer match the conversation (a resolved choice, a
|
|
@@ -129,8 +133,8 @@ or radius are one option.
|
|
|
129
133
|
|
|
130
134
|
### Inline content or a file
|
|
131
135
|
- **Inline** (`open` with `input.content` — `mermaid`, `svg`, `chart` (an
|
|
132
|
-
ECharts option as JSON), `html`, `markdown`): diagrams, charts
|
|
133
|
-
sketches
|
|
136
|
+
ECharts option as JSON), `html`, `markdown`): diagrams, charts and quick
|
|
137
|
+
sketches you will not edit again; never a report of your own work. No file is written. `mermaid`,
|
|
134
138
|
`svg` and `markdown` are static, sanitized output (no scripts). `chart` is
|
|
135
139
|
interactive (tooltips, zoom) and `html` runs its scripts, as in-memory pages
|
|
136
140
|
held to the same rules as an HTML file: outside network is blocked, so an
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
* - buildSharedToolContent — BP1: shared tool policy
|
|
8
8
|
* - buildLeadRoleContent — BP3: Lead role/system rules
|
|
9
9
|
* - buildAgentRoleContent — BP3: agent role/system rules
|
|
10
|
-
* - buildAgentRetrievalInjectionContent — BP3: narrow read-only retrieval role
|
|
11
10
|
* - buildLeadMetaContent — BP2: Lead profile/settings context
|
|
12
11
|
*
|
|
13
12
|
* 4-BP cache layout (composeSystemPrompt):
|
|
@@ -126,7 +125,10 @@ function buildProfilePreferencesContent(dataDir) {
|
|
|
126
125
|
return lines.length ? `# Profile Preferences\n\n${lines.join('\n')}` : '';
|
|
127
126
|
}
|
|
128
127
|
|
|
129
|
-
|
|
128
|
+
// `sharedFormatActive`: the prompt carries the shared Output Format partial,
|
|
129
|
+
// which already keeps literals verbatim (common.md), so the language block
|
|
130
|
+
// need not repeat it.
|
|
131
|
+
function buildLanguageSection(dataDir, sharedFormatActive = false) {
|
|
130
132
|
const profile = normalizeProfileConfig(readAgentConfig(dataDir).profile);
|
|
131
133
|
const language = profileLanguagePrompt(profile.language);
|
|
132
134
|
if (!language?.prompt) return '';
|
|
@@ -139,7 +141,7 @@ function buildLanguageSection(dataDir) {
|
|
|
139
141
|
// mistranslate, so the two clauses would be dead text.
|
|
140
142
|
if (language.prompt !== 'English') {
|
|
141
143
|
lines.push(
|
|
142
|
-
`- Preserve identifiers, paths, commands, API names, and exact errors. Keep technical terms in their established form, usually the original English (blocker, cache, commit); add a short plain explanation only when the reader may not know it. Never invent a literal translation.`
|
|
144
|
+
`- ${sharedFormatActive ? '' : 'Preserve identifiers, paths, commands, API names, and exact errors. '}Keep technical terms in their established form, usually the original English (blocker, cache, commit); add a short plain explanation only when the reader may not know it. Never invent a literal translation.`
|
|
143
145
|
);
|
|
144
146
|
}
|
|
145
147
|
return `# Language\n\n${lines.join('\n')}`;
|
|
@@ -153,7 +155,9 @@ function stripFrontmatter(markdown) {
|
|
|
153
155
|
|
|
154
156
|
// Tool dependency is declared as metadata, not matched against prose. A
|
|
155
157
|
// `<!-- tools: a, b -->` marker binds the block that follows it: the block
|
|
156
|
-
// survives while any listed tool is permitted by the allow/deny policy.
|
|
158
|
+
// survives while any listed tool is permitted by the allow/deny policy. The
|
|
159
|
+
// pseudo-entry `lead` is not a tool: it is permitted for every non-agent
|
|
160
|
+
// session (whatever its tool profile) and never for an agent-owned one.
|
|
157
161
|
// Unspecified allowlists are unrestricted. Markers never reach the model.
|
|
158
162
|
const TOOL_MARKER_RE = /^[ \t]*<!--[ \t]*tools:[ \t]*([^>]*?)[ \t]*-->[ \t]*$/;
|
|
159
163
|
|
|
@@ -188,9 +192,10 @@ function omitKeySet(omitTools) {
|
|
|
188
192
|
}
|
|
189
193
|
|
|
190
194
|
/** Drop routing clauses for tools that are not on the session surface. */
|
|
191
|
-
function omitToolRoutes(text, omitTools = [], allowTools = null) {
|
|
195
|
+
function omitToolRoutes(text, omitTools = [], allowTools = null, ownerIsAgent = false) {
|
|
192
196
|
const deny = omitKeySet(omitTools);
|
|
193
197
|
const allow = Array.isArray(allowTools) ? omitKeySet(allowTools) : null;
|
|
198
|
+
const permitted = (name) => (name === 'lead' ? !ownerIsAgent : !deny.has(name) && (!allow || allow.has(name)));
|
|
194
199
|
const lines = String(text || '').split(/\r?\n/);
|
|
195
200
|
const kept = [];
|
|
196
201
|
let index = 0;
|
|
@@ -204,7 +209,7 @@ function omitToolRoutes(text, omitTools = [], allowTools = null) {
|
|
|
204
209
|
index += 1;
|
|
205
210
|
if (index >= lines.length) break;
|
|
206
211
|
const end = markedBlockEnd(lines, index);
|
|
207
|
-
if (!tools.length || tools.some(
|
|
212
|
+
if (!tools.length || tools.some(permitted)) {
|
|
208
213
|
kept.push(...lines.slice(index, end));
|
|
209
214
|
}
|
|
210
215
|
index = end;
|
|
@@ -252,22 +257,29 @@ function readSharedFormatPartial({ PLUGIN_ROOT, DATA_DIR }) {
|
|
|
252
257
|
);
|
|
253
258
|
}
|
|
254
259
|
|
|
255
|
-
function
|
|
260
|
+
function resolveOutputStyle({ PLUGIN_ROOT, DATA_DIR }) {
|
|
256
261
|
// Root `outputStyle` is the only configured location; the retired
|
|
257
262
|
// `agent.outputStyle` key is dropped by config canonicalization.
|
|
258
263
|
const configured = String(readUnifiedConfig(DATA_DIR).outputStyle || '').trim() || DEFAULT_OUTPUT_STYLE_ID;
|
|
259
264
|
const styles = listOutputStyleEntries({ PLUGIN_ROOT, DATA_DIR });
|
|
260
265
|
const style = matchOutputStyle(configured, styles) || matchOutputStyle(DEFAULT_OUTPUT_STYLE_ID, styles) || styles[0];
|
|
261
|
-
if (!style) return
|
|
266
|
+
if (!style) return null;
|
|
262
267
|
const selected = stripFrontmatter(style.raw);
|
|
263
|
-
if (!selected) return
|
|
268
|
+
if (!selected) return null;
|
|
264
269
|
const common = style.keepSharedFormat ? readSharedFormatPartial({ PLUGIN_ROOT, DATA_DIR }) : '';
|
|
270
|
+
return { style, selected, common };
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
function loadOutputStyle(paths) {
|
|
274
|
+
const resolved = resolveOutputStyle(paths);
|
|
275
|
+
if (!resolved) return '';
|
|
276
|
+
const { style, selected, common } = resolved;
|
|
265
277
|
return [`# Output Style: ${style.label}`, OUTPUT_STYLE_ANCHOR, common, selected].filter(Boolean).join('\n\n');
|
|
266
278
|
}
|
|
267
279
|
|
|
268
|
-
function buildSharedToolContent({ PLUGIN_ROOT, omitTools = [], allowTools = null } = {}) {
|
|
280
|
+
function buildSharedToolContent({ PLUGIN_ROOT, omitTools = [], allowTools = null, ownerIsAgent = false } = {}) {
|
|
269
281
|
const SHARED_DIR = path.join(PLUGIN_ROOT, 'rules', 'shared');
|
|
270
|
-
return omitToolRoutes(readMarkdownDirectory(SHARED_DIR), omitTools, allowTools);
|
|
282
|
+
return omitToolRoutes(readMarkdownDirectory(SHARED_DIR), omitTools, allowTools, ownerIsAgent);
|
|
271
283
|
}
|
|
272
284
|
|
|
273
285
|
// Route policy: `rules/routes/*.md` files bound to a provider and/or model
|
|
@@ -369,7 +381,8 @@ function buildRouteRulesContent({
|
|
|
369
381
|
// - `identity`: the coding identity sentence ("You are Mixdog, …").
|
|
370
382
|
const LEAD_IDENTITY_LINE = /^- (You are Mixdog, a coding agent\.)\n/m;
|
|
371
383
|
const LEAD_PROGRESS_PASSAGE = / (Before your first tool call, briefly state[\s\S]*?narration or plan repeats\.)/;
|
|
372
|
-
|
|
384
|
+
// Word gaps are \s+ so rewrapping LEAD.md cannot silently unmatch a passage.
|
|
385
|
+
const LEAD_REPORT_PASSAGE = / (On\s+an\s+agent\s+report[\s\S]*?not\s+a\s+completed\s+request\.)/;
|
|
373
386
|
const AGENT_MODE_PROGRESS =
|
|
374
387
|
'- Just answer conversation. Quick tool use (checking memory, a lookup,\n' +
|
|
375
388
|
' leaving a reaction) needs no announcement. When starting longer work\n' +
|
|
@@ -379,8 +392,8 @@ const AGENT_MODE_PROGRESS =
|
|
|
379
392
|
const AGENT_MODE_REPORT =
|
|
380
393
|
'- Relay agent reports faithfully. Code: one fresh Reviewer per non-trivial\n' +
|
|
381
394
|
' feature after its last worker, any author (Lead if none); docs/copy/style:\n' +
|
|
382
|
-
' read the diff. Recheck only fixes
|
|
383
|
-
'
|
|
395
|
+
' read the diff. Recheck only concrete fixes, never rerun passing checks\n' +
|
|
396
|
+
' without new evidence; at request end check feature seams.';
|
|
384
397
|
|
|
385
398
|
function buildLeadRoleContent({ PLUGIN_ROOT, includeLeadBrief = true, part = 'common' }) {
|
|
386
399
|
const RULES_DIR = path.join(PLUGIN_ROOT, 'rules');
|
|
@@ -444,8 +457,12 @@ function buildLeadMetaContent({ PLUGIN_ROOT, DATA_DIR, includeOutputStyle = true
|
|
|
444
457
|
* preamble and progress lines follow the most recent instruction, so nothing
|
|
445
458
|
* English (session/shell/git lines included) may trail it.
|
|
446
459
|
*/
|
|
447
|
-
function buildLeadLanguageContent({ DATA_DIR }) {
|
|
448
|
-
|
|
460
|
+
function buildLeadLanguageContent({ PLUGIN_ROOT, DATA_DIR, includeOutputStyle = true }) {
|
|
461
|
+
const resolved = includeOutputStyle ? resolveOutputStyle({ PLUGIN_ROOT, DATA_DIR }) : null;
|
|
462
|
+
// Only the shipped partial is known to keep literals verbatim; a user
|
|
463
|
+
// override of common.md may not, so it keeps the language guard.
|
|
464
|
+
const shipped = stripFrontmatter(readOptional(path.join(PLUGIN_ROOT, 'output-styles', 'common.md')));
|
|
465
|
+
return buildLanguageSection(DATA_DIR, Boolean(shipped) && resolved?.common === shipped);
|
|
449
466
|
}
|
|
450
467
|
|
|
451
468
|
/** The configured response language as {id, name} (name = the language block's); null when none. */
|
|
@@ -455,31 +472,8 @@ function buildLeadLanguage({ DATA_DIR }) {
|
|
|
455
472
|
return language?.prompt ? { id: language.id, name: language.prompt } : null;
|
|
456
473
|
}
|
|
457
474
|
|
|
458
|
-
function buildAgentRoleContent({ PLUGIN_ROOT
|
|
459
|
-
|
|
460
|
-
if (String(profile || 'full') === 'retrieval') {
|
|
461
|
-
return buildAgentRetrievalInjectionContent({ PLUGIN_ROOT });
|
|
462
|
-
}
|
|
463
|
-
return readOptional(path.join(AGENT_DIR, 'AGENT.md'));
|
|
464
|
-
}
|
|
465
|
-
|
|
466
|
-
/**
|
|
467
|
-
* BP3 role rules for narrow hidden retrieval roles. These roles already carry a separate
|
|
468
|
-
* read-only tool schema shard, so keeping the full agent worker prefix does
|
|
469
|
-
* not improve cross-role cache reuse and only adds unrelated shell/edit/git
|
|
470
|
-
* guidance.
|
|
471
|
-
*
|
|
472
|
-
* @returns {string}
|
|
473
|
-
*/
|
|
474
|
-
function buildAgentRetrievalInjectionContent({ PLUGIN_ROOT }) {
|
|
475
|
-
const AGENT_DIR = path.join(PLUGIN_ROOT, 'rules', 'agent');
|
|
476
|
-
const core = readOptional(path.join(AGENT_DIR, 'AGENT.md'));
|
|
477
|
-
// Full ordered shared policy now ships via BP1 for retrieval
|
|
478
|
-
// roles too; no compact duplicate here.
|
|
479
|
-
const parts = [];
|
|
480
|
-
if (core) parts.push(core);
|
|
481
|
-
parts.push('', '- Read-only retrieval role: do not edit files, run shell, or use git.');
|
|
482
|
-
return parts.join('\n');
|
|
475
|
+
function buildAgentRoleContent({ PLUGIN_ROOT }) {
|
|
476
|
+
return readOptional(path.join(PLUGIN_ROOT, 'rules', 'agent', 'AGENT.md'));
|
|
483
477
|
}
|
|
484
478
|
|
|
485
479
|
module.exports = {
|
|
@@ -491,6 +485,5 @@ module.exports = {
|
|
|
491
485
|
buildLeadLanguageContent,
|
|
492
486
|
buildLeadLanguage,
|
|
493
487
|
buildAgentRoleContent,
|
|
494
|
-
buildAgentRetrievalInjectionContent,
|
|
495
488
|
omitToolRoutes,
|
|
496
489
|
};
|
|
@@ -13,8 +13,8 @@ partial: true
|
|
|
13
13
|
- Distinguish facts, inference, and uncertainty; keep exact literals and
|
|
14
14
|
material risks. Caveats only when they change the reader's next step.
|
|
15
15
|
- Show only what the reader needs: the decision, the result, the blocker, and
|
|
16
|
-
the action. No tangents, raw dumps, or process narration.
|
|
17
|
-
|
|
16
|
+
the action. No tangents, raw dumps, or process narration. Depth
|
|
17
|
+
applies to substantive answers, not the one-line
|
|
18
18
|
pre-tool briefing.
|
|
19
19
|
- At every depth keep decision-relevant failures, security warnings, and
|
|
20
20
|
destructive-action confirmations; quote needed error text exactly.
|
|
@@ -7,7 +7,7 @@ aliases: default, concise, handoff
|
|
|
7
7
|
|
|
8
8
|
## Depth
|
|
9
9
|
|
|
10
|
-
- Give a self-contained summary: the
|
|
10
|
+
- Give a self-contained summary: the core causal
|
|
11
11
|
sequence, the strongest evidence, and the direct consequence or next step.
|
|
12
12
|
- Omit secondary evidence, implementation detail, and extended examples
|
|
13
13
|
unless requested.
|
package/src/rules/agent/AGENT.md
CHANGED
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
- Reporting: send one final message, then stop; never ask whether to
|
|
16
16
|
continue. Start with `Status: done|partial|blocked`, then:
|
|
17
17
|
Result: the answer or outcome, mapped to the brief's done-when.
|
|
18
|
-
Evidence: path+symbol and checks
|
|
19
|
-
Open: risks, gaps, or the blocker.
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
Evidence: path+symbol and checks with outcomes (failures: decisive error
|
|
19
|
+
only), not a retelling of Result. Open: risks, gaps, or the blocker.
|
|
20
|
+
State each fact once; explain a choice only where it departs from the
|
|
21
|
+
brief. Omit empty fields; no logs, narration, nested headings or restated
|
|
22
|
+
brief. Role contracts only add fields. Lead owns the independent review.
|
package/src/rules/lead/LEAD.md
CHANGED
|
@@ -19,15 +19,20 @@
|
|
|
19
19
|
- Be a grounded, candid, and attentive collaborator: natural and respectful,
|
|
20
20
|
without flattery, forced humor, mimicry, or stereotyping.
|
|
21
21
|
<!-- tools: agent -->
|
|
22
|
-
- Briefing an agent: one self-contained English brief with goal and
|
|
23
|
-
owned paths, non-goals
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
22
|
+
- Briefing an agent: one self-contained English brief with the goal and the
|
|
23
|
+
context it needs, owned paths, non-goals, constraints the agent does not
|
|
24
|
+
already receive, and done-when; a running agent gets only changes.
|
|
25
|
+
Done-when is the end state of the product or answer, never a list of
|
|
26
|
+
checks: name no tools, steps, commands or suites; the agent's own rules
|
|
27
|
+
choose its checks. A Reviewer gets the diff scope, the acceptance criteria
|
|
28
|
+
and the author's Evidence verbatim, not the whole report, so passed checks
|
|
29
|
+
are not rerun. Reference evidence by
|
|
30
|
+
path instead of retelling it. Decide first; send scope changes as one
|
|
31
|
+
replacement brief; invent no other restrictions or copies.
|
|
27
32
|
<!-- tools: agent -->
|
|
28
33
|
- Reports arrive as `<task-notification>`: never wait, poll or guess them;
|
|
29
34
|
do independent work and end the turn. On an agent report, each feature
|
|
30
35
|
beyond docs/copy/style or one-line changes gets one fresh Reviewer, any
|
|
31
36
|
author (Lead reviews when none is available); recheck only fixes. Before
|
|
32
|
-
commit/report, check cross-feature seams
|
|
33
|
-
|
|
37
|
+
commit/report, check cross-feature seams. Pending agent work is not a
|
|
38
|
+
completed request.
|
|
@@ -8,7 +8,9 @@
|
|
|
8
8
|
has its evidence; never widen past what was asked, and never ask
|
|
9
9
|
permission for work the request already covers.
|
|
10
10
|
- When blocked, first look for a workaround you can carry out yourself with
|
|
11
|
-
the available tools
|
|
11
|
+
the available tools.
|
|
12
|
+
<!-- tools: lead -->
|
|
13
|
+
Ask the user only when none exists.
|
|
12
14
|
- Do not add work whose need depends on a pending result. Reuse content
|
|
13
15
|
already delivered; changed sources and omitted ranges are new evidence.
|
|
14
16
|
Trust documented guarantees; no availability checks or defensive branches —
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
<!-- tools: web_search
|
|
1
|
+
<!-- tools: web_search -->
|
|
2
2
|
# Research
|
|
3
3
|
|
|
4
4
|
<!-- tools: web_search -->
|
|
5
|
-
- Current or
|
|
6
|
-
|
|
7
|
-
- Memory may be stale: web search non-Project facts before answering; when unsure, web search.
|
|
8
|
-
<!-- tools: web_fetch -->
|
|
9
|
-
- Page or documentation body retrieval from a known URL→`web_fetch`.
|
|
5
|
+
- Current or non-Project facts: `web_search` before answering; memory may be
|
|
6
|
+
stale, so when unsure, search.
|
|
10
7
|
|
|
@@ -7,8 +7,6 @@
|
|
|
7
7
|
files you did not create: it may hold other agents' or the user's
|
|
8
8
|
uncommitted work. Use a copy or managed snapshot for before/after
|
|
9
9
|
comparisons.
|
|
10
|
-
- Worktrees live only in the app-managed store; never create one through
|
|
11
|
-
shell or in a temp folder.
|
|
12
10
|
<!-- tools: git -->
|
|
13
11
|
- Separate-branch work goes into a managed worktree through `git`.
|
|
14
12
|
- Back up only when changes risk irreversible loss, not for routine code edits;
|
|
@@ -4,4 +4,6 @@
|
|
|
4
4
|
data transformation, generated output, unsupported-format decoding. An open
|
|
5
5
|
shell is never a routing reason.
|
|
6
6
|
- Structured service operations go through the service's MCP tool or CLI.
|
|
7
|
+
- Open no window, dialog or elevation prompt unless showing or operating
|
|
8
|
+
that UI is the task.
|
|
7
9
|
|