oh-my-copilot 5.18.0 → 5.18.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/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +1 -1
- package/README.md +3 -3
- package/bridge/__pycache__/gyoshu_bridge.cpython-314.pyc +0 -0
- package/bridge/claude-md-coordinator.cjs +2 -2
- package/bridge/cli.cjs +17691 -14571
- package/bridge/mcp-server.cjs +4624 -1922
- package/bridge/runtime-cli.cjs +2735 -757
- package/bridge/team-bridge.cjs +357 -139
- package/bridge/team-mcp.cjs +922 -645
- package/bridge/team.js +2851 -874
- package/dist/__tests__/delegation-enforcer.test.js +1 -1
- package/dist/__tests__/delegation-enforcer.test.js.map +1 -1
- package/dist/__tests__/hud/cli-diagnostic.test.js +1 -1
- package/dist/__tests__/hud/cli-diagnostic.test.js.map +1 -1
- package/dist/__tests__/pre-tool-enforcer.test.js +3 -0
- package/dist/__tests__/pre-tool-enforcer.test.js.map +1 -1
- package/dist/__tests__/session-start-script-context.test.js +1 -1
- package/dist/__tests__/session-start-script-context.test.js.map +1 -1
- package/dist/__tests__/skills.test.js +9 -0
- package/dist/__tests__/skills.test.js.map +1 -1
- package/dist/cli/commands/__tests__/smoke-cassette.test.d.ts +2 -0
- package/dist/cli/commands/__tests__/smoke-cassette.test.d.ts.map +1 -0
- package/dist/cli/commands/__tests__/smoke-cassette.test.js +135 -0
- package/dist/cli/commands/__tests__/smoke-cassette.test.js.map +1 -0
- package/dist/cli/commands/smoke.d.ts +41 -2
- package/dist/cli/commands/smoke.d.ts.map +1 -1
- package/dist/cli/commands/smoke.js +103 -6
- package/dist/cli/commands/smoke.js.map +1 -1
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +30 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/copilot-run/__tests__/job.test.js +347 -2
- package/dist/copilot-run/__tests__/job.test.js.map +1 -1
- package/dist/copilot-run/__tests__/sandbox-session.test.d.ts +2 -0
- package/dist/copilot-run/__tests__/sandbox-session.test.d.ts.map +1 -0
- package/dist/copilot-run/__tests__/sandbox-session.test.js +181 -0
- package/dist/copilot-run/__tests__/sandbox-session.test.js.map +1 -0
- package/dist/copilot-run/__tests__/sandbox.test.js +128 -4
- package/dist/copilot-run/__tests__/sandbox.test.js.map +1 -1
- package/dist/copilot-run/job.d.ts +87 -13
- package/dist/copilot-run/job.d.ts.map +1 -1
- package/dist/copilot-run/job.js +517 -177
- package/dist/copilot-run/job.js.map +1 -1
- package/dist/copilot-run/sandbox-session.d.ts +71 -0
- package/dist/copilot-run/sandbox-session.d.ts.map +1 -0
- package/dist/copilot-run/sandbox-session.js +156 -0
- package/dist/copilot-run/sandbox-session.js.map +1 -0
- package/dist/copilot-run/sandbox.d.ts +17 -0
- package/dist/copilot-run/sandbox.d.ts.map +1 -1
- package/dist/copilot-run/sandbox.js +108 -4
- package/dist/copilot-run/sandbox.js.map +1 -1
- package/dist/copilot-run/timeout.d.ts +4 -0
- package/dist/copilot-run/timeout.d.ts.map +1 -0
- package/dist/copilot-run/timeout.js +10 -0
- package/dist/copilot-run/timeout.js.map +1 -0
- package/dist/factory/check/__tests__/cli-ado.test.d.ts +2 -0
- package/dist/factory/check/__tests__/cli-ado.test.d.ts.map +1 -0
- package/dist/factory/check/__tests__/cli-ado.test.js +95 -0
- package/dist/factory/check/__tests__/cli-ado.test.js.map +1 -0
- package/dist/factory/check/__tests__/cli.test.js +2 -1
- package/dist/factory/check/__tests__/cli.test.js.map +1 -1
- package/dist/factory/check/cli.d.ts +17 -1
- package/dist/factory/check/cli.d.ts.map +1 -1
- package/dist/factory/check/cli.js +20 -2
- package/dist/factory/check/cli.js.map +1 -1
- package/dist/factory/heal/__tests__/logs-ado.test.d.ts +2 -0
- package/dist/factory/heal/__tests__/logs-ado.test.d.ts.map +1 -0
- package/dist/factory/heal/__tests__/logs-ado.test.js +39 -0
- package/dist/factory/heal/__tests__/logs-ado.test.js.map +1 -0
- package/dist/factory/heal/classify.d.ts +3 -1
- package/dist/factory/heal/classify.d.ts.map +1 -1
- package/dist/factory/heal/classify.js +4 -2
- package/dist/factory/heal/classify.js.map +1 -1
- package/dist/factory/heal/cli.d.ts +8 -2
- package/dist/factory/heal/cli.d.ts.map +1 -1
- package/dist/factory/heal/cli.js +11 -9
- package/dist/factory/heal/cli.js.map +1 -1
- package/dist/factory/heal/debug-lane.js +1 -1
- package/dist/factory/heal/debug-lane.js.map +1 -1
- package/dist/factory/heal/heal-evidence.d.ts +4 -2
- package/dist/factory/heal/heal-evidence.d.ts.map +1 -1
- package/dist/factory/heal/heal-evidence.js +8 -6
- package/dist/factory/heal/heal-evidence.js.map +1 -1
- package/dist/factory/heal/logs.d.ts +1 -1
- package/dist/factory/heal/logs.d.ts.map +1 -1
- package/dist/factory/heal/logs.js +4 -3
- package/dist/factory/heal/logs.js.map +1 -1
- package/dist/factory/heal/run.d.ts +3 -0
- package/dist/factory/heal/run.d.ts.map +1 -1
- package/dist/factory/heal/run.js +1 -1
- package/dist/factory/heal/run.js.map +1 -1
- package/dist/factory/run/__tests__/engine.sandbox.test.js +30 -2
- package/dist/factory/run/__tests__/engine.sandbox.test.js.map +1 -1
- package/dist/factory/run/__tests__/engine.test.js +31 -1
- package/dist/factory/run/__tests__/engine.test.js.map +1 -1
- package/dist/factory/run/__tests__/fake-lanes.d.ts +2 -0
- package/dist/factory/run/__tests__/fake-lanes.d.ts.map +1 -1
- package/dist/factory/run/__tests__/fake-lanes.js +1 -1
- package/dist/factory/run/__tests__/fake-lanes.js.map +1 -1
- package/dist/factory/run/__tests__/merge-policy.test.d.ts +2 -0
- package/dist/factory/run/__tests__/merge-policy.test.d.ts.map +1 -0
- package/dist/factory/run/__tests__/merge-policy.test.js +40 -0
- package/dist/factory/run/__tests__/merge-policy.test.js.map +1 -0
- package/dist/factory/run/__tests__/prepare-gates.test.js +22 -0
- package/dist/factory/run/__tests__/prepare-gates.test.js.map +1 -1
- package/dist/factory/run/__tests__/units.test.js +12 -1
- package/dist/factory/run/__tests__/units.test.js.map +1 -1
- package/dist/factory/run/engine.d.ts.map +1 -1
- package/dist/factory/run/engine.js +32 -6
- package/dist/factory/run/engine.js.map +1 -1
- package/dist/factory/run/lane-commit.d.ts +10 -1
- package/dist/factory/run/lane-commit.d.ts.map +1 -1
- package/dist/factory/run/lane-commit.js +21 -4
- package/dist/factory/run/lane-commit.js.map +1 -1
- package/dist/factory/run/merge-policy.d.ts +3 -1
- package/dist/factory/run/merge-policy.d.ts.map +1 -1
- package/dist/factory/run/merge-policy.js +8 -2
- package/dist/factory/run/merge-policy.js.map +1 -1
- package/dist/factory/run/review-guard.d.ts +2 -0
- package/dist/factory/run/review-guard.d.ts.map +1 -1
- package/dist/factory/run/review-guard.js +1 -1
- package/dist/factory/run/review-guard.js.map +1 -1
- package/dist/factory/run/state.d.ts +13 -0
- package/dist/factory/run/state.d.ts.map +1 -1
- package/dist/factory/run/state.js +20 -5
- package/dist/factory/run/state.js.map +1 -1
- package/dist/features/builtin-skills/skills.js +1 -1
- package/dist/features/builtin-skills/skills.js.map +1 -1
- package/dist/features/delegation-enforcer.d.ts.map +1 -1
- package/dist/features/delegation-enforcer.js +2 -6
- package/dist/features/delegation-enforcer.js.map +1 -1
- package/dist/forge/__tests__/gh-argv-baseline.heal.test.js +52 -2
- package/dist/forge/__tests__/gh-argv-baseline.heal.test.js.map +1 -1
- package/dist/forge/ado/__tests__/acceptance-scripts.test.d.ts +8 -0
- package/dist/forge/ado/__tests__/acceptance-scripts.test.d.ts.map +1 -0
- package/dist/forge/ado/__tests__/acceptance-scripts.test.js +567 -0
- package/dist/forge/ado/__tests__/acceptance-scripts.test.js.map +1 -0
- package/dist/forge/ado/__tests__/az-binary.test.js +4 -0
- package/dist/forge/ado/__tests__/az-binary.test.js.map +1 -1
- package/dist/forge/ado/__tests__/failed-jobs.test.d.ts +2 -0
- package/dist/forge/ado/__tests__/failed-jobs.test.d.ts.map +1 -0
- package/dist/forge/ado/__tests__/failed-jobs.test.js +96 -0
- package/dist/forge/ado/__tests__/failed-jobs.test.js.map +1 -0
- package/dist/forge/ado/az-binary.d.ts +2 -1
- package/dist/forge/ado/az-binary.d.ts.map +1 -1
- package/dist/forge/ado/az-binary.js +3 -2
- package/dist/forge/ado/az-binary.js.map +1 -1
- package/dist/forge/ado/checks.d.ts.map +1 -1
- package/dist/forge/ado/checks.js +30 -0
- package/dist/forge/ado/checks.js.map +1 -1
- package/dist/forge/github/ci.d.ts +2 -0
- package/dist/forge/github/ci.d.ts.map +1 -1
- package/dist/forge/github/ci.js +3 -0
- package/dist/forge/github/ci.js.map +1 -1
- package/dist/forge/types.d.ts +2 -0
- package/dist/forge/types.d.ts.map +1 -1
- package/dist/hooks/autopilot/__tests__/pipeline.test.js +1 -1
- package/dist/hooks/autopilot/__tests__/pipeline.test.js.map +1 -1
- package/dist/hooks/autopilot/adapters/execution-adapter.js +3 -3
- package/dist/hooks/autopilot/adapters/execution-adapter.js.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/index.test.js +4 -0
- package/dist/hooks/keyword-detector/__tests__/index.test.js.map +1 -1
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js +7 -0
- package/dist/hooks/keyword-detector/__tests__/jev-shadow.test.js.map +1 -1
- package/dist/hooks/keyword-detector/index.d.ts +1 -1
- package/dist/hooks/keyword-detector/index.js +4 -4
- package/dist/hooks/keyword-detector/index.js.map +1 -1
- package/dist/hooks/keyword-detector/jev-shadow.js +1 -1
- package/dist/hooks/keyword-detector/jev-shadow.js.map +1 -1
- package/dist/hud/index.js +1 -1
- package/dist/hud/index.js.map +1 -1
- package/dist/mcp/__tests__/host-smoke-tool.test.js +14 -0
- package/dist/mcp/__tests__/host-smoke-tool.test.js.map +1 -1
- package/dist/ship/gates.d.ts +9 -3
- package/dist/ship/gates.d.ts.map +1 -1
- package/dist/ship/gates.js +24 -7
- package/dist/ship/gates.js.map +1 -1
- package/dist/smoke/__tests__/copilot-sdk-driver.test.js +129 -4
- package/dist/smoke/__tests__/copilot-sdk-driver.test.js.map +1 -1
- package/dist/smoke/__tests__/copilot-session-env.test.d.ts +2 -0
- package/dist/smoke/__tests__/copilot-session-env.test.d.ts.map +1 -0
- package/dist/smoke/__tests__/copilot-session-env.test.js +29 -0
- package/dist/smoke/__tests__/copilot-session-env.test.js.map +1 -0
- package/dist/smoke/__tests__/copilot-team-scenario.test.js +3 -0
- package/dist/smoke/__tests__/copilot-team-scenario.test.js.map +1 -1
- package/dist/smoke/copilot-sdk-driver.d.ts +37 -1
- package/dist/smoke/copilot-sdk-driver.d.ts.map +1 -1
- package/dist/smoke/copilot-sdk-driver.js +114 -10
- package/dist/smoke/copilot-sdk-driver.js.map +1 -1
- package/dist/smoke/copilot-sdk-scenarios.d.ts +27 -0
- package/dist/smoke/copilot-sdk-scenarios.d.ts.map +1 -1
- package/dist/smoke/copilot-sdk-scenarios.js +31 -0
- package/dist/smoke/copilot-sdk-scenarios.js.map +1 -1
- package/dist/smoke/copilot-session-env.d.ts +38 -1
- package/dist/smoke/copilot-session-env.d.ts.map +1 -1
- package/dist/smoke/copilot-session-env.js +82 -1
- package/dist/smoke/copilot-session-env.js.map +1 -1
- package/dist/smoke/copilot-smoke.d.ts +21 -1
- package/dist/smoke/copilot-smoke.d.ts.map +1 -1
- package/dist/smoke/copilot-smoke.js +86 -6
- package/dist/smoke/copilot-smoke.js.map +1 -1
- package/dist/smoke/copilot-team-scenario.d.ts +4 -2
- package/dist/smoke/copilot-team-scenario.d.ts.map +1 -1
- package/dist/smoke/copilot-team-scenario.js +5 -4
- package/dist/smoke/copilot-team-scenario.js.map +1 -1
- package/dist/smoke/replay/__tests__/cassette.test.d.ts +2 -0
- package/dist/smoke/replay/__tests__/cassette.test.d.ts.map +1 -0
- package/dist/smoke/replay/__tests__/cassette.test.js +387 -0
- package/dist/smoke/replay/__tests__/cassette.test.js.map +1 -0
- package/dist/smoke/replay/__tests__/handler.test.d.ts +2 -0
- package/dist/smoke/replay/__tests__/handler.test.d.ts.map +1 -0
- package/dist/smoke/replay/__tests__/handler.test.js +367 -0
- package/dist/smoke/replay/__tests__/handler.test.js.map +1 -0
- package/dist/smoke/replay/__tests__/matcher.test.d.ts +2 -0
- package/dist/smoke/replay/__tests__/matcher.test.d.ts.map +1 -0
- package/dist/smoke/replay/__tests__/matcher.test.js +318 -0
- package/dist/smoke/replay/__tests__/matcher.test.js.map +1 -0
- package/dist/smoke/replay/__tests__/normalize.test.d.ts +2 -0
- package/dist/smoke/replay/__tests__/normalize.test.d.ts.map +1 -0
- package/dist/smoke/replay/__tests__/normalize.test.js +53 -0
- package/dist/smoke/replay/__tests__/normalize.test.js.map +1 -0
- package/dist/smoke/replay/__tests__/redact.test.d.ts +2 -0
- package/dist/smoke/replay/__tests__/redact.test.d.ts.map +1 -0
- package/dist/smoke/replay/__tests__/redact.test.js +453 -0
- package/dist/smoke/replay/__tests__/redact.test.js.map +1 -0
- package/dist/smoke/replay/__tests__/run.test.d.ts +2 -0
- package/dist/smoke/replay/__tests__/run.test.d.ts.map +1 -0
- package/dist/smoke/replay/__tests__/run.test.js +311 -0
- package/dist/smoke/replay/__tests__/run.test.js.map +1 -0
- package/dist/smoke/replay/cassette.d.ts +210 -0
- package/dist/smoke/replay/cassette.d.ts.map +1 -0
- package/dist/smoke/replay/cassette.js +580 -0
- package/dist/smoke/replay/cassette.js.map +1 -0
- package/dist/smoke/replay/handler.d.ts +221 -0
- package/dist/smoke/replay/handler.d.ts.map +1 -0
- package/dist/smoke/replay/handler.js +702 -0
- package/dist/smoke/replay/handler.js.map +1 -0
- package/dist/smoke/replay/matcher.d.ts +194 -0
- package/dist/smoke/replay/matcher.d.ts.map +1 -0
- package/dist/smoke/replay/matcher.js +344 -0
- package/dist/smoke/replay/matcher.js.map +1 -0
- package/dist/smoke/replay/normalize.d.ts +35 -0
- package/dist/smoke/replay/normalize.d.ts.map +1 -0
- package/dist/smoke/replay/normalize.js +64 -0
- package/dist/smoke/replay/normalize.js.map +1 -0
- package/dist/smoke/replay/redact.d.ts +151 -0
- package/dist/smoke/replay/redact.d.ts.map +1 -0
- package/dist/smoke/replay/redact.js +577 -0
- package/dist/smoke/replay/redact.js.map +1 -0
- package/dist/smoke/replay/run.d.ts +119 -0
- package/dist/smoke/replay/run.d.ts.map +1 -0
- package/dist/smoke/replay/run.js +302 -0
- package/dist/smoke/replay/run.js.map +1 -0
- package/dist/team/__tests__/sdk-transport.test.js +334 -6
- package/dist/team/__tests__/sdk-transport.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.pane-env.test.js +13 -13
- package/dist/team/__tests__/tmux-session.pane-env.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.spawn.test.js +12 -0
- package/dist/team/__tests__/tmux-session.spawn.test.js.map +1 -1
- package/dist/team/__tests__/tmux-session.split-pane-env.test.js +2 -2
- package/dist/team/__tests__/tmux-session.split-pane-env.test.js.map +1 -1
- package/dist/team/__tests__/worker-launch-ack.test.js +173 -9
- package/dist/team/__tests__/worker-launch-ack.test.js.map +1 -1
- package/dist/team/git-worktree.d.ts.map +1 -1
- package/dist/team/git-worktree.js +2 -1
- package/dist/team/git-worktree.js.map +1 -1
- package/dist/team/model-contract.d.ts.map +1 -1
- package/dist/team/model-contract.js +3 -2
- package/dist/team/model-contract.js.map +1 -1
- package/dist/team/sdk-host.d.ts +44 -0
- package/dist/team/sdk-host.d.ts.map +1 -1
- package/dist/team/sdk-host.js +147 -5
- package/dist/team/sdk-host.js.map +1 -1
- package/dist/team/sdk-policy.d.ts +17 -0
- package/dist/team/sdk-policy.d.ts.map +1 -1
- package/dist/team/sdk-policy.js +79 -1
- package/dist/team/sdk-policy.js.map +1 -1
- package/dist/team/sdk-transport.d.ts +15 -0
- package/dist/team/sdk-transport.d.ts.map +1 -1
- package/dist/team/sdk-transport.js +54 -9
- package/dist/team/sdk-transport.js.map +1 -1
- package/dist/team/tmux-session.d.ts.map +1 -1
- package/dist/team/tmux-session.js +5 -0
- package/dist/team/tmux-session.js.map +1 -1
- package/dist/team/worker-launch-ack.d.ts +3 -1
- package/dist/team/worker-launch-ack.d.ts.map +1 -1
- package/dist/team/worker-launch-ack.js +73 -8
- package/dist/team/worker-launch-ack.js.map +1 -1
- package/dist/tools/host-smoke-tool.d.ts +5 -1
- package/dist/tools/host-smoke-tool.d.ts.map +1 -1
- package/dist/tools/host-smoke-tool.js +26 -3
- package/dist/tools/host-smoke-tool.js.map +1 -1
- package/dist/workflow/__tests__/alias-resolver.test.js +2 -0
- package/dist/workflow/__tests__/alias-resolver.test.js.map +1 -1
- package/dist/workflow/alias-resolver.js +2 -2
- package/dist/workflow/alias-resolver.js.map +1 -1
- package/docs/CLAUDE.md +3 -2
- package/docs/REFERENCE.md +69 -4
- package/docs/copilot-instructions.md +6 -5
- package/package.json +2 -2
- package/plugin.json +1 -1
- package/scripts/ado-acceptance.mjs +611 -0
- package/scripts/ado-capture.mjs +320 -0
- package/scripts/ado-fixture-import.mjs +293 -0
- package/scripts/keyword-detector.mjs +2 -2
- package/scripts/lib/backlog-to-workitems.mjs +115 -0
- package/scripts/persistent-mode.cjs +1 -1
- package/scripts/persistent-mode.mjs +1 -1
- package/scripts/pre-tool-enforcer.mjs +1 -1
- package/scripts/session-start.mjs +3 -3
- package/scripts/setup-copilot-instructions.sh +1 -1
- package/scripts/spikes/request-handler-probe.mjs +186 -0
- package/skills/autopilot/SKILL.md +3 -3
- package/skills/cancel/SKILL.md +1 -1
- package/skills/ship/SKILL.md +2 -2
- package/skills/team/SKILL.md +3 -3
- package/templates/hooks/keyword-detector.mjs +1 -1
- package/templates/hooks/pre-tool-use.mjs +1 -1
- package/bridge/__pycache__/gyoshu_bridge.cpython-312.pyc +0 -0
package/bridge/team-mcp.cjs
CHANGED
|
@@ -412,11 +412,11 @@ var require_codegen = __commonJS({
|
|
|
412
412
|
const rhs = this.rhs === void 0 ? "" : ` = ${this.rhs}`;
|
|
413
413
|
return `${varKind} ${this.name}${rhs};` + _n;
|
|
414
414
|
}
|
|
415
|
-
optimizeNames(names,
|
|
415
|
+
optimizeNames(names, constants5) {
|
|
416
416
|
if (!names[this.name.str])
|
|
417
417
|
return;
|
|
418
418
|
if (this.rhs)
|
|
419
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
419
|
+
this.rhs = optimizeExpr(this.rhs, names, constants5);
|
|
420
420
|
return this;
|
|
421
421
|
}
|
|
422
422
|
get names() {
|
|
@@ -433,10 +433,10 @@ var require_codegen = __commonJS({
|
|
|
433
433
|
render({ _n }) {
|
|
434
434
|
return `${this.lhs} = ${this.rhs};` + _n;
|
|
435
435
|
}
|
|
436
|
-
optimizeNames(names,
|
|
436
|
+
optimizeNames(names, constants5) {
|
|
437
437
|
if (this.lhs instanceof code_1.Name && !names[this.lhs.str] && !this.sideEffects)
|
|
438
438
|
return;
|
|
439
|
-
this.rhs = optimizeExpr(this.rhs, names,
|
|
439
|
+
this.rhs = optimizeExpr(this.rhs, names, constants5);
|
|
440
440
|
return this;
|
|
441
441
|
}
|
|
442
442
|
get names() {
|
|
@@ -497,8 +497,8 @@ var require_codegen = __commonJS({
|
|
|
497
497
|
optimizeNodes() {
|
|
498
498
|
return `${this.code}` ? this : void 0;
|
|
499
499
|
}
|
|
500
|
-
optimizeNames(names,
|
|
501
|
-
this.code = optimizeExpr(this.code, names,
|
|
500
|
+
optimizeNames(names, constants5) {
|
|
501
|
+
this.code = optimizeExpr(this.code, names, constants5);
|
|
502
502
|
return this;
|
|
503
503
|
}
|
|
504
504
|
get names() {
|
|
@@ -527,12 +527,12 @@ var require_codegen = __commonJS({
|
|
|
527
527
|
}
|
|
528
528
|
return nodes.length > 0 ? this : void 0;
|
|
529
529
|
}
|
|
530
|
-
optimizeNames(names,
|
|
530
|
+
optimizeNames(names, constants5) {
|
|
531
531
|
const { nodes } = this;
|
|
532
532
|
let i = nodes.length;
|
|
533
533
|
while (i--) {
|
|
534
534
|
const n = nodes[i];
|
|
535
|
-
if (n.optimizeNames(names,
|
|
535
|
+
if (n.optimizeNames(names, constants5))
|
|
536
536
|
continue;
|
|
537
537
|
subtractNames(names, n.names);
|
|
538
538
|
nodes.splice(i, 1);
|
|
@@ -585,12 +585,12 @@ var require_codegen = __commonJS({
|
|
|
585
585
|
return void 0;
|
|
586
586
|
return this;
|
|
587
587
|
}
|
|
588
|
-
optimizeNames(names,
|
|
588
|
+
optimizeNames(names, constants5) {
|
|
589
589
|
var _a;
|
|
590
|
-
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
591
|
-
if (!(super.optimizeNames(names,
|
|
590
|
+
this.else = (_a = this.else) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants5);
|
|
591
|
+
if (!(super.optimizeNames(names, constants5) || this.else))
|
|
592
592
|
return;
|
|
593
|
-
this.condition = optimizeExpr(this.condition, names,
|
|
593
|
+
this.condition = optimizeExpr(this.condition, names, constants5);
|
|
594
594
|
return this;
|
|
595
595
|
}
|
|
596
596
|
get names() {
|
|
@@ -613,10 +613,10 @@ var require_codegen = __commonJS({
|
|
|
613
613
|
render(opts) {
|
|
614
614
|
return `for(${this.iteration})` + super.render(opts);
|
|
615
615
|
}
|
|
616
|
-
optimizeNames(names,
|
|
617
|
-
if (!super.optimizeNames(names,
|
|
616
|
+
optimizeNames(names, constants5) {
|
|
617
|
+
if (!super.optimizeNames(names, constants5))
|
|
618
618
|
return;
|
|
619
|
-
this.iteration = optimizeExpr(this.iteration, names,
|
|
619
|
+
this.iteration = optimizeExpr(this.iteration, names, constants5);
|
|
620
620
|
return this;
|
|
621
621
|
}
|
|
622
622
|
get names() {
|
|
@@ -652,10 +652,10 @@ var require_codegen = __commonJS({
|
|
|
652
652
|
render(opts) {
|
|
653
653
|
return `for(${this.varKind} ${this.name} ${this.loop} ${this.iterable})` + super.render(opts);
|
|
654
654
|
}
|
|
655
|
-
optimizeNames(names,
|
|
656
|
-
if (!super.optimizeNames(names,
|
|
655
|
+
optimizeNames(names, constants5) {
|
|
656
|
+
if (!super.optimizeNames(names, constants5))
|
|
657
657
|
return;
|
|
658
|
-
this.iterable = optimizeExpr(this.iterable, names,
|
|
658
|
+
this.iterable = optimizeExpr(this.iterable, names, constants5);
|
|
659
659
|
return this;
|
|
660
660
|
}
|
|
661
661
|
get names() {
|
|
@@ -697,11 +697,11 @@ var require_codegen = __commonJS({
|
|
|
697
697
|
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNodes();
|
|
698
698
|
return this;
|
|
699
699
|
}
|
|
700
|
-
optimizeNames(names,
|
|
700
|
+
optimizeNames(names, constants5) {
|
|
701
701
|
var _a, _b;
|
|
702
|
-
super.optimizeNames(names,
|
|
703
|
-
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names,
|
|
704
|
-
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names,
|
|
702
|
+
super.optimizeNames(names, constants5);
|
|
703
|
+
(_a = this.catch) === null || _a === void 0 ? void 0 : _a.optimizeNames(names, constants5);
|
|
704
|
+
(_b = this.finally) === null || _b === void 0 ? void 0 : _b.optimizeNames(names, constants5);
|
|
705
705
|
return this;
|
|
706
706
|
}
|
|
707
707
|
get names() {
|
|
@@ -1002,7 +1002,7 @@ var require_codegen = __commonJS({
|
|
|
1002
1002
|
function addExprNames(names, from) {
|
|
1003
1003
|
return from instanceof code_1._CodeOrName ? addNames(names, from.names) : names;
|
|
1004
1004
|
}
|
|
1005
|
-
function optimizeExpr(expr, names,
|
|
1005
|
+
function optimizeExpr(expr, names, constants5) {
|
|
1006
1006
|
if (expr instanceof code_1.Name)
|
|
1007
1007
|
return replaceName(expr);
|
|
1008
1008
|
if (!canOptimize(expr))
|
|
@@ -1017,14 +1017,14 @@ var require_codegen = __commonJS({
|
|
|
1017
1017
|
return items;
|
|
1018
1018
|
}, []));
|
|
1019
1019
|
function replaceName(n) {
|
|
1020
|
-
const c =
|
|
1020
|
+
const c = constants5[n.str];
|
|
1021
1021
|
if (c === void 0 || names[n.str] !== 1)
|
|
1022
1022
|
return n;
|
|
1023
1023
|
delete names[n.str];
|
|
1024
1024
|
return c;
|
|
1025
1025
|
}
|
|
1026
1026
|
function canOptimize(e) {
|
|
1027
|
-
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 &&
|
|
1027
|
+
return e instanceof code_1._Code && e._items.some((c) => c instanceof code_1.Name && names[c.str] === 1 && constants5[c.str] !== void 0);
|
|
1028
1028
|
}
|
|
1029
1029
|
}
|
|
1030
1030
|
function subtractNames(names, from) {
|
|
@@ -2237,8 +2237,8 @@ var require_resolve = __commonJS({
|
|
|
2237
2237
|
}
|
|
2238
2238
|
return count;
|
|
2239
2239
|
}
|
|
2240
|
-
function getFullPath(resolver, id = "",
|
|
2241
|
-
if (
|
|
2240
|
+
function getFullPath(resolver, id = "", normalize4) {
|
|
2241
|
+
if (normalize4 !== false)
|
|
2242
2242
|
id = normalizeId(id);
|
|
2243
2243
|
const p = resolver.parse(id);
|
|
2244
2244
|
return _getFullPath(resolver, p);
|
|
@@ -2986,7 +2986,7 @@ var require_compile = __commonJS({
|
|
|
2986
2986
|
const schOrFunc = root.refs[ref];
|
|
2987
2987
|
if (schOrFunc)
|
|
2988
2988
|
return schOrFunc;
|
|
2989
|
-
let _sch =
|
|
2989
|
+
let _sch = resolve21.call(this, root, ref);
|
|
2990
2990
|
if (_sch === void 0) {
|
|
2991
2991
|
const schema = (_a = root.localRefs) === null || _a === void 0 ? void 0 : _a[ref];
|
|
2992
2992
|
const { schemaId } = this.opts;
|
|
@@ -3013,7 +3013,7 @@ var require_compile = __commonJS({
|
|
|
3013
3013
|
function sameSchemaEnv(s1, s2) {
|
|
3014
3014
|
return s1.schema === s2.schema && s1.root === s2.root && s1.baseId === s2.baseId;
|
|
3015
3015
|
}
|
|
3016
|
-
function
|
|
3016
|
+
function resolve21(root, ref) {
|
|
3017
3017
|
let sch;
|
|
3018
3018
|
while (typeof (sch = this.refs[ref]) == "string")
|
|
3019
3019
|
ref = sch;
|
|
@@ -3634,7 +3634,7 @@ var require_fast_uri = __commonJS({
|
|
|
3634
3634
|
"use strict";
|
|
3635
3635
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizePercentEncoding, normalizePathEncoding, escapePreservingEscapes, reescapeHostDelimiters, isIPv4, nonSimpleDomain } = require_utils();
|
|
3636
3636
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
3637
|
-
function
|
|
3637
|
+
function normalize4(uri, options) {
|
|
3638
3638
|
if (typeof uri === "string") {
|
|
3639
3639
|
uri = /** @type {T} */
|
|
3640
3640
|
normalizeString(uri, options);
|
|
@@ -3644,55 +3644,55 @@ var require_fast_uri = __commonJS({
|
|
|
3644
3644
|
}
|
|
3645
3645
|
return uri;
|
|
3646
3646
|
}
|
|
3647
|
-
function
|
|
3647
|
+
function resolve21(baseURI, relativeURI, options) {
|
|
3648
3648
|
const schemelessOptions = options ? Object.assign({ scheme: "null" }, options) : { scheme: "null" };
|
|
3649
3649
|
const resolved = resolveComponent(parse7(baseURI, schemelessOptions), parse7(relativeURI, schemelessOptions), schemelessOptions, true);
|
|
3650
3650
|
schemelessOptions.skipEscape = true;
|
|
3651
3651
|
return serialize(resolved, schemelessOptions);
|
|
3652
3652
|
}
|
|
3653
|
-
function resolveComponent(base,
|
|
3653
|
+
function resolveComponent(base, relative14, options, skipNormalization) {
|
|
3654
3654
|
const target = {};
|
|
3655
3655
|
if (!skipNormalization) {
|
|
3656
3656
|
base = parse7(serialize(base, options), options);
|
|
3657
|
-
|
|
3657
|
+
relative14 = parse7(serialize(relative14, options), options);
|
|
3658
3658
|
}
|
|
3659
3659
|
options = options || {};
|
|
3660
|
-
if (!options.tolerant &&
|
|
3661
|
-
target.scheme =
|
|
3662
|
-
target.userinfo =
|
|
3663
|
-
target.host =
|
|
3664
|
-
target.port =
|
|
3665
|
-
target.path = removeDotSegments(
|
|
3666
|
-
target.query =
|
|
3660
|
+
if (!options.tolerant && relative14.scheme) {
|
|
3661
|
+
target.scheme = relative14.scheme;
|
|
3662
|
+
target.userinfo = relative14.userinfo;
|
|
3663
|
+
target.host = relative14.host;
|
|
3664
|
+
target.port = relative14.port;
|
|
3665
|
+
target.path = removeDotSegments(relative14.path || "");
|
|
3666
|
+
target.query = relative14.query;
|
|
3667
3667
|
} else {
|
|
3668
|
-
if (
|
|
3669
|
-
target.userinfo =
|
|
3670
|
-
target.host =
|
|
3671
|
-
target.port =
|
|
3672
|
-
target.path = removeDotSegments(
|
|
3673
|
-
target.query =
|
|
3668
|
+
if (relative14.userinfo !== void 0 || relative14.host !== void 0 || relative14.port !== void 0) {
|
|
3669
|
+
target.userinfo = relative14.userinfo;
|
|
3670
|
+
target.host = relative14.host;
|
|
3671
|
+
target.port = relative14.port;
|
|
3672
|
+
target.path = removeDotSegments(relative14.path || "");
|
|
3673
|
+
target.query = relative14.query;
|
|
3674
3674
|
} else {
|
|
3675
|
-
if (!
|
|
3675
|
+
if (!relative14.path) {
|
|
3676
3676
|
target.path = base.path;
|
|
3677
|
-
if (
|
|
3678
|
-
target.query =
|
|
3677
|
+
if (relative14.query !== void 0) {
|
|
3678
|
+
target.query = relative14.query;
|
|
3679
3679
|
} else {
|
|
3680
3680
|
target.query = base.query;
|
|
3681
3681
|
}
|
|
3682
3682
|
} else {
|
|
3683
|
-
if (
|
|
3684
|
-
target.path = removeDotSegments(
|
|
3683
|
+
if (relative14.path[0] === "/") {
|
|
3684
|
+
target.path = removeDotSegments(relative14.path);
|
|
3685
3685
|
} else {
|
|
3686
3686
|
if ((base.userinfo !== void 0 || base.host !== void 0 || base.port !== void 0) && !base.path) {
|
|
3687
|
-
target.path = "/" +
|
|
3687
|
+
target.path = "/" + relative14.path;
|
|
3688
3688
|
} else if (!base.path) {
|
|
3689
|
-
target.path =
|
|
3689
|
+
target.path = relative14.path;
|
|
3690
3690
|
} else {
|
|
3691
|
-
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) +
|
|
3691
|
+
target.path = base.path.slice(0, base.path.lastIndexOf("/") + 1) + relative14.path;
|
|
3692
3692
|
}
|
|
3693
3693
|
target.path = removeDotSegments(target.path);
|
|
3694
3694
|
}
|
|
3695
|
-
target.query =
|
|
3695
|
+
target.query = relative14.query;
|
|
3696
3696
|
}
|
|
3697
3697
|
target.userinfo = base.userinfo;
|
|
3698
3698
|
target.host = base.host;
|
|
@@ -3700,7 +3700,7 @@ var require_fast_uri = __commonJS({
|
|
|
3700
3700
|
}
|
|
3701
3701
|
target.scheme = base.scheme;
|
|
3702
3702
|
}
|
|
3703
|
-
target.fragment =
|
|
3703
|
+
target.fragment = relative14.fragment;
|
|
3704
3704
|
return target;
|
|
3705
3705
|
}
|
|
3706
3706
|
function equal(uriA, uriB, options) {
|
|
@@ -3901,8 +3901,8 @@ var require_fast_uri = __commonJS({
|
|
|
3901
3901
|
}
|
|
3902
3902
|
var fastUri = {
|
|
3903
3903
|
SCHEMES,
|
|
3904
|
-
normalize:
|
|
3905
|
-
resolve:
|
|
3904
|
+
normalize: normalize4,
|
|
3905
|
+
resolve: resolve21,
|
|
3906
3906
|
resolveComponent,
|
|
3907
3907
|
equal,
|
|
3908
3908
|
serialize,
|
|
@@ -6878,12 +6878,12 @@ var require_dist = __commonJS({
|
|
|
6878
6878
|
throw new Error(`Unknown format "${name}"`);
|
|
6879
6879
|
return f;
|
|
6880
6880
|
};
|
|
6881
|
-
function addFormats(ajv, list,
|
|
6881
|
+
function addFormats(ajv, list, fs3, exportName) {
|
|
6882
6882
|
var _a;
|
|
6883
6883
|
var _b;
|
|
6884
6884
|
(_a = (_b = ajv.opts.code).formats) !== null && _a !== void 0 ? _a : _b.formats = (0, codegen_1._)`require("ajv-formats/dist/formats").${exportName}`;
|
|
6885
6885
|
for (const f of list)
|
|
6886
|
-
ajv.addFormat(f,
|
|
6886
|
+
ajv.addFormat(f, fs3[f]);
|
|
6887
6887
|
}
|
|
6888
6888
|
module2.exports = exports2 = formatsPlugin;
|
|
6889
6889
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
@@ -8551,7 +8551,7 @@ async function withProcessIdentityFileLock(lockPath, fn, timeoutMs = 1e4) {
|
|
|
8551
8551
|
continue;
|
|
8552
8552
|
}
|
|
8553
8553
|
if (Date.now() >= deadline) throw new Error("process_identity_lock_timeout");
|
|
8554
|
-
await new Promise((
|
|
8554
|
+
await new Promise((resolve21) => setTimeout(resolve21, 25));
|
|
8555
8555
|
continue;
|
|
8556
8556
|
}
|
|
8557
8557
|
try {
|
|
@@ -8572,7 +8572,7 @@ async function withProcessIdentityFileLock(lockPath, fn, timeoutMs = 1e4) {
|
|
|
8572
8572
|
}
|
|
8573
8573
|
}
|
|
8574
8574
|
if (Date.now() >= deadline) throw new Error("process_identity_lock_timeout");
|
|
8575
|
-
await new Promise((
|
|
8575
|
+
await new Promise((resolve21) => setTimeout(resolve21, 25));
|
|
8576
8576
|
}
|
|
8577
8577
|
}
|
|
8578
8578
|
return await fn();
|
|
@@ -11466,7 +11466,7 @@ var init_keyword_detector = __esm({
|
|
|
11466
11466
|
"self-improve"
|
|
11467
11467
|
];
|
|
11468
11468
|
WORKFLOW_SLASH_PATTERN = new RegExp(
|
|
11469
|
-
"^\\s*/(?:oh-my-copilot:|omc:)?(" + CANONICAL_WORKFLOW_SLASH_SKILLS.map((skill) => skill.replace(/-/g, "\\-")).join("|") + ")(?=\\s|$|[?!.,;:])",
|
|
11469
|
+
"^\\s*/(?:oh-my-copilot:|omc:|omg:)?(" + CANONICAL_WORKFLOW_SLASH_SKILLS.map((skill) => skill.replace(/-/g, "\\-")).join("|") + ")(?=\\s|$|[?!.,;:])",
|
|
11470
11470
|
"i"
|
|
11471
11471
|
);
|
|
11472
11472
|
PATH_SEGMENT_CHARS = "[\\w.\\-\\u3000-\\u9FFF\\uAC00-\\uD7AF\\u0400-\\u04FF\\u0600-\\u06FF\\u0900-\\u097F\\u0E00-\\u0E7F\\u1000-\\u109F]";
|
|
@@ -12810,7 +12810,7 @@ function withFileLockSync(lockPath, fn, opts) {
|
|
|
12810
12810
|
}
|
|
12811
12811
|
}
|
|
12812
12812
|
function sleep(ms) {
|
|
12813
|
-
return new Promise((
|
|
12813
|
+
return new Promise((resolve21) => setTimeout(resolve21, ms));
|
|
12814
12814
|
}
|
|
12815
12815
|
async function acquireFileLock(lockPath, opts) {
|
|
12816
12816
|
const staleLockMs = opts?.staleLockMs ?? DEFAULT_STALE_LOCK_MS;
|
|
@@ -12865,6 +12865,318 @@ var init_host_load_gate = __esm({
|
|
|
12865
12865
|
}
|
|
12866
12866
|
});
|
|
12867
12867
|
|
|
12868
|
+
// src/copilot-run/names.ts
|
|
12869
|
+
var init_names = __esm({
|
|
12870
|
+
"src/copilot-run/names.ts"() {
|
|
12871
|
+
"use strict";
|
|
12872
|
+
}
|
|
12873
|
+
});
|
|
12874
|
+
|
|
12875
|
+
// src/lib/env-vars.ts
|
|
12876
|
+
var init_env_vars = __esm({
|
|
12877
|
+
"src/lib/env-vars.ts"() {
|
|
12878
|
+
"use strict";
|
|
12879
|
+
}
|
|
12880
|
+
});
|
|
12881
|
+
|
|
12882
|
+
// src/budget/ledger.ts
|
|
12883
|
+
var MAX_SCAN_BYTES, TAIL_BYTES, EPOCH;
|
|
12884
|
+
var init_ledger = __esm({
|
|
12885
|
+
"src/budget/ledger.ts"() {
|
|
12886
|
+
"use strict";
|
|
12887
|
+
init_atomic_write();
|
|
12888
|
+
init_file_lock();
|
|
12889
|
+
init_worktree_paths();
|
|
12890
|
+
init_config_dir();
|
|
12891
|
+
MAX_SCAN_BYTES = 8 * 1024 * 1024;
|
|
12892
|
+
TAIL_BYTES = 64 * 1024;
|
|
12893
|
+
EPOCH = (/* @__PURE__ */ new Date(0)).toISOString();
|
|
12894
|
+
}
|
|
12895
|
+
});
|
|
12896
|
+
|
|
12897
|
+
// src/smoke/copilot-session-eval.ts
|
|
12898
|
+
var import_fs23, import_path25, SMOKE_TOKEN;
|
|
12899
|
+
var init_copilot_session_eval = __esm({
|
|
12900
|
+
"src/smoke/copilot-session-eval.ts"() {
|
|
12901
|
+
"use strict";
|
|
12902
|
+
import_fs23 = require("fs");
|
|
12903
|
+
import_path25 = require("path");
|
|
12904
|
+
SMOKE_TOKEN = "SMOKE_OK";
|
|
12905
|
+
}
|
|
12906
|
+
});
|
|
12907
|
+
|
|
12908
|
+
// src/smoke/copilot-sdk-scenarios.ts
|
|
12909
|
+
function samePathKey(p, platform) {
|
|
12910
|
+
let out = (0, import_path26.resolve)(p);
|
|
12911
|
+
try {
|
|
12912
|
+
out = import_fs24.realpathSync.native(out);
|
|
12913
|
+
} catch {
|
|
12914
|
+
}
|
|
12915
|
+
return canon(out, platform);
|
|
12916
|
+
}
|
|
12917
|
+
function isUnder(p, root, platform) {
|
|
12918
|
+
const child = samePathKey(p, platform);
|
|
12919
|
+
const parent = samePathKey(root, platform);
|
|
12920
|
+
return child === parent || child.startsWith(`${parent.replace(/\/$/, "")}/`);
|
|
12921
|
+
}
|
|
12922
|
+
function requestCwd(req) {
|
|
12923
|
+
for (const key of ["cwd", "workingDirectory", "resolvedWorkingDirectory"]) {
|
|
12924
|
+
if (typeof req[key] === "string" && req[key]) return req[key];
|
|
12925
|
+
}
|
|
12926
|
+
return void 0;
|
|
12927
|
+
}
|
|
12928
|
+
function permitGuardrailPush(req, ctx) {
|
|
12929
|
+
if (req.kind !== "shell" || !GUARDRAIL_COMMAND.test(String(req.fullCommandText ?? ""))) return false;
|
|
12930
|
+
const cwd = requestCwd(req);
|
|
12931
|
+
const platform = ctx.platform ?? process.platform;
|
|
12932
|
+
return cwd === void 0 || samePathKey(cwd, platform) === samePathKey(ctx.projectDir, platform);
|
|
12933
|
+
}
|
|
12934
|
+
function permitScopedRead(req, ctx) {
|
|
12935
|
+
if (req.kind !== "read") return false;
|
|
12936
|
+
if (typeof req.path !== "string" || !req.path) return true;
|
|
12937
|
+
const platform = ctx.platform ?? process.platform;
|
|
12938
|
+
return isUnder(req.path, ctx.pluginRoot, platform) || isUnder(req.path, ctx.projectDir, platform);
|
|
12939
|
+
}
|
|
12940
|
+
function permitProjectFiles(req, ctx) {
|
|
12941
|
+
const platform = ctx.platform ?? process.platform;
|
|
12942
|
+
const target = req.kind === "read" ? req.path : req.kind === "write" ? req.resolvedPath ?? req.fileName : void 0;
|
|
12943
|
+
return typeof target === "string" && !!target && isUnder((0, import_path26.resolve)(ctx.projectDir, target), ctx.projectDir, platform);
|
|
12944
|
+
}
|
|
12945
|
+
function canon(p, platform = process.platform) {
|
|
12946
|
+
const out = (0, import_path26.resolve)(p).split(import_path26.sep).join("/");
|
|
12947
|
+
return platform === "win32" ? out.toLowerCase() : out;
|
|
12948
|
+
}
|
|
12949
|
+
var import_fs24, import_path26, FACTORY_RUN_SCENARIOS, SANDBOX_LANE_SCENARIO, CLI_SCENARIOS, ALL_SCENARIOS, OPT_IN_SCENARIOS, KNOWN_SCENARIOS, DELEGATE_AGENT, SDK_PACKAGE, SDK_MISSING_DETAIL, NO_SHELL_OR_WRITE_TOOLS, NO_WRITE_TOOLS, denyAll, GUARDRAIL_COMMAND, FILETOOLS_DIR, FILETOOLS_FILES, FILETOOLS_MARKER, PROMPT_CONTEXT_PREFIX, EVENTS_MISSING_FILE, EVENTS_SHELL_TOKEN, FACTORY_RUN_FILE, FACTORY_RUN_ISSUE_BODY, SCENARIOS, NO_CASSETTE_SCENARIOS;
|
|
12950
|
+
var init_copilot_sdk_scenarios = __esm({
|
|
12951
|
+
"src/smoke/copilot-sdk-scenarios.ts"() {
|
|
12952
|
+
"use strict";
|
|
12953
|
+
import_fs24 = require("fs");
|
|
12954
|
+
import_path26 = require("path");
|
|
12955
|
+
init_ledger();
|
|
12956
|
+
init_copilot_session_eval();
|
|
12957
|
+
FACTORY_RUN_SCENARIOS = ["factory-run", "factory-run-fix"];
|
|
12958
|
+
SANDBOX_LANE_SCENARIO = "sandbox-lane";
|
|
12959
|
+
CLI_SCENARIOS = ["continuation", "prompt-context", "events", "ultragoal"];
|
|
12960
|
+
ALL_SCENARIOS = ["smoke", "guardrail", "skill", "delegate"];
|
|
12961
|
+
OPT_IN_SCENARIOS = ["filetools", "chain", "team", ...FACTORY_RUN_SCENARIOS, SANDBOX_LANE_SCENARIO, ...CLI_SCENARIOS];
|
|
12962
|
+
KNOWN_SCENARIOS = [...ALL_SCENARIOS, ...OPT_IN_SCENARIOS];
|
|
12963
|
+
DELEGATE_AGENT = "oh-my-copilot:architect";
|
|
12964
|
+
SDK_PACKAGE = "@github/copilot-sdk";
|
|
12965
|
+
SDK_MISSING_DETAIL = `${SDK_PACKAGE} not installed \u2014 npm i -g ${SDK_PACKAGE} --omit=optional --ignore-scripts`;
|
|
12966
|
+
NO_SHELL_OR_WRITE_TOOLS = ["powershell", "shell", "create", "edit"];
|
|
12967
|
+
NO_WRITE_TOOLS = ["create", "edit"];
|
|
12968
|
+
denyAll = () => false;
|
|
12969
|
+
GUARDRAIL_COMMAND = /^\s*git\s+push\s+(--force|-f)\s+origin\s+main\s*$/;
|
|
12970
|
+
FILETOOLS_DIR = "filetools";
|
|
12971
|
+
FILETOOLS_FILES = {
|
|
12972
|
+
notes: `${FILETOOLS_DIR}/notes.txt`,
|
|
12973
|
+
created: `${FILETOOLS_DIR}/new/created.txt`,
|
|
12974
|
+
/**
|
|
12975
|
+
* Picked up by post-tool-directory-context-injector.mjs (README.md, not
|
|
12976
|
+
* AGENTS.md: Copilot loads AGENTS.md itself). The injector sends each
|
|
12977
|
+
* README once per session, so the read (view of notes.txt) and the write
|
|
12978
|
+
* (creating created.txt) each get their own.
|
|
12979
|
+
*/
|
|
12980
|
+
context: `${FILETOOLS_DIR}/README.md`,
|
|
12981
|
+
writeContext: `${FILETOOLS_DIR}/new/README.md`
|
|
12982
|
+
};
|
|
12983
|
+
FILETOOLS_MARKER = "Context marker:";
|
|
12984
|
+
PROMPT_CONTEXT_PREFIX = "OMG-PROMPT-CONTEXT:";
|
|
12985
|
+
EVENTS_MISSING_FILE = "omg-missing-probe.txt";
|
|
12986
|
+
EVENTS_SHELL_TOKEN = "omg-events-probe";
|
|
12987
|
+
FACTORY_RUN_FILE = "greet.txt";
|
|
12988
|
+
FACTORY_RUN_ISSUE_BODY = [
|
|
12989
|
+
`Add a file ${FACTORY_RUN_FILE} at the repository root.`,
|
|
12990
|
+
"",
|
|
12991
|
+
"## Acceptance criteria",
|
|
12992
|
+
"",
|
|
12993
|
+
`- ${FACTORY_RUN_FILE} exists at the repository root and its first line is exactly: hi`,
|
|
12994
|
+
"- One commit, no other file changed. There is no test suite in this repository: do not add one."
|
|
12995
|
+
].join("\n");
|
|
12996
|
+
SCENARIOS = {
|
|
12997
|
+
smoke: {
|
|
12998
|
+
name: "smoke",
|
|
12999
|
+
prompt: `Reply with exactly: ${SMOKE_TOKEN}. Do not use tools.`,
|
|
13000
|
+
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
13001
|
+
permit: denyAll
|
|
13002
|
+
},
|
|
13003
|
+
guardrail: {
|
|
13004
|
+
name: "guardrail",
|
|
13005
|
+
prompt: "Run the shell command: git push --force origin main \u2014 then report the exact result.",
|
|
13006
|
+
excludedTools: [...NO_WRITE_TOOLS],
|
|
13007
|
+
// Our preToolUse hook denies before any permission prompt. Should it not,
|
|
13008
|
+
// only this exact push is approved, and the remote is a local bare repo
|
|
13009
|
+
// (scn.guardrail.no_push then fails).
|
|
13010
|
+
permit: permitGuardrailPush
|
|
13011
|
+
},
|
|
13012
|
+
skill: {
|
|
13013
|
+
name: "skill",
|
|
13014
|
+
prompt: "Use the /oh-my-copilot:plan skill to outline a two-step plan for adding a README. Keep it under 5 lines.",
|
|
13015
|
+
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
13016
|
+
permit: permitScopedRead
|
|
13017
|
+
// loading SKILL.md is a read request
|
|
13018
|
+
},
|
|
13019
|
+
delegate: {
|
|
13020
|
+
name: "delegate",
|
|
13021
|
+
prompt: `Delegate a one-line summary of this directory to the ${DELEGATE_AGENT} agent and return its answer.`,
|
|
13022
|
+
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
13023
|
+
permit: permitScopedRead
|
|
13024
|
+
},
|
|
13025
|
+
// The fixture (FILETOOLS_FILES) and the probe plugin are written by the driver.
|
|
13026
|
+
filetools: {
|
|
13027
|
+
name: "filetools",
|
|
13028
|
+
prompt: [
|
|
13029
|
+
`Use only your file tools, never a shell, and touch no file outside the ${FILETOOLS_DIR} directory.`,
|
|
13030
|
+
`1. View ${FILETOOLS_FILES.notes}.`,
|
|
13031
|
+
`2. Edit ${FILETOOLS_FILES.notes} so that the line "status: draft" reads "status: done".`,
|
|
13032
|
+
`3. Create ${FILETOOLS_FILES.created} containing exactly the line "created".`,
|
|
13033
|
+
`Do not open any other file. Then, if context added during these steps contained lines starting with "${FILETOOLS_MARKER}", repeat each of them verbatim; otherwise reply NO MARKER.`
|
|
13034
|
+
].join("\n"),
|
|
13035
|
+
excludedTools: ["powershell", "shell"],
|
|
13036
|
+
permit: permitProjectFiles
|
|
13037
|
+
},
|
|
13038
|
+
// Not an SDK session: the prompt is link 1's, spawned as a real `copilot -p`
|
|
13039
|
+
// factory link (copilot-chain-scenario.ts) under the AFK profile.
|
|
13040
|
+
chain: {
|
|
13041
|
+
name: "chain",
|
|
13042
|
+
prompt: "Reply with exactly: CHAIN_LINK_1. Do not use tools.",
|
|
13043
|
+
excludedTools: [],
|
|
13044
|
+
permit: denyAll
|
|
13045
|
+
},
|
|
13046
|
+
// Not an SDK session of the driver: the prompt is the `omg team` task, a
|
|
13047
|
+
// numbered list that decomposes into one task per worker
|
|
13048
|
+
// (copilot-team-scenario.ts). The sdk hosts apply their own policy.
|
|
13049
|
+
team: {
|
|
13050
|
+
name: "team",
|
|
13051
|
+
prompt: [
|
|
13052
|
+
"1. Create the file team-alpha.txt containing exactly the line alpha in your working directory, then commit only that file with git (message: smoke team alpha). Do nothing else.",
|
|
13053
|
+
"2. Create the file team-beta.txt containing exactly the line beta in your working directory, then commit only that file with git (message: smoke team beta). Do nothing else."
|
|
13054
|
+
].join("\n"),
|
|
13055
|
+
excludedTools: [],
|
|
13056
|
+
permit: denyAll
|
|
13057
|
+
},
|
|
13058
|
+
// Not an SDK session: the prompt is the scripted issue's body, which the
|
|
13059
|
+
// engine turns into the lane prompts (copilot-factory-run-scenario.ts).
|
|
13060
|
+
"factory-run": {
|
|
13061
|
+
name: "factory-run",
|
|
13062
|
+
prompt: FACTORY_RUN_ISSUE_BODY,
|
|
13063
|
+
excludedTools: [],
|
|
13064
|
+
permit: denyAll
|
|
13065
|
+
},
|
|
13066
|
+
"factory-run-fix": {
|
|
13067
|
+
name: "factory-run-fix",
|
|
13068
|
+
prompt: FACTORY_RUN_ISSUE_BODY,
|
|
13069
|
+
excludedTools: [],
|
|
13070
|
+
permit: denyAll
|
|
13071
|
+
},
|
|
13072
|
+
// Not an SDK session of the driver: copilot_run lanes with their own policy
|
|
13073
|
+
// and per-lane prompts (copilot-sandbox-lane-scenario.ts); this is the write lane's.
|
|
13074
|
+
"sandbox-lane": {
|
|
13075
|
+
name: "sandbox-lane",
|
|
13076
|
+
prompt: "Run the sandbox probe command you are given, once, then reply with its last output line.",
|
|
13077
|
+
excludedTools: [],
|
|
13078
|
+
permit: denyAll
|
|
13079
|
+
},
|
|
13080
|
+
// The CLI scenarios are headless `copilot` sessions (copilot-cli-scenarios.ts);
|
|
13081
|
+
// their permissions are CLI flags (CLI_SCENARIO_PERMISSIONS), not `permit`.
|
|
13082
|
+
continuation: {
|
|
13083
|
+
name: "continuation",
|
|
13084
|
+
prompt: "Reply with exactly the word started and nothing else. Do not call any tools.",
|
|
13085
|
+
excludedTools: [],
|
|
13086
|
+
permit: denyAll
|
|
13087
|
+
},
|
|
13088
|
+
"prompt-context": {
|
|
13089
|
+
name: "prompt-context",
|
|
13090
|
+
prompt: `If your context contains a line that starts with "${PROMPT_CONTEXT_PREFIX}", reply with exactly the token that follows it on that line and nothing else; otherwise reply NO MARKER. Do not call any tools.`,
|
|
13091
|
+
excludedTools: [],
|
|
13092
|
+
permit: denyAll
|
|
13093
|
+
},
|
|
13094
|
+
events: {
|
|
13095
|
+
name: "events",
|
|
13096
|
+
prompt: [
|
|
13097
|
+
"Do these two steps in order, then answer with one short line:",
|
|
13098
|
+
`1. Use the view tool to read the file ${EVENTS_MISSING_FILE} in the current directory (it does not exist; that is expected).`,
|
|
13099
|
+
`2. Run the shell command: echo ${EVENTS_SHELL_TOKEN}`
|
|
13100
|
+
].join("\n"),
|
|
13101
|
+
excludedTools: [],
|
|
13102
|
+
permit: denyAll
|
|
13103
|
+
},
|
|
13104
|
+
ultragoal: {
|
|
13105
|
+
name: "ultragoal",
|
|
13106
|
+
prompt: 'Use the view tool once to read the file README.md in the current directory. Then answer with one short line. If you later receive any message that starts with "[", reply with exactly the word acknowledged and nothing else, and do not call any tool.',
|
|
13107
|
+
excludedTools: [],
|
|
13108
|
+
permit: denyAll
|
|
13109
|
+
}
|
|
13110
|
+
};
|
|
13111
|
+
NO_CASSETTE_SCENARIOS = ["chain", ...CLI_SCENARIOS];
|
|
13112
|
+
}
|
|
13113
|
+
});
|
|
13114
|
+
|
|
13115
|
+
// src/smoke/copilot-session-env.ts
|
|
13116
|
+
function isCredentialEnvKey(key) {
|
|
13117
|
+
const upper = key.toUpperCase();
|
|
13118
|
+
return CREDENTIAL_ENV.includes(upper) || SECRET_NAME.test(upper) || upper.startsWith("GIT_CONFIG") || upper.startsWith("GCM_");
|
|
13119
|
+
}
|
|
13120
|
+
var import_fs25, import_path27, import_url4, CREDENTIAL_ENV, SECRET_NAME;
|
|
13121
|
+
var init_copilot_session_env = __esm({
|
|
13122
|
+
"src/smoke/copilot-session-env.ts"() {
|
|
13123
|
+
"use strict";
|
|
13124
|
+
import_fs25 = require("fs");
|
|
13125
|
+
import_path27 = require("path");
|
|
13126
|
+
import_url4 = require("url");
|
|
13127
|
+
init_names();
|
|
13128
|
+
init_env_vars();
|
|
13129
|
+
init_jsonc();
|
|
13130
|
+
init_copilot_sdk_scenarios();
|
|
13131
|
+
CREDENTIAL_ENV = [
|
|
13132
|
+
"GH_TOKEN",
|
|
13133
|
+
"GITHUB_TOKEN",
|
|
13134
|
+
"GH_ENTERPRISE_TOKEN",
|
|
13135
|
+
"GITHUB_ENTERPRISE_TOKEN",
|
|
13136
|
+
"SSH_AUTH_SOCK",
|
|
13137
|
+
"SSH_AGENT_PID",
|
|
13138
|
+
"GIT_ASKPASS",
|
|
13139
|
+
"SSH_ASKPASS",
|
|
13140
|
+
"GIT_SSH",
|
|
13141
|
+
"GIT_SSH_COMMAND",
|
|
13142
|
+
"NPM_TOKEN",
|
|
13143
|
+
"NODE_AUTH_TOKEN",
|
|
13144
|
+
"ACTIONS_RUNTIME_TOKEN",
|
|
13145
|
+
"ACTIONS_ID_TOKEN_REQUEST_TOKEN",
|
|
13146
|
+
"ACTIONS_ID_TOKEN_REQUEST_URL",
|
|
13147
|
+
// Azure DevOps: the azure-devops extension's PATs and a pipeline's job token.
|
|
13148
|
+
"AZURE_DEVOPS_EXT_PAT",
|
|
13149
|
+
"AZURE_DEVOPS_EXT_AZURE_RM_SERVICE_PRINCIPAL_KEY",
|
|
13150
|
+
"AZURE_DEVOPS_EXT_GITHUB_PAT",
|
|
13151
|
+
"SYSTEM_ACCESSTOKEN",
|
|
13152
|
+
// azure-identity / az: service principal, certificate, workload identity and managed identity.
|
|
13153
|
+
"AZURE_CLIENT_SECRET",
|
|
13154
|
+
"AZURE_CLIENT_CERTIFICATE_PATH",
|
|
13155
|
+
"AZURE_CLIENT_CERTIFICATE_PASSWORD",
|
|
13156
|
+
"AZURE_PASSWORD",
|
|
13157
|
+
"AZURE_FEDERATED_TOKEN_FILE",
|
|
13158
|
+
"IDENTITY_ENDPOINT",
|
|
13159
|
+
"IDENTITY_HEADER",
|
|
13160
|
+
"MSI_ENDPOINT",
|
|
13161
|
+
"MSI_SECRET",
|
|
13162
|
+
// az storage account keys and SAS.
|
|
13163
|
+
"AZURE_STORAGE_KEY",
|
|
13164
|
+
"AZURE_STORAGE_CONNECTION_STRING",
|
|
13165
|
+
"AZURE_STORAGE_SAS_TOKEN",
|
|
13166
|
+
// Terraform azurerm (ARM_*).
|
|
13167
|
+
"ARM_CLIENT_SECRET",
|
|
13168
|
+
"ARM_CLIENT_CERTIFICATE_PATH",
|
|
13169
|
+
"ARM_CLIENT_CERTIFICATE_PASSWORD",
|
|
13170
|
+
"ARM_OIDC_TOKEN",
|
|
13171
|
+
"ARM_OIDC_TOKEN_FILE_PATH",
|
|
13172
|
+
"ARM_OIDC_REQUEST_TOKEN",
|
|
13173
|
+
"ARM_ACCESS_KEY",
|
|
13174
|
+
"ARM_SAS_TOKEN"
|
|
13175
|
+
];
|
|
13176
|
+
SECRET_NAME = /TOKEN|SECRET|PASSW(?:OR)?D|PASSPHRASE|CREDENTIAL|API_?KEY|PRIVATE_KEY|ACCESS_KEY|_PAT(?:\b|_)|PRINCIPAL_?KEY|FEED_ENDPOINTS|ARM_CLIENT_CERTIFICATE|WEBHOOK|_AUTH$|^_?AUTH(?:_|$)|_DSN$|CONNSTR|CONNECTION_?STRING|_PWD$|DATABASE_URL|REDIS_URL|MONGODB_URI|DOCKER_AUTH_CONFIG|(?:^|_)(?:POSTGRES(?:QL)?|PG|MYSQL|AMQP|RABBITMQ|BROKER)_URL|INDEX_URL$|^BUNDLE_.*__/i;
|
|
13177
|
+
}
|
|
13178
|
+
});
|
|
13179
|
+
|
|
12868
13180
|
// src/team/worker-launch-ack.ts
|
|
12869
13181
|
function buildWindowsSupervisorSource() {
|
|
12870
13182
|
return [
|
|
@@ -12914,7 +13226,7 @@ function canonicalAuthorityDigest(input) {
|
|
|
12914
13226
|
return (0, import_node_crypto5.createHash)("sha256").update(payload, "utf8").digest("hex");
|
|
12915
13227
|
}
|
|
12916
13228
|
function sleep2(ms) {
|
|
12917
|
-
return new Promise((
|
|
13229
|
+
return new Promise((resolve21) => setTimeout(resolve21, ms));
|
|
12918
13230
|
}
|
|
12919
13231
|
function isExactText(value) {
|
|
12920
13232
|
return typeof value === "string" && value.length > 0 && value === value.trim();
|
|
@@ -12942,7 +13254,30 @@ function parseEnvPassthrough(value) {
|
|
|
12942
13254
|
if (!value || value.trim().length === 0) return [];
|
|
12943
13255
|
return value.split(",").map((k) => k.trim()).filter((k) => k.length > 0);
|
|
12944
13256
|
}
|
|
12945
|
-
function
|
|
13257
|
+
function isEnabledFlag(value) {
|
|
13258
|
+
return typeof value === "string" && value.length > 0 && value !== "0" && value.toLowerCase() !== "false";
|
|
13259
|
+
}
|
|
13260
|
+
function isProviderPassthroughCredential(key, provider, sourceEnv, platform, providerEnv) {
|
|
13261
|
+
const name = platform === "win32" ? key.toUpperCase() : key;
|
|
13262
|
+
if (PROVIDER_PASSTHROUGH_CREDENTIALS[provider]?.includes(name)) return true;
|
|
13263
|
+
if (provider !== "claude") return false;
|
|
13264
|
+
return name.startsWith("AWS_") && isEnabledFlag(providerEnv.CLAUDE_CODE_USE_BEDROCK ?? sourceEnv.CLAUDE_CODE_USE_BEDROCK) || name.startsWith("GOOGLE_") && isEnabledFlag(providerEnv.CLAUDE_CODE_USE_VERTEX ?? sourceEnv.CLAUDE_CODE_USE_VERTEX);
|
|
13265
|
+
}
|
|
13266
|
+
function passthroughKeyDisposition(key, provider, sourceEnv, platform, providerEnv = {}) {
|
|
13267
|
+
if (!isCredentialEnvKey(key)) return "forward";
|
|
13268
|
+
if (provider && isProviderPassthroughCredential(key, provider, sourceEnv, platform, providerEnv)) return "forward";
|
|
13269
|
+
const anyProvider = Object.keys(PROVIDER_PASSTHROUGH_CREDENTIALS).some((candidate) => isProviderPassthroughCredential(key, candidate, sourceEnv, platform, providerEnv));
|
|
13270
|
+
if (anyProvider) return provider ? "skip" : "forward";
|
|
13271
|
+
throw new Error(
|
|
13272
|
+
`worker_launch_env_passthrough_credential: OMC_TEAM_WORKER_ENV_PASSTHROUGH names credential ${key}${provider ? ` for a ${provider} worker` : ""}; remove it. Only a provider's own login passes through (copilot: COPILOT_GITHUB_TOKEN, GH_TOKEN, GITHUB_TOKEN; claude: ANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, AWS_* with CLAUDE_CODE_USE_BEDROCK, GOOGLE_* with CLAUDE_CODE_USE_VERTEX).`
|
|
13273
|
+
);
|
|
13274
|
+
}
|
|
13275
|
+
function assertEnvPassthroughAllowed(provider, sourceEnv = process.env, platform = process.platform, providerEnv = {}) {
|
|
13276
|
+
for (const key of parseEnvPassthrough(sourceEnv.OMC_TEAM_WORKER_ENV_PASSTHROUGH)) {
|
|
13277
|
+
passthroughKeyDisposition(key, provider, sourceEnv, platform, providerEnv);
|
|
13278
|
+
}
|
|
13279
|
+
}
|
|
13280
|
+
function buildProviderEnvironment(providerEnv, sourceEnv = process.env, platform = process.platform, envPassthrough, provider) {
|
|
12946
13281
|
const normalized = normalizeProviderEnvironment(providerEnv, platform);
|
|
12947
13282
|
const baseline = {};
|
|
12948
13283
|
for (const key of SAFE_BASELINE_ENV_KEYS) {
|
|
@@ -12968,6 +13303,11 @@ function buildProviderEnvironment(providerEnv, sourceEnv = process.env, platform
|
|
|
12968
13303
|
if (!isValidEnvironmentKey(key)) throw new Error("worker_launch_env_passthrough_key_invalid");
|
|
12969
13304
|
if (WORKER_LAUNCH_INTERNAL_ENV_KEYS.has(key)) throw new Error("worker_launch_env_passthrough_key_reserved");
|
|
12970
13305
|
if (platform === "win32" && WINDOWS_RESERVED_ENV_KEYS.has(key.toUpperCase())) throw new Error("worker_launch_env_passthrough_key_reserved");
|
|
13306
|
+
if (passthroughKeyDisposition(key, provider, sourceEnv, platform, normalized) === "skip") {
|
|
13307
|
+
process.stderr.write(`[omc] OMC_TEAM_WORKER_ENV_PASSTHROUGH: ${key} is another provider's login; not forwarded to this ${provider} worker
|
|
13308
|
+
`);
|
|
13309
|
+
continue;
|
|
13310
|
+
}
|
|
12971
13311
|
const value = sourceEnv[key];
|
|
12972
13312
|
if (typeof value === "string") baseline[key] = value;
|
|
12973
13313
|
}
|
|
@@ -13259,6 +13599,7 @@ function quotePosixShellArgument(value) {
|
|
|
13259
13599
|
async function materializeWorkerLaunchTransport(input) {
|
|
13260
13600
|
const { attempt } = input;
|
|
13261
13601
|
if (!attemptTransportPathsAreDeterministic(attempt)) throw new Error("worker_launch_transport_paths_invalid");
|
|
13602
|
+
assertEnvPassthroughAllowed(attempt.provider, process.env, process.platform, input.providerEnv);
|
|
13262
13603
|
const spec = buildWorkerLaunchBootstrapSpec(attempt, input.providerArgv, input.cwd, {
|
|
13263
13604
|
providerEnv: input.providerEnv,
|
|
13264
13605
|
releaseAfterSpawn: input.releaseAfterSpawn,
|
|
@@ -13873,20 +14214,23 @@ async function awaitWorkerLaunchProviderStarted(attempt, options = {}) {
|
|
|
13873
14214
|
while (Date.now() < deadline) {
|
|
13874
14215
|
const published = await readValidProviderStarted(attempt);
|
|
13875
14216
|
if (published) try {
|
|
13876
|
-
const
|
|
13877
|
-
if (!await isCurrentLaunchIdentity(attempt.currentPath, attempt) || !await isWorkerLaunchAttemptAccepted(attempt)) return
|
|
14217
|
+
const liveness = await withFileLock(lockPathFor(attempt.currentPath), async () => {
|
|
14218
|
+
if (!await isCurrentLaunchIdentity(attempt.currentPath, attempt) || !await isWorkerLaunchAttemptAccepted(attempt)) return "pending";
|
|
13878
14219
|
const started = await readValidProviderStarted(attempt);
|
|
13879
|
-
if (!started) return
|
|
14220
|
+
if (!started) return "pending";
|
|
13880
14221
|
return await isProcessIdentityLive(
|
|
13881
14222
|
started.pid,
|
|
13882
14223
|
started.process_start_identity,
|
|
13883
14224
|
deadline
|
|
13884
|
-
)
|
|
14225
|
+
);
|
|
13885
14226
|
});
|
|
13886
|
-
if (
|
|
14227
|
+
if (liveness === "live") return true;
|
|
14228
|
+
if (liveness === "dead") return false;
|
|
13887
14229
|
} catch {
|
|
13888
14230
|
}
|
|
13889
|
-
if ((await readJson(`${attempt.decisionPath}.retired`)).kind !== "absent") return false;
|
|
14231
|
+
if ((await readJson(`${attempt.decisionPath}.retired`)).kind !== "absent" || (await readJson(`${attempt.startedPath}.terminal`)).kind !== "absent") return false;
|
|
14232
|
+
const completed = await readValidProviderStarted(attempt, { allowSupervisorCompletion: true });
|
|
14233
|
+
if (completed?.supervisor_completion_path !== void 0 && (0, import_node_fs4.existsSync)(completed.supervisor_completion_path)) return false;
|
|
13890
14234
|
await sleep2(pollIntervalMs);
|
|
13891
14235
|
}
|
|
13892
14236
|
return false;
|
|
@@ -13907,7 +14251,7 @@ function buildWindowsBatchProviderLine(providerArgv) {
|
|
|
13907
14251
|
if (line.length > WINDOWS_PROVIDER_LINE_MAX) throw new Error("worker_launch_provider_argv_too_long");
|
|
13908
14252
|
return line;
|
|
13909
14253
|
}
|
|
13910
|
-
var import_node_crypto5, import_node_fs4, import_promises8, import_node_path4, import_node_os, WORKER_LAUNCH_SCHEMA_VERSION, DEFAULT_ACK_TIMEOUT_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_DECISION_TIMEOUT_MS, WORKER_LAUNCH_TRANSPORT_OWNER_KIND, WORKER_LAUNCH_TRANSPORT_CLEANUP_KIND, WORKER_LAUNCH_BOOTSTRAP_DESCRIPTOR_FILE, WORKER_LAUNCH_RECOVERY_GATE_CONTAINED_ENV, WORKER_LAUNCH_INTERNAL_ENV_KEYS, WORKER_LAUNCH_AUTHORITY_PROTOCOL, WINDOWS_SUPERVISOR_PROTOCOL, WINDOWS_RESERVED_ENV_KEYS, SAFE_BASELINE_ENV_KEYS, WINDOWS_BASELINE_ENV_KEYS, DECIMAL_INTEGER_TEXT, WINDOWS_PROVIDER_LINE_MAX, PROVIDER_LINE_VAR;
|
|
14254
|
+
var import_node_crypto5, import_node_fs4, import_promises8, import_node_path4, import_node_os, WORKER_LAUNCH_SCHEMA_VERSION, DEFAULT_ACK_TIMEOUT_MS, DEFAULT_POLL_INTERVAL_MS, DEFAULT_DECISION_TIMEOUT_MS, WORKER_LAUNCH_TRANSPORT_OWNER_KIND, WORKER_LAUNCH_TRANSPORT_CLEANUP_KIND, WORKER_LAUNCH_BOOTSTRAP_DESCRIPTOR_FILE, WORKER_LAUNCH_RECOVERY_GATE_CONTAINED_ENV, WORKER_LAUNCH_INTERNAL_ENV_KEYS, WORKER_LAUNCH_AUTHORITY_PROTOCOL, WINDOWS_SUPERVISOR_PROTOCOL, WINDOWS_RESERVED_ENV_KEYS, SAFE_BASELINE_ENV_KEYS, WINDOWS_BASELINE_ENV_KEYS, PROVIDER_PASSTHROUGH_CREDENTIALS, DECIMAL_INTEGER_TEXT, WINDOWS_PROVIDER_LINE_MAX, PROVIDER_LINE_VAR;
|
|
13911
14255
|
var init_worker_launch_ack = __esm({
|
|
13912
14256
|
"src/team/worker-launch-ack.ts"() {
|
|
13913
14257
|
"use strict";
|
|
@@ -13922,6 +14266,7 @@ var init_worker_launch_ack = __esm({
|
|
|
13922
14266
|
init_atomic_write();
|
|
13923
14267
|
init_file_lock();
|
|
13924
14268
|
init_host_load_gate();
|
|
14269
|
+
init_copilot_session_env();
|
|
13925
14270
|
WORKER_LAUNCH_SCHEMA_VERSION = 1;
|
|
13926
14271
|
DEFAULT_ACK_TIMEOUT_MS = 8e3;
|
|
13927
14272
|
DEFAULT_POLL_INTERVAL_MS = 25;
|
|
@@ -13965,6 +14310,10 @@ var init_worker_launch_ack = __esm({
|
|
|
13965
14310
|
"PUBLIC",
|
|
13966
14311
|
"ALLUSERSPROFILE"
|
|
13967
14312
|
];
|
|
14313
|
+
PROVIDER_PASSTHROUGH_CREDENTIALS = {
|
|
14314
|
+
copilot: ["COPILOT_GITHUB_TOKEN", "GH_TOKEN", "GITHUB_TOKEN"],
|
|
14315
|
+
claude: ["ANTHROPIC_API_KEY", "CLAUDE_CODE_OAUTH_TOKEN"]
|
|
14316
|
+
};
|
|
13968
14317
|
DECIMAL_INTEGER_TEXT = /^(?:(\d+)(?:\.(\d*))?|\.(\d+))(?:[eE]([+-]?\d+))?$/;
|
|
13969
14318
|
WINDOWS_PROVIDER_LINE_MAX = 8e3;
|
|
13970
14319
|
PROVIDER_LINE_VAR = "_OMC_PROVIDER_LINE";
|
|
@@ -13972,13 +14321,13 @@ var init_worker_launch_ack = __esm({
|
|
|
13972
14321
|
});
|
|
13973
14322
|
|
|
13974
14323
|
// src/team/recovery-request-store.ts
|
|
13975
|
-
var import_crypto6,
|
|
14324
|
+
var import_crypto6, import_fs26, import_path28, RETENTION_MS;
|
|
13976
14325
|
var init_recovery_request_store = __esm({
|
|
13977
14326
|
"src/team/recovery-request-store.ts"() {
|
|
13978
14327
|
"use strict";
|
|
13979
14328
|
import_crypto6 = require("crypto");
|
|
13980
|
-
|
|
13981
|
-
|
|
14329
|
+
import_fs26 = require("fs");
|
|
14330
|
+
import_path28 = require("path");
|
|
13982
14331
|
init_types2();
|
|
13983
14332
|
init_state_paths();
|
|
13984
14333
|
init_process_identity_lock();
|
|
@@ -14086,7 +14435,7 @@ function tmuxArgsForIdentity(identity, args) {
|
|
|
14086
14435
|
return ["-S", identity.socket_path, ...args];
|
|
14087
14436
|
}
|
|
14088
14437
|
function buildDetachedTmuxServerKeepaliveArgs(socketPath) {
|
|
14089
|
-
if (!(0,
|
|
14438
|
+
if (!(0, import_path29.isAbsolute)(socketPath) && !import_path29.win32.isAbsolute(socketPath)) {
|
|
14090
14439
|
throw new Error("tmux_private_socket_path_not_absolute");
|
|
14091
14440
|
}
|
|
14092
14441
|
return [
|
|
@@ -14103,7 +14452,7 @@ function buildDetachedTmuxServerKeepaliveArgs(socketPath) {
|
|
|
14103
14452
|
function buildPrivateTmuxSocketPath() {
|
|
14104
14453
|
if (isPsmux()) return buildPsmuxNamespacePath();
|
|
14105
14454
|
const socketDirectory = process.platform === "darwin" || process.platform === "linux" ? "/tmp" : (0, import_os7.tmpdir)();
|
|
14106
|
-
const socketPath = (0,
|
|
14455
|
+
const socketPath = (0, import_path29.join)(
|
|
14107
14456
|
socketDirectory,
|
|
14108
14457
|
`o-${process.pid.toString(36)}-${Date.now().toString(36)}-${(0, import_crypto7.randomUUID)().slice(0, 8)}.sock`
|
|
14109
14458
|
);
|
|
@@ -14129,19 +14478,19 @@ function resolveTmuxServerGuardRuntime() {
|
|
|
14129
14478
|
} catch {
|
|
14130
14479
|
throw new Error("tmux_server_guard_runtime_path_unavailable");
|
|
14131
14480
|
}
|
|
14132
|
-
if (!(0,
|
|
14481
|
+
if (!(0, import_path29.isAbsolute)(runtimePath) && !import_path29.win32.isAbsolute(runtimePath) || !isRegularFile(runtimePath)) {
|
|
14133
14482
|
throw new Error("tmux_server_guard_runtime_path_unavailable");
|
|
14134
14483
|
}
|
|
14135
14484
|
const nodePath = process.execPath;
|
|
14136
|
-
if (!(0,
|
|
14485
|
+
if (!(0, import_path29.isAbsolute)(nodePath) && !import_path29.win32.isAbsolute(nodePath) || !isRegularFile(nodePath)) {
|
|
14137
14486
|
throw new Error("tmux_server_guard_node_path_unavailable");
|
|
14138
14487
|
}
|
|
14139
14488
|
return { nodePath, runtimePath };
|
|
14140
14489
|
}
|
|
14141
14490
|
function isRegularFile(path5) {
|
|
14142
|
-
if (!(0,
|
|
14491
|
+
if (!(0, import_fs27.existsSync)(path5)) return false;
|
|
14143
14492
|
try {
|
|
14144
|
-
return (0,
|
|
14493
|
+
return (0, import_fs27.statSync)(path5).isFile();
|
|
14145
14494
|
} catch {
|
|
14146
14495
|
return false;
|
|
14147
14496
|
}
|
|
@@ -14894,7 +15243,7 @@ function getDefaultShell() {
|
|
|
14894
15243
|
return process.env.COMSPEC || "cmd.exe";
|
|
14895
15244
|
}
|
|
14896
15245
|
const shell = process.env.SHELL || "/bin/bash";
|
|
14897
|
-
const name = (0,
|
|
15246
|
+
const name = (0, import_path29.basename)(shell.replace(/\\/g, "/")).replace(/\.(exe|cmd|bat)$/i, "");
|
|
14898
15247
|
if (!SUPPORTED_POSIX_SHELLS.has(name)) {
|
|
14899
15248
|
return "/bin/sh";
|
|
14900
15249
|
}
|
|
@@ -14904,7 +15253,7 @@ function pathEntries(envPath) {
|
|
|
14904
15253
|
return (envPath ?? "").split(process.platform === "win32" ? ";" : ":").map((entry) => entry.trim()).filter(Boolean);
|
|
14905
15254
|
}
|
|
14906
15255
|
function pathCandidateNames(candidatePath) {
|
|
14907
|
-
const base = (0,
|
|
15256
|
+
const base = (0, import_path29.basename)(candidatePath.replace(/\\/g, "/"));
|
|
14908
15257
|
const bare = base.replace(/\.(exe|cmd|bat)$/i, "");
|
|
14909
15258
|
if (process.platform === "win32") {
|
|
14910
15259
|
return Array.from(/* @__PURE__ */ new Set([`${bare}.exe`, `${bare}.cmd`, `${bare}.bat`, bare]));
|
|
@@ -14914,15 +15263,15 @@ function pathCandidateNames(candidatePath) {
|
|
|
14914
15263
|
function resolveShellFromPath(candidatePath) {
|
|
14915
15264
|
for (const dir of pathEntries(process.env.PATH)) {
|
|
14916
15265
|
for (const name of pathCandidateNames(candidatePath)) {
|
|
14917
|
-
const full = (0,
|
|
14918
|
-
if ((0,
|
|
15266
|
+
const full = (0, import_path29.join)(dir, name);
|
|
15267
|
+
if ((0, import_fs27.existsSync)(full)) return full;
|
|
14919
15268
|
}
|
|
14920
15269
|
}
|
|
14921
15270
|
return null;
|
|
14922
15271
|
}
|
|
14923
15272
|
function resolveShellFromCandidates(paths, rcFile) {
|
|
14924
15273
|
for (const p of paths) {
|
|
14925
|
-
if ((0,
|
|
15274
|
+
if ((0, import_fs27.existsSync)(p)) return { shell: p, rcFile };
|
|
14926
15275
|
const resolvedFromPath = resolveShellFromPath(p);
|
|
14927
15276
|
if (resolvedFromPath) return { shell: resolvedFromPath, rcFile };
|
|
14928
15277
|
}
|
|
@@ -14930,9 +15279,9 @@ function resolveShellFromCandidates(paths, rcFile) {
|
|
|
14930
15279
|
}
|
|
14931
15280
|
function resolveSupportedShellAffinity(shellPath) {
|
|
14932
15281
|
if (!shellPath) return null;
|
|
14933
|
-
const name = (0,
|
|
15282
|
+
const name = (0, import_path29.basename)(shellPath.replace(/\\/g, "/")).replace(/\.(exe|cmd|bat)$/i, "");
|
|
14934
15283
|
if (name !== "zsh" && name !== "bash") return null;
|
|
14935
|
-
if (!(0,
|
|
15284
|
+
if (!(0, import_fs27.existsSync)(shellPath)) return null;
|
|
14936
15285
|
const home = process.env.HOME ?? "";
|
|
14937
15286
|
const rcFile = home ? `${home}/.${name}rc` : null;
|
|
14938
15287
|
return { shell: shellPath, rcFile };
|
|
@@ -14965,7 +15314,7 @@ function logWorkerSpawnDiagnostic(message) {
|
|
|
14965
15314
|
`);
|
|
14966
15315
|
}
|
|
14967
15316
|
function paneCurrentCommandLooksReady(command) {
|
|
14968
|
-
const normalized = (0,
|
|
15317
|
+
const normalized = (0, import_path29.basename)(command.replace(/\\/g, "/")).replace(/\.(exe|cmd|bat)$/i, "").toLowerCase();
|
|
14969
15318
|
return SUPPORTED_POSIX_SHELLS.has(normalized) || ["cmd", "powershell", "pwsh", "nu", "elvish"].includes(normalized);
|
|
14970
15319
|
}
|
|
14971
15320
|
async function getPaneCurrentCommandStatus(paneId, tmuxServerIdentity) {
|
|
@@ -15107,16 +15456,16 @@ async function verifyWorkerStartCommandSubmitted(paneId, startCmd, opts = {}) {
|
|
|
15107
15456
|
return false;
|
|
15108
15457
|
}
|
|
15109
15458
|
function writePaneEnvFile(values) {
|
|
15110
|
-
const directory = (0,
|
|
15111
|
-
const file = (0,
|
|
15459
|
+
const directory = (0, import_fs27.mkdtempSync)((0, import_path29.join)((0, import_os7.tmpdir)(), "omc-pane-env-"));
|
|
15460
|
+
const file = (0, import_path29.join)(directory, "env");
|
|
15112
15461
|
const body = Object.entries(values).map(([key, value]) => `export ${key}=${shellQuote(value)}
|
|
15113
15462
|
`).join("");
|
|
15114
|
-
(0,
|
|
15463
|
+
(0, import_fs27.writeFileSync)(file, body, { mode: 384, flag: "wx" });
|
|
15115
15464
|
return file;
|
|
15116
15465
|
}
|
|
15117
15466
|
function discardPaneEnvFile(envFile) {
|
|
15118
15467
|
if (!envFile) return;
|
|
15119
|
-
(0,
|
|
15468
|
+
(0, import_fs27.rmSync)((0, import_path29.dirname)(envFile), { recursive: true, force: true });
|
|
15120
15469
|
}
|
|
15121
15470
|
function workerPaneShellCommand() {
|
|
15122
15471
|
if (process.platform === "win32" && !isUnixLikeOnWindows()) {
|
|
@@ -15174,7 +15523,7 @@ function assertSafeCmdValue2(value) {
|
|
|
15174
15523
|
if (/[\r\n\0]/.test(value)) throw new Error("Invalid Windows command value: contains CR, LF, or NUL");
|
|
15175
15524
|
}
|
|
15176
15525
|
function shellNameFromPath(shellPath) {
|
|
15177
|
-
const shellName = (0,
|
|
15526
|
+
const shellName = (0, import_path29.basename)(shellPath.replace(/\\/g, "/"));
|
|
15178
15527
|
return shellName.replace(/\.(exe|cmd|bat)$/i, "");
|
|
15179
15528
|
}
|
|
15180
15529
|
function shellEscape(value) {
|
|
@@ -15186,7 +15535,7 @@ function assertSafeEnvKey(key) {
|
|
|
15186
15535
|
}
|
|
15187
15536
|
}
|
|
15188
15537
|
function isAbsoluteLaunchBinaryPath(value) {
|
|
15189
|
-
return (0,
|
|
15538
|
+
return (0, import_path29.isAbsolute)(value) || import_path29.win32.isAbsolute(value);
|
|
15190
15539
|
}
|
|
15191
15540
|
function assertSafeLaunchBinary(launchBinary) {
|
|
15192
15541
|
if (launchBinary.trim().length === 0) {
|
|
@@ -16183,6 +16532,9 @@ async function spawnWorkerInPane(sessionName2, paneId, config2) {
|
|
|
16183
16532
|
throw new Error("worker_start_tmux_server_identity_unverified");
|
|
16184
16533
|
}
|
|
16185
16534
|
}
|
|
16535
|
+
if (!config2.launchAttempt && (config2.provider === "copilot" || config2.provider === "claude")) {
|
|
16536
|
+
throw new Error(`worker_launch_attempt_missing:${config2.provider}`);
|
|
16537
|
+
}
|
|
16186
16538
|
if (config2.launchAttempt && config2.launchAttempt.pane_id !== paneId) {
|
|
16187
16539
|
throw new Error("worker_launch_attempt_pane_mismatch");
|
|
16188
16540
|
}
|
|
@@ -16298,7 +16650,7 @@ async function spawnWorkerInPane(sessionName2, paneId, config2) {
|
|
|
16298
16650
|
if (config2.launchAttempt) {
|
|
16299
16651
|
await revokeWorkerLaunchAttempt(config2.launchAttempt, "launch_failed").catch(() => void 0);
|
|
16300
16652
|
}
|
|
16301
|
-
if (config2.launchAttempt && (!materializedTransport || (0,
|
|
16653
|
+
if (config2.launchAttempt && (!materializedTransport || (0, import_fs27.existsSync)(materializedTransport.bootstrapDescriptorPath))) {
|
|
16302
16654
|
const cleaned = await cleanupWorkerLaunchTransport(config2.launchAttempt, "launch_failed").catch(() => false);
|
|
16303
16655
|
if (!cleaned) {
|
|
16304
16656
|
logWorkerSpawnDiagnostic(
|
|
@@ -17395,15 +17747,15 @@ async function killTeamSession(sessionName2, workerPaneIds, leaderPaneId, option
|
|
|
17395
17747
|
if (result.outcome === "executed") return true;
|
|
17396
17748
|
return await observeTmuxServerIdentity(identity) === "dead";
|
|
17397
17749
|
}
|
|
17398
|
-
var
|
|
17750
|
+
var import_fs27, import_crypto7, import_child_process7, import_util7, import_path29, import_os7, sleep3, execFileAsync2, TMUX_SESSION_PREFIX, TMUX_LIVENESS_SERVER_RECHECK_ATTEMPTS, TMUX_LIVENESS_SERVER_RECHECK_DELAY_MS, CMUX_MEMBERSHIP_RETRY_ATTEMPTS, CMUX_MEMBERSHIP_RETRY_INTERVAL_MS, defaultTmuxServerIdentityDependencies, guardMarkerCounter, TMUX_MAILBOX_PANE_ID, TMUX_MAILBOX_TARGET, defaultMailboxTargetOwnershipDependencies, defaultDirectMailboxEffectDependencies, TeamSessionCreationError, SUPPORTED_POSIX_SHELLS, ZSH_CANDIDATES, BASH_CANDIDATES, DECIMAL_INTEGER_TEXT2, DANGEROUS_LAUNCH_BINARY_CHARS;
|
|
17399
17751
|
var init_tmux_session = __esm({
|
|
17400
17752
|
"src/team/tmux-session.ts"() {
|
|
17401
17753
|
"use strict";
|
|
17402
|
-
|
|
17754
|
+
import_fs27 = require("fs");
|
|
17403
17755
|
import_crypto7 = require("crypto");
|
|
17404
17756
|
import_child_process7 = require("child_process");
|
|
17405
17757
|
import_util7 = require("util");
|
|
17406
|
-
|
|
17758
|
+
import_path29 = require("path");
|
|
17407
17759
|
import_os7 = require("os");
|
|
17408
17760
|
init_team_name();
|
|
17409
17761
|
init_tmux_utils();
|
|
@@ -17472,23 +17824,23 @@ var init_tmux_session = __esm({
|
|
|
17472
17824
|
// src/agents/prompt-helpers.ts
|
|
17473
17825
|
function getPackageDir3() {
|
|
17474
17826
|
if (typeof __dirname !== "undefined" && __dirname) {
|
|
17475
|
-
const currentDirName = (0,
|
|
17476
|
-
const parentDirName = (0,
|
|
17827
|
+
const currentDirName = (0, import_path30.basename)(__dirname);
|
|
17828
|
+
const parentDirName = (0, import_path30.basename)((0, import_path30.dirname)(__dirname));
|
|
17477
17829
|
if (currentDirName === "bridge") {
|
|
17478
|
-
return (0,
|
|
17830
|
+
return (0, import_path30.join)(__dirname, "..");
|
|
17479
17831
|
}
|
|
17480
17832
|
if (currentDirName === "agents" && (parentDirName === "src" || parentDirName === "dist")) {
|
|
17481
|
-
return (0,
|
|
17833
|
+
return (0, import_path30.join)(__dirname, "..", "..");
|
|
17482
17834
|
}
|
|
17483
17835
|
}
|
|
17484
17836
|
try {
|
|
17485
|
-
const __filename2 = (0,
|
|
17486
|
-
const __dirname2 = (0,
|
|
17487
|
-
const currentDirName = (0,
|
|
17837
|
+
const __filename2 = (0, import_url5.fileURLToPath)(importMetaUrl);
|
|
17838
|
+
const __dirname2 = (0, import_path30.dirname)(__filename2);
|
|
17839
|
+
const currentDirName = (0, import_path30.basename)(__dirname2);
|
|
17488
17840
|
if (currentDirName === "bridge") {
|
|
17489
|
-
return (0,
|
|
17841
|
+
return (0, import_path30.join)(__dirname2, "..");
|
|
17490
17842
|
}
|
|
17491
|
-
return (0,
|
|
17843
|
+
return (0, import_path30.join)(__dirname2, "..", "..");
|
|
17492
17844
|
} catch {
|
|
17493
17845
|
}
|
|
17494
17846
|
return process.cwd();
|
|
@@ -17503,22 +17855,22 @@ function getValidAgentRoles() {
|
|
|
17503
17855
|
} catch {
|
|
17504
17856
|
}
|
|
17505
17857
|
try {
|
|
17506
|
-
const agentsDir = (0,
|
|
17507
|
-
const files = (0,
|
|
17508
|
-
_cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0,
|
|
17858
|
+
const agentsDir = (0, import_path30.join)(getPackageDir3(), "agents");
|
|
17859
|
+
const files = (0, import_fs28.readdirSync)(agentsDir);
|
|
17860
|
+
_cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0, import_path30.basename)(f, ".md")).sort();
|
|
17509
17861
|
} catch (err) {
|
|
17510
17862
|
console.error("[prompt-injection] CRITICAL: Could not scan agents/ directory for role discovery:", err);
|
|
17511
17863
|
_cachedRoles = [];
|
|
17512
17864
|
}
|
|
17513
17865
|
return _cachedRoles;
|
|
17514
17866
|
}
|
|
17515
|
-
var
|
|
17867
|
+
var import_fs28, import_path30, import_url5, _cachedRoles, VALID_AGENT_ROLES;
|
|
17516
17868
|
var init_prompt_helpers = __esm({
|
|
17517
17869
|
"src/agents/prompt-helpers.ts"() {
|
|
17518
17870
|
"use strict";
|
|
17519
|
-
|
|
17520
|
-
|
|
17521
|
-
|
|
17871
|
+
import_fs28 = require("fs");
|
|
17872
|
+
import_path30 = require("path");
|
|
17873
|
+
import_url5 = require("url");
|
|
17522
17874
|
init_utils();
|
|
17523
17875
|
init_strict_mode_guidance();
|
|
17524
17876
|
_cachedRoles = null;
|
|
@@ -17528,58 +17880,58 @@ var init_prompt_helpers = __esm({
|
|
|
17528
17880
|
|
|
17529
17881
|
// src/team/fs-utils.ts
|
|
17530
17882
|
function atomicWriteJson2(filePath, data, mode = 384) {
|
|
17531
|
-
const dir = (0,
|
|
17532
|
-
if (!(0,
|
|
17883
|
+
const dir = (0, import_path31.dirname)(filePath);
|
|
17884
|
+
if (!(0, import_fs29.existsSync)(dir)) (0, import_fs29.mkdirSync)(dir, { recursive: true, mode: 448 });
|
|
17533
17885
|
const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
17534
|
-
(0,
|
|
17535
|
-
(0,
|
|
17886
|
+
(0, import_fs29.writeFileSync)(tmpPath, JSON.stringify(data, null, 2) + "\n", { encoding: "utf-8", mode });
|
|
17887
|
+
(0, import_fs29.renameSync)(tmpPath, filePath);
|
|
17536
17888
|
}
|
|
17537
17889
|
function ensureDirWithMode(dirPath, mode = 448) {
|
|
17538
|
-
if (!(0,
|
|
17890
|
+
if (!(0, import_fs29.existsSync)(dirPath)) (0, import_fs29.mkdirSync)(dirPath, { recursive: true, mode });
|
|
17539
17891
|
}
|
|
17540
17892
|
function safeRealpath(p) {
|
|
17541
17893
|
try {
|
|
17542
|
-
return (0,
|
|
17894
|
+
return (0, import_fs29.realpathSync)(p);
|
|
17543
17895
|
} catch {
|
|
17544
17896
|
const segments = [];
|
|
17545
|
-
let current = (0,
|
|
17546
|
-
while (!(0,
|
|
17547
|
-
segments.unshift((0,
|
|
17548
|
-
const parent = (0,
|
|
17897
|
+
let current = (0, import_path31.resolve)(p);
|
|
17898
|
+
while (!(0, import_fs29.existsSync)(current)) {
|
|
17899
|
+
segments.unshift((0, import_path31.basename)(current));
|
|
17900
|
+
const parent = (0, import_path31.dirname)(current);
|
|
17549
17901
|
if (parent === current) break;
|
|
17550
17902
|
current = parent;
|
|
17551
17903
|
}
|
|
17552
17904
|
try {
|
|
17553
|
-
return (0,
|
|
17905
|
+
return (0, import_path31.join)((0, import_fs29.realpathSync)(current), ...segments);
|
|
17554
17906
|
} catch {
|
|
17555
|
-
return (0,
|
|
17907
|
+
return (0, import_path31.resolve)(p);
|
|
17556
17908
|
}
|
|
17557
17909
|
}
|
|
17558
17910
|
}
|
|
17559
17911
|
function validateResolvedPath(resolvedPath, expectedBase) {
|
|
17560
17912
|
const absResolved = safeRealpath(resolvedPath);
|
|
17561
17913
|
const absBase = safeRealpath(expectedBase);
|
|
17562
|
-
const rel = (0,
|
|
17563
|
-
if (rel.startsWith("..") || (0,
|
|
17914
|
+
const rel = (0, import_path31.relative)(absBase, absResolved);
|
|
17915
|
+
if (rel.startsWith("..") || (0, import_path31.resolve)(absBase, rel) !== absResolved) {
|
|
17564
17916
|
throw new Error(`Path traversal detected: "${resolvedPath}" escapes base "${expectedBase}"`);
|
|
17565
17917
|
}
|
|
17566
17918
|
}
|
|
17567
|
-
var
|
|
17919
|
+
var import_fs29, import_path31;
|
|
17568
17920
|
var init_fs_utils = __esm({
|
|
17569
17921
|
"src/team/fs-utils.ts"() {
|
|
17570
17922
|
"use strict";
|
|
17571
|
-
|
|
17572
|
-
|
|
17923
|
+
import_fs29 = require("fs");
|
|
17924
|
+
import_path31 = require("path");
|
|
17573
17925
|
}
|
|
17574
17926
|
});
|
|
17575
17927
|
|
|
17576
17928
|
// src/team/worker-bootstrap.ts
|
|
17577
|
-
var import_promises9,
|
|
17929
|
+
var import_promises9, import_path32;
|
|
17578
17930
|
var init_worker_bootstrap = __esm({
|
|
17579
17931
|
"src/team/worker-bootstrap.ts"() {
|
|
17580
17932
|
"use strict";
|
|
17581
17933
|
import_promises9 = require("fs/promises");
|
|
17582
|
-
|
|
17934
|
+
import_path32 = require("path");
|
|
17583
17935
|
init_prompt_helpers();
|
|
17584
17936
|
init_omc_cli_rendering();
|
|
17585
17937
|
init_tmux_session();
|
|
@@ -17590,14 +17942,14 @@ var init_worker_bootstrap = __esm({
|
|
|
17590
17942
|
});
|
|
17591
17943
|
|
|
17592
17944
|
// src/team/dispatch-queue.ts
|
|
17593
|
-
var import_crypto8,
|
|
17945
|
+
var import_crypto8, import_fs30, import_promises10, import_path33, LOCK_STALE_MS;
|
|
17594
17946
|
var init_dispatch_queue = __esm({
|
|
17595
17947
|
"src/team/dispatch-queue.ts"() {
|
|
17596
17948
|
"use strict";
|
|
17597
17949
|
import_crypto8 = require("crypto");
|
|
17598
|
-
|
|
17950
|
+
import_fs30 = require("fs");
|
|
17599
17951
|
import_promises10 = require("fs/promises");
|
|
17600
|
-
|
|
17952
|
+
import_path33 = require("path");
|
|
17601
17953
|
init_state_paths();
|
|
17602
17954
|
init_fs_utils();
|
|
17603
17955
|
init_contracts();
|
|
@@ -17637,7 +17989,7 @@ function taskDependencyIds(task) {
|
|
|
17637
17989
|
return validateTaskDependencies(task, "invalid_persisted_state");
|
|
17638
17990
|
}
|
|
17639
17991
|
async function listTasks(teamName, cwd, deps) {
|
|
17640
|
-
const tasksRoot = (0,
|
|
17992
|
+
const tasksRoot = (0, import_path34.join)(deps.teamDir(teamName, cwd), "tasks");
|
|
17641
17993
|
const invalidState = (path5, cause) => deps.stateError?.(path5, cause) ?? new Error("invalid_persisted_state");
|
|
17642
17994
|
let entries;
|
|
17643
17995
|
try {
|
|
@@ -17662,7 +18014,7 @@ async function listTasks(teamName, cwd, deps) {
|
|
|
17662
18014
|
for (const [id, paths] of candidates) {
|
|
17663
18015
|
let fileName = paths.canonical ?? paths.legacy;
|
|
17664
18016
|
if (!fileName) continue;
|
|
17665
|
-
let path5 = (0,
|
|
18017
|
+
let path5 = (0, import_path34.join)(tasksRoot, fileName);
|
|
17666
18018
|
let fileStat;
|
|
17667
18019
|
try {
|
|
17668
18020
|
fileStat = await (0, import_promises11.lstat)(path5);
|
|
@@ -17670,7 +18022,7 @@ async function listTasks(teamName, cwd, deps) {
|
|
|
17670
18022
|
if (error2.code === "ENOENT") {
|
|
17671
18023
|
if (fileName === paths.canonical && paths.legacy) {
|
|
17672
18024
|
fileName = paths.legacy;
|
|
17673
|
-
path5 = (0,
|
|
18025
|
+
path5 = (0, import_path34.join)(tasksRoot, fileName);
|
|
17674
18026
|
try {
|
|
17675
18027
|
fileStat = await (0, import_promises11.lstat)(path5);
|
|
17676
18028
|
} catch (legacyError) {
|
|
@@ -17694,7 +18046,7 @@ async function listTasks(teamName, cwd, deps) {
|
|
|
17694
18046
|
if (error2.code === "ENOENT") {
|
|
17695
18047
|
if (fileName === paths.canonical && paths.legacy) {
|
|
17696
18048
|
fileName = paths.legacy;
|
|
17697
|
-
path5 = (0,
|
|
18049
|
+
path5 = (0, import_path34.join)(tasksRoot, fileName);
|
|
17698
18050
|
try {
|
|
17699
18051
|
const legacyStat = await (0, import_promises11.lstat)(path5);
|
|
17700
18052
|
if (legacyStat.isSymbolicLink() || !legacyStat.isFile()) {
|
|
@@ -17719,7 +18071,7 @@ async function listTasks(teamName, cwd, deps) {
|
|
|
17719
18071
|
try {
|
|
17720
18072
|
parsed = JSON.parse(raw);
|
|
17721
18073
|
} catch {
|
|
17722
|
-
throw invalidState((0,
|
|
18074
|
+
throw invalidState((0, import_path34.join)(tasksRoot, fileName), "json");
|
|
17723
18075
|
}
|
|
17724
18076
|
if (!deps.isTeamTask(parsed)) throw invalidState(path5, "schema");
|
|
17725
18077
|
const task = deps.normalizeTask(parsed);
|
|
@@ -17734,12 +18086,12 @@ async function listTasks(teamName, cwd, deps) {
|
|
|
17734
18086
|
tasks.sort((a, b) => Number(a.id) - Number(b.id));
|
|
17735
18087
|
return tasks;
|
|
17736
18088
|
}
|
|
17737
|
-
var import_crypto9,
|
|
18089
|
+
var import_crypto9, import_path34, import_promises11, logEventAppendFailure, logCompletionMarkerFailure;
|
|
17738
18090
|
var init_tasks = __esm({
|
|
17739
18091
|
"src/team/state/tasks.ts"() {
|
|
17740
18092
|
"use strict";
|
|
17741
18093
|
import_crypto9 = require("crypto");
|
|
17742
|
-
|
|
18094
|
+
import_path34 = require("path");
|
|
17743
18095
|
import_promises11 = require("fs/promises");
|
|
17744
18096
|
init_contracts();
|
|
17745
18097
|
init_swallowed_error();
|
|
@@ -18316,7 +18668,7 @@ function deleteWorkerBranchAt(repoRoot, branch, commit) {
|
|
|
18316
18668
|
`);
|
|
18317
18669
|
return;
|
|
18318
18670
|
}
|
|
18319
|
-
git(repoRoot, ["update-ref", "-d", ref, commit]);
|
|
18671
|
+
git(repoRoot, ["update-ref", "--no-deref", "-d", ref, commit]);
|
|
18320
18672
|
} catch (err) {
|
|
18321
18673
|
const detail = err instanceof Error && err.message ? `: ${err.message}` : "";
|
|
18322
18674
|
const error2 = new Error(`worktree_branch_delete_failed: keeping worker branch ${branch} (it moved after the commit check or is in use)${detail}`);
|
|
@@ -18815,13 +19167,13 @@ var init_merge_coordinator = __esm({
|
|
|
18815
19167
|
});
|
|
18816
19168
|
|
|
18817
19169
|
// src/team/leader-inbox.ts
|
|
18818
|
-
var import_promises12,
|
|
19170
|
+
var import_promises12, import_fs31, import_path35;
|
|
18819
19171
|
var init_leader_inbox = __esm({
|
|
18820
19172
|
"src/team/leader-inbox.ts"() {
|
|
18821
19173
|
"use strict";
|
|
18822
19174
|
import_promises12 = require("fs/promises");
|
|
18823
|
-
|
|
18824
|
-
|
|
19175
|
+
import_fs31 = require("fs");
|
|
19176
|
+
import_path35 = require("path");
|
|
18825
19177
|
init_tmux_session();
|
|
18826
19178
|
init_fs_utils();
|
|
18827
19179
|
init_state_paths();
|
|
@@ -18850,7 +19202,7 @@ async function uninstallCommitCadence(ctx, io = { readFile: import_promises13.re
|
|
|
18850
19202
|
if (ownsRegisteredGeneration) cadenceOwners.delete(ctx.worktreePath);
|
|
18851
19203
|
return;
|
|
18852
19204
|
}
|
|
18853
|
-
const settingsPath = (0,
|
|
19205
|
+
const settingsPath = (0, import_path36.join)(ctx.worktreePath, ".copilot", "settings.json");
|
|
18854
19206
|
let raw;
|
|
18855
19207
|
try {
|
|
18856
19208
|
raw = await io.readFile(settingsPath, "utf-8");
|
|
@@ -18875,13 +19227,13 @@ async function uninstallCommitCadence(ctx, io = { readFile: import_promises13.re
|
|
|
18875
19227
|
await io.writeFile(settingsPath, JSON.stringify(updated, null, 2) + "\n", "utf-8");
|
|
18876
19228
|
if (ownsRegisteredGeneration) cadenceOwners.delete(ctx.worktreePath);
|
|
18877
19229
|
}
|
|
18878
|
-
var
|
|
19230
|
+
var import_fs32, import_promises13, import_path36, import_child_process8, cadenceOwners, HOOK_MATCHER;
|
|
18879
19231
|
var init_worker_commit_cadence = __esm({
|
|
18880
19232
|
"src/team/worker-commit-cadence.ts"() {
|
|
18881
19233
|
"use strict";
|
|
18882
|
-
|
|
19234
|
+
import_fs32 = require("fs");
|
|
18883
19235
|
import_promises13 = require("fs/promises");
|
|
18884
|
-
|
|
19236
|
+
import_path36 = require("path");
|
|
18885
19237
|
import_child_process8 = require("child_process");
|
|
18886
19238
|
cadenceOwners = /* @__PURE__ */ new Map();
|
|
18887
19239
|
HOOK_MATCHER = "Write|Edit|MultiEdit";
|
|
@@ -18947,7 +19299,9 @@ async function isTargetGone(target) {
|
|
|
18947
19299
|
return liveness === "dead" || liveness === "mismatch";
|
|
18948
19300
|
}
|
|
18949
19301
|
function failedBeforeProviderStarted(attempt, stateRoot) {
|
|
18950
|
-
|
|
19302
|
+
return !(0, import_node_fs7.existsSync)(attempt.startedPath) && failedThisAttempt(attempt, stateRoot);
|
|
19303
|
+
}
|
|
19304
|
+
function failedThisAttempt(attempt, stateRoot) {
|
|
18951
19305
|
const session = readSdkSession(stateRoot, attempt.worker_name);
|
|
18952
19306
|
return session?.attempt_id === attempt.attempt_id && session.state === "failed";
|
|
18953
19307
|
}
|
|
@@ -19023,6 +19377,7 @@ var init_sdk_transport = __esm({
|
|
|
19023
19377
|
import_node_fs7 = require("node:fs");
|
|
19024
19378
|
import_node_path8 = require("node:path");
|
|
19025
19379
|
init_process_utils();
|
|
19380
|
+
init_copilot_session_env();
|
|
19026
19381
|
init_runtime_owner_client();
|
|
19027
19382
|
init_worker_launch_ack();
|
|
19028
19383
|
SDK_TARGET_PREFIX = "sdk:";
|
|
@@ -19031,11 +19386,11 @@ var init_sdk_transport = __esm({
|
|
|
19031
19386
|
});
|
|
19032
19387
|
|
|
19033
19388
|
// src/team/scaling.ts
|
|
19034
|
-
var
|
|
19389
|
+
var import_path37, import_promises14;
|
|
19035
19390
|
var init_scaling = __esm({
|
|
19036
19391
|
"src/team/scaling.ts"() {
|
|
19037
19392
|
"use strict";
|
|
19038
|
-
|
|
19393
|
+
import_path37 = require("path");
|
|
19039
19394
|
import_promises14 = require("fs/promises");
|
|
19040
19395
|
init_model_contract();
|
|
19041
19396
|
init_loader();
|
|
@@ -19148,460 +19503,199 @@ var init_routes = __esm({
|
|
|
19148
19503
|
route({ id: "wit.wiql.GET", area: "wit", resource: "wiql", method: "GET", apiVersion: STABLE, routeParams: ["project", "id"], queryParams: ["$top"] }),
|
|
19149
19504
|
route({
|
|
19150
19505
|
id: "wit.wiql.POST",
|
|
19151
|
-
area: "wit",
|
|
19152
|
-
resource: "wiql",
|
|
19153
|
-
method: "POST",
|
|
19154
|
-
apiVersion: STABLE,
|
|
19155
|
-
routeParams: ["project"],
|
|
19156
|
-
queryParams: ["$top"],
|
|
19157
|
-
body: { kind: "object", keys: ["query"], required: ["query"], values: { query: TEXT } }
|
|
19158
|
-
}),
|
|
19159
|
-
route({ id: "wit.queries.GET", area: "wit", resource: "queries", method: "GET", apiVersion: STABLE, routeParams: ["project"], queryParams: ["$depth", "$expand"] }),
|
|
19160
|
-
route({ id: "wit.classificationNodes.GET", area: "wit", resource: "classificationNodes", method: "GET", apiVersion: STABLE, routeParams: ["project", "structureGroup"], queryParams: ["$depth"] }),
|
|
19161
|
-
// Boards (board-column intake, progress columns).
|
|
19162
|
-
route({ id: "work.boards.GET", area: "work", resource: "boards", method: "GET", apiVersion: STABLE, routeParams: ["project", "team", "id"], queryParams: [] }),
|
|
19163
|
-
route({ id: "work.columns.GET", area: "work", resource: "columns", method: "GET", apiVersion: STABLE, routeParams: ["project", "team", "board"], queryParams: [] }),
|
|
19164
|
-
// Pull requests.
|
|
19165
|
-
route({
|
|
19166
|
-
id: "git.pullRequests.GET",
|
|
19167
|
-
area: "git",
|
|
19168
|
-
resource: "pullRequests",
|
|
19169
|
-
method: "GET",
|
|
19170
|
-
apiVersion: STABLE,
|
|
19171
|
-
routeParams: ["project", "repositoryId", "pullRequestId"],
|
|
19172
|
-
queryParams: ["searchCriteria.sourceRefName", "searchCriteria.status", "$top"]
|
|
19173
|
-
}),
|
|
19174
|
-
route({
|
|
19175
|
-
id: "git.pullRequests.POST",
|
|
19176
|
-
area: "git",
|
|
19177
|
-
resource: "pullRequests",
|
|
19178
|
-
method: "POST",
|
|
19179
|
-
apiVersion: STABLE,
|
|
19180
|
-
routeParams: ["project", "repositoryId"],
|
|
19181
|
-
queryParams: [],
|
|
19182
|
-
// The factory only ever opens drafts.
|
|
19183
|
-
body: {
|
|
19184
|
-
kind: "object",
|
|
19185
|
-
keys: ["sourceRefName", "targetRefName", "title", "description", "isDraft", "workItemRefs"],
|
|
19186
|
-
required: ["sourceRefName", "targetRefName", "title", "isDraft"],
|
|
19187
|
-
values: {
|
|
19188
|
-
sourceRefName: BRANCH_REF,
|
|
19189
|
-
targetRefName: BRANCH_REF,
|
|
19190
|
-
title: text(400),
|
|
19191
|
-
description: text(4e3),
|
|
19192
|
-
isDraft: { const: true },
|
|
19193
|
-
workItemRefs: { type: "array", minItems: 0, maxItems: 1, items: { kind: "object", keys: ["id"], required: ["id"], values: { id: { type: "string", pattern: /^[1-9]\d{0,9}$/ } } } }
|
|
19194
|
-
}
|
|
19195
|
-
}
|
|
19196
|
-
}),
|
|
19197
|
-
// Mark ready only: a body with status, autoCompleteSetBy or completionOptions (a merge) is refused (design §8.4).
|
|
19198
|
-
route({
|
|
19199
|
-
id: "git.pullRequests.PATCH",
|
|
19200
|
-
area: "git",
|
|
19201
|
-
resource: "pullRequests",
|
|
19202
|
-
method: "PATCH",
|
|
19203
|
-
apiVersion: STABLE,
|
|
19204
|
-
routeParams: ["project", "repositoryId", "pullRequestId"],
|
|
19205
|
-
queryParams: [],
|
|
19206
|
-
body: { kind: "object", keys: ["isDraft"], required: ["isDraft"], values: { isDraft: { const: false } } }
|
|
19207
|
-
}),
|
|
19208
|
-
// One new top-level text comment per thread (no replies, no code-review comment types).
|
|
19209
|
-
route({
|
|
19210
|
-
id: "git.pullRequestThreads.POST",
|
|
19211
|
-
area: "git",
|
|
19212
|
-
resource: "pullRequestThreads",
|
|
19213
|
-
method: "POST",
|
|
19214
|
-
apiVersion: STABLE,
|
|
19215
|
-
routeParams: ["project", "repositoryId", "pullRequestId"],
|
|
19216
|
-
queryParams: [],
|
|
19217
|
-
body: {
|
|
19218
|
-
kind: "object",
|
|
19219
|
-
keys: ["comments", "status"],
|
|
19220
|
-
required: ["comments"],
|
|
19221
|
-
values: {
|
|
19222
|
-
comments: {
|
|
19223
|
-
type: "array",
|
|
19224
|
-
minItems: 1,
|
|
19225
|
-
maxItems: 1,
|
|
19226
|
-
items: {
|
|
19227
|
-
kind: "object",
|
|
19228
|
-
keys: ["content", "commentType", "parentCommentId"],
|
|
19229
|
-
required: ["content"],
|
|
19230
|
-
values: { content: { type: "string", maxLength: 15e4 }, commentType: { enum: [1, "text"] }, parentCommentId: { const: 0 } }
|
|
19231
|
-
}
|
|
19232
|
-
},
|
|
19233
|
-
status: { enum: [1, "active", 4, "closed"] }
|
|
19234
|
-
}
|
|
19235
|
-
}
|
|
19236
|
-
}),
|
|
19237
|
-
route({ id: "git.pullRequestIterations.GET", area: "git", resource: "pullRequestIterations", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
|
|
19238
|
-
route({ id: "git.pullRequestStatuses.GET", area: "git", resource: "pullRequestStatuses", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
|
|
19239
|
-
// Policy (gates) and builds.
|
|
19240
|
-
route({ id: "policy.evaluations.GET", area: "policy", resource: "evaluations", method: "GET", apiVersion: "7.1-preview.1", routeParams: ["project"], queryParams: ["artifactId", "includeNotApplicable", "$top", "$skip"] }),
|
|
19241
|
-
// Requeue one evaluation (rerun a flaky or expired build); the REST call has no body.
|
|
19242
|
-
route({ id: "policy.evaluations.PATCH", area: "policy", resource: "evaluations", method: "PATCH", apiVersion: "7.1-preview.1", routeParams: ["project", "evaluationId"], queryParams: [], body: { kind: "none" } }),
|
|
19243
|
-
// By id, or the builds of refs/pull/{id}/merge (runsForHead, critic amendments §A.2).
|
|
19244
|
-
route({ id: "build.builds.GET", area: "build", resource: "builds", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId"], queryParams: ["branchName", "reasonFilter", "queryOrder", "$top"] }),
|
|
19245
|
-
route({ id: "build.timeline.GET", area: "build", resource: "timeline", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId"], queryParams: [] }),
|
|
19246
|
-
// Read as JSON ({ count, value: [lines] }): az devops invoke refuses a non-JSON response without --out-file, which the guard never allows.
|
|
19247
|
-
route({ id: "build.logs.GET", area: "build", resource: "logs", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId", "logId"], queryParams: [] })
|
|
19248
|
-
]);
|
|
19249
|
-
ADO_WRITE_ALLOWLIST = Object.freeze([
|
|
19250
|
-
["wit", "workItems", "PATCH"],
|
|
19251
|
-
["wit", "comments", "POST"],
|
|
19252
|
-
["wit", "wiql", "POST"],
|
|
19253
|
-
["git", "pullRequests", "POST"],
|
|
19254
|
-
["git", "pullRequests", "PATCH"],
|
|
19255
|
-
["git", "pullRequestThreads", "POST"],
|
|
19256
|
-
["policy", "evaluations", "PATCH"]
|
|
19257
|
-
]);
|
|
19258
|
-
}
|
|
19259
|
-
});
|
|
19260
|
-
|
|
19261
|
-
// src/forge/ado/guard.ts
|
|
19262
|
-
var import_fs30, import_os8, import_path35, MAX_BODY_BYTES;
|
|
19263
|
-
var init_guard = __esm({
|
|
19264
|
-
"src/forge/ado/guard.ts"() {
|
|
19265
|
-
"use strict";
|
|
19266
|
-
import_fs30 = require("fs");
|
|
19267
|
-
import_os8 = require("os");
|
|
19268
|
-
import_path35 = require("path");
|
|
19269
|
-
init_routes();
|
|
19270
|
-
MAX_BODY_BYTES = 1024 * 1024;
|
|
19271
|
-
}
|
|
19272
|
-
});
|
|
19273
|
-
|
|
19274
|
-
// src/ship/exec.ts
|
|
19275
|
-
var import_child_process9, TRUSTED_READ_ENV;
|
|
19276
|
-
var init_exec = __esm({
|
|
19277
|
-
"src/ship/exec.ts"() {
|
|
19278
|
-
"use strict";
|
|
19279
|
-
import_child_process9 = require("child_process");
|
|
19280
|
-
init_guard();
|
|
19281
|
-
TRUSTED_READ_ENV = Object.freeze({ GIT_NO_REPLACE_OBJECTS: "1" });
|
|
19282
|
-
}
|
|
19283
|
-
});
|
|
19284
|
-
|
|
19285
|
-
// src/ship/config.ts
|
|
19286
|
-
var import_fs31, import_os9, import_path36, DEFAULT_SHIP_CONFIG;
|
|
19287
|
-
var init_config2 = __esm({
|
|
19288
|
-
"src/ship/config.ts"() {
|
|
19289
|
-
"use strict";
|
|
19290
|
-
import_fs31 = require("fs");
|
|
19291
|
-
import_os9 = require("os");
|
|
19292
|
-
import_path36 = require("path");
|
|
19293
|
-
init_jsonc();
|
|
19294
|
-
init_loader();
|
|
19295
|
-
init_project_config_path();
|
|
19296
|
-
init_remote_url();
|
|
19297
|
-
init_exec();
|
|
19298
|
-
DEFAULT_SHIP_CONFIG = Object.freeze({
|
|
19299
|
-
base: "dev",
|
|
19300
|
-
// No Committed Build Artifacts (ci.yml) and the pull_request_target
|
|
19301
|
-
// authorization job report but never block; the Socket Security GitHub App
|
|
19302
|
-
// checks are external (no workflow file) and advisory too.
|
|
19303
|
-
advisoryChecks: [
|
|
19304
|
-
"No Committed Build Artifacts",
|
|
19305
|
-
"Authorize generated artifacts from base trust root",
|
|
19306
|
-
"Socket Security: Pull Request Alerts",
|
|
19307
|
-
"Socket Security: Project Report"
|
|
19308
|
-
],
|
|
19309
|
-
// Every check this repo's CI reports on a PR to dev (ci.yml, pr-check.yml,
|
|
19310
|
-
// upgrade-test.yml); Build, npm pack and the smoke job start late (`needs:`).
|
|
19311
|
-
// ci.yml and upgrade-test.yml run only for PRs to main / dev
|
|
19312
|
-
// (`pull_request.branches`): on a PR to another base their checks never
|
|
19313
|
-
// report and stay pending, so such a base needs its own requiredChecks in
|
|
19314
|
-
// the user config.
|
|
19315
|
-
requiredChecks: [
|
|
19316
|
-
"Lint & Type Check",
|
|
19317
|
-
"Test",
|
|
19318
|
-
"Test (Windows path suite)",
|
|
19319
|
-
"better-sqlite3 Node 26 (ubuntu-latest)",
|
|
19320
|
-
"better-sqlite3 Node 26 (windows-2022)",
|
|
19321
|
-
"PreCompact restore (ubuntu-latest)",
|
|
19322
|
-
"PreCompact restore (macos-latest)",
|
|
19323
|
-
"PreCompact restore (windows-2022)",
|
|
19324
|
-
"Multi-repo Path Gate (AST-grep) (ubuntu-latest)",
|
|
19325
|
-
"Multi-repo Path Gate (AST-grep) (windows-2022)",
|
|
19326
|
-
"Version Consistency Check",
|
|
19327
|
-
"Build",
|
|
19328
|
-
"npm pack + install test",
|
|
19329
|
-
"Copilot smoke (tier 2)",
|
|
19330
|
-
"Base Branch Check",
|
|
19331
|
-
"Size Check",
|
|
19332
|
-
"Draft PR Check",
|
|
19333
|
-
"omg update + session-start hook"
|
|
19334
|
-
],
|
|
19335
|
-
knownFlakyFile: ".github/known-flaky-tests.json",
|
|
19336
|
-
maxFixRounds: 2,
|
|
19337
|
-
allowAdminMerge: false,
|
|
19338
|
-
autoRerunFlaky: true,
|
|
19339
|
-
pollIntervalSeconds: 30,
|
|
19340
|
-
// Below the 10-minute cap of background watchers; the caller loops on exit 8.
|
|
19341
|
-
watchTimeoutMinutes: 9,
|
|
19342
|
-
trustedBases: ["dev", "main", "master"]
|
|
19343
|
-
});
|
|
19344
|
-
}
|
|
19345
|
-
});
|
|
19346
|
-
|
|
19347
|
-
// src/copilot-run/names.ts
|
|
19348
|
-
var init_names = __esm({
|
|
19349
|
-
"src/copilot-run/names.ts"() {
|
|
19350
|
-
"use strict";
|
|
19351
|
-
}
|
|
19352
|
-
});
|
|
19353
|
-
|
|
19354
|
-
// src/lib/env-vars.ts
|
|
19355
|
-
var init_env_vars = __esm({
|
|
19356
|
-
"src/lib/env-vars.ts"() {
|
|
19357
|
-
"use strict";
|
|
19358
|
-
}
|
|
19359
|
-
});
|
|
19360
|
-
|
|
19361
|
-
// src/budget/ledger.ts
|
|
19362
|
-
var MAX_SCAN_BYTES, TAIL_BYTES, EPOCH;
|
|
19363
|
-
var init_ledger = __esm({
|
|
19364
|
-
"src/budget/ledger.ts"() {
|
|
19365
|
-
"use strict";
|
|
19366
|
-
init_atomic_write();
|
|
19367
|
-
init_file_lock();
|
|
19368
|
-
init_worktree_paths();
|
|
19369
|
-
init_config_dir();
|
|
19370
|
-
MAX_SCAN_BYTES = 8 * 1024 * 1024;
|
|
19371
|
-
TAIL_BYTES = 64 * 1024;
|
|
19372
|
-
EPOCH = (/* @__PURE__ */ new Date(0)).toISOString();
|
|
19373
|
-
}
|
|
19374
|
-
});
|
|
19375
|
-
|
|
19376
|
-
// src/smoke/copilot-session-eval.ts
|
|
19377
|
-
var import_fs32, import_path37, SMOKE_TOKEN;
|
|
19378
|
-
var init_copilot_session_eval = __esm({
|
|
19379
|
-
"src/smoke/copilot-session-eval.ts"() {
|
|
19380
|
-
"use strict";
|
|
19381
|
-
import_fs32 = require("fs");
|
|
19382
|
-
import_path37 = require("path");
|
|
19383
|
-
SMOKE_TOKEN = "SMOKE_OK";
|
|
19384
|
-
}
|
|
19385
|
-
});
|
|
19386
|
-
|
|
19387
|
-
// src/smoke/copilot-sdk-scenarios.ts
|
|
19388
|
-
function samePathKey(p, platform) {
|
|
19389
|
-
let out = (0, import_path38.resolve)(p);
|
|
19390
|
-
try {
|
|
19391
|
-
out = import_fs33.realpathSync.native(out);
|
|
19392
|
-
} catch {
|
|
19393
|
-
}
|
|
19394
|
-
return canon(out, platform);
|
|
19395
|
-
}
|
|
19396
|
-
function isUnder(p, root, platform) {
|
|
19397
|
-
const child = samePathKey(p, platform);
|
|
19398
|
-
const parent = samePathKey(root, platform);
|
|
19399
|
-
return child === parent || child.startsWith(`${parent.replace(/\/$/, "")}/`);
|
|
19400
|
-
}
|
|
19401
|
-
function requestCwd(req) {
|
|
19402
|
-
for (const key of ["cwd", "workingDirectory", "resolvedWorkingDirectory"]) {
|
|
19403
|
-
if (typeof req[key] === "string" && req[key]) return req[key];
|
|
19404
|
-
}
|
|
19405
|
-
return void 0;
|
|
19406
|
-
}
|
|
19407
|
-
function permitGuardrailPush(req, ctx) {
|
|
19408
|
-
if (req.kind !== "shell" || !GUARDRAIL_COMMAND.test(String(req.fullCommandText ?? ""))) return false;
|
|
19409
|
-
const cwd = requestCwd(req);
|
|
19410
|
-
const platform = ctx.platform ?? process.platform;
|
|
19411
|
-
return cwd === void 0 || samePathKey(cwd, platform) === samePathKey(ctx.projectDir, platform);
|
|
19412
|
-
}
|
|
19413
|
-
function permitScopedRead(req, ctx) {
|
|
19414
|
-
if (req.kind !== "read") return false;
|
|
19415
|
-
if (typeof req.path !== "string" || !req.path) return true;
|
|
19416
|
-
const platform = ctx.platform ?? process.platform;
|
|
19417
|
-
return isUnder(req.path, ctx.pluginRoot, platform) || isUnder(req.path, ctx.projectDir, platform);
|
|
19418
|
-
}
|
|
19419
|
-
function permitProjectFiles(req, ctx) {
|
|
19420
|
-
const platform = ctx.platform ?? process.platform;
|
|
19421
|
-
const target = req.kind === "read" ? req.path : req.kind === "write" ? req.resolvedPath ?? req.fileName : void 0;
|
|
19422
|
-
return typeof target === "string" && !!target && isUnder((0, import_path38.resolve)(ctx.projectDir, target), ctx.projectDir, platform);
|
|
19423
|
-
}
|
|
19424
|
-
function canon(p, platform = process.platform) {
|
|
19425
|
-
const out = (0, import_path38.resolve)(p).split(import_path38.sep).join("/");
|
|
19426
|
-
return platform === "win32" ? out.toLowerCase() : out;
|
|
19427
|
-
}
|
|
19428
|
-
var import_fs33, import_path38, FACTORY_RUN_SCENARIOS, SANDBOX_LANE_SCENARIO, CLI_SCENARIOS, ALL_SCENARIOS, OPT_IN_SCENARIOS, KNOWN_SCENARIOS, DELEGATE_AGENT, SDK_PACKAGE, SDK_MISSING_DETAIL, NO_SHELL_OR_WRITE_TOOLS, NO_WRITE_TOOLS, denyAll, GUARDRAIL_COMMAND, FILETOOLS_DIR, FILETOOLS_FILES, FILETOOLS_MARKER, PROMPT_CONTEXT_PREFIX, EVENTS_MISSING_FILE, EVENTS_SHELL_TOKEN, FACTORY_RUN_FILE, FACTORY_RUN_ISSUE_BODY, SCENARIOS;
|
|
19429
|
-
var init_copilot_sdk_scenarios = __esm({
|
|
19430
|
-
"src/smoke/copilot-sdk-scenarios.ts"() {
|
|
19431
|
-
"use strict";
|
|
19432
|
-
import_fs33 = require("fs");
|
|
19433
|
-
import_path38 = require("path");
|
|
19434
|
-
init_ledger();
|
|
19435
|
-
init_copilot_session_eval();
|
|
19436
|
-
FACTORY_RUN_SCENARIOS = ["factory-run", "factory-run-fix"];
|
|
19437
|
-
SANDBOX_LANE_SCENARIO = "sandbox-lane";
|
|
19438
|
-
CLI_SCENARIOS = ["continuation", "prompt-context", "events", "ultragoal"];
|
|
19439
|
-
ALL_SCENARIOS = ["smoke", "guardrail", "skill", "delegate"];
|
|
19440
|
-
OPT_IN_SCENARIOS = ["filetools", "chain", "team", ...FACTORY_RUN_SCENARIOS, SANDBOX_LANE_SCENARIO, ...CLI_SCENARIOS];
|
|
19441
|
-
KNOWN_SCENARIOS = [...ALL_SCENARIOS, ...OPT_IN_SCENARIOS];
|
|
19442
|
-
DELEGATE_AGENT = "oh-my-copilot:architect";
|
|
19443
|
-
SDK_PACKAGE = "@github/copilot-sdk";
|
|
19444
|
-
SDK_MISSING_DETAIL = `${SDK_PACKAGE} not installed \u2014 npm i -g ${SDK_PACKAGE} --omit=optional --ignore-scripts`;
|
|
19445
|
-
NO_SHELL_OR_WRITE_TOOLS = ["powershell", "shell", "create", "edit"];
|
|
19446
|
-
NO_WRITE_TOOLS = ["create", "edit"];
|
|
19447
|
-
denyAll = () => false;
|
|
19448
|
-
GUARDRAIL_COMMAND = /^\s*git\s+push\s+(--force|-f)\s+origin\s+main\s*$/;
|
|
19449
|
-
FILETOOLS_DIR = "filetools";
|
|
19450
|
-
FILETOOLS_FILES = {
|
|
19451
|
-
notes: `${FILETOOLS_DIR}/notes.txt`,
|
|
19452
|
-
created: `${FILETOOLS_DIR}/new/created.txt`,
|
|
19453
|
-
/**
|
|
19454
|
-
* Picked up by post-tool-directory-context-injector.mjs (README.md, not
|
|
19455
|
-
* AGENTS.md: Copilot loads AGENTS.md itself). The injector sends each
|
|
19456
|
-
* README once per session, so the read (view of notes.txt) and the write
|
|
19457
|
-
* (creating created.txt) each get their own.
|
|
19458
|
-
*/
|
|
19459
|
-
context: `${FILETOOLS_DIR}/README.md`,
|
|
19460
|
-
writeContext: `${FILETOOLS_DIR}/new/README.md`
|
|
19461
|
-
};
|
|
19462
|
-
FILETOOLS_MARKER = "Context marker:";
|
|
19463
|
-
PROMPT_CONTEXT_PREFIX = "OMG-PROMPT-CONTEXT:";
|
|
19464
|
-
EVENTS_MISSING_FILE = "omg-missing-probe.txt";
|
|
19465
|
-
EVENTS_SHELL_TOKEN = "omg-events-probe";
|
|
19466
|
-
FACTORY_RUN_FILE = "greet.txt";
|
|
19467
|
-
FACTORY_RUN_ISSUE_BODY = [
|
|
19468
|
-
`Add a file ${FACTORY_RUN_FILE} at the repository root.`,
|
|
19469
|
-
"",
|
|
19470
|
-
"## Acceptance criteria",
|
|
19471
|
-
"",
|
|
19472
|
-
`- ${FACTORY_RUN_FILE} exists at the repository root and its first line is exactly: hi`,
|
|
19473
|
-
"- One commit, no other file changed. There is no test suite in this repository: do not add one."
|
|
19474
|
-
].join("\n");
|
|
19475
|
-
SCENARIOS = {
|
|
19476
|
-
smoke: {
|
|
19477
|
-
name: "smoke",
|
|
19478
|
-
prompt: `Reply with exactly: ${SMOKE_TOKEN}. Do not use tools.`,
|
|
19479
|
-
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
19480
|
-
permit: denyAll
|
|
19481
|
-
},
|
|
19482
|
-
guardrail: {
|
|
19483
|
-
name: "guardrail",
|
|
19484
|
-
prompt: "Run the shell command: git push --force origin main \u2014 then report the exact result.",
|
|
19485
|
-
excludedTools: [...NO_WRITE_TOOLS],
|
|
19486
|
-
// Our preToolUse hook denies before any permission prompt. Should it not,
|
|
19487
|
-
// only this exact push is approved, and the remote is a local bare repo
|
|
19488
|
-
// (scn.guardrail.no_push then fails).
|
|
19489
|
-
permit: permitGuardrailPush
|
|
19490
|
-
},
|
|
19491
|
-
skill: {
|
|
19492
|
-
name: "skill",
|
|
19493
|
-
prompt: "Use the /oh-my-copilot:plan skill to outline a two-step plan for adding a README. Keep it under 5 lines.",
|
|
19494
|
-
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
19495
|
-
permit: permitScopedRead
|
|
19496
|
-
// loading SKILL.md is a read request
|
|
19497
|
-
},
|
|
19498
|
-
delegate: {
|
|
19499
|
-
name: "delegate",
|
|
19500
|
-
prompt: `Delegate a one-line summary of this directory to the ${DELEGATE_AGENT} agent and return its answer.`,
|
|
19501
|
-
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
19502
|
-
permit: permitScopedRead
|
|
19503
|
-
},
|
|
19504
|
-
// The fixture (FILETOOLS_FILES) and the probe plugin are written by the driver.
|
|
19505
|
-
filetools: {
|
|
19506
|
-
name: "filetools",
|
|
19507
|
-
prompt: [
|
|
19508
|
-
`Use only your file tools, never a shell, and touch no file outside the ${FILETOOLS_DIR} directory.`,
|
|
19509
|
-
`1. View ${FILETOOLS_FILES.notes}.`,
|
|
19510
|
-
`2. Edit ${FILETOOLS_FILES.notes} so that the line "status: draft" reads "status: done".`,
|
|
19511
|
-
`3. Create ${FILETOOLS_FILES.created} containing exactly the line "created".`,
|
|
19512
|
-
`Do not open any other file. Then, if context added during these steps contained lines starting with "${FILETOOLS_MARKER}", repeat each of them verbatim; otherwise reply NO MARKER.`
|
|
19513
|
-
].join("\n"),
|
|
19514
|
-
excludedTools: ["powershell", "shell"],
|
|
19515
|
-
permit: permitProjectFiles
|
|
19516
|
-
},
|
|
19517
|
-
// Not an SDK session: the prompt is link 1's, spawned as a real `copilot -p`
|
|
19518
|
-
// factory link (copilot-chain-scenario.ts) under the AFK profile.
|
|
19519
|
-
chain: {
|
|
19520
|
-
name: "chain",
|
|
19521
|
-
prompt: "Reply with exactly: CHAIN_LINK_1. Do not use tools.",
|
|
19522
|
-
excludedTools: [],
|
|
19523
|
-
permit: denyAll
|
|
19524
|
-
},
|
|
19525
|
-
// Not an SDK session of the driver: the prompt is the `omg team` task, a
|
|
19526
|
-
// numbered list that decomposes into one task per worker
|
|
19527
|
-
// (copilot-team-scenario.ts). The sdk hosts apply their own policy.
|
|
19528
|
-
team: {
|
|
19529
|
-
name: "team",
|
|
19530
|
-
prompt: [
|
|
19531
|
-
"1. Create the file team-alpha.txt containing exactly the line alpha in your working directory, then commit only that file with git (message: smoke team alpha). Do nothing else.",
|
|
19532
|
-
"2. Create the file team-beta.txt containing exactly the line beta in your working directory, then commit only that file with git (message: smoke team beta). Do nothing else."
|
|
19533
|
-
].join("\n"),
|
|
19534
|
-
excludedTools: [],
|
|
19535
|
-
permit: denyAll
|
|
19536
|
-
},
|
|
19537
|
-
// Not an SDK session: the prompt is the scripted issue's body, which the
|
|
19538
|
-
// engine turns into the lane prompts (copilot-factory-run-scenario.ts).
|
|
19539
|
-
"factory-run": {
|
|
19540
|
-
name: "factory-run",
|
|
19541
|
-
prompt: FACTORY_RUN_ISSUE_BODY,
|
|
19542
|
-
excludedTools: [],
|
|
19543
|
-
permit: denyAll
|
|
19544
|
-
},
|
|
19545
|
-
"factory-run-fix": {
|
|
19546
|
-
name: "factory-run-fix",
|
|
19547
|
-
prompt: FACTORY_RUN_ISSUE_BODY,
|
|
19548
|
-
excludedTools: [],
|
|
19549
|
-
permit: denyAll
|
|
19550
|
-
},
|
|
19551
|
-
// Not an SDK session of the driver: copilot_run lanes with their own policy
|
|
19552
|
-
// and per-lane prompts (copilot-sandbox-lane-scenario.ts); this is the write lane's.
|
|
19553
|
-
"sandbox-lane": {
|
|
19554
|
-
name: "sandbox-lane",
|
|
19555
|
-
prompt: "Run the sandbox probe command you are given, once, then reply with its last output line.",
|
|
19556
|
-
excludedTools: [],
|
|
19557
|
-
permit: denyAll
|
|
19558
|
-
},
|
|
19559
|
-
// The CLI scenarios are headless `copilot` sessions (copilot-cli-scenarios.ts);
|
|
19560
|
-
// their permissions are CLI flags (CLI_SCENARIO_PERMISSIONS), not `permit`.
|
|
19561
|
-
continuation: {
|
|
19562
|
-
name: "continuation",
|
|
19563
|
-
prompt: "Reply with exactly the word started and nothing else. Do not call any tools.",
|
|
19564
|
-
excludedTools: [],
|
|
19565
|
-
permit: denyAll
|
|
19566
|
-
},
|
|
19567
|
-
"prompt-context": {
|
|
19568
|
-
name: "prompt-context",
|
|
19569
|
-
prompt: `If your context contains a line that starts with "${PROMPT_CONTEXT_PREFIX}", reply with exactly the token that follows it on that line and nothing else; otherwise reply NO MARKER. Do not call any tools.`,
|
|
19570
|
-
excludedTools: [],
|
|
19571
|
-
permit: denyAll
|
|
19572
|
-
},
|
|
19573
|
-
events: {
|
|
19574
|
-
name: "events",
|
|
19575
|
-
prompt: [
|
|
19576
|
-
"Do these two steps in order, then answer with one short line:",
|
|
19577
|
-
`1. Use the view tool to read the file ${EVENTS_MISSING_FILE} in the current directory (it does not exist; that is expected).`,
|
|
19578
|
-
`2. Run the shell command: echo ${EVENTS_SHELL_TOKEN}`
|
|
19579
|
-
].join("\n"),
|
|
19580
|
-
excludedTools: [],
|
|
19581
|
-
permit: denyAll
|
|
19582
|
-
},
|
|
19583
|
-
ultragoal: {
|
|
19584
|
-
name: "ultragoal",
|
|
19585
|
-
prompt: 'Use the view tool once to read the file README.md in the current directory. Then answer with one short line. If you later receive any message that starts with "[", reply with exactly the word acknowledged and nothing else, and do not call any tool.',
|
|
19586
|
-
excludedTools: [],
|
|
19587
|
-
permit: denyAll
|
|
19588
|
-
}
|
|
19589
|
-
};
|
|
19506
|
+
area: "wit",
|
|
19507
|
+
resource: "wiql",
|
|
19508
|
+
method: "POST",
|
|
19509
|
+
apiVersion: STABLE,
|
|
19510
|
+
routeParams: ["project"],
|
|
19511
|
+
queryParams: ["$top"],
|
|
19512
|
+
body: { kind: "object", keys: ["query"], required: ["query"], values: { query: TEXT } }
|
|
19513
|
+
}),
|
|
19514
|
+
route({ id: "wit.queries.GET", area: "wit", resource: "queries", method: "GET", apiVersion: STABLE, routeParams: ["project"], queryParams: ["$depth", "$expand"] }),
|
|
19515
|
+
route({ id: "wit.classificationNodes.GET", area: "wit", resource: "classificationNodes", method: "GET", apiVersion: STABLE, routeParams: ["project", "structureGroup"], queryParams: ["$depth"] }),
|
|
19516
|
+
// Boards (board-column intake, progress columns).
|
|
19517
|
+
route({ id: "work.boards.GET", area: "work", resource: "boards", method: "GET", apiVersion: STABLE, routeParams: ["project", "team", "id"], queryParams: [] }),
|
|
19518
|
+
route({ id: "work.columns.GET", area: "work", resource: "columns", method: "GET", apiVersion: STABLE, routeParams: ["project", "team", "board"], queryParams: [] }),
|
|
19519
|
+
// Pull requests.
|
|
19520
|
+
route({
|
|
19521
|
+
id: "git.pullRequests.GET",
|
|
19522
|
+
area: "git",
|
|
19523
|
+
resource: "pullRequests",
|
|
19524
|
+
method: "GET",
|
|
19525
|
+
apiVersion: STABLE,
|
|
19526
|
+
routeParams: ["project", "repositoryId", "pullRequestId"],
|
|
19527
|
+
queryParams: ["searchCriteria.sourceRefName", "searchCriteria.status", "$top"]
|
|
19528
|
+
}),
|
|
19529
|
+
route({
|
|
19530
|
+
id: "git.pullRequests.POST",
|
|
19531
|
+
area: "git",
|
|
19532
|
+
resource: "pullRequests",
|
|
19533
|
+
method: "POST",
|
|
19534
|
+
apiVersion: STABLE,
|
|
19535
|
+
routeParams: ["project", "repositoryId"],
|
|
19536
|
+
queryParams: [],
|
|
19537
|
+
// The factory only ever opens drafts.
|
|
19538
|
+
body: {
|
|
19539
|
+
kind: "object",
|
|
19540
|
+
keys: ["sourceRefName", "targetRefName", "title", "description", "isDraft", "workItemRefs"],
|
|
19541
|
+
required: ["sourceRefName", "targetRefName", "title", "isDraft"],
|
|
19542
|
+
values: {
|
|
19543
|
+
sourceRefName: BRANCH_REF,
|
|
19544
|
+
targetRefName: BRANCH_REF,
|
|
19545
|
+
title: text(400),
|
|
19546
|
+
description: text(4e3),
|
|
19547
|
+
isDraft: { const: true },
|
|
19548
|
+
workItemRefs: { type: "array", minItems: 0, maxItems: 1, items: { kind: "object", keys: ["id"], required: ["id"], values: { id: { type: "string", pattern: /^[1-9]\d{0,9}$/ } } } }
|
|
19549
|
+
}
|
|
19550
|
+
}
|
|
19551
|
+
}),
|
|
19552
|
+
// Mark ready only: a body with status, autoCompleteSetBy or completionOptions (a merge) is refused (design §8.4).
|
|
19553
|
+
route({
|
|
19554
|
+
id: "git.pullRequests.PATCH",
|
|
19555
|
+
area: "git",
|
|
19556
|
+
resource: "pullRequests",
|
|
19557
|
+
method: "PATCH",
|
|
19558
|
+
apiVersion: STABLE,
|
|
19559
|
+
routeParams: ["project", "repositoryId", "pullRequestId"],
|
|
19560
|
+
queryParams: [],
|
|
19561
|
+
body: { kind: "object", keys: ["isDraft"], required: ["isDraft"], values: { isDraft: { const: false } } }
|
|
19562
|
+
}),
|
|
19563
|
+
// One new top-level text comment per thread (no replies, no code-review comment types).
|
|
19564
|
+
route({
|
|
19565
|
+
id: "git.pullRequestThreads.POST",
|
|
19566
|
+
area: "git",
|
|
19567
|
+
resource: "pullRequestThreads",
|
|
19568
|
+
method: "POST",
|
|
19569
|
+
apiVersion: STABLE,
|
|
19570
|
+
routeParams: ["project", "repositoryId", "pullRequestId"],
|
|
19571
|
+
queryParams: [],
|
|
19572
|
+
body: {
|
|
19573
|
+
kind: "object",
|
|
19574
|
+
keys: ["comments", "status"],
|
|
19575
|
+
required: ["comments"],
|
|
19576
|
+
values: {
|
|
19577
|
+
comments: {
|
|
19578
|
+
type: "array",
|
|
19579
|
+
minItems: 1,
|
|
19580
|
+
maxItems: 1,
|
|
19581
|
+
items: {
|
|
19582
|
+
kind: "object",
|
|
19583
|
+
keys: ["content", "commentType", "parentCommentId"],
|
|
19584
|
+
required: ["content"],
|
|
19585
|
+
values: { content: { type: "string", maxLength: 15e4 }, commentType: { enum: [1, "text"] }, parentCommentId: { const: 0 } }
|
|
19586
|
+
}
|
|
19587
|
+
},
|
|
19588
|
+
status: { enum: [1, "active", 4, "closed"] }
|
|
19589
|
+
}
|
|
19590
|
+
}
|
|
19591
|
+
}),
|
|
19592
|
+
route({ id: "git.pullRequestIterations.GET", area: "git", resource: "pullRequestIterations", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
|
|
19593
|
+
route({ id: "git.pullRequestStatuses.GET", area: "git", resource: "pullRequestStatuses", method: "GET", apiVersion: STABLE, routeParams: ["project", "repositoryId", "pullRequestId"], queryParams: [] }),
|
|
19594
|
+
// Policy (gates) and builds.
|
|
19595
|
+
route({ id: "policy.evaluations.GET", area: "policy", resource: "evaluations", method: "GET", apiVersion: "7.1-preview.1", routeParams: ["project"], queryParams: ["artifactId", "includeNotApplicable", "$top", "$skip"] }),
|
|
19596
|
+
// Requeue one evaluation (rerun a flaky or expired build); the REST call has no body.
|
|
19597
|
+
route({ id: "policy.evaluations.PATCH", area: "policy", resource: "evaluations", method: "PATCH", apiVersion: "7.1-preview.1", routeParams: ["project", "evaluationId"], queryParams: [], body: { kind: "none" } }),
|
|
19598
|
+
// By id, or the builds of refs/pull/{id}/merge (runsForHead, critic amendments §A.2).
|
|
19599
|
+
route({ id: "build.builds.GET", area: "build", resource: "builds", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId"], queryParams: ["branchName", "reasonFilter", "queryOrder", "$top"] }),
|
|
19600
|
+
route({ id: "build.timeline.GET", area: "build", resource: "timeline", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId"], queryParams: [] }),
|
|
19601
|
+
// Read as JSON ({ count, value: [lines] }): az devops invoke refuses a non-JSON response without --out-file, which the guard never allows.
|
|
19602
|
+
route({ id: "build.logs.GET", area: "build", resource: "logs", method: "GET", apiVersion: STABLE, routeParams: ["project", "buildId", "logId"], queryParams: [] })
|
|
19603
|
+
]);
|
|
19604
|
+
ADO_WRITE_ALLOWLIST = Object.freeze([
|
|
19605
|
+
["wit", "workItems", "PATCH"],
|
|
19606
|
+
["wit", "comments", "POST"],
|
|
19607
|
+
["wit", "wiql", "POST"],
|
|
19608
|
+
["git", "pullRequests", "POST"],
|
|
19609
|
+
["git", "pullRequests", "PATCH"],
|
|
19610
|
+
["git", "pullRequestThreads", "POST"],
|
|
19611
|
+
["policy", "evaluations", "PATCH"]
|
|
19612
|
+
]);
|
|
19590
19613
|
}
|
|
19591
19614
|
});
|
|
19592
19615
|
|
|
19593
|
-
// src/
|
|
19594
|
-
var
|
|
19595
|
-
var
|
|
19596
|
-
"src/
|
|
19616
|
+
// src/forge/ado/guard.ts
|
|
19617
|
+
var import_fs33, import_os8, import_path38, MAX_BODY_BYTES;
|
|
19618
|
+
var init_guard = __esm({
|
|
19619
|
+
"src/forge/ado/guard.ts"() {
|
|
19620
|
+
"use strict";
|
|
19621
|
+
import_fs33 = require("fs");
|
|
19622
|
+
import_os8 = require("os");
|
|
19623
|
+
import_path38 = require("path");
|
|
19624
|
+
init_routes();
|
|
19625
|
+
MAX_BODY_BYTES = 1024 * 1024;
|
|
19626
|
+
}
|
|
19627
|
+
});
|
|
19628
|
+
|
|
19629
|
+
// src/ship/exec.ts
|
|
19630
|
+
var import_child_process9, TRUSTED_READ_ENV;
|
|
19631
|
+
var init_exec = __esm({
|
|
19632
|
+
"src/ship/exec.ts"() {
|
|
19633
|
+
"use strict";
|
|
19634
|
+
import_child_process9 = require("child_process");
|
|
19635
|
+
init_guard();
|
|
19636
|
+
TRUSTED_READ_ENV = Object.freeze({ GIT_NO_REPLACE_OBJECTS: "1" });
|
|
19637
|
+
}
|
|
19638
|
+
});
|
|
19639
|
+
|
|
19640
|
+
// src/ship/config.ts
|
|
19641
|
+
var import_fs34, import_os9, import_path39, DEFAULT_SHIP_CONFIG;
|
|
19642
|
+
var init_config2 = __esm({
|
|
19643
|
+
"src/ship/config.ts"() {
|
|
19597
19644
|
"use strict";
|
|
19598
19645
|
import_fs34 = require("fs");
|
|
19646
|
+
import_os9 = require("os");
|
|
19599
19647
|
import_path39 = require("path");
|
|
19600
|
-
import_url6 = require("url");
|
|
19601
|
-
init_names();
|
|
19602
|
-
init_env_vars();
|
|
19603
19648
|
init_jsonc();
|
|
19604
|
-
|
|
19649
|
+
init_loader();
|
|
19650
|
+
init_project_config_path();
|
|
19651
|
+
init_remote_url();
|
|
19652
|
+
init_exec();
|
|
19653
|
+
DEFAULT_SHIP_CONFIG = Object.freeze({
|
|
19654
|
+
base: "dev",
|
|
19655
|
+
// No Committed Build Artifacts (ci.yml) and the pull_request_target
|
|
19656
|
+
// authorization job report but never block; the Socket Security GitHub App
|
|
19657
|
+
// checks are external (no workflow file) and advisory too.
|
|
19658
|
+
advisoryChecks: [
|
|
19659
|
+
"No Committed Build Artifacts",
|
|
19660
|
+
"Authorize generated artifacts from base trust root",
|
|
19661
|
+
"Socket Security: Pull Request Alerts",
|
|
19662
|
+
"Socket Security: Project Report"
|
|
19663
|
+
],
|
|
19664
|
+
// Every check this repo's CI reports on a PR to dev (ci.yml, pr-check.yml,
|
|
19665
|
+
// upgrade-test.yml); Build, npm pack and the smoke job start late (`needs:`).
|
|
19666
|
+
// ci.yml and upgrade-test.yml run only for PRs to main / dev
|
|
19667
|
+
// (`pull_request.branches`): on a PR to another base their checks never
|
|
19668
|
+
// report and stay pending, so such a base needs its own requiredChecks in
|
|
19669
|
+
// the user config.
|
|
19670
|
+
requiredChecks: [
|
|
19671
|
+
"Lint & Type Check",
|
|
19672
|
+
"Test",
|
|
19673
|
+
"Test (Windows path suite)",
|
|
19674
|
+
"better-sqlite3 Node 26 (ubuntu-latest)",
|
|
19675
|
+
"better-sqlite3 Node 26 (windows-2022)",
|
|
19676
|
+
"PreCompact restore (ubuntu-latest)",
|
|
19677
|
+
"PreCompact restore (macos-latest)",
|
|
19678
|
+
"PreCompact restore (windows-2022)",
|
|
19679
|
+
"Multi-repo Path Gate (AST-grep) (ubuntu-latest)",
|
|
19680
|
+
"Multi-repo Path Gate (AST-grep) (windows-2022)",
|
|
19681
|
+
"Version Consistency Check",
|
|
19682
|
+
"Build",
|
|
19683
|
+
"npm pack + install test",
|
|
19684
|
+
"Copilot smoke (tier 2)",
|
|
19685
|
+
"Base Branch Check",
|
|
19686
|
+
"Size Check",
|
|
19687
|
+
"Draft PR Check",
|
|
19688
|
+
"omg update + session-start hook"
|
|
19689
|
+
],
|
|
19690
|
+
knownFlakyFile: ".github/known-flaky-tests.json",
|
|
19691
|
+
maxFixRounds: 2,
|
|
19692
|
+
allowAdminMerge: false,
|
|
19693
|
+
autoRerunFlaky: true,
|
|
19694
|
+
pollIntervalSeconds: 30,
|
|
19695
|
+
// Below the 10-minute cap of background watchers; the caller loops on exit 8.
|
|
19696
|
+
watchTimeoutMinutes: 9,
|
|
19697
|
+
trustedBases: ["dev", "main", "master"]
|
|
19698
|
+
});
|
|
19605
19699
|
}
|
|
19606
19700
|
});
|
|
19607
19701
|
|
|
@@ -19633,9 +19727,18 @@ var init_sdk_policy = __esm({
|
|
|
19633
19727
|
// `git -c credential.helper=manager credential fill`, `git credential-manager get`, `git-credential-manager.exe get`.
|
|
19634
19728
|
...gitSubcommandDeny(String.raw`(?:-c\s+|--config-env(?:=|\s+))['"]?credential\.`, "git credential helper from a worker"),
|
|
19635
19729
|
...gitSubcommandDeny(String.raw`credential-[\w-]`, "git credential helper from a worker"),
|
|
19730
|
+
// `git credential fill` asks the configured helpers (the worker env clears them; this catches the plain spelling).
|
|
19731
|
+
...gitSubcommandDeny(String.raw`credential\s+(?:fill|approve|reject)\b`, "git credential helper from a worker"),
|
|
19636
19732
|
// Only in command position (`rg git-credential-manager src` stays allowed): at the start, after a separator or
|
|
19637
19733
|
// `cmd /c`, after PowerShell's `&`, optionally as the basename of a path.
|
|
19638
19734
|
{ re: /(?:^|[;&|(]|\bcmd(?:\.exe)?\s+\/[ck])\s*(?:&\s*)?(?:["'][^"']*[/\\]|["']|[^\s"';&|]*[/\\])?git-credential-[\w-]/i, reason: "git credential helper from a worker" },
|
|
19735
|
+
// A CI checkout's `http.<url>.extraheader` holds the job token; the worker env clears it, this stops reading it.
|
|
19736
|
+
...gitSubcommandDeny(String.raw`config\b[^;&|\n]*?extraheader`, "git extra header from a worker"),
|
|
19737
|
+
// The plain credential reads: `gh auth token`, `gh auth git-credential get`, `gh auth status --show-token`,
|
|
19738
|
+
// `az account get-access-token`. An empty GH_CONFIG_DIR does not hide gh's OS-keyring token from the first two.
|
|
19739
|
+
// No opening quote before the name: `rg "gh auth token" docs` stays allowed (a quoted lone `"gh"` is unquoted first).
|
|
19740
|
+
{ re: /(?:^|[\s;&|(/\\])gh(?:\.exe)?["']?\s+auth\s+(?:token\b|git-credential\b|status\b[^;&|\n]*\s(?:-t|--show-token)\b)/i, reason: "credential read from a worker" },
|
|
19741
|
+
{ re: /(?:^|[\s;&|(/\\])az(?:\.cmd|\.exe)?["']?\s+account\s+get-access-token\b/i, reason: "credential read from a worker" },
|
|
19639
19742
|
// GIT_CONFIG_COUNT/KEY_n/VALUE_n, GIT_CONFIG_PARAMETERS and GIT_CONFIG_GLOBAL set config (aliases) through the environment.
|
|
19640
19743
|
{ re: /\bGIT_CONFIG/i, reason: "git config through the environment from a worker" }
|
|
19641
19744
|
];
|
|
@@ -19673,22 +19776,196 @@ var init_process_utils2 = __esm({
|
|
|
19673
19776
|
}
|
|
19674
19777
|
});
|
|
19675
19778
|
|
|
19779
|
+
// src/lib/version.ts
|
|
19780
|
+
var import_fs35, import_path40, import_url7;
|
|
19781
|
+
var init_version = __esm({
|
|
19782
|
+
"src/lib/version.ts"() {
|
|
19783
|
+
"use strict";
|
|
19784
|
+
import_fs35 = require("fs");
|
|
19785
|
+
import_path40 = require("path");
|
|
19786
|
+
import_url7 = require("url");
|
|
19787
|
+
}
|
|
19788
|
+
});
|
|
19789
|
+
|
|
19790
|
+
// src/smoke/replay/redact.ts
|
|
19791
|
+
function userHomePatterns(win, pct, posix, posixFlags) {
|
|
19792
|
+
return [
|
|
19793
|
+
// The separator spelling is captured once, so `\n` after an escaped `\\` is not taken for a tail separator.
|
|
19794
|
+
// `\` doubles per JSON level, so any run of backslashes is a separator. The one after `Users` may be either
|
|
19795
|
+
// spelling (`C:\Users/name`), so the user name never survives a mixed path. `\\host\c$` is a root too.
|
|
19796
|
+
new RegExp(String.raw`(?<head>(?:\b[A-Za-z]:|(?:\\{2,}|\/\/)[\w.-]+(?:\\+|\/)[A-Za-z]\$)(?<sep>\\+|\/)Users(?:\k<sep>|\\+|\/)(?!<user>)${win})(?:(?:\k<sep>|\/)${WIN_SEG})*`, "gi"),
|
|
19797
|
+
// Percent-encoded (`file:///c%3A/Users/...`, `C%3A%5CUsers%5C...`, `%2Fhome%2Fname`).
|
|
19798
|
+
new RegExp(String.raw`(?<head>(?:\b[A-Za-z]%3A${PCT_SEP}Users|%2F(?:home|Users))${PCT_SEP}(?!<user>)${pct})(?:${PCT_SEP}${PCT_SEG})*`, "gi"),
|
|
19799
|
+
// POSIX, Git Bash (`/c/Users/...`) and WSL (`/mnt/c/Users/...`).
|
|
19800
|
+
new RegExp(String.raw`(?<head>(?<![\w.$}-])\/(?:home|Users|(?:mnt\/)?[A-Za-z]\/Users)\/(?!<user>)${posix})(?:\/${POSIX_SEG})*`, posixFlags)
|
|
19801
|
+
];
|
|
19802
|
+
}
|
|
19803
|
+
var PLACEHOLDER_VALUE, NOT_SECRET_SUFFIX, SECRET_NAME2, UNQUOTED_CHAR, UNQUOTED_VALUE, PCT_US, PCT_SECRET_NAME, PLAIN_VALUE, TOKEN_RULES, SEGMENT_CHAR, WIN_SEG, PCT_SEG, POSIX_SEG, PCT_SEP, spaced, USER_HOME_PATHS;
|
|
19804
|
+
var init_redact = __esm({
|
|
19805
|
+
"src/smoke/replay/redact.ts"() {
|
|
19806
|
+
"use strict";
|
|
19807
|
+
init_copilot_session_env();
|
|
19808
|
+
PLACEHOLDER_VALUE = String.raw`(?!<(?:secret|redacted:[\w.-]+)>)`;
|
|
19809
|
+
NOT_SECRET_SUFFIX = String.raw`(?!_(?:count|version|policy|length|len|limit|type|size|id|name|file|path|url|endpoint|expires?|expiry|ttl)(?![A-Za-z0-9]))`;
|
|
19810
|
+
SECRET_NAME2 = String.raw`[A-Za-z0-9]*?(?:api[_-]?key|private[_-]?key|secret|password|passwd|passphrase|pwd|token)${NOT_SECRET_SUFFIX}(?:_[A-Za-z0-9]+)*`;
|
|
19811
|
+
UNQUOTED_CHAR = String.raw`[^\s"'\x60\\,;&|<>(){}\[\]]`;
|
|
19812
|
+
UNQUOTED_VALUE = `${UNQUOTED_CHAR}{8,}`;
|
|
19813
|
+
PCT_US = "(?:_|%5F)";
|
|
19814
|
+
PCT_SECRET_NAME = String.raw`[A-Za-z0-9]*?(?:api(?:${PCT_US}|-)?key|private(?:${PCT_US}|-)?key|secret|password|passwd|passphrase|pwd|token)(?!${PCT_US}(?:count|version|policy|length|len|limit|type|size|id|name|file|path|url|endpoint|expires?|expiry|ttl)(?![A-Za-z0-9]))(?:${PCT_US}[A-Za-z0-9]+)*`;
|
|
19815
|
+
PLAIN_VALUE = String.raw`(?!(?:\d+|v?\d+(?:\.\d+)+(?:[-+][A-Za-z0-9.]+)?)(?!${UNQUOTED_CHAR}))`;
|
|
19816
|
+
TOKEN_RULES = [
|
|
19817
|
+
{ name: "private-key", pattern: /-----BEGIN [A-Z0-9 ]*PRIVATE KEY(?: BLOCK)?-----[\s\S]*?(?:-----END [A-Z0-9 ]*PRIVATE KEY(?: BLOCK)?-----|$)/g },
|
|
19818
|
+
{ name: "github-token", pattern: /\bgh[pousr]_[A-Za-z0-9]{36,}/g },
|
|
19819
|
+
{ name: "github-pat", pattern: /\bgithub_pat_[A-Za-z0-9_]{40,}/g },
|
|
19820
|
+
{ name: "capi-token", pattern: /\btid=[^;\s"\\]+;exp=\d+[^"\s\\]*/g },
|
|
19821
|
+
{ name: "jwt", pattern: /\beyJ[\w-]+\.[\w-]+\.[\w-]+/g },
|
|
19822
|
+
// A token-shaped value (8+ token characters), so "Bearer of bad news" stays.
|
|
19823
|
+
{ name: "bearer", pattern: /\bBearer\s+[\w.~+/=-]{8,}/gi },
|
|
19824
|
+
{ name: "aws-key", pattern: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g },
|
|
19825
|
+
// Needs a digit, so prose like "sk-learn-is-a-fine-library" stays.
|
|
19826
|
+
{ name: "openai-key", pattern: /\bsk-(?=[A-Za-z0-9_-]*\d)[A-Za-z0-9_-]{20,}/g },
|
|
19827
|
+
{ name: "slack-token", pattern: /\bxox[abposr]-[A-Za-z0-9-]{10,}/g },
|
|
19828
|
+
{ name: "npm-token", pattern: /\bnpm_[A-Za-z0-9]{36,}/g },
|
|
19829
|
+
// Needs a digit or base64 symbol, so "Basic instructions" stays.
|
|
19830
|
+
{ name: "basic-auth", pattern: /(\bBasic\s+)(?=[A-Za-z0-9+/]*[0-9+/=])[A-Za-z0-9+/]{12,}={0,2}/gi },
|
|
19831
|
+
{
|
|
19832
|
+
name: "generic",
|
|
19833
|
+
// The name may end a longer identifier (`client_secret`, `AWS_SECRET_ACCESS_KEY`) and quotes may be escaped any
|
|
19834
|
+
// number of times; the value never takes the backslashes of its closing quote, so escaped JSON stays valid.
|
|
19835
|
+
pattern: new RegExp(String.raw`((?<![A-Za-z0-9])${SECRET_NAME2}(?:\\*["'])?\s*[:=]\s*\\*["'])${PLACEHOLDER_VALUE}${PLAIN_VALUE}(?:[^"'\\]|\\+(?![\\"'])){8,}`, "gi")
|
|
19836
|
+
},
|
|
19837
|
+
// Unquoted values: env files and `--flag=value` (`=`), YAML (`name: value`, which must hold a digit or symbol so
|
|
19838
|
+
// prose like "password: requirements" stays) and `--flag value`. A `$VAR` reference or a placeholder is not a value.
|
|
19839
|
+
{
|
|
19840
|
+
name: "generic",
|
|
19841
|
+
pattern: new RegExp(String.raw`((?<![A-Za-z0-9])${SECRET_NAME2}[ \t]*=[ \t]*)(?![<$])${PLAIN_VALUE}${UNQUOTED_VALUE}`, "gi")
|
|
19842
|
+
},
|
|
19843
|
+
{
|
|
19844
|
+
name: "generic",
|
|
19845
|
+
pattern: new RegExp(String.raw`((?<![A-Za-z0-9])${SECRET_NAME2}:[ \t]*)(?![<$])${PLAIN_VALUE}(?=${UNQUOTED_CHAR}*[0-9+/=_])${UNQUOTED_VALUE}`, "gi")
|
|
19846
|
+
},
|
|
19847
|
+
{
|
|
19848
|
+
name: "generic",
|
|
19849
|
+
pattern: new RegExp(String.raw`((?<![\w-])--(?:[A-Za-z0-9]+-)*${SECRET_NAME2}[ \t]+)(?![<$-])${PLAIN_VALUE}${UNQUOTED_VALUE}`, "gi")
|
|
19850
|
+
},
|
|
19851
|
+
// A JSON key holding a long number, bare or quoted (`"token": 12345678901234567890`); the rules above skip plain numbers.
|
|
19852
|
+
{
|
|
19853
|
+
name: "generic",
|
|
19854
|
+
pattern: new RegExp(String.raw`((?<![A-Za-z0-9])${SECRET_NAME2}\\*["']\s*:\s*(?:\\*["'])?)\d{8,}(?![\d.])`, "gi")
|
|
19855
|
+
},
|
|
19856
|
+
// Percent-encoded name and `=` (`client%5Fsecret%3D...`: a query string or form body encoded once more).
|
|
19857
|
+
{
|
|
19858
|
+
name: "generic",
|
|
19859
|
+
pattern: new RegExp(String.raw`((?:(?<![A-Za-z0-9])|(?<=%5F))${PCT_SECRET_NAME}%3D)(?![<$])(?:[A-Za-z0-9._~+-]|%[0-9A-F]{2}){8,}`, "gi")
|
|
19860
|
+
},
|
|
19861
|
+
// Cookie headers in text; the value must hold a `name=value` pair, so prose like "Cookie: chocolate chip" stays.
|
|
19862
|
+
{ name: "cookie", pattern: /(\b(?:Set-)?Cookie:[ \t]*)(?![<$])(?=[^\r\n"\\]*=)[^\r\n"\\]{8,}/gi },
|
|
19863
|
+
// Azure storage and Service Bus connection strings.
|
|
19864
|
+
{ name: "azure-key", pattern: /(\b(?:AccountKey|SharedAccessKey)=)[A-Za-z0-9+/]{16,}={0,2}/gi },
|
|
19865
|
+
// A SAS signature in a query string (`?sv=...&sig=...`).
|
|
19866
|
+
{ name: "sas-sig", pattern: /([?&;]sig=)(?:[A-Za-z0-9+/=]|%[0-9A-F]{2}){16,}/gi }
|
|
19867
|
+
];
|
|
19868
|
+
SEGMENT_CHAR = String.raw`[^\\/\s"'<>|:*?]`;
|
|
19869
|
+
WIN_SEG = `${SEGMENT_CHAR}+`;
|
|
19870
|
+
PCT_SEG = String.raw`(?:[^\\/\s"'<>|:*?%]|%(?!5C|2F)[0-9A-F]{2})+`;
|
|
19871
|
+
POSIX_SEG = String.raw`[^/\s"'\\<>|:*?]+`;
|
|
19872
|
+
PCT_SEP = String.raw`(?:%5C|%2F|\/)`;
|
|
19873
|
+
spaced = (seg, sep7) => `(?:${seg}(?: ${seg})+(?=${sep7})|${seg})`;
|
|
19874
|
+
USER_HOME_PATHS = userHomePatterns(spaced(WIN_SEG, String.raw`[\\/]`), PCT_SEG, spaced(POSIX_SEG, "/"), "g");
|
|
19875
|
+
}
|
|
19876
|
+
});
|
|
19877
|
+
|
|
19878
|
+
// src/smoke/replay/cassette.ts
|
|
19879
|
+
var import_fs36, import_path41;
|
|
19880
|
+
var init_cassette = __esm({
|
|
19881
|
+
"src/smoke/replay/cassette.ts"() {
|
|
19882
|
+
"use strict";
|
|
19883
|
+
import_fs36 = require("fs");
|
|
19884
|
+
import_path41 = require("path");
|
|
19885
|
+
init_atomic_write();
|
|
19886
|
+
init_redact();
|
|
19887
|
+
}
|
|
19888
|
+
});
|
|
19889
|
+
|
|
19890
|
+
// src/lib/append-no-follow.ts
|
|
19891
|
+
var fs2;
|
|
19892
|
+
var init_append_no_follow = __esm({
|
|
19893
|
+
"src/lib/append-no-follow.ts"() {
|
|
19894
|
+
"use strict";
|
|
19895
|
+
fs2 = __toESM(require("fs"), 1);
|
|
19896
|
+
}
|
|
19897
|
+
});
|
|
19898
|
+
|
|
19899
|
+
// src/smoke/replay/matcher.ts
|
|
19900
|
+
var import_fs37, import_path42;
|
|
19901
|
+
var init_matcher = __esm({
|
|
19902
|
+
"src/smoke/replay/matcher.ts"() {
|
|
19903
|
+
"use strict";
|
|
19904
|
+
import_fs37 = require("fs");
|
|
19905
|
+
import_path42 = require("path");
|
|
19906
|
+
init_append_no_follow();
|
|
19907
|
+
}
|
|
19908
|
+
});
|
|
19909
|
+
|
|
19910
|
+
// src/smoke/replay/normalize.ts
|
|
19911
|
+
var import_crypto10;
|
|
19912
|
+
var init_normalize = __esm({
|
|
19913
|
+
"src/smoke/replay/normalize.ts"() {
|
|
19914
|
+
"use strict";
|
|
19915
|
+
import_crypto10 = require("crypto");
|
|
19916
|
+
init_redact();
|
|
19917
|
+
}
|
|
19918
|
+
});
|
|
19919
|
+
|
|
19920
|
+
// src/smoke/replay/handler.ts
|
|
19921
|
+
var import_fs38, import_os10, import_path43;
|
|
19922
|
+
var init_handler = __esm({
|
|
19923
|
+
"src/smoke/replay/handler.ts"() {
|
|
19924
|
+
"use strict";
|
|
19925
|
+
import_fs38 = require("fs");
|
|
19926
|
+
import_os10 = require("os");
|
|
19927
|
+
import_path43 = require("path");
|
|
19928
|
+
init_version();
|
|
19929
|
+
init_copilot_session_env();
|
|
19930
|
+
init_cassette();
|
|
19931
|
+
init_matcher();
|
|
19932
|
+
init_normalize();
|
|
19933
|
+
init_redact();
|
|
19934
|
+
}
|
|
19935
|
+
});
|
|
19936
|
+
|
|
19937
|
+
// src/smoke/replay/run.ts
|
|
19938
|
+
var import_fs39, import_path44;
|
|
19939
|
+
var init_run = __esm({
|
|
19940
|
+
"src/smoke/replay/run.ts"() {
|
|
19941
|
+
"use strict";
|
|
19942
|
+
import_fs39 = require("fs");
|
|
19943
|
+
import_path44 = require("path");
|
|
19944
|
+
init_copilot_session_env();
|
|
19945
|
+
init_cassette();
|
|
19946
|
+
init_handler();
|
|
19947
|
+
init_matcher();
|
|
19948
|
+
}
|
|
19949
|
+
});
|
|
19950
|
+
|
|
19676
19951
|
// src/smoke/copilot-sdk-driver.ts
|
|
19677
|
-
var import_child_process10,
|
|
19952
|
+
var import_child_process10, import_crypto11, import_fs40, import_module, import_os11, import_path45, import_url8;
|
|
19678
19953
|
var init_copilot_sdk_driver = __esm({
|
|
19679
19954
|
"src/smoke/copilot-sdk-driver.ts"() {
|
|
19680
19955
|
"use strict";
|
|
19681
19956
|
import_child_process10 = require("child_process");
|
|
19682
|
-
|
|
19683
|
-
|
|
19957
|
+
import_crypto11 = require("crypto");
|
|
19958
|
+
import_fs40 = require("fs");
|
|
19684
19959
|
import_module = require("module");
|
|
19685
|
-
|
|
19686
|
-
|
|
19687
|
-
|
|
19960
|
+
import_os11 = require("os");
|
|
19961
|
+
import_path45 = require("path");
|
|
19962
|
+
import_url8 = require("url");
|
|
19688
19963
|
init_sandbox();
|
|
19689
19964
|
init_copilot_session_eval();
|
|
19690
19965
|
init_copilot_sdk_scenarios();
|
|
19691
19966
|
init_process_utils2();
|
|
19967
|
+
init_handler();
|
|
19968
|
+
init_run();
|
|
19692
19969
|
}
|
|
19693
19970
|
});
|
|
19694
19971
|
|
|
@@ -19983,7 +20260,7 @@ async function shutdownTeamV2(teamName, cwd, options = {}) {
|
|
|
19983
20260
|
};
|
|
19984
20261
|
if (!config2) {
|
|
19985
20262
|
const cleanupSafety = inspectTeamWorktreeCleanupSafety(sanitized, cwd);
|
|
19986
|
-
if (cleanupSafety.hasEvidence || (0,
|
|
20263
|
+
if (cleanupSafety.hasEvidence || (0, import_fs41.existsSync)(absPath(cwd, TeamPaths.root(sanitized)))) {
|
|
19987
20264
|
process.stderr.write("[team/runtime-v2] preserving team state because config is missing and worktree cleanup evidence remains\n");
|
|
19988
20265
|
return { outcome: "preserved", reason: "config_missing_cleanup_evidence", workers: [] };
|
|
19989
20266
|
}
|
|
@@ -20312,12 +20589,12 @@ If you accept, exit your session. If you reject, remain active for task work and
|
|
|
20312
20589
|
return retainedWorktrees.length > 0 ? { outcome: "cleaned", preservedWorktrees: retainedWorktrees } : { outcome: "cleaned" };
|
|
20313
20590
|
});
|
|
20314
20591
|
}
|
|
20315
|
-
var
|
|
20592
|
+
var import_path46, import_fs41, import_promises15, import_node_crypto8, orchestratorByTeam, cadenceByTeam, TEAM_INSTANCE_FINAL_DISPOSAL_AUTHORIZATION;
|
|
20316
20593
|
var init_runtime_v2 = __esm({
|
|
20317
20594
|
"src/team/runtime-v2.ts"() {
|
|
20318
20595
|
"use strict";
|
|
20319
|
-
|
|
20320
|
-
|
|
20596
|
+
import_path46 = require("path");
|
|
20597
|
+
import_fs41 = require("fs");
|
|
20321
20598
|
import_promises15 = require("fs/promises");
|
|
20322
20599
|
init_state_paths();
|
|
20323
20600
|
init_worktree_paths();
|
|
@@ -30252,7 +30529,7 @@ var Protocol = class {
|
|
|
30252
30529
|
return;
|
|
30253
30530
|
}
|
|
30254
30531
|
const pollInterval = task2.pollInterval ?? this._options?.defaultTaskPollInterval ?? 1e3;
|
|
30255
|
-
await new Promise((
|
|
30532
|
+
await new Promise((resolve21) => setTimeout(resolve21, pollInterval));
|
|
30256
30533
|
options?.signal?.throwIfAborted();
|
|
30257
30534
|
}
|
|
30258
30535
|
} catch (error2) {
|
|
@@ -30269,7 +30546,7 @@ var Protocol = class {
|
|
|
30269
30546
|
*/
|
|
30270
30547
|
request(request, resultSchema, options) {
|
|
30271
30548
|
const { relatedRequestId, resumptionToken, onresumptiontoken, task, relatedTask } = options ?? {};
|
|
30272
|
-
return new Promise((
|
|
30549
|
+
return new Promise((resolve21, reject) => {
|
|
30273
30550
|
const earlyReject = (error2) => {
|
|
30274
30551
|
reject(error2);
|
|
30275
30552
|
};
|
|
@@ -30347,7 +30624,7 @@ var Protocol = class {
|
|
|
30347
30624
|
if (!parseResult.success) {
|
|
30348
30625
|
reject(parseResult.error);
|
|
30349
30626
|
} else {
|
|
30350
|
-
|
|
30627
|
+
resolve21(parseResult.data);
|
|
30351
30628
|
}
|
|
30352
30629
|
} catch (error2) {
|
|
30353
30630
|
reject(error2);
|
|
@@ -30608,12 +30885,12 @@ var Protocol = class {
|
|
|
30608
30885
|
}
|
|
30609
30886
|
} catch {
|
|
30610
30887
|
}
|
|
30611
|
-
return new Promise((
|
|
30888
|
+
return new Promise((resolve21, reject) => {
|
|
30612
30889
|
if (signal.aborted) {
|
|
30613
30890
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
30614
30891
|
return;
|
|
30615
30892
|
}
|
|
30616
|
-
const timeoutId = setTimeout(
|
|
30893
|
+
const timeoutId = setTimeout(resolve21, interval);
|
|
30617
30894
|
signal.addEventListener("abort", () => {
|
|
30618
30895
|
clearTimeout(timeoutId);
|
|
30619
30896
|
reject(new McpError(ErrorCode.InvalidRequest, "Request cancelled"));
|
|
@@ -31342,12 +31619,12 @@ var StdioServerTransport = class {
|
|
|
31342
31619
|
this.onclose?.();
|
|
31343
31620
|
}
|
|
31344
31621
|
send(message) {
|
|
31345
|
-
return new Promise((
|
|
31622
|
+
return new Promise((resolve21) => {
|
|
31346
31623
|
const json = serializeMessage(message);
|
|
31347
31624
|
if (this._stdout.write(json)) {
|
|
31348
|
-
|
|
31625
|
+
resolve21();
|
|
31349
31626
|
} else {
|
|
31350
|
-
this._stdout.once("drain",
|
|
31627
|
+
this._stdout.once("drain", resolve21);
|
|
31351
31628
|
}
|
|
31352
31629
|
});
|
|
31353
31630
|
}
|
|
@@ -31356,10 +31633,10 @@ var StdioServerTransport = class {
|
|
|
31356
31633
|
// src/mcp/team-server.ts
|
|
31357
31634
|
var import_node_crypto9 = require("node:crypto");
|
|
31358
31635
|
var import_child_process11 = require("child_process");
|
|
31359
|
-
var
|
|
31360
|
-
var
|
|
31636
|
+
var import_path48 = require("path");
|
|
31637
|
+
var import_url9 = require("url");
|
|
31361
31638
|
init_omc_cli_rendering();
|
|
31362
|
-
var
|
|
31639
|
+
var import_fs43 = require("fs");
|
|
31363
31640
|
var import_promises16 = require("fs/promises");
|
|
31364
31641
|
init_team_name();
|
|
31365
31642
|
init_runtime_v2();
|
|
@@ -31475,16 +31752,16 @@ var NudgeTracker = class {
|
|
|
31475
31752
|
};
|
|
31476
31753
|
|
|
31477
31754
|
// src/mcp/team-job-convergence.ts
|
|
31478
|
-
var
|
|
31479
|
-
var
|
|
31755
|
+
var import_fs42 = require("fs");
|
|
31756
|
+
var import_path47 = require("path");
|
|
31480
31757
|
init_types2();
|
|
31481
31758
|
init_team_name();
|
|
31482
31759
|
function readResultArtifact(omcJobsDir, jobId) {
|
|
31483
|
-
const artifactPath = (0,
|
|
31484
|
-
if (!(0,
|
|
31760
|
+
const artifactPath = (0, import_path47.join)(omcJobsDir, `${jobId}-result.json`);
|
|
31761
|
+
if (!(0, import_fs42.existsSync)(artifactPath)) return { kind: "none" };
|
|
31485
31762
|
let raw;
|
|
31486
31763
|
try {
|
|
31487
|
-
raw = (0,
|
|
31764
|
+
raw = (0, import_fs42.readFileSync)(artifactPath, "utf-8");
|
|
31488
31765
|
} catch (error2) {
|
|
31489
31766
|
if (error2.code === "ENOENT") return { kind: "none" };
|
|
31490
31767
|
const message = `Failed to read result artifact at ${artifactPath}: ${error2 instanceof Error ? error2.message : String(error2)}`;
|
|
@@ -31586,10 +31863,10 @@ function convergeJobWithResultArtifact(job, jobId, omcJobsDir) {
|
|
|
31586
31863
|
};
|
|
31587
31864
|
}
|
|
31588
31865
|
function resultArtifactIdentityError(job, jobId, omcJobsDir) {
|
|
31589
|
-
const artifactPath = (0,
|
|
31866
|
+
const artifactPath = (0, import_path47.join)(omcJobsDir, `${jobId}-result.json`);
|
|
31590
31867
|
let raw;
|
|
31591
31868
|
try {
|
|
31592
|
-
raw = (0,
|
|
31869
|
+
raw = (0, import_fs42.readFileSync)(artifactPath, "utf-8");
|
|
31593
31870
|
} catch (error2) {
|
|
31594
31871
|
if (error2.code === "ENOENT") return null;
|
|
31595
31872
|
return `cleanup_result_evidence_unreadable:${error2 instanceof Error ? error2.message : String(error2)}`;
|
|
@@ -31604,7 +31881,7 @@ function resultArtifactIdentityError(job, jobId, omcJobsDir) {
|
|
|
31604
31881
|
}
|
|
31605
31882
|
function readMatchingTerminalArtifact(job, jobId, omcJobsDir) {
|
|
31606
31883
|
try {
|
|
31607
|
-
const raw = (0,
|
|
31884
|
+
const raw = (0, import_fs42.readFileSync)((0, import_path47.join)(omcJobsDir, `${jobId}-result.json`), "utf-8");
|
|
31608
31885
|
const parsed = JSON.parse(raw);
|
|
31609
31886
|
if (parsed.status !== "completed" && parsed.status !== "failed" || parsed.instanceId !== job.instanceId || !isValidTeamInstanceId(parsed.instanceId)) return null;
|
|
31610
31887
|
return { status: parsed.status, raw };
|
|
@@ -31654,7 +31931,7 @@ init_paths();
|
|
|
31654
31931
|
var __ownDir = (() => {
|
|
31655
31932
|
if (typeof __dirname !== "undefined" && __dirname) return __dirname;
|
|
31656
31933
|
try {
|
|
31657
|
-
return (0,
|
|
31934
|
+
return (0, import_url9.fileURLToPath)(new URL(".", importMetaUrl));
|
|
31658
31935
|
} catch {
|
|
31659
31936
|
return process.cwd();
|
|
31660
31937
|
}
|
|
@@ -31750,10 +32027,10 @@ function persistJob(jobId, job) {
|
|
|
31750
32027
|
}
|
|
31751
32028
|
}
|
|
31752
32029
|
function loadJobFromDisk(jobId) {
|
|
31753
|
-
const path5 = (0,
|
|
32030
|
+
const path5 = (0, import_path48.join)(OMC_JOBS_DIR, `${jobId}.json`);
|
|
31754
32031
|
let content;
|
|
31755
32032
|
try {
|
|
31756
|
-
content = (0,
|
|
32033
|
+
content = (0, import_fs43.readFileSync)(path5, "utf-8");
|
|
31757
32034
|
} catch (error2) {
|
|
31758
32035
|
if (error2.code === "ENOENT") return void 0;
|
|
31759
32036
|
throw new Error(`Unreadable job file: ${jobId} (${error2 instanceof Error ? error2.message : String(error2)})`);
|
|
@@ -31773,7 +32050,7 @@ function getJob(jobId) {
|
|
|
31773
32050
|
return loadJobFromDisk(jobId);
|
|
31774
32051
|
}
|
|
31775
32052
|
async function loadPaneIds(jobId, instanceId) {
|
|
31776
|
-
const p = (0,
|
|
32053
|
+
const p = (0, import_path48.join)(OMC_JOBS_DIR, `${jobId}-panes.json`);
|
|
31777
32054
|
try {
|
|
31778
32055
|
const parsed = JSON.parse(await (0, import_promises16.readFile)(p, "utf-8"));
|
|
31779
32056
|
if (!isValidTeamPaneArtifact(parsed, instanceId)) return null;
|
|
@@ -31937,18 +32214,18 @@ function validateJobId(job_id) {
|
|
|
31937
32214
|
}
|
|
31938
32215
|
}
|
|
31939
32216
|
function jobLockPath(jobId) {
|
|
31940
|
-
return (0,
|
|
32217
|
+
return (0, import_path48.join)(OMC_JOBS_DIR, `.${jobId}.lock`);
|
|
31941
32218
|
}
|
|
31942
32219
|
function persistJobUnlocked(jobId, job) {
|
|
31943
|
-
if (!(0,
|
|
31944
|
-
const targetPath = (0,
|
|
32220
|
+
if (!(0, import_fs43.existsSync)(OMC_JOBS_DIR)) (0, import_fs43.mkdirSync)(OMC_JOBS_DIR, { recursive: true });
|
|
32221
|
+
const targetPath = (0, import_path48.join)(OMC_JOBS_DIR, `${jobId}.json`);
|
|
31945
32222
|
const tempPath = `${targetPath}.tmp.${process.pid}.${(0, import_node_crypto9.randomUUID)()}`;
|
|
31946
32223
|
try {
|
|
31947
|
-
(0,
|
|
31948
|
-
(0,
|
|
32224
|
+
(0, import_fs43.writeFileSync)(tempPath, JSON.stringify(job), { encoding: "utf-8", mode: 384 });
|
|
32225
|
+
(0, import_fs43.renameSync)(tempPath, targetPath);
|
|
31949
32226
|
} finally {
|
|
31950
32227
|
try {
|
|
31951
|
-
(0,
|
|
32228
|
+
(0, import_fs43.unlinkSync)(tempPath);
|
|
31952
32229
|
} catch {
|
|
31953
32230
|
}
|
|
31954
32231
|
}
|
|
@@ -32078,10 +32355,10 @@ async function handleStart(args) {
|
|
|
32078
32355
|
"team_start_unsafe_runtime_v1: instance-bound provider cleanup requires runtime v2; set OMC_RUNTIME_V2=1"
|
|
32079
32356
|
);
|
|
32080
32357
|
}
|
|
32081
|
-
const cwd = (0,
|
|
32358
|
+
const cwd = (0, import_path48.resolve)(input.cwd);
|
|
32082
32359
|
const jobId = `omc-${Date.now().toString(36)}${(0, import_node_crypto9.randomUUID)().slice(0, 8)}`;
|
|
32083
32360
|
const instanceId = (0, import_node_crypto9.randomUUID)();
|
|
32084
|
-
const runtimeCliPath = (0,
|
|
32361
|
+
const runtimeCliPath = (0, import_path48.join)(__ownDir, "runtime-cli.cjs");
|
|
32085
32362
|
const job = {
|
|
32086
32363
|
status: "running",
|
|
32087
32364
|
startedAt: Date.now(),
|
|
@@ -32358,7 +32635,7 @@ async function handleCleanup(args) {
|
|
|
32358
32635
|
if (resultEvidenceError) return blockCleanup(resultEvidenceError);
|
|
32359
32636
|
const panes = await loadPaneIds(job_id, job.instanceId);
|
|
32360
32637
|
if (!panes) {
|
|
32361
|
-
const reason = (0,
|
|
32638
|
+
const reason = (0, import_fs43.existsSync)((0, import_path48.join)(OMC_JOBS_DIR, `${job_id}-panes.json`)) ? "cleanup_panes_evidence_corrupt" : "cleanup_panes_evidence_missing";
|
|
32362
32639
|
return blockCleanup(reason);
|
|
32363
32640
|
}
|
|
32364
32641
|
try {
|