@pythonluvr/openwar 0.4.0
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/LICENSE +21 -0
- package/README.md +297 -0
- package/bin/openwar +45 -0
- package/dist/adapters/anthropic.d.ts +15 -0
- package/dist/adapters/anthropic.d.ts.map +1 -0
- package/dist/adapters/anthropic.js +179 -0
- package/dist/adapters/anthropic.js.map +1 -0
- package/dist/adapters/gemini.d.ts +15 -0
- package/dist/adapters/gemini.d.ts.map +1 -0
- package/dist/adapters/gemini.js +141 -0
- package/dist/adapters/gemini.js.map +1 -0
- package/dist/adapters/grok.d.ts +6 -0
- package/dist/adapters/grok.d.ts.map +1 -0
- package/dist/adapters/grok.js +15 -0
- package/dist/adapters/grok.js.map +1 -0
- package/dist/adapters/index.d.ts +16 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/index.js +35 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/adapters/mock.d.ts +17 -0
- package/dist/adapters/mock.d.ts.map +1 -0
- package/dist/adapters/mock.js +33 -0
- package/dist/adapters/mock.js.map +1 -0
- package/dist/adapters/openai-compat.d.ts +6 -0
- package/dist/adapters/openai-compat.d.ts.map +1 -0
- package/dist/adapters/openai-compat.js +19 -0
- package/dist/adapters/openai-compat.js.map +1 -0
- package/dist/adapters/openai.d.ts +23 -0
- package/dist/adapters/openai.d.ts.map +1 -0
- package/dist/adapters/openai.js +176 -0
- package/dist/adapters/openai.js.map +1 -0
- package/dist/adapters/sse.d.ts +6 -0
- package/dist/adapters/sse.d.ts.map +1 -0
- package/dist/adapters/sse.js +45 -0
- package/dist/adapters/sse.js.map +1 -0
- package/dist/adapters/types.d.ts +7 -0
- package/dist/adapters/types.d.ts.map +1 -0
- package/dist/adapters/types.js +2 -0
- package/dist/adapters/types.js.map +1 -0
- package/dist/auth/categories.d.ts +13 -0
- package/dist/auth/categories.d.ts.map +1 -0
- package/dist/auth/categories.js +47 -0
- package/dist/auth/categories.js.map +1 -0
- package/dist/auth/check.d.ts +31 -0
- package/dist/auth/check.d.ts.map +1 -0
- package/dist/auth/check.js +59 -0
- package/dist/auth/check.js.map +1 -0
- package/dist/auth/role-scope.d.ts +18 -0
- package/dist/auth/role-scope.d.ts.map +1 -0
- package/dist/auth/role-scope.js +62 -0
- package/dist/auth/role-scope.js.map +1 -0
- package/dist/auth/wildcards.d.ts +5 -0
- package/dist/auth/wildcards.d.ts.map +1 -0
- package/dist/auth/wildcards.js +36 -0
- package/dist/auth/wildcards.js.map +1 -0
- package/dist/brief.d.ts +9 -0
- package/dist/brief.d.ts.map +1 -0
- package/dist/brief.js +514 -0
- package/dist/brief.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +585 -0
- package/dist/cli.js.map +1 -0
- package/dist/coordinator/cost-tracker.d.ts +14 -0
- package/dist/coordinator/cost-tracker.d.ts.map +1 -0
- package/dist/coordinator/cost-tracker.js +63 -0
- package/dist/coordinator/cost-tracker.js.map +1 -0
- package/dist/coordinator/driver.d.ts +37 -0
- package/dist/coordinator/driver.d.ts.map +1 -0
- package/dist/coordinator/driver.js +644 -0
- package/dist/coordinator/driver.js.map +1 -0
- package/dist/coordinator/index.d.ts +14 -0
- package/dist/coordinator/index.d.ts.map +1 -0
- package/dist/coordinator/index.js +8 -0
- package/dist/coordinator/index.js.map +1 -0
- package/dist/coordinator/plan-parser.d.ts +17 -0
- package/dist/coordinator/plan-parser.d.ts.map +1 -0
- package/dist/coordinator/plan-parser.js +44 -0
- package/dist/coordinator/plan-parser.js.map +1 -0
- package/dist/coordinator/result-aggregator.d.ts +21 -0
- package/dist/coordinator/result-aggregator.d.ts.map +1 -0
- package/dist/coordinator/result-aggregator.js +58 -0
- package/dist/coordinator/result-aggregator.js.map +1 -0
- package/dist/coordinator/retry-policy.d.ts +7 -0
- package/dist/coordinator/retry-policy.d.ts.map +1 -0
- package/dist/coordinator/retry-policy.js +17 -0
- package/dist/coordinator/retry-policy.js.map +1 -0
- package/dist/coordinator/state-machine.d.ts +63 -0
- package/dist/coordinator/state-machine.d.ts.map +1 -0
- package/dist/coordinator/state-machine.js +242 -0
- package/dist/coordinator/state-machine.js.map +1 -0
- package/dist/coordinator/types.d.ts +3 -0
- package/dist/coordinator/types.d.ts.map +1 -0
- package/dist/coordinator/types.js +5 -0
- package/dist/coordinator/types.js.map +1 -0
- package/dist/detectors/banned-phrases.d.ts +3 -0
- package/dist/detectors/banned-phrases.d.ts.map +1 -0
- package/dist/detectors/banned-phrases.js +33 -0
- package/dist/detectors/banned-phrases.js.map +1 -0
- package/dist/detectors/blocker.d.ts +3 -0
- package/dist/detectors/blocker.d.ts.map +1 -0
- package/dist/detectors/blocker.js +62 -0
- package/dist/detectors/blocker.js.map +1 -0
- package/dist/detectors/completion.d.ts +3 -0
- package/dist/detectors/completion.d.ts.map +1 -0
- package/dist/detectors/completion.js +17 -0
- package/dist/detectors/completion.js.map +1 -0
- package/dist/detectors/confirmation-summary.d.ts +3 -0
- package/dist/detectors/confirmation-summary.d.ts.map +1 -0
- package/dist/detectors/confirmation-summary.js +76 -0
- package/dist/detectors/confirmation-summary.js.map +1 -0
- package/dist/detectors/destructive.d.ts +3 -0
- package/dist/detectors/destructive.d.ts.map +1 -0
- package/dist/detectors/destructive.js +96 -0
- package/dist/detectors/destructive.js.map +1 -0
- package/dist/detectors/index.d.ts +12 -0
- package/dist/detectors/index.d.ts.map +1 -0
- package/dist/detectors/index.js +19 -0
- package/dist/detectors/index.js.map +1 -0
- package/dist/detectors/phase-marker.d.ts +3 -0
- package/dist/detectors/phase-marker.d.ts.map +1 -0
- package/dist/detectors/phase-marker.js +25 -0
- package/dist/detectors/phase-marker.js.map +1 -0
- package/dist/framework.d.ts +2 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/framework.js +34 -0
- package/dist/framework.js.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/io.d.ts +25 -0
- package/dist/io.d.ts.map +1 -0
- package/dist/io.js +83 -0
- package/dist/io.js.map +1 -0
- package/dist/mcp/client.d.ts +22 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +44 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/index.d.ts +5 -0
- package/dist/mcp/index.d.ts.map +1 -0
- package/dist/mcp/index.js +6 -0
- package/dist/mcp/index.js.map +1 -0
- package/dist/mcp/registry.d.ts +16 -0
- package/dist/mcp/registry.d.ts.map +1 -0
- package/dist/mcp/registry.js +53 -0
- package/dist/mcp/registry.js.map +1 -0
- package/dist/mcp/transport-stdio.d.ts +26 -0
- package/dist/mcp/transport-stdio.d.ts.map +1 -0
- package/dist/mcp/transport-stdio.js +138 -0
- package/dist/mcp/transport-stdio.js.map +1 -0
- package/dist/mcp/types.d.ts +90 -0
- package/dist/mcp/types.d.ts.map +1 -0
- package/dist/mcp/types.js +23 -0
- package/dist/mcp/types.js.map +1 -0
- package/dist/orchestration/handoff.d.ts +27 -0
- package/dist/orchestration/handoff.d.ts.map +1 -0
- package/dist/orchestration/handoff.js +322 -0
- package/dist/orchestration/handoff.js.map +1 -0
- package/dist/phases/blocker.d.ts +8 -0
- package/dist/phases/blocker.d.ts.map +1 -0
- package/dist/phases/blocker.js +11 -0
- package/dist/phases/blocker.js.map +1 -0
- package/dist/phases/completion.d.ts +10 -0
- package/dist/phases/completion.d.ts.map +1 -0
- package/dist/phases/completion.js +47 -0
- package/dist/phases/completion.js.map +1 -0
- package/dist/phases/destructive.d.ts +10 -0
- package/dist/phases/destructive.d.ts.map +1 -0
- package/dist/phases/destructive.js +31 -0
- package/dist/phases/destructive.js.map +1 -0
- package/dist/phases/execute.d.ts +30 -0
- package/dist/phases/execute.d.ts.map +1 -0
- package/dist/phases/execute.js +222 -0
- package/dist/phases/execute.js.map +1 -0
- package/dist/phases/intake.d.ts +16 -0
- package/dist/phases/intake.d.ts.map +1 -0
- package/dist/phases/intake.js +105 -0
- package/dist/phases/intake.js.map +1 -0
- package/dist/roles/critic.d.ts +3 -0
- package/dist/roles/critic.d.ts.map +1 -0
- package/dist/roles/critic.js +35 -0
- package/dist/roles/critic.js.map +1 -0
- package/dist/roles/executor.d.ts +3 -0
- package/dist/roles/executor.d.ts.map +1 -0
- package/dist/roles/executor.js +46 -0
- package/dist/roles/executor.js.map +1 -0
- package/dist/roles/index.d.ts +8 -0
- package/dist/roles/index.d.ts.map +1 -0
- package/dist/roles/index.js +8 -0
- package/dist/roles/index.js.map +1 -0
- package/dist/roles/planner.d.ts +3 -0
- package/dist/roles/planner.d.ts.map +1 -0
- package/dist/roles/planner.js +50 -0
- package/dist/roles/planner.js.map +1 -0
- package/dist/roles/prompt-overlay.d.ts +9 -0
- package/dist/roles/prompt-overlay.d.ts.map +1 -0
- package/dist/roles/prompt-overlay.js +25 -0
- package/dist/roles/prompt-overlay.js.map +1 -0
- package/dist/roles/registry.d.ts +8 -0
- package/dist/roles/registry.d.ts.map +1 -0
- package/dist/roles/registry.js +45 -0
- package/dist/roles/registry.js.map +1 -0
- package/dist/roles/reviewer.d.ts +3 -0
- package/dist/roles/reviewer.d.ts.map +1 -0
- package/dist/roles/reviewer.js +46 -0
- package/dist/roles/reviewer.js.map +1 -0
- package/dist/roles/types.d.ts +2 -0
- package/dist/roles/types.d.ts.map +1 -0
- package/dist/roles/types.js +4 -0
- package/dist/roles/types.js.map +1 -0
- package/dist/runner.d.ts +3 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +473 -0
- package/dist/runner.js.map +1 -0
- package/dist/sandbox/host-allowlist.d.ts +13 -0
- package/dist/sandbox/host-allowlist.d.ts.map +1 -0
- package/dist/sandbox/host-allowlist.js +85 -0
- package/dist/sandbox/host-allowlist.js.map +1 -0
- package/dist/sandbox/output-cap.d.ts +9 -0
- package/dist/sandbox/output-cap.d.ts.map +1 -0
- package/dist/sandbox/output-cap.js +66 -0
- package/dist/sandbox/output-cap.js.map +1 -0
- package/dist/sandbox/timeout.d.ts +7 -0
- package/dist/sandbox/timeout.d.ts.map +1 -0
- package/dist/sandbox/timeout.js +52 -0
- package/dist/sandbox/timeout.js.map +1 -0
- package/dist/sandbox/types.d.ts +18 -0
- package/dist/sandbox/types.d.ts.map +1 -0
- package/dist/sandbox/types.js +27 -0
- package/dist/sandbox/types.js.map +1 -0
- package/dist/sandbox/workdir.d.ts +9 -0
- package/dist/sandbox/workdir.d.ts.map +1 -0
- package/dist/sandbox/workdir.js +83 -0
- package/dist/sandbox/workdir.js.map +1 -0
- package/dist/state/index.d.ts +4 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +4 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/paths.d.ts +5 -0
- package/dist/state/paths.d.ts.map +1 -0
- package/dist/state/paths.js +18 -0
- package/dist/state/paths.js.map +1 -0
- package/dist/state/persist.d.ts +14 -0
- package/dist/state/persist.d.ts.map +1 -0
- package/dist/state/persist.js +146 -0
- package/dist/state/persist.js.map +1 -0
- package/dist/state/transcript.d.ts +9 -0
- package/dist/state/transcript.d.ts.map +1 -0
- package/dist/state/transcript.js +34 -0
- package/dist/state/transcript.js.map +1 -0
- package/dist/tools/native/apply_patch.d.ts +18 -0
- package/dist/tools/native/apply_patch.d.ts.map +1 -0
- package/dist/tools/native/apply_patch.js +245 -0
- package/dist/tools/native/apply_patch.js.map +1 -0
- package/dist/tools/native/http_fetch.d.ts +6 -0
- package/dist/tools/native/http_fetch.d.ts.map +1 -0
- package/dist/tools/native/http_fetch.js +168 -0
- package/dist/tools/native/http_fetch.js.map +1 -0
- package/dist/tools/native/index.d.ts +9 -0
- package/dist/tools/native/index.d.ts.map +1 -0
- package/dist/tools/native/index.js +22 -0
- package/dist/tools/native/index.js.map +1 -0
- package/dist/tools/native/list_dir.d.ts +4 -0
- package/dist/tools/native/list_dir.d.ts.map +1 -0
- package/dist/tools/native/list_dir.js +175 -0
- package/dist/tools/native/list_dir.js.map +1 -0
- package/dist/tools/native/read_file.d.ts +4 -0
- package/dist/tools/native/read_file.d.ts.map +1 -0
- package/dist/tools/native/read_file.js +91 -0
- package/dist/tools/native/read_file.js.map +1 -0
- package/dist/tools/native/shell_exec.d.ts +4 -0
- package/dist/tools/native/shell_exec.d.ts.map +1 -0
- package/dist/tools/native/shell_exec.js +180 -0
- package/dist/tools/native/shell_exec.js.map +1 -0
- package/dist/tools/native/write_file.d.ts +4 -0
- package/dist/tools/native/write_file.d.ts.map +1 -0
- package/dist/tools/native/write_file.js +101 -0
- package/dist/tools/native/write_file.js.map +1 -0
- package/dist/tools/types.d.ts +48 -0
- package/dist/tools/types.d.ts.map +1 -0
- package/dist/tools/types.js +10 -0
- package/dist/tools/types.js.map +1 -0
- package/dist/types.d.ts +385 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +9 -0
- package/dist/types.js.map +1 -0
- package/examples/README.md +73 -0
- package/examples/creative-brief.md +34 -0
- package/examples/critic-disagreement-brief.md +42 -0
- package/examples/engineering-brief.md +35 -0
- package/examples/file-editing-brief.md +33 -0
- package/examples/mcp-brief.md +34 -0
- package/examples/multi-agent-brief.md +43 -0
- package/examples/research-brief.md +35 -0
- package/openwar.md +248 -0
- package/package.json +76 -0
- package/templates/brief.md +62 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/coordinator/types.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAC3E,yDAAyD;AAuBzD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banned-phrases.d.ts","sourceRoot":"","sources":["../../src/detectors/banned-phrases.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAoBzD,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,CAYzE"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// Surfaces voice-rule violations from the framework as soft warnings.
|
|
2
|
+
// Counts occurrences case-insensitively. Skips matches inside fenced code
|
|
3
|
+
// blocks so users discussing the rule itself don't trigger it.
|
|
4
|
+
const BANNED = [
|
|
5
|
+
/\bcertainly\b/gi,
|
|
6
|
+
/\babsolutely\b/gi,
|
|
7
|
+
/\bgreat question\b/gi,
|
|
8
|
+
/\bof course\b/gi,
|
|
9
|
+
/\bi(?:'d| would) be happy to\b/gi,
|
|
10
|
+
/\bas an ai\b/gi,
|
|
11
|
+
/\bit(?:'s| is) important to note\b/gi,
|
|
12
|
+
/\bfeel free to\b/gi,
|
|
13
|
+
/\bleverage\b/gi,
|
|
14
|
+
/\butilize\b/gi,
|
|
15
|
+
/\bfacilitate\b/gi,
|
|
16
|
+
];
|
|
17
|
+
export function detectBannedPhrases(output) {
|
|
18
|
+
const stripped = stripCodeFences(output);
|
|
19
|
+
const hits = [];
|
|
20
|
+
let count = 0;
|
|
21
|
+
for (const re of BANNED) {
|
|
22
|
+
const matches = stripped.match(re);
|
|
23
|
+
if (matches) {
|
|
24
|
+
count += matches.length;
|
|
25
|
+
hits.push(...matches.map((m) => m.toLowerCase()));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return { count, phrases: Array.from(new Set(hits)) };
|
|
29
|
+
}
|
|
30
|
+
function stripCodeFences(text) {
|
|
31
|
+
return text.replace(/```[\s\S]*?```/g, "").replace(/`[^`\n]*`/g, "");
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=banned-phrases.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banned-phrases.js","sourceRoot":"","sources":["../../src/detectors/banned-phrases.ts"],"names":[],"mappings":"AAEA,sEAAsE;AACtE,0EAA0E;AAC1E,+DAA+D;AAE/D,MAAM,MAAM,GAAa;IACvB,iBAAiB;IACjB,kBAAkB;IAClB,sBAAsB;IACtB,iBAAiB;IACjB,kCAAkC;IAClC,gBAAgB;IAChB,sCAAsC;IACtC,oBAAoB;IACpB,gBAAgB;IAChB,eAAe;IACf,kBAAkB;CACnB,CAAC;AAEF,MAAM,UAAU,mBAAmB,CAAC,MAAc;IAChD,MAAM,QAAQ,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,EAAE,IAAI,MAAM,EAAE,CAAC;QACxB,MAAM,OAAO,GAAG,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QACnC,IAAI,OAAO,EAAE,CAAC;YACZ,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;YACxB,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC;QACpD,CAAC;IACH,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC;AACvD,CAAC;AAED,SAAS,eAAe,CAAC,IAAY;IACnC,OAAO,IAAI,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocker.d.ts","sourceRoot":"","sources":["../../src/detectors/blocker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAyBpD,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,CA2B9D"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
// Detects whether a model turn declares it is blocked under Phase 2.
|
|
2
|
+
// Two paths to a positive:
|
|
3
|
+
// 1. Explicit "Phase 2" header.
|
|
4
|
+
// 2. Heuristic phrases the framework documents (Hit a wall, blocked, etc.)
|
|
5
|
+
// combined with a stop signal (need, missing, cannot proceed).
|
|
6
|
+
const EXPLICIT_PATTERNS = [
|
|
7
|
+
/(^|\n)\s*#{1,4}\s*phase\s*2\b[^\n]*/i,
|
|
8
|
+
/(^|\n)\s*phase\s*2\s*[:\-]/i,
|
|
9
|
+
/(^|\n)\s*blocker\s*[:\-]/i,
|
|
10
|
+
];
|
|
11
|
+
const HEURISTIC_PATTERNS = [
|
|
12
|
+
/\bhit a wall\b/i,
|
|
13
|
+
/\bi(?:'m| am)\s+blocked\b/i,
|
|
14
|
+
/\bi\s+can(?:not|'t)\s+proceed\b/i,
|
|
15
|
+
/\bi\s+cannot\s+continue\b/i,
|
|
16
|
+
/\bcannot\s+resolve\s+this\b/i,
|
|
17
|
+
/\bneed (?:the operator|your|operator)\s+(?:input|call|decision|help)/i,
|
|
18
|
+
/\bstopping (?:here|until)\b/i,
|
|
19
|
+
/\bwaiting (?:for|on)\s+(?:operator|your\s+(?:call|input))/i,
|
|
20
|
+
];
|
|
21
|
+
export function detectBlocker(output) {
|
|
22
|
+
for (const p of EXPLICIT_PATTERNS) {
|
|
23
|
+
const m = p.exec(output);
|
|
24
|
+
if (m) {
|
|
25
|
+
return {
|
|
26
|
+
blocked: true,
|
|
27
|
+
reason: extractReason(output, m.index),
|
|
28
|
+
matched_pattern: p.source,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// Heuristic: require at least one signal phrase AND that the output ends
|
|
33
|
+
// in something that reads like a halt (not just a passing mention).
|
|
34
|
+
for (const p of HEURISTIC_PATTERNS) {
|
|
35
|
+
if (p.test(output)) {
|
|
36
|
+
// Reject if the phrase appears inside a quoted block or code fence.
|
|
37
|
+
if (isInsideCodeFence(output, p))
|
|
38
|
+
continue;
|
|
39
|
+
return {
|
|
40
|
+
blocked: true,
|
|
41
|
+
reason: extractReason(output, output.search(p)),
|
|
42
|
+
matched_pattern: p.source,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return { blocked: false, reason: null };
|
|
47
|
+
}
|
|
48
|
+
function extractReason(output, fromIndex) {
|
|
49
|
+
// Grab up to 4 lines starting from the matched line.
|
|
50
|
+
const rest = output.slice(fromIndex);
|
|
51
|
+
const lines = rest.split("\n").slice(0, 8);
|
|
52
|
+
return lines.join("\n").trim().slice(0, 600);
|
|
53
|
+
}
|
|
54
|
+
function isInsideCodeFence(text, pattern) {
|
|
55
|
+
const m = pattern.exec(text);
|
|
56
|
+
if (!m)
|
|
57
|
+
return false;
|
|
58
|
+
const before = text.slice(0, m.index);
|
|
59
|
+
const fences = before.match(/```/g);
|
|
60
|
+
return !!fences && fences.length % 2 === 1;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=blocker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"blocker.js","sourceRoot":"","sources":["../../src/detectors/blocker.ts"],"names":[],"mappings":"AAEA,qEAAqE;AACrE,2BAA2B;AAC3B,kCAAkC;AAClC,6EAA6E;AAC7E,oEAAoE;AAEpE,MAAM,iBAAiB,GAAa;IAClC,sCAAsC;IACtC,6BAA6B;IAC7B,2BAA2B;CAC5B,CAAC;AAEF,MAAM,kBAAkB,GAAa;IACnC,iBAAiB;IACjB,4BAA4B;IAC5B,kCAAkC;IAClC,4BAA4B;IAC5B,8BAA8B;IAC9B,uEAAuE;IACvE,8BAA8B;IAC9B,4DAA4D;CAC7D,CAAC;AAEF,MAAM,UAAU,aAAa,CAAC,MAAc;IAC1C,KAAK,MAAM,CAAC,IAAI,iBAAiB,EAAE,CAAC;QAClC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACzB,IAAI,CAAC,EAAE,CAAC;YACN,OAAO;gBACL,OAAO,EAAE,IAAI;gBACb,MAAM,EAA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tC,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.d.ts","sourceRoot":"","sources":["../../src/detectors/completion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAYvD,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,mBAAmB,CAOpE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// Detects whether the model has declared Phase 4 / completion.
|
|
2
|
+
const PATTERNS = [
|
|
3
|
+
/(^|\n)\s*#{1,4}\s*phase\s*4\b[^\n]*/i,
|
|
4
|
+
/(^|\n)\s*phase\s*4\s*[:\-]/i,
|
|
5
|
+
/(^|\n)\s*#{1,4}\s*completion\b[^\n]*/i,
|
|
6
|
+
/\ball\s+deliverables?\s+(?:are\s+)?(?:complete|delivered|shipped)\b/i,
|
|
7
|
+
/\bbrief (?:is )?complete\b/i,
|
|
8
|
+
];
|
|
9
|
+
export function detectCompletion(output) {
|
|
10
|
+
for (const p of PATTERNS) {
|
|
11
|
+
if (p.test(output)) {
|
|
12
|
+
return { complete: true, matched_pattern: p.source };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return { complete: false };
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=completion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/detectors/completion.ts"],"names":[],"mappings":"AAEA,+DAA+D;AAE/D,MAAM,QAAQ,GAAa;IACzB,sCAAsC;IACtC,6BAA6B;IAC7B,uCAAuC;IACvC,sEAAsE;IACtE,6BAA6B;CAC9B,CAAC;AAEF,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,KAAK,MAAM,CAAC,IAAI,QAAQ,EAAE,CAAC;QACzB,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC;YACnB,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC;QACvD,CAAC;IACH,CAAC;IACD,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,CAAC;AAC7B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation-summary.d.ts","sourceRoot":"","sources":["../../src/detectors/confirmation-summary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAmDzD,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,CA+B/E"}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
// Detects whether a model turn contains a Confirmation Summary in OpenWar's
|
|
2
|
+
// shape. Looks for:
|
|
3
|
+
// 1. An explicit Phase 0 / Confirmation Summary marker, OR
|
|
4
|
+
// 2. The presence of all five required subsections.
|
|
5
|
+
//
|
|
6
|
+
// Pure. Pattern-based. No LLM judging.
|
|
7
|
+
const PHASE_0_MARKERS = [
|
|
8
|
+
/(^|\n)\s*#{1,4}\s*phase\s*0\b[^\n]*/i,
|
|
9
|
+
/(^|\n)\s*#{1,4}\s*confirmation\s+summary\b[^\n]*/i,
|
|
10
|
+
/(^|\n)\s*confirmation\s+summary\s*[:\-]/i,
|
|
11
|
+
];
|
|
12
|
+
// Each section heading allows several spellings. The regex captures the body
|
|
13
|
+
// from the heading line until the next heading or end-of-string.
|
|
14
|
+
const SECTION_PATTERNS = [
|
|
15
|
+
{
|
|
16
|
+
key: "objective",
|
|
17
|
+
patterns: [/(^|\n)\s*(?:#{1,4}\s*|\*{1,2})?(?:objective|goal)s?\b\*{0,2}\s*[:\-]?/i],
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
key: "deliverables",
|
|
21
|
+
patterns: [/(^|\n)\s*(?:#{1,4}\s*|\*{1,2})?deliverables?\b\*{0,2}\s*[:\-]?/i],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
key: "constraints",
|
|
25
|
+
patterns: [/(^|\n)\s*(?:#{1,4}\s*|\*{1,2})?constraints?\b\*{0,2}\s*[:\-]?/i],
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
key: "tools_required",
|
|
29
|
+
patterns: [/(^|\n)\s*(?:#{1,4}\s*|\*{1,2})?tools?(?:\s+required)?\b\*{0,2}\s*[:\-]?/i],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: "unknowns",
|
|
33
|
+
patterns: [
|
|
34
|
+
/(^|\n)\s*(?:#{1,4}\s*|\*{1,2})?(?:unknowns?|notes?\s*\/\s*unknowns?|open\s+questions?)\b\*{0,2}\s*[:\-]?/i,
|
|
35
|
+
],
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
const MODE_QUESTION_PATTERNS = [
|
|
39
|
+
/per[\s\-]?step/i,
|
|
40
|
+
/auto[\s\-]?pilot/i,
|
|
41
|
+
/which\s+(?:execution\s+)?mode/i,
|
|
42
|
+
];
|
|
43
|
+
export function detectConfirmationSummary(output) {
|
|
44
|
+
const hasMarker = PHASE_0_MARKERS.some((p) => p.test(output));
|
|
45
|
+
const sections = {};
|
|
46
|
+
let foundSections = 0;
|
|
47
|
+
for (const { key, patterns } of SECTION_PATTERNS) {
|
|
48
|
+
for (const p of patterns) {
|
|
49
|
+
const m = p.exec(output);
|
|
50
|
+
if (m) {
|
|
51
|
+
const idx = m.index + m[0].length;
|
|
52
|
+
sections[key] = extractUntilNextHeading(output, idx);
|
|
53
|
+
foundSections++;
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
// Found = explicit marker, OR all 4 required sections (unknowns optional).
|
|
59
|
+
const requiredHit = sections.objective !== undefined &&
|
|
60
|
+
sections.deliverables !== undefined &&
|
|
61
|
+
sections.constraints !== undefined &&
|
|
62
|
+
sections.tools_required !== undefined;
|
|
63
|
+
const found = hasMarker || requiredHit;
|
|
64
|
+
const asked_for_mode = MODE_QUESTION_PATTERNS.some((p) => p.test(output)) &&
|
|
65
|
+
/\?/.test(output);
|
|
66
|
+
void foundSections;
|
|
67
|
+
return { found, sections, asked_for_mode };
|
|
68
|
+
}
|
|
69
|
+
function extractUntilNextHeading(text, fromIndex) {
|
|
70
|
+
const rest = text.slice(fromIndex);
|
|
71
|
+
// Stop at next markdown heading (#, ##, ###) on a fresh line.
|
|
72
|
+
const stop = /\n#{1,4}\s+\S/.exec(rest);
|
|
73
|
+
const chunk = stop ? rest.slice(0, stop.index) : rest;
|
|
74
|
+
return chunk.trim();
|
|
75
|
+
}
|
|
76
|
+
//# sourceMappingURL=confirmation-summary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirmation-summary.js","sourceRoot":"","sources":["../../src/detectors/confirmation-summary.ts"],"names":[],"mappings":"AAEA,4EAA4E;AAC5E,oBAAoB;AACpB,6DAA6D;AAC7D,sDAAsD;AACtD,EAAE;AACF,uCAAuC;AAEvC,MAAM,eAAe,GAAG;IACtB,sCAAsC;IACtC,mDAAmD;IACnD,0CAA0C;CAC3C,CAAC;AAEF,6EAA6E;AAC7E,iEAAiE;AACjE,MAAM,gBAAgB,GAGjB;IACH;QACE,GAAG,EAAE,WAAW;QAChB,QAAQ,EAAE,CAAC,wEAAwE,CAAC;KACrF;IACD;QACE,GAAG,EAAE,cAAc;QACnB,QAAQ,EAAE,CAAC,iEAAiE,CAAC;KAC9E;IACD;QACE,GAAG,EAAE,aAAa;QAClB,QAAQ,EAAE,CAAC,gEAAgE,CAAC;KAC7E;IACD;QACE,GAAG,EAAE,gBAAgB;QACrB,QAAQ,EAAE,CAAC,0EAA0E,CAAC;KACvF;IACD;QACE,GAAG,EAAE,UAA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AC,MAAM,CAAC,CAAC;IAEpB,KAAK,aAAa,CAAC;IACnB,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;AAC7C,CAAC;AAED,SAAS,uBAAuB,CAAC,IAAY,EAAE,SAAiB;IAC9D,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IACnC,8DAA8D;IAC9D,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACtD,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destructive.d.ts","sourceRoot":"","sources":["../../src/detectors/destructive.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAuExD,wBAAgB,iBAAiB,CAC/B,MAAM,EAAE,MAAM,EACd,gBAAgB,GAAE,MAAM,EAAO,GAC9B,oBAAoB,CAyBtB"}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
const INTENT = /\b(?:i(?:'ll| will| am going to|'m going to| plan to)|next,?\s+i(?:'ll| will)|let me)\b/i;
|
|
2
|
+
const RULES = [
|
|
3
|
+
{
|
|
4
|
+
category: "filesystem_delete",
|
|
5
|
+
action: /\b(?:rm\s+-rf|delete|remove|wipe|purge)\b[^.\n]{0,80}\b(?:file|folder|directory|repo|repository|database|table|branch|tag|commit|history|all)\b/i,
|
|
6
|
+
authorizes: ["filesystem_delete", "delete", "destructive_fs"],
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
category: "git_history_rewrite",
|
|
10
|
+
action: /\b(?:force[\s\-]?push|rebase\s+(?:--root|onto)|git\s+reset\s+--hard|amend\s+(?:published|pushed)|filter[\s\-]?repo|filter[\s\-]?branch)\b/i,
|
|
11
|
+
authorizes: ["git_history_rewrite", "git", "destructive_git"],
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
category: "git_push",
|
|
15
|
+
action: /\bgit\s+push\b/i,
|
|
16
|
+
authorizes: ["git_push", "push", "publish"],
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
category: "deploy",
|
|
20
|
+
action: /\b(?:deploy(?:\s+to)?\s+(?:prod|production|staging|live)|kubectl\s+apply|helm\s+(?:install|upgrade)|terraform\s+apply|vercel\s+deploy|wrangler\s+deploy)\b/i,
|
|
21
|
+
authorizes: ["deploy", "deploy_prod", "infra"],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
category: "external_message",
|
|
25
|
+
action: /\b(?:send|post|comment|publish|tweet|dm)\b[^.\n]{0,80}\b(?:slack|discord|email|tweet|x|linkedin|threads|bluesky|sms|whatsapp|telegram|pr|issue)\b/i,
|
|
26
|
+
authorizes: ["external_message", "messaging", "comms"],
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
category: "paid_api",
|
|
30
|
+
action: /\b(?:call|invoke|hit|generate|render|charge|spend|burn)\b[^.\n]{0,80}\b(?:gpt|claude|gemini|openai|anthropic|kling|higgsfield|elevenlabs|fal|replicate|stripe|api)\b/i,
|
|
31
|
+
authorizes: ["paid_api", "api_calls", "generation_credits", "tokens"],
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
category: "package_change",
|
|
35
|
+
action: /\b(?:downgrade|uninstall|remove)\b[^.\n]{0,80}\b(?:dependency|package|library)\b/i,
|
|
36
|
+
authorizes: ["package_change", "deps"],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
category: "ci_modify",
|
|
40
|
+
action: /\b(?:modify|change|edit|disable|skip)\b[^.\n]{0,80}\b(?:ci|cd|github\s+actions|workflow|pipeline)\b/i,
|
|
41
|
+
authorizes: ["ci_modify", "infra"],
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
category: "process_kill",
|
|
45
|
+
action: /\b(?:kill|terminate|stop)\b[^.\n]{0,80}\b(?:process|server|container|pm2|service|daemon)\b/i,
|
|
46
|
+
authorizes: ["process_kill"],
|
|
47
|
+
},
|
|
48
|
+
];
|
|
49
|
+
const WILDCARD_TOKENS = new Set(["*", "all", "any", "everything"]);
|
|
50
|
+
export function detectDestructive(output, authorized_costs = []) {
|
|
51
|
+
const authSet = new Set(authorized_costs.map((s) => s.toLowerCase()));
|
|
52
|
+
const hasWildcard = [...authSet].some((t) => WILDCARD_TOKENS.has(t));
|
|
53
|
+
// Walk each sentence and look for intent + action co-occurrence.
|
|
54
|
+
const sentences = splitSentences(output);
|
|
55
|
+
for (const sentence of sentences) {
|
|
56
|
+
if (isInCodeFenceOfFull(output, sentence))
|
|
57
|
+
continue;
|
|
58
|
+
if (!INTENT.test(sentence))
|
|
59
|
+
continue;
|
|
60
|
+
if (hasNegation(sentence))
|
|
61
|
+
continue;
|
|
62
|
+
for (const rule of RULES) {
|
|
63
|
+
if (rule.action.test(sentence)) {
|
|
64
|
+
const authorized = hasWildcard || rule.authorizes.some((tok) => authSet.has(tok.toLowerCase()));
|
|
65
|
+
return {
|
|
66
|
+
destructive: true,
|
|
67
|
+
action: rule.category,
|
|
68
|
+
authorized,
|
|
69
|
+
matched_pattern: rule.action.source,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return { destructive: false, action: null, authorized: false };
|
|
75
|
+
}
|
|
76
|
+
const NEGATION = /\b(?:not|won't|will not|don't|do not|cannot|can't|never|no longer|instead of|avoid|refuse to|won['’]t)\b/i;
|
|
77
|
+
function hasNegation(sentence) {
|
|
78
|
+
return NEGATION.test(sentence);
|
|
79
|
+
}
|
|
80
|
+
function splitSentences(text) {
|
|
81
|
+
// Conservative split: line breaks and sentence-terminal punctuation.
|
|
82
|
+
return text
|
|
83
|
+
.replace(/\r/g, "")
|
|
84
|
+
.split(/(?<=[.!?])\s+|\n+/)
|
|
85
|
+
.map((s) => s.trim())
|
|
86
|
+
.filter(Boolean);
|
|
87
|
+
}
|
|
88
|
+
function isInCodeFenceOfFull(full, fragment) {
|
|
89
|
+
const idx = full.indexOf(fragment);
|
|
90
|
+
if (idx === -1)
|
|
91
|
+
return false;
|
|
92
|
+
const before = full.slice(0, idx);
|
|
93
|
+
const fences = before.match(/```/g);
|
|
94
|
+
return !!fences && fences.length % 2 === 1;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=destructive.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destructive.js","sourceRoot":"","sources":["../../src/detectors/destructive.ts"],"names":[],"mappings":"AAmBA,MAAM,MAAM,GAAG,0FAA0F,CAAC;AAE1G,MAAM,KAAK,GAAW;IACpB;QACE,QAAQ,EAAE,mBAAmB;QAC7B,MAAM,EAAE,kJAAkJ;QAC1J,UAAU,EAAE,CAAC,mBAAmB,EAAE,QAAQ,EAAE,gBAAgB,CAAC;KAC9D;IACD;QACE,QAAQ,EAAE,qBAAqB;QAC/B,MAAM,EAAE,4IAA4I;QACpJ,UAAU,EAAE,CAAC,qBAAqB,EAAE,KAAK,EAAE,iBAAiB,CAAC;KAC9D;IACD;QACE,QAAQ,EAAE,UAAU;QACpB,MAAM,EAAE,iBAAiB;QACzB,UAAU,EAAE,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC;KAC5C;IACD;QACE,QAAQ,EAAE,QAAQ;QAClB,MAAM,EAAE,6JAA6J;QACrK,UAAU,EAAE,CAAC,QAAQ,EAAE,aAAa,EAAE,OAAO,CAAC;KAC/C;IACD;QACE,QAAQ,EAAE,kBAAkB;QAC5B,MAAM,EAAE,oJAAoJ;QAC5J,UAAU,EAAE,CAAC,kBAAkB,EAAE,WAAW,EAAE,OAAO,CAAC;KACvD;IACD;QACE,QAAQ,EAAE,UAAU;QACpB,MAA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AAK,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,KAAK,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { DetectorSnapshot } from "../types.js";
|
|
2
|
+
import { detectConfirmationSummary } from "./confirmation-summary.js";
|
|
3
|
+
import { detectBlocker } from "./blocker.js";
|
|
4
|
+
import { detectDestructive } from "./destructive.js";
|
|
5
|
+
import { detectBannedPhrases } from "./banned-phrases.js";
|
|
6
|
+
import { detectPhaseMarkers } from "./phase-marker.js";
|
|
7
|
+
import { detectCompletion } from "./completion.js";
|
|
8
|
+
export { detectConfirmationSummary, detectBlocker, detectDestructive, detectBannedPhrases, detectPhaseMarkers, detectCompletion, };
|
|
9
|
+
export declare function snapshot(output: string, ctx?: {
|
|
10
|
+
authorized_costs?: string[];
|
|
11
|
+
}): DetectorSnapshot;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/detectors/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,CAAC;AAGF,wBAAgB,QAAQ,CACtB,MAAM,EAAE,MAAM,EACd,GAAG,GAAE;IAAE,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAA;CAAO,GACxC,gBAAgB,CASlB"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { detectConfirmationSummary } from "./confirmation-summary.js";
|
|
2
|
+
import { detectBlocker } from "./blocker.js";
|
|
3
|
+
import { detectDestructive } from "./destructive.js";
|
|
4
|
+
import { detectBannedPhrases } from "./banned-phrases.js";
|
|
5
|
+
import { detectPhaseMarkers } from "./phase-marker.js";
|
|
6
|
+
import { detectCompletion } from "./completion.js";
|
|
7
|
+
export { detectConfirmationSummary, detectBlocker, detectDestructive, detectBannedPhrases, detectPhaseMarkers, detectCompletion, };
|
|
8
|
+
// Convenience: run every detector against a single agent turn.
|
|
9
|
+
export function snapshot(output, ctx = {}) {
|
|
10
|
+
return {
|
|
11
|
+
confirmation: detectConfirmationSummary(output),
|
|
12
|
+
blocker: detectBlocker(output),
|
|
13
|
+
destructive: detectDestructive(output, ctx.authorized_costs ?? []),
|
|
14
|
+
banned_phrases: detectBannedPhrases(output),
|
|
15
|
+
phase_marker: detectPhaseMarkers(output),
|
|
16
|
+
completion: detectCompletion(output),
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/detectors/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAEnD,OAAO,EACL,yBAAyB,EACzB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,CAAC;AAEF,+DAA+D;AAC/D,MAAM,UAAU,QAAQ,CACtB,MAAc,EACd,MAAuC,EAAE;IAEzC,OAAO;QACL,YAAY,EAAE,yBAAyB,CAAC,MAAM,CAAC;QAC/C,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC;QAC9B,WAAW,EAAE,iBAAiB,CAAC,MAAM,EAAE,GAAG,CAAC,gBAAgB,IAAI,EAAE,CAAC;QAClE,cAAc,EAAE,mBAAmB,CAAC,MAAM,CAAC;QAC3C,YAAY,EAAE,kBAAkB,CAAC,MAAM,CAAC;QACxC,UAAU,EAAE,gBAAgB,CAAC,MAAM,CAAC;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase-marker.d.ts","sourceRoot":"","sources":["../../src/detectors/phase-marker.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAS,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAgB/D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,GAAG,oBAAoB,CAWvE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Finds explicit Phase N markers the model declares in its output. The
|
|
2
|
+
// runtime tracks these independently of its own phase state so it can
|
|
3
|
+
// notice drift (model thinks it's in Phase 1, runtime thinks Phase 0).
|
|
4
|
+
const PHASE_HEADER = /(^|\n)\s*#{0,4}\s*phase\s*([0-4])\b[^\n]*/gi;
|
|
5
|
+
const PHASE_BY_INDEX = {
|
|
6
|
+
"0": "intake",
|
|
7
|
+
"1": "execute",
|
|
8
|
+
"2": "blocker",
|
|
9
|
+
"3": "destructive",
|
|
10
|
+
"4": "completion",
|
|
11
|
+
};
|
|
12
|
+
export function detectPhaseMarkers(output) {
|
|
13
|
+
const declared = [];
|
|
14
|
+
PHASE_HEADER.lastIndex = 0;
|
|
15
|
+
let m;
|
|
16
|
+
while ((m = PHASE_HEADER.exec(output)) !== null) {
|
|
17
|
+
const phase = PHASE_BY_INDEX[m[2]];
|
|
18
|
+
if (phase)
|
|
19
|
+
declared.push(phase);
|
|
20
|
+
}
|
|
21
|
+
return declared.length > 0
|
|
22
|
+
? { declared, last: declared[declared.length - 1] }
|
|
23
|
+
: { declared };
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=phase-marker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"phase-marker.js","sourceRoot":"","sources":["../../src/detectors/phase-marker.ts"],"names":[],"mappings":"AAEA,uEAAuE;AACvE,sEAAsE;AACtE,uEAAuE;AAEvE,MAAM,YAAY,GAAG,6CAA6C,CAAC;AAEnE,MAAM,cAAc,GAA0B;IAC5C,GAAG,EAAE,QAAQ;IACb,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,SAAS;IACd,GAAG,EAAE,aAAa;IAClB,GAAG,EAAE,YAAY;CAClB,CAAC;AAEF,MAAM,UAAU,kBAAkB,CAAC,MAAc;IAC/C,MAAM,QAAQ,GAAY,EAAE,CAAC;IAC7B,YAAY,CAAC,SAAS,GAAG,CAAC,CAAC;IAC3B,IAAI,CAAyB,CAAC;IAC9B,OAAO,CAAC,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAChD,MAAM,KAAK,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC,CAAE,CAAC,CAAC;QACpC,IAAI,KAAK;YAAE,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,GAAG,CAAC;QACxB,CAAC,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAE,EAAE;QACpD,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework.d.ts","sourceRoot":"","sources":["../src/framework.ts"],"names":[],"mappings":"AAUA,wBAAgB,gBAAgB,IAAI,MAAM,CAwBzC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { readFileSync } from "node:fs";
|
|
2
|
+
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname, join } from "node:path";
|
|
4
|
+
// Resolves the canonical openwar.md framework doc bundled with the package.
|
|
5
|
+
// Walks up from the compiled module location (dist/) until a file named
|
|
6
|
+
// openwar.md is found. The package.json's `files` entry guarantees it ships.
|
|
7
|
+
let cached = null;
|
|
8
|
+
export function loadFrameworkDoc() {
|
|
9
|
+
if (cached !== null)
|
|
10
|
+
return cached;
|
|
11
|
+
if (process.env.OPENWAR_FRAMEWORK_PATH) {
|
|
12
|
+
cached = readFileSync(process.env.OPENWAR_FRAMEWORK_PATH, "utf8");
|
|
13
|
+
return cached;
|
|
14
|
+
}
|
|
15
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
16
|
+
// Search up to 5 parent dirs for openwar.md.
|
|
17
|
+
let dir = here;
|
|
18
|
+
for (let i = 0; i < 6; i++) {
|
|
19
|
+
const candidate = join(dir, "openwar.md");
|
|
20
|
+
try {
|
|
21
|
+
cached = readFileSync(candidate, "utf8");
|
|
22
|
+
return cached;
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
// Try one level up.
|
|
26
|
+
}
|
|
27
|
+
const parent = dirname(dir);
|
|
28
|
+
if (parent === dir)
|
|
29
|
+
break;
|
|
30
|
+
dir = parent;
|
|
31
|
+
}
|
|
32
|
+
throw new Error("Could not locate openwar.md. Set OPENWAR_FRAMEWORK_PATH to override, or reinstall the package.");
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=framework.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"framework.js","sourceRoot":"","sources":["../src/framework.ts"],"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
+
export * from "./types.js";
|
|
2
|
+
export { parseBrief, validateBrief, renderBriefForAgent, generateBriefId } from "./brief.js";
|
|
3
|
+
export { run } from "./runner.js";
|
|
4
|
+
export { loadFrameworkDoc } from "./framework.js";
|
|
5
|
+
export { AnthropicAdapter, OpenAIAdapter, GeminiAdapter, GrokAdapter, OpenAICompatAdapter, MockAdapter, makeAdapter, listAdapters, } from "./adapters/index.js";
|
|
6
|
+
export type { AdapterId } from "./adapters/index.js";
|
|
7
|
+
export { snapshot, detectConfirmationSummary, detectBlocker, detectDestructive, detectBannedPhrases, detectPhaseMarkers, detectCompletion, } from "./detectors/index.js";
|
|
8
|
+
export { writeSession, readSession, listSessions, sessionExists, openwarHome, sessionsDir, sessionFile, appendTranscript, readTranscript, } from "./state/index.js";
|
|
9
|
+
export { createTerminalIO, createScriptedIO } from "./io.js";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EACL,QAAQ,EACR,yBAAyB,EACzB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// Public library surface. War Room and other integrators import from here.
|
|
2
|
+
export * from "./types.js";
|
|
3
|
+
export { parseBrief, validateBrief, renderBriefForAgent, generateBriefId } from "./brief.js";
|
|
4
|
+
export { run } from "./runner.js";
|
|
5
|
+
export { loadFrameworkDoc } from "./framework.js";
|
|
6
|
+
export { AnthropicAdapter, OpenAIAdapter, GeminiAdapter, GrokAdapter, OpenAICompatAdapter, MockAdapter, makeAdapter, listAdapters, } from "./adapters/index.js";
|
|
7
|
+
export { snapshot, detectConfirmationSummary, detectBlocker, detectDestructive, detectBannedPhrases, detectPhaseMarkers, detectCompletion, } from "./detectors/index.js";
|
|
8
|
+
export { writeSession, readSession, listSessions, sessionExists, openwarHome, sessionsDir, sessionFile, appendTranscript, readTranscript, } from "./state/index.js";
|
|
9
|
+
export { createTerminalIO, createScriptedIO } from "./io.js";
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAE3E,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7F,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAClC,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAElD,OAAO,EACL,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,YAAY,GACb,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,QAAQ,EACR,yBAAyB,EACzB,aAAa,EACb,iBAAiB,EACjB,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,aAAa,EACb,WAAW,EACX,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/io.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { RunnerIO } from "./types.js";
|
|
2
|
+
export declare const styles: {
|
|
3
|
+
dim: (s: string) => string;
|
|
4
|
+
bold: (s: string) => string;
|
|
5
|
+
cyan: (s: string) => string;
|
|
6
|
+
yellow: (s: string) => string;
|
|
7
|
+
red: (s: string) => string;
|
|
8
|
+
green: (s: string) => string;
|
|
9
|
+
magenta: (s: string) => string;
|
|
10
|
+
};
|
|
11
|
+
export declare function createTerminalIO(): RunnerIO;
|
|
12
|
+
export declare function closeTerminalIO(io: RunnerIO): void;
|
|
13
|
+
export interface ScriptedIOOptions {
|
|
14
|
+
inputs?: string[];
|
|
15
|
+
confirmations?: boolean[];
|
|
16
|
+
onWrite?: (text: string) => void;
|
|
17
|
+
onWarn?: (text: string) => void;
|
|
18
|
+
onBanner?: (text: string) => void;
|
|
19
|
+
}
|
|
20
|
+
export declare function createScriptedIO(opts?: ScriptedIOOptions): RunnerIO & {
|
|
21
|
+
output: string;
|
|
22
|
+
warnings: string[];
|
|
23
|
+
banners: string[];
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=io.d.ts.map
|
package/dist/io.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAO3C,eAAO,MAAM,MAAM;aADa,MAAM;cAAN,MAAM;cAAN,MAAM;gBAAN,MAAM;aAAN,MAAM;eAAN,MAAM;iBAAN,MAAM;CASrC,CAAC;AAEF,wBAAgB,gBAAgB,IAAI,QAAQ,CA2B3C;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAKlD;AAMD,MAAM,WAAW,iBAAiB;IAEhC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAElB,aAAa,CAAC,EAAE,OAAO,EAAE,CAAC;IAE1B,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACjC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,iBAAsB,GAAG,QAAQ,GAAG;IACzE,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAgCA"}
|