@selesai/code 0.2.1 → 0.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config.d.ts +4 -15
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +5 -45
- package/dist/config.js.map +1 -1
- package/dist/core/agent-session.d.ts +1 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +8 -0
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/diagnostics.d.ts +1 -0
- package/dist/core/diagnostics.d.ts.map +1 -1
- package/dist/core/diagnostics.js.map +1 -1
- package/dist/core/model-registry.d.ts +4 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +101 -51
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/package-manager.d.ts +10 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +93 -8
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/package-manager.test.d.ts +2 -0
- package/dist/core/package-manager.test.d.ts.map +1 -0
- package/dist/core/package-manager.test.js +20 -0
- package/dist/core/package-manager.test.js.map +1 -0
- package/dist/core/resource-loader.d.ts +3 -0
- package/dist/core/resource-loader.d.ts.map +1 -1
- package/dist/core/resource-loader.js +10 -0
- package/dist/core/resource-loader.js.map +1 -1
- package/dist/core/settings-manager.d.ts +1 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/defaults/models.json +64 -113
- package/dist/extensions/caveman/caveman-instructions.cjs +39 -0
- package/dist/extensions/caveman/index.js +116 -0
- package/dist/extensions/caveman/package.json +8 -0
- package/dist/extensions/caveman/test/extension.test.js +185 -0
- package/dist/extensions/caveman/test/helpers.test.js +67 -0
- package/dist/extensions/copy-turn.ts +2 -2
- package/dist/extensions/pi-intercom/broker/broker.ts +2 -3
- package/dist/extensions/pi-intercom/broker/paths.ts +10 -5
- package/dist/extensions/pi-intercom/broker/spawn.ts +2 -3
- package/dist/extensions/pi-intercom/config.ts +2 -2
- package/dist/extensions/pi-intercom/index.ts +2 -2
- package/dist/extensions/pi-intercom/package.json +2 -2
- package/dist/extensions/pi-intercom/ui/compose.ts +3 -3
- package/dist/extensions/pi-intercom/ui/inline-message.ts +3 -3
- package/dist/extensions/pi-intercom/ui/session-list.ts +3 -3
- package/dist/extensions/pi-powerline-footer/bash-mode/editor.ts +2 -2
- package/dist/extensions/pi-powerline-footer/bash-mode/history.ts +2 -1
- package/dist/extensions/pi-powerline-footer/index.ts +40 -47
- package/dist/extensions/pi-powerline-footer/package.json +2 -2
- package/dist/extensions/pi-powerline-footer/tests/bash-mode.test.ts +10 -10
- package/dist/extensions/pi-powerline-footer/tests/jump-shortcuts.test.ts +1 -1
- package/dist/extensions/pi-powerline-footer/tests/working-vibes.test.ts +2 -2
- package/dist/extensions/pi-powerline-footer/theme.ts +6 -6
- package/dist/extensions/pi-powerline-footer/tps.ts +1 -1
- package/dist/extensions/pi-powerline-footer/types.ts +7 -7
- package/dist/extensions/pi-powerline-footer/welcome.ts +23 -16
- package/dist/extensions/pi-powerline-footer/working-vibes.ts +52 -59
- package/dist/extensions/pi-rewind-hook/index.ts +1 -1
- package/dist/extensions/pi-rewind-hook/package.json +1 -1
- package/dist/extensions/pi-subagents/README.md +224 -52
- package/dist/extensions/pi-subagents/agents/architect.md +188 -0
- package/dist/extensions/pi-subagents/agents/builder.md +120 -0
- package/dist/extensions/pi-subagents/agents/commentator.md +131 -0
- package/dist/extensions/pi-subagents/agents/explorer.md +51 -0
- package/dist/extensions/pi-subagents/agents/recapper.md +21 -0
- package/dist/extensions/pi-subagents/install.mjs +93 -0
- package/dist/extensions/pi-subagents/package.json +4 -5
- package/dist/extensions/pi-subagents/prompts/parallel-context-build.md +1 -1
- package/dist/extensions/pi-subagents/prompts/parallel-handoff-plan.md +1 -1
- package/dist/extensions/pi-subagents/skills/pi-subagents/SKILL.md +76 -13
- package/dist/extensions/pi-subagents/src/agents/agent-management.ts +179 -2
- package/dist/extensions/pi-subagents/src/agents/agent-memory.ts +254 -0
- package/dist/extensions/pi-subagents/src/agents/agent-serializer.ts +11 -0
- package/dist/extensions/pi-subagents/src/agents/agents.ts +193 -19
- package/dist/extensions/pi-subagents/src/agents/chain-serializer.ts +27 -2
- package/dist/extensions/pi-subagents/src/extension/config.ts +27 -4
- package/dist/extensions/pi-subagents/src/extension/doctor.ts +1 -7
- package/dist/extensions/pi-subagents/src/extension/fanout-child.ts +3 -2
- package/dist/extensions/pi-subagents/src/extension/index.ts +73 -71
- package/dist/extensions/pi-subagents/src/extension/rpc.ts +369 -0
- package/dist/extensions/pi-subagents/src/extension/schemas.ts +54 -10
- package/dist/extensions/pi-subagents/src/extension/tool-description.ts +200 -0
- package/dist/extensions/pi-subagents/src/intercom/intercom-bridge.ts +21 -253
- package/dist/extensions/pi-subagents/src/intercom/native-supervisor-channel.ts +519 -0
- package/dist/extensions/pi-subagents/src/profiles/profiles.ts +1 -1
- package/dist/extensions/pi-subagents/src/runs/background/async-execution.ts +195 -105
- package/dist/extensions/pi-subagents/src/runs/background/async-job-tracker.ts +88 -2
- package/dist/extensions/pi-subagents/src/runs/background/async-status.ts +67 -10
- package/dist/extensions/pi-subagents/src/runs/background/chain-root-attachment.ts +34 -4
- package/dist/extensions/pi-subagents/src/runs/background/completion-batcher.ts +166 -0
- package/dist/extensions/pi-subagents/src/runs/background/control-channel.ts +156 -1
- package/dist/extensions/pi-subagents/src/runs/background/fleet-view.ts +515 -0
- package/dist/extensions/pi-subagents/src/runs/background/notify.ts +161 -44
- package/dist/extensions/pi-subagents/src/runs/background/result-watcher.ts +1 -2
- package/dist/extensions/pi-subagents/src/runs/background/run-id-resolver.ts +3 -2
- package/dist/extensions/pi-subagents/src/runs/background/run-status.ts +167 -6
- package/dist/extensions/pi-subagents/src/runs/background/scheduled-runs.ts +514 -0
- package/dist/extensions/pi-subagents/src/runs/background/stale-run-reconciler.ts +28 -1
- package/dist/extensions/pi-subagents/src/runs/background/subagent-runner.ts +873 -204
- package/dist/extensions/pi-subagents/src/runs/background/wait.ts +353 -0
- package/dist/extensions/pi-subagents/src/runs/foreground/chain-execution.ts +123 -27
- package/dist/extensions/pi-subagents/src/runs/foreground/execution.ts +174 -70
- package/dist/extensions/pi-subagents/src/runs/foreground/subagent-executor.ts +569 -81
- package/dist/extensions/pi-subagents/src/runs/shared/acceptance.ts +45 -22
- package/dist/extensions/pi-subagents/src/runs/shared/completion-guard.ts +3 -1
- package/dist/extensions/pi-subagents/src/runs/shared/dynamic-fanout.ts +2 -2
- package/dist/extensions/pi-subagents/src/runs/shared/model-fallback.ts +172 -21
- package/dist/extensions/pi-subagents/src/runs/shared/model-scope.ts +128 -0
- package/dist/extensions/pi-subagents/src/runs/shared/nested-events.ts +89 -0
- package/dist/extensions/pi-subagents/src/runs/shared/parallel-utils.ts +50 -1
- package/dist/extensions/pi-subagents/src/runs/shared/pi-args.ts +35 -4
- package/dist/extensions/pi-subagents/src/runs/shared/pi-spawn.ts +63 -45
- package/dist/extensions/pi-subagents/src/runs/shared/single-output.ts +2 -0
- package/dist/extensions/pi-subagents/src/runs/shared/subagent-prompt-runtime.ts +125 -5
- package/dist/extensions/pi-subagents/src/runs/shared/tool-budget.ts +74 -0
- package/dist/extensions/pi-subagents/src/runs/shared/turn-budget.ts +52 -0
- package/dist/extensions/pi-subagents/src/runs/shared/worktree.ts +28 -5
- package/dist/extensions/pi-subagents/src/shared/artifacts.ts +16 -1
- package/dist/extensions/pi-subagents/src/shared/atomic-json.ts +15 -2
- package/dist/extensions/pi-subagents/src/shared/child-transcript.ts +212 -0
- package/dist/extensions/pi-subagents/src/shared/fork-context.ts +133 -22
- package/dist/extensions/pi-subagents/src/shared/settings.ts +3 -1
- package/dist/extensions/pi-subagents/src/shared/types.ts +197 -4
- package/dist/extensions/pi-subagents/src/shared/utils.ts +108 -17
- package/dist/extensions/pi-subagents/src/slash/prompt-workflows.ts +330 -0
- package/dist/extensions/pi-subagents/src/slash/slash-commands.ts +135 -4
- package/dist/extensions/pi-subagents/src/tui/render.ts +32 -12
- package/dist/extensions/pi-subagents/test/e2e/real-session-subagent.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/integration/async-execution.test.ts +2772 -0
- package/dist/extensions/pi-subagents/test/integration/async-job-tracker.test.ts +1107 -0
- package/dist/extensions/pi-subagents/test/integration/async-status.test.ts +463 -0
- package/dist/extensions/pi-subagents/test/integration/chain-clarify.test.ts +274 -0
- package/dist/extensions/pi-subagents/test/integration/chain-execution.test.ts +1535 -0
- package/dist/extensions/pi-subagents/test/integration/detect-error.test.ts +242 -0
- package/dist/extensions/pi-subagents/test/integration/doctor-executor.test.ts +128 -0
- package/dist/extensions/pi-subagents/test/integration/error-handling.test.ts +252 -0
- package/dist/extensions/pi-subagents/test/integration/foreground-result-size.test.ts +188 -0
- package/dist/extensions/pi-subagents/test/integration/fork-context-execution.test.ts +1306 -0
- package/dist/extensions/pi-subagents/test/integration/intercom-result-delivery.test.ts +1033 -0
- package/dist/extensions/pi-subagents/test/integration/parallel-execution.test.ts +397 -0
- package/dist/extensions/pi-subagents/test/integration/render-fork-badge.test.ts +583 -0
- package/dist/extensions/pi-subagents/test/integration/render-widget.test.ts +691 -0
- package/dist/extensions/pi-subagents/test/integration/result-watcher.test.ts +892 -0
- package/dist/extensions/pi-subagents/test/integration/session-tokens.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/integration/single-execution.test.ts +1824 -0
- package/dist/extensions/pi-subagents/test/integration/slash-commands.test.ts +1284 -0
- package/dist/extensions/pi-subagents/test/integration/slash-live-state.test.ts +127 -0
- package/dist/extensions/pi-subagents/test/integration/template-resolution.test.ts +299 -0
- package/dist/extensions/pi-subagents/test/integration/top-level-async.test.ts +37 -0
- package/dist/extensions/pi-subagents/test/support/helpers.ts +189 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi-script.mjs +335 -0
- package/dist/extensions/pi-subagents/test/support/mock-pi.ts +129 -0
- package/dist/extensions/pi-subagents/test/support/real-session-child-cli.mjs +184 -0
- package/dist/extensions/pi-subagents/test/support/real-session-runner.ts +285 -0
- package/dist/extensions/pi-subagents/test/support/register-loader.mjs +15 -0
- package/dist/extensions/pi-subagents/test/support/ts-loader.mjs +108 -0
- package/dist/extensions/pi-subagents/test/unit/acceptance.test.ts +421 -0
- package/dist/extensions/pi-subagents/test/unit/agent-disabled.test.ts +213 -0
- package/dist/extensions/pi-subagents/test/unit/agent-eject-disable.test.ts +343 -0
- package/dist/extensions/pi-subagents/test/unit/agent-frontmatter.test.ts +1199 -0
- package/dist/extensions/pi-subagents/test/unit/agent-management.test.ts +556 -0
- package/dist/extensions/pi-subagents/test/unit/agent-memory.test.ts +420 -0
- package/dist/extensions/pi-subagents/test/unit/agent-overrides.test.ts +579 -0
- package/dist/extensions/pi-subagents/test/unit/agent-scope.test.ts +20 -0
- package/dist/extensions/pi-subagents/test/unit/agent-selection.test.ts +88 -0
- package/dist/extensions/pi-subagents/test/unit/artifacts.test.ts +24 -0
- package/dist/extensions/pi-subagents/test/unit/async-execution.test.ts +86 -0
- package/dist/extensions/pi-subagents/test/unit/async-interrupt-action.test.ts +221 -0
- package/dist/extensions/pi-subagents/test/unit/async-permission-session.test.ts +98 -0
- package/dist/extensions/pi-subagents/test/unit/async-resume.test.ts +285 -0
- package/dist/extensions/pi-subagents/test/unit/atomic-json.test.ts +112 -0
- package/dist/extensions/pi-subagents/test/unit/chain-append.test.ts +206 -0
- package/dist/extensions/pi-subagents/test/unit/chain-root-attachment.test.ts +159 -0
- package/dist/extensions/pi-subagents/test/unit/chain-serializer.test.ts +229 -0
- package/dist/extensions/pi-subagents/test/unit/child-transcript.test.ts +225 -0
- package/dist/extensions/pi-subagents/test/unit/close-grace-timer.test.ts +101 -0
- package/dist/extensions/pi-subagents/test/unit/completion-batcher.test.ts +228 -0
- package/dist/extensions/pi-subagents/test/unit/completion-dedupe.test.ts +36 -0
- package/dist/extensions/pi-subagents/test/unit/completion-guard.test.ts +152 -0
- package/dist/extensions/pi-subagents/test/unit/config-dir-runtime.test.ts +72 -0
- package/dist/extensions/pi-subagents/test/unit/control-channel.test.ts +327 -0
- package/dist/extensions/pi-subagents/test/unit/control-notices.test.ts +161 -0
- package/dist/extensions/pi-subagents/test/unit/doctor.test.ts +159 -0
- package/dist/extensions/pi-subagents/test/unit/dynamic-fanout.test.ts +217 -0
- package/dist/extensions/pi-subagents/test/unit/extra-agent-dirs.test.ts +88 -0
- package/dist/extensions/pi-subagents/test/unit/file-coalescer.test.ts +68 -0
- package/dist/extensions/pi-subagents/test/unit/foreground-tool-call-compaction.test.ts +78 -0
- package/dist/extensions/pi-subagents/test/unit/fork-context.test.ts +415 -0
- package/dist/extensions/pi-subagents/test/unit/get-final-output.test.ts +126 -0
- package/dist/extensions/pi-subagents/test/unit/index-child-registration.test.ts +271 -0
- package/dist/extensions/pi-subagents/test/unit/intercom-bridge.test.ts +173 -0
- package/dist/extensions/pi-subagents/test/unit/jsonl-writer.test.ts +119 -0
- package/dist/extensions/pi-subagents/test/unit/live-async-resume.test.ts +170 -0
- package/dist/extensions/pi-subagents/test/unit/model-fallback.test.ts +346 -0
- package/dist/extensions/pi-subagents/test/unit/model-info.test.ts +62 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope-settings.test.ts +87 -0
- package/dist/extensions/pi-subagents/test/unit/model-scope.test.ts +145 -0
- package/dist/extensions/pi-subagents/test/unit/native-supervisor-channel.test.ts +162 -0
- package/dist/extensions/pi-subagents/test/unit/nested-control.test.ts +470 -0
- package/dist/extensions/pi-subagents/test/unit/nested-events.test.ts +329 -0
- package/dist/extensions/pi-subagents/test/unit/notify.test.ts +319 -0
- package/dist/extensions/pi-subagents/test/unit/package-manifest.test.ts +70 -0
- package/dist/extensions/pi-subagents/test/unit/parallel-utils.test.ts +247 -0
- package/dist/extensions/pi-subagents/test/unit/path-handling.test.ts +113 -0
- package/dist/extensions/pi-subagents/test/unit/path-resolution.test.ts +94 -0
- package/dist/extensions/pi-subagents/test/unit/pi-args.test.ts +803 -0
- package/dist/extensions/pi-subagents/test/unit/pi-coding-agent-dir.test.ts +209 -0
- package/dist/extensions/pi-subagents/test/unit/pi-spawn.test.ts +238 -0
- package/dist/extensions/pi-subagents/test/unit/proactive-skills.test.ts +118 -0
- package/dist/extensions/pi-subagents/test/unit/profiles.test.ts +299 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-template-bridge.test.ts +408 -0
- package/dist/extensions/pi-subagents/test/unit/prompt-workflows.test.ts +134 -0
- package/dist/extensions/pi-subagents/test/unit/recursion-guard.test.ts +257 -0
- package/dist/extensions/pi-subagents/test/unit/render-helpers.test.ts +209 -0
- package/dist/extensions/pi-subagents/test/unit/result-intercom.test.ts +226 -0
- package/dist/extensions/pi-subagents/test/unit/rpc.test.ts +294 -0
- package/dist/extensions/pi-subagents/test/unit/run-id-resolver.test.ts +147 -0
- package/dist/extensions/pi-subagents/test/unit/run-status.test.ts +997 -0
- package/dist/extensions/pi-subagents/test/unit/scheduled-runs.test.ts +478 -0
- package/dist/extensions/pi-subagents/test/unit/schemas.test.ts +562 -0
- package/dist/extensions/pi-subagents/test/unit/single-output.test.ts +213 -0
- package/dist/extensions/pi-subagents/test/unit/skills-fallback.test.ts +438 -0
- package/dist/extensions/pi-subagents/test/unit/slash-bridge.test.ts +54 -0
- package/dist/extensions/pi-subagents/test/unit/slash-chain-groups.test.ts +464 -0
- package/dist/extensions/pi-subagents/test/unit/stale-run-reconciler.test.ts +255 -0
- package/dist/extensions/pi-subagents/test/unit/status-format.test.ts +19 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-control.test.ts +245 -0
- package/dist/extensions/pi-subagents/test/unit/subagent-prompt-runtime.test.ts +517 -0
- package/dist/extensions/pi-subagents/test/unit/temp-paths.test.ts +72 -0
- package/dist/extensions/pi-subagents/test/unit/tool-budget.test.ts +52 -0
- package/dist/extensions/pi-subagents/test/unit/tool-description.test.ts +237 -0
- package/dist/extensions/pi-subagents/test/unit/total-cost.test.ts +60 -0
- package/dist/extensions/pi-subagents/test/unit/ts-loader.test.ts +33 -0
- package/dist/extensions/pi-subagents/test/unit/turn-budget.test.ts +202 -0
- package/dist/extensions/pi-subagents/test/unit/types-fork-preamble.test.ts +23 -0
- package/dist/extensions/pi-subagents/test/unit/wait.test.ts +398 -0
- package/dist/extensions/pi-subagents/test/unit/widget-nested-render.test.ts +88 -0
- package/dist/extensions/pi-subagents/test/unit/windows-hide-spawn.test.ts +26 -0
- package/dist/extensions/pi-subagents/test/unit/workflow-graph.test.ts +134 -0
- package/dist/extensions/pi-subagents/test/unit/worktree.test.ts +479 -0
- package/dist/extensions/pi-web-agent/package.json +2 -2
- package/dist/extensions/pi-web-agent/src/backends/settings-reader.ts +2 -2
- package/dist/extensions/pi-web-agent/src/changelog-notice.ts +5 -2
- package/dist/extensions/pi-web-agent/src/commands/web-agent-config.ts +1 -1
- package/dist/extensions/pi-web-agent/src/extension.ts +1 -1
- package/dist/extensions/pi-web-agent/src/presentation/config-store.ts +6 -4
- package/dist/extensions/question/helpers.ts +3 -3
- package/dist/extensions/question/index.ts +2 -2
- package/dist/extensions/question/navigation.ts +2 -2
- package/dist/extensions/question/package.json +2 -2
- package/dist/extensions/question/question-list.ts +2 -2
- package/dist/extensions/question/tests/question-list.test.ts +2 -2
- package/dist/extensions/question/tui-adapter.ts +2 -2
- package/dist/extensions/question/types.ts +2 -2
- package/dist/extensions/question/ui-protocol.ts +2 -2
- package/dist/extensions/rtk.ts +2 -2
- package/dist/extensions/tokenin-onboarding.ts +2 -2
- package/dist/extensions/undo.ts +1 -1
- package/dist/extensions/web-agent-onboarding.ts +3 -3
- package/dist/extensions/workflow/adapter.ts +16 -8
- package/dist/extensions/workflow/extension.ts +1 -1
- package/dist/extensions/workflow/package.json +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +4 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +2 -0
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts +1 -1
- package/dist/modes/interactive/components/first-time-setup.d.ts.map +1 -1
- package/dist/modes/interactive/components/first-time-setup.js +19 -5
- package/dist/modes/interactive/components/first-time-setup.js.map +1 -1
- package/dist/skills/caveman/SKILL.md +49 -0
- package/dist/skills/handoff-text/SKILL.md +13 -0
- package/dist/utils/thinking-tags.d.ts +7 -0
- package/dist/utils/thinking-tags.d.ts.map +1 -0
- package/dist/utils/thinking-tags.js +63 -0
- package/dist/utils/thinking-tags.js.map +1 -0
- package/docs/docs.json +4 -0
- package/docs/extensions.md +2 -0
- package/docs/settings.md +15 -0
- package/docs/shared-host-extensions.md +109 -0
- package/package.json +2 -2
|
@@ -0,0 +1,803 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import * as fs from "node:fs";
|
|
3
|
+
import * as os from "node:os";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { afterEach, describe, it } from "node:test";
|
|
6
|
+
import { computeMcpServerHash } from "../../src/runs/shared/mcp-direct-tool-allowlist.ts";
|
|
7
|
+
import { TOOL_BUDGET_ENV } from "../../src/runs/shared/tool-budget.ts";
|
|
8
|
+
import {
|
|
9
|
+
SUBAGENT_FANOUT_CHILD_ENV,
|
|
10
|
+
SUBAGENT_PARENT_CHILD_INDEX_ENV,
|
|
11
|
+
SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV,
|
|
12
|
+
SUBAGENT_PARENT_CONTROL_INBOX_ENV,
|
|
13
|
+
SUBAGENT_PARENT_DEPTH_ENV,
|
|
14
|
+
SUBAGENT_PARENT_EVENT_SINK_ENV,
|
|
15
|
+
SUBAGENT_PARENT_PATH_ENV,
|
|
16
|
+
SUBAGENT_PARENT_ROOT_RUN_ID_ENV,
|
|
17
|
+
SUBAGENT_PARENT_RUN_ID_ENV,
|
|
18
|
+
SUBAGENT_PARENT_SESSION_ENV,
|
|
19
|
+
SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV,
|
|
20
|
+
SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV,
|
|
21
|
+
SUBAGENT_RUN_ID_ENV,
|
|
22
|
+
applyThinkingSuffix,
|
|
23
|
+
buildPiArgs,
|
|
24
|
+
} from "../../src/runs/shared/pi-args.ts";
|
|
25
|
+
|
|
26
|
+
const originalEnv = {
|
|
27
|
+
HOME: process.env.HOME,
|
|
28
|
+
USERPROFILE: process.env.USERPROFILE,
|
|
29
|
+
SELESAI_CODING_AGENT_DIR: process.env.SELESAI_CODING_AGENT_DIR,
|
|
30
|
+
SELESAI_SUBAGENT_FANOUT_CHILD: process.env.SELESAI_SUBAGENT_FANOUT_CHILD,
|
|
31
|
+
SELESAI_SUBAGENT_PARENT_EVENT_SINK: process.env.SELESAI_SUBAGENT_PARENT_EVENT_SINK,
|
|
32
|
+
SELESAI_SUBAGENT_PARENT_CONTROL_INBOX: process.env.SELESAI_SUBAGENT_PARENT_CONTROL_INBOX,
|
|
33
|
+
SELESAI_SUBAGENT_PARENT_ROOT_RUN_ID: process.env.SELESAI_SUBAGENT_PARENT_ROOT_RUN_ID,
|
|
34
|
+
SELESAI_SUBAGENT_PARENT_RUN_ID: process.env.SELESAI_SUBAGENT_PARENT_RUN_ID,
|
|
35
|
+
SELESAI_SUBAGENT_PARENT_CHILD_INDEX: process.env.SELESAI_SUBAGENT_PARENT_CHILD_INDEX,
|
|
36
|
+
SELESAI_SUBAGENT_PARENT_DEPTH: process.env.SELESAI_SUBAGENT_PARENT_DEPTH,
|
|
37
|
+
SELESAI_SUBAGENT_PARENT_PATH: process.env.SELESAI_SUBAGENT_PARENT_PATH,
|
|
38
|
+
SELESAI_SUBAGENT_PARENT_CAPABILITY_TOKEN: process.env.SELESAI_SUBAGENT_PARENT_CAPABILITY_TOKEN,
|
|
39
|
+
SELESAI_SUBAGENT_PARENT_SESSION: process.env.SELESAI_SUBAGENT_PARENT_SESSION,
|
|
40
|
+
SELESAI_SUBAGENT_RUN_ID: process.env.SELESAI_SUBAGENT_RUN_ID,
|
|
41
|
+
};
|
|
42
|
+
const originalCwd = process.cwd();
|
|
43
|
+
const tempRoots: string[] = [];
|
|
44
|
+
|
|
45
|
+
interface McpFixture {
|
|
46
|
+
root: string;
|
|
47
|
+
agentDir: string;
|
|
48
|
+
projectDir: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function createMcpFixture(): McpFixture {
|
|
52
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "pi-args-mcp-"));
|
|
53
|
+
tempRoots.push(root);
|
|
54
|
+
const home = path.join(root, "home");
|
|
55
|
+
const agentDir = path.join(home, ".selesai", "agent");
|
|
56
|
+
const projectDir = path.join(root, "project");
|
|
57
|
+
fs.mkdirSync(agentDir, { recursive: true });
|
|
58
|
+
fs.mkdirSync(projectDir, { recursive: true });
|
|
59
|
+
process.env.HOME = home;
|
|
60
|
+
process.env.USERPROFILE = home;
|
|
61
|
+
process.env.SELESAI_CODING_AGENT_DIR = agentDir;
|
|
62
|
+
process.chdir(projectDir);
|
|
63
|
+
return { root, agentDir, projectDir };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function writeJson(filePath: string, value: unknown): void {
|
|
67
|
+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
|
|
68
|
+
fs.writeFileSync(filePath, JSON.stringify(value, null, 2), "utf-8");
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function writeMcpFixture(
|
|
72
|
+
fixture: McpFixture,
|
|
73
|
+
options: {
|
|
74
|
+
serverName?: string;
|
|
75
|
+
definition?: Record<string, unknown>;
|
|
76
|
+
settings?: Record<string, unknown>;
|
|
77
|
+
tools?: Array<{ name: string; description?: string }>;
|
|
78
|
+
resources?: Array<{ name: string; uri: string; description?: string }>;
|
|
79
|
+
configPath?: string;
|
|
80
|
+
cachedAt?: number;
|
|
81
|
+
} = {},
|
|
82
|
+
): void {
|
|
83
|
+
const serverName = options.serverName ?? "chrome-devtools";
|
|
84
|
+
const definition = { command: "npx", args: ["chrome-devtools-mcp"], ...(options.definition ?? {}) };
|
|
85
|
+
writeJson(options.configPath ?? path.join(fixture.agentDir, "mcp.json"), {
|
|
86
|
+
...(options.settings ? { settings: options.settings } : {}),
|
|
87
|
+
mcpServers: {
|
|
88
|
+
[serverName]: definition,
|
|
89
|
+
},
|
|
90
|
+
});
|
|
91
|
+
writeJson(path.join(fixture.agentDir, "mcp-cache.json"), {
|
|
92
|
+
version: 1,
|
|
93
|
+
servers: {
|
|
94
|
+
[serverName]: {
|
|
95
|
+
configHash: computeMcpServerHash(definition),
|
|
96
|
+
cachedAt: options.cachedAt ?? Date.now(),
|
|
97
|
+
tools: options.tools ?? [
|
|
98
|
+
{ name: "take_screenshot" },
|
|
99
|
+
{ name: "click" },
|
|
100
|
+
],
|
|
101
|
+
resources: options.resources ?? [],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
afterEach(() => {
|
|
108
|
+
process.chdir(originalCwd);
|
|
109
|
+
for (const [key, value] of Object.entries(originalEnv)) {
|
|
110
|
+
if (value === undefined) {
|
|
111
|
+
delete process.env[key];
|
|
112
|
+
} else {
|
|
113
|
+
process.env[key] = value;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
for (const root of tempRoots.splice(0)) {
|
|
117
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
describe("buildPiArgs session wiring", () => {
|
|
122
|
+
it("uses --session when sessionFile is provided", () => {
|
|
123
|
+
const tempDir = fs.mkdtempSync(path.join(os.tmpdir(), "pi-args-session-"));
|
|
124
|
+
try {
|
|
125
|
+
const sessionFile = path.join(tempDir, "nested", "session.jsonl");
|
|
126
|
+
const { args } = buildPiArgs({
|
|
127
|
+
baseArgs: ["-p"],
|
|
128
|
+
task: "hello",
|
|
129
|
+
sessionEnabled: true,
|
|
130
|
+
sessionFile,
|
|
131
|
+
sessionDir: "/tmp/should-not-be-used",
|
|
132
|
+
inheritProjectContext: false,
|
|
133
|
+
inheritSkills: false,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
assert.ok(args.includes("--session"));
|
|
137
|
+
assert.ok(args.includes(sessionFile));
|
|
138
|
+
assert.ok(fs.existsSync(path.dirname(sessionFile)));
|
|
139
|
+
assert.ok(!args.includes("--session-dir"), "--session-dir should not be emitted with --session");
|
|
140
|
+
assert.ok(!args.includes("--no-session"), "--no-session should not be emitted with --session");
|
|
141
|
+
} finally {
|
|
142
|
+
fs.rmSync(tempDir, { recursive: true, force: true });
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
it("keeps fresh mode behavior (sessionDir + no session file)", () => {
|
|
147
|
+
const { args } = buildPiArgs({
|
|
148
|
+
baseArgs: ["-p"],
|
|
149
|
+
task: "hello",
|
|
150
|
+
sessionEnabled: true,
|
|
151
|
+
sessionDir: "/tmp/subagent-sessions",
|
|
152
|
+
inheritProjectContext: false,
|
|
153
|
+
inheritSkills: false,
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
assert.ok(args.includes("--session-dir"));
|
|
157
|
+
assert.ok(args.includes("/tmp/subagent-sessions"));
|
|
158
|
+
assert.ok(!args.includes("--session"));
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it("emits explicit parent session env for permission forwarding", () => {
|
|
162
|
+
process.env.SELESAI_SUBAGENT_PARENT_SESSION = "inherited-parent";
|
|
163
|
+
const { env } = buildPiArgs({
|
|
164
|
+
parentSessionId: "direct-parent",
|
|
165
|
+
baseArgs: ["-p"],
|
|
166
|
+
task: "hello",
|
|
167
|
+
sessionEnabled: false,
|
|
168
|
+
inheritProjectContext: false,
|
|
169
|
+
inheritSkills: false,
|
|
170
|
+
});
|
|
171
|
+
|
|
172
|
+
assert.equal(env[SUBAGENT_PARENT_SESSION_ENV], "direct-parent");
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
it("falls back to inherited parent session env for permission forwarding", () => {
|
|
176
|
+
process.env.SELESAI_SUBAGENT_PARENT_SESSION = "inherited-parent";
|
|
177
|
+
const { env } = buildPiArgs({
|
|
178
|
+
baseArgs: ["-p"],
|
|
179
|
+
task: "hello",
|
|
180
|
+
sessionEnabled: false,
|
|
181
|
+
inheritProjectContext: false,
|
|
182
|
+
inheritSkills: false,
|
|
183
|
+
});
|
|
184
|
+
|
|
185
|
+
assert.equal(env[SUBAGENT_PARENT_SESSION_ENV], "inherited-parent");
|
|
186
|
+
});
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
describe("buildPiArgs model wiring", () => {
|
|
190
|
+
it("uses --model for provider-qualified model ids", () => {
|
|
191
|
+
const { args } = buildPiArgs({
|
|
192
|
+
baseArgs: ["-p"],
|
|
193
|
+
task: "hello",
|
|
194
|
+
sessionEnabled: false,
|
|
195
|
+
model: "openai-codex/gpt-5.4-mini",
|
|
196
|
+
inheritProjectContext: false,
|
|
197
|
+
inheritSkills: false,
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
assert.ok(args.includes("--model"));
|
|
201
|
+
assert.ok(args.includes("openai-codex/gpt-5.4-mini"));
|
|
202
|
+
assert.ok(!args.includes("--models"));
|
|
203
|
+
});
|
|
204
|
+
|
|
205
|
+
it("uses --model for bare model ids too", () => {
|
|
206
|
+
const { args } = buildPiArgs({
|
|
207
|
+
baseArgs: ["-p"],
|
|
208
|
+
task: "hello",
|
|
209
|
+
sessionEnabled: false,
|
|
210
|
+
model: "kimi-k2.5",
|
|
211
|
+
inheritProjectContext: false,
|
|
212
|
+
inheritSkills: false,
|
|
213
|
+
});
|
|
214
|
+
|
|
215
|
+
assert.ok(args.includes("--model"));
|
|
216
|
+
assert.ok(args.includes("kimi-k2.5"));
|
|
217
|
+
assert.ok(!args.includes("--models"));
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
it("preserves thinking suffixes on model args", () => {
|
|
222
|
+
const { args } = buildPiArgs({
|
|
223
|
+
baseArgs: ["-p"],
|
|
224
|
+
task: "hello",
|
|
225
|
+
sessionEnabled: false,
|
|
226
|
+
model: "openai-codex/gpt-5.4-mini",
|
|
227
|
+
thinking: "high",
|
|
228
|
+
inheritProjectContext: false,
|
|
229
|
+
inheritSkills: false,
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
assert.equal(applyThinkingSuffix("openai-codex/gpt-5.4-mini", "high"), "openai-codex/gpt-5.4-mini:high");
|
|
233
|
+
assert.ok(args.includes("--model"));
|
|
234
|
+
assert.ok(args.includes("openai-codex/gpt-5.4-mini:high"));
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
it("passes explicit thinking off through to the model arg", () => {
|
|
238
|
+
const { args } = buildPiArgs({
|
|
239
|
+
baseArgs: ["-p"],
|
|
240
|
+
task: "hello",
|
|
241
|
+
sessionEnabled: false,
|
|
242
|
+
model: "anthropic/claude-haiku-4-5",
|
|
243
|
+
thinking: "off",
|
|
244
|
+
inheritProjectContext: false,
|
|
245
|
+
inheritSkills: false,
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
assert.equal(applyThinkingSuffix("anthropic/claude-haiku-4-5", "off"), "anthropic/claude-haiku-4-5:off");
|
|
249
|
+
assert.equal(applyThinkingSuffix("anthropic/claude-haiku-4-5:high", "off", true), "anthropic/claude-haiku-4-5:off");
|
|
250
|
+
assert.ok(args.includes("--model"));
|
|
251
|
+
assert.ok(args.includes("anthropic/claude-haiku-4-5:off"));
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
it("leaves provider-specific model suffixes untouched when thinking is disabled", () => {
|
|
255
|
+
const model = "openai-compatible/qwen2.5-coder:7b";
|
|
256
|
+
const { args } = buildPiArgs({
|
|
257
|
+
baseArgs: ["-p"],
|
|
258
|
+
task: "hello",
|
|
259
|
+
sessionEnabled: false,
|
|
260
|
+
model,
|
|
261
|
+
inheritProjectContext: false,
|
|
262
|
+
inheritSkills: false,
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
assert.ok(args.includes("--model"));
|
|
266
|
+
assert.ok(args.includes(model));
|
|
267
|
+
assert.ok(!args.includes(`${model}:high`));
|
|
268
|
+
});
|
|
269
|
+
});
|
|
270
|
+
|
|
271
|
+
describe("buildPiArgs system prompt mode wiring", () => {
|
|
272
|
+
it("uses --append-system-prompt by default", () => {
|
|
273
|
+
const { args } = buildPiArgs({
|
|
274
|
+
baseArgs: ["-p"],
|
|
275
|
+
task: "hello",
|
|
276
|
+
sessionEnabled: false,
|
|
277
|
+
systemPrompt: "You are a worker",
|
|
278
|
+
inheritProjectContext: false,
|
|
279
|
+
inheritSkills: false,
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
assert.ok(args.includes("--append-system-prompt"));
|
|
283
|
+
assert.ok(!args.includes("--system-prompt"));
|
|
284
|
+
});
|
|
285
|
+
|
|
286
|
+
it("uses --system-prompt when systemPromptMode=replace", () => {
|
|
287
|
+
const { args } = buildPiArgs({
|
|
288
|
+
baseArgs: ["-p"],
|
|
289
|
+
task: "hello",
|
|
290
|
+
sessionEnabled: false,
|
|
291
|
+
systemPrompt: "You are a worker",
|
|
292
|
+
systemPromptMode: "replace",
|
|
293
|
+
inheritProjectContext: false,
|
|
294
|
+
inheritSkills: false,
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
assert.ok(args.includes("--system-prompt"));
|
|
298
|
+
assert.ok(!args.includes("--append-system-prompt"));
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it("injects the subagent prompt runtime extension and env flags", () => {
|
|
302
|
+
const { args, env } = buildPiArgs({
|
|
303
|
+
baseArgs: ["-p"],
|
|
304
|
+
task: "hello",
|
|
305
|
+
sessionEnabled: false,
|
|
306
|
+
inheritProjectContext: false,
|
|
307
|
+
inheritSkills: true,
|
|
308
|
+
});
|
|
309
|
+
|
|
310
|
+
const extensionArgs = args.filter((arg, index) => args[index - 1] === "--extension");
|
|
311
|
+
assert.ok(extensionArgs.some((arg) => arg.endsWith(path.join("src", "runs", "shared", "subagent-prompt-runtime.ts"))));
|
|
312
|
+
assert.equal(env.SELESAI_SUBAGENT_CHILD, "1");
|
|
313
|
+
assert.equal(env.SELESAI_SUBAGENT_INHERIT_PROJECT_CONTEXT, "0");
|
|
314
|
+
assert.equal(env.SELESAI_SUBAGENT_INHERIT_SKILLS, "1");
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
it("passes tool budget through env", () => {
|
|
318
|
+
const { env } = buildPiArgs({
|
|
319
|
+
baseArgs: ["-p"],
|
|
320
|
+
task: "hello",
|
|
321
|
+
sessionEnabled: false,
|
|
322
|
+
inheritProjectContext: false,
|
|
323
|
+
inheritSkills: false,
|
|
324
|
+
toolBudget: { soft: 2, hard: 3, block: ["read"] },
|
|
325
|
+
});
|
|
326
|
+
|
|
327
|
+
assert.deepEqual(JSON.parse(env[TOOL_BUDGET_ENV] ?? "{}"), { soft: 2, hard: 3, block: ["read"] });
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
it("passes child intercom and orchestrator metadata through env", () => {
|
|
331
|
+
const { env } = buildPiArgs({
|
|
332
|
+
baseArgs: ["-p"],
|
|
333
|
+
task: "hello",
|
|
334
|
+
sessionEnabled: false,
|
|
335
|
+
inheritProjectContext: true,
|
|
336
|
+
inheritSkills: true,
|
|
337
|
+
intercomSessionName: "subagent-worker-78f659a3",
|
|
338
|
+
orchestratorIntercomTarget: "subagent-chat-parent",
|
|
339
|
+
parentSessionId: "session-parent-123",
|
|
340
|
+
runId: "78f659a3",
|
|
341
|
+
childAgentName: "worker",
|
|
342
|
+
childIndex: 2,
|
|
343
|
+
});
|
|
344
|
+
|
|
345
|
+
assert.equal(env.SELESAI_SUBAGENT_INTERCOM_SESSION_NAME, "subagent-worker-78f659a3");
|
|
346
|
+
assert.equal(env.SELESAI_SUBAGENT_ORCHESTRATOR_TARGET, "subagent-chat-parent");
|
|
347
|
+
assert.equal(env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV], "session-parent-123");
|
|
348
|
+
assert.equal(env.SELESAI_SUBAGENT_RUN_ID, "78f659a3");
|
|
349
|
+
assert.equal(env.SELESAI_SUBAGENT_CHILD_AGENT, "worker");
|
|
350
|
+
assert.equal(env.SELESAI_SUBAGENT_CHILD_INDEX, "2");
|
|
351
|
+
assert.equal(typeof env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV], "string");
|
|
352
|
+
assert.match(env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV] ?? "", /supervisor-channels/);
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
it("does not create a supervisor channel without an exact parent session id", () => {
|
|
356
|
+
const { env } = buildPiArgs({
|
|
357
|
+
baseArgs: ["-p"],
|
|
358
|
+
task: "hello",
|
|
359
|
+
sessionEnabled: false,
|
|
360
|
+
inheritProjectContext: true,
|
|
361
|
+
inheritSkills: true,
|
|
362
|
+
orchestratorIntercomTarget: "subagent-chat-parent",
|
|
363
|
+
runId: "78f659a3",
|
|
364
|
+
childAgentName: "worker",
|
|
365
|
+
childIndex: 2,
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
assert.equal(env[SUBAGENT_ORCHESTRATOR_SESSION_ID_ENV], undefined);
|
|
369
|
+
assert.equal(env[SUBAGENT_SUPERVISOR_CHANNEL_DIR_ENV], undefined);
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
it("emits explicit builtin tool allowlists", () => {
|
|
373
|
+
const { args } = buildPiArgs({
|
|
374
|
+
baseArgs: ["-p"],
|
|
375
|
+
task: "hello",
|
|
376
|
+
sessionEnabled: false,
|
|
377
|
+
inheritProjectContext: false,
|
|
378
|
+
inheritSkills: false,
|
|
379
|
+
tools: ["read", "grep", "find", "ls", "bash", "edit", "write", "contact_supervisor"],
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
const toolsArg = args[args.indexOf("--tools") + 1];
|
|
383
|
+
assert.equal(toolsArg, "read,grep,find,ls,bash,edit,write,contact_supervisor");
|
|
384
|
+
});
|
|
385
|
+
|
|
386
|
+
it("adds read to explicit tool allowlists when skills must be loaded lazily", () => {
|
|
387
|
+
const { args } = buildPiArgs({
|
|
388
|
+
baseArgs: ["-p"],
|
|
389
|
+
task: "hello",
|
|
390
|
+
sessionEnabled: false,
|
|
391
|
+
inheritProjectContext: false,
|
|
392
|
+
inheritSkills: false,
|
|
393
|
+
requireReadTool: true,
|
|
394
|
+
tools: ["bash"],
|
|
395
|
+
});
|
|
396
|
+
|
|
397
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read,bash");
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
it("does not duplicate read in explicit tool allowlists for lazy skills", () => {
|
|
401
|
+
const { args } = buildPiArgs({
|
|
402
|
+
baseArgs: ["-p"],
|
|
403
|
+
task: "hello",
|
|
404
|
+
sessionEnabled: false,
|
|
405
|
+
inheritProjectContext: false,
|
|
406
|
+
inheritSkills: false,
|
|
407
|
+
requireReadTool: true,
|
|
408
|
+
tools: ["read", "bash"],
|
|
409
|
+
});
|
|
410
|
+
|
|
411
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read,bash");
|
|
412
|
+
});
|
|
413
|
+
|
|
414
|
+
it("augments explicit builtin allowlists with selected direct MCP tool names", () => {
|
|
415
|
+
const fixture = createMcpFixture();
|
|
416
|
+
writeMcpFixture(fixture);
|
|
417
|
+
|
|
418
|
+
const { args, env } = buildPiArgs({
|
|
419
|
+
baseArgs: ["-p"],
|
|
420
|
+
task: "hello",
|
|
421
|
+
sessionEnabled: false,
|
|
422
|
+
inheritProjectContext: false,
|
|
423
|
+
inheritSkills: false,
|
|
424
|
+
tools: ["read", "bash"],
|
|
425
|
+
mcpDirectTools: ["chrome-devtools"],
|
|
426
|
+
});
|
|
427
|
+
|
|
428
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read,bash,chrome_devtools_take_screenshot,chrome_devtools_click");
|
|
429
|
+
assert.equal(env.MCP_DIRECT_TOOLS, "chrome-devtools");
|
|
430
|
+
});
|
|
431
|
+
|
|
432
|
+
it("preserves no --tools for MCP-only agents", () => {
|
|
433
|
+
const fixture = createMcpFixture();
|
|
434
|
+
writeMcpFixture(fixture);
|
|
435
|
+
|
|
436
|
+
const { args, env } = buildPiArgs({
|
|
437
|
+
baseArgs: ["-p"],
|
|
438
|
+
task: "hello",
|
|
439
|
+
sessionEnabled: false,
|
|
440
|
+
inheritProjectContext: false,
|
|
441
|
+
inheritSkills: false,
|
|
442
|
+
mcpDirectTools: ["chrome-devtools"],
|
|
443
|
+
});
|
|
444
|
+
|
|
445
|
+
assert.equal(args.includes("--tools"), false);
|
|
446
|
+
assert.equal(env.MCP_DIRECT_TOOLS, "chrome-devtools");
|
|
447
|
+
});
|
|
448
|
+
|
|
449
|
+
it("supports direct MCP server/tool filters", () => {
|
|
450
|
+
const fixture = createMcpFixture();
|
|
451
|
+
writeMcpFixture(fixture, {
|
|
452
|
+
serverName: "github",
|
|
453
|
+
definition: { command: "github-mcp" },
|
|
454
|
+
tools: [{ name: "search_repositories" }, { name: "create_issue" }],
|
|
455
|
+
});
|
|
456
|
+
|
|
457
|
+
const { args } = buildPiArgs({
|
|
458
|
+
baseArgs: ["-p"],
|
|
459
|
+
task: "hello",
|
|
460
|
+
sessionEnabled: false,
|
|
461
|
+
inheritProjectContext: false,
|
|
462
|
+
inheritSkills: false,
|
|
463
|
+
tools: ["read"],
|
|
464
|
+
mcpDirectTools: ["github/search_repositories"],
|
|
465
|
+
});
|
|
466
|
+
|
|
467
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read,github_search_repositories");
|
|
468
|
+
});
|
|
469
|
+
|
|
470
|
+
it("matches adapter prefix modes for direct MCP names", () => {
|
|
471
|
+
for (const [prefix, expected] of [
|
|
472
|
+
["server", "read,linear_mcp_list_issues"],
|
|
473
|
+
["short", "read,linear_list_issues"],
|
|
474
|
+
["none", "read,list_issues"],
|
|
475
|
+
] as const) {
|
|
476
|
+
const fixture = createMcpFixture();
|
|
477
|
+
writeMcpFixture(fixture, {
|
|
478
|
+
serverName: "linear-mcp",
|
|
479
|
+
settings: { toolPrefix: prefix },
|
|
480
|
+
tools: [{ name: "list_issues" }],
|
|
481
|
+
});
|
|
482
|
+
|
|
483
|
+
const { args } = buildPiArgs({
|
|
484
|
+
baseArgs: ["-p"],
|
|
485
|
+
task: "hello",
|
|
486
|
+
sessionEnabled: false,
|
|
487
|
+
inheritProjectContext: false,
|
|
488
|
+
inheritSkills: false,
|
|
489
|
+
tools: ["read"],
|
|
490
|
+
mcpDirectTools: ["linear-mcp"],
|
|
491
|
+
});
|
|
492
|
+
|
|
493
|
+
assert.equal(args[args.indexOf("--tools") + 1], expected);
|
|
494
|
+
}
|
|
495
|
+
});
|
|
496
|
+
|
|
497
|
+
it("includes resource tools and respects excludeTools", () => {
|
|
498
|
+
const fixture = createMcpFixture();
|
|
499
|
+
writeMcpFixture(fixture, {
|
|
500
|
+
serverName: "browser-mcp",
|
|
501
|
+
definition: { excludeTools: ["browser_click"] },
|
|
502
|
+
tools: [{ name: "click" }, { name: "navigate" }],
|
|
503
|
+
resources: [{ name: "Console Logs", uri: "resource://console" }],
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
const { args } = buildPiArgs({
|
|
507
|
+
baseArgs: ["-p"],
|
|
508
|
+
task: "hello",
|
|
509
|
+
sessionEnabled: false,
|
|
510
|
+
inheritProjectContext: false,
|
|
511
|
+
inheritSkills: false,
|
|
512
|
+
tools: ["read"],
|
|
513
|
+
mcpDirectTools: ["browser-mcp"],
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read,browser_mcp_navigate,browser_mcp_get_console_logs");
|
|
517
|
+
});
|
|
518
|
+
|
|
519
|
+
it("falls back to explicit builtins when direct MCP cache or config is missing or invalid", () => {
|
|
520
|
+
const missingFixture = createMcpFixture();
|
|
521
|
+
writeJson(path.join(missingFixture.agentDir, "mcp.json"), {
|
|
522
|
+
mcpServers: { "chrome-devtools": { command: "npx", args: ["chrome-devtools-mcp"] } },
|
|
523
|
+
});
|
|
524
|
+
const missingCache = buildPiArgs({
|
|
525
|
+
baseArgs: ["-p"],
|
|
526
|
+
task: "hello",
|
|
527
|
+
sessionEnabled: false,
|
|
528
|
+
inheritProjectContext: false,
|
|
529
|
+
inheritSkills: false,
|
|
530
|
+
tools: ["read", "bash"],
|
|
531
|
+
mcpDirectTools: ["chrome-devtools"],
|
|
532
|
+
});
|
|
533
|
+
assert.equal(missingCache.args[missingCache.args.indexOf("--tools") + 1], "read,bash");
|
|
534
|
+
|
|
535
|
+
const invalidFixture = createMcpFixture();
|
|
536
|
+
writeMcpFixture(invalidFixture, { cachedAt: Date.now() - 8 * 24 * 60 * 60 * 1000 });
|
|
537
|
+
const staleCache = buildPiArgs({
|
|
538
|
+
baseArgs: ["-p"],
|
|
539
|
+
task: "hello",
|
|
540
|
+
sessionEnabled: false,
|
|
541
|
+
inheritProjectContext: false,
|
|
542
|
+
inheritSkills: false,
|
|
543
|
+
tools: ["read", "bash"],
|
|
544
|
+
mcpDirectTools: ["chrome-devtools"],
|
|
545
|
+
});
|
|
546
|
+
assert.equal(staleCache.args[staleCache.args.indexOf("--tools") + 1], "read,bash");
|
|
547
|
+
});
|
|
548
|
+
|
|
549
|
+
it("resolves project MCP config from the child cwd and expands SELESAI_CODING_AGENT_DIR", () => {
|
|
550
|
+
const fixture = createMcpFixture();
|
|
551
|
+
process.env.SELESAI_CODING_AGENT_DIR = "~/.pi/agent";
|
|
552
|
+
process.chdir(fixture.root);
|
|
553
|
+
writeMcpFixture(fixture, {
|
|
554
|
+
serverName: "project-mcp",
|
|
555
|
+
configPath: path.join(fixture.projectDir, ".mcp.json"),
|
|
556
|
+
tools: [{ name: "inspect" }],
|
|
557
|
+
});
|
|
558
|
+
|
|
559
|
+
const { args } = buildPiArgs({
|
|
560
|
+
baseArgs: ["-p"],
|
|
561
|
+
task: "hello",
|
|
562
|
+
sessionEnabled: false,
|
|
563
|
+
inheritProjectContext: false,
|
|
564
|
+
inheritSkills: false,
|
|
565
|
+
tools: ["read"],
|
|
566
|
+
mcpDirectTools: ["project-mcp"],
|
|
567
|
+
cwd: fixture.projectDir,
|
|
568
|
+
});
|
|
569
|
+
|
|
570
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read,project_mcp_inspect");
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
it("keeps tool extension paths when explicit extensions are allowlisted", () => {
|
|
574
|
+
const fixture = createMcpFixture();
|
|
575
|
+
writeMcpFixture(fixture, { tools: [{ name: "take_screenshot" }] });
|
|
576
|
+
|
|
577
|
+
const { args } = buildPiArgs({
|
|
578
|
+
baseArgs: ["-p"],
|
|
579
|
+
task: "hello",
|
|
580
|
+
sessionEnabled: false,
|
|
581
|
+
inheritProjectContext: false,
|
|
582
|
+
inheritSkills: false,
|
|
583
|
+
tools: ["read", "./custom-tool.ts"],
|
|
584
|
+
extensions: ["./allowed-ext.ts"],
|
|
585
|
+
mcpDirectTools: ["chrome-devtools"],
|
|
586
|
+
});
|
|
587
|
+
|
|
588
|
+
const extensionArgs = args.filter((arg, index) => args[index - 1] === "--extension");
|
|
589
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read,chrome_devtools_take_screenshot");
|
|
590
|
+
assert.ok(extensionArgs.some((arg) => arg.endsWith(path.join("src", "runs", "shared", "subagent-prompt-runtime.ts"))));
|
|
591
|
+
assert.ok(extensionArgs.includes("./custom-tool.ts"));
|
|
592
|
+
assert.ok(extensionArgs.includes("./allowed-ext.ts"));
|
|
593
|
+
});
|
|
594
|
+
|
|
595
|
+
it("loads subagent-only extension paths only through child process extension args", () => {
|
|
596
|
+
const { args } = buildPiArgs({
|
|
597
|
+
baseArgs: ["-p"],
|
|
598
|
+
task: "hello",
|
|
599
|
+
sessionEnabled: false,
|
|
600
|
+
inheritProjectContext: false,
|
|
601
|
+
inheritSkills: false,
|
|
602
|
+
tools: ["read"],
|
|
603
|
+
extensions: ["./main-allowed-ext.ts"],
|
|
604
|
+
subagentOnlyExtensions: ["./child-tool.ts"],
|
|
605
|
+
});
|
|
606
|
+
|
|
607
|
+
const extensionArgs = args.filter((arg, index) => args[index - 1] === "--extension");
|
|
608
|
+
assert.ok(args.includes("--no-extensions"));
|
|
609
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read");
|
|
610
|
+
assert.ok(extensionArgs.includes("./main-allowed-ext.ts"));
|
|
611
|
+
assert.ok(extensionArgs.includes("./child-tool.ts"));
|
|
612
|
+
});
|
|
613
|
+
|
|
614
|
+
it("authorizes child fanout only from exact declared builtin subagent", () => {
|
|
615
|
+
const { args, env } = buildPiArgs({
|
|
616
|
+
baseArgs: ["-p"],
|
|
617
|
+
task: "hello",
|
|
618
|
+
sessionEnabled: false,
|
|
619
|
+
inheritProjectContext: false,
|
|
620
|
+
inheritSkills: false,
|
|
621
|
+
tools: ["read", "subagent"],
|
|
622
|
+
runId: "parent-run",
|
|
623
|
+
childIndex: 1,
|
|
624
|
+
parentEventSink: "/tmp/root/events",
|
|
625
|
+
parentControlInbox: "/tmp/root/control",
|
|
626
|
+
parentRootRunId: "root-run",
|
|
627
|
+
parentCapabilityToken: "token-1",
|
|
628
|
+
});
|
|
629
|
+
|
|
630
|
+
const extensionArgs = args.filter((arg, index) => args[index - 1] === "--extension");
|
|
631
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read,subagent");
|
|
632
|
+
assert.equal(env[SUBAGENT_FANOUT_CHILD_ENV], "1");
|
|
633
|
+
assert.equal(env[SUBAGENT_PARENT_EVENT_SINK_ENV], "/tmp/root/events");
|
|
634
|
+
assert.equal(env[SUBAGENT_PARENT_CONTROL_INBOX_ENV], "/tmp/root/control");
|
|
635
|
+
assert.equal(env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV], "root-run");
|
|
636
|
+
assert.equal(env[SUBAGENT_PARENT_RUN_ID_ENV], "parent-run");
|
|
637
|
+
assert.equal(env[SUBAGENT_PARENT_CHILD_INDEX_ENV], "1");
|
|
638
|
+
assert.equal(env[SUBAGENT_PARENT_DEPTH_ENV], "1");
|
|
639
|
+
assert.deepEqual(JSON.parse(env[SUBAGENT_PARENT_PATH_ENV] ?? "[]"), [{ runId: "parent-run", stepIndex: 1 }]);
|
|
640
|
+
assert.equal(env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV], "token-1");
|
|
641
|
+
assert.ok(extensionArgs.some((arg) => arg.endsWith(path.join("src", "extension", "fanout-child.ts"))));
|
|
642
|
+
});
|
|
643
|
+
|
|
644
|
+
it("clears all fanout routing env values for non-fanout children", () => {
|
|
645
|
+
const { args, env } = buildPiArgs({
|
|
646
|
+
baseArgs: ["-p"],
|
|
647
|
+
task: "hello",
|
|
648
|
+
sessionEnabled: false,
|
|
649
|
+
inheritProjectContext: false,
|
|
650
|
+
inheritSkills: false,
|
|
651
|
+
tools: ["read", "mcp:server/subagent"],
|
|
652
|
+
parentEventSink: "/tmp/should-not-leak/events",
|
|
653
|
+
parentControlInbox: "/tmp/should-not-leak/control",
|
|
654
|
+
parentRootRunId: "root-should-not-leak",
|
|
655
|
+
parentRunId: "should-not-leak",
|
|
656
|
+
parentChildIndex: 9,
|
|
657
|
+
parentCapabilityToken: "token-should-not-leak",
|
|
658
|
+
});
|
|
659
|
+
|
|
660
|
+
const extensionArgs = args.filter((arg, index) => args[index - 1] === "--extension");
|
|
661
|
+
assert.equal(env[SUBAGENT_FANOUT_CHILD_ENV], "0");
|
|
662
|
+
assert.equal(env[SUBAGENT_PARENT_EVENT_SINK_ENV], "");
|
|
663
|
+
assert.equal(env[SUBAGENT_PARENT_CONTROL_INBOX_ENV], "");
|
|
664
|
+
assert.equal(env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV], "");
|
|
665
|
+
assert.equal(env[SUBAGENT_PARENT_RUN_ID_ENV], "");
|
|
666
|
+
assert.equal(env[SUBAGENT_PARENT_CHILD_INDEX_ENV], "");
|
|
667
|
+
assert.equal(env[SUBAGENT_PARENT_DEPTH_ENV], "");
|
|
668
|
+
assert.equal(env[SUBAGENT_PARENT_PATH_ENV], "");
|
|
669
|
+
assert.equal(env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV], "");
|
|
670
|
+
assert.ok(!extensionArgs.some((arg) => arg.endsWith(path.join("src", "extension", "fanout-child.ts"))));
|
|
671
|
+
});
|
|
672
|
+
|
|
673
|
+
it("inherits routing env only for authorized fanout children", () => {
|
|
674
|
+
process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] = "/tmp/inherited/events";
|
|
675
|
+
process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = "/tmp/inherited/control";
|
|
676
|
+
process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = "inherited-root";
|
|
677
|
+
process.env[SUBAGENT_PARENT_RUN_ID_ENV] = "inherited-run";
|
|
678
|
+
process.env[SUBAGENT_RUN_ID_ENV] = "owner-run";
|
|
679
|
+
process.env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = "4";
|
|
680
|
+
process.env[SUBAGENT_PARENT_DEPTH_ENV] = "2";
|
|
681
|
+
process.env[SUBAGENT_PARENT_PATH_ENV] = JSON.stringify([{ runId: "root-run", stepIndex: 0 }, { runId: "../unsafe", stepIndex: 1 }, { runId: "owner-run", stepIndex: 1 }]);
|
|
682
|
+
process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = "inherited-token";
|
|
683
|
+
|
|
684
|
+
const fanout = buildPiArgs({
|
|
685
|
+
baseArgs: ["-p"],
|
|
686
|
+
task: "hello",
|
|
687
|
+
sessionEnabled: false,
|
|
688
|
+
inheritProjectContext: false,
|
|
689
|
+
inheritSkills: false,
|
|
690
|
+
tools: ["subagent"],
|
|
691
|
+
});
|
|
692
|
+
assert.equal(fanout.env[SUBAGENT_PARENT_EVENT_SINK_ENV], "/tmp/inherited/events");
|
|
693
|
+
assert.equal(fanout.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV], "/tmp/inherited/control");
|
|
694
|
+
assert.equal(fanout.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV], "inherited-root");
|
|
695
|
+
assert.equal(fanout.env[SUBAGENT_PARENT_RUN_ID_ENV], "owner-run");
|
|
696
|
+
assert.equal(fanout.env[SUBAGENT_PARENT_CHILD_INDEX_ENV], "4");
|
|
697
|
+
assert.equal(fanout.env[SUBAGENT_PARENT_DEPTH_ENV], "3");
|
|
698
|
+
assert.deepEqual(JSON.parse(fanout.env[SUBAGENT_PARENT_PATH_ENV] ?? "[]"), [{ runId: "root-run", stepIndex: 0 }, { runId: "owner-run", stepIndex: 1 }, { runId: "owner-run", stepIndex: 4 }]);
|
|
699
|
+
assert.equal(fanout.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV], "inherited-token");
|
|
700
|
+
|
|
701
|
+
const nonFanout = buildPiArgs({
|
|
702
|
+
baseArgs: ["-p"],
|
|
703
|
+
task: "hello",
|
|
704
|
+
sessionEnabled: false,
|
|
705
|
+
inheritProjectContext: false,
|
|
706
|
+
inheritSkills: false,
|
|
707
|
+
tools: ["read"],
|
|
708
|
+
});
|
|
709
|
+
assert.equal(nonFanout.env[SUBAGENT_FANOUT_CHILD_ENV], "0");
|
|
710
|
+
assert.equal(nonFanout.env[SUBAGENT_PARENT_EVENT_SINK_ENV], "");
|
|
711
|
+
assert.equal(nonFanout.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV], "");
|
|
712
|
+
assert.equal(nonFanout.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV], "");
|
|
713
|
+
assert.equal(nonFanout.env[SUBAGENT_PARENT_RUN_ID_ENV], "");
|
|
714
|
+
assert.equal(nonFanout.env[SUBAGENT_PARENT_CHILD_INDEX_ENV], "");
|
|
715
|
+
assert.equal(nonFanout.env[SUBAGENT_PARENT_DEPTH_ENV], "");
|
|
716
|
+
assert.equal(nonFanout.env[SUBAGENT_PARENT_PATH_ENV], "");
|
|
717
|
+
assert.equal(nonFanout.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV], "");
|
|
718
|
+
});
|
|
719
|
+
|
|
720
|
+
it("prefers the current subagent run id over inherited ancestor ids for nested fanout routing", () => {
|
|
721
|
+
process.env[SUBAGENT_PARENT_EVENT_SINK_ENV] = "/tmp/inherited/events";
|
|
722
|
+
process.env[SUBAGENT_PARENT_CONTROL_INBOX_ENV] = "/tmp/inherited/control";
|
|
723
|
+
process.env[SUBAGENT_PARENT_ROOT_RUN_ID_ENV] = "root-run";
|
|
724
|
+
process.env[SUBAGENT_PARENT_RUN_ID_ENV] = "older-parent";
|
|
725
|
+
process.env[SUBAGENT_RUN_ID_ENV] = "ancestor-run";
|
|
726
|
+
process.env[SUBAGENT_PARENT_CHILD_INDEX_ENV] = "4";
|
|
727
|
+
process.env[SUBAGENT_PARENT_DEPTH_ENV] = "1";
|
|
728
|
+
process.env[SUBAGENT_PARENT_PATH_ENV] = JSON.stringify([{ runId: "root-run", stepIndex: 0 }]);
|
|
729
|
+
process.env[SUBAGENT_PARENT_CAPABILITY_TOKEN_ENV] = "inherited-token";
|
|
730
|
+
|
|
731
|
+
const { env } = buildPiArgs({
|
|
732
|
+
baseArgs: ["-p"],
|
|
733
|
+
task: "hello",
|
|
734
|
+
sessionEnabled: false,
|
|
735
|
+
inheritProjectContext: false,
|
|
736
|
+
inheritSkills: false,
|
|
737
|
+
tools: ["subagent"],
|
|
738
|
+
runId: "current-nested-run",
|
|
739
|
+
childIndex: 2,
|
|
740
|
+
});
|
|
741
|
+
|
|
742
|
+
assert.equal(env[SUBAGENT_PARENT_RUN_ID_ENV], "current-nested-run");
|
|
743
|
+
assert.equal(env[SUBAGENT_PARENT_CHILD_INDEX_ENV], "2");
|
|
744
|
+
assert.equal(env[SUBAGENT_PARENT_DEPTH_ENV], "2");
|
|
745
|
+
assert.deepEqual(JSON.parse(env[SUBAGENT_PARENT_PATH_ENV] ?? "[]"), [{ runId: "root-run", stepIndex: 0 }, { runId: "current-nested-run", stepIndex: 2 }]);
|
|
746
|
+
});
|
|
747
|
+
|
|
748
|
+
it("does not let direct MCP tools authorize child fanout", () => {
|
|
749
|
+
const fixture = createMcpFixture();
|
|
750
|
+
writeMcpFixture(fixture, {
|
|
751
|
+
serverName: "delegator",
|
|
752
|
+
definition: { command: "delegator-mcp" },
|
|
753
|
+
tools: [{ name: "subagent" }],
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
const { args, env } = buildPiArgs({
|
|
757
|
+
baseArgs: ["-p"],
|
|
758
|
+
task: "hello",
|
|
759
|
+
sessionEnabled: false,
|
|
760
|
+
inheritProjectContext: false,
|
|
761
|
+
inheritSkills: false,
|
|
762
|
+
tools: ["read"],
|
|
763
|
+
mcpDirectTools: ["delegator"],
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
const extensionArgs = args.filter((arg, index) => args[index - 1] === "--extension");
|
|
767
|
+
assert.equal(args[args.indexOf("--tools") + 1], "read,delegator_subagent");
|
|
768
|
+
assert.equal(env[SUBAGENT_FANOUT_CHILD_ENV], "0");
|
|
769
|
+
assert.ok(!extensionArgs.some((arg) => arg.endsWith(path.join("src", "extension", "fanout-child.ts"))));
|
|
770
|
+
});
|
|
771
|
+
|
|
772
|
+
it("keeps child-safe fanout registration in explicit extensions mode", () => {
|
|
773
|
+
const { args, env } = buildPiArgs({
|
|
774
|
+
baseArgs: ["-p"],
|
|
775
|
+
task: "hello",
|
|
776
|
+
sessionEnabled: false,
|
|
777
|
+
inheritProjectContext: false,
|
|
778
|
+
inheritSkills: false,
|
|
779
|
+
tools: ["subagent"],
|
|
780
|
+
extensions: ["./agent-allowed-ext.ts"],
|
|
781
|
+
});
|
|
782
|
+
|
|
783
|
+
const extensionArgs = args.filter((arg, index) => args[index - 1] === "--extension");
|
|
784
|
+
assert.ok(args.includes("--no-extensions"));
|
|
785
|
+
assert.equal(env[SUBAGENT_FANOUT_CHILD_ENV], "1");
|
|
786
|
+
assert.ok(extensionArgs.some((arg) => arg.endsWith(path.join("src", "extension", "fanout-child.ts"))));
|
|
787
|
+
assert.ok(extensionArgs.includes("./agent-allowed-ext.ts"));
|
|
788
|
+
});
|
|
789
|
+
|
|
790
|
+
it("emits an empty prompt file when replace mode is used with an empty prompt", () => {
|
|
791
|
+
const { args } = buildPiArgs({
|
|
792
|
+
baseArgs: ["-p"],
|
|
793
|
+
task: "hello",
|
|
794
|
+
sessionEnabled: false,
|
|
795
|
+
systemPrompt: "",
|
|
796
|
+
systemPromptMode: "replace",
|
|
797
|
+
inheritProjectContext: false,
|
|
798
|
+
inheritSkills: false,
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
assert.ok(args.includes("--system-prompt"));
|
|
802
|
+
});
|
|
803
|
+
});
|