@event4u/agent-config 9.36.0 → 10.0.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/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +57 -0
- package/agents/templates/.ai-council.yml.example +31 -51
- package/dist/agent-src/commands/analyze/conformance.md +15 -4
- package/dist/agent-src/rules/session-canary.md +28 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli-delegate/{chunk-SFGARMAB.js → chunk-2H5SE7DU.js} +24 -4
- package/dist/cli-delegate/{chunk-U7CMAIOC.js → chunk-3JUTT26I.js} +1 -1
- package/dist/cli-delegate/{chunk-JP53LNVT.js → chunk-HJSKTMIF.js} +6 -14
- package/dist/cli-delegate/{chunk-QEEB4LHO.js → chunk-LRXJK6GN.js} +1 -1
- package/dist/cli-delegate/{chunk-NR7HSN3P.js → chunk-NX5AXSLD.js} +3 -3
- package/dist/cli-delegate/{chunk-AG47LAGQ.js → chunk-TVGXH7VA.js} +1 -1
- package/dist/cli-delegate/{chunk-55RI5UXK.js → chunk-XT2YTJCZ.js} +22 -18
- package/dist/cli-delegate/{chunk-JEJABGKB.js → chunk-XTC5ARB6.js} +16 -12
- package/dist/cli-delegate/cmd_analyze_session.js +1 -1
- package/dist/cli-delegate/cmd_brand_status.js +1 -1
- package/dist/cli-delegate/cmd_conformance.js +1037 -196
- package/dist/cli-delegate/cmd_doctor.js +3 -3
- package/dist/cli-delegate/cmd_explain.js +2 -2
- package/dist/cli-delegate/cmd_export.js +4 -4
- package/dist/cli-delegate/cmd_handoff.js +3 -3
- package/dist/cli-delegate/cmd_mcp_available.js +1 -1
- package/dist/cli-delegate/cmd_migrate.js +2 -2
- package/dist/cli-delegate/cmd_packs_active.js +2 -2
- package/dist/cli-delegate/cmd_prune.js +4 -4
- package/dist/cli-delegate/cmd_route_audit.js +2 -2
- package/dist/cli-delegate/cmd_route_explain.js +1 -1
- package/dist/cli-delegate/cmd_session_recycle.js +1 -1
- package/dist/cli-delegate/cmd_settings_get.js +1 -1
- package/dist/cli-delegate/cmd_settings_migrate.js +4 -4
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +4 -4
- package/dist/cli-delegate/cmd_uninstall.js +4 -4
- package/dist/cli-delegate/cmd_update.js +1 -1
- package/dist/cli-delegate/cmd_upgrade.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +4 -4
- package/dist/cli-delegate/cmd_versions.js +1 -1
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +4 -4
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +125 -89
- package/dist/install/install.mjs +22 -26
- package/dist/mcp/registry-manifest.json +1 -1
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1556 -613
- package/dist/scripts/_lib/agent_settings.js +39 -25
- package/dist/scripts/_lib/agent_settings.js.map +1 -1
- package/dist/scripts/condense.js +15 -2
- package/dist/scripts/condense.js.map +1 -1
- package/dist/server/routes/wizard.js +23 -3
- package/dist/server/routes/wizard.js.map +1 -1
- package/dist/server/schemas/settings.js +6 -6
- package/dist/server/schemas/settings.js.map +1 -1
- package/docs/contracts/settings-classes.md +14 -9
- package/package.json +1 -1
- package/src/config/agent-settings.template.yml +6 -36
- package/src/config/ci-local-parity.yml +44 -0
- package/src/scripts/_lib/agent_settings.ts +39 -25
- package/src/scripts/_lib/environment_detector.ts +52 -1
- package/src/scripts/ai_council/config.ts +62 -24
- package/src/scripts/before_complete_hook.ts +39 -0
- package/src/scripts/check_bridge_derivation.ts +89 -3
- package/src/scripts/check_ci_local_parity.ts +74 -0
- package/src/scripts/check_references.ts +15 -1
- package/src/scripts/condense.ts +16 -2
- package/src/scripts/conformance_scan.ts +200 -9
- package/src/scripts/council_cli.ts +95 -3
- package/src/scripts/hook_manifest.yaml +12 -6
- package/src/scripts/hooks/block_no_verify.ts +82 -9
- package/src/scripts/hooks/turn_end_gate_hook.ts +138 -105
- package/src/scripts/probe_promissory_closing.ts +180 -0
- package/src/scripts/probe_session_canary.ts +180 -0
- package/src/server/schemas/settings.ts +6 -14
package/dist/mcp/server.mjs
CHANGED
|
@@ -591,15 +591,15 @@ function _readDottedSettingsPath(root, dotted) {
|
|
|
591
591
|
return node;
|
|
592
592
|
}
|
|
593
593
|
function _warn_removed_always_on_keys(merged) {
|
|
594
|
-
for (const key of
|
|
595
|
-
if (
|
|
594
|
+
for (const [key, reason] of REMOVED_KEYS) {
|
|
595
|
+
if (_warnedRemovedKeys.has(key)) {
|
|
596
596
|
continue;
|
|
597
597
|
}
|
|
598
598
|
if (_readDottedSettingsPath(merged, key) === void 0) {
|
|
599
599
|
continue;
|
|
600
600
|
}
|
|
601
|
-
|
|
602
|
-
process.stderr.write(`${key} was removed (
|
|
601
|
+
_warnedRemovedKeys.add(key);
|
|
602
|
+
process.stderr.write(`${key} was removed (${reason}); ignored.
|
|
603
603
|
`);
|
|
604
604
|
}
|
|
605
605
|
}
|
|
@@ -877,7 +877,7 @@ function _relative_to(child, root) {
|
|
|
877
877
|
function _posix_join(a, b) {
|
|
878
878
|
return `${a.split(path3.sep).join("/")}/${b}`;
|
|
879
879
|
}
|
|
880
|
-
var _require, Logger, logger, DEFAULT_PROJECT_FILE, LOCAL_PROJECT_FILE, LOCAL_PROJECT_SUBDIR, DEFAULT_TEAM_FILE, USER_GLOBAL_FILENAME, USER_GLOBAL_CANONICAL_RELATIVE, MERGEABLE_KEYS, TEMPLATE_RELATIVE, _PACKAGE_ROOT, _template_defaults_cache, MODULES_DEFAULTS, ANCHOR_AGENT_SETTINGS, ANCHOR_AGENTS_DIR, ANCHOR_GIT, _AGENTS_DIR_MARKERS, _LEGACY_ANCHOR_ENV, ORIGIN_ROOT_FLAG, ORIGIN_EXPLICIT, ORIGIN_ENV, ORIGIN_CWD_FALLBACK, PROJECT_ROOT_ENV, ROOT_OVERRIDE_ENV, ProjectRootError,
|
|
880
|
+
var _require, Logger, logger, DEFAULT_PROJECT_FILE, LOCAL_PROJECT_FILE, LOCAL_PROJECT_SUBDIR, DEFAULT_TEAM_FILE, USER_GLOBAL_FILENAME, USER_GLOBAL_CANONICAL_RELATIVE, MERGEABLE_KEYS, TEMPLATE_RELATIVE, _PACKAGE_ROOT, _template_defaults_cache, MODULES_DEFAULTS, ANCHOR_AGENT_SETTINGS, ANCHOR_AGENTS_DIR, ANCHOR_GIT, _AGENTS_DIR_MARKERS, _LEGACY_ANCHOR_ENV, ORIGIN_ROOT_FLAG, ORIGIN_EXPLICIT, ORIGIN_ENV, ORIGIN_CWD_FALLBACK, PROJECT_ROOT_ENV, ROOT_OVERRIDE_ENV, ProjectRootError, REMOVED_KEYS, _warnedRemovedKeys;
|
|
881
881
|
var init_agent_settings = __esm({
|
|
882
882
|
"src/scripts/_lib/agent_settings.ts"() {
|
|
883
883
|
"use strict";
|
|
@@ -970,14 +970,18 @@ var init_agent_settings = __esm({
|
|
|
970
970
|
this.name = "ProjectRootError";
|
|
971
971
|
}
|
|
972
972
|
};
|
|
973
|
-
|
|
974
|
-
"subagents.enabled",
|
|
975
|
-
"subagents.auto",
|
|
976
|
-
"subagents.host_capabilities",
|
|
977
|
-
"subagents.budget_routing",
|
|
978
|
-
"ai_team.enabled"
|
|
979
|
-
|
|
980
|
-
|
|
973
|
+
REMOVED_KEYS = /* @__PURE__ */ new Map([
|
|
974
|
+
["subagents.enabled", "always-on orchestration"],
|
|
975
|
+
["subagents.auto", "always-on orchestration"],
|
|
976
|
+
["subagents.host_capabilities", "always-on orchestration"],
|
|
977
|
+
["subagents.budget_routing", "always-on orchestration"],
|
|
978
|
+
["ai_team.enabled", "always-on orchestration"],
|
|
979
|
+
["hooks.turn_end_gate.enabled", "the turn-end gate is always armed"],
|
|
980
|
+
["hooks.turn_end_gate.promissory", "the turn-end gate is always armed"],
|
|
981
|
+
["hooks.turn_end_gate.language", "the turn-end gate is always armed"],
|
|
982
|
+
["hooks.turn_end_gate.verification", "the turn-end gate is always armed"]
|
|
983
|
+
]);
|
|
984
|
+
_warnedRemovedKeys = /* @__PURE__ */ new Set();
|
|
981
985
|
}
|
|
982
986
|
});
|
|
983
987
|
|
|
@@ -1831,17 +1835,17 @@ var require_visit = __commonJS({
|
|
|
1831
1835
|
visit.BREAK = BREAK;
|
|
1832
1836
|
visit.SKIP = SKIP;
|
|
1833
1837
|
visit.REMOVE = REMOVE;
|
|
1834
|
-
function visit_(key, node, visitor,
|
|
1835
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
1838
|
+
function visit_(key, node, visitor, path73) {
|
|
1839
|
+
const ctrl = callVisitor(key, node, visitor, path73);
|
|
1836
1840
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
1837
|
-
replaceNode(key,
|
|
1838
|
-
return visit_(key, ctrl, visitor,
|
|
1841
|
+
replaceNode(key, path73, ctrl);
|
|
1842
|
+
return visit_(key, ctrl, visitor, path73);
|
|
1839
1843
|
}
|
|
1840
1844
|
if (typeof ctrl !== "symbol") {
|
|
1841
1845
|
if (identity.isCollection(node)) {
|
|
1842
|
-
|
|
1846
|
+
path73 = Object.freeze(path73.concat(node));
|
|
1843
1847
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1844
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
1848
|
+
const ci = visit_(i, node.items[i], visitor, path73);
|
|
1845
1849
|
if (typeof ci === "number")
|
|
1846
1850
|
i = ci - 1;
|
|
1847
1851
|
else if (ci === BREAK)
|
|
@@ -1852,13 +1856,13 @@ var require_visit = __commonJS({
|
|
|
1852
1856
|
}
|
|
1853
1857
|
}
|
|
1854
1858
|
} else if (identity.isPair(node)) {
|
|
1855
|
-
|
|
1856
|
-
const ck = visit_("key", node.key, visitor,
|
|
1859
|
+
path73 = Object.freeze(path73.concat(node));
|
|
1860
|
+
const ck = visit_("key", node.key, visitor, path73);
|
|
1857
1861
|
if (ck === BREAK)
|
|
1858
1862
|
return BREAK;
|
|
1859
1863
|
else if (ck === REMOVE)
|
|
1860
1864
|
node.key = null;
|
|
1861
|
-
const cv = visit_("value", node.value, visitor,
|
|
1865
|
+
const cv = visit_("value", node.value, visitor, path73);
|
|
1862
1866
|
if (cv === BREAK)
|
|
1863
1867
|
return BREAK;
|
|
1864
1868
|
else if (cv === REMOVE)
|
|
@@ -1879,17 +1883,17 @@ var require_visit = __commonJS({
|
|
|
1879
1883
|
visitAsync.BREAK = BREAK;
|
|
1880
1884
|
visitAsync.SKIP = SKIP;
|
|
1881
1885
|
visitAsync.REMOVE = REMOVE;
|
|
1882
|
-
async function visitAsync_(key, node, visitor,
|
|
1883
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
1886
|
+
async function visitAsync_(key, node, visitor, path73) {
|
|
1887
|
+
const ctrl = await callVisitor(key, node, visitor, path73);
|
|
1884
1888
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
1885
|
-
replaceNode(key,
|
|
1886
|
-
return visitAsync_(key, ctrl, visitor,
|
|
1889
|
+
replaceNode(key, path73, ctrl);
|
|
1890
|
+
return visitAsync_(key, ctrl, visitor, path73);
|
|
1887
1891
|
}
|
|
1888
1892
|
if (typeof ctrl !== "symbol") {
|
|
1889
1893
|
if (identity.isCollection(node)) {
|
|
1890
|
-
|
|
1894
|
+
path73 = Object.freeze(path73.concat(node));
|
|
1891
1895
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1892
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
1896
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path73);
|
|
1893
1897
|
if (typeof ci === "number")
|
|
1894
1898
|
i = ci - 1;
|
|
1895
1899
|
else if (ci === BREAK)
|
|
@@ -1900,13 +1904,13 @@ var require_visit = __commonJS({
|
|
|
1900
1904
|
}
|
|
1901
1905
|
}
|
|
1902
1906
|
} else if (identity.isPair(node)) {
|
|
1903
|
-
|
|
1904
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
1907
|
+
path73 = Object.freeze(path73.concat(node));
|
|
1908
|
+
const ck = await visitAsync_("key", node.key, visitor, path73);
|
|
1905
1909
|
if (ck === BREAK)
|
|
1906
1910
|
return BREAK;
|
|
1907
1911
|
else if (ck === REMOVE)
|
|
1908
1912
|
node.key = null;
|
|
1909
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
1913
|
+
const cv = await visitAsync_("value", node.value, visitor, path73);
|
|
1910
1914
|
if (cv === BREAK)
|
|
1911
1915
|
return BREAK;
|
|
1912
1916
|
else if (cv === REMOVE)
|
|
@@ -1933,23 +1937,23 @@ var require_visit = __commonJS({
|
|
|
1933
1937
|
}
|
|
1934
1938
|
return visitor;
|
|
1935
1939
|
}
|
|
1936
|
-
function callVisitor(key, node, visitor,
|
|
1940
|
+
function callVisitor(key, node, visitor, path73) {
|
|
1937
1941
|
if (typeof visitor === "function")
|
|
1938
|
-
return visitor(key, node,
|
|
1942
|
+
return visitor(key, node, path73);
|
|
1939
1943
|
if (identity.isMap(node))
|
|
1940
|
-
return visitor.Map?.(key, node,
|
|
1944
|
+
return visitor.Map?.(key, node, path73);
|
|
1941
1945
|
if (identity.isSeq(node))
|
|
1942
|
-
return visitor.Seq?.(key, node,
|
|
1946
|
+
return visitor.Seq?.(key, node, path73);
|
|
1943
1947
|
if (identity.isPair(node))
|
|
1944
|
-
return visitor.Pair?.(key, node,
|
|
1948
|
+
return visitor.Pair?.(key, node, path73);
|
|
1945
1949
|
if (identity.isScalar(node))
|
|
1946
|
-
return visitor.Scalar?.(key, node,
|
|
1950
|
+
return visitor.Scalar?.(key, node, path73);
|
|
1947
1951
|
if (identity.isAlias(node))
|
|
1948
|
-
return visitor.Alias?.(key, node,
|
|
1952
|
+
return visitor.Alias?.(key, node, path73);
|
|
1949
1953
|
return void 0;
|
|
1950
1954
|
}
|
|
1951
|
-
function replaceNode(key,
|
|
1952
|
-
const parent =
|
|
1955
|
+
function replaceNode(key, path73, node) {
|
|
1956
|
+
const parent = path73[path73.length - 1];
|
|
1953
1957
|
if (identity.isCollection(parent)) {
|
|
1954
1958
|
parent.items[key] = node;
|
|
1955
1959
|
} else if (identity.isPair(parent)) {
|
|
@@ -2559,10 +2563,10 @@ var require_Collection = __commonJS({
|
|
|
2559
2563
|
var createNode = require_createNode();
|
|
2560
2564
|
var identity = require_identity();
|
|
2561
2565
|
var Node = require_Node();
|
|
2562
|
-
function collectionFromPath(schema,
|
|
2566
|
+
function collectionFromPath(schema, path73, value) {
|
|
2563
2567
|
let v = value;
|
|
2564
|
-
for (let i =
|
|
2565
|
-
const k =
|
|
2568
|
+
for (let i = path73.length - 1; i >= 0; --i) {
|
|
2569
|
+
const k = path73[i];
|
|
2566
2570
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2567
2571
|
const a = [];
|
|
2568
2572
|
a[k] = v;
|
|
@@ -2581,7 +2585,7 @@ var require_Collection = __commonJS({
|
|
|
2581
2585
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2582
2586
|
});
|
|
2583
2587
|
}
|
|
2584
|
-
var isEmptyPath = (
|
|
2588
|
+
var isEmptyPath = (path73) => path73 == null || typeof path73 === "object" && !!path73[Symbol.iterator]().next().done;
|
|
2585
2589
|
var Collection = class extends Node.NodeBase {
|
|
2586
2590
|
constructor(type, schema) {
|
|
2587
2591
|
super(type);
|
|
@@ -2611,11 +2615,11 @@ var require_Collection = __commonJS({
|
|
|
2611
2615
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2612
2616
|
* that already exists in the map.
|
|
2613
2617
|
*/
|
|
2614
|
-
addIn(
|
|
2615
|
-
if (isEmptyPath(
|
|
2618
|
+
addIn(path73, value) {
|
|
2619
|
+
if (isEmptyPath(path73))
|
|
2616
2620
|
this.add(value);
|
|
2617
2621
|
else {
|
|
2618
|
-
const [key, ...rest] =
|
|
2622
|
+
const [key, ...rest] = path73;
|
|
2619
2623
|
const node = this.get(key, true);
|
|
2620
2624
|
if (identity.isCollection(node))
|
|
2621
2625
|
node.addIn(rest, value);
|
|
@@ -2629,8 +2633,8 @@ var require_Collection = __commonJS({
|
|
|
2629
2633
|
* Removes a value from the collection.
|
|
2630
2634
|
* @returns `true` if the item was found and removed.
|
|
2631
2635
|
*/
|
|
2632
|
-
deleteIn(
|
|
2633
|
-
const [key, ...rest] =
|
|
2636
|
+
deleteIn(path73) {
|
|
2637
|
+
const [key, ...rest] = path73;
|
|
2634
2638
|
if (rest.length === 0)
|
|
2635
2639
|
return this.delete(key);
|
|
2636
2640
|
const node = this.get(key, true);
|
|
@@ -2644,8 +2648,8 @@ var require_Collection = __commonJS({
|
|
|
2644
2648
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2645
2649
|
* `true` (collections are always returned intact).
|
|
2646
2650
|
*/
|
|
2647
|
-
getIn(
|
|
2648
|
-
const [key, ...rest] =
|
|
2651
|
+
getIn(path73, keepScalar) {
|
|
2652
|
+
const [key, ...rest] = path73;
|
|
2649
2653
|
const node = this.get(key, true);
|
|
2650
2654
|
if (rest.length === 0)
|
|
2651
2655
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -2663,8 +2667,8 @@ var require_Collection = __commonJS({
|
|
|
2663
2667
|
/**
|
|
2664
2668
|
* Checks if the collection includes a value with the key `key`.
|
|
2665
2669
|
*/
|
|
2666
|
-
hasIn(
|
|
2667
|
-
const [key, ...rest] =
|
|
2670
|
+
hasIn(path73) {
|
|
2671
|
+
const [key, ...rest] = path73;
|
|
2668
2672
|
if (rest.length === 0)
|
|
2669
2673
|
return this.has(key);
|
|
2670
2674
|
const node = this.get(key, true);
|
|
@@ -2674,8 +2678,8 @@ var require_Collection = __commonJS({
|
|
|
2674
2678
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2675
2679
|
* boolean to add/remove the item from the set.
|
|
2676
2680
|
*/
|
|
2677
|
-
setIn(
|
|
2678
|
-
const [key, ...rest] =
|
|
2681
|
+
setIn(path73, value) {
|
|
2682
|
+
const [key, ...rest] = path73;
|
|
2679
2683
|
if (rest.length === 0) {
|
|
2680
2684
|
this.set(key, value);
|
|
2681
2685
|
} else {
|
|
@@ -2699,13 +2703,13 @@ var require_Collection = __commonJS({
|
|
|
2699
2703
|
var require_stringifyComment = __commonJS({
|
|
2700
2704
|
"node_modules/yaml/dist/stringify/stringifyComment.js"(exports) {
|
|
2701
2705
|
"use strict";
|
|
2702
|
-
var stringifyComment = (
|
|
2706
|
+
var stringifyComment = (str3) => str3.replace(/^(?!$)(?: $)?/gm, "#");
|
|
2703
2707
|
function indentComment(comment, indent) {
|
|
2704
2708
|
if (/^\n+$/.test(comment))
|
|
2705
2709
|
return comment.substring(1);
|
|
2706
2710
|
return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
|
|
2707
2711
|
}
|
|
2708
|
-
var lineComment = (
|
|
2712
|
+
var lineComment = (str3, indent, comment) => str3.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str3.endsWith(" ") ? "" : " ") + comment;
|
|
2709
2713
|
exports.indentComment = indentComment;
|
|
2710
2714
|
exports.lineComment = lineComment;
|
|
2711
2715
|
exports.stringifyComment = stringifyComment;
|
|
@@ -2859,16 +2863,16 @@ var require_stringifyString = __commonJS({
|
|
|
2859
2863
|
lineWidth: ctx.options.lineWidth,
|
|
2860
2864
|
minContentWidth: ctx.options.minContentWidth
|
|
2861
2865
|
});
|
|
2862
|
-
var containsDocumentMarker = (
|
|
2863
|
-
function lineLengthOverLimit(
|
|
2866
|
+
var containsDocumentMarker = (str3) => /^(%|---|\.\.\.)/m.test(str3);
|
|
2867
|
+
function lineLengthOverLimit(str3, lineWidth, indentLength) {
|
|
2864
2868
|
if (!lineWidth || lineWidth < 0)
|
|
2865
2869
|
return false;
|
|
2866
2870
|
const limit = lineWidth - indentLength;
|
|
2867
|
-
const strLen =
|
|
2871
|
+
const strLen = str3.length;
|
|
2868
2872
|
if (strLen <= limit)
|
|
2869
2873
|
return false;
|
|
2870
2874
|
for (let i = 0, start = 0; i < strLen; ++i) {
|
|
2871
|
-
if (
|
|
2875
|
+
if (str3[i] === "\n") {
|
|
2872
2876
|
if (i - start > limit)
|
|
2873
2877
|
return true;
|
|
2874
2878
|
start = i + 1;
|
|
@@ -2885,11 +2889,11 @@ var require_stringifyString = __commonJS({
|
|
|
2885
2889
|
const { implicitKey } = ctx;
|
|
2886
2890
|
const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
|
|
2887
2891
|
const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
|
|
2888
|
-
let
|
|
2892
|
+
let str3 = "";
|
|
2889
2893
|
let start = 0;
|
|
2890
2894
|
for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
|
|
2891
2895
|
if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
|
|
2892
|
-
|
|
2896
|
+
str3 += json.slice(start, i) + "\\ ";
|
|
2893
2897
|
i += 1;
|
|
2894
2898
|
start = i;
|
|
2895
2899
|
ch = "\\";
|
|
@@ -2898,38 +2902,38 @@ var require_stringifyString = __commonJS({
|
|
|
2898
2902
|
switch (json[i + 1]) {
|
|
2899
2903
|
case "u":
|
|
2900
2904
|
{
|
|
2901
|
-
|
|
2905
|
+
str3 += json.slice(start, i);
|
|
2902
2906
|
const code = json.substr(i + 2, 4);
|
|
2903
2907
|
switch (code) {
|
|
2904
2908
|
case "0000":
|
|
2905
|
-
|
|
2909
|
+
str3 += "\\0";
|
|
2906
2910
|
break;
|
|
2907
2911
|
case "0007":
|
|
2908
|
-
|
|
2912
|
+
str3 += "\\a";
|
|
2909
2913
|
break;
|
|
2910
2914
|
case "000b":
|
|
2911
|
-
|
|
2915
|
+
str3 += "\\v";
|
|
2912
2916
|
break;
|
|
2913
2917
|
case "001b":
|
|
2914
|
-
|
|
2918
|
+
str3 += "\\e";
|
|
2915
2919
|
break;
|
|
2916
2920
|
case "0085":
|
|
2917
|
-
|
|
2921
|
+
str3 += "\\N";
|
|
2918
2922
|
break;
|
|
2919
2923
|
case "00a0":
|
|
2920
|
-
|
|
2924
|
+
str3 += "\\_";
|
|
2921
2925
|
break;
|
|
2922
2926
|
case "2028":
|
|
2923
|
-
|
|
2927
|
+
str3 += "\\L";
|
|
2924
2928
|
break;
|
|
2925
2929
|
case "2029":
|
|
2926
|
-
|
|
2930
|
+
str3 += "\\P";
|
|
2927
2931
|
break;
|
|
2928
2932
|
default:
|
|
2929
2933
|
if (code.substr(0, 2) === "00")
|
|
2930
|
-
|
|
2934
|
+
str3 += "\\x" + code.substr(2);
|
|
2931
2935
|
else
|
|
2932
|
-
|
|
2936
|
+
str3 += json.substr(i, 6);
|
|
2933
2937
|
}
|
|
2934
2938
|
i += 5;
|
|
2935
2939
|
start = i + 1;
|
|
@@ -2939,14 +2943,14 @@ var require_stringifyString = __commonJS({
|
|
|
2939
2943
|
if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
|
|
2940
2944
|
i += 1;
|
|
2941
2945
|
} else {
|
|
2942
|
-
|
|
2946
|
+
str3 += json.slice(start, i) + "\n\n";
|
|
2943
2947
|
while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
|
|
2944
|
-
|
|
2948
|
+
str3 += "\n";
|
|
2945
2949
|
i += 2;
|
|
2946
2950
|
}
|
|
2947
|
-
|
|
2951
|
+
str3 += indent;
|
|
2948
2952
|
if (json[i + 2] === " ")
|
|
2949
|
-
|
|
2953
|
+
str3 += "\\";
|
|
2950
2954
|
i += 1;
|
|
2951
2955
|
start = i + 1;
|
|
2952
2956
|
}
|
|
@@ -2955,8 +2959,8 @@ var require_stringifyString = __commonJS({
|
|
|
2955
2959
|
i += 1;
|
|
2956
2960
|
}
|
|
2957
2961
|
}
|
|
2958
|
-
|
|
2959
|
-
return implicitKey ?
|
|
2962
|
+
str3 = start ? str3 + json.slice(start) : json;
|
|
2963
|
+
return implicitKey ? str3 : foldFlowLines.foldFlowLines(str3, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
|
|
2960
2964
|
}
|
|
2961
2965
|
function singleQuotedString(value, ctx) {
|
|
2962
2966
|
if (ctx.options.singleQuote === false || ctx.implicitKey && value.includes("\n") || /[ \t]\n|\n[ \t]/.test(value))
|
|
@@ -3084,15 +3088,15 @@ ${indent}${start}${value}${end}`;
|
|
|
3084
3088
|
return quotedString(value, ctx);
|
|
3085
3089
|
}
|
|
3086
3090
|
}
|
|
3087
|
-
const
|
|
3091
|
+
const str3 = value.replace(/\n+/g, `$&
|
|
3088
3092
|
${indent}`);
|
|
3089
3093
|
if (actualString) {
|
|
3090
|
-
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(
|
|
3094
|
+
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str3);
|
|
3091
3095
|
const { compat, tags } = ctx.doc.schema;
|
|
3092
3096
|
if (tags.some(test) || compat?.some(test))
|
|
3093
3097
|
return quotedString(value, ctx);
|
|
3094
3098
|
}
|
|
3095
|
-
return implicitKey ?
|
|
3099
|
+
return implicitKey ? str3 : foldFlowLines.foldFlowLines(str3, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
3096
3100
|
}
|
|
3097
3101
|
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
3098
3102
|
const { implicitKey, inFlow } = ctx;
|
|
@@ -3244,11 +3248,11 @@ var require_stringify = __commonJS({
|
|
|
3244
3248
|
const props = stringifyProps(node, tagObj, ctx);
|
|
3245
3249
|
if (props.length > 0)
|
|
3246
3250
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
3247
|
-
const
|
|
3251
|
+
const str3 = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
|
|
3248
3252
|
if (!props)
|
|
3249
|
-
return
|
|
3250
|
-
return identity.isScalar(node) ||
|
|
3251
|
-
${ctx.indent}${
|
|
3253
|
+
return str3;
|
|
3254
|
+
return identity.isScalar(node) || str3[0] === "{" || str3[0] === "[" ? `${props} ${str3}` : `${props}
|
|
3255
|
+
${ctx.indent}${str3}`;
|
|
3252
3256
|
}
|
|
3253
3257
|
exports.createStringifyContext = createStringifyContext;
|
|
3254
3258
|
exports.stringify = stringify;
|
|
@@ -3283,8 +3287,8 @@ var require_stringifyPair = __commonJS({
|
|
|
3283
3287
|
});
|
|
3284
3288
|
let keyCommentDone = false;
|
|
3285
3289
|
let chompKeep = false;
|
|
3286
|
-
let
|
|
3287
|
-
if (!explicitKey && !ctx.inFlow &&
|
|
3290
|
+
let str3 = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
|
|
3291
|
+
if (!explicitKey && !ctx.inFlow && str3.length > 1024) {
|
|
3288
3292
|
if (simpleKeys)
|
|
3289
3293
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
3290
3294
|
explicitKey = true;
|
|
@@ -3293,27 +3297,27 @@ var require_stringifyPair = __commonJS({
|
|
|
3293
3297
|
if (allNullValues || value == null) {
|
|
3294
3298
|
if (keyCommentDone && onComment)
|
|
3295
3299
|
onComment();
|
|
3296
|
-
return
|
|
3300
|
+
return str3 === "" ? "?" : explicitKey ? `? ${str3}` : str3;
|
|
3297
3301
|
}
|
|
3298
3302
|
} else if (allNullValues && !simpleKeys || value == null && explicitKey) {
|
|
3299
|
-
|
|
3303
|
+
str3 = `? ${str3}`;
|
|
3300
3304
|
if (keyComment && !keyCommentDone) {
|
|
3301
|
-
|
|
3305
|
+
str3 += stringifyComment.lineComment(str3, ctx.indent, commentString(keyComment));
|
|
3302
3306
|
} else if (chompKeep && onChompKeep)
|
|
3303
3307
|
onChompKeep();
|
|
3304
|
-
return
|
|
3308
|
+
return str3;
|
|
3305
3309
|
}
|
|
3306
3310
|
if (keyCommentDone)
|
|
3307
3311
|
keyComment = null;
|
|
3308
3312
|
if (explicitKey) {
|
|
3309
3313
|
if (keyComment)
|
|
3310
|
-
|
|
3311
|
-
|
|
3314
|
+
str3 += stringifyComment.lineComment(str3, ctx.indent, commentString(keyComment));
|
|
3315
|
+
str3 = `? ${str3}
|
|
3312
3316
|
${indent}:`;
|
|
3313
3317
|
} else {
|
|
3314
|
-
|
|
3318
|
+
str3 = `${str3}:`;
|
|
3315
3319
|
if (keyComment)
|
|
3316
|
-
|
|
3320
|
+
str3 += stringifyComment.lineComment(str3, ctx.indent, commentString(keyComment));
|
|
3317
3321
|
}
|
|
3318
3322
|
let vsb, vcb, valueComment;
|
|
3319
3323
|
if (identity.isNode(value)) {
|
|
@@ -3329,7 +3333,7 @@ ${indent}:`;
|
|
|
3329
3333
|
}
|
|
3330
3334
|
ctx.implicitKey = false;
|
|
3331
3335
|
if (!explicitKey && !keyComment && identity.isScalar(value))
|
|
3332
|
-
ctx.indentAtStart =
|
|
3336
|
+
ctx.indentAtStart = str3.length + 1;
|
|
3333
3337
|
chompKeep = false;
|
|
3334
3338
|
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity.isSeq(value) && !value.flow && !value.tag && !value.anchor) {
|
|
3335
3339
|
ctx.indent = ctx.indent.substring(2);
|
|
@@ -3373,16 +3377,16 @@ ${ctx.indent}`;
|
|
|
3373
3377
|
} else if (valueStr === "" || valueStr[0] === "\n") {
|
|
3374
3378
|
ws = "";
|
|
3375
3379
|
}
|
|
3376
|
-
|
|
3380
|
+
str3 += ws + valueStr;
|
|
3377
3381
|
if (ctx.inFlow) {
|
|
3378
3382
|
if (valueCommentDone && onComment)
|
|
3379
3383
|
onComment();
|
|
3380
3384
|
} else if (valueComment && !valueCommentDone) {
|
|
3381
|
-
|
|
3385
|
+
str3 += stringifyComment.lineComment(str3, ctx.indent, commentString(valueComment));
|
|
3382
3386
|
} else if (chompKeep && onChompKeep) {
|
|
3383
3387
|
onChompKeep();
|
|
3384
3388
|
}
|
|
3385
|
-
return
|
|
3389
|
+
return str3;
|
|
3386
3390
|
}
|
|
3387
3391
|
exports.stringifyPair = stringifyPair;
|
|
3388
3392
|
}
|
|
@@ -3609,31 +3613,31 @@ var require_stringifyCollection = __commonJS({
|
|
|
3609
3613
|
}
|
|
3610
3614
|
}
|
|
3611
3615
|
chompKeep = false;
|
|
3612
|
-
let
|
|
3616
|
+
let str4 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
|
|
3613
3617
|
if (comment2)
|
|
3614
|
-
|
|
3618
|
+
str4 += stringifyComment.lineComment(str4, itemIndent, commentString(comment2));
|
|
3615
3619
|
if (chompKeep && comment2)
|
|
3616
3620
|
chompKeep = false;
|
|
3617
|
-
lines.push(blockItemPrefix +
|
|
3621
|
+
lines.push(blockItemPrefix + str4);
|
|
3618
3622
|
}
|
|
3619
|
-
let
|
|
3623
|
+
let str3;
|
|
3620
3624
|
if (lines.length === 0) {
|
|
3621
|
-
|
|
3625
|
+
str3 = flowChars.start + flowChars.end;
|
|
3622
3626
|
} else {
|
|
3623
|
-
|
|
3627
|
+
str3 = lines[0];
|
|
3624
3628
|
for (let i = 1; i < lines.length; ++i) {
|
|
3625
3629
|
const line = lines[i];
|
|
3626
|
-
|
|
3630
|
+
str3 += line ? `
|
|
3627
3631
|
${indent}${line}` : "\n";
|
|
3628
3632
|
}
|
|
3629
3633
|
}
|
|
3630
3634
|
if (comment) {
|
|
3631
|
-
|
|
3635
|
+
str3 += "\n" + stringifyComment.indentComment(commentString(comment), indent);
|
|
3632
3636
|
if (onComment)
|
|
3633
3637
|
onComment();
|
|
3634
3638
|
} else if (chompKeep && onChompKeep)
|
|
3635
3639
|
onChompKeep();
|
|
3636
|
-
return
|
|
3640
|
+
return str3;
|
|
3637
3641
|
}
|
|
3638
3642
|
function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
|
|
3639
3643
|
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
|
|
@@ -3676,21 +3680,21 @@ ${indent}${line}` : "\n";
|
|
|
3676
3680
|
}
|
|
3677
3681
|
if (comment)
|
|
3678
3682
|
reqNewline = true;
|
|
3679
|
-
let
|
|
3680
|
-
reqNewline || (reqNewline = lines.length > linesAtValue ||
|
|
3683
|
+
let str3 = stringify.stringify(item, itemCtx, () => comment = null);
|
|
3684
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str3.includes("\n"));
|
|
3681
3685
|
if (i < items.length - 1) {
|
|
3682
|
-
|
|
3686
|
+
str3 += ",";
|
|
3683
3687
|
} else if (ctx.options.trailingComma) {
|
|
3684
3688
|
if (ctx.options.lineWidth > 0) {
|
|
3685
|
-
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (
|
|
3689
|
+
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str3.length + 2) > ctx.options.lineWidth);
|
|
3686
3690
|
}
|
|
3687
3691
|
if (reqNewline) {
|
|
3688
|
-
|
|
3692
|
+
str3 += ",";
|
|
3689
3693
|
}
|
|
3690
3694
|
}
|
|
3691
3695
|
if (comment)
|
|
3692
|
-
|
|
3693
|
-
lines.push(
|
|
3696
|
+
str3 += stringifyComment.lineComment(str3, itemIndent, commentString(comment));
|
|
3697
|
+
lines.push(str3);
|
|
3694
3698
|
linesAtValue = lines.length;
|
|
3695
3699
|
}
|
|
3696
3700
|
const { start, end } = flowChars;
|
|
@@ -3702,11 +3706,11 @@ ${indent}${line}` : "\n";
|
|
|
3702
3706
|
reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
|
|
3703
3707
|
}
|
|
3704
3708
|
if (reqNewline) {
|
|
3705
|
-
let
|
|
3709
|
+
let str3 = start;
|
|
3706
3710
|
for (const line of lines)
|
|
3707
|
-
|
|
3711
|
+
str3 += line ? `
|
|
3708
3712
|
${indentStep}${indent}${line}` : "\n";
|
|
3709
|
-
return `${
|
|
3713
|
+
return `${str3}
|
|
3710
3714
|
${indent}${end}`;
|
|
3711
3715
|
} else {
|
|
3712
3716
|
return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
|
|
@@ -4038,7 +4042,7 @@ var require_string = __commonJS({
|
|
|
4038
4042
|
identify: (value) => typeof value === "string",
|
|
4039
4043
|
default: true,
|
|
4040
4044
|
tag: "tag:yaml.org,2002:str",
|
|
4041
|
-
resolve: (
|
|
4045
|
+
resolve: (str3) => str3,
|
|
4042
4046
|
stringify(item, ctx, onComment, onChompKeep) {
|
|
4043
4047
|
ctx = Object.assign({ actualString: true }, ctx);
|
|
4044
4048
|
return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
|
|
@@ -4076,7 +4080,7 @@ var require_bool = __commonJS({
|
|
|
4076
4080
|
default: true,
|
|
4077
4081
|
tag: "tag:yaml.org,2002:bool",
|
|
4078
4082
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
4079
|
-
resolve: (
|
|
4083
|
+
resolve: (str3) => new Scalar.Scalar(str3[0] === "t" || str3[0] === "T"),
|
|
4080
4084
|
stringify({ source, value }, ctx) {
|
|
4081
4085
|
if (source && boolTag.test.test(source)) {
|
|
4082
4086
|
const sv = source[0] === "t" || source[0] === "T";
|
|
@@ -4128,7 +4132,7 @@ var require_float = __commonJS({
|
|
|
4128
4132
|
default: true,
|
|
4129
4133
|
tag: "tag:yaml.org,2002:float",
|
|
4130
4134
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
4131
|
-
resolve: (
|
|
4135
|
+
resolve: (str3) => str3.slice(-3).toLowerCase() === "nan" ? NaN : str3[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
4132
4136
|
stringify: stringifyNumber.stringifyNumber
|
|
4133
4137
|
};
|
|
4134
4138
|
var floatExp = {
|
|
@@ -4137,7 +4141,7 @@ var require_float = __commonJS({
|
|
|
4137
4141
|
tag: "tag:yaml.org,2002:float",
|
|
4138
4142
|
format: "EXP",
|
|
4139
4143
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
|
4140
|
-
resolve: (
|
|
4144
|
+
resolve: (str3) => parseFloat(str3),
|
|
4141
4145
|
stringify(node) {
|
|
4142
4146
|
const num = Number(node.value);
|
|
4143
4147
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
@@ -4148,11 +4152,11 @@ var require_float = __commonJS({
|
|
|
4148
4152
|
default: true,
|
|
4149
4153
|
tag: "tag:yaml.org,2002:float",
|
|
4150
4154
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
4151
|
-
resolve(
|
|
4152
|
-
const node = new Scalar.Scalar(parseFloat(
|
|
4153
|
-
const dot =
|
|
4154
|
-
if (dot !== -1 &&
|
|
4155
|
-
node.minFractionDigits =
|
|
4155
|
+
resolve(str3) {
|
|
4156
|
+
const node = new Scalar.Scalar(parseFloat(str3));
|
|
4157
|
+
const dot = str3.indexOf(".");
|
|
4158
|
+
if (dot !== -1 && str3[str3.length - 1] === "0")
|
|
4159
|
+
node.minFractionDigits = str3.length - dot - 1;
|
|
4156
4160
|
return node;
|
|
4157
4161
|
},
|
|
4158
4162
|
stringify: stringifyNumber.stringifyNumber
|
|
@@ -4169,7 +4173,7 @@ var require_int = __commonJS({
|
|
|
4169
4173
|
"use strict";
|
|
4170
4174
|
var stringifyNumber = require_stringifyNumber();
|
|
4171
4175
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
4172
|
-
var intResolve = (
|
|
4176
|
+
var intResolve = (str3, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str3) : parseInt(str3.substring(offset), radix);
|
|
4173
4177
|
function intStringify(node, radix, prefix) {
|
|
4174
4178
|
const { value } = node;
|
|
4175
4179
|
if (intIdentify(value) && value >= 0)
|
|
@@ -4182,7 +4186,7 @@ var require_int = __commonJS({
|
|
|
4182
4186
|
tag: "tag:yaml.org,2002:int",
|
|
4183
4187
|
format: "OCT",
|
|
4184
4188
|
test: /^0o[0-7]+$/,
|
|
4185
|
-
resolve: (
|
|
4189
|
+
resolve: (str3, _onError, opt) => intResolve(str3, 2, 8, opt),
|
|
4186
4190
|
stringify: (node) => intStringify(node, 8, "0o")
|
|
4187
4191
|
};
|
|
4188
4192
|
var int = {
|
|
@@ -4190,7 +4194,7 @@ var require_int = __commonJS({
|
|
|
4190
4194
|
default: true,
|
|
4191
4195
|
tag: "tag:yaml.org,2002:int",
|
|
4192
4196
|
test: /^[-+]?[0-9]+$/,
|
|
4193
|
-
resolve: (
|
|
4197
|
+
resolve: (str3, _onError, opt) => intResolve(str3, 0, 10, opt),
|
|
4194
4198
|
stringify: stringifyNumber.stringifyNumber
|
|
4195
4199
|
};
|
|
4196
4200
|
var intHex = {
|
|
@@ -4199,7 +4203,7 @@ var require_int = __commonJS({
|
|
|
4199
4203
|
tag: "tag:yaml.org,2002:int",
|
|
4200
4204
|
format: "HEX",
|
|
4201
4205
|
test: /^0x[0-9a-fA-F]+$/,
|
|
4202
|
-
resolve: (
|
|
4206
|
+
resolve: (str3, _onError, opt) => intResolve(str3, 2, 16, opt),
|
|
4203
4207
|
stringify: (node) => intStringify(node, 16, "0x")
|
|
4204
4208
|
};
|
|
4205
4209
|
exports.int = int;
|
|
@@ -4252,7 +4256,7 @@ var require_schema2 = __commonJS({
|
|
|
4252
4256
|
identify: (value) => typeof value === "string",
|
|
4253
4257
|
default: true,
|
|
4254
4258
|
tag: "tag:yaml.org,2002:str",
|
|
4255
|
-
resolve: (
|
|
4259
|
+
resolve: (str3) => str3,
|
|
4256
4260
|
stringify: stringifyJSON
|
|
4257
4261
|
},
|
|
4258
4262
|
{
|
|
@@ -4269,7 +4273,7 @@ var require_schema2 = __commonJS({
|
|
|
4269
4273
|
default: true,
|
|
4270
4274
|
tag: "tag:yaml.org,2002:bool",
|
|
4271
4275
|
test: /^true$|^false$/,
|
|
4272
|
-
resolve: (
|
|
4276
|
+
resolve: (str3) => str3 === "true",
|
|
4273
4277
|
stringify: stringifyJSON
|
|
4274
4278
|
},
|
|
4275
4279
|
{
|
|
@@ -4277,7 +4281,7 @@ var require_schema2 = __commonJS({
|
|
|
4277
4281
|
default: true,
|
|
4278
4282
|
tag: "tag:yaml.org,2002:int",
|
|
4279
4283
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
4280
|
-
resolve: (
|
|
4284
|
+
resolve: (str3, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str3) : parseInt(str3, 10),
|
|
4281
4285
|
stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)
|
|
4282
4286
|
},
|
|
4283
4287
|
{
|
|
@@ -4285,7 +4289,7 @@ var require_schema2 = __commonJS({
|
|
|
4285
4289
|
default: true,
|
|
4286
4290
|
tag: "tag:yaml.org,2002:float",
|
|
4287
4291
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
4288
|
-
resolve: (
|
|
4292
|
+
resolve: (str3) => parseFloat(str3),
|
|
4289
4293
|
stringify: stringifyJSON
|
|
4290
4294
|
}
|
|
4291
4295
|
];
|
|
@@ -4293,9 +4297,9 @@ var require_schema2 = __commonJS({
|
|
|
4293
4297
|
default: true,
|
|
4294
4298
|
tag: "",
|
|
4295
4299
|
test: /^/,
|
|
4296
|
-
resolve(
|
|
4297
|
-
onError(`Unresolved plain scalar ${JSON.stringify(
|
|
4298
|
-
return
|
|
4300
|
+
resolve(str3, onError) {
|
|
4301
|
+
onError(`Unresolved plain scalar ${JSON.stringify(str3)}`);
|
|
4302
|
+
return str3;
|
|
4299
4303
|
}
|
|
4300
4304
|
};
|
|
4301
4305
|
var schema = [map.map, seq.seq].concat(jsonScalars, jsonError);
|
|
@@ -4327,10 +4331,10 @@ var require_binary = __commonJS({
|
|
|
4327
4331
|
if (typeof node_buffer.Buffer === "function") {
|
|
4328
4332
|
return node_buffer.Buffer.from(src, "base64");
|
|
4329
4333
|
} else if (typeof atob === "function") {
|
|
4330
|
-
const
|
|
4331
|
-
const buffer = new Uint8Array(
|
|
4332
|
-
for (let i = 0; i <
|
|
4333
|
-
buffer[i] =
|
|
4334
|
+
const str3 = atob(src.replace(/[\n\r]/g, ""));
|
|
4335
|
+
const buffer = new Uint8Array(str3.length);
|
|
4336
|
+
for (let i = 0; i < str3.length; ++i)
|
|
4337
|
+
buffer[i] = str3.charCodeAt(i);
|
|
4334
4338
|
return buffer;
|
|
4335
4339
|
} else {
|
|
4336
4340
|
onError("This environment does not support reading binary tags; either Buffer or atob is required");
|
|
@@ -4341,28 +4345,28 @@ var require_binary = __commonJS({
|
|
|
4341
4345
|
if (!value)
|
|
4342
4346
|
return "";
|
|
4343
4347
|
const buf = value;
|
|
4344
|
-
let
|
|
4348
|
+
let str3;
|
|
4345
4349
|
if (typeof node_buffer.Buffer === "function") {
|
|
4346
|
-
|
|
4350
|
+
str3 = buf instanceof node_buffer.Buffer ? buf.toString("base64") : node_buffer.Buffer.from(buf.buffer).toString("base64");
|
|
4347
4351
|
} else if (typeof btoa === "function") {
|
|
4348
4352
|
let s = "";
|
|
4349
4353
|
for (let i = 0; i < buf.length; ++i)
|
|
4350
4354
|
s += String.fromCharCode(buf[i]);
|
|
4351
|
-
|
|
4355
|
+
str3 = btoa(s);
|
|
4352
4356
|
} else {
|
|
4353
4357
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
4354
4358
|
}
|
|
4355
4359
|
type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
|
|
4356
4360
|
if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
|
|
4357
4361
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
4358
|
-
const n = Math.ceil(
|
|
4362
|
+
const n = Math.ceil(str3.length / lineWidth);
|
|
4359
4363
|
const lines = new Array(n);
|
|
4360
4364
|
for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
|
|
4361
|
-
lines[i] =
|
|
4365
|
+
lines[i] = str3.substr(o, lineWidth);
|
|
4362
4366
|
}
|
|
4363
|
-
|
|
4367
|
+
str3 = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " ");
|
|
4364
4368
|
}
|
|
4365
|
-
return stringifyString.stringifyString({ comment, type, value:
|
|
4369
|
+
return stringifyString.stringifyString({ comment, type, value: str3 }, ctx, onComment, onChompKeep);
|
|
4366
4370
|
}
|
|
4367
4371
|
};
|
|
4368
4372
|
exports.binary = binary;
|
|
@@ -4568,7 +4572,7 @@ var require_float2 = __commonJS({
|
|
|
4568
4572
|
default: true,
|
|
4569
4573
|
tag: "tag:yaml.org,2002:float",
|
|
4570
4574
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
4571
|
-
resolve: (
|
|
4575
|
+
resolve: (str3) => str3.slice(-3).toLowerCase() === "nan" ? NaN : str3[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
4572
4576
|
stringify: stringifyNumber.stringifyNumber
|
|
4573
4577
|
};
|
|
4574
4578
|
var floatExp = {
|
|
@@ -4577,7 +4581,7 @@ var require_float2 = __commonJS({
|
|
|
4577
4581
|
tag: "tag:yaml.org,2002:float",
|
|
4578
4582
|
format: "EXP",
|
|
4579
4583
|
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
|
4580
|
-
resolve: (
|
|
4584
|
+
resolve: (str3) => parseFloat(str3.replace(/_/g, "")),
|
|
4581
4585
|
stringify(node) {
|
|
4582
4586
|
const num = Number(node.value);
|
|
4583
4587
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
@@ -4588,11 +4592,11 @@ var require_float2 = __commonJS({
|
|
|
4588
4592
|
default: true,
|
|
4589
4593
|
tag: "tag:yaml.org,2002:float",
|
|
4590
4594
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
4591
|
-
resolve(
|
|
4592
|
-
const node = new Scalar.Scalar(parseFloat(
|
|
4593
|
-
const dot =
|
|
4595
|
+
resolve(str3) {
|
|
4596
|
+
const node = new Scalar.Scalar(parseFloat(str3.replace(/_/g, "")));
|
|
4597
|
+
const dot = str3.indexOf(".");
|
|
4594
4598
|
if (dot !== -1) {
|
|
4595
|
-
const f =
|
|
4599
|
+
const f = str3.substring(dot + 1).replace(/_/g, "");
|
|
4596
4600
|
if (f[f.length - 1] === "0")
|
|
4597
4601
|
node.minFractionDigits = f.length;
|
|
4598
4602
|
}
|
|
@@ -4612,34 +4616,34 @@ var require_int2 = __commonJS({
|
|
|
4612
4616
|
"use strict";
|
|
4613
4617
|
var stringifyNumber = require_stringifyNumber();
|
|
4614
4618
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
4615
|
-
function intResolve(
|
|
4616
|
-
const sign =
|
|
4619
|
+
function intResolve(str3, offset, radix, { intAsBigInt }) {
|
|
4620
|
+
const sign = str3[0];
|
|
4617
4621
|
if (sign === "-" || sign === "+")
|
|
4618
4622
|
offset += 1;
|
|
4619
|
-
|
|
4623
|
+
str3 = str3.substring(offset).replace(/_/g, "");
|
|
4620
4624
|
if (intAsBigInt) {
|
|
4621
4625
|
switch (radix) {
|
|
4622
4626
|
case 2:
|
|
4623
|
-
|
|
4627
|
+
str3 = `0b${str3}`;
|
|
4624
4628
|
break;
|
|
4625
4629
|
case 8:
|
|
4626
|
-
|
|
4630
|
+
str3 = `0o${str3}`;
|
|
4627
4631
|
break;
|
|
4628
4632
|
case 16:
|
|
4629
|
-
|
|
4633
|
+
str3 = `0x${str3}`;
|
|
4630
4634
|
break;
|
|
4631
4635
|
}
|
|
4632
|
-
const n2 = BigInt(
|
|
4636
|
+
const n2 = BigInt(str3);
|
|
4633
4637
|
return sign === "-" ? BigInt(-1) * n2 : n2;
|
|
4634
4638
|
}
|
|
4635
|
-
const n = parseInt(
|
|
4639
|
+
const n = parseInt(str3, radix);
|
|
4636
4640
|
return sign === "-" ? -1 * n : n;
|
|
4637
4641
|
}
|
|
4638
4642
|
function intStringify(node, radix, prefix) {
|
|
4639
4643
|
const { value } = node;
|
|
4640
4644
|
if (intIdentify(value)) {
|
|
4641
|
-
const
|
|
4642
|
-
return value < 0 ? "-" + prefix +
|
|
4645
|
+
const str3 = value.toString(radix);
|
|
4646
|
+
return value < 0 ? "-" + prefix + str3.substr(1) : prefix + str3;
|
|
4643
4647
|
}
|
|
4644
4648
|
return stringifyNumber.stringifyNumber(node);
|
|
4645
4649
|
}
|
|
@@ -4649,7 +4653,7 @@ var require_int2 = __commonJS({
|
|
|
4649
4653
|
tag: "tag:yaml.org,2002:int",
|
|
4650
4654
|
format: "BIN",
|
|
4651
4655
|
test: /^[-+]?0b[0-1_]+$/,
|
|
4652
|
-
resolve: (
|
|
4656
|
+
resolve: (str3, _onError, opt) => intResolve(str3, 2, 2, opt),
|
|
4653
4657
|
stringify: (node) => intStringify(node, 2, "0b")
|
|
4654
4658
|
};
|
|
4655
4659
|
var intOct = {
|
|
@@ -4658,7 +4662,7 @@ var require_int2 = __commonJS({
|
|
|
4658
4662
|
tag: "tag:yaml.org,2002:int",
|
|
4659
4663
|
format: "OCT",
|
|
4660
4664
|
test: /^[-+]?0[0-7_]+$/,
|
|
4661
|
-
resolve: (
|
|
4665
|
+
resolve: (str3, _onError, opt) => intResolve(str3, 1, 8, opt),
|
|
4662
4666
|
stringify: (node) => intStringify(node, 8, "0")
|
|
4663
4667
|
};
|
|
4664
4668
|
var int = {
|
|
@@ -4666,7 +4670,7 @@ var require_int2 = __commonJS({
|
|
|
4666
4670
|
default: true,
|
|
4667
4671
|
tag: "tag:yaml.org,2002:int",
|
|
4668
4672
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
4669
|
-
resolve: (
|
|
4673
|
+
resolve: (str3, _onError, opt) => intResolve(str3, 0, 10, opt),
|
|
4670
4674
|
stringify: stringifyNumber.stringifyNumber
|
|
4671
4675
|
};
|
|
4672
4676
|
var intHex = {
|
|
@@ -4675,7 +4679,7 @@ var require_int2 = __commonJS({
|
|
|
4675
4679
|
tag: "tag:yaml.org,2002:int",
|
|
4676
4680
|
format: "HEX",
|
|
4677
4681
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
4678
|
-
resolve: (
|
|
4682
|
+
resolve: (str3, _onError, opt) => intResolve(str3, 2, 16, opt),
|
|
4679
4683
|
stringify: (node) => intStringify(node, 16, "0x")
|
|
4680
4684
|
};
|
|
4681
4685
|
exports.int = int;
|
|
@@ -4779,9 +4783,9 @@ var require_timestamp = __commonJS({
|
|
|
4779
4783
|
"node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports) {
|
|
4780
4784
|
"use strict";
|
|
4781
4785
|
var stringifyNumber = require_stringifyNumber();
|
|
4782
|
-
function parseSexagesimal(
|
|
4783
|
-
const sign =
|
|
4784
|
-
const parts = sign === "-" || sign === "+" ?
|
|
4786
|
+
function parseSexagesimal(str3, asBigInt) {
|
|
4787
|
+
const sign = str3[0];
|
|
4788
|
+
const parts = sign === "-" || sign === "+" ? str3.substring(1) : str3;
|
|
4785
4789
|
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
4786
4790
|
const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0));
|
|
4787
4791
|
return sign === "-" ? num(-1) * res : res;
|
|
@@ -4818,7 +4822,7 @@ var require_timestamp = __commonJS({
|
|
|
4818
4822
|
tag: "tag:yaml.org,2002:int",
|
|
4819
4823
|
format: "TIME",
|
|
4820
4824
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
4821
|
-
resolve: (
|
|
4825
|
+
resolve: (str3, _onError, { intAsBigInt }) => parseSexagesimal(str3, intAsBigInt),
|
|
4822
4826
|
stringify: stringifySexagesimal
|
|
4823
4827
|
};
|
|
4824
4828
|
var floatTime = {
|
|
@@ -4827,7 +4831,7 @@ var require_timestamp = __commonJS({
|
|
|
4827
4831
|
tag: "tag:yaml.org,2002:float",
|
|
4828
4832
|
format: "TIME",
|
|
4829
4833
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
4830
|
-
resolve: (
|
|
4834
|
+
resolve: (str3) => parseSexagesimal(str3, false),
|
|
4831
4835
|
stringify: stringifySexagesimal
|
|
4832
4836
|
};
|
|
4833
4837
|
var timestamp = {
|
|
@@ -4838,8 +4842,8 @@ var require_timestamp = __commonJS({
|
|
|
4838
4842
|
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
|
4839
4843
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
4840
4844
|
test: RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),
|
|
4841
|
-
resolve(
|
|
4842
|
-
const match =
|
|
4845
|
+
resolve(str3) {
|
|
4846
|
+
const match = str3.match(timestamp.test);
|
|
4843
4847
|
if (!match)
|
|
4844
4848
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
4845
4849
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
@@ -5190,9 +5194,9 @@ var require_Document = __commonJS({
|
|
|
5190
5194
|
this.contents.add(value);
|
|
5191
5195
|
}
|
|
5192
5196
|
/** Adds a value to the document. */
|
|
5193
|
-
addIn(
|
|
5197
|
+
addIn(path73, value) {
|
|
5194
5198
|
if (assertCollection(this.contents))
|
|
5195
|
-
this.contents.addIn(
|
|
5199
|
+
this.contents.addIn(path73, value);
|
|
5196
5200
|
}
|
|
5197
5201
|
/**
|
|
5198
5202
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -5267,14 +5271,14 @@ var require_Document = __commonJS({
|
|
|
5267
5271
|
* Removes a value from the document.
|
|
5268
5272
|
* @returns `true` if the item was found and removed.
|
|
5269
5273
|
*/
|
|
5270
|
-
deleteIn(
|
|
5271
|
-
if (Collection.isEmptyPath(
|
|
5274
|
+
deleteIn(path73) {
|
|
5275
|
+
if (Collection.isEmptyPath(path73)) {
|
|
5272
5276
|
if (this.contents == null)
|
|
5273
5277
|
return false;
|
|
5274
5278
|
this.contents = null;
|
|
5275
5279
|
return true;
|
|
5276
5280
|
}
|
|
5277
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
5281
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path73) : false;
|
|
5278
5282
|
}
|
|
5279
5283
|
/**
|
|
5280
5284
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -5289,10 +5293,10 @@ var require_Document = __commonJS({
|
|
|
5289
5293
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5290
5294
|
* `true` (collections are always returned intact).
|
|
5291
5295
|
*/
|
|
5292
|
-
getIn(
|
|
5293
|
-
if (Collection.isEmptyPath(
|
|
5296
|
+
getIn(path73, keepScalar) {
|
|
5297
|
+
if (Collection.isEmptyPath(path73))
|
|
5294
5298
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
5295
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
5299
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path73, keepScalar) : void 0;
|
|
5296
5300
|
}
|
|
5297
5301
|
/**
|
|
5298
5302
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -5303,10 +5307,10 @@ var require_Document = __commonJS({
|
|
|
5303
5307
|
/**
|
|
5304
5308
|
* Checks if the document includes a value at `path`.
|
|
5305
5309
|
*/
|
|
5306
|
-
hasIn(
|
|
5307
|
-
if (Collection.isEmptyPath(
|
|
5310
|
+
hasIn(path73) {
|
|
5311
|
+
if (Collection.isEmptyPath(path73))
|
|
5308
5312
|
return this.contents !== void 0;
|
|
5309
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
5313
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path73) : false;
|
|
5310
5314
|
}
|
|
5311
5315
|
/**
|
|
5312
5316
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -5323,13 +5327,13 @@ var require_Document = __commonJS({
|
|
|
5323
5327
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
5324
5328
|
* boolean to add/remove the item from the set.
|
|
5325
5329
|
*/
|
|
5326
|
-
setIn(
|
|
5327
|
-
if (Collection.isEmptyPath(
|
|
5330
|
+
setIn(path73, value) {
|
|
5331
|
+
if (Collection.isEmptyPath(path73)) {
|
|
5328
5332
|
this.contents = value;
|
|
5329
5333
|
} else if (this.contents == null) {
|
|
5330
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
5334
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path73), value);
|
|
5331
5335
|
} else if (assertCollection(this.contents)) {
|
|
5332
|
-
this.contents.setIn(
|
|
5336
|
+
this.contents.setIn(path73, value);
|
|
5333
5337
|
}
|
|
5334
5338
|
}
|
|
5335
5339
|
/**
|
|
@@ -7289,9 +7293,9 @@ var require_cst_visit = __commonJS({
|
|
|
7289
7293
|
visit.BREAK = BREAK;
|
|
7290
7294
|
visit.SKIP = SKIP;
|
|
7291
7295
|
visit.REMOVE = REMOVE;
|
|
7292
|
-
visit.itemAtPath = (cst,
|
|
7296
|
+
visit.itemAtPath = (cst, path73) => {
|
|
7293
7297
|
let item = cst;
|
|
7294
|
-
for (const [field, index] of
|
|
7298
|
+
for (const [field, index] of path73) {
|
|
7295
7299
|
const tok = item?.[field];
|
|
7296
7300
|
if (tok && "items" in tok) {
|
|
7297
7301
|
item = tok.items[index];
|
|
@@ -7300,23 +7304,23 @@ var require_cst_visit = __commonJS({
|
|
|
7300
7304
|
}
|
|
7301
7305
|
return item;
|
|
7302
7306
|
};
|
|
7303
|
-
visit.parentCollection = (cst,
|
|
7304
|
-
const parent = visit.itemAtPath(cst,
|
|
7305
|
-
const field =
|
|
7307
|
+
visit.parentCollection = (cst, path73) => {
|
|
7308
|
+
const parent = visit.itemAtPath(cst, path73.slice(0, -1));
|
|
7309
|
+
const field = path73[path73.length - 1][0];
|
|
7306
7310
|
const coll = parent?.[field];
|
|
7307
7311
|
if (coll && "items" in coll)
|
|
7308
7312
|
return coll;
|
|
7309
7313
|
throw new Error("Parent collection not found");
|
|
7310
7314
|
};
|
|
7311
|
-
function _visit(
|
|
7312
|
-
let ctrl = visitor(item,
|
|
7315
|
+
function _visit(path73, item, visitor) {
|
|
7316
|
+
let ctrl = visitor(item, path73);
|
|
7313
7317
|
if (typeof ctrl === "symbol")
|
|
7314
7318
|
return ctrl;
|
|
7315
7319
|
for (const field of ["key", "value"]) {
|
|
7316
7320
|
const token = item[field];
|
|
7317
7321
|
if (token && "items" in token) {
|
|
7318
7322
|
for (let i = 0; i < token.items.length; ++i) {
|
|
7319
|
-
const ci = _visit(Object.freeze(
|
|
7323
|
+
const ci = _visit(Object.freeze(path73.concat([[field, i]])), token.items[i], visitor);
|
|
7320
7324
|
if (typeof ci === "number")
|
|
7321
7325
|
i = ci - 1;
|
|
7322
7326
|
else if (ci === BREAK)
|
|
@@ -7327,10 +7331,10 @@ var require_cst_visit = __commonJS({
|
|
|
7327
7331
|
}
|
|
7328
7332
|
}
|
|
7329
7333
|
if (typeof ctrl === "function" && field === "key")
|
|
7330
|
-
ctrl = ctrl(item,
|
|
7334
|
+
ctrl = ctrl(item, path73);
|
|
7331
7335
|
}
|
|
7332
7336
|
}
|
|
7333
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
7337
|
+
return typeof ctrl === "function" ? ctrl(item, path73) : ctrl;
|
|
7334
7338
|
}
|
|
7335
7339
|
exports.visit = visit;
|
|
7336
7340
|
}
|
|
@@ -8632,14 +8636,14 @@ var require_parser = __commonJS({
|
|
|
8632
8636
|
case "scalar":
|
|
8633
8637
|
case "single-quoted-scalar":
|
|
8634
8638
|
case "double-quoted-scalar": {
|
|
8635
|
-
const
|
|
8639
|
+
const fs76 = this.flowScalar(this.type);
|
|
8636
8640
|
if (atNextItem || it.value) {
|
|
8637
|
-
map.items.push({ start, key:
|
|
8641
|
+
map.items.push({ start, key: fs76, sep: [] });
|
|
8638
8642
|
this.onKeyLine = true;
|
|
8639
8643
|
} else if (it.sep) {
|
|
8640
|
-
this.stack.push(
|
|
8644
|
+
this.stack.push(fs76);
|
|
8641
8645
|
} else {
|
|
8642
|
-
Object.assign(it, { key:
|
|
8646
|
+
Object.assign(it, { key: fs76, sep: [] });
|
|
8643
8647
|
this.onKeyLine = true;
|
|
8644
8648
|
}
|
|
8645
8649
|
return;
|
|
@@ -8767,13 +8771,13 @@ var require_parser = __commonJS({
|
|
|
8767
8771
|
case "scalar":
|
|
8768
8772
|
case "single-quoted-scalar":
|
|
8769
8773
|
case "double-quoted-scalar": {
|
|
8770
|
-
const
|
|
8774
|
+
const fs76 = this.flowScalar(this.type);
|
|
8771
8775
|
if (!it || it.value)
|
|
8772
|
-
fc.items.push({ start: [], key:
|
|
8776
|
+
fc.items.push({ start: [], key: fs76, sep: [] });
|
|
8773
8777
|
else if (it.sep)
|
|
8774
|
-
this.stack.push(
|
|
8778
|
+
this.stack.push(fs76);
|
|
8775
8779
|
else
|
|
8776
|
-
Object.assign(it, { key:
|
|
8780
|
+
Object.assign(it, { key: fs76, sep: [] });
|
|
8777
8781
|
return;
|
|
8778
8782
|
}
|
|
8779
8783
|
case "flow-map-end":
|
|
@@ -21641,8 +21645,8 @@ function lockfile_path(env) {
|
|
|
21641
21645
|
}
|
|
21642
21646
|
return write_target("installed.lock", { env: env ?? null });
|
|
21643
21647
|
}
|
|
21644
|
-
function read_lockfile(
|
|
21645
|
-
const target =
|
|
21648
|
+
function read_lockfile(path73) {
|
|
21649
|
+
const target = path73 ?? lockfile_path();
|
|
21646
21650
|
let text;
|
|
21647
21651
|
try {
|
|
21648
21652
|
text = fs31.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -21852,18 +21856,18 @@ function manifest_path(project_root, env) {
|
|
|
21852
21856
|
}
|
|
21853
21857
|
return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
|
|
21854
21858
|
}
|
|
21855
|
-
function read_manifest(
|
|
21859
|
+
function read_manifest(path73) {
|
|
21856
21860
|
let text;
|
|
21857
21861
|
try {
|
|
21858
|
-
text = require_read_text(
|
|
21862
|
+
text = require_read_text(path73);
|
|
21859
21863
|
} catch {
|
|
21860
21864
|
return null;
|
|
21861
21865
|
}
|
|
21862
21866
|
const data = _parse_manual(text);
|
|
21863
21867
|
return _normalise_v2_shape(data);
|
|
21864
21868
|
}
|
|
21865
|
-
function require_read_text(
|
|
21866
|
-
return fs33.readFileSync(
|
|
21869
|
+
function require_read_text(path73) {
|
|
21870
|
+
return fs33.readFileSync(path73, { encoding: "utf-8" });
|
|
21867
21871
|
}
|
|
21868
21872
|
function _normalise_v2_shape(data) {
|
|
21869
21873
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -22044,9 +22048,9 @@ function stable_sort(items, key) {
|
|
|
22044
22048
|
return a.index - b.index;
|
|
22045
22049
|
}).map((entry) => entry.item);
|
|
22046
22050
|
}
|
|
22047
|
-
function write_manifest(
|
|
22051
|
+
function write_manifest(path73, version, tools, options = {}) {
|
|
22048
22052
|
const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
22049
|
-
return write_atomic(
|
|
22053
|
+
return write_atomic(path73, rendered);
|
|
22050
22054
|
}
|
|
22051
22055
|
function upsert_tool(existing, options) {
|
|
22052
22056
|
const {
|
|
@@ -27842,7 +27846,11 @@ function _build_config(raw, source_path) {
|
|
|
27842
27846
|
if (!_isBool(enabled)) {
|
|
27843
27847
|
throw new CouncilConfigError("`enabled` must be a bool.");
|
|
27844
27848
|
}
|
|
27845
|
-
const
|
|
27849
|
+
const ignored_transport_keys = [];
|
|
27850
|
+
const defaults = _build_defaults(
|
|
27851
|
+
_asDict(_getOr(raw, "defaults", {})),
|
|
27852
|
+
ignored_transport_keys
|
|
27853
|
+
);
|
|
27846
27854
|
const cost_budget = _build_cost_budget(
|
|
27847
27855
|
_asDict(_getOr(raw, "cost_budget", {}))
|
|
27848
27856
|
);
|
|
@@ -27854,7 +27862,12 @@ function _build_config(raw, source_path) {
|
|
|
27854
27862
|
for (const [name, cfg] of Object.entries(members_raw)) {
|
|
27855
27863
|
members.set(
|
|
27856
27864
|
name,
|
|
27857
|
-
_build_member(
|
|
27865
|
+
_build_member(
|
|
27866
|
+
name,
|
|
27867
|
+
_asDict(_orEmpty(cfg)),
|
|
27868
|
+
defaults.mode,
|
|
27869
|
+
ignored_transport_keys
|
|
27870
|
+
)
|
|
27858
27871
|
);
|
|
27859
27872
|
}
|
|
27860
27873
|
const advisors_raw = _getOr(raw, "advisors", {});
|
|
@@ -27953,7 +27966,8 @@ function _build_config(raw, source_path) {
|
|
|
27953
27966
|
routing,
|
|
27954
27967
|
low_impact,
|
|
27955
27968
|
lens_overrides,
|
|
27956
|
-
source_path
|
|
27969
|
+
source_path,
|
|
27970
|
+
ignored_transport_keys
|
|
27957
27971
|
};
|
|
27958
27972
|
}
|
|
27959
27973
|
function _orEmpty(value) {
|
|
@@ -28406,16 +28420,14 @@ function _build_consensus_scoring(d) {
|
|
|
28406
28420
|
lenses: lenses_raw
|
|
28407
28421
|
};
|
|
28408
28422
|
}
|
|
28409
|
-
function _build_defaults(d) {
|
|
28423
|
+
function _build_defaults(d, ignored = []) {
|
|
28410
28424
|
if (!_isDict(d)) {
|
|
28411
28425
|
throw new CouncilConfigError("`defaults` must be a mapping.");
|
|
28412
28426
|
}
|
|
28413
|
-
|
|
28414
|
-
|
|
28415
|
-
throw new CouncilConfigError(
|
|
28416
|
-
`defaults.mode=${_pyRepr6(mode)} not in ${_sortedListRepr(_VALID_MODES)}.`
|
|
28417
|
-
);
|
|
28427
|
+
if (_get(d, "mode", null) !== null) {
|
|
28428
|
+
ignored.push("defaults.mode");
|
|
28418
28429
|
}
|
|
28430
|
+
const mode = "auto";
|
|
28419
28431
|
const member_mode = _get(d, "member_mode", "cli");
|
|
28420
28432
|
if (!(_isStr(member_mode) && _VALID_MEMBER_MODES.has(member_mode))) {
|
|
28421
28433
|
throw new CouncilConfigError(
|
|
@@ -28571,7 +28583,7 @@ function _build_cost_budget(d) {
|
|
|
28571
28583
|
}
|
|
28572
28584
|
return cb;
|
|
28573
28585
|
}
|
|
28574
|
-
function _build_member(name, cfg, default_mode = "auto") {
|
|
28586
|
+
function _build_member(name, cfg, default_mode = "auto", ignored = []) {
|
|
28575
28587
|
if (!_VALID_PROVIDERS.has(name)) {
|
|
28576
28588
|
throw new CouncilConfigError(
|
|
28577
28589
|
`members.${name}: unknown provider; valid: ${_sortedListRepr(_VALID_PROVIDERS)}.`
|
|
@@ -28582,14 +28594,11 @@ function _build_member(name, cfg, default_mode = "auto") {
|
|
|
28582
28594
|
const model = _pyTruthy3(modelVal) ? modelVal : "";
|
|
28583
28595
|
const api_key_ref_raw = _get(cfg, "api_key_ref", null);
|
|
28584
28596
|
const api_key_ref = api_key_ref_raw === void 0 ? null : api_key_ref_raw;
|
|
28585
|
-
|
|
28586
|
-
|
|
28587
|
-
if (member_mode !== null && !(_isStr(member_mode) && _VALID_MODES.has(member_mode))) {
|
|
28588
|
-
throw new CouncilConfigError(
|
|
28589
|
-
`members.${name}.mode=${_pyRepr6(member_mode)} not in ${_sortedListRepr(_VALID_MODES)}.`
|
|
28590
|
-
);
|
|
28597
|
+
if (_get(cfg, "mode", null) !== null) {
|
|
28598
|
+
ignored.push(`members.${name}.mode`);
|
|
28591
28599
|
}
|
|
28592
|
-
const
|
|
28600
|
+
const member_mode = null;
|
|
28601
|
+
const effective_mode = default_mode;
|
|
28593
28602
|
const binary_raw = _get(cfg, "binary", null);
|
|
28594
28603
|
const binary = binary_raw === void 0 ? null : binary_raw;
|
|
28595
28604
|
if (binary !== null) {
|
|
@@ -28868,7 +28877,7 @@ function _pyTruthy3(value) {
|
|
|
28868
28877
|
}
|
|
28869
28878
|
return Object.keys(value).length > 0;
|
|
28870
28879
|
}
|
|
28871
|
-
var import_yaml5, _VALID_PROVIDERS,
|
|
28880
|
+
var import_yaml5, _VALID_PROVIDERS, _RAW_KEY_PREFIXES, CouncilConfigError, _Float, _VALID_NECESSITY_MODES, _VALID_DISCLOSURE_MODES, _VALID_CHAIRMAN_MODES, COUNCIL_CONFIG_RELNAME, COUNCIL_CONFIG_USER_GLOBAL_REL, COUNCIL_CONFIG_ENV, _VALID_CRITIC_PROTOCOLS, _VALID_RESOLUTION_MODES, _IMPACT_CLASSES, _LOCKED_IMPACT_CLASSES, _DEFAULT_RESOLUTION_MODES, _VALID_MEMBER_MODES, _VALID_DISPATCH_MODES, _DEFAULT_CLI_CALLS_PER_DAY;
|
|
28872
28881
|
var init_config = __esm({
|
|
28873
28882
|
"src/scripts/ai_council/config.ts"() {
|
|
28874
28883
|
"use strict";
|
|
@@ -28882,7 +28891,6 @@ var init_config = __esm({
|
|
|
28882
28891
|
"xai",
|
|
28883
28892
|
"perplexity"
|
|
28884
28893
|
]);
|
|
28885
|
-
_VALID_MODES = /* @__PURE__ */ new Set(["api", "manual", "cli", "auto"]);
|
|
28886
28894
|
_RAW_KEY_PREFIXES = [
|
|
28887
28895
|
"sk-",
|
|
28888
28896
|
"sk-ant-",
|
|
@@ -29079,6 +29087,21 @@ function homeOf(env) {
|
|
|
29079
29087
|
const injected = (map["HOME"] ?? "").trim();
|
|
29080
29088
|
return injected !== "" ? injected : os9.homedir();
|
|
29081
29089
|
}
|
|
29090
|
+
function defaultProbeKeychain(service) {
|
|
29091
|
+
if (process.platform !== "darwin") return false;
|
|
29092
|
+
try {
|
|
29093
|
+
const res = spawnSync8("security", ["find-generic-password", "-s", service], {
|
|
29094
|
+
timeout: VERSION_PROBE_TIMEOUT_MS,
|
|
29095
|
+
encoding: "utf-8",
|
|
29096
|
+
windowsHide: true,
|
|
29097
|
+
env: hardenedSpawnEnv()
|
|
29098
|
+
});
|
|
29099
|
+
if (res.error !== void 0 || res.signal !== null) return false;
|
|
29100
|
+
return res.status === 0;
|
|
29101
|
+
} catch {
|
|
29102
|
+
return false;
|
|
29103
|
+
}
|
|
29104
|
+
}
|
|
29082
29105
|
function defaultProbeVersion(binary) {
|
|
29083
29106
|
try {
|
|
29084
29107
|
const res = spawnSync8(binary, ["--version"], {
|
|
@@ -29124,13 +29147,16 @@ function classifyCodexAuth(authPath) {
|
|
|
29124
29147
|
if (hasOauth) return "cli-subscription";
|
|
29125
29148
|
return "cli-api-key";
|
|
29126
29149
|
}
|
|
29127
|
-
function cliSubscriptionEvidence(provider, home, env, claudeConfigDir) {
|
|
29150
|
+
function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeychain) {
|
|
29128
29151
|
if (provider === "anthropic") {
|
|
29129
29152
|
const configDir = claudeConfigDir;
|
|
29130
29153
|
for (const rel of [".credentials.json", "credentials.json"]) {
|
|
29131
29154
|
const p = path47.join(configDir, rel);
|
|
29132
29155
|
if (isFile2(p)) return { source: "cli-subscription", evidence: p };
|
|
29133
29156
|
}
|
|
29157
|
+
if (probeKeychain(CLAUDE_KEYCHAIN_SERVICE)) {
|
|
29158
|
+
return { source: "cli-subscription", evidence: `keychain:${CLAUDE_KEYCHAIN_SERVICE}` };
|
|
29159
|
+
}
|
|
29134
29160
|
return null;
|
|
29135
29161
|
}
|
|
29136
29162
|
if (provider === "openai") {
|
|
@@ -29172,10 +29198,11 @@ function detectAuth(opts) {
|
|
|
29172
29198
|
const env = opts.env ?? process.env;
|
|
29173
29199
|
const home = opts.home ?? homeOf(opts.env);
|
|
29174
29200
|
const claudeConfigDir = opts.home === void 0 && opts.env === void 0 ? claude_config_dir() : (env["CLAUDE_CONFIG_DIR"] ?? "").trim() || path47.join(home, ".claude");
|
|
29201
|
+
const probeKeychain = opts.probeKeychain ?? defaultProbeKeychain;
|
|
29175
29202
|
const auth = [];
|
|
29176
29203
|
const keys = [];
|
|
29177
29204
|
for (const provider of knownProviders()) {
|
|
29178
|
-
const cli = cliSubscriptionEvidence(provider, home, env, claudeConfigDir);
|
|
29205
|
+
const cli = cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeychain);
|
|
29179
29206
|
if (cli !== null) {
|
|
29180
29207
|
auth.push({ provider, source: cli.source, evidence: cli.evidence });
|
|
29181
29208
|
}
|
|
@@ -29222,7 +29249,7 @@ function detectEnvironment(opts = {}) {
|
|
|
29222
29249
|
if (isDefaultCall) _cached = report2;
|
|
29223
29250
|
return report2;
|
|
29224
29251
|
}
|
|
29225
|
-
var PROVIDER_CLI_META, PROVIDER_ENV_KEY, PROVIDER_KEY_FILE, VERSION_PROBE_TIMEOUT_MS, _cached;
|
|
29252
|
+
var PROVIDER_CLI_META, PROVIDER_ENV_KEY, PROVIDER_KEY_FILE, VERSION_PROBE_TIMEOUT_MS, CLAUDE_KEYCHAIN_SERVICE, _cached;
|
|
29226
29253
|
var init_environment_detector = __esm({
|
|
29227
29254
|
"src/scripts/_lib/environment_detector.ts"() {
|
|
29228
29255
|
"use strict";
|
|
@@ -29253,6 +29280,7 @@ var init_environment_detector = __esm({
|
|
|
29253
29280
|
perplexity: "perplexity.key"
|
|
29254
29281
|
};
|
|
29255
29282
|
VERSION_PROBE_TIMEOUT_MS = 2e3;
|
|
29283
|
+
CLAUDE_KEYCHAIN_SERVICE = "Claude Code-credentials";
|
|
29256
29284
|
_cached = null;
|
|
29257
29285
|
}
|
|
29258
29286
|
});
|
|
@@ -33134,9 +33162,9 @@ function detectToolPresence(root) {
|
|
|
33134
33162
|
agentsMd: existsSync25(join49(root, "AGENTS.md"))
|
|
33135
33163
|
};
|
|
33136
33164
|
}
|
|
33137
|
-
function isDir3(
|
|
33165
|
+
function isDir3(path73) {
|
|
33138
33166
|
try {
|
|
33139
|
-
return statSync32(
|
|
33167
|
+
return statSync32(path73).isDirectory();
|
|
33140
33168
|
} catch {
|
|
33141
33169
|
return false;
|
|
33142
33170
|
}
|
|
@@ -34095,6 +34123,14 @@ function _empty_state() {
|
|
|
34095
34123
|
verified_this_turn: false,
|
|
34096
34124
|
ci_saw_pending: false,
|
|
34097
34125
|
nonevidence_this_turn: 0,
|
|
34126
|
+
// Round 7 § Phase 1 — the last CI read, SESSION-scoped on purpose. Every
|
|
34127
|
+
// other counter here is turn-scoped because a stale POSITIVE would wrongly
|
|
34128
|
+
// vouch ("I verified"). This one is a NEGATIVE ("CI was not settled"), and a
|
|
34129
|
+
// stale negative only ever refuses more often — so surviving the turn
|
|
34130
|
+
// boundary preserves the freshness invariant rather than bypassing it. It
|
|
34131
|
+
// has to survive it: the measured failure is a completion claim in a LATER
|
|
34132
|
+
// turn than the poll it rests on.
|
|
34133
|
+
ci_last: null,
|
|
34098
34134
|
checked_at: _now2()
|
|
34099
34135
|
};
|
|
34100
34136
|
}
|
|
@@ -34207,6 +34243,7 @@ function _update(state, event, envelope) {
|
|
|
34207
34243
|
if (session_id && session_id !== state["session_id"]) {
|
|
34208
34244
|
state["session_id"] = session_id;
|
|
34209
34245
|
state["verifications_this_session"] = 0;
|
|
34246
|
+
state["ci_last"] = null;
|
|
34210
34247
|
state = _reset_turn(state, session_id);
|
|
34211
34248
|
}
|
|
34212
34249
|
let payload = envelope["payload"];
|
|
@@ -34232,6 +34269,12 @@ function _update(state, event, envelope) {
|
|
|
34232
34269
|
} else {
|
|
34233
34270
|
counts = false;
|
|
34234
34271
|
}
|
|
34272
|
+
state["ci_last"] = {
|
|
34273
|
+
at: _now2(),
|
|
34274
|
+
command: cmd.slice(0, 512),
|
|
34275
|
+
pending,
|
|
34276
|
+
settled: pending === 0 && counts === true
|
|
34277
|
+
};
|
|
34235
34278
|
}
|
|
34236
34279
|
state["last_verification"] = {
|
|
34237
34280
|
command: cmd.slice(0, 512),
|
|
@@ -34389,12 +34432,785 @@ var init_before_complete_hook = __esm({
|
|
|
34389
34432
|
}
|
|
34390
34433
|
});
|
|
34391
34434
|
|
|
34392
|
-
// src/scripts/
|
|
34393
|
-
|
|
34394
|
-
|
|
34395
|
-
|
|
34435
|
+
// src/scripts/_lib/review_skipped_record.ts
|
|
34436
|
+
function isNonNegInt(n) {
|
|
34437
|
+
return typeof n === "number" && Number.isFinite(n) && Number.isInteger(n) && n >= 0;
|
|
34438
|
+
}
|
|
34439
|
+
function buildReviewSkippedLine(input) {
|
|
34440
|
+
const errors = [];
|
|
34441
|
+
if (!isNonNegInt(input.diff_lines)) {
|
|
34442
|
+
errors.push("diff_lines must be a non-negative integer");
|
|
34443
|
+
}
|
|
34444
|
+
if (input.mutation_measure !== "exact" && input.mutation_measure !== "capped_approximation") {
|
|
34445
|
+
errors.push('mutation_measure must be "exact" or "capped_approximation"');
|
|
34446
|
+
}
|
|
34447
|
+
if (!input.ts) errors.push("ts (ISO-8601 UTC) is required");
|
|
34448
|
+
if (!input.id) errors.push("id (ULID, UUID, or content hash) is required");
|
|
34449
|
+
if (errors.length) return { line: null, errors };
|
|
34450
|
+
const line = {
|
|
34451
|
+
schema_version: 1,
|
|
34452
|
+
id: input.id,
|
|
34453
|
+
ts: input.ts,
|
|
34454
|
+
work_id: input.work_id ?? `review-skipped-${input.ts}`,
|
|
34455
|
+
phase: "report",
|
|
34456
|
+
outcome: "skipped",
|
|
34457
|
+
confidence_band: "medium",
|
|
34458
|
+
risk_class: input.diff_lines >= HIGH_RISK_DIFF_LINES ? "high" : "medium",
|
|
34459
|
+
memory: { asks: 0, hits: 0 },
|
|
34460
|
+
verify: { claims: 0, first_try_passes: 0 },
|
|
34461
|
+
rules_applied: ["delegation-policy"],
|
|
34462
|
+
persona: null,
|
|
34463
|
+
input_kind: "prompt",
|
|
34464
|
+
type: "note",
|
|
34465
|
+
review_skipped: { diff_lines: input.diff_lines, mutation_measure: input.mutation_measure }
|
|
34466
|
+
};
|
|
34467
|
+
return { line, errors: [] };
|
|
34468
|
+
}
|
|
34469
|
+
var HIGH_RISK_DIFF_LINES;
|
|
34470
|
+
var init_review_skipped_record = __esm({
|
|
34471
|
+
"src/scripts/_lib/review_skipped_record.ts"() {
|
|
34472
|
+
"use strict";
|
|
34473
|
+
HIGH_RISK_DIFF_LINES = 200;
|
|
34474
|
+
}
|
|
34475
|
+
});
|
|
34476
|
+
|
|
34477
|
+
// src/scripts/hooks/envelope.ts
|
|
34478
|
+
function _isObject5(obj) {
|
|
34479
|
+
return typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
34480
|
+
}
|
|
34481
|
+
function looks_like_envelope(obj) {
|
|
34482
|
+
if (!_isObject5(obj)) {
|
|
34483
|
+
return false;
|
|
34484
|
+
}
|
|
34485
|
+
return ENVELOPE_KEYS.every((key) => key in obj);
|
|
34486
|
+
}
|
|
34487
|
+
function unwrap(stdin_text, default_platform = "generic") {
|
|
34488
|
+
const text = (stdin_text ?? "").trim();
|
|
34489
|
+
if (!text) {
|
|
34490
|
+
return [{}, {}, default_platform];
|
|
34491
|
+
}
|
|
34492
|
+
let decoded;
|
|
34493
|
+
try {
|
|
34494
|
+
decoded = JSON.parse(text);
|
|
34495
|
+
} catch {
|
|
34496
|
+
return [{}, {}, default_platform];
|
|
34497
|
+
}
|
|
34498
|
+
if (looks_like_envelope(decoded)) {
|
|
34499
|
+
const env = decoded;
|
|
34500
|
+
let payload2 = env["payload"];
|
|
34501
|
+
if (!payload2 || !_isObject5(payload2)) {
|
|
34502
|
+
payload2 = {};
|
|
34503
|
+
}
|
|
34504
|
+
const platRaw = env["platform"];
|
|
34505
|
+
const platform = String(platRaw || default_platform);
|
|
34506
|
+
return [env, payload2, platform];
|
|
34507
|
+
}
|
|
34508
|
+
const payload = _isObject5(decoded) ? decoded : {};
|
|
34509
|
+
return [
|
|
34510
|
+
{
|
|
34511
|
+
schema_version: 1,
|
|
34512
|
+
platform: default_platform,
|
|
34513
|
+
event: "",
|
|
34514
|
+
native_event: "",
|
|
34515
|
+
session_id: "",
|
|
34516
|
+
workspace_root: "",
|
|
34517
|
+
payload,
|
|
34518
|
+
settings: {}
|
|
34519
|
+
},
|
|
34520
|
+
payload,
|
|
34521
|
+
default_platform
|
|
34522
|
+
];
|
|
34523
|
+
}
|
|
34524
|
+
var ENVELOPE_KEYS;
|
|
34525
|
+
var init_envelope = __esm({
|
|
34526
|
+
"src/scripts/hooks/envelope.ts"() {
|
|
34527
|
+
"use strict";
|
|
34528
|
+
ENVELOPE_KEYS = [
|
|
34529
|
+
"schema_version",
|
|
34530
|
+
"platform",
|
|
34531
|
+
"event",
|
|
34532
|
+
"payload"
|
|
34533
|
+
];
|
|
34534
|
+
}
|
|
34535
|
+
});
|
|
34536
|
+
|
|
34537
|
+
// src/scripts/hooks/end_review_nudge_hook.ts
|
|
34538
|
+
import { spawnSync as spawnSync9 } from "node:child_process";
|
|
34539
|
+
import * as crypto7 from "node:crypto";
|
|
34540
|
+
import * as fs57 from "node:fs";
|
|
34541
|
+
import * as os12 from "node:os";
|
|
34542
|
+
import * as path58 from "node:path";
|
|
34396
34543
|
import { fileURLToPath as fileURLToPath34, pathToFileURL as pathToFileURL23 } from "node:url";
|
|
34397
|
-
function
|
|
34544
|
+
function isSafeTranscriptPath(rawPath, opts = {}) {
|
|
34545
|
+
if (!rawPath || !/\.jsonl$/i.test(rawPath)) return false;
|
|
34546
|
+
const homeDir = opts.homeDir ?? os12.homedir();
|
|
34547
|
+
const maxBytes = opts.maxBytes ?? TRANSCRIPT_SCAN_MAX_BYTES;
|
|
34548
|
+
try {
|
|
34549
|
+
const realHome = fs57.realpathSync(homeDir);
|
|
34550
|
+
const realPath = fs57.realpathSync(rawPath);
|
|
34551
|
+
const relative16 = path58.relative(realHome, realPath);
|
|
34552
|
+
if (relative16 === "" || relative16.startsWith("..") || path58.isAbsolute(relative16)) {
|
|
34553
|
+
return false;
|
|
34554
|
+
}
|
|
34555
|
+
const { size } = fs57.statSync(realPath);
|
|
34556
|
+
return size <= maxBytes;
|
|
34557
|
+
} catch {
|
|
34558
|
+
return false;
|
|
34559
|
+
}
|
|
34560
|
+
}
|
|
34561
|
+
function parseNumstat(raw) {
|
|
34562
|
+
const rows = [];
|
|
34563
|
+
for (const line of raw.split("\n")) {
|
|
34564
|
+
const m = /^(\d+|-)\t(\d+|-)\t(.+)$/.exec(line);
|
|
34565
|
+
if (!m) continue;
|
|
34566
|
+
const addedStr = m[1];
|
|
34567
|
+
const deletedStr = m[2];
|
|
34568
|
+
rows.push({
|
|
34569
|
+
added: addedStr === "-" ? 0 : Number(addedStr),
|
|
34570
|
+
deleted: deletedStr === "-" ? 0 : Number(deletedStr),
|
|
34571
|
+
path: m[3]
|
|
34572
|
+
});
|
|
34573
|
+
}
|
|
34574
|
+
return rows;
|
|
34575
|
+
}
|
|
34576
|
+
function isDocPath(p) {
|
|
34577
|
+
return DOC_PATH_RE.test(p);
|
|
34578
|
+
}
|
|
34579
|
+
function nonDocMutatedLines(rows) {
|
|
34580
|
+
return rows.filter((r) => !isDocPath(r.path)).reduce((sum, r) => sum + r.added + r.deleted, 0);
|
|
34581
|
+
}
|
|
34582
|
+
function gitNumstatRows(cwd) {
|
|
34583
|
+
try {
|
|
34584
|
+
const r = spawnSync9("git", ["diff", "--numstat", "HEAD"], {
|
|
34585
|
+
cwd,
|
|
34586
|
+
encoding: "utf8",
|
|
34587
|
+
maxBuffer: 16 * 1024 * 1024
|
|
34588
|
+
});
|
|
34589
|
+
if (r.status !== 0) return [];
|
|
34590
|
+
return parseNumstat(r.stdout ?? "");
|
|
34591
|
+
} catch {
|
|
34592
|
+
return [];
|
|
34593
|
+
}
|
|
34594
|
+
}
|
|
34595
|
+
function untrackedNonDocFiles(cwd) {
|
|
34596
|
+
try {
|
|
34597
|
+
const r = spawnSync9("git", ["ls-files", "--others", "--exclude-standard"], {
|
|
34598
|
+
cwd,
|
|
34599
|
+
encoding: "utf8",
|
|
34600
|
+
maxBuffer: 16 * 1024 * 1024
|
|
34601
|
+
});
|
|
34602
|
+
if (r.status !== 0) return [];
|
|
34603
|
+
return (r.stdout ?? "").split("\n").map((l) => l.trim()).filter((l) => l.length > 0 && !isDocPath(l));
|
|
34604
|
+
} catch {
|
|
34605
|
+
return [];
|
|
34606
|
+
}
|
|
34607
|
+
}
|
|
34608
|
+
function untrackedFileLineCount(cwd, relPath) {
|
|
34609
|
+
try {
|
|
34610
|
+
const r = spawnSync9("git", ["diff", "--numstat", "--no-index", "/dev/null", relPath], {
|
|
34611
|
+
cwd,
|
|
34612
|
+
encoding: "utf8",
|
|
34613
|
+
maxBuffer: 16 * 1024 * 1024
|
|
34614
|
+
});
|
|
34615
|
+
return parseNumstat(r.stdout ?? "").reduce((sum, row) => sum + row.added + row.deleted, 0);
|
|
34616
|
+
} catch {
|
|
34617
|
+
return 0;
|
|
34618
|
+
}
|
|
34619
|
+
}
|
|
34620
|
+
function totalNonDocMutatedLinesWithMeasure(cwd) {
|
|
34621
|
+
const trackedLines = nonDocMutatedLines(gitNumstatRows(cwd));
|
|
34622
|
+
const untracked = untrackedNonDocFiles(cwd);
|
|
34623
|
+
if (untracked.length > UNTRACKED_FILE_CAP) {
|
|
34624
|
+
return { lines: MUTATION_LINE_THRESHOLD + 1 + trackedLines, measure: "capped_approximation" };
|
|
34625
|
+
}
|
|
34626
|
+
const untrackedLines = untracked.reduce(
|
|
34627
|
+
(sum, relPath) => sum + untrackedFileLineCount(cwd, relPath),
|
|
34628
|
+
0
|
|
34629
|
+
);
|
|
34630
|
+
return { lines: trackedLines + untrackedLines, measure: "exact" };
|
|
34631
|
+
}
|
|
34632
|
+
function isObject(v) {
|
|
34633
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
34634
|
+
}
|
|
34635
|
+
function str(v) {
|
|
34636
|
+
return typeof v === "string" ? v : "";
|
|
34637
|
+
}
|
|
34638
|
+
function scanTranscriptForReviewer(transcriptText) {
|
|
34639
|
+
for (const raw of transcriptText.split("\n")) {
|
|
34640
|
+
const line = raw.trim();
|
|
34641
|
+
if (!line) continue;
|
|
34642
|
+
let obj;
|
|
34643
|
+
try {
|
|
34644
|
+
obj = JSON.parse(line);
|
|
34645
|
+
} catch {
|
|
34646
|
+
continue;
|
|
34647
|
+
}
|
|
34648
|
+
if (!isObject(obj) || obj["type"] !== "assistant") continue;
|
|
34649
|
+
const msg = obj["message"];
|
|
34650
|
+
if (!isObject(msg)) continue;
|
|
34651
|
+
const content = msg["content"];
|
|
34652
|
+
if (!Array.isArray(content)) continue;
|
|
34653
|
+
for (const blk of content) {
|
|
34654
|
+
if (!isObject(blk) || blk["type"] !== "tool_use") continue;
|
|
34655
|
+
const name = str(blk["name"]);
|
|
34656
|
+
const input = blk["input"];
|
|
34657
|
+
const inputObj = isObject(input) ? input : {};
|
|
34658
|
+
if (DISPATCH_TOOL_RE.test(name)) {
|
|
34659
|
+
const label = [
|
|
34660
|
+
str(inputObj["description"]),
|
|
34661
|
+
str(inputObj["subagent_type"])
|
|
34662
|
+
].filter(Boolean).join(" ");
|
|
34663
|
+
if (REVIEW_SHAPED_LABEL_RE.test(label)) return true;
|
|
34664
|
+
const prompt = str(inputObj["prompt"]);
|
|
34665
|
+
if (REVIEW_SHAPED_PROMPT_RE.test(prompt)) return true;
|
|
34666
|
+
continue;
|
|
34667
|
+
}
|
|
34668
|
+
if (/^skill$/i.test(name)) {
|
|
34669
|
+
const skillName = str(inputObj["skill"]) || str(inputObj["name"]) || str(inputObj["command"]);
|
|
34670
|
+
if (REVIEW_SKILL_NAME_RE.test(skillName)) return true;
|
|
34671
|
+
continue;
|
|
34672
|
+
}
|
|
34673
|
+
if (REVIEW_SKILL_NAME_RE.test(name)) return true;
|
|
34674
|
+
}
|
|
34675
|
+
}
|
|
34676
|
+
return false;
|
|
34677
|
+
}
|
|
34678
|
+
function buildAdvisoryLine(diffLines) {
|
|
34679
|
+
return `this session mutated ${diffLines} lines without a neutral review; spawn a cross-model reviewer before claiming done (delegation-policy / verify-budget)`;
|
|
34680
|
+
}
|
|
34681
|
+
function appendReviewSkippedTelemetry(workspaceRoot, diffLines, mutationMeasure) {
|
|
34682
|
+
if (is_replay_mode()) return;
|
|
34683
|
+
const ts = (/* @__PURE__ */ new Date()).toISOString();
|
|
34684
|
+
const { line, errors } = buildReviewSkippedLine({
|
|
34685
|
+
diff_lines: diffLines,
|
|
34686
|
+
mutation_measure: mutationMeasure,
|
|
34687
|
+
ts,
|
|
34688
|
+
id: crypto7.randomUUID()
|
|
34689
|
+
});
|
|
34690
|
+
if (errors.length || line === null) return;
|
|
34691
|
+
try {
|
|
34692
|
+
const dir = path58.join(workspaceRoot, "agents", "runtime", "state", "audit");
|
|
34693
|
+
fs57.mkdirSync(dir, { recursive: true });
|
|
34694
|
+
const file = path58.join(dir, `${ts.slice(0, 7)}.jsonl`);
|
|
34695
|
+
fs57.appendFileSync(file, `${JSON.stringify(line)}
|
|
34696
|
+
`, "utf8");
|
|
34697
|
+
} catch {
|
|
34698
|
+
}
|
|
34699
|
+
}
|
|
34700
|
+
function sessionStateDir(workspaceRoot) {
|
|
34701
|
+
return path58.join(workspaceRoot, "agents", "runtime", "state", "end-review-nudge");
|
|
34702
|
+
}
|
|
34703
|
+
function sessionStateFile(workspaceRoot, sessionKey) {
|
|
34704
|
+
return path58.join(sessionStateDir(workspaceRoot), `${sessionKey}.json`);
|
|
34705
|
+
}
|
|
34706
|
+
function deriveSessionKey(envelope, payload) {
|
|
34707
|
+
const raw = str(envelope["session_id"]) || str(payload["transcript_path"] ?? payload["transcriptPath"]);
|
|
34708
|
+
const material = raw || "unknown-session";
|
|
34709
|
+
return crypto7.createHash("sha256").update(material).digest("hex");
|
|
34710
|
+
}
|
|
34711
|
+
function hasFiredThisSession(workspaceRoot, sessionKey) {
|
|
34712
|
+
try {
|
|
34713
|
+
return fs57.existsSync(sessionStateFile(workspaceRoot, sessionKey));
|
|
34714
|
+
} catch {
|
|
34715
|
+
return false;
|
|
34716
|
+
}
|
|
34717
|
+
}
|
|
34718
|
+
function markFiredThisSession(workspaceRoot, sessionKey, ts) {
|
|
34719
|
+
try {
|
|
34720
|
+
atomic_write_json(sessionStateFile(workspaceRoot, sessionKey), { fired_at: ts });
|
|
34721
|
+
} catch {
|
|
34722
|
+
}
|
|
34723
|
+
}
|
|
34724
|
+
function _read_stdin() {
|
|
34725
|
+
return readHookStdin();
|
|
34726
|
+
}
|
|
34727
|
+
function main23() {
|
|
34728
|
+
const [envelope, payload] = unwrap(_read_stdin(), "claude");
|
|
34729
|
+
const event = String(envelope["event"] ?? "");
|
|
34730
|
+
if (event !== "" && event !== "stop") {
|
|
34731
|
+
return 0;
|
|
34732
|
+
}
|
|
34733
|
+
const workspace_root = String(envelope["workspace_root"] ?? "").trim() || process.cwd();
|
|
34734
|
+
let diffLines;
|
|
34735
|
+
let mutationMeasure;
|
|
34736
|
+
try {
|
|
34737
|
+
const measured = totalNonDocMutatedLinesWithMeasure(workspace_root);
|
|
34738
|
+
diffLines = measured.lines;
|
|
34739
|
+
mutationMeasure = measured.measure;
|
|
34740
|
+
} catch {
|
|
34741
|
+
return 0;
|
|
34742
|
+
}
|
|
34743
|
+
if (diffLines <= MUTATION_LINE_THRESHOLD) {
|
|
34744
|
+
return 0;
|
|
34745
|
+
}
|
|
34746
|
+
const sessionKey = deriveSessionKey(envelope, payload);
|
|
34747
|
+
if (hasFiredThisSession(workspace_root, sessionKey)) {
|
|
34748
|
+
return 0;
|
|
34749
|
+
}
|
|
34750
|
+
const transcriptPath = str(
|
|
34751
|
+
payload["transcript_path"] ?? payload["transcriptPath"]
|
|
34752
|
+
).trim();
|
|
34753
|
+
let reviewerRan = false;
|
|
34754
|
+
if (transcriptPath && isSafeTranscriptPath(transcriptPath)) {
|
|
34755
|
+
try {
|
|
34756
|
+
reviewerRan = scanTranscriptForReviewer(fs57.readFileSync(transcriptPath, "utf-8"));
|
|
34757
|
+
} catch {
|
|
34758
|
+
reviewerRan = false;
|
|
34759
|
+
}
|
|
34760
|
+
}
|
|
34761
|
+
if (reviewerRan) {
|
|
34762
|
+
return 0;
|
|
34763
|
+
}
|
|
34764
|
+
markFiredThisSession(workspace_root, sessionKey, (/* @__PURE__ */ new Date()).toISOString());
|
|
34765
|
+
try {
|
|
34766
|
+
appendReviewSkippedTelemetry(workspace_root, diffLines, mutationMeasure);
|
|
34767
|
+
} catch {
|
|
34768
|
+
}
|
|
34769
|
+
process.stdout.write(
|
|
34770
|
+
`${JSON.stringify({
|
|
34771
|
+
decision: "warn",
|
|
34772
|
+
reason: `end-review-nudge: session mutated ${diffLines} non-doc lines without a neutral review`,
|
|
34773
|
+
additional_context: buildAdvisoryLine(diffLines)
|
|
34774
|
+
})}
|
|
34775
|
+
`
|
|
34776
|
+
);
|
|
34777
|
+
return EXIT_WARN2;
|
|
34778
|
+
}
|
|
34779
|
+
function _isCliEntry21() {
|
|
34780
|
+
if (true) {
|
|
34781
|
+
return false;
|
|
34782
|
+
}
|
|
34783
|
+
if (process.argv[1] === void 0) {
|
|
34784
|
+
return false;
|
|
34785
|
+
}
|
|
34786
|
+
const argvUrl = pathToFileURL23(path58.resolve(process.argv[1])).href;
|
|
34787
|
+
if (import.meta.url === argvUrl) {
|
|
34788
|
+
return true;
|
|
34789
|
+
}
|
|
34790
|
+
try {
|
|
34791
|
+
const here = fs57.realpathSync(fileURLToPath34(import.meta.url));
|
|
34792
|
+
const argv = fs57.realpathSync(path58.resolve(process.argv[1]));
|
|
34793
|
+
return here === argv;
|
|
34794
|
+
} catch {
|
|
34795
|
+
return false;
|
|
34796
|
+
}
|
|
34797
|
+
}
|
|
34798
|
+
var MUTATION_LINE_THRESHOLD, UNTRACKED_FILE_CAP, TRANSCRIPT_SCAN_MAX_BYTES, EXIT_WARN2, DOC_PATH_RE, DISPATCH_TOOL_RE, REVIEW_SHAPED_LABEL_RE, REVIEW_SHAPED_PROMPT_RE, REVIEW_SKILL_NAME_RE;
|
|
34799
|
+
var init_end_review_nudge_hook = __esm({
|
|
34800
|
+
"src/scripts/hooks/end_review_nudge_hook.ts"() {
|
|
34801
|
+
"use strict";
|
|
34802
|
+
init_review_skipped_record();
|
|
34803
|
+
init_envelope();
|
|
34804
|
+
init_hook_stdin();
|
|
34805
|
+
init_state_io();
|
|
34806
|
+
MUTATION_LINE_THRESHOLD = 50;
|
|
34807
|
+
UNTRACKED_FILE_CAP = 20;
|
|
34808
|
+
TRANSCRIPT_SCAN_MAX_BYTES = 50 * 1024 * 1024;
|
|
34809
|
+
EXIT_WARN2 = 2;
|
|
34810
|
+
DOC_PATH_RE = /\.md$/i;
|
|
34811
|
+
DISPATCH_TOOL_RE = /^(agent|task)$/i;
|
|
34812
|
+
REVIEW_SHAPED_LABEL_RE = /\b(review|judge|adversarial|critique|second[- ]opinion|blind\s+(pass|review)|cross-model)\b/i;
|
|
34813
|
+
REVIEW_SHAPED_PROMPT_RE = /\b(code\s+review|neutral\s+review|adversarial|judge|critique|second[- ]opinion|blind\s+(pass|review)|cross-model)\b/i;
|
|
34814
|
+
REVIEW_SKILL_NAME_RE = /^(review[-:]changes|judge[-:][a-z0-9-]+|adversarial-review|code-review)$/i;
|
|
34815
|
+
if (_isCliEntry21()) {
|
|
34816
|
+
process.exit(main23());
|
|
34817
|
+
}
|
|
34818
|
+
}
|
|
34819
|
+
});
|
|
34820
|
+
|
|
34821
|
+
// src/scripts/hooks/turn_end_gate_hook.ts
|
|
34822
|
+
import * as crypto8 from "node:crypto";
|
|
34823
|
+
import * as fs58 from "node:fs";
|
|
34824
|
+
import * as path59 from "node:path";
|
|
34825
|
+
import { fileURLToPath as fileURLToPath35, pathToFileURL as pathToFileURL24 } from "node:url";
|
|
34826
|
+
function stripFencedBlocks(text) {
|
|
34827
|
+
const out = [];
|
|
34828
|
+
let open = null;
|
|
34829
|
+
for (const line of text.split("\n")) {
|
|
34830
|
+
const m = /^[ \t]{0,3}([`~]{3,})(.*)$/.exec(line);
|
|
34831
|
+
if (open === null) {
|
|
34832
|
+
if (m) {
|
|
34833
|
+
open = { ch: m[1][0], len: m[1].length };
|
|
34834
|
+
out.push(" ");
|
|
34835
|
+
continue;
|
|
34836
|
+
}
|
|
34837
|
+
out.push(line);
|
|
34838
|
+
continue;
|
|
34839
|
+
}
|
|
34840
|
+
if (m && m[1][0] === open.ch && m[1].length >= open.len && (m[2] ?? "").trim() === "") {
|
|
34841
|
+
open = null;
|
|
34842
|
+
}
|
|
34843
|
+
}
|
|
34844
|
+
return out.join("\n");
|
|
34845
|
+
}
|
|
34846
|
+
function visibleProse(reply) {
|
|
34847
|
+
let text = stripFencedBlocks(reply);
|
|
34848
|
+
text = text.replace(/`[^`\n]*`/g, " ");
|
|
34849
|
+
text = text.replace(/^[ \t]*>.*$/gm, " ");
|
|
34850
|
+
text = text.replace(/^[ \t]*\|.*\|[ \t]*$/gm, " ");
|
|
34851
|
+
text = text.replace(/\bhttps?:\/\/\S+/g, " ");
|
|
34852
|
+
text = text.replace(/\S*\/\S+/g, " ");
|
|
34853
|
+
text = text.replace(/\b[\w.-]+\.(ts|js|md|json|ya?ml|py|php|txt|sh)\b/g, " ");
|
|
34854
|
+
return text;
|
|
34855
|
+
}
|
|
34856
|
+
function finalParagraph(reply) {
|
|
34857
|
+
const prose = visibleProse(reply).trim();
|
|
34858
|
+
if (!prose) return "";
|
|
34859
|
+
const paragraphs = prose.split(/\n\s*\n/).map((p) => p.trim()).filter((p) => p.length > 0);
|
|
34860
|
+
return paragraphs.length === 0 ? "" : paragraphs[paragraphs.length - 1];
|
|
34861
|
+
}
|
|
34862
|
+
function detectPromissory(reply) {
|
|
34863
|
+
const tail = finalParagraph(reply);
|
|
34864
|
+
if (!tail) return null;
|
|
34865
|
+
if (/\?["'’)\]]*\s*$/.test(tail)) return null;
|
|
34866
|
+
if (HANDBACK.some((re) => re.test(tail))) return null;
|
|
34867
|
+
for (const re of PROMISSORY) {
|
|
34868
|
+
const m = tail.match(re);
|
|
34869
|
+
if (m) {
|
|
34870
|
+
return {
|
|
34871
|
+
detector: "promissory",
|
|
34872
|
+
evidence: m[0],
|
|
34873
|
+
reason: "the closing paragraph promises work that has not been performed, and the turn asks the user nothing \u2014 so nothing ends this turn but the promise itself"
|
|
34874
|
+
};
|
|
34875
|
+
}
|
|
34876
|
+
}
|
|
34877
|
+
return null;
|
|
34878
|
+
}
|
|
34879
|
+
function readCiSettled(workspaceRoot) {
|
|
34880
|
+
try {
|
|
34881
|
+
const raw = fs58.readFileSync(path59.join(workspaceRoot, STATE_FILE3), "utf-8");
|
|
34882
|
+
const decoded = JSON.parse(raw);
|
|
34883
|
+
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
34884
|
+
const ci = decoded["ci_last"];
|
|
34885
|
+
if (typeof ci === "object" && ci !== null && !Array.isArray(ci)) {
|
|
34886
|
+
return { seen: true, settled: ci["settled"] === true };
|
|
34887
|
+
}
|
|
34888
|
+
}
|
|
34889
|
+
} catch {
|
|
34890
|
+
}
|
|
34891
|
+
return { seen: false, settled: false };
|
|
34892
|
+
}
|
|
34893
|
+
function detectCompletionClaim(reply, ci) {
|
|
34894
|
+
if (!ci.seen || ci.settled) return null;
|
|
34895
|
+
const prose = visibleProse(reply);
|
|
34896
|
+
const m = _COMPLETION_RE.exec(prose);
|
|
34897
|
+
if (!m) return null;
|
|
34898
|
+
const at = m.index;
|
|
34899
|
+
return {
|
|
34900
|
+
detector: "completion",
|
|
34901
|
+
evidence: prose.slice(at, at + 120).trim(),
|
|
34902
|
+
reason: "a completion claim while the last CI read was not settled \u2014 read the verdict, then claim it (verify-before-complete)"
|
|
34903
|
+
};
|
|
34904
|
+
}
|
|
34905
|
+
function readLanguagePin(workspaceRoot) {
|
|
34906
|
+
try {
|
|
34907
|
+
const raw = fs58.readFileSync(path59.join(workspaceRoot, STATE_FILE), "utf-8");
|
|
34908
|
+
const decoded = JSON.parse(raw);
|
|
34909
|
+
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
34910
|
+
const lang = decoded["language"];
|
|
34911
|
+
if (lang === "de" || lang === "en") return lang;
|
|
34912
|
+
}
|
|
34913
|
+
} catch {
|
|
34914
|
+
}
|
|
34915
|
+
return "und";
|
|
34916
|
+
}
|
|
34917
|
+
function detectLanguage(reply, pinned) {
|
|
34918
|
+
if (pinned !== "de" && pinned !== "en") return null;
|
|
34919
|
+
const prose = visibleProse(reply);
|
|
34920
|
+
const verdict = classify(prose);
|
|
34921
|
+
if (verdict.language === "und") return null;
|
|
34922
|
+
if (verdict.language === pinned) return null;
|
|
34923
|
+
return {
|
|
34924
|
+
detector: "language",
|
|
34925
|
+
evidence: prose.trim().slice(0, 120),
|
|
34926
|
+
reason: `the pinned reply language is "${pinned}" but the reply classifies as "${verdict.language}" (${verdict.de_markers} de / ${verdict.en_markers} en markers; code, quotes, tables, URLs and paths excluded, then scored lead-first by the same classifier that sets the pin)`
|
|
34927
|
+
};
|
|
34928
|
+
}
|
|
34929
|
+
function isVerificationCommand(command) {
|
|
34930
|
+
return _VERIFY_RE.test(command);
|
|
34931
|
+
}
|
|
34932
|
+
function detectUnverifiedEdit(toolCalls) {
|
|
34933
|
+
let lastEdit = -1;
|
|
34934
|
+
for (let i = 0; i < toolCalls.length; i += 1) {
|
|
34935
|
+
if (_EDIT_TOOLS.has(toolCalls[i].name)) lastEdit = i;
|
|
34936
|
+
}
|
|
34937
|
+
if (lastEdit === -1) return null;
|
|
34938
|
+
for (let i = lastEdit + 1; i < toolCalls.length; i += 1) {
|
|
34939
|
+
const c = toolCalls[i];
|
|
34940
|
+
if (c.name === "Bash" && c.command !== void 0 && isVerificationCommand(c.command)) {
|
|
34941
|
+
return null;
|
|
34942
|
+
}
|
|
34943
|
+
}
|
|
34944
|
+
const edited = toolCalls[lastEdit].path;
|
|
34945
|
+
return {
|
|
34946
|
+
detector: "verification",
|
|
34947
|
+
// The path, never the diff: the evidence span is quoted into a refusal,
|
|
34948
|
+
// and `ToolCall` is shaped so a file body cannot reach it.
|
|
34949
|
+
evidence: edited ?? toolCalls[lastEdit].name,
|
|
34950
|
+
reason: "this turn changed a file and then ran no verification command \u2014 no test, type-check, lint or build call follows the last edit (verify-before-complete: a claim without a fresh run is unverified)"
|
|
34951
|
+
};
|
|
34952
|
+
}
|
|
34953
|
+
function stateDir(workspaceRoot) {
|
|
34954
|
+
return path59.join(workspaceRoot, "agents", "runtime", "state", "turn-end-gate");
|
|
34955
|
+
}
|
|
34956
|
+
function sessionStateFile2(workspaceRoot, sessionKey) {
|
|
34957
|
+
return path59.join(stateDir(workspaceRoot), `${sessionKey}.json`);
|
|
34958
|
+
}
|
|
34959
|
+
function deriveSessionKey2(sessionId) {
|
|
34960
|
+
return crypto8.createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
34961
|
+
}
|
|
34962
|
+
function alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal) {
|
|
34963
|
+
try {
|
|
34964
|
+
const raw = fs58.readFileSync(sessionStateFile2(workspaceRoot, sessionKey), "utf-8");
|
|
34965
|
+
const decoded = JSON.parse(raw);
|
|
34966
|
+
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
34967
|
+
return decoded["refused_turn"] === turnOrdinal;
|
|
34968
|
+
}
|
|
34969
|
+
} catch {
|
|
34970
|
+
}
|
|
34971
|
+
return false;
|
|
34972
|
+
}
|
|
34973
|
+
function markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, detector) {
|
|
34974
|
+
if (is_replay_mode()) return;
|
|
34975
|
+
try {
|
|
34976
|
+
atomic_write_json(sessionStateFile2(workspaceRoot, sessionKey), {
|
|
34977
|
+
refused_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
34978
|
+
refused_turn: turnOrdinal,
|
|
34979
|
+
detector
|
|
34980
|
+
});
|
|
34981
|
+
} catch {
|
|
34982
|
+
}
|
|
34983
|
+
}
|
|
34984
|
+
function readTranscriptTail(transcriptPath, opts = {}) {
|
|
34985
|
+
const empty = { lastAssistant: "", turnOrdinal: 0, toolCalls: [] };
|
|
34986
|
+
if (!transcriptPath || !isSafeTranscriptPath(transcriptPath, opts)) return empty;
|
|
34987
|
+
let lines;
|
|
34988
|
+
try {
|
|
34989
|
+
if (opts.maxBytes !== void 0 && fs58.statSync(transcriptPath).size > opts.maxBytes) {
|
|
34990
|
+
return empty;
|
|
34991
|
+
}
|
|
34992
|
+
lines = fs58.readFileSync(transcriptPath, "utf-8").split("\n");
|
|
34993
|
+
} catch {
|
|
34994
|
+
return empty;
|
|
34995
|
+
}
|
|
34996
|
+
let lastAssistant = "";
|
|
34997
|
+
let turnOrdinal = 0;
|
|
34998
|
+
let toolCalls = [];
|
|
34999
|
+
for (const rawLine of lines) {
|
|
35000
|
+
const line = rawLine.trim();
|
|
35001
|
+
if (!line) continue;
|
|
35002
|
+
let obj;
|
|
35003
|
+
try {
|
|
35004
|
+
obj = JSON.parse(line);
|
|
35005
|
+
} catch {
|
|
35006
|
+
continue;
|
|
35007
|
+
}
|
|
35008
|
+
if (typeof obj !== "object" || obj === null || Array.isArray(obj)) continue;
|
|
35009
|
+
const entry = obj;
|
|
35010
|
+
if (entry["isSidechain"] === true) continue;
|
|
35011
|
+
const role = entry["type"];
|
|
35012
|
+
if (role !== "assistant" && role !== "user") continue;
|
|
35013
|
+
const msg = entry["message"];
|
|
35014
|
+
if (typeof msg !== "object" || msg === null || Array.isArray(msg)) continue;
|
|
35015
|
+
const content = msg["content"];
|
|
35016
|
+
if (role === "assistant") {
|
|
35017
|
+
toolCalls.push(..._toolCalls(content));
|
|
35018
|
+
}
|
|
35019
|
+
const text = _messageText(content);
|
|
35020
|
+
if (text === null) continue;
|
|
35021
|
+
if (role === "assistant") {
|
|
35022
|
+
lastAssistant = text;
|
|
35023
|
+
} else if (!isSyntheticPrompt(text)) {
|
|
35024
|
+
turnOrdinal += 1;
|
|
35025
|
+
toolCalls = [];
|
|
35026
|
+
}
|
|
35027
|
+
}
|
|
35028
|
+
return { lastAssistant: lastAssistant.trim(), turnOrdinal, toolCalls };
|
|
35029
|
+
}
|
|
35030
|
+
function _toolCalls(content) {
|
|
35031
|
+
if (!Array.isArray(content)) return [];
|
|
35032
|
+
const out = [];
|
|
35033
|
+
for (const blk of content) {
|
|
35034
|
+
if (typeof blk !== "object" || blk === null || Array.isArray(blk)) continue;
|
|
35035
|
+
const b = blk;
|
|
35036
|
+
if (b["type"] !== "tool_use") continue;
|
|
35037
|
+
const name = b["name"];
|
|
35038
|
+
if (typeof name !== "string") continue;
|
|
35039
|
+
const input = b["input"];
|
|
35040
|
+
const call = { name };
|
|
35041
|
+
if (typeof input === "object" && input !== null && !Array.isArray(input)) {
|
|
35042
|
+
const inp = input;
|
|
35043
|
+
const cmd = inp["command"];
|
|
35044
|
+
if (typeof cmd === "string") call.command = cmd;
|
|
35045
|
+
const p = inp["file_path"] ?? inp["path"] ?? inp["notebook_path"];
|
|
35046
|
+
if (typeof p === "string") call.path = p;
|
|
35047
|
+
}
|
|
35048
|
+
out.push(call);
|
|
35049
|
+
}
|
|
35050
|
+
return out;
|
|
35051
|
+
}
|
|
35052
|
+
function _messageText(content) {
|
|
35053
|
+
if (typeof content === "string") return content;
|
|
35054
|
+
if (!Array.isArray(content)) return null;
|
|
35055
|
+
const parts = [];
|
|
35056
|
+
for (const blk of content) {
|
|
35057
|
+
if (typeof blk !== "object" || blk === null || Array.isArray(blk)) continue;
|
|
35058
|
+
const b = blk;
|
|
35059
|
+
if (b["type"] !== "text") continue;
|
|
35060
|
+
const t = b["text"];
|
|
35061
|
+
if (typeof t === "string") parts.push(t);
|
|
35062
|
+
}
|
|
35063
|
+
return parts.length > 0 ? parts.join("\n") : null;
|
|
35064
|
+
}
|
|
35065
|
+
function str2(v) {
|
|
35066
|
+
return typeof v === "string" ? v : "";
|
|
35067
|
+
}
|
|
35068
|
+
function main24() {
|
|
35069
|
+
let envelope;
|
|
35070
|
+
let payload;
|
|
35071
|
+
try {
|
|
35072
|
+
[envelope, payload] = unwrap(readHookStdin(), "claude");
|
|
35073
|
+
} catch {
|
|
35074
|
+
return EXIT_ALLOW4;
|
|
35075
|
+
}
|
|
35076
|
+
if (payload["stop_hook_active"] === true) return EXIT_ALLOW4;
|
|
35077
|
+
const workspaceRoot = str2(envelope["workspace_root"]) || process.cwd();
|
|
35078
|
+
const transcriptPath = str2(
|
|
35079
|
+
payload["transcript_path"] ?? payload["transcriptPath"]
|
|
35080
|
+
);
|
|
35081
|
+
const { lastAssistant, turnOrdinal, toolCalls } = readTranscriptTail(transcriptPath, {
|
|
35082
|
+
maxBytes: TRANSCRIPT_READ_MAX_BYTES
|
|
35083
|
+
});
|
|
35084
|
+
if (!lastAssistant) return EXIT_ALLOW4;
|
|
35085
|
+
const sessionKey = deriveSessionKey2(
|
|
35086
|
+
str2(envelope["session_id"]) || "unknown-session"
|
|
35087
|
+
);
|
|
35088
|
+
if (alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal)) return EXIT_ALLOW4;
|
|
35089
|
+
const findings = [];
|
|
35090
|
+
for (const f of [
|
|
35091
|
+
detectPromissory(lastAssistant),
|
|
35092
|
+
detectLanguage(lastAssistant, readLanguagePin(workspaceRoot)),
|
|
35093
|
+
detectUnverifiedEdit(toolCalls),
|
|
35094
|
+
// Round 7 § Phase 1 — detector D, in the same unconditional list as the
|
|
35095
|
+
// other three. It shipped with its own settings flag one commit earlier
|
|
35096
|
+
// and that flag is gone: `hooks.turn_end_gate.*` was deleted on
|
|
35097
|
+
// 2026-08-12 because a default-off safety gate is an absent one. Its
|
|
35098
|
+
// gating is where the comment above says gating belongs — inside the
|
|
35099
|
+
// detector: no CI observed, or a settled read, or no completion claim
|
|
35100
|
+
// ⇒ no finding.
|
|
35101
|
+
detectCompletionClaim(lastAssistant, readCiSettled(workspaceRoot))
|
|
35102
|
+
]) {
|
|
35103
|
+
if (f) findings.push(f);
|
|
35104
|
+
}
|
|
35105
|
+
if (findings.length === 0) return EXIT_ALLOW4;
|
|
35106
|
+
markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, findings[0].detector);
|
|
35107
|
+
const lines = findings.map(
|
|
35108
|
+
(f) => ` \xB7 ${f.detector}: ${f.reason}
|
|
35109
|
+
evidence: ${JSON.stringify(f.evidence)}`
|
|
35110
|
+
);
|
|
35111
|
+
process.stderr.write(
|
|
35112
|
+
`turn-end-gate: REFUSED \u2014 this turn is not finished.
|
|
35113
|
+
${lines.join("\n")}
|
|
35114
|
+
Do the promised work now, correct the language, run the verification the edit needs, or read the CI verdict before claiming it \u2014 then end the turn.
|
|
35115
|
+
This turn will not be refused a second time.
|
|
35116
|
+
`
|
|
35117
|
+
);
|
|
35118
|
+
return EXIT_BLOCK2;
|
|
35119
|
+
}
|
|
35120
|
+
function _isCliEntry22() {
|
|
35121
|
+
if (true) {
|
|
35122
|
+
return false;
|
|
35123
|
+
}
|
|
35124
|
+
if (process.argv[1] === void 0) {
|
|
35125
|
+
return false;
|
|
35126
|
+
}
|
|
35127
|
+
const argvUrl = pathToFileURL24(path59.resolve(process.argv[1])).href;
|
|
35128
|
+
if (import.meta.url === argvUrl) {
|
|
35129
|
+
return true;
|
|
35130
|
+
}
|
|
35131
|
+
try {
|
|
35132
|
+
const here = fs58.realpathSync(fileURLToPath35(import.meta.url));
|
|
35133
|
+
const argv = fs58.realpathSync(path59.resolve(process.argv[1]));
|
|
35134
|
+
return here === argv;
|
|
35135
|
+
} catch {
|
|
35136
|
+
return false;
|
|
35137
|
+
}
|
|
35138
|
+
}
|
|
35139
|
+
var EXIT_BLOCK2, EXIT_ALLOW4, TRANSCRIPT_READ_MAX_BYTES, PROMISSORY, HANDBACK, _COMPLETION_RE, _EDIT_TOOLS, _VERIFY_RE;
|
|
35140
|
+
var init_turn_end_gate_hook = __esm({
|
|
35141
|
+
"src/scripts/hooks/turn_end_gate_hook.ts"() {
|
|
35142
|
+
"use strict";
|
|
35143
|
+
init_language_mirror_hook();
|
|
35144
|
+
init_before_complete_hook();
|
|
35145
|
+
init_end_review_nudge_hook();
|
|
35146
|
+
init_envelope();
|
|
35147
|
+
init_hook_stdin();
|
|
35148
|
+
init_state_io();
|
|
35149
|
+
EXIT_BLOCK2 = 1;
|
|
35150
|
+
EXIT_ALLOW4 = 0;
|
|
35151
|
+
TRANSCRIPT_READ_MAX_BYTES = 8 * 1024 * 1024;
|
|
35152
|
+
PROMISSORY = [
|
|
35153
|
+
/\bich melde mich\b/i,
|
|
35154
|
+
/\bmelde ich (mich|dir|Dir)\b/i,
|
|
35155
|
+
/\bich melde\b/i,
|
|
35156
|
+
/\bich berichte\b/i,
|
|
35157
|
+
/\bich (sage|gebe) (dir |Dir )?Bescheid\b/i,
|
|
35158
|
+
/\bals n(ä|ae)chstes (werde|mache|baue|pr(ü|ue)fe) ich\b/i,
|
|
35159
|
+
// German puts the infinitive at the END of the clause ("ich werde jetzt
|
|
35160
|
+
// die Tests schreiben"), so the verb cannot be matched adjacent to
|
|
35161
|
+
// "werde" — it has to be looked for across the rest of the sentence.
|
|
35162
|
+
//
|
|
35163
|
+
// The lookahead excludes a stated REFUSAL to act: declining to do
|
|
35164
|
+
// something is not a promise to do it. R2 finding 4 reproduced four live
|
|
35165
|
+
// false refusals against the old `\bnicht\b`-only version — "Ich werde
|
|
35166
|
+
// nichts anfassen" (no word boundary after `nicht`), "keine Tests
|
|
35167
|
+
// schreiben", "niemals raten", and the passive non-promise "Ich werde
|
|
35168
|
+
// gefragt, ob …". Each was a false refusal on a BLOCKING guard, which is
|
|
35169
|
+
// the precision failure the council warning is about.
|
|
35170
|
+
// `\p{L}` with the `u` flag, NOT `\w`: R2 round 2, finding 15 verified that
|
|
35171
|
+
// `\b\w{3,}en\b` cannot reach an infinitive whose post-umlaut fragment is
|
|
35172
|
+
// short, because `ü`/`ö`/`ä` are not `\w` and create a word boundary — so
|
|
35173
|
+
// "prüfen" and "lösen" were silent while the comment above claimed the
|
|
35174
|
+
// verb-final construction was handled.
|
|
35175
|
+
//
|
|
35176
|
+
// Honest about what this proxy matches: any word of 3+ letters ending in
|
|
35177
|
+
// "en" within the clause, which is the infinitive in practice but also hits
|
|
35178
|
+
// a plural noun ("die Zeilen zählen" matches on "Zeilen"). That is
|
|
35179
|
+
// acceptable here — the clause already requires "ich werde" and excludes
|
|
35180
|
+
// negations and passives, so a forward commitment is what remains — but it
|
|
35181
|
+
// is a proxy for the infinitive, not a parse of one.
|
|
35182
|
+
new RegExp("\\bich werde\\b(?![^.!?\\n]*\\b(?:nicht|nichts|kein(?:e|en|em|er|es)?|niemals|nie)\\b)(?![^.!?\\n]*\\b(?:gefragt|gebeten|informiert|benachrichtigt)\\b)[^.!?\\n]*(?<!\\p{L})\\p{L}{3,}en(?!\\p{L})", "iu"),
|
|
35183
|
+
/\bI(?:'| wi)ll (report|let you know|update you|follow up)\b/i,
|
|
35184
|
+
/\bI(?:'| wi)ll (now |then )?\w+ (it|that|this|next)\b/i,
|
|
35185
|
+
/\bnext,? I(?:'| wi)ll\b/i,
|
|
35186
|
+
/\bI am going to\b/i
|
|
35187
|
+
];
|
|
35188
|
+
HANDBACK = [
|
|
35189
|
+
/\bdas entscheidest (du|Du)\b/i,
|
|
35190
|
+
/\bdeine Entscheidung\b/i,
|
|
35191
|
+
/\bich fasse .{0,40}nicht ungefragt an\b/i,
|
|
35192
|
+
/\bsag (Bescheid|ein Wort)\b/i,
|
|
35193
|
+
/\bwarte auf (deine|Deine|dein|Dein)\b/i,
|
|
35194
|
+
/\byour call\b/i,
|
|
35195
|
+
/\byou decide\b/i,
|
|
35196
|
+
/\blet me know (which|if|whether)\b/i,
|
|
35197
|
+
/\bwaiting for your\b/i
|
|
35198
|
+
];
|
|
35199
|
+
_COMPLETION_RE = /(^|\n)\s*(?:\*\*)?(?:fertig\b|damit ist alles erledigt|aufgabe erledigt|alles erledigt\b|komplett(?:er)? (?:auftrag|abgearbeitet)|der komplette auftrag ist durch|done[.!]|all done\b|task complete)/i;
|
|
35200
|
+
_EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
|
|
35201
|
+
_VERIFY_RE = /\b(test|tests|vitest|jest|pytest|phpunit|pest|tsc|eslint|ruff|mypy|pyright|clippy|typecheck|lint|build|ci|preflight|smoke[-_:a-z]*|check[-_:a-z]*|validate[-_:a-z]*)\b|\b(task|npm|pnpm|yarn|composer|cargo|go|make|php artisan|bun)\s+(run\s+)?\S*(test|check|lint|build|ci|typecheck)/i;
|
|
35202
|
+
if (_isCliEntry22()) {
|
|
35203
|
+
process.exit(main24());
|
|
35204
|
+
}
|
|
35205
|
+
}
|
|
35206
|
+
});
|
|
35207
|
+
|
|
35208
|
+
// src/scripts/hooks/evidence_independence.ts
|
|
35209
|
+
import crypto9 from "node:crypto";
|
|
35210
|
+
import fs59 from "node:fs";
|
|
35211
|
+
import path60 from "node:path";
|
|
35212
|
+
import { fileURLToPath as fileURLToPath36, pathToFileURL as pathToFileURL25 } from "node:url";
|
|
35213
|
+
function _isObject6(v) {
|
|
34398
35214
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
34399
35215
|
}
|
|
34400
35216
|
function isDispatchTool(tool) {
|
|
@@ -34416,10 +35232,10 @@ function preloadedVerdict(prompt) {
|
|
|
34416
35232
|
return null;
|
|
34417
35233
|
}
|
|
34418
35234
|
function extractDispatch(envelope) {
|
|
34419
|
-
const payload =
|
|
35235
|
+
const payload = _isObject6(envelope["payload"]) ? envelope["payload"] : envelope;
|
|
34420
35236
|
const toolRaw = payload["tool_name"] ?? payload["toolName"] ?? payload["tool"];
|
|
34421
35237
|
const tool = typeof toolRaw === "string" ? toolRaw : null;
|
|
34422
|
-
const input =
|
|
35238
|
+
const input = _isObject6(payload["tool_input"]) ? payload["tool_input"] : _isObject6(payload["toolInput"]) ? payload["toolInput"] : payload;
|
|
34423
35239
|
for (const key of ["prompt", "instructions", "task", "description"]) {
|
|
34424
35240
|
const v = input[key];
|
|
34425
35241
|
if (typeof v === "string" && v.trim()) {
|
|
@@ -34430,8 +35246,8 @@ function extractDispatch(envelope) {
|
|
|
34430
35246
|
}
|
|
34431
35247
|
function _ledgerStamp(consumer_root) {
|
|
34432
35248
|
try {
|
|
34433
|
-
const raw =
|
|
34434
|
-
|
|
35249
|
+
const raw = fs59.readFileSync(
|
|
35250
|
+
path60.join(consumer_root, "agents", "state", "git-authorization.json"),
|
|
34435
35251
|
"utf8"
|
|
34436
35252
|
);
|
|
34437
35253
|
const d = JSON.parse(raw);
|
|
@@ -34442,8 +35258,8 @@ function _ledgerStamp(consumer_root) {
|
|
|
34442
35258
|
}
|
|
34443
35259
|
function _load2(target) {
|
|
34444
35260
|
try {
|
|
34445
|
-
const decoded = JSON.parse(
|
|
34446
|
-
if (
|
|
35261
|
+
const decoded = JSON.parse(fs59.readFileSync(target, "utf8"));
|
|
35262
|
+
if (_isObject6(decoded) && Array.isArray(decoded["evaluations"])) {
|
|
34447
35263
|
return decoded;
|
|
34448
35264
|
}
|
|
34449
35265
|
} catch {
|
|
@@ -34452,12 +35268,12 @@ function _load2(target) {
|
|
|
34452
35268
|
}
|
|
34453
35269
|
function decide2(tool, prompt, priorEvaluations) {
|
|
34454
35270
|
if (!isDispatchTool(tool) || !isEvaluationPrompt(prompt)) {
|
|
34455
|
-
return { exit:
|
|
35271
|
+
return { exit: EXIT_ALLOW5, stdout: "", stderr: "", evaluations: priorEvaluations };
|
|
34456
35272
|
}
|
|
34457
35273
|
const preloaded = preloadedVerdict(prompt);
|
|
34458
35274
|
if (preloaded !== null) {
|
|
34459
35275
|
return {
|
|
34460
|
-
exit:
|
|
35276
|
+
exit: EXIT_BLOCK3,
|
|
34461
35277
|
stdout: "",
|
|
34462
35278
|
stderr: `Blocked: this evaluation prompt pre-loads its verdict ("${preloaded}"). That is the construct that produced a fabricated NO-FINDINGS committed as binding gate evidence, over a delta an unsteered pass then found a live critical in. Remove the expectation from the prompt and let the evaluator reach its own verdict.
|
|
34463
35279
|
`,
|
|
@@ -34465,11 +35281,11 @@ function decide2(tool, prompt, priorEvaluations) {
|
|
|
34465
35281
|
};
|
|
34466
35282
|
}
|
|
34467
35283
|
if (!isSelfScoped(prompt)) {
|
|
34468
|
-
return { exit:
|
|
35284
|
+
return { exit: EXIT_ALLOW5, stdout: "", stderr: "", evaluations: priorEvaluations };
|
|
34469
35285
|
}
|
|
34470
35286
|
if (priorEvaluations >= 1) {
|
|
34471
35287
|
return {
|
|
34472
|
-
exit:
|
|
35288
|
+
exit: EXIT_BLOCK3,
|
|
34473
35289
|
stdout: "",
|
|
34474
35290
|
stderr: `Blocked: second evaluation dispatch of your own work in this turn (verdict shopping). One evaluation has already run; commissioning another with a different prompt or scope selects the answer instead of measuring it. Report what the first pass returned, then re-plan.
|
|
34475
35291
|
`,
|
|
@@ -34477,7 +35293,7 @@ function decide2(tool, prompt, priorEvaluations) {
|
|
|
34477
35293
|
};
|
|
34478
35294
|
}
|
|
34479
35295
|
return {
|
|
34480
|
-
exit:
|
|
35296
|
+
exit: EXIT_ALLOW5,
|
|
34481
35297
|
stdout: `${JSON.stringify({ decision: "warn", reason: WARN_TEXT })}
|
|
34482
35298
|
`,
|
|
34483
35299
|
stderr: "",
|
|
@@ -34489,14 +35305,14 @@ function run5(stdin_text, options) {
|
|
|
34489
35305
|
if (stdin_text.trim()) {
|
|
34490
35306
|
try {
|
|
34491
35307
|
const decoded = JSON.parse(stdin_text);
|
|
34492
|
-
if (
|
|
35308
|
+
if (_isObject6(decoded)) {
|
|
34493
35309
|
envelope = decoded;
|
|
34494
35310
|
}
|
|
34495
35311
|
} catch {
|
|
34496
|
-
return
|
|
35312
|
+
return EXIT_ALLOW5;
|
|
34497
35313
|
}
|
|
34498
35314
|
}
|
|
34499
|
-
const target =
|
|
35315
|
+
const target = path60.join(options.consumer_root, STATE_FILE4);
|
|
34500
35316
|
const state = _load2(target);
|
|
34501
35317
|
const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
|
|
34502
35318
|
const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root)}`;
|
|
@@ -34510,7 +35326,7 @@ function run5(stdin_text, options) {
|
|
|
34510
35326
|
if (decision.evaluations > state.evaluations.length) {
|
|
34511
35327
|
state.evaluations.push({
|
|
34512
35328
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
34513
|
-
digest:
|
|
35329
|
+
digest: crypto9.createHash("sha256").update(prompt).digest("hex").slice(0, 16),
|
|
34514
35330
|
prompt_chars: prompt.length
|
|
34515
35331
|
});
|
|
34516
35332
|
try {
|
|
@@ -34526,7 +35342,7 @@ function run5(stdin_text, options) {
|
|
|
34526
35342
|
}
|
|
34527
35343
|
return decision.exit;
|
|
34528
35344
|
}
|
|
34529
|
-
function
|
|
35345
|
+
function main25(argv) {
|
|
34530
35346
|
const args = argv ?? process.argv.slice(2);
|
|
34531
35347
|
let consumer_root = process.cwd();
|
|
34532
35348
|
for (let i = 0; i < args.length; i += 1) {
|
|
@@ -34540,34 +35356,34 @@ function main23(argv) {
|
|
|
34540
35356
|
}
|
|
34541
35357
|
return run5(readHookStdin(), { consumer_root });
|
|
34542
35358
|
}
|
|
34543
|
-
function
|
|
35359
|
+
function _isCliEntry23() {
|
|
34544
35360
|
if (true) {
|
|
34545
35361
|
return false;
|
|
34546
35362
|
}
|
|
34547
35363
|
if (process.argv[1] === void 0) {
|
|
34548
35364
|
return false;
|
|
34549
35365
|
}
|
|
34550
|
-
const argvUrl =
|
|
35366
|
+
const argvUrl = pathToFileURL25(path60.resolve(process.argv[1])).href;
|
|
34551
35367
|
if (import.meta.url === argvUrl) {
|
|
34552
35368
|
return true;
|
|
34553
35369
|
}
|
|
34554
35370
|
try {
|
|
34555
|
-
const here =
|
|
34556
|
-
const argv =
|
|
35371
|
+
const here = fs59.realpathSync(fileURLToPath36(import.meta.url));
|
|
35372
|
+
const argv = fs59.realpathSync(path60.resolve(process.argv[1]));
|
|
34557
35373
|
return here === argv;
|
|
34558
35374
|
} catch {
|
|
34559
35375
|
return false;
|
|
34560
35376
|
}
|
|
34561
35377
|
}
|
|
34562
|
-
var
|
|
35378
|
+
var EXIT_ALLOW5, EXIT_BLOCK3, STATE_FILE4, DISPATCH_TOOLS, EVALUATION_RE, PRELOADED_VERDICT_RE, SELF_SCOPE_RE, WARN_TEXT;
|
|
34563
35379
|
var init_evidence_independence = __esm({
|
|
34564
35380
|
"src/scripts/hooks/evidence_independence.ts"() {
|
|
34565
35381
|
"use strict";
|
|
34566
35382
|
init_state_io();
|
|
34567
35383
|
init_hook_stdin();
|
|
34568
|
-
|
|
34569
|
-
|
|
34570
|
-
STATE_FILE4 =
|
|
35384
|
+
EXIT_ALLOW5 = 0;
|
|
35385
|
+
EXIT_BLOCK3 = 1;
|
|
35386
|
+
STATE_FILE4 = path60.join("agents", "state", "evidence-dispatch.json");
|
|
34571
35387
|
DISPATCH_TOOLS = /* @__PURE__ */ new Set([
|
|
34572
35388
|
"Agent",
|
|
34573
35389
|
"Task",
|
|
@@ -34600,19 +35416,36 @@ var init_evidence_independence = __esm({
|
|
|
34600
35416
|
];
|
|
34601
35417
|
SELF_SCOPE_RE = /\b(my (work|change|diff|implementation|code|fix|patch|branch|pr)|this (diff|change|branch|pr|delta|implementation|patch)|the delta|the change i|what i (wrote|built|changed|implemented)|i just (wrote|built|changed|implemented))\b/i;
|
|
34602
35418
|
WARN_TEXT = "First evaluation dispatch this turn. Two shapes fabricated a binding honest-null in the audited sessions \u2014 check your prompt for both before it goes out: (1) a verdict pre-loaded into the prompt, and (2) a scope narrowed to files you chose. A review you commissioned on your own work is admissible as gate evidence only when the prompt is recorded alongside the verdict.";
|
|
34603
|
-
if (
|
|
34604
|
-
process.exit(
|
|
35419
|
+
if (_isCliEntry23()) {
|
|
35420
|
+
process.exit(main25());
|
|
34605
35421
|
}
|
|
34606
35422
|
}
|
|
34607
35423
|
});
|
|
34608
35424
|
|
|
34609
35425
|
// src/scripts/conformance_scan.ts
|
|
34610
|
-
import { createHash as
|
|
34611
|
-
import
|
|
34612
|
-
import
|
|
34613
|
-
import
|
|
34614
|
-
import { fileURLToPath as
|
|
34615
|
-
function
|
|
35426
|
+
import { createHash as createHash10 } from "node:crypto";
|
|
35427
|
+
import fs60 from "node:fs";
|
|
35428
|
+
import os13 from "node:os";
|
|
35429
|
+
import path61 from "node:path";
|
|
35430
|
+
import { fileURLToPath as fileURLToPath37, pathToFileURL as pathToFileURL26 } from "node:url";
|
|
35431
|
+
function spansCarrierChange(firstAts) {
|
|
35432
|
+
const stamps = firstAts.filter((s) => s !== "").sort();
|
|
35433
|
+
if (stamps.length === 0) {
|
|
35434
|
+
return { spans: false, what: "" };
|
|
35435
|
+
}
|
|
35436
|
+
const lo = stamps[0];
|
|
35437
|
+
const hi = stamps[stamps.length - 1];
|
|
35438
|
+
for (const c of CARRIER_CHANGES) {
|
|
35439
|
+
if (lo < c.at && hi >= c.at) {
|
|
35440
|
+
return { spans: true, what: c.what };
|
|
35441
|
+
}
|
|
35442
|
+
}
|
|
35443
|
+
return { spans: false, what: "" };
|
|
35444
|
+
}
|
|
35445
|
+
function bandVerdict(rate_pct, assistant_turns, opts = {}) {
|
|
35446
|
+
if (opts.spansCarrier === true) {
|
|
35447
|
+
return "era-spanning";
|
|
35448
|
+
}
|
|
34616
35449
|
if (assistant_turns < BAND_MIN_TURNS) {
|
|
34617
35450
|
return "corpus-too-small";
|
|
34618
35451
|
}
|
|
@@ -34646,7 +35479,7 @@ function renderWhy(report2, id) {
|
|
|
34646
35479
|
}
|
|
34647
35480
|
return lines.join("\n");
|
|
34648
35481
|
}
|
|
34649
|
-
function
|
|
35482
|
+
function _isObject7(v) {
|
|
34650
35483
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
34651
35484
|
}
|
|
34652
35485
|
function userText(entry) {
|
|
@@ -34670,15 +35503,15 @@ function assistantText(entry) {
|
|
|
34670
35503
|
}
|
|
34671
35504
|
function toolUses2(entry) {
|
|
34672
35505
|
const msg = entry["message"];
|
|
34673
|
-
const content =
|
|
35506
|
+
const content = _isObject7(msg) ? msg["content"] : void 0;
|
|
34674
35507
|
if (!Array.isArray(content)) {
|
|
34675
35508
|
return [];
|
|
34676
35509
|
}
|
|
34677
|
-
return content.filter((b) =>
|
|
35510
|
+
return content.filter((b) => _isObject7(b) && b["type"] === "tool_use").map((b) => {
|
|
34678
35511
|
const o = b;
|
|
34679
35512
|
return {
|
|
34680
35513
|
name: String(o["name"] ?? ""),
|
|
34681
|
-
input:
|
|
35514
|
+
input: _isObject7(o["input"]) ? o["input"] : {}
|
|
34682
35515
|
};
|
|
34683
35516
|
});
|
|
34684
35517
|
}
|
|
@@ -34693,7 +35526,9 @@ function scanSession(sessionId, lines) {
|
|
|
34693
35526
|
session: sessionId,
|
|
34694
35527
|
user_turns: 0,
|
|
34695
35528
|
assistant_turns: 0,
|
|
34696
|
-
violations: []
|
|
35529
|
+
violations: [],
|
|
35530
|
+
de_pin_turns: 0,
|
|
35531
|
+
first_at: ""
|
|
34697
35532
|
};
|
|
34698
35533
|
let pinned = null;
|
|
34699
35534
|
let pendingPoll = null;
|
|
@@ -34702,6 +35537,8 @@ function scanSession(sessionId, lines) {
|
|
|
34702
35537
|
let evaluationsThisTurn = 0;
|
|
34703
35538
|
let turnsSincePrompt = 0;
|
|
34704
35539
|
let compactionSincePrompt = false;
|
|
35540
|
+
let ciSeen = false;
|
|
35541
|
+
let ciSettled = false;
|
|
34705
35542
|
for (const line of lines) {
|
|
34706
35543
|
if (!line.trim()) {
|
|
34707
35544
|
continue;
|
|
@@ -34712,6 +35549,9 @@ function scanSession(sessionId, lines) {
|
|
|
34712
35549
|
} catch {
|
|
34713
35550
|
continue;
|
|
34714
35551
|
}
|
|
35552
|
+
if (report2.first_at === "" && typeof entry["timestamp"] === "string") {
|
|
35553
|
+
report2.first_at = entry["timestamp"];
|
|
35554
|
+
}
|
|
34715
35555
|
if (entry["type"] === "user" && entry["toolUseResult"] !== void 0 && pendingPoll !== null) {
|
|
34716
35556
|
const raw = entry["toolUseResult"];
|
|
34717
35557
|
const out = typeof raw === "string" ? raw : JSON.stringify(raw);
|
|
@@ -34726,6 +35566,8 @@ function scanSession(sessionId, lines) {
|
|
|
34726
35566
|
detail: `CI poll read as settled without an in-flight observation: ${out.slice(0, 90)}`
|
|
34727
35567
|
});
|
|
34728
35568
|
}
|
|
35569
|
+
ciSeen = true;
|
|
35570
|
+
ciSettled = pending === 0 && sawPending && !isVacuousOutput(out);
|
|
34729
35571
|
pendingPoll = null;
|
|
34730
35572
|
continue;
|
|
34731
35573
|
}
|
|
@@ -34765,6 +35607,20 @@ function scanSession(sessionId, lines) {
|
|
|
34765
35607
|
if (prose !== null) {
|
|
34766
35608
|
report2.assistant_turns += 1;
|
|
34767
35609
|
turnsSincePrompt += 1;
|
|
35610
|
+
if (pinned === "de") {
|
|
35611
|
+
report2.de_pin_turns += 1;
|
|
35612
|
+
}
|
|
35613
|
+
if (!HARNESS_TEXT.test((prose.split("\n").find((l) => l.trim()) ?? "").trim())) {
|
|
35614
|
+
const cc = detectCompletionClaim(prose, { seen: ciSeen, settled: ciSettled });
|
|
35615
|
+
if (cc !== null) {
|
|
35616
|
+
report2.violations.push({
|
|
35617
|
+
check: "completion-claim",
|
|
35618
|
+
session: sessionId,
|
|
35619
|
+
at,
|
|
35620
|
+
detail: `completion claimed over an unsettled CI read: "${cc.evidence.slice(0, 110)}"`
|
|
35621
|
+
});
|
|
35622
|
+
}
|
|
35623
|
+
}
|
|
34768
35624
|
if (pinned === "de") {
|
|
34769
35625
|
const first = prose.split("\n").find((l) => l.trim()) ?? "";
|
|
34770
35626
|
if (HARNESS_TEXT.test(first.trim())) {
|
|
@@ -34827,7 +35683,7 @@ function scanSession(sessionId, lines) {
|
|
|
34827
35683
|
}
|
|
34828
35684
|
function defaultStore(projectDir) {
|
|
34829
35685
|
const slug = projectDir.replace(/[/.]/g, "-");
|
|
34830
|
-
return
|
|
35686
|
+
return path61.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
|
|
34831
35687
|
}
|
|
34832
35688
|
function _tokens(chars) {
|
|
34833
35689
|
return Math.round(chars / 4);
|
|
@@ -34838,13 +35694,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
34838
35694
|
return {
|
|
34839
35695
|
project: {
|
|
34840
35696
|
dir: projectRulesDir,
|
|
34841
|
-
present:
|
|
35697
|
+
present: fs60.existsSync(projectRulesDir),
|
|
34842
35698
|
files: p.files,
|
|
34843
35699
|
tokens: _tokens(p.chars)
|
|
34844
35700
|
},
|
|
34845
35701
|
global: {
|
|
34846
35702
|
dir: globalRulesDir,
|
|
34847
|
-
present:
|
|
35703
|
+
present: fs60.existsSync(globalRulesDir),
|
|
34848
35704
|
files: g.files,
|
|
34849
35705
|
tokens: _tokens(g.chars)
|
|
34850
35706
|
},
|
|
@@ -34852,13 +35708,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
34852
35708
|
};
|
|
34853
35709
|
}
|
|
34854
35710
|
function storeKey(store) {
|
|
34855
|
-
return
|
|
35711
|
+
return createHash10("sha256").update(path61.resolve(store)).digest("hex").slice(0, 12);
|
|
34856
35712
|
}
|
|
34857
35713
|
function scanStore(store, limit) {
|
|
34858
|
-
const files =
|
|
35714
|
+
const files = fs60.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs60.statSync(path61.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
|
|
34859
35715
|
const per_session = [];
|
|
34860
35716
|
for (const f of files) {
|
|
34861
|
-
const lines =
|
|
35717
|
+
const lines = fs60.readFileSync(path61.join(store, f), "utf8").split("\n");
|
|
34862
35718
|
const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
|
|
34863
35719
|
if (r.assistant_turns > 0) {
|
|
34864
35720
|
per_session.push(r);
|
|
@@ -34868,7 +35724,8 @@ function scanStore(store, limit) {
|
|
|
34868
35724
|
"language-pin": 0,
|
|
34869
35725
|
"git-authorization": 0,
|
|
34870
35726
|
"vacuous-evidence": 0,
|
|
34871
|
-
"evidence-steering": 0
|
|
35727
|
+
"evidence-steering": 0,
|
|
35728
|
+
"completion-claim": 0
|
|
34872
35729
|
};
|
|
34873
35730
|
for (const s of per_session) {
|
|
34874
35731
|
for (const v of s.violations) {
|
|
@@ -34878,11 +35735,14 @@ function scanStore(store, limit) {
|
|
|
34878
35735
|
const assistant_turns = per_session.reduce((n, s) => n + s.assistant_turns, 0);
|
|
34879
35736
|
const language_pin = totals["language-pin"] ?? 0;
|
|
34880
35737
|
const rate_pct = assistant_turns === 0 ? 0 : Number((100 * language_pin / assistant_turns).toFixed(1));
|
|
35738
|
+
const de_pin_turns = per_session.reduce((n, s) => n + s.de_pin_turns, 0);
|
|
35739
|
+
const rate_pct_de_pin = de_pin_turns === 0 ? 0 : Number((100 * language_pin / de_pin_turns).toFixed(1));
|
|
35740
|
+
const era = spansCarrierChange(per_session.map((s) => s.first_at));
|
|
34881
35741
|
const delivered = measureDelivered(
|
|
34882
|
-
|
|
34883
|
-
|
|
35742
|
+
path61.join(REPO_ROOT6, ".claude", "rules"),
|
|
35743
|
+
path61.join(process.env["HOME"] ?? os13.homedir(), ".claude", "rules")
|
|
34884
35744
|
);
|
|
34885
|
-
const ownStore =
|
|
35745
|
+
const ownStore = path61.resolve(store) === path61.resolve(defaultStore(REPO_ROOT6));
|
|
34886
35746
|
return {
|
|
34887
35747
|
scanned_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
34888
35748
|
store,
|
|
@@ -34896,7 +35756,11 @@ function scanStore(store, limit) {
|
|
|
34896
35756
|
assistant_turns,
|
|
34897
35757
|
language_pin,
|
|
34898
35758
|
rate_pct,
|
|
34899
|
-
|
|
35759
|
+
de_pin_turns,
|
|
35760
|
+
rate_pct_de_pin,
|
|
35761
|
+
era_spanning: era.spans,
|
|
35762
|
+
era_reason: era.what,
|
|
35763
|
+
band: bandVerdict(rate_pct, assistant_turns, { spansCarrier: era.spans }),
|
|
34900
35764
|
// Only attach the carrier figures when the rate and the carriers describe
|
|
34901
35765
|
// the same project.
|
|
34902
35766
|
delivered_project_tokens: ownStore ? delivered.project.tokens : null,
|
|
@@ -34905,8 +35769,8 @@ function scanStore(store, limit) {
|
|
|
34905
35769
|
};
|
|
34906
35770
|
}
|
|
34907
35771
|
function recordRate(file, scanned_at, rate) {
|
|
34908
|
-
|
|
34909
|
-
|
|
35772
|
+
fs60.mkdirSync(path61.dirname(file), { recursive: true });
|
|
35773
|
+
fs60.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
|
|
34910
35774
|
`, "utf8");
|
|
34911
35775
|
}
|
|
34912
35776
|
function render2(report2) {
|
|
@@ -34937,7 +35801,26 @@ function render2(report2) {
|
|
|
34937
35801
|
lines.push(
|
|
34938
35802
|
` language-pin rate ${report2.rate.rate_pct.toFixed(1)}% (${report2.rate.language_pin} of ${report2.rate.assistant_turns} assistant turns)`
|
|
34939
35803
|
);
|
|
34940
|
-
|
|
35804
|
+
const dePinTurns = report2.rate.de_pin_turns;
|
|
35805
|
+
const dePinRate = report2.rate.rate_pct_de_pin;
|
|
35806
|
+
if (typeof dePinTurns === "number" && typeof dePinRate === "number") {
|
|
35807
|
+
lines.push(
|
|
35808
|
+
` ${dePinRate.toFixed(1)}% (${report2.rate.language_pin} of ${dePinTurns} turns under a GERMAN pin \u2014 the only turns this check can fire on)`
|
|
35809
|
+
);
|
|
35810
|
+
lines.push(
|
|
35811
|
+
" The band (M5, n=3) was computed on the ALL-turns denominator, so the first figure"
|
|
35812
|
+
);
|
|
35813
|
+
lines.push(" is the comparable one and the second is the honest one. Both are printed.");
|
|
35814
|
+
}
|
|
35815
|
+
if (report2.rate.band === "era-spanning") {
|
|
35816
|
+
lines.push(
|
|
35817
|
+
` Not compared: the corpus SPANS a carrier landing \u2014 ${report2.rate.era_reason || "see CARRIER_CHANGES"}.`
|
|
35818
|
+
);
|
|
35819
|
+
lines.push(" A rate pooled across it is a weighted average of two different systems, not");
|
|
35820
|
+
lines.push(" a reading about behaviour. Round 7 measured 23.1% before and 0.0% after that");
|
|
35821
|
+
lines.push(" exact carrier; the pooled 6.5% was announced as the falsifier firing.");
|
|
35822
|
+
lines.push(" Split the window at the carrier date and read each era on its own.");
|
|
35823
|
+
} else if (report2.rate.band === "corpus-too-small") {
|
|
34941
35824
|
lines.push(
|
|
34942
35825
|
` Not compared: ${report2.rate.assistant_turns} turns is below the ${BAND_MIN_TURNS} of the`
|
|
34943
35826
|
);
|
|
@@ -34959,11 +35842,22 @@ function render2(report2) {
|
|
|
34959
35842
|
lines.push(" as new. Store novelty is not project novelty.");
|
|
34960
35843
|
}
|
|
34961
35844
|
lines.push("");
|
|
34962
|
-
lines.push(" Scanned checks are exactly the mechanised ones.
|
|
34963
|
-
lines.push("
|
|
35845
|
+
lines.push(" Scanned checks are exactly the mechanised ones. What is NOT in the counts above:");
|
|
35846
|
+
lines.push(" ask-shape (trailing free-text offer) \u2014 measured NOWHERE. ~11 findings in round 7's");
|
|
35847
|
+
lines.push(" reading half; the discriminator needs judgement, so it stays advisory on purpose.");
|
|
35848
|
+
lines.push(" session-canary (opening greeting) \u2014 not here, but PROBEABLE:");
|
|
35849
|
+
lines.push(" `./scripts-run src/scripts/probe_session_canary`. Round 7: 25/28 sessions,");
|
|
35850
|
+
lines.push(" 24/25 post-carrier. The per-TASK instance is undecidable \u2014 no task boundary");
|
|
35851
|
+
lines.push(" is recorded in a transcript.");
|
|
35852
|
+
lines.push(" promissory closings \u2014 not here, but ALREADY GATED: `turn-end-gate`");
|
|
35853
|
+
lines.push(" ships a blocking `detectPromissory`. Round 7 probe: 1 of 120 hand-back turns");
|
|
35854
|
+
lines.push(" (the 163 this line first printed was the retracted denominator \u2014 it counted");
|
|
35855
|
+
lines.push(" synthetic user turns as hand-back closers).");
|
|
35856
|
+
lines.push(" `./scripts-run src/scripts/probe_promissory_closing`.");
|
|
35857
|
+
lines.push(" checkbox batching \u2014 measured NOWHERE. ~5 low-severity findings.");
|
|
34964
35858
|
return lines.join("\n");
|
|
34965
35859
|
}
|
|
34966
|
-
function
|
|
35860
|
+
function main26(argv) {
|
|
34967
35861
|
const args = argv ?? process.argv.slice(2);
|
|
34968
35862
|
let store = null;
|
|
34969
35863
|
let limit = 30;
|
|
@@ -34995,14 +35889,14 @@ function main24(argv) {
|
|
|
34995
35889
|
return 2;
|
|
34996
35890
|
}
|
|
34997
35891
|
const resolved = store ?? defaultStore(process.cwd());
|
|
34998
|
-
if (!
|
|
35892
|
+
if (!fs60.existsSync(resolved)) {
|
|
34999
35893
|
process.stderr.write(`conformance:behavior: no transcript store at ${resolved}
|
|
35000
35894
|
`);
|
|
35001
35895
|
return 1;
|
|
35002
35896
|
}
|
|
35003
35897
|
const report2 = scanStore(resolved, Number.isFinite(limit) && limit > 0 ? limit : 30);
|
|
35004
35898
|
if (out) {
|
|
35005
|
-
|
|
35899
|
+
fs60.writeFileSync(out, `${JSON.stringify(report2, null, 2)}
|
|
35006
35900
|
`, "utf8");
|
|
35007
35901
|
}
|
|
35008
35902
|
if (record) {
|
|
@@ -35010,7 +35904,7 @@ function main24(argv) {
|
|
|
35010
35904
|
}
|
|
35011
35905
|
if (why !== null) {
|
|
35012
35906
|
const id = why;
|
|
35013
|
-
|
|
35907
|
+
fs60.writeSync(
|
|
35014
35908
|
1,
|
|
35015
35909
|
json ? `${JSON.stringify(
|
|
35016
35910
|
{
|
|
@@ -35030,31 +35924,31 @@ function main24(argv) {
|
|
|
35030
35924
|
);
|
|
35031
35925
|
return 0;
|
|
35032
35926
|
}
|
|
35033
|
-
|
|
35927
|
+
fs60.writeSync(1, json ? `${JSON.stringify(report2, null, 2)}
|
|
35034
35928
|
` : `${render2(report2)}
|
|
35035
35929
|
`);
|
|
35036
35930
|
return 0;
|
|
35037
35931
|
}
|
|
35038
|
-
function
|
|
35932
|
+
function _isCliEntry24() {
|
|
35039
35933
|
if (true) {
|
|
35040
35934
|
return false;
|
|
35041
35935
|
}
|
|
35042
35936
|
if (process.argv[1] === void 0) {
|
|
35043
35937
|
return false;
|
|
35044
35938
|
}
|
|
35045
|
-
const argvUrl =
|
|
35939
|
+
const argvUrl = pathToFileURL26(path61.resolve(process.argv[1])).href;
|
|
35046
35940
|
if (import.meta.url === argvUrl) {
|
|
35047
35941
|
return true;
|
|
35048
35942
|
}
|
|
35049
35943
|
try {
|
|
35050
|
-
const here =
|
|
35051
|
-
const argv =
|
|
35944
|
+
const here = fs60.realpathSync(fileURLToPath37(import.meta.url));
|
|
35945
|
+
const argv = fs60.realpathSync(path61.resolve(process.argv[1]));
|
|
35052
35946
|
return here === argv;
|
|
35053
35947
|
} catch {
|
|
35054
35948
|
return false;
|
|
35055
35949
|
}
|
|
35056
35950
|
}
|
|
35057
|
-
var REPO_ROOT6, OBSERVED_BAND, BAND_MIN_TURNS, CHECK_IDS2, CHECK_MEANINGS, HARNESS_TEXT, EN_OPENER, DEFAULT_RATE_SERIES;
|
|
35951
|
+
var REPO_ROOT6, OBSERVED_BAND, BAND_MIN_TURNS, CARRIER_CHANGES, CHECK_IDS2, CHECK_MEANINGS, HARNESS_TEXT, EN_OPENER, DEFAULT_RATE_SERIES;
|
|
35058
35952
|
var init_conformance_scan = __esm({
|
|
35059
35953
|
"src/scripts/conformance_scan.ts"() {
|
|
35060
35954
|
"use strict";
|
|
@@ -35065,46 +35959,52 @@ var init_conformance_scan = __esm({
|
|
|
35065
35959
|
init_git_authorization_hook();
|
|
35066
35960
|
init_block_unauthorized_git();
|
|
35067
35961
|
init_before_complete_hook();
|
|
35962
|
+
init_turn_end_gate_hook();
|
|
35068
35963
|
init_evidence_independence();
|
|
35069
|
-
REPO_ROOT6 =
|
|
35964
|
+
REPO_ROOT6 = path61.resolve(path61.dirname(fileURLToPath37(import.meta.url)), "..", "..");
|
|
35070
35965
|
OBSERVED_BAND = { low: 9.1, high: 39.2 };
|
|
35071
35966
|
BAND_MIN_TURNS = 1978;
|
|
35967
|
+
CARRIER_CHANGES = [
|
|
35968
|
+
{ at: "2026-08-07T00:00:00Z", what: "language-pin bound on user_prompt_submit (round 5)" }
|
|
35969
|
+
];
|
|
35072
35970
|
CHECK_IDS2 = [
|
|
35073
35971
|
"language-pin",
|
|
35074
35972
|
"git-authorization",
|
|
35075
35973
|
"vacuous-evidence",
|
|
35076
|
-
"evidence-steering"
|
|
35974
|
+
"evidence-steering",
|
|
35975
|
+
"completion-claim"
|
|
35077
35976
|
];
|
|
35078
35977
|
CHECK_MEANINGS = {
|
|
35079
35978
|
"language-pin": "An assistant turn whose user-visible prose is not in the language that turn's own pin named. Carries provenance (turns_since_prompt, compaction_since_prompt) so a pin that was ABSENT because compaction removed it stays distinguishable from one that was present and ignored.",
|
|
35080
35979
|
"git-authorization": "A gated git operation performed in a session where no authorization for that operation was observed. Authorization is per-operation and never carries from one to the next.",
|
|
35081
35980
|
"vacuous-evidence": "A CI poll read as settled without ever observing an in-flight run \u2014 the poll gap that reports a green settle over a window in which nothing was pending yet.",
|
|
35082
|
-
"evidence-steering": "A self-commissioned evaluation whose prompt pre-loaded its own verdict, or a second self-scoped evaluation of the same subject within one turn."
|
|
35981
|
+
"evidence-steering": "A self-commissioned evaluation whose prompt pre-loaded its own verdict, or a second self-scoped evaluation of the same subject within one turn.",
|
|
35982
|
+
"completion-claim": "An assistant turn claiming the work is complete while the last CI read in that session was NOT settled. Round 7 measured 14 instances by reading, each followed by the user handing the work back; this is the same predicate `turn-end-gate`'s completion detector refuses on, so the rate and the gate cannot disagree. A session that never polled CI can never hit."
|
|
35083
35983
|
};
|
|
35084
35984
|
HARNESS_TEXT = /^(API Error:|Request (timed out|was aborted)|\[Request interrupted|Error: |Credit balance is too low|You've hit your|Prompt is too long)/i;
|
|
35085
35985
|
EN_OPENER = /^(let me|i'?ll |i'?m |found it|ok[,. ]|okay|alright|here'?s|now[,. ]|looking|checking|reading|running|the |this |that |there |we |you |good |right[,. ]|perfect|done[.,]|all |confirmed|correct)/i;
|
|
35086
|
-
DEFAULT_RATE_SERIES =
|
|
35986
|
+
DEFAULT_RATE_SERIES = path61.join(
|
|
35087
35987
|
REPO_ROOT6,
|
|
35088
35988
|
"agents",
|
|
35089
35989
|
"runtime",
|
|
35090
35990
|
"state",
|
|
35091
35991
|
"conformance-rates.jsonl"
|
|
35092
35992
|
);
|
|
35093
|
-
if (
|
|
35094
|
-
process.exit(
|
|
35993
|
+
if (_isCliEntry24()) {
|
|
35994
|
+
process.exit(main26());
|
|
35095
35995
|
}
|
|
35096
35996
|
}
|
|
35097
35997
|
});
|
|
35098
35998
|
|
|
35099
35999
|
// src/scripts/report_carrier_divergence.ts
|
|
35100
|
-
import * as
|
|
35101
|
-
import * as
|
|
35102
|
-
import * as
|
|
36000
|
+
import * as fs61 from "node:fs";
|
|
36001
|
+
import * as os14 from "node:os";
|
|
36002
|
+
import * as path62 from "node:path";
|
|
35103
36003
|
import process16 from "node:process";
|
|
35104
|
-
import { fileURLToPath as
|
|
36004
|
+
import { fileURLToPath as fileURLToPath38, pathToFileURL as pathToFileURL27 } from "node:url";
|
|
35105
36005
|
function _listRules(dir) {
|
|
35106
36006
|
try {
|
|
35107
|
-
return
|
|
36007
|
+
return fs61.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
|
|
35108
36008
|
} catch {
|
|
35109
36009
|
return [];
|
|
35110
36010
|
}
|
|
@@ -35112,7 +36012,7 @@ function _listRules(dir) {
|
|
|
35112
36012
|
function _ruleType(file) {
|
|
35113
36013
|
let text;
|
|
35114
36014
|
try {
|
|
35115
|
-
text =
|
|
36015
|
+
text = fs61.readFileSync(file, "utf-8");
|
|
35116
36016
|
} catch {
|
|
35117
36017
|
return "";
|
|
35118
36018
|
}
|
|
@@ -35123,8 +36023,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
35123
36023
|
const out = {
|
|
35124
36024
|
projectDir,
|
|
35125
36025
|
globalDir,
|
|
35126
|
-
globalPresent:
|
|
35127
|
-
projectPresent:
|
|
36026
|
+
globalPresent: fs61.existsSync(globalDir),
|
|
36027
|
+
projectPresent: fs61.existsSync(projectDir),
|
|
35128
36028
|
shared: 0,
|
|
35129
36029
|
identical: [],
|
|
35130
36030
|
provenanceOnly: [],
|
|
@@ -35147,7 +36047,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
35147
36047
|
}
|
|
35148
36048
|
if (!inP && inG) {
|
|
35149
36049
|
out.globalOnly.push(rule);
|
|
35150
|
-
if (sourceDir !== void 0 && _ruleType(
|
|
36050
|
+
if (sourceDir !== void 0 && _ruleType(path62.join(sourceDir, rule)) === "manual") {
|
|
35151
36051
|
out.manualOnlyGlobal.push(rule);
|
|
35152
36052
|
}
|
|
35153
36053
|
continue;
|
|
@@ -35157,8 +36057,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
35157
36057
|
let projectCopy;
|
|
35158
36058
|
let globalCopy;
|
|
35159
36059
|
try {
|
|
35160
|
-
projectCopy =
|
|
35161
|
-
globalCopy =
|
|
36060
|
+
projectCopy = fs61.readFileSync(path62.join(projectDir, rule));
|
|
36061
|
+
globalCopy = fs61.readFileSync(path62.join(globalDir, rule));
|
|
35162
36062
|
verdict = comparePair(projectCopy, globalCopy);
|
|
35163
36063
|
} catch {
|
|
35164
36064
|
out.shared -= 1;
|
|
@@ -35303,11 +36203,11 @@ function render3(d) {
|
|
|
35303
36203
|
}
|
|
35304
36204
|
return lines.join("\n");
|
|
35305
36205
|
}
|
|
35306
|
-
function
|
|
36206
|
+
function main27(argv) {
|
|
35307
36207
|
const args = argv ?? process16.argv.slice(2);
|
|
35308
|
-
let projectDir =
|
|
35309
|
-
let globalDir =
|
|
35310
|
-
let sourceDir =
|
|
36208
|
+
let projectDir = path62.join(REPO_ROOT7, PROJECT_RULES);
|
|
36209
|
+
let globalDir = path62.join(os14.homedir(), GLOBAL_RULES);
|
|
36210
|
+
let sourceDir = path62.join(REPO_ROOT7, PROJECTION_SOURCE);
|
|
35311
36211
|
const value = (i) => {
|
|
35312
36212
|
const v = args[i + 1];
|
|
35313
36213
|
return v === void 0 || v.startsWith("-") ? null : v;
|
|
@@ -35321,7 +36221,7 @@ function main25(argv) {
|
|
|
35321
36221
|
`);
|
|
35322
36222
|
return 1;
|
|
35323
36223
|
}
|
|
35324
|
-
const resolved =
|
|
36224
|
+
const resolved = path62.resolve(v);
|
|
35325
36225
|
if (a === "--project") projectDir = resolved;
|
|
35326
36226
|
else if (a === "--global") globalDir = resolved;
|
|
35327
36227
|
else sourceDir = resolved;
|
|
@@ -35341,11 +36241,11 @@ function main25(argv) {
|
|
|
35341
36241
|
`);
|
|
35342
36242
|
return 0;
|
|
35343
36243
|
}
|
|
35344
|
-
function
|
|
36244
|
+
function _isCliEntry25() {
|
|
35345
36245
|
if (process16.argv[1] === void 0) return false;
|
|
35346
|
-
if (import.meta.url ===
|
|
36246
|
+
if (import.meta.url === pathToFileURL27(path62.resolve(process16.argv[1])).href) return true;
|
|
35347
36247
|
try {
|
|
35348
|
-
return
|
|
36248
|
+
return fs61.realpathSync(_HERE17) === fs61.realpathSync(path62.resolve(process16.argv[1]));
|
|
35349
36249
|
} catch {
|
|
35350
36250
|
return false;
|
|
35351
36251
|
}
|
|
@@ -35355,37 +36255,37 @@ var init_report_carrier_divergence = __esm({
|
|
|
35355
36255
|
"src/scripts/report_carrier_divergence.ts"() {
|
|
35356
36256
|
"use strict";
|
|
35357
36257
|
init_carrier_divergence();
|
|
35358
|
-
_HERE17 =
|
|
35359
|
-
REPO_ROOT7 =
|
|
35360
|
-
PROJECT_RULES =
|
|
35361
|
-
PROJECTION_SOURCE =
|
|
35362
|
-
GLOBAL_RULES =
|
|
35363
|
-
if (
|
|
35364
|
-
process16.exit(
|
|
36258
|
+
_HERE17 = fileURLToPath38(import.meta.url);
|
|
36259
|
+
REPO_ROOT7 = path62.resolve(path62.dirname(_HERE17), "..", "..");
|
|
36260
|
+
PROJECT_RULES = path62.join(".claude", "rules");
|
|
36261
|
+
PROJECTION_SOURCE = path62.join("dist", "agent-src", "rules");
|
|
36262
|
+
GLOBAL_RULES = path62.join(".claude", "rules");
|
|
36263
|
+
if (_isCliEntry25()) {
|
|
36264
|
+
process16.exit(main27());
|
|
35365
36265
|
}
|
|
35366
36266
|
}
|
|
35367
36267
|
});
|
|
35368
36268
|
|
|
35369
36269
|
// src/scripts/report_skill_activation.ts
|
|
35370
|
-
import * as
|
|
35371
|
-
import * as
|
|
35372
|
-
import * as
|
|
35373
|
-
import { fileURLToPath as
|
|
36270
|
+
import * as fs62 from "node:fs";
|
|
36271
|
+
import * as os15 from "node:os";
|
|
36272
|
+
import * as path63 from "node:path";
|
|
36273
|
+
import { fileURLToPath as fileURLToPath39, pathToFileURL as pathToFileURL28 } from "node:url";
|
|
35374
36274
|
function censusSkills(root) {
|
|
35375
36275
|
const out = { total: 0, withTriggerKey: [], withDeterministicObligation: [] };
|
|
35376
|
-
if (!
|
|
36276
|
+
if (!fs62.existsSync(root)) {
|
|
35377
36277
|
return out;
|
|
35378
36278
|
}
|
|
35379
|
-
for (const entry of
|
|
36279
|
+
for (const entry of fs62.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
35380
36280
|
if (!entry.isDirectory()) {
|
|
35381
36281
|
continue;
|
|
35382
36282
|
}
|
|
35383
|
-
const file =
|
|
35384
|
-
if (!
|
|
36283
|
+
const file = path63.join(root, entry.name, "SKILL.md");
|
|
36284
|
+
if (!fs62.existsSync(file)) {
|
|
35385
36285
|
continue;
|
|
35386
36286
|
}
|
|
35387
36287
|
out.total += 1;
|
|
35388
|
-
const text =
|
|
36288
|
+
const text = fs62.readFileSync(file, "utf8");
|
|
35389
36289
|
const fmEnd = text.startsWith("---") ? text.indexOf("\n---", 3) : -1;
|
|
35390
36290
|
const fm = fmEnd === -1 ? "" : text.slice(0, fmEnd);
|
|
35391
36291
|
if (TRIGGER_KEYS.some((k) => new RegExp(`^${k}`, "m").test(fm))) {
|
|
@@ -35399,17 +36299,17 @@ function censusSkills(root) {
|
|
|
35399
36299
|
return out;
|
|
35400
36300
|
}
|
|
35401
36301
|
function defaultStore2(cwd) {
|
|
35402
|
-
return
|
|
36302
|
+
return path63.join(os15.homedir(), ".claude", "projects", cwd.replace(/[/.]/g, "-"));
|
|
35403
36303
|
}
|
|
35404
36304
|
function measureUsage(store, limit) {
|
|
35405
36305
|
const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
|
|
35406
|
-
if (!
|
|
36306
|
+
if (!fs62.existsSync(store)) {
|
|
35407
36307
|
return rep;
|
|
35408
36308
|
}
|
|
35409
|
-
const files =
|
|
36309
|
+
const files = fs62.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path63.join(store, f)).sort((a, b) => fs62.statSync(b).mtimeMs - fs62.statSync(a).mtimeMs).slice(0, limit);
|
|
35410
36310
|
rep.sessions = files.length;
|
|
35411
36311
|
for (const file of files) {
|
|
35412
|
-
for (const line of
|
|
36312
|
+
for (const line of fs62.readFileSync(file, "utf8").split("\n")) {
|
|
35413
36313
|
if (!line.trim()) {
|
|
35414
36314
|
continue;
|
|
35415
36315
|
}
|
|
@@ -35472,7 +36372,7 @@ function render4(census, usage) {
|
|
|
35472
36372
|
}
|
|
35473
36373
|
totalInv += u.invocations;
|
|
35474
36374
|
lines.push(
|
|
35475
|
-
` ${
|
|
36375
|
+
` ${path63.basename(u.store).slice(-38).padEnd(38)} sessions=${String(u.sessions).padStart(3)} asst=${String(u.assistantTurns).padStart(6)} Skill calls=${String(u.invocations).padStart(3)}`
|
|
35476
36376
|
);
|
|
35477
36377
|
}
|
|
35478
36378
|
lines.push("");
|
|
@@ -35497,7 +36397,7 @@ function render4(census, usage) {
|
|
|
35497
36397
|
lines.push(" catalogue once per session, then count descriptions against bare names.");
|
|
35498
36398
|
return lines.join("\n");
|
|
35499
36399
|
}
|
|
35500
|
-
function
|
|
36400
|
+
function main28(argv) {
|
|
35501
36401
|
let limit = 30;
|
|
35502
36402
|
const stores = [];
|
|
35503
36403
|
for (let i = 0; i < argv.length; i += 1) {
|
|
@@ -35520,7 +36420,7 @@ function main26(argv) {
|
|
|
35520
36420
|
if (stores.length === 0) {
|
|
35521
36421
|
stores.push(defaultStore2(REPO_ROOT8));
|
|
35522
36422
|
}
|
|
35523
|
-
const census = censusSkills(
|
|
36423
|
+
const census = censusSkills(path63.join(REPO_ROOT8, SKILLS_ROOT));
|
|
35524
36424
|
const usage = stores.map((s) => measureUsage(s, limit));
|
|
35525
36425
|
process.stdout.write(`${render4(census, usage)}
|
|
35526
36426
|
`);
|
|
@@ -35530,23 +36430,23 @@ var _HERE18, REPO_ROOT8, SKILLS_ROOT, TRIGGER_KEYS, DETERMINISTIC_RE;
|
|
|
35530
36430
|
var init_report_skill_activation = __esm({
|
|
35531
36431
|
"src/scripts/report_skill_activation.ts"() {
|
|
35532
36432
|
"use strict";
|
|
35533
|
-
_HERE18 =
|
|
35534
|
-
REPO_ROOT8 =
|
|
36433
|
+
_HERE18 = fileURLToPath39(import.meta.url);
|
|
36434
|
+
REPO_ROOT8 = path63.resolve(path63.dirname(_HERE18), "..", "..");
|
|
35535
36435
|
SKILLS_ROOT = "src/skills";
|
|
35536
36436
|
TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
|
|
35537
36437
|
DETERMINISTIC_RE = /^\s*(?:[-*]\s*)?(?:\*\*)?(MUST|NEVER|ALWAYS)\b/m;
|
|
35538
|
-
if (process.argv[1] !== void 0 && import.meta.url ===
|
|
35539
|
-
process.exit(
|
|
36438
|
+
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL28(path63.resolve(process.argv[1])).href) {
|
|
36439
|
+
process.exit(main28(process.argv.slice(2)));
|
|
35540
36440
|
}
|
|
35541
36441
|
}
|
|
35542
36442
|
});
|
|
35543
36443
|
|
|
35544
36444
|
// src/scripts/report_skill_obligation_violations.ts
|
|
35545
|
-
import * as
|
|
35546
|
-
import * as
|
|
35547
|
-
import * as
|
|
36445
|
+
import * as fs63 from "node:fs";
|
|
36446
|
+
import * as os16 from "node:os";
|
|
36447
|
+
import * as path64 from "node:path";
|
|
35548
36448
|
import process17 from "node:process";
|
|
35549
|
-
import { fileURLToPath as
|
|
36449
|
+
import { fileURLToPath as fileURLToPath40, pathToFileURL as pathToFileURL29 } from "node:url";
|
|
35550
36450
|
function _verb(line) {
|
|
35551
36451
|
const m = /\b(NEVER|MUST|ALWAYS)\b/.exec(line);
|
|
35552
36452
|
return m?.[1] ?? "NEVER";
|
|
@@ -35565,7 +36465,7 @@ function _artefacts(line) {
|
|
|
35565
36465
|
return out;
|
|
35566
36466
|
}
|
|
35567
36467
|
function extractObligations(repoRoot) {
|
|
35568
|
-
const skillsRoot =
|
|
36468
|
+
const skillsRoot = path64.join(repoRoot, SKILLS_ROOT);
|
|
35569
36469
|
const census = censusSkills(skillsRoot);
|
|
35570
36470
|
const out = {
|
|
35571
36471
|
skills: census.withDeterministicObligation,
|
|
@@ -35579,7 +36479,7 @@ function extractObligations(repoRoot) {
|
|
|
35579
36479
|
for (const skill of census.withDeterministicObligation) {
|
|
35580
36480
|
let text;
|
|
35581
36481
|
try {
|
|
35582
|
-
text =
|
|
36482
|
+
text = fs63.readFileSync(path64.join(skillsRoot, skill, "SKILL.md"), "utf-8");
|
|
35583
36483
|
} catch {
|
|
35584
36484
|
continue;
|
|
35585
36485
|
}
|
|
@@ -35681,7 +36581,7 @@ function scanSessionForViolations(session, lines, forbidden, parsed) {
|
|
|
35681
36581
|
return flags;
|
|
35682
36582
|
}
|
|
35683
36583
|
function defaultStore3(cwd) {
|
|
35684
|
-
return
|
|
36584
|
+
return path64.join(os16.homedir(), ".claude", "projects", cwd.replace(/[/.]/g, "-"));
|
|
35685
36585
|
}
|
|
35686
36586
|
function scanStore2(repoRoot, store, limit) {
|
|
35687
36587
|
const census = extractObligations(repoRoot);
|
|
@@ -35694,14 +36594,14 @@ function scanStore2(repoRoot, store, limit) {
|
|
|
35694
36594
|
};
|
|
35695
36595
|
let files;
|
|
35696
36596
|
try {
|
|
35697
|
-
files =
|
|
36597
|
+
files = fs63.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path64.join(store, f), m: fs63.statSync(path64.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
|
|
35698
36598
|
} catch {
|
|
35699
36599
|
return report2;
|
|
35700
36600
|
}
|
|
35701
36601
|
report2.sessions = files.length;
|
|
35702
36602
|
for (const file of files) {
|
|
35703
|
-
const lines =
|
|
35704
|
-
const id =
|
|
36603
|
+
const lines = fs63.readFileSync(file, "utf-8").split("\n");
|
|
36604
|
+
const id = path64.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
|
|
35705
36605
|
const entries = _parseSession(lines);
|
|
35706
36606
|
if (loadedSkillsFrom(entries).size > 0) report2.sessionsWithASkill += 1;
|
|
35707
36607
|
report2.flags.push(...scanSessionForViolations(id, lines, census.forbidden, entries));
|
|
@@ -35771,7 +36671,7 @@ function render5(r) {
|
|
|
35771
36671
|
lines.push(" ships as detection-only, and this one says so.");
|
|
35772
36672
|
return lines.join("\n");
|
|
35773
36673
|
}
|
|
35774
|
-
function
|
|
36674
|
+
function main29(argv) {
|
|
35775
36675
|
const args = argv ?? process17.argv.slice(2);
|
|
35776
36676
|
let limit = 30;
|
|
35777
36677
|
let json = false;
|
|
@@ -35824,11 +36724,11 @@ function main27(argv) {
|
|
|
35824
36724
|
}
|
|
35825
36725
|
return 0;
|
|
35826
36726
|
}
|
|
35827
|
-
function
|
|
36727
|
+
function _isCliEntry26() {
|
|
35828
36728
|
if (process17.argv[1] === void 0) return false;
|
|
35829
|
-
if (import.meta.url ===
|
|
36729
|
+
if (import.meta.url === pathToFileURL29(path64.resolve(process17.argv[1])).href) return true;
|
|
35830
36730
|
try {
|
|
35831
|
-
return
|
|
36731
|
+
return fs63.realpathSync(_HERE19) === fs63.realpathSync(path64.resolve(process17.argv[1]));
|
|
35832
36732
|
} catch {
|
|
35833
36733
|
return false;
|
|
35834
36734
|
}
|
|
@@ -35839,8 +36739,8 @@ var init_report_skill_obligation_violations = __esm({
|
|
|
35839
36739
|
"use strict";
|
|
35840
36740
|
init_transcript_entry();
|
|
35841
36741
|
init_report_skill_activation();
|
|
35842
|
-
_HERE19 =
|
|
35843
|
-
REPO_ROOT9 =
|
|
36742
|
+
_HERE19 = fileURLToPath40(import.meta.url);
|
|
36743
|
+
REPO_ROOT9 = path64.resolve(path64.dirname(_HERE19), "..", "..");
|
|
35844
36744
|
OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
|
|
35845
36745
|
PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
|
|
35846
36746
|
CMD_RE = /`([a-z][a-z0-9-]*(?: [a-z][a-z0-9:._-]*){1,3})`/g;
|
|
@@ -35874,31 +36774,31 @@ var init_report_skill_obligation_violations = __esm({
|
|
|
35874
36774
|
SKILL_BODY_RE = /Base directory for this skill:\s*\S*?\/skills\/([A-Za-z0-9_-]+)/;
|
|
35875
36775
|
PATH_FIELDS = ["file_path", "path", "filePath", "notebook_path", "target_file"];
|
|
35876
36776
|
COMMAND_FIELDS = ["command", "cmd"];
|
|
35877
|
-
if (
|
|
35878
|
-
process17.exit(
|
|
36777
|
+
if (_isCliEntry26()) {
|
|
36778
|
+
process17.exit(main29());
|
|
35879
36779
|
}
|
|
35880
36780
|
}
|
|
35881
36781
|
});
|
|
35882
36782
|
|
|
35883
36783
|
// src/scripts/report_conformance_funnel.ts
|
|
35884
|
-
import * as
|
|
35885
|
-
import * as
|
|
35886
|
-
import * as
|
|
36784
|
+
import * as fs64 from "node:fs";
|
|
36785
|
+
import * as os17 from "node:os";
|
|
36786
|
+
import * as path65 from "node:path";
|
|
35887
36787
|
import process18 from "node:process";
|
|
35888
|
-
import { fileURLToPath as
|
|
36788
|
+
import { fileURLToPath as fileURLToPath41, pathToFileURL as pathToFileURL30 } from "node:url";
|
|
35889
36789
|
function buildFunnel(opts = {}) {
|
|
35890
36790
|
const repoRoot = opts.repoRoot ?? REPO_ROOT10;
|
|
35891
|
-
const projectRulesDir = opts.projectRulesDir ??
|
|
35892
|
-
const globalRulesDir = opts.globalRulesDir ??
|
|
35893
|
-
const sourceDir = opts.sourceDir ??
|
|
36791
|
+
const projectRulesDir = opts.projectRulesDir ?? path65.join(repoRoot, PROJECT_RULES);
|
|
36792
|
+
const globalRulesDir = opts.globalRulesDir ?? path65.join(os17.homedir(), GLOBAL_RULES);
|
|
36793
|
+
const sourceDir = opts.sourceDir ?? path65.join(repoRoot, PROJECTION_SOURCE);
|
|
35894
36794
|
const store = opts.store ?? defaultStore(repoRoot);
|
|
35895
36795
|
const limit = opts.limit ?? 30;
|
|
35896
36796
|
return {
|
|
35897
36797
|
delivered: measureDelivered(projectRulesDir, globalRulesDir),
|
|
35898
36798
|
divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
|
|
35899
|
-
skills: censusSkills(
|
|
36799
|
+
skills: censusSkills(path65.join(repoRoot, SKILLS_ROOT)),
|
|
35900
36800
|
usage: measureUsage(store, limit),
|
|
35901
|
-
storePresent:
|
|
36801
|
+
storePresent: fs64.existsSync(store),
|
|
35902
36802
|
sk2: scanStore2(repoRoot, store, limit)
|
|
35903
36803
|
};
|
|
35904
36804
|
}
|
|
@@ -36023,7 +36923,7 @@ function render6(r) {
|
|
|
36023
36923
|
lines.push("workflow without a measured false-positive rate first (locked policy).");
|
|
36024
36924
|
return lines.join("\n");
|
|
36025
36925
|
}
|
|
36026
|
-
function
|
|
36926
|
+
function main30(argv) {
|
|
36027
36927
|
const args = argv ?? process18.argv.slice(2);
|
|
36028
36928
|
const opts = {};
|
|
36029
36929
|
const value = (i) => {
|
|
@@ -36039,7 +36939,7 @@ function main28(argv) {
|
|
|
36039
36939
|
`);
|
|
36040
36940
|
return 1;
|
|
36041
36941
|
}
|
|
36042
|
-
const resolved =
|
|
36942
|
+
const resolved = path65.resolve(v);
|
|
36043
36943
|
if (a === "--store") opts.store = resolved;
|
|
36044
36944
|
else if (a === "--project") opts.projectRulesDir = resolved;
|
|
36045
36945
|
else if (a === "--global") opts.globalRulesDir = resolved;
|
|
@@ -36069,11 +36969,11 @@ function main28(argv) {
|
|
|
36069
36969
|
`);
|
|
36070
36970
|
return 0;
|
|
36071
36971
|
}
|
|
36072
|
-
function
|
|
36972
|
+
function _isCliEntry27() {
|
|
36073
36973
|
if (process18.argv[1] === void 0) return false;
|
|
36074
|
-
if (import.meta.url ===
|
|
36974
|
+
if (import.meta.url === pathToFileURL30(path65.resolve(process18.argv[1])).href) return true;
|
|
36075
36975
|
try {
|
|
36076
|
-
return
|
|
36976
|
+
return fs64.realpathSync(_HERE20) === fs64.realpathSync(path65.resolve(process18.argv[1]));
|
|
36077
36977
|
} catch {
|
|
36078
36978
|
return false;
|
|
36079
36979
|
}
|
|
@@ -36086,10 +36986,10 @@ var init_report_conformance_funnel = __esm({
|
|
|
36086
36986
|
init_report_carrier_divergence();
|
|
36087
36987
|
init_report_skill_activation();
|
|
36088
36988
|
init_report_skill_obligation_violations();
|
|
36089
|
-
_HERE20 =
|
|
36090
|
-
REPO_ROOT10 =
|
|
36091
|
-
if (
|
|
36092
|
-
process18.exit(
|
|
36989
|
+
_HERE20 = fileURLToPath41(import.meta.url);
|
|
36990
|
+
REPO_ROOT10 = path65.resolve(path65.dirname(_HERE20), "..", "..");
|
|
36991
|
+
if (_isCliEntry27()) {
|
|
36992
|
+
process18.exit(main30());
|
|
36093
36993
|
}
|
|
36094
36994
|
}
|
|
36095
36995
|
});
|
|
@@ -36110,16 +37010,16 @@ __export(cmd_conformance_exports, {
|
|
|
36110
37010
|
conformanceLogPath: () => conformanceLogPath,
|
|
36111
37011
|
detectSmokePlatform: () => detectSmokePlatform,
|
|
36112
37012
|
installLogPath: () => installLogPath,
|
|
36113
|
-
main: () =>
|
|
37013
|
+
main: () => main31,
|
|
36114
37014
|
routeTargetPaths: () => routeTargetPaths,
|
|
36115
37015
|
runConformanceChecks: () => runConformanceChecks
|
|
36116
37016
|
});
|
|
36117
|
-
import * as
|
|
36118
|
-
import * as
|
|
36119
|
-
import * as
|
|
37017
|
+
import * as fs65 from "node:fs";
|
|
37018
|
+
import * as os18 from "node:os";
|
|
37019
|
+
import * as path66 from "node:path";
|
|
36120
37020
|
import process19 from "node:process";
|
|
36121
|
-
import { spawnSync as
|
|
36122
|
-
import { fileURLToPath as
|
|
37021
|
+
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
37022
|
+
import { fileURLToPath as fileURLToPath42, pathToFileURL as pathToFileURL31 } from "node:url";
|
|
36123
37023
|
function print2(s = "") {
|
|
36124
37024
|
process19.stdout.write(`${s}
|
|
36125
37025
|
`);
|
|
@@ -36133,17 +37033,17 @@ function conformanceLogPath() {
|
|
|
36133
37033
|
if (override && override.trim().length > 0) {
|
|
36134
37034
|
return override;
|
|
36135
37035
|
}
|
|
36136
|
-
return
|
|
37036
|
+
return path66.join(os18.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
|
|
36137
37037
|
}
|
|
36138
37038
|
function installLogPath() {
|
|
36139
37039
|
const override = process19.env["AGENT_CONFIG_INSTALL_LOG"];
|
|
36140
37040
|
if (override && override.trim().length > 0) {
|
|
36141
37041
|
return override;
|
|
36142
37042
|
}
|
|
36143
|
-
return
|
|
37043
|
+
return path66.join(os18.homedir(), ".event4u", "agent-config", "install-log.jsonl");
|
|
36144
37044
|
}
|
|
36145
37045
|
function _check_txlog_clean(logPath = installLogPath()) {
|
|
36146
|
-
if (!
|
|
37046
|
+
if (!fs65.existsSync(logPath)) {
|
|
36147
37047
|
return {
|
|
36148
37048
|
id: "txlog-clean",
|
|
36149
37049
|
status: "ok",
|
|
@@ -36177,11 +37077,11 @@ function _check_txlog_clean(logPath = installLogPath()) {
|
|
|
36177
37077
|
};
|
|
36178
37078
|
}
|
|
36179
37079
|
function routeTargetPaths(target) {
|
|
36180
|
-
return routeTargetPathsPosix(target).map((rel) =>
|
|
37080
|
+
return routeTargetPathsPosix(target).map((rel) => path66.join(...rel.split("/")));
|
|
36181
37081
|
}
|
|
36182
37082
|
function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
36183
|
-
const routerPath =
|
|
36184
|
-
if (!
|
|
37083
|
+
const routerPath = path66.join(packageRoot, "dist", "router.json");
|
|
37084
|
+
if (!fs65.existsSync(routerPath)) {
|
|
36185
37085
|
return {
|
|
36186
37086
|
id: "router-pointers",
|
|
36187
37087
|
status: "fail",
|
|
@@ -36191,7 +37091,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
36191
37091
|
}
|
|
36192
37092
|
let router;
|
|
36193
37093
|
try {
|
|
36194
|
-
router = JSON.parse(
|
|
37094
|
+
router = JSON.parse(fs65.readFileSync(routerPath, "utf8"));
|
|
36195
37095
|
} catch (exc) {
|
|
36196
37096
|
return {
|
|
36197
37097
|
id: "router-pointers",
|
|
@@ -36200,13 +37100,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
36200
37100
|
remedy: "reinstall the package \u2014 dist/router.json is corrupt"
|
|
36201
37101
|
};
|
|
36202
37102
|
}
|
|
36203
|
-
const rulesDir =
|
|
37103
|
+
const rulesDir = path66.join(packageRoot, "dist", "agent-src", "rules");
|
|
36204
37104
|
const broken = [];
|
|
36205
37105
|
let ids = 0;
|
|
36206
37106
|
let targets = 0;
|
|
36207
37107
|
for (const kernelId of router["kernel"] ?? []) {
|
|
36208
37108
|
ids += 1;
|
|
36209
|
-
if (!
|
|
37109
|
+
if (!fs65.existsSync(path66.join(rulesDir, `${kernelId}.md`))) {
|
|
36210
37110
|
broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
|
|
36211
37111
|
}
|
|
36212
37112
|
}
|
|
@@ -36214,7 +37114,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
36214
37114
|
for (const entry of router[tier] ?? []) {
|
|
36215
37115
|
const ruleId = String(entry["id"] ?? "");
|
|
36216
37116
|
ids += 1;
|
|
36217
|
-
if (!
|
|
37117
|
+
if (!fs65.existsSync(path66.join(rulesDir, `${ruleId}.md`))) {
|
|
36218
37118
|
broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
|
|
36219
37119
|
}
|
|
36220
37120
|
for (const target of entry["routes_to"] ?? []) {
|
|
@@ -36224,7 +37124,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
36224
37124
|
broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
|
|
36225
37125
|
continue;
|
|
36226
37126
|
}
|
|
36227
|
-
if (!candidates.some((rel) =>
|
|
37127
|
+
if (!candidates.some((rel) => fs65.existsSync(path66.join(packageRoot, rel)))) {
|
|
36228
37128
|
broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
|
|
36229
37129
|
}
|
|
36230
37130
|
}
|
|
@@ -36256,9 +37156,9 @@ function detectSmokePlatform(projectRoot) {
|
|
|
36256
37156
|
return "claude";
|
|
36257
37157
|
}
|
|
36258
37158
|
function dispatcherRunner(packageRoot) {
|
|
36259
|
-
const localTsx =
|
|
36260
|
-
const script =
|
|
36261
|
-
if (
|
|
37159
|
+
const localTsx = path66.join(packageRoot, "node_modules", ".bin", "tsx");
|
|
37160
|
+
const script = path66.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
|
|
37161
|
+
if (fs65.existsSync(localTsx)) {
|
|
36262
37162
|
return [localTsx, script];
|
|
36263
37163
|
}
|
|
36264
37164
|
return ["npx", "tsx", script];
|
|
@@ -36275,7 +37175,7 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
|
|
|
36275
37175
|
...event === "stop" ? { stop_reason: "conformance-smoke" } : { source: "startup" }
|
|
36276
37176
|
});
|
|
36277
37177
|
const argv = [...runner, "--platform", platform, "--event", event];
|
|
36278
|
-
const proc =
|
|
37178
|
+
const proc = spawnSync10(argv[0], argv.slice(1), {
|
|
36279
37179
|
input: payload,
|
|
36280
37180
|
cwd: projectRoot,
|
|
36281
37181
|
encoding: "utf8",
|
|
@@ -36308,12 +37208,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
|
|
|
36308
37208
|
};
|
|
36309
37209
|
}
|
|
36310
37210
|
function readSettingsMode(projectRoot) {
|
|
36311
|
-
const settingsPath =
|
|
36312
|
-
if (!
|
|
37211
|
+
const settingsPath = path66.join(projectRoot, ".agent-settings.yml");
|
|
37212
|
+
if (!fs65.existsSync(settingsPath)) {
|
|
36313
37213
|
return "eager-all";
|
|
36314
37214
|
}
|
|
36315
37215
|
try {
|
|
36316
|
-
const parsed = YAML7.parse(
|
|
37216
|
+
const parsed = YAML7.parse(fs65.readFileSync(settingsPath, "utf8"));
|
|
36317
37217
|
const lean = parsed?.["lean_projection"] ?? null;
|
|
36318
37218
|
const mode = lean?.["mode"];
|
|
36319
37219
|
return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
|
|
@@ -36324,7 +37224,7 @@ function readSettingsMode(projectRoot) {
|
|
|
36324
37224
|
function kernelIdsFromRouter(packageRoot) {
|
|
36325
37225
|
try {
|
|
36326
37226
|
const router = JSON.parse(
|
|
36327
|
-
|
|
37227
|
+
fs65.readFileSync(path66.join(packageRoot, "dist", "router.json"), "utf8")
|
|
36328
37228
|
);
|
|
36329
37229
|
return new Set((router["kernel"] ?? []).map(String));
|
|
36330
37230
|
} catch {
|
|
@@ -36341,8 +37241,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
36341
37241
|
remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
|
|
36342
37242
|
};
|
|
36343
37243
|
}
|
|
36344
|
-
const rulesDir = projectedRulesDir ??
|
|
36345
|
-
if (!
|
|
37244
|
+
const rulesDir = projectedRulesDir ?? path66.join(projectRoot, ".augment", "rules");
|
|
37245
|
+
if (!fs65.existsSync(rulesDir)) {
|
|
36346
37246
|
return {
|
|
36347
37247
|
id: "lean-projection",
|
|
36348
37248
|
status: "skipped",
|
|
@@ -36351,7 +37251,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
36351
37251
|
};
|
|
36352
37252
|
}
|
|
36353
37253
|
const kernel = kernelIdsFromRouter(packageRoot);
|
|
36354
|
-
const files =
|
|
37254
|
+
const files = fs65.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
|
|
36355
37255
|
const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
|
|
36356
37256
|
if (nonKernel.length === 0) {
|
|
36357
37257
|
return {
|
|
@@ -36365,7 +37265,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
36365
37265
|
for (const f of nonKernel) {
|
|
36366
37266
|
let text = "";
|
|
36367
37267
|
try {
|
|
36368
|
-
text =
|
|
37268
|
+
text = fs65.readFileSync(path66.join(rulesDir, f), "utf8");
|
|
36369
37269
|
} catch {
|
|
36370
37270
|
continue;
|
|
36371
37271
|
}
|
|
@@ -36396,8 +37296,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
36396
37296
|
function _check_host_manifest(projectRoot) {
|
|
36397
37297
|
const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
|
|
36398
37298
|
const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
|
|
36399
|
-
const settingsPath =
|
|
36400
|
-
if (!
|
|
37299
|
+
const settingsPath = path66.join(projectRoot, ".agent-settings.yml");
|
|
37300
|
+
if (!fs65.existsSync(settingsPath)) {
|
|
36401
37301
|
return {
|
|
36402
37302
|
id: "host-manifest",
|
|
36403
37303
|
status: "ok",
|
|
@@ -36407,7 +37307,7 @@ function _check_host_manifest(projectRoot) {
|
|
|
36407
37307
|
}
|
|
36408
37308
|
let parsed = null;
|
|
36409
37309
|
try {
|
|
36410
|
-
parsed = YAML7.parse(
|
|
37310
|
+
parsed = YAML7.parse(fs65.readFileSync(settingsPath, "utf8"));
|
|
36411
37311
|
} catch (exc) {
|
|
36412
37312
|
return {
|
|
36413
37313
|
id: "host-manifest",
|
|
@@ -36505,7 +37405,7 @@ function _parse4(argv) {
|
|
|
36505
37405
|
}
|
|
36506
37406
|
return opts;
|
|
36507
37407
|
}
|
|
36508
|
-
function
|
|
37408
|
+
function main31(argv = null) {
|
|
36509
37409
|
const opts = _parse4(argv !== null ? Array.from(argv) : process19.argv.slice(2));
|
|
36510
37410
|
if (opts.funnel) {
|
|
36511
37411
|
print2(render6(buildFunnel()));
|
|
@@ -36576,17 +37476,17 @@ function main29(argv = null) {
|
|
|
36576
37476
|
}
|
|
36577
37477
|
return failed ? 1 : 0;
|
|
36578
37478
|
}
|
|
36579
|
-
function
|
|
37479
|
+
function _isCliEntry28() {
|
|
36580
37480
|
if (process19.argv[1] === void 0) {
|
|
36581
37481
|
return false;
|
|
36582
37482
|
}
|
|
36583
|
-
const argvUrl =
|
|
37483
|
+
const argvUrl = pathToFileURL31(path66.resolve(process19.argv[1])).href;
|
|
36584
37484
|
if (import.meta.url === argvUrl) {
|
|
36585
37485
|
return true;
|
|
36586
37486
|
}
|
|
36587
37487
|
try {
|
|
36588
|
-
const here =
|
|
36589
|
-
const argv =
|
|
37488
|
+
const here = fs65.realpathSync(fileURLToPath42(import.meta.url));
|
|
37489
|
+
const argv = fs65.realpathSync(path66.resolve(process19.argv[1]));
|
|
36590
37490
|
return here === argv;
|
|
36591
37491
|
} catch {
|
|
36592
37492
|
return false;
|
|
@@ -36605,7 +37505,7 @@ var init_cmd_conformance = __esm({
|
|
|
36605
37505
|
init_router_target_paths();
|
|
36606
37506
|
init_report_conformance_funnel();
|
|
36607
37507
|
init_cmd_doctor();
|
|
36608
|
-
_HERE21 =
|
|
37508
|
+
_HERE21 = fileURLToPath42(import.meta.url);
|
|
36609
37509
|
PACKAGE_ROOT2 = resolvePackageRoot(import.meta.url);
|
|
36610
37510
|
CONFORMANCE_CHECK_IDS = [
|
|
36611
37511
|
"txlog-clean",
|
|
@@ -36616,9 +37516,9 @@ var init_cmd_conformance = __esm({
|
|
|
36616
37516
|
];
|
|
36617
37517
|
THIN_STUB_MARKER = "Routed rule \u2014 load the body on trigger-match";
|
|
36618
37518
|
USAGE3 = "usage: agent-config conformance [-h] [--project PROJECT] [--json]\n [--skip-dispatcher] [--funnel]\n";
|
|
36619
|
-
if (
|
|
37519
|
+
if (_isCliEntry28() || process19.argv[1] === _HERE21) {
|
|
36620
37520
|
try {
|
|
36621
|
-
process19.exitCode =
|
|
37521
|
+
process19.exitCode = main31(process19.argv.slice(2));
|
|
36622
37522
|
} catch (e) {
|
|
36623
37523
|
if (e instanceof ArgparseExit4) {
|
|
36624
37524
|
process19.exitCode = e.code;
|
|
@@ -36644,7 +37544,7 @@ __export(settings_exports, {
|
|
|
36644
37544
|
read_tier_usage_settings: () => read_tier_usage_settings
|
|
36645
37545
|
});
|
|
36646
37546
|
import { createRequire as createRequire6 } from "node:module";
|
|
36647
|
-
import * as
|
|
37547
|
+
import * as fs66 from "node:fs";
|
|
36648
37548
|
function _isPlainObject8(v) {
|
|
36649
37549
|
return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
|
|
36650
37550
|
}
|
|
@@ -36681,7 +37581,7 @@ function _coerce_path(value, def) {
|
|
|
36681
37581
|
}
|
|
36682
37582
|
function _isFile13(p) {
|
|
36683
37583
|
try {
|
|
36684
|
-
return
|
|
37584
|
+
return fs66.statSync(p).isFile();
|
|
36685
37585
|
} catch {
|
|
36686
37586
|
return false;
|
|
36687
37587
|
}
|
|
@@ -36692,7 +37592,7 @@ function read_settings(p) {
|
|
|
36692
37592
|
if (_isFile13(p)) {
|
|
36693
37593
|
let raw = {};
|
|
36694
37594
|
try {
|
|
36695
|
-
raw = YAML8.parse(
|
|
37595
|
+
raw = YAML8.parse(fs66.readFileSync(p, "utf-8"), { version: "1.1" });
|
|
36696
37596
|
if (raw === null || raw === void 0) {
|
|
36697
37597
|
raw = {};
|
|
36698
37598
|
}
|
|
@@ -36726,7 +37626,7 @@ function read_tier_usage_settings(p) {
|
|
|
36726
37626
|
if (_isFile13(p)) {
|
|
36727
37627
|
let raw = {};
|
|
36728
37628
|
try {
|
|
36729
|
-
raw = YAML8.parse(
|
|
37629
|
+
raw = YAML8.parse(fs66.readFileSync(p, "utf-8"), { version: "1.1" });
|
|
36730
37630
|
if (raw === null || raw === void 0) {
|
|
36731
37631
|
raw = {};
|
|
36732
37632
|
}
|
|
@@ -37264,7 +38164,7 @@ __export(aggregator_exports, {
|
|
|
37264
38164
|
aggregate: () => aggregate2,
|
|
37265
38165
|
rank_artefacts: () => rank_artefacts
|
|
37266
38166
|
});
|
|
37267
|
-
import * as
|
|
38167
|
+
import * as fs67 from "node:fs";
|
|
37268
38168
|
function _key(kind, artId) {
|
|
37269
38169
|
return `${kind}\0${artId}`;
|
|
37270
38170
|
}
|
|
@@ -37301,7 +38201,7 @@ function* _iter_events(log_path) {
|
|
|
37301
38201
|
if (!_isFile14(log_path)) {
|
|
37302
38202
|
return;
|
|
37303
38203
|
}
|
|
37304
|
-
const text =
|
|
38204
|
+
const text = fs67.readFileSync(log_path, "utf-8");
|
|
37305
38205
|
const lines = _pyFileLines(text);
|
|
37306
38206
|
let lineNo = 0;
|
|
37307
38207
|
for (const line of lines) {
|
|
@@ -37335,7 +38235,7 @@ function _pyFileLines(text) {
|
|
|
37335
38235
|
}
|
|
37336
38236
|
function _isFile14(p) {
|
|
37337
38237
|
try {
|
|
37338
|
-
return
|
|
38238
|
+
return fs67.statSync(p).isFile();
|
|
37339
38239
|
} catch {
|
|
37340
38240
|
return false;
|
|
37341
38241
|
}
|
|
@@ -37679,14 +38579,14 @@ function _pyRound5(value, ndigits = 0) {
|
|
|
37679
38579
|
}
|
|
37680
38580
|
const sign = value < 0 ? -1 : 1;
|
|
37681
38581
|
const abs = Math.abs(value);
|
|
37682
|
-
const
|
|
37683
|
-
if (
|
|
38582
|
+
const str3 = abs.toPrecision(17);
|
|
38583
|
+
if (str3.includes("e") || str3.includes("E")) {
|
|
37684
38584
|
const factor = 10 ** ndigits;
|
|
37685
38585
|
return value > 0 ? Math.round(abs * factor) / factor * sign : -Math.round(abs * factor) / factor;
|
|
37686
38586
|
}
|
|
37687
|
-
const dot =
|
|
37688
|
-
const intPart = dot === -1 ?
|
|
37689
|
-
let fracPart = dot === -1 ? "" :
|
|
38587
|
+
const dot = str3.indexOf(".");
|
|
38588
|
+
const intPart = dot === -1 ? str3 : str3.slice(0, dot);
|
|
38589
|
+
let fracPart = dot === -1 ? "" : str3.slice(dot + 1);
|
|
37690
38590
|
while (fracPart.length <= ndigits) {
|
|
37691
38591
|
fracPart += "0";
|
|
37692
38592
|
}
|
|
@@ -37714,13 +38614,13 @@ function _pyFixed(value, ndigits) {
|
|
|
37714
38614
|
}
|
|
37715
38615
|
const sign = value < 0 ? "-" : "";
|
|
37716
38616
|
const abs = Math.abs(value);
|
|
37717
|
-
const
|
|
37718
|
-
if (
|
|
38617
|
+
const str3 = abs.toPrecision(17);
|
|
38618
|
+
if (str3.includes("e") || str3.includes("E")) {
|
|
37719
38619
|
return sign + abs.toFixed(ndigits);
|
|
37720
38620
|
}
|
|
37721
|
-
const dot =
|
|
37722
|
-
const intPart = dot === -1 ?
|
|
37723
|
-
let fracPart = dot === -1 ? "" :
|
|
38621
|
+
const dot = str3.indexOf(".");
|
|
38622
|
+
const intPart = dot === -1 ? str3 : str3.slice(0, dot);
|
|
38623
|
+
let fracPart = dot === -1 ? "" : str3.slice(dot + 1);
|
|
37724
38624
|
while (fracPart.length <= ndigits) {
|
|
37725
38625
|
fracPart += "0";
|
|
37726
38626
|
}
|
|
@@ -37849,7 +38749,7 @@ var init_report_renderer = __esm({
|
|
|
37849
38749
|
});
|
|
37850
38750
|
|
|
37851
38751
|
// src/scripts/ai_council/bundler.ts
|
|
37852
|
-
import * as
|
|
38752
|
+
import * as fs68 from "node:fs";
|
|
37853
38753
|
function _context(mode, text, manifest = [], excluded = []) {
|
|
37854
38754
|
return { mode, text, manifest, excluded };
|
|
37855
38755
|
}
|
|
@@ -37907,10 +38807,10 @@ function bundle_prompt(text) {
|
|
|
37907
38807
|
return _context("prompt", _enforceSize(redacted, "prompt"), ["<inline prompt>"]);
|
|
37908
38808
|
}
|
|
37909
38809
|
function bundle_roadmap(p) {
|
|
37910
|
-
if (!
|
|
38810
|
+
if (!fs68.existsSync(p)) {
|
|
37911
38811
|
throw new FileNotFoundError2(`Roadmap not found: ${p}`);
|
|
37912
38812
|
}
|
|
37913
|
-
const raw =
|
|
38813
|
+
const raw = fs68.readFileSync(p, { encoding: "utf-8" });
|
|
37914
38814
|
const redacted = redact(raw);
|
|
37915
38815
|
return _context(
|
|
37916
38816
|
"roadmap",
|
|
@@ -38521,8 +39421,8 @@ not. Cite the peer-reviewer label and the targeted response label
|
|
|
38521
39421
|
});
|
|
38522
39422
|
|
|
38523
39423
|
// src/scripts/ai_council/advisors.ts
|
|
38524
|
-
import * as
|
|
38525
|
-
import * as
|
|
39424
|
+
import * as fs69 from "node:fs";
|
|
39425
|
+
import * as path67 from "node:path";
|
|
38526
39426
|
function _split_frontmatter2(raw) {
|
|
38527
39427
|
const match = _FRONTMATTER_RE2.exec(raw);
|
|
38528
39428
|
if (!match) {
|
|
@@ -38550,12 +39450,12 @@ function _display_name_from(advisor_name, frontmatter) {
|
|
|
38550
39450
|
}
|
|
38551
39451
|
function resolve_persona_text(persona_path, repo_root) {
|
|
38552
39452
|
const candidates = [
|
|
38553
|
-
|
|
38554
|
-
|
|
39453
|
+
path67.join(repo_root, "dist/agent-src", persona_path),
|
|
39454
|
+
path67.join(repo_root, ".agent-src.uncondensed", persona_path)
|
|
38555
39455
|
];
|
|
38556
39456
|
for (const candidate of candidates) {
|
|
38557
|
-
if (
|
|
38558
|
-
const raw =
|
|
39457
|
+
if (fs69.existsSync(candidate)) {
|
|
39458
|
+
const raw = fs69.readFileSync(candidate, "utf-8");
|
|
38559
39459
|
const [meta, body] = _split_frontmatter2(raw);
|
|
38560
39460
|
return [body.trim(), meta];
|
|
38561
39461
|
}
|
|
@@ -38859,7 +39759,7 @@ __export(low_impact_corpus_exports, {
|
|
|
38859
39759
|
load_validated_phrases: () => load_validated_phrases,
|
|
38860
39760
|
parse_corpus_strict: () => parse_corpus_strict
|
|
38861
39761
|
});
|
|
38862
|
-
import * as
|
|
39762
|
+
import * as fs70 from "node:fs";
|
|
38863
39763
|
function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
|
|
38864
39764
|
return { phrase, normalised, section, line_no, trailing_metadata };
|
|
38865
39765
|
}
|
|
@@ -39032,10 +39932,10 @@ function _checkHeadingDrift(text, title) {
|
|
|
39032
39932
|
}
|
|
39033
39933
|
function parse_corpus_strict(corpusPath) {
|
|
39034
39934
|
const p = corpusPath;
|
|
39035
|
-
if (!
|
|
39935
|
+
if (!fs70.existsSync(p)) {
|
|
39036
39936
|
return new CorpusParseResult();
|
|
39037
39937
|
}
|
|
39038
|
-
const text =
|
|
39938
|
+
const text = fs70.readFileSync(p, { encoding: "utf-8" });
|
|
39039
39939
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
39040
39940
|
const resultSections = {
|
|
39041
39941
|
validated: [],
|
|
@@ -39098,10 +39998,10 @@ function load_anti_example_phrases(corpusPath) {
|
|
|
39098
39998
|
}
|
|
39099
39999
|
function load_corpus_lock(yamlPath) {
|
|
39100
40000
|
const p = yamlPath;
|
|
39101
|
-
if (!
|
|
40001
|
+
if (!fs70.existsSync(p)) {
|
|
39102
40002
|
return new CorpusParseResult();
|
|
39103
40003
|
}
|
|
39104
|
-
const parsed = (0, import_yaml7.parse)(
|
|
40004
|
+
const parsed = (0, import_yaml7.parse)(fs70.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
|
|
39105
40005
|
const doc = parsed === null || parsed === void 0 ? {} : parsed;
|
|
39106
40006
|
const schemaVersion = doc["schema_version"];
|
|
39107
40007
|
if (schemaVersion !== 1) {
|
|
@@ -39163,7 +40063,7 @@ function _deriveLockPath(corpusPath) {
|
|
|
39163
40063
|
}
|
|
39164
40064
|
function _loadSectionFromLock(corpusPath, section) {
|
|
39165
40065
|
const lockPath = _deriveLockPath(corpusPath);
|
|
39166
|
-
if (!
|
|
40066
|
+
if (!fs70.existsSync(lockPath)) {
|
|
39167
40067
|
return null;
|
|
39168
40068
|
}
|
|
39169
40069
|
try {
|
|
@@ -39175,10 +40075,10 @@ function _loadSectionFromLock(corpusPath, section) {
|
|
|
39175
40075
|
}
|
|
39176
40076
|
function _loadSectionLenient(corpusPath, section) {
|
|
39177
40077
|
const p = corpusPath;
|
|
39178
|
-
if (!
|
|
40078
|
+
if (!fs70.existsSync(p)) {
|
|
39179
40079
|
return [];
|
|
39180
40080
|
}
|
|
39181
|
-
const text =
|
|
40081
|
+
const text = fs70.readFileSync(p, { encoding: "utf-8" });
|
|
39182
40082
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
39183
40083
|
const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
|
|
39184
40084
|
if (bounds === null) {
|
|
@@ -39958,8 +40858,8 @@ var init_necessity = __esm({
|
|
|
39958
40858
|
});
|
|
39959
40859
|
|
|
39960
40860
|
// src/scripts/ai_council/budget_guard.ts
|
|
39961
|
-
import * as
|
|
39962
|
-
import * as
|
|
40861
|
+
import * as fs71 from "node:fs";
|
|
40862
|
+
import * as path68 from "node:path";
|
|
39963
40863
|
function _resolveLedgerPath(p) {
|
|
39964
40864
|
if (p !== null) {
|
|
39965
40865
|
return p;
|
|
@@ -39974,18 +40874,18 @@ function _nowUtcMs() {
|
|
|
39974
40874
|
return Date.now();
|
|
39975
40875
|
}
|
|
39976
40876
|
function _ensureLedgerDir(p) {
|
|
39977
|
-
const parent =
|
|
40877
|
+
const parent = path68.dirname(p);
|
|
39978
40878
|
try {
|
|
39979
|
-
|
|
40879
|
+
fs71.mkdirSync(parent, { recursive: true });
|
|
39980
40880
|
let mode;
|
|
39981
40881
|
try {
|
|
39982
|
-
mode =
|
|
40882
|
+
mode = fs71.statSync(parent).mode & 511;
|
|
39983
40883
|
} catch {
|
|
39984
40884
|
mode = 448;
|
|
39985
40885
|
}
|
|
39986
40886
|
if (mode !== 448) {
|
|
39987
40887
|
try {
|
|
39988
|
-
|
|
40888
|
+
fs71.chmodSync(parent, 448);
|
|
39989
40889
|
} catch {
|
|
39990
40890
|
}
|
|
39991
40891
|
}
|
|
@@ -39997,18 +40897,18 @@ function _ensureLedgerDir(p) {
|
|
|
39997
40897
|
}
|
|
39998
40898
|
}
|
|
39999
40899
|
function _ensureLedgerFileMode(p) {
|
|
40000
|
-
if (!
|
|
40900
|
+
if (!fs71.existsSync(p)) {
|
|
40001
40901
|
return;
|
|
40002
40902
|
}
|
|
40003
40903
|
let current;
|
|
40004
40904
|
try {
|
|
40005
|
-
current =
|
|
40905
|
+
current = fs71.statSync(p).mode & 511;
|
|
40006
40906
|
} catch {
|
|
40007
40907
|
return;
|
|
40008
40908
|
}
|
|
40009
40909
|
if (current !== 384) {
|
|
40010
40910
|
try {
|
|
40011
|
-
|
|
40911
|
+
fs71.chmodSync(p, 384);
|
|
40012
40912
|
} catch {
|
|
40013
40913
|
}
|
|
40014
40914
|
}
|
|
@@ -40160,11 +41060,11 @@ function pyNumToStr(n) {
|
|
|
40160
41060
|
}
|
|
40161
41061
|
function read_entries2(p = null) {
|
|
40162
41062
|
const resolved = _resolveLedgerPath(p);
|
|
40163
|
-
if (!
|
|
41063
|
+
if (!fs71.existsSync(resolved)) {
|
|
40164
41064
|
return [];
|
|
40165
41065
|
}
|
|
40166
41066
|
const out = [];
|
|
40167
|
-
const text =
|
|
41067
|
+
const text = fs71.readFileSync(resolved, "utf-8");
|
|
40168
41068
|
for (const rawLine of text.split(/\r\n|\r|\n/u)) {
|
|
40169
41069
|
const line = rawLine.trim();
|
|
40170
41070
|
if (line === "") {
|
|
@@ -40267,7 +41167,7 @@ function record_spend(usd, provider, model, options = {}) {
|
|
|
40267
41167
|
)}
|
|
40268
41168
|
`;
|
|
40269
41169
|
try {
|
|
40270
|
-
|
|
41170
|
+
fs71.appendFileSync(p, entry, { encoding: "utf-8" });
|
|
40271
41171
|
} catch (exc) {
|
|
40272
41172
|
process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
|
|
40273
41173
|
`);
|
|
@@ -40283,12 +41183,12 @@ function _pyRound6(value) {
|
|
|
40283
41183
|
const ndigits = 6;
|
|
40284
41184
|
const sign = value < 0 ? -1 : 1;
|
|
40285
41185
|
const abs = Math.abs(value);
|
|
40286
|
-
const
|
|
40287
|
-
if (
|
|
41186
|
+
const str3 = abs.toPrecision(17);
|
|
41187
|
+
if (str3.includes("e") || str3.includes("E")) {
|
|
40288
41188
|
const factor = 10 ** ndigits;
|
|
40289
41189
|
return value > 0 ? Math.round(abs * factor) / factor * sign : -Math.round(abs * factor) / factor;
|
|
40290
41190
|
}
|
|
40291
|
-
const [intPart, fracPartRaw = ""] =
|
|
41191
|
+
const [intPart, fracPartRaw = ""] = str3.split(".");
|
|
40292
41192
|
let fracPart = fracPartRaw;
|
|
40293
41193
|
while (fracPart.length <= ndigits) {
|
|
40294
41194
|
fracPart += "0";
|
|
@@ -40329,12 +41229,12 @@ function pyRound(value, ndigits = 0) {
|
|
|
40329
41229
|
}
|
|
40330
41230
|
const sign = value < 0 ? -1 : 1;
|
|
40331
41231
|
const abs = Math.abs(value);
|
|
40332
|
-
let
|
|
40333
|
-
if (
|
|
41232
|
+
let str3 = abs.toPrecision(17);
|
|
41233
|
+
if (str3.includes("e") || str3.includes("E")) {
|
|
40334
41234
|
const factor2 = 10 ** ndigits;
|
|
40335
41235
|
return value > 0 ? Math.round(abs * factor2) / factor2 * sign : -Math.round(abs * factor2) / factor2;
|
|
40336
41236
|
}
|
|
40337
|
-
let [intPart, fracPart = ""] =
|
|
41237
|
+
let [intPart, fracPart = ""] = str3.split(".");
|
|
40338
41238
|
while (fracPart.length <= ndigits) {
|
|
40339
41239
|
fracPart += "0";
|
|
40340
41240
|
}
|
|
@@ -40390,8 +41290,8 @@ function aggregate_scores(findings, scores) {
|
|
|
40390
41290
|
by_id.get(s.finding_id).push(s);
|
|
40391
41291
|
}
|
|
40392
41292
|
const out = /* @__PURE__ */ new Map();
|
|
40393
|
-
for (const [fid,
|
|
40394
|
-
if (
|
|
41293
|
+
for (const [fid, fs76] of by_id) {
|
|
41294
|
+
if (fs76.length === 0) {
|
|
40395
41295
|
out.set(
|
|
40396
41296
|
fid,
|
|
40397
41297
|
new ConsensusMetadata({
|
|
@@ -40407,13 +41307,13 @@ function aggregate_scores(findings, scores) {
|
|
|
40407
41307
|
);
|
|
40408
41308
|
continue;
|
|
40409
41309
|
}
|
|
40410
|
-
const mean2 =
|
|
40411
|
-
const agree_rate =
|
|
41310
|
+
const mean2 = fs76.reduce((acc, s) => acc + s.score, 0) / fs76.length;
|
|
41311
|
+
const agree_rate = fs76.filter((s) => s.agree).length / fs76.length;
|
|
40412
41312
|
const strength = mean2 / 10 * agree_rate;
|
|
40413
|
-
const dissent =
|
|
40414
|
-
const concur =
|
|
40415
|
-
const scorers =
|
|
40416
|
-
const dissent_reasons =
|
|
41313
|
+
const dissent = fs76.filter((s) => !s.agree).length;
|
|
41314
|
+
const concur = fs76.filter((s) => s.agree).length;
|
|
41315
|
+
const scorers = fs76.map((s) => s.scorer);
|
|
41316
|
+
const dissent_reasons = fs76.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
|
|
40417
41317
|
const mean_rounded = pyRound(mean2, 2);
|
|
40418
41318
|
out.set(
|
|
40419
41319
|
fid,
|
|
@@ -40888,9 +41788,9 @@ var init_stance_tally = __esm({
|
|
|
40888
41788
|
});
|
|
40889
41789
|
|
|
40890
41790
|
// src/scripts/ai_council/blind_review.ts
|
|
40891
|
-
import { createHash as
|
|
41791
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
40892
41792
|
function _sha256_hex(s) {
|
|
40893
|
-
return
|
|
41793
|
+
return createHash11("sha256").update(s, "utf-8").digest("hex");
|
|
40894
41794
|
}
|
|
40895
41795
|
function deterministic_shuffle_indices(seed, n) {
|
|
40896
41796
|
const keyed = Array.from({ length: n }, (_, i) => ({ i, key: _sha256_hex(`${seed}\0${i}`) }));
|
|
@@ -42348,18 +43248,18 @@ __export(project_context_exports, {
|
|
|
42348
43248
|
REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
|
|
42349
43249
|
detect_project_context: () => detect_project_context
|
|
42350
43250
|
});
|
|
42351
|
-
import * as
|
|
42352
|
-
import * as
|
|
43251
|
+
import * as fs72 from "node:fs";
|
|
43252
|
+
import * as path69 from "node:path";
|
|
42353
43253
|
function _isPlainObject11(v) {
|
|
42354
43254
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
42355
43255
|
}
|
|
42356
43256
|
function _read_json(p) {
|
|
42357
|
-
if (!
|
|
43257
|
+
if (!fs72.existsSync(p)) {
|
|
42358
43258
|
return null;
|
|
42359
43259
|
}
|
|
42360
43260
|
let raw;
|
|
42361
43261
|
try {
|
|
42362
|
-
raw =
|
|
43262
|
+
raw = fs72.readFileSync(p, "utf-8");
|
|
42363
43263
|
} catch {
|
|
42364
43264
|
return null;
|
|
42365
43265
|
}
|
|
@@ -42381,7 +43281,7 @@ function _name_from(composer, pkg, root) {
|
|
|
42381
43281
|
}
|
|
42382
43282
|
}
|
|
42383
43283
|
try {
|
|
42384
|
-
const base =
|
|
43284
|
+
const base = path69.basename(root);
|
|
42385
43285
|
return base || null;
|
|
42386
43286
|
} catch {
|
|
42387
43287
|
return null;
|
|
@@ -42450,12 +43350,12 @@ function _splitlines10(text) {
|
|
|
42450
43350
|
return parts;
|
|
42451
43351
|
}
|
|
42452
43352
|
function _purpose_from_readme(p) {
|
|
42453
|
-
if (!
|
|
43353
|
+
if (!fs72.existsSync(p)) {
|
|
42454
43354
|
return null;
|
|
42455
43355
|
}
|
|
42456
43356
|
let text;
|
|
42457
43357
|
try {
|
|
42458
|
-
text =
|
|
43358
|
+
text = fs72.readFileSync(p, "utf-8");
|
|
42459
43359
|
} catch {
|
|
42460
43360
|
return null;
|
|
42461
43361
|
}
|
|
@@ -42539,13 +43439,13 @@ function _rfind(haystack, needle) {
|
|
|
42539
43439
|
return -1;
|
|
42540
43440
|
}
|
|
42541
43441
|
function detect_project_context(root) {
|
|
42542
|
-
const resolvedRoot =
|
|
42543
|
-
const composer = _read_json(
|
|
42544
|
-
const pkg = _read_json(
|
|
43442
|
+
const resolvedRoot = path69.resolve(root ?? process.cwd());
|
|
43443
|
+
const composer = _read_json(path69.join(resolvedRoot, "composer.json"));
|
|
43444
|
+
const pkg = _read_json(path69.join(resolvedRoot, "package.json"));
|
|
42545
43445
|
return new ProjectContext(
|
|
42546
43446
|
_name_from(composer, pkg, resolvedRoot),
|
|
42547
43447
|
_stack_from(composer, pkg),
|
|
42548
|
-
_purpose_from_readme(
|
|
43448
|
+
_purpose_from_readme(path69.join(resolvedRoot, "README.md"))
|
|
42549
43449
|
);
|
|
42550
43450
|
}
|
|
42551
43451
|
var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
|
|
@@ -42815,8 +43715,8 @@ __export(shadow_dispatch_exports, {
|
|
|
42815
43715
|
slo_banner: () => slo_banner,
|
|
42816
43716
|
slo_status: () => slo_status
|
|
42817
43717
|
});
|
|
42818
|
-
import * as
|
|
42819
|
-
import { createHash as
|
|
43718
|
+
import * as fs73 from "node:fs";
|
|
43719
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
42820
43720
|
function should_shadow(sampleRate, opts = {}) {
|
|
42821
43721
|
const rate = Math.max(0, Math.min(1, sampleRate));
|
|
42822
43722
|
const rng = opts.rng ?? null;
|
|
@@ -42825,7 +43725,7 @@ function should_shadow(sampleRate, opts = {}) {
|
|
|
42825
43725
|
}
|
|
42826
43726
|
function _hashQuery(query) {
|
|
42827
43727
|
const redacted = redact(query);
|
|
42828
|
-
return
|
|
43728
|
+
return createHash12("sha256").update(Buffer.from(redacted, "utf-8")).digest("hex").slice(0, 16);
|
|
42829
43729
|
}
|
|
42830
43730
|
function _privacyDropped(redacted) {
|
|
42831
43731
|
const stripped = _strip7(redacted);
|
|
@@ -42853,7 +43753,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
42853
43753
|
escalated,
|
|
42854
43754
|
escalation_reason: escalationReason
|
|
42855
43755
|
};
|
|
42856
|
-
|
|
43756
|
+
fs73.mkdirSync(_dirname2(logPath), { recursive: true });
|
|
42857
43757
|
const row = _pyJsonDumps2({
|
|
42858
43758
|
timestamp: decision.timestamp,
|
|
42859
43759
|
query_hash: decision.query_hash,
|
|
@@ -42863,7 +43763,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
42863
43763
|
escalated: decision.escalated,
|
|
42864
43764
|
escalation_reason: decision.escalation_reason
|
|
42865
43765
|
}) + "\n";
|
|
42866
|
-
|
|
43766
|
+
fs73.appendFileSync(logPath, row, { encoding: "utf-8" });
|
|
42867
43767
|
return decision;
|
|
42868
43768
|
}
|
|
42869
43769
|
function _isoNowSeconds() {
|
|
@@ -42872,10 +43772,10 @@ function _isoNowSeconds() {
|
|
|
42872
43772
|
return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}+00:00`;
|
|
42873
43773
|
}
|
|
42874
43774
|
function* _iterLog(logPath) {
|
|
42875
|
-
if (!
|
|
43775
|
+
if (!fs73.existsSync(logPath)) {
|
|
42876
43776
|
return;
|
|
42877
43777
|
}
|
|
42878
|
-
const content =
|
|
43778
|
+
const content = fs73.readFileSync(logPath, { encoding: "utf-8" });
|
|
42879
43779
|
for (const rawLine of _splitlines11(content)) {
|
|
42880
43780
|
const line = _strip7(rawLine);
|
|
42881
43781
|
if (!line) {
|
|
@@ -43796,11 +44696,11 @@ __export(council_cli_exports, {
|
|
|
43796
44696
|
cmd_status: () => cmd_status,
|
|
43797
44697
|
format_estimate_table: () => format_estimate_table,
|
|
43798
44698
|
load_settings: () => load_settings,
|
|
43799
|
-
main: () =>
|
|
44699
|
+
main: () => main32
|
|
43800
44700
|
});
|
|
43801
|
-
import * as
|
|
43802
|
-
import * as
|
|
43803
|
-
import { fileURLToPath as
|
|
44701
|
+
import * as fs74 from "node:fs";
|
|
44702
|
+
import * as path70 from "node:path";
|
|
44703
|
+
import { fileURLToPath as fileURLToPath43, pathToFileURL as pathToFileURL32 } from "node:url";
|
|
43804
44704
|
function _pyFixed6(x, ndigits) {
|
|
43805
44705
|
if (!Number.isFinite(x)) {
|
|
43806
44706
|
return String(x);
|
|
@@ -44008,7 +44908,7 @@ function _stderr2(s) {
|
|
|
44008
44908
|
function load_settings(p = SETTINGS_FILE2, opts = {}) {
|
|
44009
44909
|
const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
|
|
44010
44910
|
const settings = load_agent_settings({ project_path: p });
|
|
44011
|
-
if (
|
|
44911
|
+
if (fs74.existsSync(ai_council_path)) {
|
|
44012
44912
|
const cfg = load_council_config(ai_council_path);
|
|
44013
44913
|
settings["ai_council"] = _synthesize_ai_council_block(cfg);
|
|
44014
44914
|
}
|
|
@@ -44188,11 +45088,11 @@ function _postRunQuorum(members, responses, ai_cfg) {
|
|
|
44188
45088
|
for (let i = 0; i < members.length; i++) {
|
|
44189
45089
|
const m = members[i];
|
|
44190
45090
|
const r = responses[i];
|
|
44191
|
-
if (r !== void 0 && !r.error) {
|
|
45091
|
+
if (r !== void 0 && !r.error && r.text.trim() !== "") {
|
|
44192
45092
|
present += 1;
|
|
44193
45093
|
continue;
|
|
44194
45094
|
}
|
|
44195
|
-
const raw = r?.error ?? "no response";
|
|
45095
|
+
const raw = r?.error ?? (r !== void 0 && r.text.trim() === "" ? "empty response body" : "no response");
|
|
44196
45096
|
const failure = classifyCliFailure(raw);
|
|
44197
45097
|
absent.push({
|
|
44198
45098
|
member: m.name,
|
|
@@ -44204,7 +45104,8 @@ function _postRunQuorum(members, responses, ai_cfg) {
|
|
|
44204
45104
|
}
|
|
44205
45105
|
function _format_quorum_line(q) {
|
|
44206
45106
|
const verdict = q.status === "concluded" ? "concluded" : "INCONCLUSIVE \u2014 release gate holds";
|
|
44207
|
-
|
|
45107
|
+
const degraded = q.present < q.total ? ` \u26A0\uFE0F DEGRADED \u2014 ${String(q.total - q.present)} member(s) did not answer; this is not convergence.` : "";
|
|
45108
|
+
return `council:quorum \xB7 ${q.present}/${q.total} present, needed ${q.threshold} \u2014 ${verdict}.${degraded}`;
|
|
44208
45109
|
}
|
|
44209
45110
|
function build_members(settings, opts = {}) {
|
|
44210
45111
|
const invocation_mode = opts.invocation_mode ?? null;
|
|
@@ -44515,7 +45416,7 @@ function build_question(opts) {
|
|
|
44515
45416
|
let ctx;
|
|
44516
45417
|
let artefact;
|
|
44517
45418
|
if (input_mode === "prompt") {
|
|
44518
|
-
const text =
|
|
45419
|
+
const text = fs74.readFileSync(input_path, "utf-8");
|
|
44519
45420
|
ctx = bundle_prompt(text);
|
|
44520
45421
|
artefact = String(input_path);
|
|
44521
45422
|
} else if (input_mode === "roadmap") {
|
|
@@ -44658,9 +45559,9 @@ function _maybe_write_decision_replay(opts) {
|
|
|
44658
45559
|
include_member_arguments: include_args
|
|
44659
45560
|
})
|
|
44660
45561
|
);
|
|
44661
|
-
const target =
|
|
44662
|
-
|
|
44663
|
-
|
|
45562
|
+
const target = path70.join(path70.dirname(opts.out_path), "decision-replay.md");
|
|
45563
|
+
fs74.mkdirSync(path70.dirname(target), { recursive: true });
|
|
45564
|
+
fs74.writeFileSync(target, replay, { encoding: "utf-8" });
|
|
44664
45565
|
return target;
|
|
44665
45566
|
}
|
|
44666
45567
|
function _peer_review_active(ai_cfg, args) {
|
|
@@ -45335,11 +46236,21 @@ function _emit_shadow_slo_banner() {
|
|
|
45335
46236
|
return;
|
|
45336
46237
|
}
|
|
45337
46238
|
}
|
|
46239
|
+
function _resolvedTransportFor(name, member, report2) {
|
|
46240
|
+
return resolveMemberTransport({
|
|
46241
|
+
provider: name,
|
|
46242
|
+
report: report2 ?? detectEnvironment(),
|
|
46243
|
+
invocationMode: null,
|
|
46244
|
+
memberSettings: null,
|
|
46245
|
+
globalMode: "auto",
|
|
46246
|
+
binaryOverride: member.binary
|
|
46247
|
+
});
|
|
46248
|
+
}
|
|
45338
46249
|
function cmd_status(args, opts = {}) {
|
|
45339
46250
|
const env = opts.env ?? process.env;
|
|
45340
46251
|
const override = env[COUNCIL_CONFIG_ENV];
|
|
45341
46252
|
const path_ = resolve_config_path(REPO_ROOT11, { env });
|
|
45342
|
-
const exists3 =
|
|
46253
|
+
const exists3 = fs74.existsSync(String(path_));
|
|
45343
46254
|
const provenance = override ? `${COUNCIL_CONFIG_ENV} override` : "user-global";
|
|
45344
46255
|
let cfg = null;
|
|
45345
46256
|
let parse_error = null;
|
|
@@ -45363,6 +46274,21 @@ function cmd_status(args, opts = {}) {
|
|
|
45363
46274
|
members_total: cfg === null ? null : cfg.members.size,
|
|
45364
46275
|
members_enabled: cfg === null ? null : enabledMembers.length,
|
|
45365
46276
|
member_names: enabledMembers.map(([n]) => n),
|
|
46277
|
+
transports: Object.fromEntries(
|
|
46278
|
+
enabledMembers.map(([n, m]) => {
|
|
46279
|
+
const t = _resolvedTransportFor(n, m);
|
|
46280
|
+
return [
|
|
46281
|
+
n,
|
|
46282
|
+
{
|
|
46283
|
+
available: t.available,
|
|
46284
|
+
transport: t.available ? t.transport : null,
|
|
46285
|
+
billing: t.available ? t.billing : null,
|
|
46286
|
+
reason: t.reason
|
|
46287
|
+
}
|
|
46288
|
+
];
|
|
46289
|
+
})
|
|
46290
|
+
),
|
|
46291
|
+
ignored_transport_keys: cfg?.ignored_transport_keys ?? [],
|
|
45366
46292
|
parse_error,
|
|
45367
46293
|
project_tree_consulted: false
|
|
45368
46294
|
})}
|
|
@@ -45391,6 +46317,22 @@ function cmd_status(args, opts = {}) {
|
|
|
45391
46317
|
_stdout2(` ${enabledMembers.map(([n]) => n).join(", ")}
|
|
45392
46318
|
`);
|
|
45393
46319
|
}
|
|
46320
|
+
for (const [name, member] of enabledMembers) {
|
|
46321
|
+
const t = _resolvedTransportFor(name, member);
|
|
46322
|
+
const billing = t.available ? ` \xB7 ${t.billing}` : "";
|
|
46323
|
+
const detail = t.available ? t.transport : `unavailable \u2014 ${t.reason ?? "no usable transport"}`;
|
|
46324
|
+
_stdout2(` transport ${name}: ${detail}${billing}
|
|
46325
|
+
`);
|
|
46326
|
+
}
|
|
46327
|
+
if (cfg.ignored_transport_keys.length > 0) {
|
|
46328
|
+
_stdout2("\n");
|
|
46329
|
+
_stdout2(" Ignored transport keys \u2014 transport is resolved, not configured:\n");
|
|
46330
|
+
for (const key of cfg.ignored_transport_keys) {
|
|
46331
|
+
_stdout2(` ${key}
|
|
46332
|
+
`);
|
|
46333
|
+
}
|
|
46334
|
+
_stdout2(" Safe to delete from the config file; they change nothing.\n");
|
|
46335
|
+
}
|
|
45394
46336
|
}
|
|
45395
46337
|
_stdout2("\n");
|
|
45396
46338
|
_stdout2(" The project tree is NEVER consulted (ADR-104). No project file \u2014\n");
|
|
@@ -45573,6 +46515,7 @@ function cmd_run(args, opts = {}) {
|
|
|
45573
46515
|
);
|
|
45574
46516
|
return 0;
|
|
45575
46517
|
}
|
|
46518
|
+
_validate_council_output_path(args.output, { kind: "responses", subcommand: "run" });
|
|
45576
46519
|
const cost_cfg = ai_cfg["cost_budget"] || {};
|
|
45577
46520
|
const budget = new CostBudget({
|
|
45578
46521
|
max_input_tokens: _pyInt6(cost_cfg["max_input_tokens"] ?? 5e4, 5e4),
|
|
@@ -45716,8 +46659,8 @@ function cmd_run(args, opts = {}) {
|
|
|
45716
46659
|
kind: "responses",
|
|
45717
46660
|
subcommand: "run"
|
|
45718
46661
|
});
|
|
45719
|
-
|
|
45720
|
-
|
|
46662
|
+
fs74.mkdirSync(path70.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
46663
|
+
fs74.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
|
|
45721
46664
|
_stdout2(
|
|
45722
46665
|
`
|
|
45723
46666
|
council:run \xB7 wrote ${out_path} (estimated $${_pyFixed6(estimated_total, 4)} / actual $${_pyFixed6(actual_total, 4)})
|
|
@@ -45742,7 +46685,7 @@ function _debate_round_filename(round_number) {
|
|
|
45742
46685
|
return `debate-round-${round_number}.json`;
|
|
45743
46686
|
}
|
|
45744
46687
|
function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
45745
|
-
|
|
46688
|
+
fs74.mkdirSync(_resolveTarget(out_dir), { recursive: true });
|
|
45746
46689
|
let actual_total = 0;
|
|
45747
46690
|
for (const r of responses) {
|
|
45748
46691
|
if (r.error) {
|
|
@@ -45766,15 +46709,15 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
|
45766
46709
|
prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
|
|
45767
46710
|
responses: _serialise_responses(responses)
|
|
45768
46711
|
};
|
|
45769
|
-
const out_path =
|
|
45770
|
-
|
|
46712
|
+
const out_path = path70.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
|
|
46713
|
+
fs74.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
|
|
45771
46714
|
return out_path;
|
|
45772
46715
|
}
|
|
45773
46716
|
function _load_debate_seed(p, expected_members) {
|
|
45774
|
-
if (!
|
|
46717
|
+
if (!fs74.existsSync(p)) {
|
|
45775
46718
|
throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
|
|
45776
46719
|
}
|
|
45777
|
-
const payload = JSON.parse(
|
|
46720
|
+
const payload = JSON.parse(fs74.readFileSync(p, "utf-8"));
|
|
45778
46721
|
const source_members = (payload["members"] || []).slice();
|
|
45779
46722
|
const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
|
|
45780
46723
|
if (!_listEq(source_members, expected_labels)) {
|
|
@@ -45820,7 +46763,7 @@ function _readStdinLine() {
|
|
|
45820
46763
|
try {
|
|
45821
46764
|
const buf = Buffer.alloc(4096);
|
|
45822
46765
|
const fd = 0;
|
|
45823
|
-
const n =
|
|
46766
|
+
const n = fs74.readSync(fd, buf, 0, buf.length, null);
|
|
45824
46767
|
return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
|
|
45825
46768
|
} catch {
|
|
45826
46769
|
return "";
|
|
@@ -46049,7 +46992,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
|
|
|
46049
46992
|
return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
|
|
46050
46993
|
}
|
|
46051
46994
|
function cmd_render(args) {
|
|
46052
|
-
const payload = JSON.parse(
|
|
46995
|
+
const payload = JSON.parse(fs74.readFileSync(args.responses, "utf-8"));
|
|
46053
46996
|
const items = payload["responses"] || [];
|
|
46054
46997
|
const explicit = _getattr3(args, "prompt_mode", null);
|
|
46055
46998
|
const mode = explicit || payload["prompt_mode"] || payload["mode"];
|
|
@@ -46078,8 +47021,8 @@ function cmd_render(args) {
|
|
|
46078
47021
|
kind: "sessions",
|
|
46079
47022
|
subcommand: "render"
|
|
46080
47023
|
});
|
|
46081
|
-
|
|
46082
|
-
|
|
47024
|
+
fs74.mkdirSync(path70.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
47025
|
+
fs74.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
|
|
46083
47026
|
_stdout2(`council:render \xB7 wrote ${out_path}
|
|
46084
47027
|
`);
|
|
46085
47028
|
return 0;
|
|
@@ -46090,15 +47033,15 @@ function cmd_render(args) {
|
|
|
46090
47033
|
function _cmd_replay_low_impact_stats(args) {
|
|
46091
47034
|
const li = low_impact_exports;
|
|
46092
47035
|
const responses_path = args.responses;
|
|
46093
|
-
const log_path =
|
|
46094
|
-
if (!
|
|
47036
|
+
const log_path = path70.join(path70.dirname(responses_path), "low-impact-resolutions.md");
|
|
47037
|
+
if (!fs74.existsSync(log_path)) {
|
|
46095
47038
|
_stdout2(
|
|
46096
47039
|
`council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
|
|
46097
47040
|
`
|
|
46098
47041
|
);
|
|
46099
47042
|
return 0;
|
|
46100
47043
|
}
|
|
46101
|
-
const body =
|
|
47044
|
+
const body = fs74.readFileSync(log_path, "utf-8");
|
|
46102
47045
|
const stats = li.parse_low_impact_log(body);
|
|
46103
47046
|
const out = li.render_low_impact_stats(stats);
|
|
46104
47047
|
if (_getattr3(args, "output", null)) {
|
|
@@ -46106,8 +47049,8 @@ function _cmd_replay_low_impact_stats(args) {
|
|
|
46106
47049
|
kind: "sessions",
|
|
46107
47050
|
subcommand: "replay"
|
|
46108
47051
|
});
|
|
46109
|
-
|
|
46110
|
-
|
|
47052
|
+
fs74.mkdirSync(path70.dirname(_resolveTarget(target)), { recursive: true });
|
|
47053
|
+
fs74.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
|
|
46111
47054
|
_stdout2(`council:replay \xB7 wrote ${target}
|
|
46112
47055
|
`);
|
|
46113
47056
|
return 0;
|
|
@@ -46119,7 +47062,7 @@ function cmd_replay(args) {
|
|
|
46119
47062
|
if (_getattr3(args, "low_impact_stats", false)) {
|
|
46120
47063
|
return _cmd_replay_low_impact_stats(args);
|
|
46121
47064
|
}
|
|
46122
|
-
const payload = JSON.parse(
|
|
47065
|
+
const payload = JSON.parse(fs74.readFileSync(args.responses, "utf-8"));
|
|
46123
47066
|
const consensus = _deserialise_consensus(payload["consensus"]);
|
|
46124
47067
|
if (consensus === null) {
|
|
46125
47068
|
_stderr2(
|
|
@@ -46144,8 +47087,8 @@ function cmd_replay(args) {
|
|
|
46144
47087
|
kind: "sessions",
|
|
46145
47088
|
subcommand: "replay"
|
|
46146
47089
|
});
|
|
46147
|
-
|
|
46148
|
-
|
|
47090
|
+
fs74.mkdirSync(path70.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
47091
|
+
fs74.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
|
|
46149
47092
|
_stdout2(`council:replay \xB7 wrote ${out_path}
|
|
46150
47093
|
`);
|
|
46151
47094
|
} else {
|
|
@@ -46202,8 +47145,8 @@ function cmd_quota(args, opts = {}) {
|
|
|
46202
47145
|
}
|
|
46203
47146
|
function _validate_council_output_path(path_str, opts) {
|
|
46204
47147
|
const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
|
|
46205
|
-
const expected_abs = _resolveReal(
|
|
46206
|
-
const target =
|
|
47148
|
+
const expected_abs = _resolveReal(path70.join(REPO_ROOT11, expected_rel));
|
|
47149
|
+
const target = path70.isAbsolute(path_str) ? path_str : path70.join(REPO_ROOT11, path_str);
|
|
46207
47150
|
const target_resolved = _resolveReal(target);
|
|
46208
47151
|
if (!_isRelativeTo(target_resolved, expected_abs)) {
|
|
46209
47152
|
throw new ArgumentTypeError(
|
|
@@ -46213,12 +47156,12 @@ function _validate_council_output_path(path_str, opts) {
|
|
|
46213
47156
|
return path_str;
|
|
46214
47157
|
}
|
|
46215
47158
|
function _resolveTarget(path_str) {
|
|
46216
|
-
return
|
|
47159
|
+
return path70.isAbsolute(path_str) ? path_str : path70.join(REPO_ROOT11, path_str);
|
|
46217
47160
|
}
|
|
46218
47161
|
function _resolveReal(p) {
|
|
46219
|
-
const abs =
|
|
47162
|
+
const abs = path70.resolve(p);
|
|
46220
47163
|
try {
|
|
46221
|
-
return
|
|
47164
|
+
return fs74.realpathSync(abs);
|
|
46222
47165
|
} catch {
|
|
46223
47166
|
return abs;
|
|
46224
47167
|
}
|
|
@@ -46227,8 +47170,8 @@ function _isRelativeTo(target, base) {
|
|
|
46227
47170
|
if (target === base) {
|
|
46228
47171
|
return true;
|
|
46229
47172
|
}
|
|
46230
|
-
const rel =
|
|
46231
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
47173
|
+
const rel = path70.relative(base, target);
|
|
47174
|
+
return rel !== "" && !rel.startsWith("..") && !path70.isAbsolute(rel);
|
|
46232
47175
|
}
|
|
46233
47176
|
function _topError(message) {
|
|
46234
47177
|
_stderr2(_TOP_USAGE2);
|
|
@@ -46553,7 +47496,7 @@ function _parse_siblings_overrides(items) {
|
|
|
46553
47496
|
function _isFileNotFound(exc) {
|
|
46554
47497
|
return exc instanceof FileNotFoundError3 || exc instanceof Error && exc.code === "ENOENT";
|
|
46555
47498
|
}
|
|
46556
|
-
function
|
|
47499
|
+
function main32(argv = null) {
|
|
46557
47500
|
const args = _parseArgs7(argv ?? process.argv.slice(2));
|
|
46558
47501
|
try {
|
|
46559
47502
|
if (args.cmd === "estimate") {
|
|
@@ -46595,17 +47538,17 @@ function main30(argv = null) {
|
|
|
46595
47538
|
}
|
|
46596
47539
|
return 1;
|
|
46597
47540
|
}
|
|
46598
|
-
function
|
|
47541
|
+
function _isCliEntry29() {
|
|
46599
47542
|
if (process.argv[1] === void 0) {
|
|
46600
47543
|
return false;
|
|
46601
47544
|
}
|
|
46602
|
-
const argvUrl =
|
|
47545
|
+
const argvUrl = pathToFileURL32(path70.resolve(process.argv[1])).href;
|
|
46603
47546
|
if (import.meta.url === argvUrl) {
|
|
46604
47547
|
return true;
|
|
46605
47548
|
}
|
|
46606
47549
|
try {
|
|
46607
|
-
const here =
|
|
46608
|
-
const argv =
|
|
47550
|
+
const here = fs74.realpathSync(fileURLToPath43(import.meta.url));
|
|
47551
|
+
const argv = fs74.realpathSync(path70.resolve(process.argv[1]));
|
|
46609
47552
|
return here === argv;
|
|
46610
47553
|
} catch {
|
|
46611
47554
|
return false;
|
|
@@ -46663,7 +47606,7 @@ var init_council_cli = __esm({
|
|
|
46663
47606
|
"xai",
|
|
46664
47607
|
"perplexity"
|
|
46665
47608
|
]);
|
|
46666
|
-
_HERE22 =
|
|
47609
|
+
_HERE22 = path70.dirname(fileURLToPath43(import.meta.url));
|
|
46667
47610
|
[REPO_ROOT11] = resolve_project_root(null);
|
|
46668
47611
|
SETTINGS_FILE2 = project_settings_path(REPO_ROOT11);
|
|
46669
47612
|
AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT11);
|
|
@@ -46696,9 +47639,9 @@ var init_council_cli = __esm({
|
|
|
46696
47639
|
{estimate,run,debate,render,replay,quota,shadow-report,status}
|
|
46697
47640
|
...
|
|
46698
47641
|
`;
|
|
46699
|
-
if (
|
|
47642
|
+
if (_isCliEntry29()) {
|
|
46700
47643
|
try {
|
|
46701
|
-
process.exitCode =
|
|
47644
|
+
process.exitCode = main32(process.argv.slice(2));
|
|
46702
47645
|
} catch (err) {
|
|
46703
47646
|
if (!(err instanceof _ArgExit2)) {
|
|
46704
47647
|
throw err;
|
|
@@ -46727,7 +47670,7 @@ function run_enveloped(spec) {
|
|
|
46727
47670
|
if (cmd === void 0) {
|
|
46728
47671
|
throw new Error("envelope argv must not be empty");
|
|
46729
47672
|
}
|
|
46730
|
-
return new Promise((
|
|
47673
|
+
return new Promise((resolve42) => {
|
|
46731
47674
|
execFile(
|
|
46732
47675
|
cmd,
|
|
46733
47676
|
args,
|
|
@@ -46750,7 +47693,7 @@ function run_enveloped(spec) {
|
|
|
46750
47693
|
}
|
|
46751
47694
|
const [out, outTrunc] = _truncate(String(stdout ?? ""), spec.max_output_bytes);
|
|
46752
47695
|
const [err, errTrunc] = _truncate(String(stderr ?? ""), spec.max_output_bytes);
|
|
46753
|
-
|
|
47696
|
+
resolve42({
|
|
46754
47697
|
exit_code: timedOut ? null : exitCode,
|
|
46755
47698
|
timed_out: timedOut,
|
|
46756
47699
|
stdout: out,
|
|
@@ -46771,8 +47714,8 @@ var init_safety_envelope = __esm({
|
|
|
46771
47714
|
});
|
|
46772
47715
|
|
|
46773
47716
|
// src/scripts/mcp_server/__main__.ts
|
|
46774
|
-
import * as
|
|
46775
|
-
import { fileURLToPath as
|
|
47717
|
+
import * as path72 from "node:path";
|
|
47718
|
+
import { fileURLToPath as fileURLToPath45 } from "node:url";
|
|
46776
47719
|
|
|
46777
47720
|
// src/scripts/mcp_server/index.ts
|
|
46778
47721
|
var __version__ = "0.1.0";
|
|
@@ -46819,9 +47762,9 @@ init_prompts();
|
|
|
46819
47762
|
init_resources();
|
|
46820
47763
|
|
|
46821
47764
|
// src/scripts/mcp_server/tools.ts
|
|
46822
|
-
import * as
|
|
46823
|
-
import * as
|
|
46824
|
-
import { fileURLToPath as
|
|
47765
|
+
import * as fs75 from "node:fs";
|
|
47766
|
+
import * as path71 from "node:path";
|
|
47767
|
+
import { fileURLToPath as fileURLToPath44 } from "node:url";
|
|
46825
47768
|
|
|
46826
47769
|
// src/scripts/chat_history.ts
|
|
46827
47770
|
init_memory_lookup();
|
|
@@ -49054,9 +49997,9 @@ function _strip8(s) {
|
|
|
49054
49997
|
}
|
|
49055
49998
|
function _resolvePath2(p) {
|
|
49056
49999
|
try {
|
|
49057
|
-
return
|
|
50000
|
+
return fs75.realpathSync(p);
|
|
49058
50001
|
} catch {
|
|
49059
|
-
return
|
|
50002
|
+
return path71.resolve(p);
|
|
49060
50003
|
}
|
|
49061
50004
|
}
|
|
49062
50005
|
function _resolveConsumerRoot(override) {
|
|
@@ -49066,14 +50009,14 @@ function _resolveConsumerRoot(override) {
|
|
|
49066
50009
|
return _resolvePath2(process.cwd());
|
|
49067
50010
|
}
|
|
49068
50011
|
function _relativeUnder(target, root) {
|
|
49069
|
-
const rel =
|
|
50012
|
+
const rel = path71.relative(root, target);
|
|
49070
50013
|
if (rel === "") {
|
|
49071
50014
|
return "";
|
|
49072
50015
|
}
|
|
49073
|
-
if (rel.startsWith("..") ||
|
|
50016
|
+
if (rel.startsWith("..") || path71.isAbsolute(rel)) {
|
|
49074
50017
|
return null;
|
|
49075
50018
|
}
|
|
49076
|
-
return rel.split(
|
|
50019
|
+
return rel.split(path71.sep).join("/");
|
|
49077
50020
|
}
|
|
49078
50021
|
function _reprStrList(values) {
|
|
49079
50022
|
return `[${values.map((v) => `'${v}'`).join(", ")}]`;
|
|
@@ -49082,11 +50025,11 @@ function _validateInTreePath(raw, consumerRoot) {
|
|
|
49082
50025
|
const root = _resolvePath2(consumerRoot);
|
|
49083
50026
|
let target;
|
|
49084
50027
|
if (raw === null || raw === void 0 || raw === "") {
|
|
49085
|
-
target =
|
|
49086
|
-
} else if (
|
|
50028
|
+
target = path71.join(root, "agents", "runtime", ".agent-chat-history");
|
|
50029
|
+
} else if (path71.isAbsolute(raw)) {
|
|
49087
50030
|
target = _resolvePath2(raw);
|
|
49088
50031
|
} else {
|
|
49089
|
-
target = _resolvePath2(
|
|
50032
|
+
target = _resolvePath2(path71.join(root, raw));
|
|
49090
50033
|
}
|
|
49091
50034
|
const rel = _relativeUnder(target, root);
|
|
49092
50035
|
if (rel === null) {
|
|
@@ -49124,11 +50067,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
|
|
|
49124
50067
|
if (typeof raw !== "string") {
|
|
49125
50068
|
throw new Error("'paths' entries must be strings");
|
|
49126
50069
|
}
|
|
49127
|
-
const resolved =
|
|
50070
|
+
const resolved = path71.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path71.join(root, raw));
|
|
49128
50071
|
if (_relativeUnder(resolved, root) === null) {
|
|
49129
50072
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
49130
50073
|
}
|
|
49131
|
-
if (
|
|
50074
|
+
if (fs75.existsSync(resolved)) {
|
|
49132
50075
|
paths.push(resolved);
|
|
49133
50076
|
}
|
|
49134
50077
|
}
|
|
@@ -49165,7 +50108,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
49165
50108
|
if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
|
|
49166
50109
|
throw new Error("'min_schema_version' must be an integer");
|
|
49167
50110
|
}
|
|
49168
|
-
const existingHeader =
|
|
50111
|
+
const existingHeader = fs75.existsSync(target) ? _chReadHeader(target) : null;
|
|
49169
50112
|
const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
|
|
49170
50113
|
if (observed < minSchema) {
|
|
49171
50114
|
throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
|
|
@@ -49180,8 +50123,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
49180
50123
|
session: session === void 0 ? null : session
|
|
49181
50124
|
};
|
|
49182
50125
|
}
|
|
49183
|
-
if (!
|
|
49184
|
-
|
|
50126
|
+
if (!fs75.existsSync(target) || _chReadHeader(target) === null) {
|
|
50127
|
+
fs75.mkdirSync(path71.dirname(target), { recursive: true });
|
|
49185
50128
|
_chInit(target);
|
|
49186
50129
|
}
|
|
49187
50130
|
_chAppend(entry, target, session ?? null);
|
|
@@ -49225,7 +50168,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
|
|
|
49225
50168
|
if (detail !== "full" && detail !== "index") {
|
|
49226
50169
|
throw new Error("'detail' must be 'index' or 'full'");
|
|
49227
50170
|
}
|
|
49228
|
-
if (!
|
|
50171
|
+
if (!fs75.existsSync(target)) {
|
|
49229
50172
|
return { path: target, entries: [], count: 0 };
|
|
49230
50173
|
}
|
|
49231
50174
|
if (around !== void 0 && around !== null) {
|
|
@@ -49327,8 +50270,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
|
|
|
49327
50270
|
}
|
|
49328
50271
|
return result;
|
|
49329
50272
|
}
|
|
49330
|
-
var _PACKAGE_ROOT3 =
|
|
49331
|
-
|
|
50273
|
+
var _PACKAGE_ROOT3 = path71.resolve(
|
|
50274
|
+
path71.dirname(fileURLToPath44(import.meta.url)),
|
|
49332
50275
|
"..",
|
|
49333
50276
|
"..",
|
|
49334
50277
|
".."
|
|
@@ -49372,10 +50315,10 @@ async function _memorySignalHandler(args, consumerRoot) {
|
|
|
49372
50315
|
async function _roadmapProgressHandler(args, consumerRoot) {
|
|
49373
50316
|
const dryRun = _pyTruthy6(args.dry_run ?? false);
|
|
49374
50317
|
const root = _resolvePath2(consumerRoot);
|
|
49375
|
-
const roadmapRoot =
|
|
49376
|
-
const target =
|
|
50318
|
+
const roadmapRoot = path71.join(root, "agents", "roadmaps");
|
|
50319
|
+
const target = path71.join(root, "agents", "roadmaps-progress.md");
|
|
49377
50320
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
49378
|
-
if (!
|
|
50321
|
+
if (!fs75.existsSync(roadmapRoot)) {
|
|
49379
50322
|
return {
|
|
49380
50323
|
written: false,
|
|
49381
50324
|
path: target,
|
|
@@ -49390,7 +50333,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
|
|
|
49390
50333
|
const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
|
|
49391
50334
|
const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
|
|
49392
50335
|
if (!dryRun) {
|
|
49393
|
-
|
|
50336
|
+
fs75.writeFileSync(target, content, "utf-8");
|
|
49394
50337
|
}
|
|
49395
50338
|
return {
|
|
49396
50339
|
written: !dryRun,
|
|
@@ -49411,11 +50354,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
49411
50354
|
let dashboardRegenerated = false;
|
|
49412
50355
|
if (archived.length > 0) {
|
|
49413
50356
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
49414
|
-
const roadmapRoot =
|
|
49415
|
-
if (
|
|
50357
|
+
const roadmapRoot = path71.join(root, "agents", "roadmaps");
|
|
50358
|
+
if (fs75.existsSync(roadmapRoot)) {
|
|
49416
50359
|
const roadmaps = urp.collect(roadmapRoot);
|
|
49417
|
-
|
|
49418
|
-
|
|
50360
|
+
fs75.writeFileSync(
|
|
50361
|
+
path71.join(root, "agents", "roadmaps-progress.md"),
|
|
49419
50362
|
urp.render(roadmaps, urp.collect_bundles(root)),
|
|
49420
50363
|
"utf-8"
|
|
49421
50364
|
);
|
|
@@ -49431,9 +50374,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
49431
50374
|
async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
49432
50375
|
const check = _pyTruthy6(args.check ?? false);
|
|
49433
50376
|
const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
|
|
49434
|
-
const out =
|
|
50377
|
+
const out = path71.join(_PACKAGE_ROOT3, "CAPABILITIES.yaml");
|
|
49435
50378
|
const content = cap.build();
|
|
49436
|
-
const onDisk =
|
|
50379
|
+
const onDisk = fs75.existsSync(out) ? fs75.readFileSync(out, "utf-8") : "";
|
|
49437
50380
|
const drift = onDisk !== content;
|
|
49438
50381
|
if (check) {
|
|
49439
50382
|
return { check: true, written: false, drift, path: out };
|
|
@@ -49444,7 +50387,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
|
49444
50387
|
`CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
|
|
49445
50388
|
);
|
|
49446
50389
|
}
|
|
49447
|
-
|
|
50390
|
+
fs75.writeFileSync(out, content, "utf-8");
|
|
49448
50391
|
return { check: false, written: true, drift, path: out };
|
|
49449
50392
|
}
|
|
49450
50393
|
async function _runDoctorLeg(consumerRoot) {
|
|
@@ -49544,11 +50487,11 @@ async function _councilEstimateHandler(args, consumerRoot) {
|
|
|
49544
50487
|
throw new Error("'depth' must be 'shallow' or 'deep' when provided");
|
|
49545
50488
|
}
|
|
49546
50489
|
const root = _resolvePath2(consumerRoot);
|
|
49547
|
-
const target =
|
|
50490
|
+
const target = path71.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path71.join(root, inputRaw));
|
|
49548
50491
|
if (_relativeUnder(target, root) === null) {
|
|
49549
50492
|
throw new Error(`path escapes consumer_root: ${target}`);
|
|
49550
50493
|
}
|
|
49551
|
-
if (!
|
|
50494
|
+
if (!fs75.existsSync(target)) {
|
|
49552
50495
|
throw new Error(`input_path not found: ${target}`);
|
|
49553
50496
|
}
|
|
49554
50497
|
const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
|
|
@@ -49610,18 +50553,18 @@ async function _runTestsHandler(args, consumerRoot) {
|
|
|
49610
50553
|
if (typeof relPathRaw !== "string" || !_strip8(relPathRaw)) {
|
|
49611
50554
|
throw new Error("'path' must be a non-empty string when provided");
|
|
49612
50555
|
}
|
|
49613
|
-
const resolved =
|
|
50556
|
+
const resolved = path71.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path71.join(root, relPathRaw));
|
|
49614
50557
|
const rel = _relativeUnder(resolved, root);
|
|
49615
50558
|
if (rel === null) {
|
|
49616
50559
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
49617
50560
|
}
|
|
49618
|
-
if (!
|
|
50561
|
+
if (!fs75.existsSync(resolved)) {
|
|
49619
50562
|
throw new Error(`path not found: ${resolved}`);
|
|
49620
50563
|
}
|
|
49621
50564
|
relArg = rel;
|
|
49622
50565
|
}
|
|
49623
|
-
const vitestEntry =
|
|
49624
|
-
if (!
|
|
50566
|
+
const vitestEntry = path71.join(root, "node_modules", "vitest", "vitest.mjs");
|
|
50567
|
+
if (!fs75.existsSync(vitestEntry)) {
|
|
49625
50568
|
throw new Error(
|
|
49626
50569
|
"run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
|
|
49627
50570
|
);
|
|
@@ -50227,8 +51170,8 @@ function _strCmp3(a, b) {
|
|
|
50227
51170
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
50228
51171
|
}
|
|
50229
51172
|
function _pathlibCompare3(a, b) {
|
|
50230
|
-
const pa = a.split(
|
|
50231
|
-
const pb = b.split(
|
|
51173
|
+
const pa = a.split(path71.sep);
|
|
51174
|
+
const pb = b.split(path71.sep);
|
|
50232
51175
|
const n = Math.min(pa.length, pb.length);
|
|
50233
51176
|
for (let i = 0; i < n; i++) {
|
|
50234
51177
|
const c = _strCmp3(pa[i], pb[i]);
|
|
@@ -50447,18 +51390,18 @@ async function _serveOverSdk(server) {
|
|
|
50447
51390
|
const transport = new StdioServerTransport();
|
|
50448
51391
|
await sdkServer.connect(transport);
|
|
50449
51392
|
}
|
|
50450
|
-
function
|
|
51393
|
+
function main33() {
|
|
50451
51394
|
void run_stdio();
|
|
50452
51395
|
}
|
|
50453
51396
|
|
|
50454
51397
|
// src/scripts/mcp_server/__main__.ts
|
|
50455
|
-
var _selfPath =
|
|
50456
|
-
var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 &&
|
|
51398
|
+
var _selfPath = fileURLToPath45(import.meta.url);
|
|
51399
|
+
var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path72.resolve(process.argv[1]) === path72.resolve(_selfPath);
|
|
50457
51400
|
if (_invokedDirectly2) {
|
|
50458
|
-
|
|
51401
|
+
main33();
|
|
50459
51402
|
}
|
|
50460
51403
|
export {
|
|
50461
|
-
|
|
51404
|
+
main33 as main
|
|
50462
51405
|
};
|
|
50463
51406
|
/*! Bundled license information:
|
|
50464
51407
|
|