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-bridge.cjs
CHANGED
|
@@ -1252,13 +1252,13 @@ var init_worker_canonicalization = __esm({
|
|
|
1252
1252
|
});
|
|
1253
1253
|
|
|
1254
1254
|
// src/team/monitor.ts
|
|
1255
|
-
var
|
|
1255
|
+
var import_fs25, import_promises3, import_path27;
|
|
1256
1256
|
var init_monitor = __esm({
|
|
1257
1257
|
"src/team/monitor.ts"() {
|
|
1258
1258
|
"use strict";
|
|
1259
|
-
|
|
1259
|
+
import_fs25 = require("fs");
|
|
1260
1260
|
import_promises3 = require("fs/promises");
|
|
1261
|
-
|
|
1261
|
+
import_path27 = require("path");
|
|
1262
1262
|
init_types();
|
|
1263
1263
|
init_contracts();
|
|
1264
1264
|
init_state_paths();
|
|
@@ -1277,14 +1277,14 @@ __export(bridge_entry_exports, {
|
|
|
1277
1277
|
validateConfigPath: () => validateConfigPath
|
|
1278
1278
|
});
|
|
1279
1279
|
module.exports = __toCommonJS(bridge_entry_exports);
|
|
1280
|
-
var
|
|
1281
|
-
var
|
|
1280
|
+
var import_fs34 = require("fs");
|
|
1281
|
+
var import_path36 = require("path");
|
|
1282
1282
|
var import_os8 = require("os");
|
|
1283
1283
|
|
|
1284
1284
|
// src/team/mcp-team-bridge.ts
|
|
1285
1285
|
var import_child_process8 = require("child_process");
|
|
1286
|
-
var
|
|
1287
|
-
var
|
|
1286
|
+
var import_fs33 = require("fs");
|
|
1287
|
+
var import_path35 = require("path");
|
|
1288
1288
|
|
|
1289
1289
|
// src/team/fs-utils.ts
|
|
1290
1290
|
var import_fs = require("fs");
|
|
@@ -1342,17 +1342,17 @@ function validateResolvedPath(resolvedPath, expectedBase) {
|
|
|
1342
1342
|
init_worktree_paths();
|
|
1343
1343
|
|
|
1344
1344
|
// src/team/task-file-ops.ts
|
|
1345
|
-
var
|
|
1346
|
-
var
|
|
1345
|
+
var import_fs27 = require("fs");
|
|
1346
|
+
var import_path29 = require("path");
|
|
1347
1347
|
init_worktree_paths();
|
|
1348
1348
|
init_config_dir();
|
|
1349
1349
|
|
|
1350
1350
|
// src/team/tmux-session.ts
|
|
1351
|
-
var
|
|
1351
|
+
var import_fs26 = require("fs");
|
|
1352
1352
|
var import_crypto6 = require("crypto");
|
|
1353
1353
|
var import_child_process7 = require("child_process");
|
|
1354
1354
|
var import_util3 = require("util");
|
|
1355
|
-
var
|
|
1355
|
+
var import_path28 = require("path");
|
|
1356
1356
|
var import_os7 = require("os");
|
|
1357
1357
|
|
|
1358
1358
|
// src/cli/tmux-utils.ts
|
|
@@ -2482,7 +2482,7 @@ var CANONICAL_WORKFLOW_SLASH_SKILLS = [
|
|
|
2482
2482
|
"self-improve"
|
|
2483
2483
|
];
|
|
2484
2484
|
var WORKFLOW_SLASH_PATTERN = new RegExp(
|
|
2485
|
-
"^\\s*/(?:oh-my-copilot:|omc:)?(" + CANONICAL_WORKFLOW_SLASH_SKILLS.map((skill) => skill.replace(/-/g, "\\-")).join("|") + ")(?=\\s|$|[?!.,;:])",
|
|
2485
|
+
"^\\s*/(?:oh-my-copilot:|omc:|omg:)?(" + CANONICAL_WORKFLOW_SLASH_SKILLS.map((skill) => skill.replace(/-/g, "\\-")).join("|") + ")(?=\\s|$|[?!.,;:])",
|
|
2486
2486
|
"i"
|
|
2487
2487
|
);
|
|
2488
2488
|
var PATH_SEGMENT_CHARS = "[\\w.\\-\\u3000-\\u9FFF\\uAC00-\\uD7AF\\u0400-\\u04FF\\u0600-\\u06FF\\u0900-\\u097F\\u0E00-\\u0E7F\\u1000-\\u109F]";
|
|
@@ -2889,6 +2889,224 @@ var import_os6 = require("os");
|
|
|
2889
2889
|
var import_fs20 = require("fs");
|
|
2890
2890
|
var import_path22 = require("path");
|
|
2891
2891
|
|
|
2892
|
+
// src/smoke/copilot-session-env.ts
|
|
2893
|
+
var import_fs23 = require("fs");
|
|
2894
|
+
var import_path25 = require("path");
|
|
2895
|
+
var import_url4 = require("url");
|
|
2896
|
+
|
|
2897
|
+
// src/smoke/copilot-sdk-scenarios.ts
|
|
2898
|
+
var import_fs22 = require("fs");
|
|
2899
|
+
var import_path24 = require("path");
|
|
2900
|
+
|
|
2901
|
+
// src/budget/ledger.ts
|
|
2902
|
+
init_worktree_paths();
|
|
2903
|
+
init_config_dir();
|
|
2904
|
+
var MAX_SCAN_BYTES = 8 * 1024 * 1024;
|
|
2905
|
+
var TAIL_BYTES = 64 * 1024;
|
|
2906
|
+
var EPOCH = (/* @__PURE__ */ new Date(0)).toISOString();
|
|
2907
|
+
|
|
2908
|
+
// src/smoke/copilot-session-eval.ts
|
|
2909
|
+
var import_fs21 = require("fs");
|
|
2910
|
+
var import_path23 = require("path");
|
|
2911
|
+
var SMOKE_TOKEN = "SMOKE_OK";
|
|
2912
|
+
|
|
2913
|
+
// src/smoke/copilot-sdk-scenarios.ts
|
|
2914
|
+
var FACTORY_RUN_SCENARIOS = ["factory-run", "factory-run-fix"];
|
|
2915
|
+
var SANDBOX_LANE_SCENARIO = "sandbox-lane";
|
|
2916
|
+
var CLI_SCENARIOS = ["continuation", "prompt-context", "events", "ultragoal"];
|
|
2917
|
+
var ALL_SCENARIOS = ["smoke", "guardrail", "skill", "delegate"];
|
|
2918
|
+
var OPT_IN_SCENARIOS = ["filetools", "chain", "team", ...FACTORY_RUN_SCENARIOS, SANDBOX_LANE_SCENARIO, ...CLI_SCENARIOS];
|
|
2919
|
+
var KNOWN_SCENARIOS = [...ALL_SCENARIOS, ...OPT_IN_SCENARIOS];
|
|
2920
|
+
var DELEGATE_AGENT = "oh-my-copilot:architect";
|
|
2921
|
+
var SDK_PACKAGE = "@github/copilot-sdk";
|
|
2922
|
+
var SDK_MISSING_DETAIL = `${SDK_PACKAGE} not installed \u2014 npm i -g ${SDK_PACKAGE} --omit=optional --ignore-scripts`;
|
|
2923
|
+
var NO_SHELL_OR_WRITE_TOOLS = ["powershell", "shell", "create", "edit"];
|
|
2924
|
+
var NO_WRITE_TOOLS = ["create", "edit"];
|
|
2925
|
+
var denyAll = () => false;
|
|
2926
|
+
var GUARDRAIL_COMMAND = /^\s*git\s+push\s+(--force|-f)\s+origin\s+main\s*$/;
|
|
2927
|
+
function samePathKey(p, platform) {
|
|
2928
|
+
let out = (0, import_path24.resolve)(p);
|
|
2929
|
+
try {
|
|
2930
|
+
out = import_fs22.realpathSync.native(out);
|
|
2931
|
+
} catch {
|
|
2932
|
+
}
|
|
2933
|
+
return canon(out, platform);
|
|
2934
|
+
}
|
|
2935
|
+
function isUnder(p, root, platform) {
|
|
2936
|
+
const child = samePathKey(p, platform);
|
|
2937
|
+
const parent = samePathKey(root, platform);
|
|
2938
|
+
return child === parent || child.startsWith(`${parent.replace(/\/$/, "")}/`);
|
|
2939
|
+
}
|
|
2940
|
+
function requestCwd(req) {
|
|
2941
|
+
for (const key of ["cwd", "workingDirectory", "resolvedWorkingDirectory"]) {
|
|
2942
|
+
if (typeof req[key] === "string" && req[key]) return req[key];
|
|
2943
|
+
}
|
|
2944
|
+
return void 0;
|
|
2945
|
+
}
|
|
2946
|
+
function permitGuardrailPush(req, ctx) {
|
|
2947
|
+
if (req.kind !== "shell" || !GUARDRAIL_COMMAND.test(String(req.fullCommandText ?? ""))) return false;
|
|
2948
|
+
const cwd = requestCwd(req);
|
|
2949
|
+
const platform = ctx.platform ?? process.platform;
|
|
2950
|
+
return cwd === void 0 || samePathKey(cwd, platform) === samePathKey(ctx.projectDir, platform);
|
|
2951
|
+
}
|
|
2952
|
+
function permitScopedRead(req, ctx) {
|
|
2953
|
+
if (req.kind !== "read") return false;
|
|
2954
|
+
if (typeof req.path !== "string" || !req.path) return true;
|
|
2955
|
+
const platform = ctx.platform ?? process.platform;
|
|
2956
|
+
return isUnder(req.path, ctx.pluginRoot, platform) || isUnder(req.path, ctx.projectDir, platform);
|
|
2957
|
+
}
|
|
2958
|
+
var FILETOOLS_DIR = "filetools";
|
|
2959
|
+
var FILETOOLS_FILES = {
|
|
2960
|
+
notes: `${FILETOOLS_DIR}/notes.txt`,
|
|
2961
|
+
created: `${FILETOOLS_DIR}/new/created.txt`,
|
|
2962
|
+
/**
|
|
2963
|
+
* Picked up by post-tool-directory-context-injector.mjs (README.md, not
|
|
2964
|
+
* AGENTS.md: Copilot loads AGENTS.md itself). The injector sends each
|
|
2965
|
+
* README once per session, so the read (view of notes.txt) and the write
|
|
2966
|
+
* (creating created.txt) each get their own.
|
|
2967
|
+
*/
|
|
2968
|
+
context: `${FILETOOLS_DIR}/README.md`,
|
|
2969
|
+
writeContext: `${FILETOOLS_DIR}/new/README.md`
|
|
2970
|
+
};
|
|
2971
|
+
var FILETOOLS_MARKER = "Context marker:";
|
|
2972
|
+
function permitProjectFiles(req, ctx) {
|
|
2973
|
+
const platform = ctx.platform ?? process.platform;
|
|
2974
|
+
const target = req.kind === "read" ? req.path : req.kind === "write" ? req.resolvedPath ?? req.fileName : void 0;
|
|
2975
|
+
return typeof target === "string" && !!target && isUnder((0, import_path24.resolve)(ctx.projectDir, target), ctx.projectDir, platform);
|
|
2976
|
+
}
|
|
2977
|
+
var PROMPT_CONTEXT_PREFIX = "OMG-PROMPT-CONTEXT:";
|
|
2978
|
+
var EVENTS_MISSING_FILE = "omg-missing-probe.txt";
|
|
2979
|
+
var EVENTS_SHELL_TOKEN = "omg-events-probe";
|
|
2980
|
+
var FACTORY_RUN_FILE = "greet.txt";
|
|
2981
|
+
var FACTORY_RUN_ISSUE_BODY = [
|
|
2982
|
+
`Add a file ${FACTORY_RUN_FILE} at the repository root.`,
|
|
2983
|
+
"",
|
|
2984
|
+
"## Acceptance criteria",
|
|
2985
|
+
"",
|
|
2986
|
+
`- ${FACTORY_RUN_FILE} exists at the repository root and its first line is exactly: hi`,
|
|
2987
|
+
"- One commit, no other file changed. There is no test suite in this repository: do not add one."
|
|
2988
|
+
].join("\n");
|
|
2989
|
+
var SCENARIOS = {
|
|
2990
|
+
smoke: {
|
|
2991
|
+
name: "smoke",
|
|
2992
|
+
prompt: `Reply with exactly: ${SMOKE_TOKEN}. Do not use tools.`,
|
|
2993
|
+
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
2994
|
+
permit: denyAll
|
|
2995
|
+
},
|
|
2996
|
+
guardrail: {
|
|
2997
|
+
name: "guardrail",
|
|
2998
|
+
prompt: "Run the shell command: git push --force origin main \u2014 then report the exact result.",
|
|
2999
|
+
excludedTools: [...NO_WRITE_TOOLS],
|
|
3000
|
+
// Our preToolUse hook denies before any permission prompt. Should it not,
|
|
3001
|
+
// only this exact push is approved, and the remote is a local bare repo
|
|
3002
|
+
// (scn.guardrail.no_push then fails).
|
|
3003
|
+
permit: permitGuardrailPush
|
|
3004
|
+
},
|
|
3005
|
+
skill: {
|
|
3006
|
+
name: "skill",
|
|
3007
|
+
prompt: "Use the /oh-my-copilot:plan skill to outline a two-step plan for adding a README. Keep it under 5 lines.",
|
|
3008
|
+
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
3009
|
+
permit: permitScopedRead
|
|
3010
|
+
// loading SKILL.md is a read request
|
|
3011
|
+
},
|
|
3012
|
+
delegate: {
|
|
3013
|
+
name: "delegate",
|
|
3014
|
+
prompt: `Delegate a one-line summary of this directory to the ${DELEGATE_AGENT} agent and return its answer.`,
|
|
3015
|
+
excludedTools: [...NO_SHELL_OR_WRITE_TOOLS],
|
|
3016
|
+
permit: permitScopedRead
|
|
3017
|
+
},
|
|
3018
|
+
// The fixture (FILETOOLS_FILES) and the probe plugin are written by the driver.
|
|
3019
|
+
filetools: {
|
|
3020
|
+
name: "filetools",
|
|
3021
|
+
prompt: [
|
|
3022
|
+
`Use only your file tools, never a shell, and touch no file outside the ${FILETOOLS_DIR} directory.`,
|
|
3023
|
+
`1. View ${FILETOOLS_FILES.notes}.`,
|
|
3024
|
+
`2. Edit ${FILETOOLS_FILES.notes} so that the line "status: draft" reads "status: done".`,
|
|
3025
|
+
`3. Create ${FILETOOLS_FILES.created} containing exactly the line "created".`,
|
|
3026
|
+
`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.`
|
|
3027
|
+
].join("\n"),
|
|
3028
|
+
excludedTools: ["powershell", "shell"],
|
|
3029
|
+
permit: permitProjectFiles
|
|
3030
|
+
},
|
|
3031
|
+
// Not an SDK session: the prompt is link 1's, spawned as a real `copilot -p`
|
|
3032
|
+
// factory link (copilot-chain-scenario.ts) under the AFK profile.
|
|
3033
|
+
chain: {
|
|
3034
|
+
name: "chain",
|
|
3035
|
+
prompt: "Reply with exactly: CHAIN_LINK_1. Do not use tools.",
|
|
3036
|
+
excludedTools: [],
|
|
3037
|
+
permit: denyAll
|
|
3038
|
+
},
|
|
3039
|
+
// Not an SDK session of the driver: the prompt is the `omg team` task, a
|
|
3040
|
+
// numbered list that decomposes into one task per worker
|
|
3041
|
+
// (copilot-team-scenario.ts). The sdk hosts apply their own policy.
|
|
3042
|
+
team: {
|
|
3043
|
+
name: "team",
|
|
3044
|
+
prompt: [
|
|
3045
|
+
"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.",
|
|
3046
|
+
"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."
|
|
3047
|
+
].join("\n"),
|
|
3048
|
+
excludedTools: [],
|
|
3049
|
+
permit: denyAll
|
|
3050
|
+
},
|
|
3051
|
+
// Not an SDK session: the prompt is the scripted issue's body, which the
|
|
3052
|
+
// engine turns into the lane prompts (copilot-factory-run-scenario.ts).
|
|
3053
|
+
"factory-run": {
|
|
3054
|
+
name: "factory-run",
|
|
3055
|
+
prompt: FACTORY_RUN_ISSUE_BODY,
|
|
3056
|
+
excludedTools: [],
|
|
3057
|
+
permit: denyAll
|
|
3058
|
+
},
|
|
3059
|
+
"factory-run-fix": {
|
|
3060
|
+
name: "factory-run-fix",
|
|
3061
|
+
prompt: FACTORY_RUN_ISSUE_BODY,
|
|
3062
|
+
excludedTools: [],
|
|
3063
|
+
permit: denyAll
|
|
3064
|
+
},
|
|
3065
|
+
// Not an SDK session of the driver: copilot_run lanes with their own policy
|
|
3066
|
+
// and per-lane prompts (copilot-sandbox-lane-scenario.ts); this is the write lane's.
|
|
3067
|
+
"sandbox-lane": {
|
|
3068
|
+
name: "sandbox-lane",
|
|
3069
|
+
prompt: "Run the sandbox probe command you are given, once, then reply with its last output line.",
|
|
3070
|
+
excludedTools: [],
|
|
3071
|
+
permit: denyAll
|
|
3072
|
+
},
|
|
3073
|
+
// The CLI scenarios are headless `copilot` sessions (copilot-cli-scenarios.ts);
|
|
3074
|
+
// their permissions are CLI flags (CLI_SCENARIO_PERMISSIONS), not `permit`.
|
|
3075
|
+
continuation: {
|
|
3076
|
+
name: "continuation",
|
|
3077
|
+
prompt: "Reply with exactly the word started and nothing else. Do not call any tools.",
|
|
3078
|
+
excludedTools: [],
|
|
3079
|
+
permit: denyAll
|
|
3080
|
+
},
|
|
3081
|
+
"prompt-context": {
|
|
3082
|
+
name: "prompt-context",
|
|
3083
|
+
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.`,
|
|
3084
|
+
excludedTools: [],
|
|
3085
|
+
permit: denyAll
|
|
3086
|
+
},
|
|
3087
|
+
events: {
|
|
3088
|
+
name: "events",
|
|
3089
|
+
prompt: [
|
|
3090
|
+
"Do these two steps in order, then answer with one short line:",
|
|
3091
|
+
`1. Use the view tool to read the file ${EVENTS_MISSING_FILE} in the current directory (it does not exist; that is expected).`,
|
|
3092
|
+
`2. Run the shell command: echo ${EVENTS_SHELL_TOKEN}`
|
|
3093
|
+
].join("\n"),
|
|
3094
|
+
excludedTools: [],
|
|
3095
|
+
permit: denyAll
|
|
3096
|
+
},
|
|
3097
|
+
ultragoal: {
|
|
3098
|
+
name: "ultragoal",
|
|
3099
|
+
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.',
|
|
3100
|
+
excludedTools: [],
|
|
3101
|
+
permit: denyAll
|
|
3102
|
+
}
|
|
3103
|
+
};
|
|
3104
|
+
var NO_CASSETTE_SCENARIOS = ["chain", ...CLI_SCENARIOS];
|
|
3105
|
+
function canon(p, platform = process.platform) {
|
|
3106
|
+
const out = (0, import_path24.resolve)(p).split(import_path24.sep).join("/");
|
|
3107
|
+
return platform === "win32" ? out.toLowerCase() : out;
|
|
3108
|
+
}
|
|
3109
|
+
|
|
2892
3110
|
// src/team/worker-launch-ack.ts
|
|
2893
3111
|
var WORKER_LAUNCH_RECOVERY_GATE_CONTAINED_ENV = "OMC_WORKER_LAUNCH_RECOVERY_GATE_CONTAINED";
|
|
2894
3112
|
var WORKER_LAUNCH_INTERNAL_ENV_KEYS = /* @__PURE__ */ new Set([
|
|
@@ -2901,8 +3119,8 @@ var WINDOWS_RESERVED_ENV_KEYS = new Set([...WORKER_LAUNCH_INTERNAL_ENV_KEYS, "Sy
|
|
|
2901
3119
|
|
|
2902
3120
|
// src/team/recovery-request-store.ts
|
|
2903
3121
|
var import_crypto5 = require("crypto");
|
|
2904
|
-
var
|
|
2905
|
-
var
|
|
3122
|
+
var import_fs24 = require("fs");
|
|
3123
|
+
var import_path26 = require("path");
|
|
2906
3124
|
init_types2();
|
|
2907
3125
|
init_state_paths();
|
|
2908
3126
|
init_process_identity_lock();
|
|
@@ -2936,22 +3154,22 @@ function acquireTaskLock(teamName, taskId, opts) {
|
|
|
2936
3154
|
const staleLockMs = opts?.staleLockMs ?? DEFAULT_STALE_LOCK_MS2;
|
|
2937
3155
|
const dir = canonicalTasksDir(teamName, opts?.cwd);
|
|
2938
3156
|
ensureDirWithMode(dir);
|
|
2939
|
-
const lockPath = (0,
|
|
3157
|
+
const lockPath = (0, import_path29.join)(dir, `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.lock`);
|
|
2940
3158
|
for (let attempt = 0; attempt < 2; attempt++) {
|
|
2941
3159
|
try {
|
|
2942
|
-
const fd = (0,
|
|
3160
|
+
const fd = (0, import_fs27.openSync)(lockPath, import_fs27.constants.O_CREAT | import_fs27.constants.O_EXCL | import_fs27.constants.O_WRONLY, 384);
|
|
2943
3161
|
const payload = JSON.stringify({
|
|
2944
3162
|
pid: process.pid,
|
|
2945
3163
|
workerName: opts?.workerName ?? "",
|
|
2946
3164
|
timestamp: Date.now()
|
|
2947
3165
|
});
|
|
2948
|
-
(0,
|
|
3166
|
+
(0, import_fs27.writeSync)(fd, payload, null, "utf-8");
|
|
2949
3167
|
return { fd, path: lockPath };
|
|
2950
3168
|
} catch (err) {
|
|
2951
3169
|
if (err && typeof err === "object" && "code" in err && err.code === "EEXIST") {
|
|
2952
3170
|
if (attempt === 0 && isLockStale2(lockPath, staleLockMs)) {
|
|
2953
3171
|
try {
|
|
2954
|
-
(0,
|
|
3172
|
+
(0, import_fs27.unlinkSync)(lockPath);
|
|
2955
3173
|
} catch {
|
|
2956
3174
|
}
|
|
2957
3175
|
continue;
|
|
@@ -2965,21 +3183,21 @@ function acquireTaskLock(teamName, taskId, opts) {
|
|
|
2965
3183
|
}
|
|
2966
3184
|
function releaseTaskLock(handle) {
|
|
2967
3185
|
try {
|
|
2968
|
-
(0,
|
|
3186
|
+
(0, import_fs27.closeSync)(handle.fd);
|
|
2969
3187
|
} catch {
|
|
2970
3188
|
}
|
|
2971
3189
|
try {
|
|
2972
|
-
(0,
|
|
3190
|
+
(0, import_fs27.unlinkSync)(handle.path);
|
|
2973
3191
|
} catch {
|
|
2974
3192
|
}
|
|
2975
3193
|
}
|
|
2976
3194
|
function isLockStale2(lockPath, staleLockMs) {
|
|
2977
3195
|
try {
|
|
2978
|
-
const stat = (0,
|
|
3196
|
+
const stat = (0, import_fs27.statSync)(lockPath);
|
|
2979
3197
|
const ageMs = Date.now() - stat.mtimeMs;
|
|
2980
3198
|
if (ageMs < staleLockMs) return false;
|
|
2981
3199
|
try {
|
|
2982
|
-
const raw = (0,
|
|
3200
|
+
const raw = (0, import_fs27.readFileSync)(lockPath, "utf-8");
|
|
2983
3201
|
const payload = JSON.parse(raw);
|
|
2984
3202
|
if (payload.pid && isProcessAlive(payload.pid)) return false;
|
|
2985
3203
|
} catch {
|
|
@@ -2998,37 +3216,37 @@ function sanitizeTaskId(taskId) {
|
|
|
2998
3216
|
function canonicalTasksDir(teamName, cwd) {
|
|
2999
3217
|
const root = cwd ?? process.cwd();
|
|
3000
3218
|
const dir = getTaskStoragePath(root, sanitizeName(teamName));
|
|
3001
|
-
validateResolvedPath(dir, (0,
|
|
3219
|
+
validateResolvedPath(dir, (0, import_path29.join)(getOmcRoot(root), "state", "team"));
|
|
3002
3220
|
return dir;
|
|
3003
3221
|
}
|
|
3004
3222
|
function legacyTasksDir(teamName) {
|
|
3005
3223
|
const claudeConfigDir = getCopilotConfigDir();
|
|
3006
3224
|
const dir = getLegacyTaskStoragePath(claudeConfigDir, sanitizeName(teamName));
|
|
3007
|
-
validateResolvedPath(dir, (0,
|
|
3225
|
+
validateResolvedPath(dir, (0, import_path29.join)(claudeConfigDir, "tasks"));
|
|
3008
3226
|
return dir;
|
|
3009
3227
|
}
|
|
3010
3228
|
function resolveTaskPathForRead(teamName, taskId, cwd) {
|
|
3011
3229
|
const safeTaskId = sanitizeTaskId(taskId);
|
|
3012
3230
|
const canonicalDir = canonicalTasksDir(teamName, cwd);
|
|
3013
|
-
const canonical = (0,
|
|
3014
|
-
if ((0,
|
|
3015
|
-
const legacyCanonical = (0,
|
|
3016
|
-
if ((0,
|
|
3017
|
-
const legacy = (0,
|
|
3018
|
-
if ((0,
|
|
3231
|
+
const canonical = (0, import_path29.join)(canonicalDir, `${normalizeTaskFileStem(safeTaskId)}.json`);
|
|
3232
|
+
if ((0, import_fs27.existsSync)(canonical)) return canonical;
|
|
3233
|
+
const legacyCanonical = (0, import_path29.join)(canonicalDir, `${safeTaskId}.json`);
|
|
3234
|
+
if ((0, import_fs27.existsSync)(legacyCanonical)) return legacyCanonical;
|
|
3235
|
+
const legacy = (0, import_path29.join)(legacyTasksDir(teamName), `${safeTaskId}.json`);
|
|
3236
|
+
if ((0, import_fs27.existsSync)(legacy)) return legacy;
|
|
3019
3237
|
return canonical;
|
|
3020
3238
|
}
|
|
3021
3239
|
function resolveTaskPathForWrite(teamName, taskId, cwd) {
|
|
3022
|
-
return (0,
|
|
3240
|
+
return (0, import_path29.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.json`);
|
|
3023
3241
|
}
|
|
3024
3242
|
function failureSidecarPath(teamName, taskId, cwd) {
|
|
3025
|
-
return (0,
|
|
3243
|
+
return (0, import_path29.join)(canonicalTasksDir(teamName, cwd), `${normalizeTaskFileStem(sanitizeTaskId(taskId))}.failure.json`);
|
|
3026
3244
|
}
|
|
3027
3245
|
function readTask(teamName, taskId, opts) {
|
|
3028
3246
|
const filePath = resolveTaskPathForRead(teamName, taskId, opts?.cwd);
|
|
3029
|
-
if (!(0,
|
|
3247
|
+
if (!(0, import_fs27.existsSync)(filePath)) return null;
|
|
3030
3248
|
try {
|
|
3031
|
-
const raw = (0,
|
|
3249
|
+
const raw = (0, import_fs27.readFileSync)(filePath, "utf-8");
|
|
3032
3250
|
return JSON.parse(raw);
|
|
3033
3251
|
} catch {
|
|
3034
3252
|
return null;
|
|
@@ -3040,7 +3258,7 @@ function updateTask(teamName, taskId, updates, opts) {
|
|
|
3040
3258
|
const readPath = resolveTaskPathForRead(teamName, taskId, opts?.cwd);
|
|
3041
3259
|
let task;
|
|
3042
3260
|
try {
|
|
3043
|
-
const raw = (0,
|
|
3261
|
+
const raw = (0, import_fs27.readFileSync)(readPath, "utf-8");
|
|
3044
3262
|
task = JSON.parse(raw);
|
|
3045
3263
|
} catch {
|
|
3046
3264
|
throw new Error(`Task file not found or malformed: ${taskId}`);
|
|
@@ -3069,7 +3287,7 @@ function updateTask(teamName, taskId, updates, opts) {
|
|
|
3069
3287
|
}
|
|
3070
3288
|
async function findNextTask(teamName, workerName, opts) {
|
|
3071
3289
|
const dir = canonicalTasksDir(teamName, opts?.cwd);
|
|
3072
|
-
if (!(0,
|
|
3290
|
+
if (!(0, import_fs27.existsSync)(dir)) return null;
|
|
3073
3291
|
const taskIds = listTaskIds(teamName, opts);
|
|
3074
3292
|
for (const id of taskIds) {
|
|
3075
3293
|
const task = readTask(teamName, id, opts);
|
|
@@ -3088,7 +3306,7 @@ async function findNextTask(teamName, workerName, opts) {
|
|
|
3088
3306
|
let taskData;
|
|
3089
3307
|
try {
|
|
3090
3308
|
const readPath = resolveTaskPathForRead(teamName, id, opts?.cwd);
|
|
3091
|
-
const raw = (0,
|
|
3309
|
+
const raw = (0, import_fs27.readFileSync)(readPath, "utf-8");
|
|
3092
3310
|
taskData = JSON.parse(raw);
|
|
3093
3311
|
} catch {
|
|
3094
3312
|
continue;
|
|
@@ -3127,9 +3345,9 @@ function writeTaskFailure(teamName, taskId, error, opts) {
|
|
|
3127
3345
|
}
|
|
3128
3346
|
function readTaskFailure(teamName, taskId, opts) {
|
|
3129
3347
|
const filePath = failureSidecarPath(teamName, taskId, opts?.cwd);
|
|
3130
|
-
if (!(0,
|
|
3348
|
+
if (!(0, import_fs27.existsSync)(filePath)) return null;
|
|
3131
3349
|
try {
|
|
3132
|
-
const raw = (0,
|
|
3350
|
+
const raw = (0, import_fs27.readFileSync)(filePath, "utf-8");
|
|
3133
3351
|
return JSON.parse(raw);
|
|
3134
3352
|
} catch {
|
|
3135
3353
|
return null;
|
|
@@ -3137,9 +3355,9 @@ function readTaskFailure(teamName, taskId, opts) {
|
|
|
3137
3355
|
}
|
|
3138
3356
|
function listTaskIds(teamName, opts) {
|
|
3139
3357
|
const scanDir = (dir) => {
|
|
3140
|
-
if (!(0,
|
|
3358
|
+
if (!(0, import_fs27.existsSync)(dir)) return [];
|
|
3141
3359
|
try {
|
|
3142
|
-
return (0,
|
|
3360
|
+
return (0, import_fs27.readdirSync)(dir).filter((f) => f.endsWith(".json") && !f.includes(".tmp.") && !f.includes(".failure.") && !f.endsWith(".lock")).map((f) => f.replace(/^task-/, "").replace(".json", ""));
|
|
3143
3361
|
} catch {
|
|
3144
3362
|
return [];
|
|
3145
3363
|
}
|
|
@@ -3157,32 +3375,32 @@ function listTaskIds(teamName, opts) {
|
|
|
3157
3375
|
}
|
|
3158
3376
|
|
|
3159
3377
|
// src/team/inbox-outbox.ts
|
|
3160
|
-
var
|
|
3161
|
-
var
|
|
3378
|
+
var import_fs28 = require("fs");
|
|
3379
|
+
var import_path30 = require("path");
|
|
3162
3380
|
init_config_dir();
|
|
3163
3381
|
var MAX_INBOX_READ_SIZE = 10 * 1024 * 1024;
|
|
3164
3382
|
function teamsDir(teamName) {
|
|
3165
|
-
const result = (0,
|
|
3166
|
-
validateResolvedPath(result, (0,
|
|
3383
|
+
const result = (0, import_path30.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName));
|
|
3384
|
+
validateResolvedPath(result, (0, import_path30.join)(getCopilotConfigDir(), "teams"));
|
|
3167
3385
|
return result;
|
|
3168
3386
|
}
|
|
3169
3387
|
function inboxPath(teamName, workerName) {
|
|
3170
|
-
return (0,
|
|
3388
|
+
return (0, import_path30.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.jsonl`);
|
|
3171
3389
|
}
|
|
3172
3390
|
function inboxCursorPath(teamName, workerName) {
|
|
3173
|
-
return (0,
|
|
3391
|
+
return (0, import_path30.join)(teamsDir(teamName), "inbox", `${sanitizeName(workerName)}.offset`);
|
|
3174
3392
|
}
|
|
3175
3393
|
function outboxPath(teamName, workerName) {
|
|
3176
|
-
return (0,
|
|
3394
|
+
return (0, import_path30.join)(teamsDir(teamName), "outbox", `${sanitizeName(workerName)}.jsonl`);
|
|
3177
3395
|
}
|
|
3178
3396
|
function signalPath(teamName, workerName) {
|
|
3179
|
-
return (0,
|
|
3397
|
+
return (0, import_path30.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.shutdown`);
|
|
3180
3398
|
}
|
|
3181
3399
|
function drainSignalPath(teamName, workerName) {
|
|
3182
|
-
return (0,
|
|
3400
|
+
return (0, import_path30.join)(teamsDir(teamName), "signals", `${sanitizeName(workerName)}.drain`);
|
|
3183
3401
|
}
|
|
3184
3402
|
function ensureDir(filePath) {
|
|
3185
|
-
const dir = (0,
|
|
3403
|
+
const dir = (0, import_path30.dirname)(filePath);
|
|
3186
3404
|
ensureDirWithMode(dir);
|
|
3187
3405
|
}
|
|
3188
3406
|
function appendOutbox(teamName, workerName, message) {
|
|
@@ -3192,32 +3410,32 @@ function appendOutbox(teamName, workerName, message) {
|
|
|
3192
3410
|
}
|
|
3193
3411
|
function rotateOutboxIfNeeded(teamName, workerName, maxLines) {
|
|
3194
3412
|
const filePath = outboxPath(teamName, workerName);
|
|
3195
|
-
if (!(0,
|
|
3413
|
+
if (!(0, import_fs28.existsSync)(filePath)) return;
|
|
3196
3414
|
try {
|
|
3197
|
-
const content = (0,
|
|
3415
|
+
const content = (0, import_fs28.readFileSync)(filePath, "utf-8");
|
|
3198
3416
|
const lines = content.split("\n").filter((l) => l.trim());
|
|
3199
3417
|
if (lines.length <= maxLines) return;
|
|
3200
3418
|
const keepCount = Math.floor(maxLines / 2);
|
|
3201
3419
|
const kept = keepCount === 0 ? [] : lines.slice(-keepCount);
|
|
3202
3420
|
const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
3203
3421
|
writeFileWithMode(tmpPath, kept.join("\n") + "\n");
|
|
3204
|
-
(0,
|
|
3422
|
+
(0, import_fs28.renameSync)(tmpPath, filePath);
|
|
3205
3423
|
} catch {
|
|
3206
3424
|
}
|
|
3207
3425
|
}
|
|
3208
3426
|
function rotateInboxIfNeeded(teamName, workerName, maxSizeBytes) {
|
|
3209
3427
|
const filePath = inboxPath(teamName, workerName);
|
|
3210
|
-
if (!(0,
|
|
3428
|
+
if (!(0, import_fs28.existsSync)(filePath)) return;
|
|
3211
3429
|
try {
|
|
3212
|
-
const stat = (0,
|
|
3430
|
+
const stat = (0, import_fs28.statSync)(filePath);
|
|
3213
3431
|
if (stat.size <= maxSizeBytes) return;
|
|
3214
|
-
const content = (0,
|
|
3432
|
+
const content = (0, import_fs28.readFileSync)(filePath, "utf-8");
|
|
3215
3433
|
const lines = content.split("\n").filter((l) => l.trim());
|
|
3216
3434
|
const keepCount = Math.max(1, Math.floor(lines.length / 2));
|
|
3217
3435
|
const kept = lines.slice(-keepCount);
|
|
3218
3436
|
const tmpPath = `${filePath}.tmp.${process.pid}.${Date.now()}`;
|
|
3219
3437
|
writeFileWithMode(tmpPath, kept.join("\n") + "\n");
|
|
3220
|
-
(0,
|
|
3438
|
+
(0, import_fs28.renameSync)(tmpPath, filePath);
|
|
3221
3439
|
const cursorFile = inboxCursorPath(teamName, workerName);
|
|
3222
3440
|
atomicWriteJson(cursorFile, { bytesRead: 0 });
|
|
3223
3441
|
} catch {
|
|
@@ -3226,16 +3444,16 @@ function rotateInboxIfNeeded(teamName, workerName, maxSizeBytes) {
|
|
|
3226
3444
|
function readNewInboxMessages(teamName, workerName) {
|
|
3227
3445
|
const inbox = inboxPath(teamName, workerName);
|
|
3228
3446
|
const cursorFile = inboxCursorPath(teamName, workerName);
|
|
3229
|
-
if (!(0,
|
|
3447
|
+
if (!(0, import_fs28.existsSync)(inbox)) return [];
|
|
3230
3448
|
let offset = 0;
|
|
3231
|
-
if ((0,
|
|
3449
|
+
if ((0, import_fs28.existsSync)(cursorFile)) {
|
|
3232
3450
|
try {
|
|
3233
|
-
const cursor = JSON.parse((0,
|
|
3451
|
+
const cursor = JSON.parse((0, import_fs28.readFileSync)(cursorFile, "utf-8"));
|
|
3234
3452
|
offset = cursor.bytesRead;
|
|
3235
3453
|
} catch {
|
|
3236
3454
|
}
|
|
3237
3455
|
}
|
|
3238
|
-
const stat = (0,
|
|
3456
|
+
const stat = (0, import_fs28.statSync)(inbox);
|
|
3239
3457
|
if (stat.size < offset) {
|
|
3240
3458
|
offset = 0;
|
|
3241
3459
|
}
|
|
@@ -3245,12 +3463,12 @@ function readNewInboxMessages(teamName, workerName) {
|
|
|
3245
3463
|
if (cappedSize < readSize) {
|
|
3246
3464
|
console.warn(`[inbox-outbox] Inbox for ${workerName} exceeds ${MAX_INBOX_READ_SIZE} bytes, reading truncated`);
|
|
3247
3465
|
}
|
|
3248
|
-
const fd = (0,
|
|
3466
|
+
const fd = (0, import_fs28.openSync)(inbox, "r");
|
|
3249
3467
|
const buffer = Buffer.alloc(cappedSize);
|
|
3250
3468
|
try {
|
|
3251
|
-
(0,
|
|
3469
|
+
(0, import_fs28.readSync)(fd, buffer, 0, buffer.length, offset);
|
|
3252
3470
|
} finally {
|
|
3253
|
-
(0,
|
|
3471
|
+
(0, import_fs28.closeSync)(fd);
|
|
3254
3472
|
}
|
|
3255
3473
|
const newData = buffer.toString("utf-8");
|
|
3256
3474
|
const lastNewlineIdx = newData.lastIndexOf("\n");
|
|
@@ -3287,9 +3505,9 @@ function readNewInboxMessages(teamName, workerName) {
|
|
|
3287
3505
|
}
|
|
3288
3506
|
function checkShutdownSignal(teamName, workerName) {
|
|
3289
3507
|
const filePath = signalPath(teamName, workerName);
|
|
3290
|
-
if (!(0,
|
|
3508
|
+
if (!(0, import_fs28.existsSync)(filePath)) return null;
|
|
3291
3509
|
try {
|
|
3292
|
-
const raw = (0,
|
|
3510
|
+
const raw = (0, import_fs28.readFileSync)(filePath, "utf-8");
|
|
3293
3511
|
return JSON.parse(raw);
|
|
3294
3512
|
} catch {
|
|
3295
3513
|
return null;
|
|
@@ -3297,18 +3515,18 @@ function checkShutdownSignal(teamName, workerName) {
|
|
|
3297
3515
|
}
|
|
3298
3516
|
function deleteShutdownSignal(teamName, workerName) {
|
|
3299
3517
|
const filePath = signalPath(teamName, workerName);
|
|
3300
|
-
if ((0,
|
|
3518
|
+
if ((0, import_fs28.existsSync)(filePath)) {
|
|
3301
3519
|
try {
|
|
3302
|
-
(0,
|
|
3520
|
+
(0, import_fs28.unlinkSync)(filePath);
|
|
3303
3521
|
} catch {
|
|
3304
3522
|
}
|
|
3305
3523
|
}
|
|
3306
3524
|
}
|
|
3307
3525
|
function checkDrainSignal(teamName, workerName) {
|
|
3308
3526
|
const filePath = drainSignalPath(teamName, workerName);
|
|
3309
|
-
if (!(0,
|
|
3527
|
+
if (!(0, import_fs28.existsSync)(filePath)) return null;
|
|
3310
3528
|
try {
|
|
3311
|
-
const raw = (0,
|
|
3529
|
+
const raw = (0, import_fs28.readFileSync)(filePath, "utf-8");
|
|
3312
3530
|
return JSON.parse(raw);
|
|
3313
3531
|
} catch {
|
|
3314
3532
|
return null;
|
|
@@ -3316,34 +3534,34 @@ function checkDrainSignal(teamName, workerName) {
|
|
|
3316
3534
|
}
|
|
3317
3535
|
function deleteDrainSignal(teamName, workerName) {
|
|
3318
3536
|
const filePath = drainSignalPath(teamName, workerName);
|
|
3319
|
-
if ((0,
|
|
3537
|
+
if ((0, import_fs28.existsSync)(filePath)) {
|
|
3320
3538
|
try {
|
|
3321
|
-
(0,
|
|
3539
|
+
(0, import_fs28.unlinkSync)(filePath);
|
|
3322
3540
|
} catch {
|
|
3323
3541
|
}
|
|
3324
3542
|
}
|
|
3325
3543
|
}
|
|
3326
3544
|
|
|
3327
3545
|
// src/team/team-registration.ts
|
|
3328
|
-
var
|
|
3329
|
-
var
|
|
3546
|
+
var import_fs29 = require("fs");
|
|
3547
|
+
var import_path31 = require("path");
|
|
3330
3548
|
init_config_dir();
|
|
3331
3549
|
init_worktree_paths();
|
|
3332
3550
|
function configPath(teamName) {
|
|
3333
|
-
const result = (0,
|
|
3334
|
-
validateResolvedPath(result, (0,
|
|
3551
|
+
const result = (0, import_path31.join)(getCopilotConfigDir(), "teams", sanitizeName(teamName), "config.json");
|
|
3552
|
+
validateResolvedPath(result, (0, import_path31.join)(getCopilotConfigDir(), "teams"));
|
|
3335
3553
|
return result;
|
|
3336
3554
|
}
|
|
3337
3555
|
function shadowRegistryPath(workingDirectory) {
|
|
3338
|
-
const result = (0,
|
|
3339
|
-
validateResolvedPath(result, (0,
|
|
3556
|
+
const result = (0, import_path31.join)(getOmcRoot(workingDirectory), "state", "team-mcp-workers.json");
|
|
3557
|
+
validateResolvedPath(result, (0, import_path31.join)(getOmcRoot(workingDirectory), "state"));
|
|
3340
3558
|
return result;
|
|
3341
3559
|
}
|
|
3342
3560
|
function unregisterMcpWorker(teamName, workerName, workingDirectory) {
|
|
3343
3561
|
const configFile = configPath(teamName);
|
|
3344
|
-
if ((0,
|
|
3562
|
+
if ((0, import_fs29.existsSync)(configFile)) {
|
|
3345
3563
|
try {
|
|
3346
|
-
const raw = (0,
|
|
3564
|
+
const raw = (0, import_fs29.readFileSync)(configFile, "utf-8");
|
|
3347
3565
|
const config = JSON.parse(raw);
|
|
3348
3566
|
const members = Array.isArray(config.members) ? config.members : [];
|
|
3349
3567
|
config.members = members.filter((m) => m.name !== workerName);
|
|
@@ -3354,9 +3572,9 @@ function unregisterMcpWorker(teamName, workerName, workingDirectory) {
|
|
|
3354
3572
|
const shadowFile = shadowRegistryPath(workingDirectory);
|
|
3355
3573
|
try {
|
|
3356
3574
|
withFileLockSync(shadowFile + ".lock", () => {
|
|
3357
|
-
if ((0,
|
|
3575
|
+
if ((0, import_fs29.existsSync)(shadowFile)) {
|
|
3358
3576
|
try {
|
|
3359
|
-
const registry = JSON.parse((0,
|
|
3577
|
+
const registry = JSON.parse((0, import_fs29.readFileSync)(shadowFile, "utf-8"));
|
|
3360
3578
|
registry.workers = (registry.workers || []).filter((w) => w.name !== workerName);
|
|
3361
3579
|
atomicWriteJson(shadowFile, registry);
|
|
3362
3580
|
} catch {
|
|
@@ -3372,9 +3590,9 @@ function isMcpWorker(member) {
|
|
|
3372
3590
|
function listMcpWorkers(teamName, workingDirectory) {
|
|
3373
3591
|
const workers = /* @__PURE__ */ new Map();
|
|
3374
3592
|
const configFile = configPath(teamName);
|
|
3375
|
-
if ((0,
|
|
3593
|
+
if ((0, import_fs29.existsSync)(configFile)) {
|
|
3376
3594
|
try {
|
|
3377
|
-
const raw = (0,
|
|
3595
|
+
const raw = (0, import_fs29.readFileSync)(configFile, "utf-8");
|
|
3378
3596
|
const config = JSON.parse(raw);
|
|
3379
3597
|
const members = Array.isArray(config.members) ? config.members : [];
|
|
3380
3598
|
for (const m of members) {
|
|
@@ -3386,9 +3604,9 @@ function listMcpWorkers(teamName, workingDirectory) {
|
|
|
3386
3604
|
}
|
|
3387
3605
|
}
|
|
3388
3606
|
const shadowFile = shadowRegistryPath(workingDirectory);
|
|
3389
|
-
if ((0,
|
|
3607
|
+
if ((0, import_fs29.existsSync)(shadowFile)) {
|
|
3390
3608
|
try {
|
|
3391
|
-
const registry = JSON.parse((0,
|
|
3609
|
+
const registry = JSON.parse((0, import_fs29.readFileSync)(shadowFile, "utf-8"));
|
|
3392
3610
|
for (const w of registry.workers || []) {
|
|
3393
3611
|
workers.set(w.name, w);
|
|
3394
3612
|
}
|
|
@@ -3399,11 +3617,11 @@ function listMcpWorkers(teamName, workingDirectory) {
|
|
|
3399
3617
|
}
|
|
3400
3618
|
|
|
3401
3619
|
// src/team/heartbeat.ts
|
|
3402
|
-
var
|
|
3403
|
-
var
|
|
3620
|
+
var import_fs30 = require("fs");
|
|
3621
|
+
var import_path32 = require("path");
|
|
3404
3622
|
init_worktree_paths();
|
|
3405
3623
|
function heartbeatPath(workingDirectory, teamName, workerName) {
|
|
3406
|
-
return (0,
|
|
3624
|
+
return (0, import_path32.join)(getOmcRoot(workingDirectory), "state", "team-bridge", sanitizeName(teamName), `${sanitizeName(workerName)}.heartbeat.json`);
|
|
3407
3625
|
}
|
|
3408
3626
|
function writeHeartbeat(workingDirectory, data) {
|
|
3409
3627
|
const filePath = heartbeatPath(workingDirectory, data.teamName, data.workerName);
|
|
@@ -3411,9 +3629,9 @@ function writeHeartbeat(workingDirectory, data) {
|
|
|
3411
3629
|
}
|
|
3412
3630
|
function readHeartbeat(workingDirectory, teamName, workerName) {
|
|
3413
3631
|
const filePath = heartbeatPath(workingDirectory, teamName, workerName);
|
|
3414
|
-
if (!(0,
|
|
3632
|
+
if (!(0, import_fs30.existsSync)(filePath)) return null;
|
|
3415
3633
|
try {
|
|
3416
|
-
const raw = (0,
|
|
3634
|
+
const raw = (0, import_fs30.readFileSync)(filePath, "utf-8");
|
|
3417
3635
|
return JSON.parse(raw);
|
|
3418
3636
|
} catch {
|
|
3419
3637
|
return null;
|
|
@@ -3432,9 +3650,9 @@ function isWorkerAlive(workingDirectory, teamName, workerName, maxAgeMs) {
|
|
|
3432
3650
|
}
|
|
3433
3651
|
function deleteHeartbeat(workingDirectory, teamName, workerName) {
|
|
3434
3652
|
const filePath = heartbeatPath(workingDirectory, teamName, workerName);
|
|
3435
|
-
if ((0,
|
|
3653
|
+
if ((0, import_fs30.existsSync)(filePath)) {
|
|
3436
3654
|
try {
|
|
3437
|
-
(0,
|
|
3655
|
+
(0, import_fs30.unlinkSync)(filePath);
|
|
3438
3656
|
} catch {
|
|
3439
3657
|
}
|
|
3440
3658
|
}
|
|
@@ -3590,28 +3808,28 @@ function findPermissionViolations(changedPaths, permissions, cwd) {
|
|
|
3590
3808
|
}
|
|
3591
3809
|
|
|
3592
3810
|
// src/agents/prompt-helpers.ts
|
|
3593
|
-
var
|
|
3594
|
-
var
|
|
3595
|
-
var
|
|
3811
|
+
var import_fs31 = require("fs");
|
|
3812
|
+
var import_path33 = require("path");
|
|
3813
|
+
var import_url5 = require("url");
|
|
3596
3814
|
function getPackageDir3() {
|
|
3597
3815
|
if (typeof __dirname !== "undefined" && __dirname) {
|
|
3598
|
-
const currentDirName = (0,
|
|
3599
|
-
const parentDirName = (0,
|
|
3816
|
+
const currentDirName = (0, import_path33.basename)(__dirname);
|
|
3817
|
+
const parentDirName = (0, import_path33.basename)((0, import_path33.dirname)(__dirname));
|
|
3600
3818
|
if (currentDirName === "bridge") {
|
|
3601
|
-
return (0,
|
|
3819
|
+
return (0, import_path33.join)(__dirname, "..");
|
|
3602
3820
|
}
|
|
3603
3821
|
if (currentDirName === "agents" && (parentDirName === "src" || parentDirName === "dist")) {
|
|
3604
|
-
return (0,
|
|
3822
|
+
return (0, import_path33.join)(__dirname, "..", "..");
|
|
3605
3823
|
}
|
|
3606
3824
|
}
|
|
3607
3825
|
try {
|
|
3608
|
-
const __filename = (0,
|
|
3609
|
-
const __dirname2 = (0,
|
|
3610
|
-
const currentDirName = (0,
|
|
3826
|
+
const __filename = (0, import_url5.fileURLToPath)(importMetaUrl);
|
|
3827
|
+
const __dirname2 = (0, import_path33.dirname)(__filename);
|
|
3828
|
+
const currentDirName = (0, import_path33.basename)(__dirname2);
|
|
3611
3829
|
if (currentDirName === "bridge") {
|
|
3612
|
-
return (0,
|
|
3830
|
+
return (0, import_path33.join)(__dirname2, "..");
|
|
3613
3831
|
}
|
|
3614
|
-
return (0,
|
|
3832
|
+
return (0, import_path33.join)(__dirname2, "..", "..");
|
|
3615
3833
|
} catch {
|
|
3616
3834
|
}
|
|
3617
3835
|
return process.cwd();
|
|
@@ -3627,9 +3845,9 @@ function getValidAgentRoles() {
|
|
|
3627
3845
|
} catch {
|
|
3628
3846
|
}
|
|
3629
3847
|
try {
|
|
3630
|
-
const agentsDir = (0,
|
|
3631
|
-
const files = (0,
|
|
3632
|
-
_cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0,
|
|
3848
|
+
const agentsDir = (0, import_path33.join)(getPackageDir3(), "agents");
|
|
3849
|
+
const files = (0, import_fs31.readdirSync)(agentsDir);
|
|
3850
|
+
_cachedRoles = files.filter((f) => f.endsWith(".md")).map((f) => (0, import_path33.basename)(f, ".md")).sort();
|
|
3633
3851
|
} catch (err) {
|
|
3634
3852
|
console.error("[prompt-injection] CRITICAL: Could not scan agents/ directory for role discovery:", err);
|
|
3635
3853
|
_cachedRoles = [];
|
|
@@ -3651,8 +3869,8 @@ function sanitizePromptContent(content, maxLength = 4e3) {
|
|
|
3651
3869
|
}
|
|
3652
3870
|
|
|
3653
3871
|
// src/team/team-status.ts
|
|
3654
|
-
var
|
|
3655
|
-
var
|
|
3872
|
+
var import_fs32 = require("fs");
|
|
3873
|
+
var import_path34 = require("path");
|
|
3656
3874
|
init_config_dir();
|
|
3657
3875
|
|
|
3658
3876
|
// node_modules/zod/v3/external.js
|
|
@@ -7860,10 +8078,10 @@ function emptyUsageReport(teamName) {
|
|
|
7860
8078
|
function peekRecentOutboxMessages(teamName, workerName, maxMessages = 10) {
|
|
7861
8079
|
const safeName = sanitizeName(teamName);
|
|
7862
8080
|
const safeWorker = sanitizeName(workerName);
|
|
7863
|
-
const outboxPath2 = (0,
|
|
7864
|
-
if (!(0,
|
|
8081
|
+
const outboxPath2 = (0, import_path34.join)(getCopilotConfigDir(), "teams", safeName, "outbox", `${safeWorker}.jsonl`);
|
|
8082
|
+
if (!(0, import_fs32.existsSync)(outboxPath2)) return [];
|
|
7865
8083
|
try {
|
|
7866
|
-
const content = (0,
|
|
8084
|
+
const content = (0, import_fs32.readFileSync)(outboxPath2, "utf-8");
|
|
7867
8085
|
const lines = content.split("\n").filter((l) => l.trim());
|
|
7868
8086
|
const recentLines = lines.slice(-maxMessages);
|
|
7869
8087
|
const messages = [];
|
|
@@ -7968,7 +8186,7 @@ function audit(config, eventType, taskId, details) {
|
|
|
7968
8186
|
}
|
|
7969
8187
|
}
|
|
7970
8188
|
function sleep(ms) {
|
|
7971
|
-
return new Promise((
|
|
8189
|
+
return new Promise((resolve11) => setTimeout(resolve11, ms));
|
|
7972
8190
|
}
|
|
7973
8191
|
function captureFileSnapshot(cwd) {
|
|
7974
8192
|
const files = /* @__PURE__ */ new Set();
|
|
@@ -8136,29 +8354,29 @@ function buildTaskPrompt(task, messages, config) {
|
|
|
8136
8354
|
return result;
|
|
8137
8355
|
}
|
|
8138
8356
|
function writePromptFile(config, taskId, prompt) {
|
|
8139
|
-
const dir = (0,
|
|
8357
|
+
const dir = (0, import_path35.join)(getOmcRoot(config.workingDirectory), "prompts");
|
|
8140
8358
|
ensureDirWithMode(dir);
|
|
8141
8359
|
const filename = `team-${config.teamName}-task-${taskId}-${Date.now()}.md`;
|
|
8142
|
-
const filePath = (0,
|
|
8360
|
+
const filePath = (0, import_path35.join)(dir, filename);
|
|
8143
8361
|
writeFileWithMode(filePath, prompt);
|
|
8144
8362
|
return filePath;
|
|
8145
8363
|
}
|
|
8146
8364
|
function getOutputPath(config, taskId) {
|
|
8147
|
-
const dir = (0,
|
|
8365
|
+
const dir = (0, import_path35.join)(getOmcRoot(config.workingDirectory), "outputs");
|
|
8148
8366
|
ensureDirWithMode(dir);
|
|
8149
8367
|
const suffix = Math.random().toString(36).slice(2, 8);
|
|
8150
|
-
return (0,
|
|
8368
|
+
return (0, import_path35.join)(
|
|
8151
8369
|
dir,
|
|
8152
8370
|
`team-${config.teamName}-task-${taskId}-${Date.now()}-${suffix}.md`
|
|
8153
8371
|
);
|
|
8154
8372
|
}
|
|
8155
8373
|
function readOutputSummary(outputFile) {
|
|
8156
8374
|
try {
|
|
8157
|
-
if (!(0,
|
|
8375
|
+
if (!(0, import_fs33.existsSync)(outputFile)) return "(no output file)";
|
|
8158
8376
|
const buf = Buffer.alloc(1024);
|
|
8159
|
-
const fd = (0,
|
|
8377
|
+
const fd = (0, import_fs33.openSync)(outputFile, "r");
|
|
8160
8378
|
try {
|
|
8161
|
-
const bytesRead = (0,
|
|
8379
|
+
const bytesRead = (0, import_fs33.readSync)(fd, buf, 0, 1024, 0);
|
|
8162
8380
|
if (bytesRead === 0) return "(empty output)";
|
|
8163
8381
|
const content = buf.toString("utf-8", 0, bytesRead);
|
|
8164
8382
|
if (content.length > 500) {
|
|
@@ -8166,7 +8384,7 @@ function readOutputSummary(outputFile) {
|
|
|
8166
8384
|
}
|
|
8167
8385
|
return content;
|
|
8168
8386
|
} finally {
|
|
8169
|
-
(0,
|
|
8387
|
+
(0, import_fs33.closeSync)(fd);
|
|
8170
8388
|
}
|
|
8171
8389
|
} catch {
|
|
8172
8390
|
return "(error reading output)";
|
|
@@ -8253,7 +8471,7 @@ function spawnCliProcess(provider, prompt, model, cwd, timeoutMs) {
|
|
|
8253
8471
|
stdio: ["pipe", "pipe", "pipe"],
|
|
8254
8472
|
cwd
|
|
8255
8473
|
});
|
|
8256
|
-
const result = new Promise((
|
|
8474
|
+
const result = new Promise((resolve11, reject) => {
|
|
8257
8475
|
let stdout = "";
|
|
8258
8476
|
let stderr = "";
|
|
8259
8477
|
let settled = false;
|
|
@@ -8276,7 +8494,7 @@ function spawnCliProcess(provider, prompt, model, cwd, timeoutMs) {
|
|
|
8276
8494
|
clearTimeout(timeoutHandle);
|
|
8277
8495
|
if (code === 0) {
|
|
8278
8496
|
const response = provider === "codex" ? parseCodexOutput(stdout) : stdout.trim();
|
|
8279
|
-
|
|
8497
|
+
resolve11(response);
|
|
8280
8498
|
} else {
|
|
8281
8499
|
const detail = stderr || stdout.trim() || "No output";
|
|
8282
8500
|
reject(new Error(`CLI exited with code ${code}: ${detail}`));
|
|
@@ -8313,7 +8531,7 @@ async function handleShutdown(config, signal, activeChild) {
|
|
|
8313
8531
|
});
|
|
8314
8532
|
activeChild.kill("SIGTERM");
|
|
8315
8533
|
await Promise.race([
|
|
8316
|
-
new Promise((
|
|
8534
|
+
new Promise((resolve11) => activeChild.on("close", () => resolve11())),
|
|
8317
8535
|
sleep(5e3)
|
|
8318
8536
|
]);
|
|
8319
8537
|
if (!closed) {
|
|
@@ -8722,16 +8940,16 @@ ${violationSummary}`
|
|
|
8722
8940
|
init_worktree_paths();
|
|
8723
8941
|
init_config_dir();
|
|
8724
8942
|
function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
|
|
8725
|
-
const resolved = (0,
|
|
8726
|
-
const normalizedHome = (0,
|
|
8943
|
+
const resolved = (0, import_path36.resolve)(configPath2);
|
|
8944
|
+
const normalizedHome = (0, import_path36.resolve)(homeDir);
|
|
8727
8945
|
const isUnderHome = isAtOrUnder(normalizedHome, resolved);
|
|
8728
|
-
const normalizedConfigDir = (0,
|
|
8729
|
-
const normalizedOmcDir = (0,
|
|
8946
|
+
const normalizedConfigDir = (0, import_path36.resolve)(claudeConfigDir);
|
|
8947
|
+
const normalizedOmcDir = (0, import_path36.resolve)(homeDir, ".omg");
|
|
8730
8948
|
const isTrustedSubpath = isAtOrUnder(normalizedConfigDir, resolved) || isAtOrUnder(normalizedOmcDir, resolved) || hasOmcPathSegment(resolved);
|
|
8731
8949
|
if (!isUnderHome || !isTrustedSubpath) return false;
|
|
8732
8950
|
try {
|
|
8733
|
-
const parentDir = (0,
|
|
8734
|
-
const realParent = (0,
|
|
8951
|
+
const parentDir = (0, import_path36.resolve)(resolved, "..");
|
|
8952
|
+
const realParent = (0, import_fs34.realpathSync)(parentDir);
|
|
8735
8953
|
if (!isAtOrUnder(normalizedHome, realParent)) {
|
|
8736
8954
|
return false;
|
|
8737
8955
|
}
|
|
@@ -8740,9 +8958,9 @@ function validateConfigPath(configPath2, homeDir, claudeConfigDir) {
|
|
|
8740
8958
|
return true;
|
|
8741
8959
|
}
|
|
8742
8960
|
function isAtOrUnder(parent, child) {
|
|
8743
|
-
const rel = (0,
|
|
8961
|
+
const rel = (0, import_path36.relative)(parent, child);
|
|
8744
8962
|
if (rel === "") return true;
|
|
8745
|
-
return !rel.startsWith("..") && !(0,
|
|
8963
|
+
return !rel.startsWith("..") && !(0, import_path36.isAbsolute)(rel);
|
|
8746
8964
|
}
|
|
8747
8965
|
function hasOmcPathSegment(absolutePath) {
|
|
8748
8966
|
return absolutePath.split(/[\\/]/).includes(".omg");
|
|
@@ -8750,15 +8968,15 @@ function hasOmcPathSegment(absolutePath) {
|
|
|
8750
8968
|
function validateBridgeWorkingDirectory(workingDirectory) {
|
|
8751
8969
|
let stat;
|
|
8752
8970
|
try {
|
|
8753
|
-
stat = (0,
|
|
8971
|
+
stat = (0, import_fs34.statSync)(workingDirectory);
|
|
8754
8972
|
} catch {
|
|
8755
8973
|
throw new Error(`workingDirectory does not exist: ${workingDirectory}`);
|
|
8756
8974
|
}
|
|
8757
8975
|
if (!stat.isDirectory()) {
|
|
8758
8976
|
throw new Error(`workingDirectory is not a directory: ${workingDirectory}`);
|
|
8759
8977
|
}
|
|
8760
|
-
const resolved = (0,
|
|
8761
|
-
const home = (0,
|
|
8978
|
+
const resolved = (0, import_fs34.realpathSync)(workingDirectory);
|
|
8979
|
+
const home = (0, import_path36.resolve)((0, import_os8.homedir)());
|
|
8762
8980
|
if (!isAtOrUnder(home, resolved)) {
|
|
8763
8981
|
throw new Error(`workingDirectory is outside home directory: ${resolved}`);
|
|
8764
8982
|
}
|
|
@@ -8773,7 +8991,7 @@ function main() {
|
|
|
8773
8991
|
console.error("Usage: node bridge-entry.js --config <path-to-config.json>");
|
|
8774
8992
|
process.exit(1);
|
|
8775
8993
|
}
|
|
8776
|
-
const configPath2 = (0,
|
|
8994
|
+
const configPath2 = (0, import_path36.resolve)(process.argv[configIdx + 1]);
|
|
8777
8995
|
const home = (0, import_os8.homedir)();
|
|
8778
8996
|
const claudeConfigDir = getCopilotConfigDir();
|
|
8779
8997
|
if (!validateConfigPath(configPath2, home, claudeConfigDir)) {
|
|
@@ -8782,7 +9000,7 @@ function main() {
|
|
|
8782
9000
|
}
|
|
8783
9001
|
let config;
|
|
8784
9002
|
try {
|
|
8785
|
-
const raw = (0,
|
|
9003
|
+
const raw = (0, import_fs34.readFileSync)(configPath2, "utf-8");
|
|
8786
9004
|
config = JSON.parse(raw);
|
|
8787
9005
|
} catch (err) {
|
|
8788
9006
|
console.error(`Failed to read config from ${configPath2}: ${err.message}`);
|