@event4u/agent-config 10.2.0 → 10.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +168 -256
- package/README.md +1 -1
- package/dist/agent-src/commands/analyze/reference-repo.md +62 -0
- package/dist/agent-src/commands/analyze.md +2 -1
- package/dist/agent-src/commands/design-system/capture.md +44 -0
- package/dist/agent-src/commands/design-system/generate.md +53 -0
- package/dist/agent-src/commands/design-system/import.md +63 -0
- package/dist/agent-src/commands/design-system.md +66 -0
- package/dist/agent-src/commands/roadmap/create.md +4 -1
- package/dist/agent-src/personas/advisors/first-principles.md +6 -0
- package/dist/agent-src/rules/active-remediation.md +53 -2
- package/dist/agent-src/rules/code-provenance.md +66 -4
- package/dist/agent-src/rules/content-quoting-floor.md +6 -0
- package/dist/agent-src/rules/design-fidelity.md +49 -3
- package/dist/agent-src/skills/design-review/references/verification-automation.md +23 -1
- package/dist/agent-src/skills/design-system-capture/SKILL.md +9 -0
- package/dist/agent-src/skills/design-system-capture/references/design-system-json.md +70 -0
- package/dist/agent-src/skills/fe-design/SKILL.md +27 -3
- package/dist/agent-src/skills/judge-synthesis/SKILL.md +30 -0
- package/dist/agent-src/skills/learning-to-rule-or-skill/SKILL.md +11 -0
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +8 -8
- package/dist/agent-src/skills/skill-writing/SKILL.md +4 -0
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/persona.md +26 -0
- package/dist/agent-src/templates/roadmaps.md +27 -7
- package/dist/agent-src/templates/scripts/work_engine/directives/ui/design.ts +4 -1
- package/dist/agent-src/templates/skill.md +35 -1
- package/dist/cli/commands/commands.candidates.test.js +257 -0
- package/dist/cli/commands/commands.candidates.test.js.map +1 -0
- package/dist/cli/commands/commands.js +199 -0
- package/dist/cli/commands/commands.js.map +1 -1
- package/dist/cli/main.js +1 -0
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/registry.js +1 -1
- package/dist/cli/registry.js.map +1 -1
- package/dist/cli-delegate/{chunk-E4RUZKXB.js → chunk-FV34EGEX.js} +1 -1
- package/dist/cli-delegate/chunk-RLN73PR5.js +157 -0
- package/dist/cli-delegate/{chunk-I5EAFRII.js → chunk-ZPSXJTLI.js} +2 -154
- package/dist/cli-delegate/cmd_conformance.js +672 -214
- package/dist/cli-delegate/cmd_doctor.js +1 -1
- package/dist/cli-delegate/cmd_handoff.js +8 -6
- package/dist/cli-delegate/cmd_session_recycle.js +5 -3
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +127 -22
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +3 -3
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +9 -5
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +8 -4
- package/dist/hooks/dispatch.js +1056 -411
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +1103 -593
- package/dist/router.json +1 -1
- package/docs/guidelines/agent-infra/active-remediation-mechanics.md +54 -0
- package/docs/guidelines/design-antipatterns.md +79 -10
- package/docs/guidelines/design-fidelity-mechanics.md +120 -2
- package/package.json +1 -1
- package/src/agent-src/templates/scripts/work_engine/directives/ui/design.ts +4 -1
- package/src/config/gate-coverage.yml +65 -10
- package/src/config/gate-violation-baselines.json +6 -0
- package/src/config/review-prompt-binding-baseline.json +19 -0
- package/src/config/rule-enforcement-baseline.json +0 -1
- package/src/scripts/_dispatch.bash +1 -0
- package/src/scripts/_lib/design_system_import.ts +987 -0
- package/src/scripts/ai_council/clients.ts +15 -1
- package/src/scripts/check_ci_local_parity.ts +60 -6
- package/src/scripts/check_review_prompt_binding.ts +553 -0
- package/src/scripts/check_suppression_hygiene.ts +19 -3
- package/src/scripts/design_slop_rules.test.ts +37 -6
- package/src/scripts/design_slop_rules.ts +150 -22
- package/src/scripts/design_system_import.ts +264 -0
- package/src/scripts/dispatch_r2_reviewer.ts +15 -1
- package/src/scripts/hook_manifest.yaml +71 -2
- package/src/scripts/hooks/concern_registry.ts +4 -0
- package/src/scripts/hooks/dispatch_hook.ts +10 -0
- package/src/scripts/hooks/host_semantics.ts +2 -0
- package/src/scripts/hooks/spawn_guard_shadow_hook.ts +212 -0
- package/src/scripts/hooks/subagent_ledger_hook.ts +723 -0
- package/src/scripts/hooks/turn_end_gate_hook.ts +39 -2
- package/src/scripts/hooks/ui_route_nudge_hook.ts +55 -2
- package/src/scripts/lint_design_antipattern_parity.ts +201 -0
- package/src/scripts/lint_harvest_provenance.ts +483 -0
- package/src/scripts/lint_hook_manifest.ts +2 -0
- package/src/scripts/lint_rule_skill_pack_reach.ts +194 -13
- package/src/scripts/lint_skill_router_head.ts +254 -0
- package/src/scripts/report_consultation_rate.ts +126 -1
- package/src/scripts/run_skill_evals.ts +10 -5
- package/src/scripts/schemas/persona.schema.json +8 -0
- package/src/scripts/schemas/provenance-harvest.schema.json +39 -0
- package/src/scripts/sweep_dead_scan_roots.ts +51 -0
- package/tests/fixtures/hooks/subagent_start.json +7 -0
- package/tests/fixtures/hooks/subagent_stop.json +8 -0
package/dist/mcp/server.mjs
CHANGED
|
@@ -1840,17 +1840,17 @@ var require_visit = __commonJS({
|
|
|
1840
1840
|
visit.BREAK = BREAK;
|
|
1841
1841
|
visit.SKIP = SKIP;
|
|
1842
1842
|
visit.REMOVE = REMOVE;
|
|
1843
|
-
function visit_(key, node, visitor,
|
|
1844
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
1843
|
+
function visit_(key, node, visitor, path75) {
|
|
1844
|
+
const ctrl = callVisitor(key, node, visitor, path75);
|
|
1845
1845
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
1846
|
-
replaceNode(key,
|
|
1847
|
-
return visit_(key, ctrl, visitor,
|
|
1846
|
+
replaceNode(key, path75, ctrl);
|
|
1847
|
+
return visit_(key, ctrl, visitor, path75);
|
|
1848
1848
|
}
|
|
1849
1849
|
if (typeof ctrl !== "symbol") {
|
|
1850
1850
|
if (identity.isCollection(node)) {
|
|
1851
|
-
|
|
1851
|
+
path75 = Object.freeze(path75.concat(node));
|
|
1852
1852
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1853
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
1853
|
+
const ci = visit_(i, node.items[i], visitor, path75);
|
|
1854
1854
|
if (typeof ci === "number")
|
|
1855
1855
|
i = ci - 1;
|
|
1856
1856
|
else if (ci === BREAK)
|
|
@@ -1861,13 +1861,13 @@ var require_visit = __commonJS({
|
|
|
1861
1861
|
}
|
|
1862
1862
|
}
|
|
1863
1863
|
} else if (identity.isPair(node)) {
|
|
1864
|
-
|
|
1865
|
-
const ck = visit_("key", node.key, visitor,
|
|
1864
|
+
path75 = Object.freeze(path75.concat(node));
|
|
1865
|
+
const ck = visit_("key", node.key, visitor, path75);
|
|
1866
1866
|
if (ck === BREAK)
|
|
1867
1867
|
return BREAK;
|
|
1868
1868
|
else if (ck === REMOVE)
|
|
1869
1869
|
node.key = null;
|
|
1870
|
-
const cv = visit_("value", node.value, visitor,
|
|
1870
|
+
const cv = visit_("value", node.value, visitor, path75);
|
|
1871
1871
|
if (cv === BREAK)
|
|
1872
1872
|
return BREAK;
|
|
1873
1873
|
else if (cv === REMOVE)
|
|
@@ -1888,17 +1888,17 @@ var require_visit = __commonJS({
|
|
|
1888
1888
|
visitAsync.BREAK = BREAK;
|
|
1889
1889
|
visitAsync.SKIP = SKIP;
|
|
1890
1890
|
visitAsync.REMOVE = REMOVE;
|
|
1891
|
-
async function visitAsync_(key, node, visitor,
|
|
1892
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
1891
|
+
async function visitAsync_(key, node, visitor, path75) {
|
|
1892
|
+
const ctrl = await callVisitor(key, node, visitor, path75);
|
|
1893
1893
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
1894
|
-
replaceNode(key,
|
|
1895
|
-
return visitAsync_(key, ctrl, visitor,
|
|
1894
|
+
replaceNode(key, path75, ctrl);
|
|
1895
|
+
return visitAsync_(key, ctrl, visitor, path75);
|
|
1896
1896
|
}
|
|
1897
1897
|
if (typeof ctrl !== "symbol") {
|
|
1898
1898
|
if (identity.isCollection(node)) {
|
|
1899
|
-
|
|
1899
|
+
path75 = Object.freeze(path75.concat(node));
|
|
1900
1900
|
for (let i = 0; i < node.items.length; ++i) {
|
|
1901
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
1901
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path75);
|
|
1902
1902
|
if (typeof ci === "number")
|
|
1903
1903
|
i = ci - 1;
|
|
1904
1904
|
else if (ci === BREAK)
|
|
@@ -1909,13 +1909,13 @@ var require_visit = __commonJS({
|
|
|
1909
1909
|
}
|
|
1910
1910
|
}
|
|
1911
1911
|
} else if (identity.isPair(node)) {
|
|
1912
|
-
|
|
1913
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
1912
|
+
path75 = Object.freeze(path75.concat(node));
|
|
1913
|
+
const ck = await visitAsync_("key", node.key, visitor, path75);
|
|
1914
1914
|
if (ck === BREAK)
|
|
1915
1915
|
return BREAK;
|
|
1916
1916
|
else if (ck === REMOVE)
|
|
1917
1917
|
node.key = null;
|
|
1918
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
1918
|
+
const cv = await visitAsync_("value", node.value, visitor, path75);
|
|
1919
1919
|
if (cv === BREAK)
|
|
1920
1920
|
return BREAK;
|
|
1921
1921
|
else if (cv === REMOVE)
|
|
@@ -1942,23 +1942,23 @@ var require_visit = __commonJS({
|
|
|
1942
1942
|
}
|
|
1943
1943
|
return visitor;
|
|
1944
1944
|
}
|
|
1945
|
-
function callVisitor(key, node, visitor,
|
|
1945
|
+
function callVisitor(key, node, visitor, path75) {
|
|
1946
1946
|
if (typeof visitor === "function")
|
|
1947
|
-
return visitor(key, node,
|
|
1947
|
+
return visitor(key, node, path75);
|
|
1948
1948
|
if (identity.isMap(node))
|
|
1949
|
-
return visitor.Map?.(key, node,
|
|
1949
|
+
return visitor.Map?.(key, node, path75);
|
|
1950
1950
|
if (identity.isSeq(node))
|
|
1951
|
-
return visitor.Seq?.(key, node,
|
|
1951
|
+
return visitor.Seq?.(key, node, path75);
|
|
1952
1952
|
if (identity.isPair(node))
|
|
1953
|
-
return visitor.Pair?.(key, node,
|
|
1953
|
+
return visitor.Pair?.(key, node, path75);
|
|
1954
1954
|
if (identity.isScalar(node))
|
|
1955
|
-
return visitor.Scalar?.(key, node,
|
|
1955
|
+
return visitor.Scalar?.(key, node, path75);
|
|
1956
1956
|
if (identity.isAlias(node))
|
|
1957
|
-
return visitor.Alias?.(key, node,
|
|
1957
|
+
return visitor.Alias?.(key, node, path75);
|
|
1958
1958
|
return void 0;
|
|
1959
1959
|
}
|
|
1960
|
-
function replaceNode(key,
|
|
1961
|
-
const parent =
|
|
1960
|
+
function replaceNode(key, path75, node) {
|
|
1961
|
+
const parent = path75[path75.length - 1];
|
|
1962
1962
|
if (identity.isCollection(parent)) {
|
|
1963
1963
|
parent.items[key] = node;
|
|
1964
1964
|
} else if (identity.isPair(parent)) {
|
|
@@ -2568,10 +2568,10 @@ var require_Collection = __commonJS({
|
|
|
2568
2568
|
var createNode = require_createNode();
|
|
2569
2569
|
var identity = require_identity();
|
|
2570
2570
|
var Node = require_Node();
|
|
2571
|
-
function collectionFromPath(schema,
|
|
2571
|
+
function collectionFromPath(schema, path75, value) {
|
|
2572
2572
|
let v = value;
|
|
2573
|
-
for (let i =
|
|
2574
|
-
const k =
|
|
2573
|
+
for (let i = path75.length - 1; i >= 0; --i) {
|
|
2574
|
+
const k = path75[i];
|
|
2575
2575
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2576
2576
|
const a = [];
|
|
2577
2577
|
a[k] = v;
|
|
@@ -2590,7 +2590,7 @@ var require_Collection = __commonJS({
|
|
|
2590
2590
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2591
2591
|
});
|
|
2592
2592
|
}
|
|
2593
|
-
var isEmptyPath = (
|
|
2593
|
+
var isEmptyPath = (path75) => path75 == null || typeof path75 === "object" && !!path75[Symbol.iterator]().next().done;
|
|
2594
2594
|
var Collection = class extends Node.NodeBase {
|
|
2595
2595
|
constructor(type, schema) {
|
|
2596
2596
|
super(type);
|
|
@@ -2620,11 +2620,11 @@ var require_Collection = __commonJS({
|
|
|
2620
2620
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2621
2621
|
* that already exists in the map.
|
|
2622
2622
|
*/
|
|
2623
|
-
addIn(
|
|
2624
|
-
if (isEmptyPath(
|
|
2623
|
+
addIn(path75, value) {
|
|
2624
|
+
if (isEmptyPath(path75))
|
|
2625
2625
|
this.add(value);
|
|
2626
2626
|
else {
|
|
2627
|
-
const [key, ...rest] =
|
|
2627
|
+
const [key, ...rest] = path75;
|
|
2628
2628
|
const node = this.get(key, true);
|
|
2629
2629
|
if (identity.isCollection(node))
|
|
2630
2630
|
node.addIn(rest, value);
|
|
@@ -2638,8 +2638,8 @@ var require_Collection = __commonJS({
|
|
|
2638
2638
|
* Removes a value from the collection.
|
|
2639
2639
|
* @returns `true` if the item was found and removed.
|
|
2640
2640
|
*/
|
|
2641
|
-
deleteIn(
|
|
2642
|
-
const [key, ...rest] =
|
|
2641
|
+
deleteIn(path75) {
|
|
2642
|
+
const [key, ...rest] = path75;
|
|
2643
2643
|
if (rest.length === 0)
|
|
2644
2644
|
return this.delete(key);
|
|
2645
2645
|
const node = this.get(key, true);
|
|
@@ -2653,8 +2653,8 @@ var require_Collection = __commonJS({
|
|
|
2653
2653
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2654
2654
|
* `true` (collections are always returned intact).
|
|
2655
2655
|
*/
|
|
2656
|
-
getIn(
|
|
2657
|
-
const [key, ...rest] =
|
|
2656
|
+
getIn(path75, keepScalar) {
|
|
2657
|
+
const [key, ...rest] = path75;
|
|
2658
2658
|
const node = this.get(key, true);
|
|
2659
2659
|
if (rest.length === 0)
|
|
2660
2660
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -2672,8 +2672,8 @@ var require_Collection = __commonJS({
|
|
|
2672
2672
|
/**
|
|
2673
2673
|
* Checks if the collection includes a value with the key `key`.
|
|
2674
2674
|
*/
|
|
2675
|
-
hasIn(
|
|
2676
|
-
const [key, ...rest] =
|
|
2675
|
+
hasIn(path75) {
|
|
2676
|
+
const [key, ...rest] = path75;
|
|
2677
2677
|
if (rest.length === 0)
|
|
2678
2678
|
return this.has(key);
|
|
2679
2679
|
const node = this.get(key, true);
|
|
@@ -2683,8 +2683,8 @@ var require_Collection = __commonJS({
|
|
|
2683
2683
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2684
2684
|
* boolean to add/remove the item from the set.
|
|
2685
2685
|
*/
|
|
2686
|
-
setIn(
|
|
2687
|
-
const [key, ...rest] =
|
|
2686
|
+
setIn(path75, value) {
|
|
2687
|
+
const [key, ...rest] = path75;
|
|
2688
2688
|
if (rest.length === 0) {
|
|
2689
2689
|
this.set(key, value);
|
|
2690
2690
|
} else {
|
|
@@ -2708,13 +2708,13 @@ var require_Collection = __commonJS({
|
|
|
2708
2708
|
var require_stringifyComment = __commonJS({
|
|
2709
2709
|
"node_modules/yaml/dist/stringify/stringifyComment.js"(exports) {
|
|
2710
2710
|
"use strict";
|
|
2711
|
-
var stringifyComment = (
|
|
2711
|
+
var stringifyComment = (str4) => str4.replace(/^(?!$)(?: $)?/gm, "#");
|
|
2712
2712
|
function indentComment(comment, indent) {
|
|
2713
2713
|
if (/^\n+$/.test(comment))
|
|
2714
2714
|
return comment.substring(1);
|
|
2715
2715
|
return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;
|
|
2716
2716
|
}
|
|
2717
|
-
var lineComment = (
|
|
2717
|
+
var lineComment = (str4, indent, comment) => str4.endsWith("\n") ? indentComment(comment, indent) : comment.includes("\n") ? "\n" + indentComment(comment, indent) : (str4.endsWith(" ") ? "" : " ") + comment;
|
|
2718
2718
|
exports.indentComment = indentComment;
|
|
2719
2719
|
exports.lineComment = lineComment;
|
|
2720
2720
|
exports.stringifyComment = stringifyComment;
|
|
@@ -2868,16 +2868,16 @@ var require_stringifyString = __commonJS({
|
|
|
2868
2868
|
lineWidth: ctx.options.lineWidth,
|
|
2869
2869
|
minContentWidth: ctx.options.minContentWidth
|
|
2870
2870
|
});
|
|
2871
|
-
var containsDocumentMarker = (
|
|
2872
|
-
function lineLengthOverLimit(
|
|
2871
|
+
var containsDocumentMarker = (str4) => /^(%|---|\.\.\.)/m.test(str4);
|
|
2872
|
+
function lineLengthOverLimit(str4, lineWidth, indentLength) {
|
|
2873
2873
|
if (!lineWidth || lineWidth < 0)
|
|
2874
2874
|
return false;
|
|
2875
2875
|
const limit = lineWidth - indentLength;
|
|
2876
|
-
const strLen =
|
|
2876
|
+
const strLen = str4.length;
|
|
2877
2877
|
if (strLen <= limit)
|
|
2878
2878
|
return false;
|
|
2879
2879
|
for (let i = 0, start = 0; i < strLen; ++i) {
|
|
2880
|
-
if (
|
|
2880
|
+
if (str4[i] === "\n") {
|
|
2881
2881
|
if (i - start > limit)
|
|
2882
2882
|
return true;
|
|
2883
2883
|
start = i + 1;
|
|
@@ -2894,11 +2894,11 @@ var require_stringifyString = __commonJS({
|
|
|
2894
2894
|
const { implicitKey } = ctx;
|
|
2895
2895
|
const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;
|
|
2896
2896
|
const indent = ctx.indent || (containsDocumentMarker(value) ? " " : "");
|
|
2897
|
-
let
|
|
2897
|
+
let str4 = "";
|
|
2898
2898
|
let start = 0;
|
|
2899
2899
|
for (let i = 0, ch = json[i]; ch; ch = json[++i]) {
|
|
2900
2900
|
if (ch === " " && json[i + 1] === "\\" && json[i + 2] === "n") {
|
|
2901
|
-
|
|
2901
|
+
str4 += json.slice(start, i) + "\\ ";
|
|
2902
2902
|
i += 1;
|
|
2903
2903
|
start = i;
|
|
2904
2904
|
ch = "\\";
|
|
@@ -2907,38 +2907,38 @@ var require_stringifyString = __commonJS({
|
|
|
2907
2907
|
switch (json[i + 1]) {
|
|
2908
2908
|
case "u":
|
|
2909
2909
|
{
|
|
2910
|
-
|
|
2910
|
+
str4 += json.slice(start, i);
|
|
2911
2911
|
const code = json.substr(i + 2, 4);
|
|
2912
2912
|
switch (code) {
|
|
2913
2913
|
case "0000":
|
|
2914
|
-
|
|
2914
|
+
str4 += "\\0";
|
|
2915
2915
|
break;
|
|
2916
2916
|
case "0007":
|
|
2917
|
-
|
|
2917
|
+
str4 += "\\a";
|
|
2918
2918
|
break;
|
|
2919
2919
|
case "000b":
|
|
2920
|
-
|
|
2920
|
+
str4 += "\\v";
|
|
2921
2921
|
break;
|
|
2922
2922
|
case "001b":
|
|
2923
|
-
|
|
2923
|
+
str4 += "\\e";
|
|
2924
2924
|
break;
|
|
2925
2925
|
case "0085":
|
|
2926
|
-
|
|
2926
|
+
str4 += "\\N";
|
|
2927
2927
|
break;
|
|
2928
2928
|
case "00a0":
|
|
2929
|
-
|
|
2929
|
+
str4 += "\\_";
|
|
2930
2930
|
break;
|
|
2931
2931
|
case "2028":
|
|
2932
|
-
|
|
2932
|
+
str4 += "\\L";
|
|
2933
2933
|
break;
|
|
2934
2934
|
case "2029":
|
|
2935
|
-
|
|
2935
|
+
str4 += "\\P";
|
|
2936
2936
|
break;
|
|
2937
2937
|
default:
|
|
2938
2938
|
if (code.substr(0, 2) === "00")
|
|
2939
|
-
|
|
2939
|
+
str4 += "\\x" + code.substr(2);
|
|
2940
2940
|
else
|
|
2941
|
-
|
|
2941
|
+
str4 += json.substr(i, 6);
|
|
2942
2942
|
}
|
|
2943
2943
|
i += 5;
|
|
2944
2944
|
start = i + 1;
|
|
@@ -2948,14 +2948,14 @@ var require_stringifyString = __commonJS({
|
|
|
2948
2948
|
if (implicitKey || json[i + 2] === '"' || json.length < minMultiLineLength) {
|
|
2949
2949
|
i += 1;
|
|
2950
2950
|
} else {
|
|
2951
|
-
|
|
2951
|
+
str4 += json.slice(start, i) + "\n\n";
|
|
2952
2952
|
while (json[i + 2] === "\\" && json[i + 3] === "n" && json[i + 4] !== '"') {
|
|
2953
|
-
|
|
2953
|
+
str4 += "\n";
|
|
2954
2954
|
i += 2;
|
|
2955
2955
|
}
|
|
2956
|
-
|
|
2956
|
+
str4 += indent;
|
|
2957
2957
|
if (json[i + 2] === " ")
|
|
2958
|
-
|
|
2958
|
+
str4 += "\\";
|
|
2959
2959
|
i += 1;
|
|
2960
2960
|
start = i + 1;
|
|
2961
2961
|
}
|
|
@@ -2964,8 +2964,8 @@ var require_stringifyString = __commonJS({
|
|
|
2964
2964
|
i += 1;
|
|
2965
2965
|
}
|
|
2966
2966
|
}
|
|
2967
|
-
|
|
2968
|
-
return implicitKey ?
|
|
2967
|
+
str4 = start ? str4 + json.slice(start) : json;
|
|
2968
|
+
return implicitKey ? str4 : foldFlowLines.foldFlowLines(str4, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));
|
|
2969
2969
|
}
|
|
2970
2970
|
function singleQuotedString(value, ctx) {
|
|
2971
2971
|
if (ctx.options.singleQuote === false || ctx.implicitKey && value.includes("\n") || /[ \t]\n|\n[ \t]/.test(value))
|
|
@@ -3093,15 +3093,15 @@ ${indent}${start}${value}${end}`;
|
|
|
3093
3093
|
return quotedString(value, ctx);
|
|
3094
3094
|
}
|
|
3095
3095
|
}
|
|
3096
|
-
const
|
|
3096
|
+
const str4 = value.replace(/\n+/g, `$&
|
|
3097
3097
|
${indent}`);
|
|
3098
3098
|
if (actualString) {
|
|
3099
|
-
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(
|
|
3099
|
+
const test = (tag) => tag.default && tag.tag !== "tag:yaml.org,2002:str" && tag.test?.test(str4);
|
|
3100
3100
|
const { compat, tags } = ctx.doc.schema;
|
|
3101
3101
|
if (tags.some(test) || compat?.some(test))
|
|
3102
3102
|
return quotedString(value, ctx);
|
|
3103
3103
|
}
|
|
3104
|
-
return implicitKey ?
|
|
3104
|
+
return implicitKey ? str4 : foldFlowLines.foldFlowLines(str4, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));
|
|
3105
3105
|
}
|
|
3106
3106
|
function stringifyString(item, ctx, onComment, onChompKeep) {
|
|
3107
3107
|
const { implicitKey, inFlow } = ctx;
|
|
@@ -3253,11 +3253,11 @@ var require_stringify = __commonJS({
|
|
|
3253
3253
|
const props = stringifyProps(node, tagObj, ctx);
|
|
3254
3254
|
if (props.length > 0)
|
|
3255
3255
|
ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;
|
|
3256
|
-
const
|
|
3256
|
+
const str4 = typeof tagObj.stringify === "function" ? tagObj.stringify(node, ctx, onComment, onChompKeep) : identity.isScalar(node) ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep) : node.toString(ctx, onComment, onChompKeep);
|
|
3257
3257
|
if (!props)
|
|
3258
|
-
return
|
|
3259
|
-
return identity.isScalar(node) ||
|
|
3260
|
-
${ctx.indent}${
|
|
3258
|
+
return str4;
|
|
3259
|
+
return identity.isScalar(node) || str4[0] === "{" || str4[0] === "[" ? `${props} ${str4}` : `${props}
|
|
3260
|
+
${ctx.indent}${str4}`;
|
|
3261
3261
|
}
|
|
3262
3262
|
exports.createStringifyContext = createStringifyContext;
|
|
3263
3263
|
exports.stringify = stringify;
|
|
@@ -3292,8 +3292,8 @@ var require_stringifyPair = __commonJS({
|
|
|
3292
3292
|
});
|
|
3293
3293
|
let keyCommentDone = false;
|
|
3294
3294
|
let chompKeep = false;
|
|
3295
|
-
let
|
|
3296
|
-
if (!explicitKey && !ctx.inFlow &&
|
|
3295
|
+
let str4 = stringify.stringify(key, ctx, () => keyCommentDone = true, () => chompKeep = true);
|
|
3296
|
+
if (!explicitKey && !ctx.inFlow && str4.length > 1024) {
|
|
3297
3297
|
if (simpleKeys)
|
|
3298
3298
|
throw new Error("With simple keys, single line scalar must not span more than 1024 characters");
|
|
3299
3299
|
explicitKey = true;
|
|
@@ -3302,27 +3302,27 @@ var require_stringifyPair = __commonJS({
|
|
|
3302
3302
|
if (allNullValues || value == null) {
|
|
3303
3303
|
if (keyCommentDone && onComment)
|
|
3304
3304
|
onComment();
|
|
3305
|
-
return
|
|
3305
|
+
return str4 === "" ? "?" : explicitKey ? `? ${str4}` : str4;
|
|
3306
3306
|
}
|
|
3307
3307
|
} else if (allNullValues && !simpleKeys || value == null && explicitKey) {
|
|
3308
|
-
|
|
3308
|
+
str4 = `? ${str4}`;
|
|
3309
3309
|
if (keyComment && !keyCommentDone) {
|
|
3310
|
-
|
|
3310
|
+
str4 += stringifyComment.lineComment(str4, ctx.indent, commentString(keyComment));
|
|
3311
3311
|
} else if (chompKeep && onChompKeep)
|
|
3312
3312
|
onChompKeep();
|
|
3313
|
-
return
|
|
3313
|
+
return str4;
|
|
3314
3314
|
}
|
|
3315
3315
|
if (keyCommentDone)
|
|
3316
3316
|
keyComment = null;
|
|
3317
3317
|
if (explicitKey) {
|
|
3318
3318
|
if (keyComment)
|
|
3319
|
-
|
|
3320
|
-
|
|
3319
|
+
str4 += stringifyComment.lineComment(str4, ctx.indent, commentString(keyComment));
|
|
3320
|
+
str4 = `? ${str4}
|
|
3321
3321
|
${indent}:`;
|
|
3322
3322
|
} else {
|
|
3323
|
-
|
|
3323
|
+
str4 = `${str4}:`;
|
|
3324
3324
|
if (keyComment)
|
|
3325
|
-
|
|
3325
|
+
str4 += stringifyComment.lineComment(str4, ctx.indent, commentString(keyComment));
|
|
3326
3326
|
}
|
|
3327
3327
|
let vsb, vcb, valueComment;
|
|
3328
3328
|
if (identity.isNode(value)) {
|
|
@@ -3338,7 +3338,7 @@ ${indent}:`;
|
|
|
3338
3338
|
}
|
|
3339
3339
|
ctx.implicitKey = false;
|
|
3340
3340
|
if (!explicitKey && !keyComment && identity.isScalar(value))
|
|
3341
|
-
ctx.indentAtStart =
|
|
3341
|
+
ctx.indentAtStart = str4.length + 1;
|
|
3342
3342
|
chompKeep = false;
|
|
3343
3343
|
if (!indentSeq && indentStep.length >= 2 && !ctx.inFlow && !explicitKey && identity.isSeq(value) && !value.flow && !value.tag && !value.anchor) {
|
|
3344
3344
|
ctx.indent = ctx.indent.substring(2);
|
|
@@ -3382,16 +3382,16 @@ ${ctx.indent}`;
|
|
|
3382
3382
|
} else if (valueStr === "" || valueStr[0] === "\n") {
|
|
3383
3383
|
ws = "";
|
|
3384
3384
|
}
|
|
3385
|
-
|
|
3385
|
+
str4 += ws + valueStr;
|
|
3386
3386
|
if (ctx.inFlow) {
|
|
3387
3387
|
if (valueCommentDone && onComment)
|
|
3388
3388
|
onComment();
|
|
3389
3389
|
} else if (valueComment && !valueCommentDone) {
|
|
3390
|
-
|
|
3390
|
+
str4 += stringifyComment.lineComment(str4, ctx.indent, commentString(valueComment));
|
|
3391
3391
|
} else if (chompKeep && onChompKeep) {
|
|
3392
3392
|
onChompKeep();
|
|
3393
3393
|
}
|
|
3394
|
-
return
|
|
3394
|
+
return str4;
|
|
3395
3395
|
}
|
|
3396
3396
|
exports.stringifyPair = stringifyPair;
|
|
3397
3397
|
}
|
|
@@ -3618,31 +3618,31 @@ var require_stringifyCollection = __commonJS({
|
|
|
3618
3618
|
}
|
|
3619
3619
|
}
|
|
3620
3620
|
chompKeep = false;
|
|
3621
|
-
let
|
|
3621
|
+
let str5 = stringify.stringify(item, itemCtx, () => comment2 = null, () => chompKeep = true);
|
|
3622
3622
|
if (comment2)
|
|
3623
|
-
|
|
3623
|
+
str5 += stringifyComment.lineComment(str5, itemIndent, commentString(comment2));
|
|
3624
3624
|
if (chompKeep && comment2)
|
|
3625
3625
|
chompKeep = false;
|
|
3626
|
-
lines.push(blockItemPrefix +
|
|
3626
|
+
lines.push(blockItemPrefix + str5);
|
|
3627
3627
|
}
|
|
3628
|
-
let
|
|
3628
|
+
let str4;
|
|
3629
3629
|
if (lines.length === 0) {
|
|
3630
|
-
|
|
3630
|
+
str4 = flowChars.start + flowChars.end;
|
|
3631
3631
|
} else {
|
|
3632
|
-
|
|
3632
|
+
str4 = lines[0];
|
|
3633
3633
|
for (let i = 1; i < lines.length; ++i) {
|
|
3634
3634
|
const line = lines[i];
|
|
3635
|
-
|
|
3635
|
+
str4 += line ? `
|
|
3636
3636
|
${indent}${line}` : "\n";
|
|
3637
3637
|
}
|
|
3638
3638
|
}
|
|
3639
3639
|
if (comment) {
|
|
3640
|
-
|
|
3640
|
+
str4 += "\n" + stringifyComment.indentComment(commentString(comment), indent);
|
|
3641
3641
|
if (onComment)
|
|
3642
3642
|
onComment();
|
|
3643
3643
|
} else if (chompKeep && onChompKeep)
|
|
3644
3644
|
onChompKeep();
|
|
3645
|
-
return
|
|
3645
|
+
return str4;
|
|
3646
3646
|
}
|
|
3647
3647
|
function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
|
|
3648
3648
|
const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;
|
|
@@ -3685,21 +3685,21 @@ ${indent}${line}` : "\n";
|
|
|
3685
3685
|
}
|
|
3686
3686
|
if (comment)
|
|
3687
3687
|
reqNewline = true;
|
|
3688
|
-
let
|
|
3689
|
-
reqNewline || (reqNewline = lines.length > linesAtValue ||
|
|
3688
|
+
let str4 = stringify.stringify(item, itemCtx, () => comment = null);
|
|
3689
|
+
reqNewline || (reqNewline = lines.length > linesAtValue || str4.includes("\n"));
|
|
3690
3690
|
if (i < items.length - 1) {
|
|
3691
|
-
|
|
3691
|
+
str4 += ",";
|
|
3692
3692
|
} else if (ctx.options.trailingComma) {
|
|
3693
3693
|
if (ctx.options.lineWidth > 0) {
|
|
3694
|
-
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (
|
|
3694
|
+
reqNewline || (reqNewline = lines.reduce((sum, line) => sum + line.length + 2, 2) + (str4.length + 2) > ctx.options.lineWidth);
|
|
3695
3695
|
}
|
|
3696
3696
|
if (reqNewline) {
|
|
3697
|
-
|
|
3697
|
+
str4 += ",";
|
|
3698
3698
|
}
|
|
3699
3699
|
}
|
|
3700
3700
|
if (comment)
|
|
3701
|
-
|
|
3702
|
-
lines.push(
|
|
3701
|
+
str4 += stringifyComment.lineComment(str4, itemIndent, commentString(comment));
|
|
3702
|
+
lines.push(str4);
|
|
3703
3703
|
linesAtValue = lines.length;
|
|
3704
3704
|
}
|
|
3705
3705
|
const { start, end } = flowChars;
|
|
@@ -3711,11 +3711,11 @@ ${indent}${line}` : "\n";
|
|
|
3711
3711
|
reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;
|
|
3712
3712
|
}
|
|
3713
3713
|
if (reqNewline) {
|
|
3714
|
-
let
|
|
3714
|
+
let str4 = start;
|
|
3715
3715
|
for (const line of lines)
|
|
3716
|
-
|
|
3716
|
+
str4 += line ? `
|
|
3717
3717
|
${indentStep}${indent}${line}` : "\n";
|
|
3718
|
-
return `${
|
|
3718
|
+
return `${str4}
|
|
3719
3719
|
${indent}${end}`;
|
|
3720
3720
|
} else {
|
|
3721
3721
|
return `${start}${fcPadding}${lines.join(" ")}${fcPadding}${end}`;
|
|
@@ -4047,7 +4047,7 @@ var require_string = __commonJS({
|
|
|
4047
4047
|
identify: (value) => typeof value === "string",
|
|
4048
4048
|
default: true,
|
|
4049
4049
|
tag: "tag:yaml.org,2002:str",
|
|
4050
|
-
resolve: (
|
|
4050
|
+
resolve: (str4) => str4,
|
|
4051
4051
|
stringify(item, ctx, onComment, onChompKeep) {
|
|
4052
4052
|
ctx = Object.assign({ actualString: true }, ctx);
|
|
4053
4053
|
return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);
|
|
@@ -4085,7 +4085,7 @@ var require_bool = __commonJS({
|
|
|
4085
4085
|
default: true,
|
|
4086
4086
|
tag: "tag:yaml.org,2002:bool",
|
|
4087
4087
|
test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,
|
|
4088
|
-
resolve: (
|
|
4088
|
+
resolve: (str4) => new Scalar.Scalar(str4[0] === "t" || str4[0] === "T"),
|
|
4089
4089
|
stringify({ source, value }, ctx) {
|
|
4090
4090
|
if (source && boolTag.test.test(source)) {
|
|
4091
4091
|
const sv = source[0] === "t" || source[0] === "T";
|
|
@@ -4137,7 +4137,7 @@ var require_float = __commonJS({
|
|
|
4137
4137
|
default: true,
|
|
4138
4138
|
tag: "tag:yaml.org,2002:float",
|
|
4139
4139
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
4140
|
-
resolve: (
|
|
4140
|
+
resolve: (str4) => str4.slice(-3).toLowerCase() === "nan" ? NaN : str4[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
4141
4141
|
stringify: stringifyNumber.stringifyNumber
|
|
4142
4142
|
};
|
|
4143
4143
|
var floatExp = {
|
|
@@ -4146,7 +4146,7 @@ var require_float = __commonJS({
|
|
|
4146
4146
|
tag: "tag:yaml.org,2002:float",
|
|
4147
4147
|
format: "EXP",
|
|
4148
4148
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,
|
|
4149
|
-
resolve: (
|
|
4149
|
+
resolve: (str4) => parseFloat(str4),
|
|
4150
4150
|
stringify(node) {
|
|
4151
4151
|
const num = Number(node.value);
|
|
4152
4152
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
@@ -4157,11 +4157,11 @@ var require_float = __commonJS({
|
|
|
4157
4157
|
default: true,
|
|
4158
4158
|
tag: "tag:yaml.org,2002:float",
|
|
4159
4159
|
test: /^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,
|
|
4160
|
-
resolve(
|
|
4161
|
-
const node = new Scalar.Scalar(parseFloat(
|
|
4162
|
-
const dot =
|
|
4163
|
-
if (dot !== -1 &&
|
|
4164
|
-
node.minFractionDigits =
|
|
4160
|
+
resolve(str4) {
|
|
4161
|
+
const node = new Scalar.Scalar(parseFloat(str4));
|
|
4162
|
+
const dot = str4.indexOf(".");
|
|
4163
|
+
if (dot !== -1 && str4[str4.length - 1] === "0")
|
|
4164
|
+
node.minFractionDigits = str4.length - dot - 1;
|
|
4165
4165
|
return node;
|
|
4166
4166
|
},
|
|
4167
4167
|
stringify: stringifyNumber.stringifyNumber
|
|
@@ -4178,7 +4178,7 @@ var require_int = __commonJS({
|
|
|
4178
4178
|
"use strict";
|
|
4179
4179
|
var stringifyNumber = require_stringifyNumber();
|
|
4180
4180
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
4181
|
-
var intResolve = (
|
|
4181
|
+
var intResolve = (str4, offset, radix, { intAsBigInt }) => intAsBigInt ? BigInt(str4) : parseInt(str4.substring(offset), radix);
|
|
4182
4182
|
function intStringify(node, radix, prefix) {
|
|
4183
4183
|
const { value } = node;
|
|
4184
4184
|
if (intIdentify(value) && value >= 0)
|
|
@@ -4191,7 +4191,7 @@ var require_int = __commonJS({
|
|
|
4191
4191
|
tag: "tag:yaml.org,2002:int",
|
|
4192
4192
|
format: "OCT",
|
|
4193
4193
|
test: /^0o[0-7]+$/,
|
|
4194
|
-
resolve: (
|
|
4194
|
+
resolve: (str4, _onError, opt) => intResolve(str4, 2, 8, opt),
|
|
4195
4195
|
stringify: (node) => intStringify(node, 8, "0o")
|
|
4196
4196
|
};
|
|
4197
4197
|
var int = {
|
|
@@ -4199,7 +4199,7 @@ var require_int = __commonJS({
|
|
|
4199
4199
|
default: true,
|
|
4200
4200
|
tag: "tag:yaml.org,2002:int",
|
|
4201
4201
|
test: /^[-+]?[0-9]+$/,
|
|
4202
|
-
resolve: (
|
|
4202
|
+
resolve: (str4, _onError, opt) => intResolve(str4, 0, 10, opt),
|
|
4203
4203
|
stringify: stringifyNumber.stringifyNumber
|
|
4204
4204
|
};
|
|
4205
4205
|
var intHex = {
|
|
@@ -4208,7 +4208,7 @@ var require_int = __commonJS({
|
|
|
4208
4208
|
tag: "tag:yaml.org,2002:int",
|
|
4209
4209
|
format: "HEX",
|
|
4210
4210
|
test: /^0x[0-9a-fA-F]+$/,
|
|
4211
|
-
resolve: (
|
|
4211
|
+
resolve: (str4, _onError, opt) => intResolve(str4, 2, 16, opt),
|
|
4212
4212
|
stringify: (node) => intStringify(node, 16, "0x")
|
|
4213
4213
|
};
|
|
4214
4214
|
exports.int = int;
|
|
@@ -4261,7 +4261,7 @@ var require_schema2 = __commonJS({
|
|
|
4261
4261
|
identify: (value) => typeof value === "string",
|
|
4262
4262
|
default: true,
|
|
4263
4263
|
tag: "tag:yaml.org,2002:str",
|
|
4264
|
-
resolve: (
|
|
4264
|
+
resolve: (str4) => str4,
|
|
4265
4265
|
stringify: stringifyJSON
|
|
4266
4266
|
},
|
|
4267
4267
|
{
|
|
@@ -4278,7 +4278,7 @@ var require_schema2 = __commonJS({
|
|
|
4278
4278
|
default: true,
|
|
4279
4279
|
tag: "tag:yaml.org,2002:bool",
|
|
4280
4280
|
test: /^true$|^false$/,
|
|
4281
|
-
resolve: (
|
|
4281
|
+
resolve: (str4) => str4 === "true",
|
|
4282
4282
|
stringify: stringifyJSON
|
|
4283
4283
|
},
|
|
4284
4284
|
{
|
|
@@ -4286,7 +4286,7 @@ var require_schema2 = __commonJS({
|
|
|
4286
4286
|
default: true,
|
|
4287
4287
|
tag: "tag:yaml.org,2002:int",
|
|
4288
4288
|
test: /^-?(?:0|[1-9][0-9]*)$/,
|
|
4289
|
-
resolve: (
|
|
4289
|
+
resolve: (str4, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str4) : parseInt(str4, 10),
|
|
4290
4290
|
stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)
|
|
4291
4291
|
},
|
|
4292
4292
|
{
|
|
@@ -4294,7 +4294,7 @@ var require_schema2 = __commonJS({
|
|
|
4294
4294
|
default: true,
|
|
4295
4295
|
tag: "tag:yaml.org,2002:float",
|
|
4296
4296
|
test: /^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,
|
|
4297
|
-
resolve: (
|
|
4297
|
+
resolve: (str4) => parseFloat(str4),
|
|
4298
4298
|
stringify: stringifyJSON
|
|
4299
4299
|
}
|
|
4300
4300
|
];
|
|
@@ -4302,9 +4302,9 @@ var require_schema2 = __commonJS({
|
|
|
4302
4302
|
default: true,
|
|
4303
4303
|
tag: "",
|
|
4304
4304
|
test: /^/,
|
|
4305
|
-
resolve(
|
|
4306
|
-
onError(`Unresolved plain scalar ${JSON.stringify(
|
|
4307
|
-
return
|
|
4305
|
+
resolve(str4, onError) {
|
|
4306
|
+
onError(`Unresolved plain scalar ${JSON.stringify(str4)}`);
|
|
4307
|
+
return str4;
|
|
4308
4308
|
}
|
|
4309
4309
|
};
|
|
4310
4310
|
var schema = [map.map, seq.seq].concat(jsonScalars, jsonError);
|
|
@@ -4336,10 +4336,10 @@ var require_binary = __commonJS({
|
|
|
4336
4336
|
if (typeof node_buffer.Buffer === "function") {
|
|
4337
4337
|
return node_buffer.Buffer.from(src, "base64");
|
|
4338
4338
|
} else if (typeof atob === "function") {
|
|
4339
|
-
const
|
|
4340
|
-
const buffer = new Uint8Array(
|
|
4341
|
-
for (let i = 0; i <
|
|
4342
|
-
buffer[i] =
|
|
4339
|
+
const str4 = atob(src.replace(/[\n\r]/g, ""));
|
|
4340
|
+
const buffer = new Uint8Array(str4.length);
|
|
4341
|
+
for (let i = 0; i < str4.length; ++i)
|
|
4342
|
+
buffer[i] = str4.charCodeAt(i);
|
|
4343
4343
|
return buffer;
|
|
4344
4344
|
} else {
|
|
4345
4345
|
onError("This environment does not support reading binary tags; either Buffer or atob is required");
|
|
@@ -4350,28 +4350,28 @@ var require_binary = __commonJS({
|
|
|
4350
4350
|
if (!value)
|
|
4351
4351
|
return "";
|
|
4352
4352
|
const buf = value;
|
|
4353
|
-
let
|
|
4353
|
+
let str4;
|
|
4354
4354
|
if (typeof node_buffer.Buffer === "function") {
|
|
4355
|
-
|
|
4355
|
+
str4 = buf instanceof node_buffer.Buffer ? buf.toString("base64") : node_buffer.Buffer.from(buf.buffer).toString("base64");
|
|
4356
4356
|
} else if (typeof btoa === "function") {
|
|
4357
4357
|
let s = "";
|
|
4358
4358
|
for (let i = 0; i < buf.length; ++i)
|
|
4359
4359
|
s += String.fromCharCode(buf[i]);
|
|
4360
|
-
|
|
4360
|
+
str4 = btoa(s);
|
|
4361
4361
|
} else {
|
|
4362
4362
|
throw new Error("This environment does not support writing binary tags; either Buffer or btoa is required");
|
|
4363
4363
|
}
|
|
4364
4364
|
type ?? (type = Scalar.Scalar.BLOCK_LITERAL);
|
|
4365
4365
|
if (type !== Scalar.Scalar.QUOTE_DOUBLE) {
|
|
4366
4366
|
const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);
|
|
4367
|
-
const n = Math.ceil(
|
|
4367
|
+
const n = Math.ceil(str4.length / lineWidth);
|
|
4368
4368
|
const lines = new Array(n);
|
|
4369
4369
|
for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {
|
|
4370
|
-
lines[i] =
|
|
4370
|
+
lines[i] = str4.substr(o, lineWidth);
|
|
4371
4371
|
}
|
|
4372
|
-
|
|
4372
|
+
str4 = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? "\n" : " ");
|
|
4373
4373
|
}
|
|
4374
|
-
return stringifyString.stringifyString({ comment, type, value:
|
|
4374
|
+
return stringifyString.stringifyString({ comment, type, value: str4 }, ctx, onComment, onChompKeep);
|
|
4375
4375
|
}
|
|
4376
4376
|
};
|
|
4377
4377
|
exports.binary = binary;
|
|
@@ -4577,7 +4577,7 @@ var require_float2 = __commonJS({
|
|
|
4577
4577
|
default: true,
|
|
4578
4578
|
tag: "tag:yaml.org,2002:float",
|
|
4579
4579
|
test: /^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,
|
|
4580
|
-
resolve: (
|
|
4580
|
+
resolve: (str4) => str4.slice(-3).toLowerCase() === "nan" ? NaN : str4[0] === "-" ? Number.NEGATIVE_INFINITY : Number.POSITIVE_INFINITY,
|
|
4581
4581
|
stringify: stringifyNumber.stringifyNumber
|
|
4582
4582
|
};
|
|
4583
4583
|
var floatExp = {
|
|
@@ -4586,7 +4586,7 @@ var require_float2 = __commonJS({
|
|
|
4586
4586
|
tag: "tag:yaml.org,2002:float",
|
|
4587
4587
|
format: "EXP",
|
|
4588
4588
|
test: /^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,
|
|
4589
|
-
resolve: (
|
|
4589
|
+
resolve: (str4) => parseFloat(str4.replace(/_/g, "")),
|
|
4590
4590
|
stringify(node) {
|
|
4591
4591
|
const num = Number(node.value);
|
|
4592
4592
|
return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);
|
|
@@ -4597,11 +4597,11 @@ var require_float2 = __commonJS({
|
|
|
4597
4597
|
default: true,
|
|
4598
4598
|
tag: "tag:yaml.org,2002:float",
|
|
4599
4599
|
test: /^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,
|
|
4600
|
-
resolve(
|
|
4601
|
-
const node = new Scalar.Scalar(parseFloat(
|
|
4602
|
-
const dot =
|
|
4600
|
+
resolve(str4) {
|
|
4601
|
+
const node = new Scalar.Scalar(parseFloat(str4.replace(/_/g, "")));
|
|
4602
|
+
const dot = str4.indexOf(".");
|
|
4603
4603
|
if (dot !== -1) {
|
|
4604
|
-
const f =
|
|
4604
|
+
const f = str4.substring(dot + 1).replace(/_/g, "");
|
|
4605
4605
|
if (f[f.length - 1] === "0")
|
|
4606
4606
|
node.minFractionDigits = f.length;
|
|
4607
4607
|
}
|
|
@@ -4621,34 +4621,34 @@ var require_int2 = __commonJS({
|
|
|
4621
4621
|
"use strict";
|
|
4622
4622
|
var stringifyNumber = require_stringifyNumber();
|
|
4623
4623
|
var intIdentify = (value) => typeof value === "bigint" || Number.isInteger(value);
|
|
4624
|
-
function intResolve(
|
|
4625
|
-
const sign =
|
|
4624
|
+
function intResolve(str4, offset, radix, { intAsBigInt }) {
|
|
4625
|
+
const sign = str4[0];
|
|
4626
4626
|
if (sign === "-" || sign === "+")
|
|
4627
4627
|
offset += 1;
|
|
4628
|
-
|
|
4628
|
+
str4 = str4.substring(offset).replace(/_/g, "");
|
|
4629
4629
|
if (intAsBigInt) {
|
|
4630
4630
|
switch (radix) {
|
|
4631
4631
|
case 2:
|
|
4632
|
-
|
|
4632
|
+
str4 = `0b${str4}`;
|
|
4633
4633
|
break;
|
|
4634
4634
|
case 8:
|
|
4635
|
-
|
|
4635
|
+
str4 = `0o${str4}`;
|
|
4636
4636
|
break;
|
|
4637
4637
|
case 16:
|
|
4638
|
-
|
|
4638
|
+
str4 = `0x${str4}`;
|
|
4639
4639
|
break;
|
|
4640
4640
|
}
|
|
4641
|
-
const n2 = BigInt(
|
|
4641
|
+
const n2 = BigInt(str4);
|
|
4642
4642
|
return sign === "-" ? BigInt(-1) * n2 : n2;
|
|
4643
4643
|
}
|
|
4644
|
-
const n = parseInt(
|
|
4644
|
+
const n = parseInt(str4, radix);
|
|
4645
4645
|
return sign === "-" ? -1 * n : n;
|
|
4646
4646
|
}
|
|
4647
4647
|
function intStringify(node, radix, prefix) {
|
|
4648
4648
|
const { value } = node;
|
|
4649
4649
|
if (intIdentify(value)) {
|
|
4650
|
-
const
|
|
4651
|
-
return value < 0 ? "-" + prefix +
|
|
4650
|
+
const str4 = value.toString(radix);
|
|
4651
|
+
return value < 0 ? "-" + prefix + str4.substr(1) : prefix + str4;
|
|
4652
4652
|
}
|
|
4653
4653
|
return stringifyNumber.stringifyNumber(node);
|
|
4654
4654
|
}
|
|
@@ -4658,7 +4658,7 @@ var require_int2 = __commonJS({
|
|
|
4658
4658
|
tag: "tag:yaml.org,2002:int",
|
|
4659
4659
|
format: "BIN",
|
|
4660
4660
|
test: /^[-+]?0b[0-1_]+$/,
|
|
4661
|
-
resolve: (
|
|
4661
|
+
resolve: (str4, _onError, opt) => intResolve(str4, 2, 2, opt),
|
|
4662
4662
|
stringify: (node) => intStringify(node, 2, "0b")
|
|
4663
4663
|
};
|
|
4664
4664
|
var intOct = {
|
|
@@ -4667,7 +4667,7 @@ var require_int2 = __commonJS({
|
|
|
4667
4667
|
tag: "tag:yaml.org,2002:int",
|
|
4668
4668
|
format: "OCT",
|
|
4669
4669
|
test: /^[-+]?0[0-7_]+$/,
|
|
4670
|
-
resolve: (
|
|
4670
|
+
resolve: (str4, _onError, opt) => intResolve(str4, 1, 8, opt),
|
|
4671
4671
|
stringify: (node) => intStringify(node, 8, "0")
|
|
4672
4672
|
};
|
|
4673
4673
|
var int = {
|
|
@@ -4675,7 +4675,7 @@ var require_int2 = __commonJS({
|
|
|
4675
4675
|
default: true,
|
|
4676
4676
|
tag: "tag:yaml.org,2002:int",
|
|
4677
4677
|
test: /^[-+]?[0-9][0-9_]*$/,
|
|
4678
|
-
resolve: (
|
|
4678
|
+
resolve: (str4, _onError, opt) => intResolve(str4, 0, 10, opt),
|
|
4679
4679
|
stringify: stringifyNumber.stringifyNumber
|
|
4680
4680
|
};
|
|
4681
4681
|
var intHex = {
|
|
@@ -4684,7 +4684,7 @@ var require_int2 = __commonJS({
|
|
|
4684
4684
|
tag: "tag:yaml.org,2002:int",
|
|
4685
4685
|
format: "HEX",
|
|
4686
4686
|
test: /^[-+]?0x[0-9a-fA-F_]+$/,
|
|
4687
|
-
resolve: (
|
|
4687
|
+
resolve: (str4, _onError, opt) => intResolve(str4, 2, 16, opt),
|
|
4688
4688
|
stringify: (node) => intStringify(node, 16, "0x")
|
|
4689
4689
|
};
|
|
4690
4690
|
exports.int = int;
|
|
@@ -4788,9 +4788,9 @@ var require_timestamp = __commonJS({
|
|
|
4788
4788
|
"node_modules/yaml/dist/schema/yaml-1.1/timestamp.js"(exports) {
|
|
4789
4789
|
"use strict";
|
|
4790
4790
|
var stringifyNumber = require_stringifyNumber();
|
|
4791
|
-
function parseSexagesimal(
|
|
4792
|
-
const sign =
|
|
4793
|
-
const parts = sign === "-" || sign === "+" ?
|
|
4791
|
+
function parseSexagesimal(str4, asBigInt) {
|
|
4792
|
+
const sign = str4[0];
|
|
4793
|
+
const parts = sign === "-" || sign === "+" ? str4.substring(1) : str4;
|
|
4794
4794
|
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
4795
4795
|
const res = parts.replace(/_/g, "").split(":").reduce((res2, p) => res2 * num(60) + num(p), num(0));
|
|
4796
4796
|
return sign === "-" ? num(-1) * res : res;
|
|
@@ -4827,7 +4827,7 @@ var require_timestamp = __commonJS({
|
|
|
4827
4827
|
tag: "tag:yaml.org,2002:int",
|
|
4828
4828
|
format: "TIME",
|
|
4829
4829
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,
|
|
4830
|
-
resolve: (
|
|
4830
|
+
resolve: (str4, _onError, { intAsBigInt }) => parseSexagesimal(str4, intAsBigInt),
|
|
4831
4831
|
stringify: stringifySexagesimal
|
|
4832
4832
|
};
|
|
4833
4833
|
var floatTime = {
|
|
@@ -4836,7 +4836,7 @@ var require_timestamp = __commonJS({
|
|
|
4836
4836
|
tag: "tag:yaml.org,2002:float",
|
|
4837
4837
|
format: "TIME",
|
|
4838
4838
|
test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,
|
|
4839
|
-
resolve: (
|
|
4839
|
+
resolve: (str4) => parseSexagesimal(str4, false),
|
|
4840
4840
|
stringify: stringifySexagesimal
|
|
4841
4841
|
};
|
|
4842
4842
|
var timestamp = {
|
|
@@ -4847,8 +4847,8 @@ var require_timestamp = __commonJS({
|
|
|
4847
4847
|
// may be omitted altogether, resulting in a date format. In such a case, the time part is
|
|
4848
4848
|
// assumed to be 00:00:00Z (start of day, UTC).
|
|
4849
4849
|
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})?))?)?$"),
|
|
4850
|
-
resolve(
|
|
4851
|
-
const match =
|
|
4850
|
+
resolve(str4) {
|
|
4851
|
+
const match = str4.match(timestamp.test);
|
|
4852
4852
|
if (!match)
|
|
4853
4853
|
throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");
|
|
4854
4854
|
const [, year, month, day, hour, minute, second] = match.map(Number);
|
|
@@ -5199,9 +5199,9 @@ var require_Document = __commonJS({
|
|
|
5199
5199
|
this.contents.add(value);
|
|
5200
5200
|
}
|
|
5201
5201
|
/** Adds a value to the document. */
|
|
5202
|
-
addIn(
|
|
5202
|
+
addIn(path75, value) {
|
|
5203
5203
|
if (assertCollection(this.contents))
|
|
5204
|
-
this.contents.addIn(
|
|
5204
|
+
this.contents.addIn(path75, value);
|
|
5205
5205
|
}
|
|
5206
5206
|
/**
|
|
5207
5207
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -5276,14 +5276,14 @@ var require_Document = __commonJS({
|
|
|
5276
5276
|
* Removes a value from the document.
|
|
5277
5277
|
* @returns `true` if the item was found and removed.
|
|
5278
5278
|
*/
|
|
5279
|
-
deleteIn(
|
|
5280
|
-
if (Collection.isEmptyPath(
|
|
5279
|
+
deleteIn(path75) {
|
|
5280
|
+
if (Collection.isEmptyPath(path75)) {
|
|
5281
5281
|
if (this.contents == null)
|
|
5282
5282
|
return false;
|
|
5283
5283
|
this.contents = null;
|
|
5284
5284
|
return true;
|
|
5285
5285
|
}
|
|
5286
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
5286
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path75) : false;
|
|
5287
5287
|
}
|
|
5288
5288
|
/**
|
|
5289
5289
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -5298,10 +5298,10 @@ var require_Document = __commonJS({
|
|
|
5298
5298
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5299
5299
|
* `true` (collections are always returned intact).
|
|
5300
5300
|
*/
|
|
5301
|
-
getIn(
|
|
5302
|
-
if (Collection.isEmptyPath(
|
|
5301
|
+
getIn(path75, keepScalar) {
|
|
5302
|
+
if (Collection.isEmptyPath(path75))
|
|
5303
5303
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
5304
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
5304
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path75, keepScalar) : void 0;
|
|
5305
5305
|
}
|
|
5306
5306
|
/**
|
|
5307
5307
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -5312,10 +5312,10 @@ var require_Document = __commonJS({
|
|
|
5312
5312
|
/**
|
|
5313
5313
|
* Checks if the document includes a value at `path`.
|
|
5314
5314
|
*/
|
|
5315
|
-
hasIn(
|
|
5316
|
-
if (Collection.isEmptyPath(
|
|
5315
|
+
hasIn(path75) {
|
|
5316
|
+
if (Collection.isEmptyPath(path75))
|
|
5317
5317
|
return this.contents !== void 0;
|
|
5318
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
5318
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path75) : false;
|
|
5319
5319
|
}
|
|
5320
5320
|
/**
|
|
5321
5321
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -5332,13 +5332,13 @@ var require_Document = __commonJS({
|
|
|
5332
5332
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
5333
5333
|
* boolean to add/remove the item from the set.
|
|
5334
5334
|
*/
|
|
5335
|
-
setIn(
|
|
5336
|
-
if (Collection.isEmptyPath(
|
|
5335
|
+
setIn(path75, value) {
|
|
5336
|
+
if (Collection.isEmptyPath(path75)) {
|
|
5337
5337
|
this.contents = value;
|
|
5338
5338
|
} else if (this.contents == null) {
|
|
5339
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
5339
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path75), value);
|
|
5340
5340
|
} else if (assertCollection(this.contents)) {
|
|
5341
|
-
this.contents.setIn(
|
|
5341
|
+
this.contents.setIn(path75, value);
|
|
5342
5342
|
}
|
|
5343
5343
|
}
|
|
5344
5344
|
/**
|
|
@@ -7298,9 +7298,9 @@ var require_cst_visit = __commonJS({
|
|
|
7298
7298
|
visit.BREAK = BREAK;
|
|
7299
7299
|
visit.SKIP = SKIP;
|
|
7300
7300
|
visit.REMOVE = REMOVE;
|
|
7301
|
-
visit.itemAtPath = (cst,
|
|
7301
|
+
visit.itemAtPath = (cst, path75) => {
|
|
7302
7302
|
let item = cst;
|
|
7303
|
-
for (const [field, index] of
|
|
7303
|
+
for (const [field, index] of path75) {
|
|
7304
7304
|
const tok = item?.[field];
|
|
7305
7305
|
if (tok && "items" in tok) {
|
|
7306
7306
|
item = tok.items[index];
|
|
@@ -7309,23 +7309,23 @@ var require_cst_visit = __commonJS({
|
|
|
7309
7309
|
}
|
|
7310
7310
|
return item;
|
|
7311
7311
|
};
|
|
7312
|
-
visit.parentCollection = (cst,
|
|
7313
|
-
const parent = visit.itemAtPath(cst,
|
|
7314
|
-
const field =
|
|
7312
|
+
visit.parentCollection = (cst, path75) => {
|
|
7313
|
+
const parent = visit.itemAtPath(cst, path75.slice(0, -1));
|
|
7314
|
+
const field = path75[path75.length - 1][0];
|
|
7315
7315
|
const coll = parent?.[field];
|
|
7316
7316
|
if (coll && "items" in coll)
|
|
7317
7317
|
return coll;
|
|
7318
7318
|
throw new Error("Parent collection not found");
|
|
7319
7319
|
};
|
|
7320
|
-
function _visit(
|
|
7321
|
-
let ctrl = visitor(item,
|
|
7320
|
+
function _visit(path75, item, visitor) {
|
|
7321
|
+
let ctrl = visitor(item, path75);
|
|
7322
7322
|
if (typeof ctrl === "symbol")
|
|
7323
7323
|
return ctrl;
|
|
7324
7324
|
for (const field of ["key", "value"]) {
|
|
7325
7325
|
const token = item[field];
|
|
7326
7326
|
if (token && "items" in token) {
|
|
7327
7327
|
for (let i = 0; i < token.items.length; ++i) {
|
|
7328
|
-
const ci = _visit(Object.freeze(
|
|
7328
|
+
const ci = _visit(Object.freeze(path75.concat([[field, i]])), token.items[i], visitor);
|
|
7329
7329
|
if (typeof ci === "number")
|
|
7330
7330
|
i = ci - 1;
|
|
7331
7331
|
else if (ci === BREAK)
|
|
@@ -7336,10 +7336,10 @@ var require_cst_visit = __commonJS({
|
|
|
7336
7336
|
}
|
|
7337
7337
|
}
|
|
7338
7338
|
if (typeof ctrl === "function" && field === "key")
|
|
7339
|
-
ctrl = ctrl(item,
|
|
7339
|
+
ctrl = ctrl(item, path75);
|
|
7340
7340
|
}
|
|
7341
7341
|
}
|
|
7342
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
7342
|
+
return typeof ctrl === "function" ? ctrl(item, path75) : ctrl;
|
|
7343
7343
|
}
|
|
7344
7344
|
exports.visit = visit;
|
|
7345
7345
|
}
|
|
@@ -8641,14 +8641,14 @@ var require_parser = __commonJS({
|
|
|
8641
8641
|
case "scalar":
|
|
8642
8642
|
case "single-quoted-scalar":
|
|
8643
8643
|
case "double-quoted-scalar": {
|
|
8644
|
-
const
|
|
8644
|
+
const fs78 = this.flowScalar(this.type);
|
|
8645
8645
|
if (atNextItem || it.value) {
|
|
8646
|
-
map.items.push({ start, key:
|
|
8646
|
+
map.items.push({ start, key: fs78, sep: [] });
|
|
8647
8647
|
this.onKeyLine = true;
|
|
8648
8648
|
} else if (it.sep) {
|
|
8649
|
-
this.stack.push(
|
|
8649
|
+
this.stack.push(fs78);
|
|
8650
8650
|
} else {
|
|
8651
|
-
Object.assign(it, { key:
|
|
8651
|
+
Object.assign(it, { key: fs78, sep: [] });
|
|
8652
8652
|
this.onKeyLine = true;
|
|
8653
8653
|
}
|
|
8654
8654
|
return;
|
|
@@ -8776,13 +8776,13 @@ var require_parser = __commonJS({
|
|
|
8776
8776
|
case "scalar":
|
|
8777
8777
|
case "single-quoted-scalar":
|
|
8778
8778
|
case "double-quoted-scalar": {
|
|
8779
|
-
const
|
|
8779
|
+
const fs78 = this.flowScalar(this.type);
|
|
8780
8780
|
if (!it || it.value)
|
|
8781
|
-
fc.items.push({ start: [], key:
|
|
8781
|
+
fc.items.push({ start: [], key: fs78, sep: [] });
|
|
8782
8782
|
else if (it.sep)
|
|
8783
|
-
this.stack.push(
|
|
8783
|
+
this.stack.push(fs78);
|
|
8784
8784
|
else
|
|
8785
|
-
Object.assign(it, { key:
|
|
8785
|
+
Object.assign(it, { key: fs78, sep: [] });
|
|
8786
8786
|
return;
|
|
8787
8787
|
}
|
|
8788
8788
|
case "flow-map-end":
|
|
@@ -21670,8 +21670,8 @@ function lockfile_path(env) {
|
|
|
21670
21670
|
}
|
|
21671
21671
|
return write_target("installed.lock", { env: env ?? null });
|
|
21672
21672
|
}
|
|
21673
|
-
function read_lockfile(
|
|
21674
|
-
const target =
|
|
21673
|
+
function read_lockfile(path75) {
|
|
21674
|
+
const target = path75 ?? lockfile_path();
|
|
21675
21675
|
let text;
|
|
21676
21676
|
try {
|
|
21677
21677
|
text = fs31.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -21881,18 +21881,18 @@ function manifest_path(project_root, env) {
|
|
|
21881
21881
|
}
|
|
21882
21882
|
return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
|
|
21883
21883
|
}
|
|
21884
|
-
function read_manifest(
|
|
21884
|
+
function read_manifest(path75) {
|
|
21885
21885
|
let text;
|
|
21886
21886
|
try {
|
|
21887
|
-
text = require_read_text(
|
|
21887
|
+
text = require_read_text(path75);
|
|
21888
21888
|
} catch {
|
|
21889
21889
|
return null;
|
|
21890
21890
|
}
|
|
21891
21891
|
const data = _parse_manual(text);
|
|
21892
21892
|
return _normalise_v2_shape(data);
|
|
21893
21893
|
}
|
|
21894
|
-
function require_read_text(
|
|
21895
|
-
return fs33.readFileSync(
|
|
21894
|
+
function require_read_text(path75) {
|
|
21895
|
+
return fs33.readFileSync(path75, { encoding: "utf-8" });
|
|
21896
21896
|
}
|
|
21897
21897
|
function _normalise_v2_shape(data) {
|
|
21898
21898
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -22073,9 +22073,9 @@ function stable_sort(items, key) {
|
|
|
22073
22073
|
return a.index - b.index;
|
|
22074
22074
|
}).map((entry) => entry.item);
|
|
22075
22075
|
}
|
|
22076
|
-
function write_manifest(
|
|
22076
|
+
function write_manifest(path75, version, tools, options = {}) {
|
|
22077
22077
|
const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
22078
|
-
return write_atomic(
|
|
22078
|
+
return write_atomic(path75, rendered);
|
|
22079
22079
|
}
|
|
22080
22080
|
function upsert_tool(existing, options) {
|
|
22081
22081
|
const {
|
|
@@ -26874,7 +26874,7 @@ ${user_prompt}`;
|
|
|
26874
26874
|
}
|
|
26875
26875
|
};
|
|
26876
26876
|
CLI_CALLS_FILENAME = "cli-calls.json";
|
|
26877
|
-
DEFAULT_CLI_TIMEOUT_SECONDS =
|
|
26877
|
+
DEFAULT_CLI_TIMEOUT_SECONDS = 300;
|
|
26878
26878
|
SubprocessError = class extends Error {
|
|
26879
26879
|
kind;
|
|
26880
26880
|
osName;
|
|
@@ -33315,9 +33315,9 @@ function detectToolPresence(root) {
|
|
|
33315
33315
|
agentsMd: existsSync25(join49(root, "AGENTS.md"))
|
|
33316
33316
|
};
|
|
33317
33317
|
}
|
|
33318
|
-
function isDir3(
|
|
33318
|
+
function isDir3(path75) {
|
|
33319
33319
|
try {
|
|
33320
|
-
return statSync32(
|
|
33320
|
+
return statSync32(path75).isDirectory();
|
|
33321
33321
|
} catch {
|
|
33322
33322
|
return false;
|
|
33323
33323
|
}
|
|
@@ -34987,11 +34987,512 @@ var init_end_review_nudge_hook = __esm({
|
|
|
34987
34987
|
}
|
|
34988
34988
|
});
|
|
34989
34989
|
|
|
34990
|
-
// src/scripts/
|
|
34990
|
+
// src/scripts/_lib/secret_detector.ts
|
|
34991
|
+
var init_secret_detector = __esm({
|
|
34992
|
+
"src/scripts/_lib/secret_detector.ts"() {
|
|
34993
|
+
"use strict";
|
|
34994
|
+
}
|
|
34995
|
+
});
|
|
34996
|
+
|
|
34997
|
+
// src/scripts/_lib/subagent_capsule.ts
|
|
34998
|
+
function isShortLine(value, max) {
|
|
34999
|
+
return typeof value === "string" && value.length > 0 && value.length <= max && !value.includes("\n");
|
|
35000
|
+
}
|
|
35001
|
+
function validateAssumption(input, label = "assumption") {
|
|
35002
|
+
const errors = [];
|
|
35003
|
+
if (typeof input !== "object" || input === null || Array.isArray(input)) {
|
|
35004
|
+
return [`${label} is not an object`];
|
|
35005
|
+
}
|
|
35006
|
+
const a = input;
|
|
35007
|
+
if (!isShortLine(a["statement"], MAX_LINE_CHARS)) {
|
|
35008
|
+
errors.push(`${label}.statement must be a single line of 1\u2013${MAX_LINE_CHARS} chars`);
|
|
35009
|
+
}
|
|
35010
|
+
if (!isShortLine(a["basis"], MAX_REF_CHARS)) {
|
|
35011
|
+
errors.push(`${label}.basis must be a ref token (file:line, id, path, command) of \u2264 ${MAX_REF_CHARS} chars`);
|
|
35012
|
+
}
|
|
35013
|
+
if (typeof a["epistemic_state"] !== "string" || !EPISTEMIC.has(a["epistemic_state"])) {
|
|
35014
|
+
errors.push(`${label}.epistemic_state must be one of ${EPISTEMIC_STATES.join(" | ")}`);
|
|
35015
|
+
}
|
|
35016
|
+
return errors;
|
|
35017
|
+
}
|
|
35018
|
+
var EPISTEMIC_STATES, EPISTEMIC, MAX_REF_CHARS, MAX_LINE_CHARS;
|
|
35019
|
+
var init_subagent_capsule = __esm({
|
|
35020
|
+
"src/scripts/_lib/subagent_capsule.ts"() {
|
|
35021
|
+
"use strict";
|
|
35022
|
+
init_secret_detector();
|
|
35023
|
+
EPISTEMIC_STATES = ["verified", "assumed", "gap"];
|
|
35024
|
+
EPISTEMIC = new Set(EPISTEMIC_STATES);
|
|
35025
|
+
MAX_REF_CHARS = 200;
|
|
35026
|
+
MAX_LINE_CHARS = 240;
|
|
35027
|
+
}
|
|
35028
|
+
});
|
|
35029
|
+
|
|
35030
|
+
// src/scripts/_lib/subagent_response.ts
|
|
35031
|
+
function validateResponse(input) {
|
|
35032
|
+
const errors = [];
|
|
35033
|
+
if (input === null || typeof input !== "object") {
|
|
35034
|
+
return { valid: false, errors: ["response is not an object"] };
|
|
35035
|
+
}
|
|
35036
|
+
const r = input;
|
|
35037
|
+
if (typeof r.summary !== "string") errors.push("summary missing or not a string");
|
|
35038
|
+
if (typeof r.handoff !== "string") errors.push("handoff missing or not a string");
|
|
35039
|
+
if (!CONFIDENCE.has(r.confidence)) errors.push(`confidence must be low|medium|high (got ${String(r.confidence)})`);
|
|
35040
|
+
if (!Array.isArray(r.findings)) errors.push("findings missing or not an array");
|
|
35041
|
+
if (!Array.isArray(r.risks)) errors.push("risks missing or not an array");
|
|
35042
|
+
if (Array.isArray(r.findings)) {
|
|
35043
|
+
for (const [i, f] of r.findings.entries()) {
|
|
35044
|
+
if (!f || typeof f.title !== "string") errors.push(`finding[${i}] missing title`);
|
|
35045
|
+
const refs = f?.evidence_refs;
|
|
35046
|
+
if (refs && refs.some((x) => typeof x !== "string" || x.includes("\n"))) {
|
|
35047
|
+
errors.push(`finding[${i}] evidence_refs must be ref tokens, not bodies`);
|
|
35048
|
+
}
|
|
35049
|
+
}
|
|
35050
|
+
}
|
|
35051
|
+
if (r.assumptions !== void 0) {
|
|
35052
|
+
if (!Array.isArray(r.assumptions)) {
|
|
35053
|
+
errors.push("assumptions must be an array of {statement, basis, epistemic_state}");
|
|
35054
|
+
} else {
|
|
35055
|
+
for (const [i, a] of r.assumptions.entries()) {
|
|
35056
|
+
errors.push(...validateAssumption(a, `assumptions[${i}]`));
|
|
35057
|
+
}
|
|
35058
|
+
}
|
|
35059
|
+
}
|
|
35060
|
+
if (typeof r.summary === "string" && r.summary.length > MAX_SUMMARY_CHARS) {
|
|
35061
|
+
errors.push(`summary is ${r.summary.length} chars (max ${MAX_SUMMARY_CHARS}) \u2014 the envelope carries a bounded summary; the full result belongs on disk (artifact_paths)`);
|
|
35062
|
+
}
|
|
35063
|
+
if (typeof r.handoff === "string" && r.handoff.length > MAX_RESPONSE_LINE_CHARS) {
|
|
35064
|
+
errors.push(`handoff is ${r.handoff.length} chars (max ${MAX_RESPONSE_LINE_CHARS})`);
|
|
35065
|
+
}
|
|
35066
|
+
for (const [key, arr] of [
|
|
35067
|
+
["findings", r.findings],
|
|
35068
|
+
["risks", r.risks],
|
|
35069
|
+
["artifact_paths", r.artifact_paths]
|
|
35070
|
+
]) {
|
|
35071
|
+
if (Array.isArray(arr) && arr.length > MAX_RESPONSE_ENTRIES) {
|
|
35072
|
+
errors.push(`${key} carries ${arr.length} entries (max ${MAX_RESPONSE_ENTRIES}) \u2014 an envelope is a handoff, not a transcript`);
|
|
35073
|
+
}
|
|
35074
|
+
}
|
|
35075
|
+
if (Array.isArray(r.risks)) {
|
|
35076
|
+
for (const [i, risk] of r.risks.entries()) {
|
|
35077
|
+
if (typeof risk === "string" && risk.length > MAX_RESPONSE_LINE_CHARS) {
|
|
35078
|
+
errors.push(`risks[${i}] is ${risk.length} chars (max ${MAX_RESPONSE_LINE_CHARS})`);
|
|
35079
|
+
}
|
|
35080
|
+
}
|
|
35081
|
+
}
|
|
35082
|
+
if (Array.isArray(r.findings)) {
|
|
35083
|
+
for (const [i, f] of r.findings.entries()) {
|
|
35084
|
+
if (f && typeof f.title === "string" && f.title.length > MAX_RESPONSE_LINE_CHARS) {
|
|
35085
|
+
errors.push(`finding[${i}] title is ${f.title.length} chars (max ${MAX_RESPONSE_LINE_CHARS})`);
|
|
35086
|
+
}
|
|
35087
|
+
}
|
|
35088
|
+
}
|
|
35089
|
+
if (r.artifact_paths !== void 0) {
|
|
35090
|
+
if (!Array.isArray(r.artifact_paths)) {
|
|
35091
|
+
errors.push("artifact_paths must be an array of path ref tokens");
|
|
35092
|
+
} else {
|
|
35093
|
+
for (const [i, p] of r.artifact_paths.entries()) {
|
|
35094
|
+
if (typeof p !== "string" || p.includes("\n") || p.length > MAX_ARTIFACT_REF_CHARS) {
|
|
35095
|
+
errors.push(`artifact_paths[${i}] must be a single-line path ref \u2264 ${MAX_ARTIFACT_REF_CHARS} chars`);
|
|
35096
|
+
}
|
|
35097
|
+
}
|
|
35098
|
+
}
|
|
35099
|
+
}
|
|
35100
|
+
try {
|
|
35101
|
+
const serialized = JSON.stringify(input);
|
|
35102
|
+
if (serialized.length > MAX_ENVELOPE_CHARS) {
|
|
35103
|
+
errors.push(`envelope serializes to ${serialized.length} chars (max ${MAX_ENVELOPE_CHARS}) \u2014 move content to disk and reference it via artifact_paths`);
|
|
35104
|
+
}
|
|
35105
|
+
} catch {
|
|
35106
|
+
errors.push("envelope is not JSON-serializable");
|
|
35107
|
+
}
|
|
35108
|
+
return { valid: errors.length === 0, errors };
|
|
35109
|
+
}
|
|
35110
|
+
var MAX_SUMMARY_CHARS, MAX_RESPONSE_LINE_CHARS, MAX_RESPONSE_ENTRIES, MAX_ARTIFACT_REF_CHARS, MAX_ENVELOPE_CHARS, CONFIDENCE;
|
|
35111
|
+
var init_subagent_response = __esm({
|
|
35112
|
+
"src/scripts/_lib/subagent_response.ts"() {
|
|
35113
|
+
"use strict";
|
|
35114
|
+
init_subagent_capsule();
|
|
35115
|
+
MAX_SUMMARY_CHARS = 2e3;
|
|
35116
|
+
MAX_RESPONSE_LINE_CHARS = 240;
|
|
35117
|
+
MAX_RESPONSE_ENTRIES = 40;
|
|
35118
|
+
MAX_ARTIFACT_REF_CHARS = 200;
|
|
35119
|
+
MAX_ENVELOPE_CHARS = 12e3;
|
|
35120
|
+
CONFIDENCE = /* @__PURE__ */ new Set(["low", "medium", "high"]);
|
|
35121
|
+
}
|
|
35122
|
+
});
|
|
35123
|
+
|
|
35124
|
+
// src/scripts/hooks/subagent_ledger_hook.ts
|
|
34991
35125
|
import * as crypto8 from "node:crypto";
|
|
34992
35126
|
import * as fs58 from "node:fs";
|
|
34993
35127
|
import * as path59 from "node:path";
|
|
34994
35128
|
import { fileURLToPath as fileURLToPath35, pathToFileURL as pathToFileURL24 } from "node:url";
|
|
35129
|
+
function isObject2(v) {
|
|
35130
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
35131
|
+
}
|
|
35132
|
+
function refFor(agentId) {
|
|
35133
|
+
return crypto8.createHash("sha256").update(agentId, "utf8").digest("hex").slice(0, 12);
|
|
35134
|
+
}
|
|
35135
|
+
function unwrapPayload(envelope) {
|
|
35136
|
+
const inner = envelope["payload"];
|
|
35137
|
+
return isObject2(inner) ? inner : envelope;
|
|
35138
|
+
}
|
|
35139
|
+
function str2(payload, ...keys) {
|
|
35140
|
+
for (const k of keys) {
|
|
35141
|
+
const v = payload[k];
|
|
35142
|
+
if (typeof v === "string" && v) return v;
|
|
35143
|
+
}
|
|
35144
|
+
return null;
|
|
35145
|
+
}
|
|
35146
|
+
function extractParentId(payload, ownId) {
|
|
35147
|
+
const explicit = str2(payload, "parent_agent_id", "parentAgentId");
|
|
35148
|
+
if (explicit) return explicit;
|
|
35149
|
+
const session = payload["session"];
|
|
35150
|
+
if (isObject2(session)) {
|
|
35151
|
+
const sessionAgent = str2(session, "agent_id", "agentId");
|
|
35152
|
+
if (sessionAgent && sessionAgent !== ownId) return sessionAgent;
|
|
35153
|
+
}
|
|
35154
|
+
return null;
|
|
35155
|
+
}
|
|
35156
|
+
function classifyEnvelope(message) {
|
|
35157
|
+
if (message === null || !message.trim()) return { verdict: "absent", error_count: 0 };
|
|
35158
|
+
const candidates = _jsonObjectCandidates(message);
|
|
35159
|
+
if (candidates.length === 0) return { verdict: "absent", error_count: 0 };
|
|
35160
|
+
let best = null;
|
|
35161
|
+
for (const candidate of candidates) {
|
|
35162
|
+
const result = validateResponse(candidate);
|
|
35163
|
+
if (result.valid) return { verdict: "ok", error_count: 0 };
|
|
35164
|
+
if (best === null) best = { verdict: "fail", error_count: result.errors.length };
|
|
35165
|
+
}
|
|
35166
|
+
return best ?? { verdict: "absent", error_count: 0 };
|
|
35167
|
+
}
|
|
35168
|
+
function _jsonObjectCandidates(message) {
|
|
35169
|
+
const texts = [];
|
|
35170
|
+
for (const match of message.matchAll(/^[ \t]*```[ \t]*(?:json)?[ \t]*\r?\n([\s\S]*?)^[ \t]*```/gm)) {
|
|
35171
|
+
if (match[1]) texts.push(match[1]);
|
|
35172
|
+
}
|
|
35173
|
+
let depth = 0;
|
|
35174
|
+
let start = -1;
|
|
35175
|
+
let inString = false;
|
|
35176
|
+
let escaped = false;
|
|
35177
|
+
for (let i = 0; i < message.length; i++) {
|
|
35178
|
+
const ch = message[i];
|
|
35179
|
+
if (inString) {
|
|
35180
|
+
if (escaped) escaped = false;
|
|
35181
|
+
else if (ch === "\\") escaped = true;
|
|
35182
|
+
else if (ch === '"') inString = false;
|
|
35183
|
+
continue;
|
|
35184
|
+
}
|
|
35185
|
+
if (ch === '"') inString = true;
|
|
35186
|
+
else if (ch === "{") {
|
|
35187
|
+
if (depth === 0) start = i;
|
|
35188
|
+
depth++;
|
|
35189
|
+
} else if (ch === "}") {
|
|
35190
|
+
if (depth > 0) {
|
|
35191
|
+
depth--;
|
|
35192
|
+
if (depth === 0 && start !== -1) {
|
|
35193
|
+
texts.push(message.slice(start, i + 1));
|
|
35194
|
+
start = -1;
|
|
35195
|
+
}
|
|
35196
|
+
}
|
|
35197
|
+
}
|
|
35198
|
+
}
|
|
35199
|
+
const out = [];
|
|
35200
|
+
for (const text of texts) {
|
|
35201
|
+
try {
|
|
35202
|
+
const parsed = JSON.parse(text.trim());
|
|
35203
|
+
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) out.push(parsed);
|
|
35204
|
+
} catch {
|
|
35205
|
+
}
|
|
35206
|
+
}
|
|
35207
|
+
return out;
|
|
35208
|
+
}
|
|
35209
|
+
function openDir(root) {
|
|
35210
|
+
return path59.join(root, LEDGER_DIR, OPEN_SUBDIR);
|
|
35211
|
+
}
|
|
35212
|
+
function openFile(root, ref) {
|
|
35213
|
+
return path59.join(openDir(root), `${ref}.json`);
|
|
35214
|
+
}
|
|
35215
|
+
function _asOpenRecord(value, expectedRef) {
|
|
35216
|
+
if (!isObject2(value)) return null;
|
|
35217
|
+
const ref = value["ref"];
|
|
35218
|
+
if (typeof ref !== "string" || ref !== expectedRef) return null;
|
|
35219
|
+
if (typeof value["started_at"] !== "string") return null;
|
|
35220
|
+
if (typeof value["depth"] !== "number" || !Number.isFinite(value["depth"])) return null;
|
|
35221
|
+
if (typeof value["depth_basis"] !== "string" || !DEPTH_BASES.has(value["depth_basis"])) return null;
|
|
35222
|
+
const agentType = value["agent_type"];
|
|
35223
|
+
const parentRef = value["parent_ref"];
|
|
35224
|
+
const sessionId = value["session_id"];
|
|
35225
|
+
return {
|
|
35226
|
+
ref,
|
|
35227
|
+
agent_type: typeof agentType === "string" ? agentType : null,
|
|
35228
|
+
started_at: value["started_at"],
|
|
35229
|
+
parent_ref: typeof parentRef === "string" ? parentRef : null,
|
|
35230
|
+
depth: value["depth"],
|
|
35231
|
+
depth_basis: value["depth_basis"],
|
|
35232
|
+
session_id: typeof sessionId === "string" ? sessionId : null
|
|
35233
|
+
};
|
|
35234
|
+
}
|
|
35235
|
+
function readOpenRecords(root) {
|
|
35236
|
+
const out = /* @__PURE__ */ new Map();
|
|
35237
|
+
let names;
|
|
35238
|
+
try {
|
|
35239
|
+
names = fs58.readdirSync(openDir(root));
|
|
35240
|
+
} catch {
|
|
35241
|
+
return out;
|
|
35242
|
+
}
|
|
35243
|
+
for (const name of names) {
|
|
35244
|
+
if (!name.endsWith(".json")) continue;
|
|
35245
|
+
const expectedRef = name.slice(0, -".json".length);
|
|
35246
|
+
try {
|
|
35247
|
+
const raw = fs58.readFileSync(path59.join(openDir(root), name), "utf8");
|
|
35248
|
+
const rec = _asOpenRecord(JSON.parse(raw), expectedRef);
|
|
35249
|
+
if (rec) out.set(rec.ref, rec);
|
|
35250
|
+
} catch {
|
|
35251
|
+
}
|
|
35252
|
+
}
|
|
35253
|
+
return out;
|
|
35254
|
+
}
|
|
35255
|
+
function resolveDepth(parentRef, open) {
|
|
35256
|
+
if (parentRef === null) return { depth: 1, depth_basis: "assumed-root" };
|
|
35257
|
+
const parent = open.get(parentRef);
|
|
35258
|
+
if (!parent) return { depth: 2, depth_basis: "asserted-parent" };
|
|
35259
|
+
return { depth: parent.depth + 1, depth_basis: "observed" };
|
|
35260
|
+
}
|
|
35261
|
+
function ledgerFileFor(root, ts) {
|
|
35262
|
+
return path59.join(root, LEDGER_DIR, `${ts.slice(0, 7)}.jsonl`);
|
|
35263
|
+
}
|
|
35264
|
+
function appendLedgerLine(root, ts, line) {
|
|
35265
|
+
if (is_replay_mode()) return;
|
|
35266
|
+
const file = ledgerFileFor(root, ts);
|
|
35267
|
+
fs58.mkdirSync(path59.dirname(file), { recursive: true });
|
|
35268
|
+
fs58.appendFileSync(file, `${JSON.stringify(line)}
|
|
35269
|
+
`, "utf8");
|
|
35270
|
+
}
|
|
35271
|
+
function armsExceeded(elapsedMs) {
|
|
35272
|
+
if (elapsedMs === null || !Number.isFinite(elapsedMs)) return [];
|
|
35273
|
+
return WALL_CLOCK_ARMS_MS.filter((a) => elapsedMs >= a.ms).map((a) => a.label);
|
|
35274
|
+
}
|
|
35275
|
+
function openRecordStats(root, nowMs = Date.now()) {
|
|
35276
|
+
const ledgerPresent = fs58.existsSync(path59.join(root, LEDGER_DIR));
|
|
35277
|
+
const open = readOpenRecords(root);
|
|
35278
|
+
let maxDepth = 0;
|
|
35279
|
+
let counted = 0;
|
|
35280
|
+
let stale = 0;
|
|
35281
|
+
for (const rec of open.values()) {
|
|
35282
|
+
const started = Date.parse(rec.started_at);
|
|
35283
|
+
const isStale2 = Number.isFinite(started) && nowMs - started >= OPEN_RECORD_TTL_MS;
|
|
35284
|
+
if (isStale2) {
|
|
35285
|
+
stale++;
|
|
35286
|
+
continue;
|
|
35287
|
+
}
|
|
35288
|
+
counted++;
|
|
35289
|
+
if (rec.depth > maxDepth) maxDepth = rec.depth;
|
|
35290
|
+
}
|
|
35291
|
+
return {
|
|
35292
|
+
open_count: counted,
|
|
35293
|
+
max_depth: maxDepth,
|
|
35294
|
+
stale_excluded: stale,
|
|
35295
|
+
ledger_present: ledgerPresent
|
|
35296
|
+
};
|
|
35297
|
+
}
|
|
35298
|
+
function writeOpenRecord(root, rec) {
|
|
35299
|
+
atomic_write_json(openFile(root, rec.ref), rec);
|
|
35300
|
+
}
|
|
35301
|
+
function removeOpenRecord(root, ref) {
|
|
35302
|
+
if (is_replay_mode()) return;
|
|
35303
|
+
try {
|
|
35304
|
+
fs58.unlinkSync(openFile(root, ref));
|
|
35305
|
+
} catch {
|
|
35306
|
+
}
|
|
35307
|
+
}
|
|
35308
|
+
function countOpen(root) {
|
|
35309
|
+
try {
|
|
35310
|
+
return fs58.readdirSync(openDir(root)).filter((n) => n.endsWith(".json")).length;
|
|
35311
|
+
} catch {
|
|
35312
|
+
return 0;
|
|
35313
|
+
}
|
|
35314
|
+
}
|
|
35315
|
+
function reapStaleOpenRecords(root, nowIso) {
|
|
35316
|
+
const now = Date.parse(nowIso);
|
|
35317
|
+
if (!Number.isFinite(now)) return 0;
|
|
35318
|
+
let reaped = 0;
|
|
35319
|
+
for (const rec of readOpenRecords(root).values()) {
|
|
35320
|
+
const started = Date.parse(rec.started_at);
|
|
35321
|
+
if (!Number.isFinite(started) || now - started < OPEN_RECORD_TTL_MS) continue;
|
|
35322
|
+
removeOpenRecord(root, rec.ref);
|
|
35323
|
+
reaped++;
|
|
35324
|
+
appendLedgerLine(root, nowIso, {
|
|
35325
|
+
event: "subagent_reaped",
|
|
35326
|
+
ts: nowIso,
|
|
35327
|
+
ref: rec.ref,
|
|
35328
|
+
agent_type: rec.agent_type,
|
|
35329
|
+
depth: rec.depth,
|
|
35330
|
+
depth_basis: rec.depth_basis,
|
|
35331
|
+
// R2 round 2, finding 5: the arm list is NOT repeated here. A reap
|
|
35332
|
+
// fires only past OPEN_RECORD_TTL_MS (24 h), which exceeds every
|
|
35333
|
+
// arm (largest: 2 h), so `stop_loss_arms_exceeded` would be a
|
|
35334
|
+
// constant on this line — a field that cannot vary answers no
|
|
35335
|
+
// question. `age_ms` carries strictly more information and is what
|
|
35336
|
+
// a reader should aggregate over.
|
|
35337
|
+
age_ms: now - started,
|
|
35338
|
+
reason: "open record exceeded OPEN_RECORD_TTL_MS without a stop"
|
|
35339
|
+
});
|
|
35340
|
+
}
|
|
35341
|
+
return reaped;
|
|
35342
|
+
}
|
|
35343
|
+
function appendUnidentified(root, event, nowIso, payload) {
|
|
35344
|
+
appendLedgerLine(root, nowIso, {
|
|
35345
|
+
event,
|
|
35346
|
+
ts: nowIso,
|
|
35347
|
+
ref: null,
|
|
35348
|
+
unidentified: true,
|
|
35349
|
+
// The agent TYPE is an id-shaped enum and may still be present; it is
|
|
35350
|
+
// the only thing salvageable from a payload with no id.
|
|
35351
|
+
agent_type: str2(payload, "agent_type", "agentType", "subagent_type", "subagentType"),
|
|
35352
|
+
reason: "payload carried no agent id \u2014 nothing to correlate start with stop"
|
|
35353
|
+
});
|
|
35354
|
+
}
|
|
35355
|
+
function handleStart(root, payload, nowIso, sessionId) {
|
|
35356
|
+
const agentId = str2(payload, "agent_id", "agentId");
|
|
35357
|
+
if (agentId === null) {
|
|
35358
|
+
appendUnidentified(root, "subagent_start", nowIso, payload);
|
|
35359
|
+
return;
|
|
35360
|
+
}
|
|
35361
|
+
const ref = refFor(agentId);
|
|
35362
|
+
const parentId = extractParentId(payload, agentId);
|
|
35363
|
+
const parentRef = parentId ? refFor(parentId) : null;
|
|
35364
|
+
const { depth, depth_basis } = resolveDepth(parentRef, readOpenRecords(root));
|
|
35365
|
+
const rec = {
|
|
35366
|
+
ref,
|
|
35367
|
+
agent_type: str2(payload, "agent_type", "agentType", "subagent_type", "subagentType"),
|
|
35368
|
+
started_at: nowIso,
|
|
35369
|
+
parent_ref: parentRef,
|
|
35370
|
+
depth,
|
|
35371
|
+
depth_basis,
|
|
35372
|
+
session_id: sessionId
|
|
35373
|
+
};
|
|
35374
|
+
writeOpenRecord(root, rec);
|
|
35375
|
+
appendLedgerLine(root, nowIso, {
|
|
35376
|
+
event: "subagent_start",
|
|
35377
|
+
ts: nowIso,
|
|
35378
|
+
ref,
|
|
35379
|
+
agent_type: rec.agent_type,
|
|
35380
|
+
parent_ref: parentRef,
|
|
35381
|
+
depth,
|
|
35382
|
+
depth_basis,
|
|
35383
|
+
concurrent_open: countOpen(root)
|
|
35384
|
+
});
|
|
35385
|
+
}
|
|
35386
|
+
function handleStop(root, payload, nowIso) {
|
|
35387
|
+
const agentId = str2(payload, "agent_id", "agentId");
|
|
35388
|
+
if (agentId === null) {
|
|
35389
|
+
appendUnidentified(root, "subagent_stop", nowIso, payload);
|
|
35390
|
+
return;
|
|
35391
|
+
}
|
|
35392
|
+
const ref = refFor(agentId);
|
|
35393
|
+
const rec = readOpenRecords(root).get(ref) ?? null;
|
|
35394
|
+
let durationMs = null;
|
|
35395
|
+
if (rec) {
|
|
35396
|
+
const started = Date.parse(rec.started_at);
|
|
35397
|
+
if (Number.isFinite(started)) durationMs = Math.max(0, Date.parse(nowIso) - started);
|
|
35398
|
+
}
|
|
35399
|
+
const parse6 = classifyEnvelope(str2(payload, "last_assistant_message", "lastAssistantMessage"));
|
|
35400
|
+
removeOpenRecord(root, ref);
|
|
35401
|
+
appendLedgerLine(root, nowIso, {
|
|
35402
|
+
event: "subagent_stop",
|
|
35403
|
+
ts: nowIso,
|
|
35404
|
+
ref,
|
|
35405
|
+
agent_type: rec?.agent_type ?? str2(payload, "agent_type", "agentType", "subagent_type", "subagentType"),
|
|
35406
|
+
depth: rec?.depth ?? null,
|
|
35407
|
+
depth_basis: rec?.depth_basis ?? null,
|
|
35408
|
+
// `null` = the matching start was never seen. That is a finding about
|
|
35409
|
+
// the instrument's own coverage and is recorded as such, not as 0.
|
|
35410
|
+
duration_ms: durationMs,
|
|
35411
|
+
// Phase 3 Step 3, shadow: which wall-clock arms this dispatch would
|
|
35412
|
+
// have tripped. Recorded, never acted on.
|
|
35413
|
+
stop_loss_arms_exceeded: armsExceeded(durationMs),
|
|
35414
|
+
start_seen: rec !== null,
|
|
35415
|
+
envelope_parse: parse6.verdict,
|
|
35416
|
+
envelope_error_count: parse6.error_count,
|
|
35417
|
+
concurrent_open: countOpen(root)
|
|
35418
|
+
});
|
|
35419
|
+
}
|
|
35420
|
+
function processEnvelope(envelope, consumerRoot) {
|
|
35421
|
+
try {
|
|
35422
|
+
if (!isObject2(envelope)) return EXIT_ALLOW4;
|
|
35423
|
+
const event = envelope["event"];
|
|
35424
|
+
if (event !== "subagent_start" && event !== "subagent_stop") return EXIT_ALLOW4;
|
|
35425
|
+
const payload = unwrapPayload(envelope);
|
|
35426
|
+
const nowIso = (/* @__PURE__ */ new Date()).toISOString();
|
|
35427
|
+
const sessionId = str2(payload, "session_id", "sessionId") ?? str2(envelope, "session_id", "sessionId");
|
|
35428
|
+
reapStaleOpenRecords(consumerRoot, nowIso);
|
|
35429
|
+
if (event === "subagent_start") handleStart(consumerRoot, payload, nowIso, sessionId);
|
|
35430
|
+
else handleStop(consumerRoot, payload, nowIso);
|
|
35431
|
+
} catch {
|
|
35432
|
+
return EXIT_ALLOW4;
|
|
35433
|
+
}
|
|
35434
|
+
return EXIT_ALLOW4;
|
|
35435
|
+
}
|
|
35436
|
+
function resolveConsumerRoot(envelope) {
|
|
35437
|
+
if (isObject2(envelope)) {
|
|
35438
|
+
const pr = str2(envelope, "workspace_root", "project_root");
|
|
35439
|
+
if (pr) return pr;
|
|
35440
|
+
const payload = unwrapPayload(envelope);
|
|
35441
|
+
const cwd = str2(payload, "cwd");
|
|
35442
|
+
if (cwd) return cwd;
|
|
35443
|
+
}
|
|
35444
|
+
return process.cwd();
|
|
35445
|
+
}
|
|
35446
|
+
function main24() {
|
|
35447
|
+
const raw = readHookStdin();
|
|
35448
|
+
let envelope = {};
|
|
35449
|
+
try {
|
|
35450
|
+
envelope = raw.trim() ? JSON.parse(raw) : {};
|
|
35451
|
+
} catch {
|
|
35452
|
+
return EXIT_ALLOW4;
|
|
35453
|
+
}
|
|
35454
|
+
return processEnvelope(envelope, resolveConsumerRoot(envelope));
|
|
35455
|
+
}
|
|
35456
|
+
function _isCliEntry22() {
|
|
35457
|
+
if (true) {
|
|
35458
|
+
return false;
|
|
35459
|
+
}
|
|
35460
|
+
if (process.argv[1] === void 0) return false;
|
|
35461
|
+
const argvUrl = pathToFileURL24(path59.resolve(process.argv[1])).href;
|
|
35462
|
+
if (import.meta.url === argvUrl) return true;
|
|
35463
|
+
try {
|
|
35464
|
+
return fs58.realpathSync(fileURLToPath35(import.meta.url)) === fs58.realpathSync(path59.resolve(process.argv[1]));
|
|
35465
|
+
} catch {
|
|
35466
|
+
return false;
|
|
35467
|
+
}
|
|
35468
|
+
}
|
|
35469
|
+
var EXIT_ALLOW4, LEDGER_DIR, OPEN_SUBDIR, OPEN_RECORD_TTL_MS, DEPTH_BASES, WALL_CLOCK_ARMS_MS;
|
|
35470
|
+
var init_subagent_ledger_hook = __esm({
|
|
35471
|
+
"src/scripts/hooks/subagent_ledger_hook.ts"() {
|
|
35472
|
+
"use strict";
|
|
35473
|
+
init_subagent_response();
|
|
35474
|
+
init_state_io();
|
|
35475
|
+
init_hook_stdin();
|
|
35476
|
+
EXIT_ALLOW4 = 0;
|
|
35477
|
+
LEDGER_DIR = path59.join("agents", "runtime", "state", "subagent-ledger");
|
|
35478
|
+
OPEN_SUBDIR = "open";
|
|
35479
|
+
OPEN_RECORD_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
35480
|
+
DEPTH_BASES = /* @__PURE__ */ new Set(["observed", "asserted-parent", "assumed-root"]);
|
|
35481
|
+
WALL_CLOCK_ARMS_MS = [
|
|
35482
|
+
{ label: "5m", ms: 5 * 60 * 1e3 },
|
|
35483
|
+
{ label: "15m", ms: 15 * 60 * 1e3 },
|
|
35484
|
+
{ label: "30m", ms: 30 * 60 * 1e3 },
|
|
35485
|
+
{ label: "2h", ms: 2 * 60 * 60 * 1e3 }
|
|
35486
|
+
];
|
|
35487
|
+
if (_isCliEntry22()) process.exit(main24());
|
|
35488
|
+
}
|
|
35489
|
+
});
|
|
35490
|
+
|
|
35491
|
+
// src/scripts/hooks/turn_end_gate_hook.ts
|
|
35492
|
+
import * as crypto9 from "node:crypto";
|
|
35493
|
+
import * as fs59 from "node:fs";
|
|
35494
|
+
import * as path60 from "node:path";
|
|
35495
|
+
import { fileURLToPath as fileURLToPath36, pathToFileURL as pathToFileURL25 } from "node:url";
|
|
34995
35496
|
function stripFencedBlocks(text) {
|
|
34996
35497
|
const out = [];
|
|
34997
35498
|
let open = null;
|
|
@@ -35047,7 +35548,7 @@ function detectPromissory(reply) {
|
|
|
35047
35548
|
}
|
|
35048
35549
|
function readCiSettled(workspaceRoot) {
|
|
35049
35550
|
try {
|
|
35050
|
-
const raw =
|
|
35551
|
+
const raw = fs59.readFileSync(path60.join(workspaceRoot, STATE_FILE3), "utf-8");
|
|
35051
35552
|
const decoded = JSON.parse(raw);
|
|
35052
35553
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
35053
35554
|
const ci = decoded["ci_last"];
|
|
@@ -35079,7 +35580,7 @@ function detectCompletionClaim(reply, ci) {
|
|
|
35079
35580
|
}
|
|
35080
35581
|
function readLanguagePin(workspaceRoot) {
|
|
35081
35582
|
try {
|
|
35082
|
-
const raw =
|
|
35583
|
+
const raw = fs59.readFileSync(path60.join(workspaceRoot, STATE_FILE), "utf-8");
|
|
35083
35584
|
const decoded = JSON.parse(raw);
|
|
35084
35585
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
35085
35586
|
const lang = decoded["language"];
|
|
@@ -35126,17 +35627,17 @@ function detectUnverifiedEdit(toolCalls) {
|
|
|
35126
35627
|
};
|
|
35127
35628
|
}
|
|
35128
35629
|
function stateDir(workspaceRoot) {
|
|
35129
|
-
return
|
|
35630
|
+
return path60.join(workspaceRoot, "agents", "runtime", "state", "turn-end-gate");
|
|
35130
35631
|
}
|
|
35131
35632
|
function sessionStateFile2(workspaceRoot, sessionKey) {
|
|
35132
|
-
return
|
|
35633
|
+
return path60.join(stateDir(workspaceRoot), `${sessionKey}.json`);
|
|
35133
35634
|
}
|
|
35134
35635
|
function deriveSessionKey2(sessionId) {
|
|
35135
|
-
return
|
|
35636
|
+
return crypto9.createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
35136
35637
|
}
|
|
35137
35638
|
function alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal) {
|
|
35138
35639
|
try {
|
|
35139
|
-
const raw =
|
|
35640
|
+
const raw = fs59.readFileSync(sessionStateFile2(workspaceRoot, sessionKey), "utf-8");
|
|
35140
35641
|
const decoded = JSON.parse(raw);
|
|
35141
35642
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
35142
35643
|
return decoded["refused_turn"] === turnOrdinal;
|
|
@@ -35161,10 +35662,10 @@ function readTranscriptTail(transcriptPath, opts = {}) {
|
|
|
35161
35662
|
if (!transcriptPath || !isSafeTranscriptPath(transcriptPath, opts)) return empty;
|
|
35162
35663
|
let lines;
|
|
35163
35664
|
try {
|
|
35164
|
-
if (opts.maxBytes !== void 0 &&
|
|
35665
|
+
if (opts.maxBytes !== void 0 && fs59.statSync(transcriptPath).size > opts.maxBytes) {
|
|
35165
35666
|
return empty;
|
|
35166
35667
|
}
|
|
35167
|
-
lines =
|
|
35668
|
+
lines = fs59.readFileSync(transcriptPath, "utf-8").split("\n");
|
|
35168
35669
|
} catch {
|
|
35169
35670
|
return empty;
|
|
35170
35671
|
}
|
|
@@ -35237,33 +35738,41 @@ function _messageText(content) {
|
|
|
35237
35738
|
}
|
|
35238
35739
|
return parts.length > 0 ? parts.join("\n") : null;
|
|
35239
35740
|
}
|
|
35240
|
-
function
|
|
35741
|
+
function str3(v) {
|
|
35241
35742
|
return typeof v === "string" ? v : "";
|
|
35242
35743
|
}
|
|
35243
|
-
function
|
|
35744
|
+
function main25() {
|
|
35244
35745
|
let envelope;
|
|
35245
35746
|
let payload;
|
|
35246
35747
|
try {
|
|
35247
35748
|
[envelope, payload] = unwrap(readHookStdin(), "claude");
|
|
35248
35749
|
} catch {
|
|
35249
|
-
return
|
|
35750
|
+
return EXIT_ALLOW5;
|
|
35250
35751
|
}
|
|
35251
|
-
if (payload["stop_hook_active"] === true) return
|
|
35252
|
-
const workspaceRoot =
|
|
35253
|
-
|
|
35752
|
+
if (payload["stop_hook_active"] === true) return EXIT_ALLOW5;
|
|
35753
|
+
const workspaceRoot = str3(envelope["workspace_root"]) || process.cwd();
|
|
35754
|
+
let dispatchOpen = false;
|
|
35755
|
+
try {
|
|
35756
|
+
dispatchOpen = openRecordStats(workspaceRoot).open_count > 0;
|
|
35757
|
+
} catch {
|
|
35758
|
+
}
|
|
35759
|
+
const transcriptPath = str3(
|
|
35254
35760
|
payload["transcript_path"] ?? payload["transcriptPath"]
|
|
35255
35761
|
);
|
|
35256
35762
|
const { lastAssistant, turnOrdinal, toolCalls } = readTranscriptTail(transcriptPath, {
|
|
35257
35763
|
maxBytes: TRANSCRIPT_READ_MAX_BYTES
|
|
35258
35764
|
});
|
|
35259
|
-
if (!lastAssistant) return
|
|
35765
|
+
if (!lastAssistant) return EXIT_ALLOW5;
|
|
35260
35766
|
const sessionKey = deriveSessionKey2(
|
|
35261
|
-
|
|
35767
|
+
str3(envelope["session_id"]) || "unknown-session"
|
|
35262
35768
|
);
|
|
35263
|
-
if (alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal)) return
|
|
35769
|
+
if (alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal)) return EXIT_ALLOW5;
|
|
35264
35770
|
const findings = [];
|
|
35265
35771
|
for (const f of [
|
|
35266
|
-
|
|
35772
|
+
// A and D are the completion-adjacent pair a pending dispatch excuses
|
|
35773
|
+
// (Phase 3 Step 2, narrowed by R2 round 2 finding 2). B and C are not
|
|
35774
|
+
// excused by anything about a dispatch and run unchanged.
|
|
35775
|
+
dispatchOpen ? null : detectPromissory(lastAssistant),
|
|
35267
35776
|
detectLanguage(lastAssistant, readLanguagePin(workspaceRoot)),
|
|
35268
35777
|
detectUnverifiedEdit(toolCalls),
|
|
35269
35778
|
// Round 7 § Phase 1 — detector D, in the same unconditional list as the
|
|
@@ -35273,11 +35782,11 @@ function main24() {
|
|
|
35273
35782
|
// gating is where the comment above says gating belongs — inside the
|
|
35274
35783
|
// detector: no CI observed, or a settled read, or no completion claim
|
|
35275
35784
|
// ⇒ no finding.
|
|
35276
|
-
detectCompletionClaim(lastAssistant, readCiSettled(workspaceRoot))
|
|
35785
|
+
dispatchOpen ? null : detectCompletionClaim(lastAssistant, readCiSettled(workspaceRoot))
|
|
35277
35786
|
]) {
|
|
35278
35787
|
if (f) findings.push(f);
|
|
35279
35788
|
}
|
|
35280
|
-
if (findings.length === 0) return
|
|
35789
|
+
if (findings.length === 0) return EXIT_ALLOW5;
|
|
35281
35790
|
markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, findings[0].detector);
|
|
35282
35791
|
const lines = findings.map(
|
|
35283
35792
|
(f) => ` \xB7 ${f.detector}: ${f.reason}
|
|
@@ -35292,26 +35801,26 @@ ${lines.join("\n")}
|
|
|
35292
35801
|
);
|
|
35293
35802
|
return EXIT_BLOCK2;
|
|
35294
35803
|
}
|
|
35295
|
-
function
|
|
35804
|
+
function _isCliEntry23() {
|
|
35296
35805
|
if (true) {
|
|
35297
35806
|
return false;
|
|
35298
35807
|
}
|
|
35299
35808
|
if (process.argv[1] === void 0) {
|
|
35300
35809
|
return false;
|
|
35301
35810
|
}
|
|
35302
|
-
const argvUrl =
|
|
35811
|
+
const argvUrl = pathToFileURL25(path60.resolve(process.argv[1])).href;
|
|
35303
35812
|
if (import.meta.url === argvUrl) {
|
|
35304
35813
|
return true;
|
|
35305
35814
|
}
|
|
35306
35815
|
try {
|
|
35307
|
-
const here =
|
|
35308
|
-
const argv =
|
|
35816
|
+
const here = fs59.realpathSync(fileURLToPath36(import.meta.url));
|
|
35817
|
+
const argv = fs59.realpathSync(path60.resolve(process.argv[1]));
|
|
35309
35818
|
return here === argv;
|
|
35310
35819
|
} catch {
|
|
35311
35820
|
return false;
|
|
35312
35821
|
}
|
|
35313
35822
|
}
|
|
35314
|
-
var EXIT_BLOCK2,
|
|
35823
|
+
var EXIT_BLOCK2, EXIT_ALLOW5, TRANSCRIPT_READ_MAX_BYTES, PROMISSORY, HANDBACK, _COMPLETION_RE, _NEGATED_CLAIM_RE, _EDIT_TOOLS, _VERIFY_RE;
|
|
35315
35824
|
var init_turn_end_gate_hook = __esm({
|
|
35316
35825
|
"src/scripts/hooks/turn_end_gate_hook.ts"() {
|
|
35317
35826
|
"use strict";
|
|
@@ -35321,8 +35830,9 @@ var init_turn_end_gate_hook = __esm({
|
|
|
35321
35830
|
init_envelope();
|
|
35322
35831
|
init_hook_stdin();
|
|
35323
35832
|
init_state_io();
|
|
35833
|
+
init_subagent_ledger_hook();
|
|
35324
35834
|
EXIT_BLOCK2 = 1;
|
|
35325
|
-
|
|
35835
|
+
EXIT_ALLOW5 = 0;
|
|
35326
35836
|
TRANSCRIPT_READ_MAX_BYTES = 8 * 1024 * 1024;
|
|
35327
35837
|
PROMISSORY = [
|
|
35328
35838
|
/\bich melde mich\b/i,
|
|
@@ -35375,17 +35885,17 @@ var init_turn_end_gate_hook = __esm({
|
|
|
35375
35885
|
_NEGATED_CLAIM_RE = /\b(noch nicht|nicht fertig|nicht durch|wäre verfrüht|ist verfrüht|not yet|not done|isn'?t done|nein)\b/i;
|
|
35376
35886
|
_EDIT_TOOLS = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
|
|
35377
35887
|
_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;
|
|
35378
|
-
if (
|
|
35379
|
-
process.exit(
|
|
35888
|
+
if (_isCliEntry23()) {
|
|
35889
|
+
process.exit(main25());
|
|
35380
35890
|
}
|
|
35381
35891
|
}
|
|
35382
35892
|
});
|
|
35383
35893
|
|
|
35384
35894
|
// src/scripts/hooks/evidence_independence.ts
|
|
35385
|
-
import
|
|
35386
|
-
import
|
|
35387
|
-
import
|
|
35388
|
-
import { fileURLToPath as
|
|
35895
|
+
import crypto10 from "node:crypto";
|
|
35896
|
+
import fs60 from "node:fs";
|
|
35897
|
+
import path61 from "node:path";
|
|
35898
|
+
import { fileURLToPath as fileURLToPath37, pathToFileURL as pathToFileURL26 } from "node:url";
|
|
35389
35899
|
function _isObject6(v) {
|
|
35390
35900
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
35391
35901
|
}
|
|
@@ -35422,8 +35932,8 @@ function extractDispatch(envelope) {
|
|
|
35422
35932
|
}
|
|
35423
35933
|
function _ledgerStamp(consumer_root) {
|
|
35424
35934
|
try {
|
|
35425
|
-
const raw =
|
|
35426
|
-
|
|
35935
|
+
const raw = fs60.readFileSync(
|
|
35936
|
+
path61.join(consumer_root, "agents", "state", "git-authorization.json"),
|
|
35427
35937
|
"utf8"
|
|
35428
35938
|
);
|
|
35429
35939
|
const d = JSON.parse(raw);
|
|
@@ -35434,7 +35944,7 @@ function _ledgerStamp(consumer_root) {
|
|
|
35434
35944
|
}
|
|
35435
35945
|
function _load2(target) {
|
|
35436
35946
|
try {
|
|
35437
|
-
const decoded = JSON.parse(
|
|
35947
|
+
const decoded = JSON.parse(fs60.readFileSync(target, "utf8"));
|
|
35438
35948
|
if (_isObject6(decoded) && Array.isArray(decoded["evaluations"])) {
|
|
35439
35949
|
return decoded;
|
|
35440
35950
|
}
|
|
@@ -35444,7 +35954,7 @@ function _load2(target) {
|
|
|
35444
35954
|
}
|
|
35445
35955
|
function decide2(tool, prompt, priorEvaluations) {
|
|
35446
35956
|
if (!isDispatchTool(tool) || !isEvaluationPrompt(prompt)) {
|
|
35447
|
-
return { exit:
|
|
35957
|
+
return { exit: EXIT_ALLOW6, stdout: "", stderr: "", evaluations: priorEvaluations };
|
|
35448
35958
|
}
|
|
35449
35959
|
const preloaded = preloadedVerdict(prompt);
|
|
35450
35960
|
if (preloaded !== null) {
|
|
@@ -35457,11 +35967,11 @@ function decide2(tool, prompt, priorEvaluations) {
|
|
|
35457
35967
|
};
|
|
35458
35968
|
}
|
|
35459
35969
|
if (!isSelfScoped(prompt)) {
|
|
35460
|
-
return { exit:
|
|
35970
|
+
return { exit: EXIT_ALLOW6, stdout: "", stderr: "", evaluations: priorEvaluations };
|
|
35461
35971
|
}
|
|
35462
35972
|
if (priorEvaluations >= 1) {
|
|
35463
35973
|
return {
|
|
35464
|
-
exit:
|
|
35974
|
+
exit: EXIT_ALLOW6,
|
|
35465
35975
|
stdout: `${JSON.stringify({
|
|
35466
35976
|
decision: "warn",
|
|
35467
35977
|
reason: `Second evaluation dispatch of your own work in this turn. If both passes judge the SAME subject, that is verdict shopping \u2014 commissioning another with a different prompt or scope selects the answer instead of measuring it. Report what the first pass returned, then re-plan. If this is an implementation fan-out rather than a second review, carry on: this check reads prose and cannot tell the two apart with certainty.`
|
|
@@ -35472,7 +35982,7 @@ function decide2(tool, prompt, priorEvaluations) {
|
|
|
35472
35982
|
};
|
|
35473
35983
|
}
|
|
35474
35984
|
return {
|
|
35475
|
-
exit:
|
|
35985
|
+
exit: EXIT_ALLOW6,
|
|
35476
35986
|
stdout: `${JSON.stringify({ decision: "warn", reason: WARN_TEXT })}
|
|
35477
35987
|
`,
|
|
35478
35988
|
stderr: "",
|
|
@@ -35488,10 +35998,10 @@ function run5(stdin_text, options) {
|
|
|
35488
35998
|
envelope = decoded;
|
|
35489
35999
|
}
|
|
35490
36000
|
} catch {
|
|
35491
|
-
return
|
|
36001
|
+
return EXIT_ALLOW6;
|
|
35492
36002
|
}
|
|
35493
36003
|
}
|
|
35494
|
-
const target =
|
|
36004
|
+
const target = path61.join(options.consumer_root, STATE_FILE4);
|
|
35495
36005
|
const state = _load2(target);
|
|
35496
36006
|
const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
|
|
35497
36007
|
const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root)}`;
|
|
@@ -35505,7 +36015,7 @@ function run5(stdin_text, options) {
|
|
|
35505
36015
|
if (decision.evaluations > state.evaluations.length) {
|
|
35506
36016
|
state.evaluations.push({
|
|
35507
36017
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
35508
|
-
digest:
|
|
36018
|
+
digest: crypto10.createHash("sha256").update(prompt).digest("hex").slice(0, 16),
|
|
35509
36019
|
prompt_chars: prompt.length
|
|
35510
36020
|
});
|
|
35511
36021
|
try {
|
|
@@ -35521,7 +36031,7 @@ function run5(stdin_text, options) {
|
|
|
35521
36031
|
}
|
|
35522
36032
|
return decision.exit;
|
|
35523
36033
|
}
|
|
35524
|
-
function
|
|
36034
|
+
function main26(argv) {
|
|
35525
36035
|
const args = argv ?? process.argv.slice(2);
|
|
35526
36036
|
let consumer_root = process.cwd();
|
|
35527
36037
|
for (let i = 0; i < args.length; i += 1) {
|
|
@@ -35535,34 +36045,34 @@ function main25(argv) {
|
|
|
35535
36045
|
}
|
|
35536
36046
|
return run5(readHookStdin(), { consumer_root });
|
|
35537
36047
|
}
|
|
35538
|
-
function
|
|
36048
|
+
function _isCliEntry24() {
|
|
35539
36049
|
if (true) {
|
|
35540
36050
|
return false;
|
|
35541
36051
|
}
|
|
35542
36052
|
if (process.argv[1] === void 0) {
|
|
35543
36053
|
return false;
|
|
35544
36054
|
}
|
|
35545
|
-
const argvUrl =
|
|
36055
|
+
const argvUrl = pathToFileURL26(path61.resolve(process.argv[1])).href;
|
|
35546
36056
|
if (import.meta.url === argvUrl) {
|
|
35547
36057
|
return true;
|
|
35548
36058
|
}
|
|
35549
36059
|
try {
|
|
35550
|
-
const here =
|
|
35551
|
-
const argv =
|
|
36060
|
+
const here = fs60.realpathSync(fileURLToPath37(import.meta.url));
|
|
36061
|
+
const argv = fs60.realpathSync(path61.resolve(process.argv[1]));
|
|
35552
36062
|
return here === argv;
|
|
35553
36063
|
} catch {
|
|
35554
36064
|
return false;
|
|
35555
36065
|
}
|
|
35556
36066
|
}
|
|
35557
|
-
var
|
|
36067
|
+
var EXIT_ALLOW6, EXIT_BLOCK3, STATE_FILE4, DISPATCH_TOOLS, EVALUATION_RE, PRELOADED_VERDICT_RE, SELF_SCOPE_RE, WARN_TEXT;
|
|
35558
36068
|
var init_evidence_independence = __esm({
|
|
35559
36069
|
"src/scripts/hooks/evidence_independence.ts"() {
|
|
35560
36070
|
"use strict";
|
|
35561
36071
|
init_state_io();
|
|
35562
36072
|
init_hook_stdin();
|
|
35563
|
-
|
|
36073
|
+
EXIT_ALLOW6 = 0;
|
|
35564
36074
|
EXIT_BLOCK3 = 1;
|
|
35565
|
-
STATE_FILE4 =
|
|
36075
|
+
STATE_FILE4 = path61.join("agents", "state", "evidence-dispatch.json");
|
|
35566
36076
|
DISPATCH_TOOLS = /* @__PURE__ */ new Set([
|
|
35567
36077
|
"Agent",
|
|
35568
36078
|
"Task",
|
|
@@ -35595,8 +36105,8 @@ var init_evidence_independence = __esm({
|
|
|
35595
36105
|
];
|
|
35596
36106
|
SELF_SCOPE_RE = /\b(my (work|change|diff|implementation|code|fix|patch|branch|pr)|this (diff|change|pr|delta|implementation|patch)|the delta|the change i|what i (wrote|built|changed|implemented)|i just (wrote|built|changed|implemented))\b/i;
|
|
35597
36107
|
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.";
|
|
35598
|
-
if (
|
|
35599
|
-
process.exit(
|
|
36108
|
+
if (_isCliEntry24()) {
|
|
36109
|
+
process.exit(main26());
|
|
35600
36110
|
}
|
|
35601
36111
|
}
|
|
35602
36112
|
});
|
|
@@ -35950,9 +36460,9 @@ var init_subagent_routing = __esm({
|
|
|
35950
36460
|
});
|
|
35951
36461
|
|
|
35952
36462
|
// src/scripts/hooks/delegation_nudge_hook.ts
|
|
35953
|
-
import
|
|
35954
|
-
import
|
|
35955
|
-
import { fileURLToPath as
|
|
36463
|
+
import fs61 from "node:fs";
|
|
36464
|
+
import path62 from "node:path";
|
|
36465
|
+
import { fileURLToPath as fileURLToPath38, pathToFileURL as pathToFileURL27 } from "node:url";
|
|
35956
36466
|
function _isObject7(v) {
|
|
35957
36467
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
35958
36468
|
}
|
|
@@ -36104,34 +36614,34 @@ function _workspaceRoot(envelope) {
|
|
|
36104
36614
|
}
|
|
36105
36615
|
return process.cwd();
|
|
36106
36616
|
}
|
|
36107
|
-
function
|
|
36617
|
+
function main27() {
|
|
36108
36618
|
let envelope = {};
|
|
36109
36619
|
try {
|
|
36110
36620
|
const raw = readHookStdin();
|
|
36111
36621
|
envelope = raw.trim() ? JSON.parse(raw) : {};
|
|
36112
36622
|
} catch {
|
|
36113
|
-
return
|
|
36623
|
+
return EXIT_ALLOW7;
|
|
36114
36624
|
}
|
|
36115
36625
|
const env = _isObject7(envelope) ? envelope : {};
|
|
36116
36626
|
const event = env["event"];
|
|
36117
36627
|
const slot = typeof event === "string" && event !== "" ? event : "user_prompt_submit";
|
|
36118
36628
|
if (slot !== "user_prompt_submit") {
|
|
36119
|
-
return
|
|
36629
|
+
return EXIT_ALLOW7;
|
|
36120
36630
|
}
|
|
36121
36631
|
const payload = _isObject7(env["payload"]) ? env["payload"] : env;
|
|
36122
36632
|
const prompt = _extractPrompt2(payload);
|
|
36123
36633
|
if (!prompt) {
|
|
36124
|
-
return
|
|
36634
|
+
return EXIT_ALLOW7;
|
|
36125
36635
|
}
|
|
36126
36636
|
if (isSyntheticPrompt(prompt)) {
|
|
36127
|
-
return
|
|
36637
|
+
return EXIT_ALLOW7;
|
|
36128
36638
|
}
|
|
36129
36639
|
const root = _workspaceRoot(env);
|
|
36130
36640
|
const platform = env["platform"];
|
|
36131
36641
|
const hostId = typeof platform === "string" && platform ? platform : null;
|
|
36132
36642
|
const result = classifyPrompt(prompt, root, hostId);
|
|
36133
36643
|
if (!result) {
|
|
36134
|
-
return
|
|
36644
|
+
return EXIT_ALLOW7;
|
|
36135
36645
|
}
|
|
36136
36646
|
process.stdout.write(
|
|
36137
36647
|
`${JSON.stringify({
|
|
@@ -36143,26 +36653,26 @@ function main26() {
|
|
|
36143
36653
|
);
|
|
36144
36654
|
return EXIT_WARN3;
|
|
36145
36655
|
}
|
|
36146
|
-
function
|
|
36656
|
+
function _isCliEntry25() {
|
|
36147
36657
|
if (true) {
|
|
36148
36658
|
return false;
|
|
36149
36659
|
}
|
|
36150
36660
|
if (process.argv[1] === void 0) {
|
|
36151
36661
|
return false;
|
|
36152
36662
|
}
|
|
36153
|
-
const argvUrl =
|
|
36663
|
+
const argvUrl = pathToFileURL27(path62.resolve(process.argv[1])).href;
|
|
36154
36664
|
if (import.meta.url === argvUrl) {
|
|
36155
36665
|
return true;
|
|
36156
36666
|
}
|
|
36157
36667
|
try {
|
|
36158
|
-
const here =
|
|
36159
|
-
const argv =
|
|
36668
|
+
const here = fs61.realpathSync(fileURLToPath38(import.meta.url));
|
|
36669
|
+
const argv = fs61.realpathSync(path62.resolve(process.argv[1]));
|
|
36160
36670
|
return here === argv;
|
|
36161
36671
|
} catch {
|
|
36162
36672
|
return false;
|
|
36163
36673
|
}
|
|
36164
36674
|
}
|
|
36165
|
-
var
|
|
36675
|
+
var EXIT_ALLOW7, EXIT_WARN3, FILE_TOKEN_RE, FILE_SIGNAL_FLOOR, EXPLICIT_COUNT_RE, FOR_EACH_RE, STEP_WORD_RE, STEP_LINE_RE, ORDERED_LINE_FLOOR, ORDERED_WORD_FLOOR;
|
|
36166
36676
|
var init_delegation_nudge_hook = __esm({
|
|
36167
36677
|
"src/scripts/hooks/delegation_nudge_hook.ts"() {
|
|
36168
36678
|
"use strict";
|
|
@@ -36173,7 +36683,7 @@ var init_delegation_nudge_hook = __esm({
|
|
|
36173
36683
|
init_session_role();
|
|
36174
36684
|
init_subagent_routing();
|
|
36175
36685
|
init_prompt_shape();
|
|
36176
|
-
|
|
36686
|
+
EXIT_ALLOW7 = 0;
|
|
36177
36687
|
EXIT_WARN3 = 2;
|
|
36178
36688
|
FILE_TOKEN_RE = /`?\b[\w][\w.\-]{0,80}\.(ts|tsx|js|jsx|mjs|cjs|py|php|rb|go|rs|java|kt|swift|md|mdx|json|ya?ml|css|scss|less|html|vue|svelte|sql|sh|bash|c|cpp|h|hpp|cs|toml|xml)\b`?/gi;
|
|
36179
36689
|
FILE_SIGNAL_FLOOR = 3;
|
|
@@ -36183,18 +36693,18 @@ var init_delegation_nudge_hook = __esm({
|
|
|
36183
36693
|
STEP_LINE_RE = /^\s*\d+[.)]\s+\S/gm;
|
|
36184
36694
|
ORDERED_LINE_FLOOR = 3;
|
|
36185
36695
|
ORDERED_WORD_FLOOR = 2;
|
|
36186
|
-
if (
|
|
36187
|
-
process.exit(
|
|
36696
|
+
if (_isCliEntry25()) {
|
|
36697
|
+
process.exit(main27());
|
|
36188
36698
|
}
|
|
36189
36699
|
}
|
|
36190
36700
|
});
|
|
36191
36701
|
|
|
36192
36702
|
// src/scripts/conformance_scan.ts
|
|
36193
|
-
import { createHash as
|
|
36194
|
-
import
|
|
36703
|
+
import { createHash as createHash11 } from "node:crypto";
|
|
36704
|
+
import fs62 from "node:fs";
|
|
36195
36705
|
import os14 from "node:os";
|
|
36196
|
-
import
|
|
36197
|
-
import { fileURLToPath as
|
|
36706
|
+
import path63 from "node:path";
|
|
36707
|
+
import { fileURLToPath as fileURLToPath39, pathToFileURL as pathToFileURL28 } from "node:url";
|
|
36198
36708
|
function spansCarrierChange(firstAts) {
|
|
36199
36709
|
const stamps = firstAts.filter((s) => s !== "").sort();
|
|
36200
36710
|
if (stamps.length === 0) {
|
|
@@ -36520,7 +37030,7 @@ function scanSession(sessionId, lines) {
|
|
|
36520
37030
|
}
|
|
36521
37031
|
function defaultStore(projectDir) {
|
|
36522
37032
|
const slug = projectStoreSlug(projectDir);
|
|
36523
|
-
return
|
|
37033
|
+
return path63.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
|
|
36524
37034
|
}
|
|
36525
37035
|
function _tokens(chars) {
|
|
36526
37036
|
return Math.round(chars / 4);
|
|
@@ -36531,13 +37041,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
36531
37041
|
return {
|
|
36532
37042
|
project: {
|
|
36533
37043
|
dir: projectRulesDir,
|
|
36534
|
-
present:
|
|
37044
|
+
present: fs62.existsSync(projectRulesDir),
|
|
36535
37045
|
files: p.files,
|
|
36536
37046
|
tokens: _tokens(p.chars)
|
|
36537
37047
|
},
|
|
36538
37048
|
global: {
|
|
36539
37049
|
dir: globalRulesDir,
|
|
36540
|
-
present:
|
|
37050
|
+
present: fs62.existsSync(globalRulesDir),
|
|
36541
37051
|
files: g.files,
|
|
36542
37052
|
tokens: _tokens(g.chars)
|
|
36543
37053
|
},
|
|
@@ -36545,13 +37055,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
36545
37055
|
};
|
|
36546
37056
|
}
|
|
36547
37057
|
function storeKey(store) {
|
|
36548
|
-
return
|
|
37058
|
+
return createHash11("sha256").update(path63.resolve(store)).digest("hex").slice(0, 12);
|
|
36549
37059
|
}
|
|
36550
37060
|
function scanStore(store, limit) {
|
|
36551
|
-
const files =
|
|
37061
|
+
const files = fs62.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs62.statSync(path63.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
|
|
36552
37062
|
const per_session = [];
|
|
36553
37063
|
for (const f of files) {
|
|
36554
|
-
const lines =
|
|
37064
|
+
const lines = fs62.readFileSync(path63.join(store, f), "utf8").split("\n");
|
|
36555
37065
|
const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
|
|
36556
37066
|
if (r.assistant_turns > 0) {
|
|
36557
37067
|
per_session.push(r);
|
|
@@ -36579,10 +37089,10 @@ function scanStore(store, limit) {
|
|
|
36579
37089
|
const task_completeness_rate_pct = completeness_windows === 0 ? 0 : Number((100 * task_completeness / completeness_windows).toFixed(1));
|
|
36580
37090
|
const era = spansCarrierChange(per_session.map((s) => s.first_at));
|
|
36581
37091
|
const delivered = measureDelivered(
|
|
36582
|
-
|
|
36583
|
-
|
|
37092
|
+
path63.join(REPO_ROOT6, ".claude", "rules"),
|
|
37093
|
+
path63.join(process.env["HOME"] ?? os14.homedir(), ".claude", "rules")
|
|
36584
37094
|
);
|
|
36585
|
-
const ownStore =
|
|
37095
|
+
const ownStore = path63.resolve(store) === path63.resolve(defaultStore(REPO_ROOT6));
|
|
36586
37096
|
return {
|
|
36587
37097
|
scanned_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
36588
37098
|
store,
|
|
@@ -36612,8 +37122,8 @@ function scanStore(store, limit) {
|
|
|
36612
37122
|
};
|
|
36613
37123
|
}
|
|
36614
37124
|
function recordRate(file, scanned_at, rate) {
|
|
36615
|
-
|
|
36616
|
-
|
|
37125
|
+
fs62.mkdirSync(path63.dirname(file), { recursive: true });
|
|
37126
|
+
fs62.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
|
|
36617
37127
|
`, "utf8");
|
|
36618
37128
|
}
|
|
36619
37129
|
function render2(report2) {
|
|
@@ -36712,7 +37222,7 @@ function render2(report2) {
|
|
|
36712
37222
|
lines.push(" checkbox batching \u2014 measured NOWHERE. ~5 low-severity findings.");
|
|
36713
37223
|
return lines.join("\n");
|
|
36714
37224
|
}
|
|
36715
|
-
function
|
|
37225
|
+
function main28(argv) {
|
|
36716
37226
|
const args = argv ?? process.argv.slice(2);
|
|
36717
37227
|
let store = null;
|
|
36718
37228
|
let limit = 30;
|
|
@@ -36744,14 +37254,14 @@ function main27(argv) {
|
|
|
36744
37254
|
return 2;
|
|
36745
37255
|
}
|
|
36746
37256
|
const resolved = store ?? defaultStore(process.cwd());
|
|
36747
|
-
if (!
|
|
37257
|
+
if (!fs62.existsSync(resolved)) {
|
|
36748
37258
|
process.stderr.write(`conformance:behavior: no transcript store at ${resolved}
|
|
36749
37259
|
`);
|
|
36750
37260
|
return 1;
|
|
36751
37261
|
}
|
|
36752
37262
|
const report2 = scanStore(resolved, Number.isFinite(limit) && limit > 0 ? limit : 30);
|
|
36753
37263
|
if (out) {
|
|
36754
|
-
|
|
37264
|
+
fs62.writeFileSync(out, `${JSON.stringify(report2, null, 2)}
|
|
36755
37265
|
`, "utf8");
|
|
36756
37266
|
}
|
|
36757
37267
|
if (record) {
|
|
@@ -36759,7 +37269,7 @@ function main27(argv) {
|
|
|
36759
37269
|
}
|
|
36760
37270
|
if (why !== null) {
|
|
36761
37271
|
const id = why;
|
|
36762
|
-
|
|
37272
|
+
fs62.writeSync(
|
|
36763
37273
|
1,
|
|
36764
37274
|
json ? `${JSON.stringify(
|
|
36765
37275
|
{
|
|
@@ -36779,25 +37289,25 @@ function main27(argv) {
|
|
|
36779
37289
|
);
|
|
36780
37290
|
return 0;
|
|
36781
37291
|
}
|
|
36782
|
-
|
|
37292
|
+
fs62.writeSync(1, json ? `${JSON.stringify(report2, null, 2)}
|
|
36783
37293
|
` : `${render2(report2)}
|
|
36784
37294
|
`);
|
|
36785
37295
|
return 0;
|
|
36786
37296
|
}
|
|
36787
|
-
function
|
|
37297
|
+
function _isCliEntry26() {
|
|
36788
37298
|
if (true) {
|
|
36789
37299
|
return false;
|
|
36790
37300
|
}
|
|
36791
37301
|
if (process.argv[1] === void 0) {
|
|
36792
37302
|
return false;
|
|
36793
37303
|
}
|
|
36794
|
-
const argvUrl =
|
|
37304
|
+
const argvUrl = pathToFileURL28(path63.resolve(process.argv[1])).href;
|
|
36795
37305
|
if (import.meta.url === argvUrl) {
|
|
36796
37306
|
return true;
|
|
36797
37307
|
}
|
|
36798
37308
|
try {
|
|
36799
|
-
const here =
|
|
36800
|
-
const argv =
|
|
37309
|
+
const here = fs62.realpathSync(fileURLToPath39(import.meta.url));
|
|
37310
|
+
const argv = fs62.realpathSync(path63.resolve(process.argv[1]));
|
|
36801
37311
|
return here === argv;
|
|
36802
37312
|
} catch {
|
|
36803
37313
|
return false;
|
|
@@ -36818,7 +37328,7 @@ var init_conformance_scan = __esm({
|
|
|
36818
37328
|
init_turn_end_gate_hook();
|
|
36819
37329
|
init_evidence_independence();
|
|
36820
37330
|
init_delegation_nudge_hook();
|
|
36821
|
-
REPO_ROOT6 =
|
|
37331
|
+
REPO_ROOT6 = path63.resolve(path63.dirname(fileURLToPath39(import.meta.url)), "..", "..");
|
|
36822
37332
|
OBSERVED_BAND = { low: 9.1, high: 39.2 };
|
|
36823
37333
|
BAND_MIN_TURNS = 1978;
|
|
36824
37334
|
CARRIER_CHANGES = [
|
|
@@ -36845,28 +37355,28 @@ var init_conformance_scan = __esm({
|
|
|
36845
37355
|
};
|
|
36846
37356
|
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;
|
|
36847
37357
|
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;
|
|
36848
|
-
DEFAULT_RATE_SERIES =
|
|
37358
|
+
DEFAULT_RATE_SERIES = path63.join(
|
|
36849
37359
|
REPO_ROOT6,
|
|
36850
37360
|
"agents",
|
|
36851
37361
|
"runtime",
|
|
36852
37362
|
"state",
|
|
36853
37363
|
"conformance-rates.jsonl"
|
|
36854
37364
|
);
|
|
36855
|
-
if (
|
|
36856
|
-
process.exit(
|
|
37365
|
+
if (_isCliEntry26()) {
|
|
37366
|
+
process.exit(main28());
|
|
36857
37367
|
}
|
|
36858
37368
|
}
|
|
36859
37369
|
});
|
|
36860
37370
|
|
|
36861
37371
|
// src/scripts/report_carrier_divergence.ts
|
|
36862
|
-
import * as
|
|
37372
|
+
import * as fs63 from "node:fs";
|
|
36863
37373
|
import * as os15 from "node:os";
|
|
36864
|
-
import * as
|
|
37374
|
+
import * as path64 from "node:path";
|
|
36865
37375
|
import process17 from "node:process";
|
|
36866
|
-
import { fileURLToPath as
|
|
37376
|
+
import { fileURLToPath as fileURLToPath40, pathToFileURL as pathToFileURL29 } from "node:url";
|
|
36867
37377
|
function _listRules(dir) {
|
|
36868
37378
|
try {
|
|
36869
|
-
return
|
|
37379
|
+
return fs63.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
|
|
36870
37380
|
} catch {
|
|
36871
37381
|
return [];
|
|
36872
37382
|
}
|
|
@@ -36874,7 +37384,7 @@ function _listRules(dir) {
|
|
|
36874
37384
|
function _ruleType(file) {
|
|
36875
37385
|
let text;
|
|
36876
37386
|
try {
|
|
36877
|
-
text =
|
|
37387
|
+
text = fs63.readFileSync(file, "utf-8");
|
|
36878
37388
|
} catch {
|
|
36879
37389
|
return "";
|
|
36880
37390
|
}
|
|
@@ -36885,8 +37395,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
36885
37395
|
const out = {
|
|
36886
37396
|
projectDir,
|
|
36887
37397
|
globalDir,
|
|
36888
|
-
globalPresent:
|
|
36889
|
-
projectPresent:
|
|
37398
|
+
globalPresent: fs63.existsSync(globalDir),
|
|
37399
|
+
projectPresent: fs63.existsSync(projectDir),
|
|
36890
37400
|
shared: 0,
|
|
36891
37401
|
identical: [],
|
|
36892
37402
|
provenanceOnly: [],
|
|
@@ -36909,7 +37419,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
36909
37419
|
}
|
|
36910
37420
|
if (!inP && inG) {
|
|
36911
37421
|
out.globalOnly.push(rule);
|
|
36912
|
-
if (sourceDir !== void 0 && _ruleType(
|
|
37422
|
+
if (sourceDir !== void 0 && _ruleType(path64.join(sourceDir, rule)) === "manual") {
|
|
36913
37423
|
out.manualOnlyGlobal.push(rule);
|
|
36914
37424
|
}
|
|
36915
37425
|
continue;
|
|
@@ -36919,8 +37429,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
36919
37429
|
let projectCopy;
|
|
36920
37430
|
let globalCopy;
|
|
36921
37431
|
try {
|
|
36922
|
-
projectCopy =
|
|
36923
|
-
globalCopy =
|
|
37432
|
+
projectCopy = fs63.readFileSync(path64.join(projectDir, rule));
|
|
37433
|
+
globalCopy = fs63.readFileSync(path64.join(globalDir, rule));
|
|
36924
37434
|
verdict = comparePair(projectCopy, globalCopy);
|
|
36925
37435
|
} catch {
|
|
36926
37436
|
out.shared -= 1;
|
|
@@ -37065,11 +37575,11 @@ function render3(d) {
|
|
|
37065
37575
|
}
|
|
37066
37576
|
return lines.join("\n");
|
|
37067
37577
|
}
|
|
37068
|
-
function
|
|
37578
|
+
function main29(argv) {
|
|
37069
37579
|
const args = argv ?? process17.argv.slice(2);
|
|
37070
|
-
let projectDir =
|
|
37071
|
-
let globalDir =
|
|
37072
|
-
let sourceDir =
|
|
37580
|
+
let projectDir = path64.join(REPO_ROOT7, PROJECT_RULES);
|
|
37581
|
+
let globalDir = path64.join(os15.homedir(), GLOBAL_RULES);
|
|
37582
|
+
let sourceDir = path64.join(REPO_ROOT7, PROJECTION_SOURCE);
|
|
37073
37583
|
const value = (i) => {
|
|
37074
37584
|
const v = args[i + 1];
|
|
37075
37585
|
return v === void 0 || v.startsWith("-") ? null : v;
|
|
@@ -37083,7 +37593,7 @@ function main28(argv) {
|
|
|
37083
37593
|
`);
|
|
37084
37594
|
return 1;
|
|
37085
37595
|
}
|
|
37086
|
-
const resolved =
|
|
37596
|
+
const resolved = path64.resolve(v);
|
|
37087
37597
|
if (a === "--project") projectDir = resolved;
|
|
37088
37598
|
else if (a === "--global") globalDir = resolved;
|
|
37089
37599
|
else sourceDir = resolved;
|
|
@@ -37103,11 +37613,11 @@ function main28(argv) {
|
|
|
37103
37613
|
`);
|
|
37104
37614
|
return 0;
|
|
37105
37615
|
}
|
|
37106
|
-
function
|
|
37616
|
+
function _isCliEntry27() {
|
|
37107
37617
|
if (process17.argv[1] === void 0) return false;
|
|
37108
|
-
if (import.meta.url ===
|
|
37618
|
+
if (import.meta.url === pathToFileURL29(path64.resolve(process17.argv[1])).href) return true;
|
|
37109
37619
|
try {
|
|
37110
|
-
return
|
|
37620
|
+
return fs63.realpathSync(_HERE17) === fs63.realpathSync(path64.resolve(process17.argv[1]));
|
|
37111
37621
|
} catch {
|
|
37112
37622
|
return false;
|
|
37113
37623
|
}
|
|
@@ -37117,37 +37627,37 @@ var init_report_carrier_divergence = __esm({
|
|
|
37117
37627
|
"src/scripts/report_carrier_divergence.ts"() {
|
|
37118
37628
|
"use strict";
|
|
37119
37629
|
init_carrier_divergence();
|
|
37120
|
-
_HERE17 =
|
|
37121
|
-
REPO_ROOT7 =
|
|
37122
|
-
PROJECT_RULES =
|
|
37123
|
-
PROJECTION_SOURCE =
|
|
37124
|
-
GLOBAL_RULES =
|
|
37125
|
-
if (
|
|
37126
|
-
process17.exit(
|
|
37630
|
+
_HERE17 = fileURLToPath40(import.meta.url);
|
|
37631
|
+
REPO_ROOT7 = path64.resolve(path64.dirname(_HERE17), "..", "..");
|
|
37632
|
+
PROJECT_RULES = path64.join(".claude", "rules");
|
|
37633
|
+
PROJECTION_SOURCE = path64.join("dist", "agent-src", "rules");
|
|
37634
|
+
GLOBAL_RULES = path64.join(".claude", "rules");
|
|
37635
|
+
if (_isCliEntry27()) {
|
|
37636
|
+
process17.exit(main29());
|
|
37127
37637
|
}
|
|
37128
37638
|
}
|
|
37129
37639
|
});
|
|
37130
37640
|
|
|
37131
37641
|
// src/scripts/report_skill_activation.ts
|
|
37132
|
-
import * as
|
|
37642
|
+
import * as fs64 from "node:fs";
|
|
37133
37643
|
import * as os16 from "node:os";
|
|
37134
|
-
import * as
|
|
37135
|
-
import { fileURLToPath as
|
|
37644
|
+
import * as path65 from "node:path";
|
|
37645
|
+
import { fileURLToPath as fileURLToPath41, pathToFileURL as pathToFileURL30 } from "node:url";
|
|
37136
37646
|
function censusSkills(root) {
|
|
37137
37647
|
const out = { total: 0, withTriggerKey: [], withDeterministicObligation: [] };
|
|
37138
|
-
if (!
|
|
37648
|
+
if (!fs64.existsSync(root)) {
|
|
37139
37649
|
return out;
|
|
37140
37650
|
}
|
|
37141
|
-
for (const entry of
|
|
37651
|
+
for (const entry of fs64.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
37142
37652
|
if (!entry.isDirectory()) {
|
|
37143
37653
|
continue;
|
|
37144
37654
|
}
|
|
37145
|
-
const file =
|
|
37146
|
-
if (!
|
|
37655
|
+
const file = path65.join(root, entry.name, "SKILL.md");
|
|
37656
|
+
if (!fs64.existsSync(file)) {
|
|
37147
37657
|
continue;
|
|
37148
37658
|
}
|
|
37149
37659
|
out.total += 1;
|
|
37150
|
-
const text =
|
|
37660
|
+
const text = fs64.readFileSync(file, "utf8");
|
|
37151
37661
|
const fmEnd = text.startsWith("---") ? text.indexOf("\n---", 3) : -1;
|
|
37152
37662
|
const fm = fmEnd === -1 ? "" : text.slice(0, fmEnd);
|
|
37153
37663
|
if (TRIGGER_KEYS.some((k) => new RegExp(`^${k}`, "m").test(fm))) {
|
|
@@ -37161,17 +37671,17 @@ function censusSkills(root) {
|
|
|
37161
37671
|
return out;
|
|
37162
37672
|
}
|
|
37163
37673
|
function defaultStore2(cwd) {
|
|
37164
|
-
return
|
|
37674
|
+
return path65.join(os16.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
37165
37675
|
}
|
|
37166
37676
|
function measureUsage(store, limit) {
|
|
37167
37677
|
const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
|
|
37168
|
-
if (!
|
|
37678
|
+
if (!fs64.existsSync(store)) {
|
|
37169
37679
|
return rep;
|
|
37170
37680
|
}
|
|
37171
|
-
const files =
|
|
37681
|
+
const files = fs64.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path65.join(store, f)).sort((a, b) => fs64.statSync(b).mtimeMs - fs64.statSync(a).mtimeMs).slice(0, limit);
|
|
37172
37682
|
rep.sessions = files.length;
|
|
37173
37683
|
for (const file of files) {
|
|
37174
|
-
for (const line of
|
|
37684
|
+
for (const line of fs64.readFileSync(file, "utf8").split("\n")) {
|
|
37175
37685
|
if (!line.trim()) {
|
|
37176
37686
|
continue;
|
|
37177
37687
|
}
|
|
@@ -37234,7 +37744,7 @@ function render4(census, usage) {
|
|
|
37234
37744
|
}
|
|
37235
37745
|
totalInv += u.invocations;
|
|
37236
37746
|
lines.push(
|
|
37237
|
-
` ${
|
|
37747
|
+
` ${path65.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)}`
|
|
37238
37748
|
);
|
|
37239
37749
|
}
|
|
37240
37750
|
lines.push("");
|
|
@@ -37259,7 +37769,7 @@ function render4(census, usage) {
|
|
|
37259
37769
|
lines.push(" catalogue once per session, then count descriptions against bare names.");
|
|
37260
37770
|
return lines.join("\n");
|
|
37261
37771
|
}
|
|
37262
|
-
function
|
|
37772
|
+
function main30(argv) {
|
|
37263
37773
|
let limit = 30;
|
|
37264
37774
|
const stores = [];
|
|
37265
37775
|
for (let i = 0; i < argv.length; i += 1) {
|
|
@@ -37282,7 +37792,7 @@ function main29(argv) {
|
|
|
37282
37792
|
if (stores.length === 0) {
|
|
37283
37793
|
stores.push(defaultStore2(REPO_ROOT8));
|
|
37284
37794
|
}
|
|
37285
|
-
const census = censusSkills(
|
|
37795
|
+
const census = censusSkills(path65.join(REPO_ROOT8, SKILLS_ROOT));
|
|
37286
37796
|
const usage = stores.map((s) => measureUsage(s, limit));
|
|
37287
37797
|
process.stdout.write(`${render4(census, usage)}
|
|
37288
37798
|
`);
|
|
@@ -37293,23 +37803,23 @@ var init_report_skill_activation = __esm({
|
|
|
37293
37803
|
"src/scripts/report_skill_activation.ts"() {
|
|
37294
37804
|
"use strict";
|
|
37295
37805
|
init_cc_transcript();
|
|
37296
|
-
_HERE18 =
|
|
37297
|
-
REPO_ROOT8 =
|
|
37806
|
+
_HERE18 = fileURLToPath41(import.meta.url);
|
|
37807
|
+
REPO_ROOT8 = path65.resolve(path65.dirname(_HERE18), "..", "..");
|
|
37298
37808
|
SKILLS_ROOT = "src/skills";
|
|
37299
37809
|
TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
|
|
37300
37810
|
DETERMINISTIC_RE = /^\s*(?:[-*]\s*)?(?:\*\*)?(MUST|NEVER|ALWAYS)\b/m;
|
|
37301
|
-
if (process.argv[1] !== void 0 && import.meta.url ===
|
|
37302
|
-
process.exit(
|
|
37811
|
+
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL30(path65.resolve(process.argv[1])).href) {
|
|
37812
|
+
process.exit(main30(process.argv.slice(2)));
|
|
37303
37813
|
}
|
|
37304
37814
|
}
|
|
37305
37815
|
});
|
|
37306
37816
|
|
|
37307
37817
|
// src/scripts/report_skill_obligation_violations.ts
|
|
37308
|
-
import * as
|
|
37818
|
+
import * as fs65 from "node:fs";
|
|
37309
37819
|
import * as os17 from "node:os";
|
|
37310
|
-
import * as
|
|
37820
|
+
import * as path66 from "node:path";
|
|
37311
37821
|
import process18 from "node:process";
|
|
37312
|
-
import { fileURLToPath as
|
|
37822
|
+
import { fileURLToPath as fileURLToPath42, pathToFileURL as pathToFileURL31 } from "node:url";
|
|
37313
37823
|
function _verb(line) {
|
|
37314
37824
|
const m = /\b(NEVER|MUST|ALWAYS)\b/.exec(line);
|
|
37315
37825
|
return m?.[1] ?? "NEVER";
|
|
@@ -37328,7 +37838,7 @@ function _artefacts(line) {
|
|
|
37328
37838
|
return out;
|
|
37329
37839
|
}
|
|
37330
37840
|
function extractObligations(repoRoot) {
|
|
37331
|
-
const skillsRoot =
|
|
37841
|
+
const skillsRoot = path66.join(repoRoot, SKILLS_ROOT);
|
|
37332
37842
|
const census = censusSkills(skillsRoot);
|
|
37333
37843
|
const out = {
|
|
37334
37844
|
skills: census.withDeterministicObligation,
|
|
@@ -37342,7 +37852,7 @@ function extractObligations(repoRoot) {
|
|
|
37342
37852
|
for (const skill of census.withDeterministicObligation) {
|
|
37343
37853
|
let text;
|
|
37344
37854
|
try {
|
|
37345
|
-
text =
|
|
37855
|
+
text = fs65.readFileSync(path66.join(skillsRoot, skill, "SKILL.md"), "utf-8");
|
|
37346
37856
|
} catch {
|
|
37347
37857
|
continue;
|
|
37348
37858
|
}
|
|
@@ -37444,7 +37954,7 @@ function scanSessionForViolations(session, lines, forbidden, parsed) {
|
|
|
37444
37954
|
return flags;
|
|
37445
37955
|
}
|
|
37446
37956
|
function defaultStore3(cwd) {
|
|
37447
|
-
return
|
|
37957
|
+
return path66.join(os17.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
37448
37958
|
}
|
|
37449
37959
|
function scanStore2(repoRoot, store, limit) {
|
|
37450
37960
|
const census = extractObligations(repoRoot);
|
|
@@ -37457,14 +37967,14 @@ function scanStore2(repoRoot, store, limit) {
|
|
|
37457
37967
|
};
|
|
37458
37968
|
let files;
|
|
37459
37969
|
try {
|
|
37460
|
-
files =
|
|
37970
|
+
files = fs65.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path66.join(store, f), m: fs65.statSync(path66.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
|
|
37461
37971
|
} catch {
|
|
37462
37972
|
return report2;
|
|
37463
37973
|
}
|
|
37464
37974
|
report2.sessions = files.length;
|
|
37465
37975
|
for (const file of files) {
|
|
37466
|
-
const lines =
|
|
37467
|
-
const id =
|
|
37976
|
+
const lines = fs65.readFileSync(file, "utf-8").split("\n");
|
|
37977
|
+
const id = path66.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
|
|
37468
37978
|
const entries = _parseSession(lines);
|
|
37469
37979
|
if (loadedSkillsFrom(entries).size > 0) report2.sessionsWithASkill += 1;
|
|
37470
37980
|
report2.flags.push(...scanSessionForViolations(id, lines, census.forbidden, entries));
|
|
@@ -37534,7 +38044,7 @@ function render5(r) {
|
|
|
37534
38044
|
lines.push(" ships as detection-only, and this one says so.");
|
|
37535
38045
|
return lines.join("\n");
|
|
37536
38046
|
}
|
|
37537
|
-
function
|
|
38047
|
+
function main31(argv) {
|
|
37538
38048
|
const args = argv ?? process18.argv.slice(2);
|
|
37539
38049
|
let limit = 30;
|
|
37540
38050
|
let json = false;
|
|
@@ -37587,11 +38097,11 @@ function main30(argv) {
|
|
|
37587
38097
|
}
|
|
37588
38098
|
return 0;
|
|
37589
38099
|
}
|
|
37590
|
-
function
|
|
38100
|
+
function _isCliEntry28() {
|
|
37591
38101
|
if (process18.argv[1] === void 0) return false;
|
|
37592
|
-
if (import.meta.url ===
|
|
38102
|
+
if (import.meta.url === pathToFileURL31(path66.resolve(process18.argv[1])).href) return true;
|
|
37593
38103
|
try {
|
|
37594
|
-
return
|
|
38104
|
+
return fs65.realpathSync(_HERE19) === fs65.realpathSync(path66.resolve(process18.argv[1]));
|
|
37595
38105
|
} catch {
|
|
37596
38106
|
return false;
|
|
37597
38107
|
}
|
|
@@ -37603,8 +38113,8 @@ var init_report_skill_obligation_violations = __esm({
|
|
|
37603
38113
|
init_cc_transcript();
|
|
37604
38114
|
init_transcript_entry();
|
|
37605
38115
|
init_report_skill_activation();
|
|
37606
|
-
_HERE19 =
|
|
37607
|
-
REPO_ROOT9 =
|
|
38116
|
+
_HERE19 = fileURLToPath42(import.meta.url);
|
|
38117
|
+
REPO_ROOT9 = path66.resolve(path66.dirname(_HERE19), "..", "..");
|
|
37608
38118
|
OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
|
|
37609
38119
|
PATH_RE = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
|
|
37610
38120
|
CMD_RE = /`([a-z][a-z0-9-]*(?: [a-z][a-z0-9:._-]*){1,3})`/g;
|
|
@@ -37638,31 +38148,31 @@ var init_report_skill_obligation_violations = __esm({
|
|
|
37638
38148
|
SKILL_BODY_RE = /Base directory for this skill:\s*\S*?\/skills\/([A-Za-z0-9_-]+)/;
|
|
37639
38149
|
PATH_FIELDS = ["file_path", "path", "filePath", "notebook_path", "target_file"];
|
|
37640
38150
|
COMMAND_FIELDS = ["command", "cmd"];
|
|
37641
|
-
if (
|
|
37642
|
-
process18.exit(
|
|
38151
|
+
if (_isCliEntry28()) {
|
|
38152
|
+
process18.exit(main31());
|
|
37643
38153
|
}
|
|
37644
38154
|
}
|
|
37645
38155
|
});
|
|
37646
38156
|
|
|
37647
38157
|
// src/scripts/report_conformance_funnel.ts
|
|
37648
|
-
import * as
|
|
38158
|
+
import * as fs66 from "node:fs";
|
|
37649
38159
|
import * as os18 from "node:os";
|
|
37650
|
-
import * as
|
|
38160
|
+
import * as path67 from "node:path";
|
|
37651
38161
|
import process19 from "node:process";
|
|
37652
|
-
import { fileURLToPath as
|
|
38162
|
+
import { fileURLToPath as fileURLToPath43, pathToFileURL as pathToFileURL32 } from "node:url";
|
|
37653
38163
|
function buildFunnel(opts = {}) {
|
|
37654
38164
|
const repoRoot = opts.repoRoot ?? REPO_ROOT10;
|
|
37655
|
-
const projectRulesDir = opts.projectRulesDir ??
|
|
37656
|
-
const globalRulesDir = opts.globalRulesDir ??
|
|
37657
|
-
const sourceDir = opts.sourceDir ??
|
|
38165
|
+
const projectRulesDir = opts.projectRulesDir ?? path67.join(repoRoot, PROJECT_RULES);
|
|
38166
|
+
const globalRulesDir = opts.globalRulesDir ?? path67.join(os18.homedir(), GLOBAL_RULES);
|
|
38167
|
+
const sourceDir = opts.sourceDir ?? path67.join(repoRoot, PROJECTION_SOURCE);
|
|
37658
38168
|
const store = opts.store ?? defaultStore(repoRoot);
|
|
37659
38169
|
const limit = opts.limit ?? 30;
|
|
37660
38170
|
return {
|
|
37661
38171
|
delivered: measureDelivered(projectRulesDir, globalRulesDir),
|
|
37662
38172
|
divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
|
|
37663
|
-
skills: censusSkills(
|
|
38173
|
+
skills: censusSkills(path67.join(repoRoot, SKILLS_ROOT)),
|
|
37664
38174
|
usage: measureUsage(store, limit),
|
|
37665
|
-
storePresent:
|
|
38175
|
+
storePresent: fs66.existsSync(store),
|
|
37666
38176
|
sk2: scanStore2(repoRoot, store, limit)
|
|
37667
38177
|
};
|
|
37668
38178
|
}
|
|
@@ -37787,7 +38297,7 @@ function render6(r) {
|
|
|
37787
38297
|
lines.push("workflow without a measured false-positive rate first (locked policy).");
|
|
37788
38298
|
return lines.join("\n");
|
|
37789
38299
|
}
|
|
37790
|
-
function
|
|
38300
|
+
function main32(argv) {
|
|
37791
38301
|
const args = argv ?? process19.argv.slice(2);
|
|
37792
38302
|
const opts = {};
|
|
37793
38303
|
const value = (i) => {
|
|
@@ -37803,7 +38313,7 @@ function main31(argv) {
|
|
|
37803
38313
|
`);
|
|
37804
38314
|
return 1;
|
|
37805
38315
|
}
|
|
37806
|
-
const resolved =
|
|
38316
|
+
const resolved = path67.resolve(v);
|
|
37807
38317
|
if (a === "--store") opts.store = resolved;
|
|
37808
38318
|
else if (a === "--project") opts.projectRulesDir = resolved;
|
|
37809
38319
|
else if (a === "--global") opts.globalRulesDir = resolved;
|
|
@@ -37833,11 +38343,11 @@ function main31(argv) {
|
|
|
37833
38343
|
`);
|
|
37834
38344
|
return 0;
|
|
37835
38345
|
}
|
|
37836
|
-
function
|
|
38346
|
+
function _isCliEntry29() {
|
|
37837
38347
|
if (process19.argv[1] === void 0) return false;
|
|
37838
|
-
if (import.meta.url ===
|
|
38348
|
+
if (import.meta.url === pathToFileURL32(path67.resolve(process19.argv[1])).href) return true;
|
|
37839
38349
|
try {
|
|
37840
|
-
return
|
|
38350
|
+
return fs66.realpathSync(_HERE20) === fs66.realpathSync(path67.resolve(process19.argv[1]));
|
|
37841
38351
|
} catch {
|
|
37842
38352
|
return false;
|
|
37843
38353
|
}
|
|
@@ -37850,10 +38360,10 @@ var init_report_conformance_funnel = __esm({
|
|
|
37850
38360
|
init_report_carrier_divergence();
|
|
37851
38361
|
init_report_skill_activation();
|
|
37852
38362
|
init_report_skill_obligation_violations();
|
|
37853
|
-
_HERE20 =
|
|
37854
|
-
REPO_ROOT10 =
|
|
37855
|
-
if (
|
|
37856
|
-
process19.exit(
|
|
38363
|
+
_HERE20 = fileURLToPath43(import.meta.url);
|
|
38364
|
+
REPO_ROOT10 = path67.resolve(path67.dirname(_HERE20), "..", "..");
|
|
38365
|
+
if (_isCliEntry29()) {
|
|
38366
|
+
process19.exit(main32());
|
|
37857
38367
|
}
|
|
37858
38368
|
}
|
|
37859
38369
|
});
|
|
@@ -37874,16 +38384,16 @@ __export(cmd_conformance_exports, {
|
|
|
37874
38384
|
conformanceLogPath: () => conformanceLogPath,
|
|
37875
38385
|
detectSmokePlatform: () => detectSmokePlatform,
|
|
37876
38386
|
installLogPath: () => installLogPath,
|
|
37877
|
-
main: () =>
|
|
38387
|
+
main: () => main33,
|
|
37878
38388
|
routeTargetPaths: () => routeTargetPaths,
|
|
37879
38389
|
runConformanceChecks: () => runConformanceChecks
|
|
37880
38390
|
});
|
|
37881
|
-
import * as
|
|
38391
|
+
import * as fs67 from "node:fs";
|
|
37882
38392
|
import * as os19 from "node:os";
|
|
37883
|
-
import * as
|
|
38393
|
+
import * as path68 from "node:path";
|
|
37884
38394
|
import process20 from "node:process";
|
|
37885
38395
|
import { spawnSync as spawnSync10 } from "node:child_process";
|
|
37886
|
-
import { fileURLToPath as
|
|
38396
|
+
import { fileURLToPath as fileURLToPath44, pathToFileURL as pathToFileURL33 } from "node:url";
|
|
37887
38397
|
function print2(s = "") {
|
|
37888
38398
|
process20.stdout.write(`${s}
|
|
37889
38399
|
`);
|
|
@@ -37897,17 +38407,17 @@ function conformanceLogPath() {
|
|
|
37897
38407
|
if (override && override.trim().length > 0) {
|
|
37898
38408
|
return override;
|
|
37899
38409
|
}
|
|
37900
|
-
return
|
|
38410
|
+
return path68.join(os19.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
|
|
37901
38411
|
}
|
|
37902
38412
|
function installLogPath() {
|
|
37903
38413
|
const override = process20.env["AGENT_CONFIG_INSTALL_LOG"];
|
|
37904
38414
|
if (override && override.trim().length > 0) {
|
|
37905
38415
|
return override;
|
|
37906
38416
|
}
|
|
37907
|
-
return
|
|
38417
|
+
return path68.join(os19.homedir(), ".event4u", "agent-config", "install-log.jsonl");
|
|
37908
38418
|
}
|
|
37909
38419
|
function _check_txlog_clean(logPath = installLogPath()) {
|
|
37910
|
-
if (!
|
|
38420
|
+
if (!fs67.existsSync(logPath)) {
|
|
37911
38421
|
return {
|
|
37912
38422
|
id: "txlog-clean",
|
|
37913
38423
|
status: "ok",
|
|
@@ -37941,11 +38451,11 @@ function _check_txlog_clean(logPath = installLogPath()) {
|
|
|
37941
38451
|
};
|
|
37942
38452
|
}
|
|
37943
38453
|
function routeTargetPaths(target) {
|
|
37944
|
-
return routeTargetPathsPosix(target).map((rel) =>
|
|
38454
|
+
return routeTargetPathsPosix(target).map((rel) => path68.join(...rel.split("/")));
|
|
37945
38455
|
}
|
|
37946
38456
|
function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
37947
|
-
const routerPath =
|
|
37948
|
-
if (!
|
|
38457
|
+
const routerPath = path68.join(packageRoot, "dist", "router.json");
|
|
38458
|
+
if (!fs67.existsSync(routerPath)) {
|
|
37949
38459
|
return {
|
|
37950
38460
|
id: "router-pointers",
|
|
37951
38461
|
status: "fail",
|
|
@@ -37955,7 +38465,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
37955
38465
|
}
|
|
37956
38466
|
let router;
|
|
37957
38467
|
try {
|
|
37958
|
-
router = JSON.parse(
|
|
38468
|
+
router = JSON.parse(fs67.readFileSync(routerPath, "utf8"));
|
|
37959
38469
|
} catch (exc) {
|
|
37960
38470
|
return {
|
|
37961
38471
|
id: "router-pointers",
|
|
@@ -37964,13 +38474,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
37964
38474
|
remedy: "reinstall the package \u2014 dist/router.json is corrupt"
|
|
37965
38475
|
};
|
|
37966
38476
|
}
|
|
37967
|
-
const rulesDir =
|
|
38477
|
+
const rulesDir = path68.join(packageRoot, "dist", "agent-src", "rules");
|
|
37968
38478
|
const broken = [];
|
|
37969
38479
|
let ids = 0;
|
|
37970
38480
|
let targets = 0;
|
|
37971
38481
|
for (const kernelId of router["kernel"] ?? []) {
|
|
37972
38482
|
ids += 1;
|
|
37973
|
-
if (!
|
|
38483
|
+
if (!fs67.existsSync(path68.join(rulesDir, `${kernelId}.md`))) {
|
|
37974
38484
|
broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
|
|
37975
38485
|
}
|
|
37976
38486
|
}
|
|
@@ -37978,7 +38488,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
37978
38488
|
for (const entry of router[tier] ?? []) {
|
|
37979
38489
|
const ruleId = String(entry["id"] ?? "");
|
|
37980
38490
|
ids += 1;
|
|
37981
|
-
if (!
|
|
38491
|
+
if (!fs67.existsSync(path68.join(rulesDir, `${ruleId}.md`))) {
|
|
37982
38492
|
broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
|
|
37983
38493
|
}
|
|
37984
38494
|
for (const target of entry["routes_to"] ?? []) {
|
|
@@ -37988,7 +38498,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
37988
38498
|
broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
|
|
37989
38499
|
continue;
|
|
37990
38500
|
}
|
|
37991
|
-
if (!candidates.some((rel) =>
|
|
38501
|
+
if (!candidates.some((rel) => fs67.existsSync(path68.join(packageRoot, rel)))) {
|
|
37992
38502
|
broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
|
|
37993
38503
|
}
|
|
37994
38504
|
}
|
|
@@ -38020,9 +38530,9 @@ function detectSmokePlatform(projectRoot) {
|
|
|
38020
38530
|
return "claude";
|
|
38021
38531
|
}
|
|
38022
38532
|
function dispatcherRunner(packageRoot) {
|
|
38023
|
-
const localTsx =
|
|
38024
|
-
const script =
|
|
38025
|
-
if (
|
|
38533
|
+
const localTsx = path68.join(packageRoot, "node_modules", ".bin", "tsx");
|
|
38534
|
+
const script = path68.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
|
|
38535
|
+
if (fs67.existsSync(localTsx)) {
|
|
38026
38536
|
return [localTsx, script];
|
|
38027
38537
|
}
|
|
38028
38538
|
return ["npx", "tsx", script];
|
|
@@ -38072,12 +38582,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
|
|
|
38072
38582
|
};
|
|
38073
38583
|
}
|
|
38074
38584
|
function readSettingsMode(projectRoot) {
|
|
38075
|
-
const settingsPath =
|
|
38076
|
-
if (!
|
|
38585
|
+
const settingsPath = path68.join(projectRoot, ".agent-settings.yml");
|
|
38586
|
+
if (!fs67.existsSync(settingsPath)) {
|
|
38077
38587
|
return "eager-all";
|
|
38078
38588
|
}
|
|
38079
38589
|
try {
|
|
38080
|
-
const parsed = YAML7.parse(
|
|
38590
|
+
const parsed = YAML7.parse(fs67.readFileSync(settingsPath, "utf8"));
|
|
38081
38591
|
const lean = parsed?.["lean_projection"] ?? null;
|
|
38082
38592
|
const mode = lean?.["mode"];
|
|
38083
38593
|
return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
|
|
@@ -38088,7 +38598,7 @@ function readSettingsMode(projectRoot) {
|
|
|
38088
38598
|
function kernelIdsFromRouter(packageRoot) {
|
|
38089
38599
|
try {
|
|
38090
38600
|
const router = JSON.parse(
|
|
38091
|
-
|
|
38601
|
+
fs67.readFileSync(path68.join(packageRoot, "dist", "router.json"), "utf8")
|
|
38092
38602
|
);
|
|
38093
38603
|
return new Set((router["kernel"] ?? []).map(String));
|
|
38094
38604
|
} catch {
|
|
@@ -38105,8 +38615,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
38105
38615
|
remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
|
|
38106
38616
|
};
|
|
38107
38617
|
}
|
|
38108
|
-
const rulesDir = projectedRulesDir ??
|
|
38109
|
-
if (!
|
|
38618
|
+
const rulesDir = projectedRulesDir ?? path68.join(projectRoot, ".augment", "rules");
|
|
38619
|
+
if (!fs67.existsSync(rulesDir)) {
|
|
38110
38620
|
return {
|
|
38111
38621
|
id: "lean-projection",
|
|
38112
38622
|
status: "skipped",
|
|
@@ -38115,7 +38625,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
38115
38625
|
};
|
|
38116
38626
|
}
|
|
38117
38627
|
const kernel = kernelIdsFromRouter(packageRoot);
|
|
38118
|
-
const files =
|
|
38628
|
+
const files = fs67.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
|
|
38119
38629
|
const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
|
|
38120
38630
|
if (nonKernel.length === 0) {
|
|
38121
38631
|
return {
|
|
@@ -38129,7 +38639,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
38129
38639
|
for (const f of nonKernel) {
|
|
38130
38640
|
let text = "";
|
|
38131
38641
|
try {
|
|
38132
|
-
text =
|
|
38642
|
+
text = fs67.readFileSync(path68.join(rulesDir, f), "utf8");
|
|
38133
38643
|
} catch {
|
|
38134
38644
|
continue;
|
|
38135
38645
|
}
|
|
@@ -38160,8 +38670,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
38160
38670
|
function _check_host_manifest(projectRoot) {
|
|
38161
38671
|
const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
|
|
38162
38672
|
const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
|
|
38163
|
-
const settingsPath =
|
|
38164
|
-
if (!
|
|
38673
|
+
const settingsPath = path68.join(projectRoot, ".agent-settings.yml");
|
|
38674
|
+
if (!fs67.existsSync(settingsPath)) {
|
|
38165
38675
|
return {
|
|
38166
38676
|
id: "host-manifest",
|
|
38167
38677
|
status: "ok",
|
|
@@ -38171,7 +38681,7 @@ function _check_host_manifest(projectRoot) {
|
|
|
38171
38681
|
}
|
|
38172
38682
|
let parsed = null;
|
|
38173
38683
|
try {
|
|
38174
|
-
parsed = YAML7.parse(
|
|
38684
|
+
parsed = YAML7.parse(fs67.readFileSync(settingsPath, "utf8"));
|
|
38175
38685
|
} catch (exc) {
|
|
38176
38686
|
return {
|
|
38177
38687
|
id: "host-manifest",
|
|
@@ -38269,7 +38779,7 @@ function _parse4(argv) {
|
|
|
38269
38779
|
}
|
|
38270
38780
|
return opts;
|
|
38271
38781
|
}
|
|
38272
|
-
function
|
|
38782
|
+
function main33(argv = null) {
|
|
38273
38783
|
const opts = _parse4(argv !== null ? Array.from(argv) : process20.argv.slice(2));
|
|
38274
38784
|
if (opts.funnel) {
|
|
38275
38785
|
print2(render6(buildFunnel()));
|
|
@@ -38340,17 +38850,17 @@ function main32(argv = null) {
|
|
|
38340
38850
|
}
|
|
38341
38851
|
return failed ? 1 : 0;
|
|
38342
38852
|
}
|
|
38343
|
-
function
|
|
38853
|
+
function _isCliEntry30() {
|
|
38344
38854
|
if (process20.argv[1] === void 0) {
|
|
38345
38855
|
return false;
|
|
38346
38856
|
}
|
|
38347
|
-
const argvUrl =
|
|
38857
|
+
const argvUrl = pathToFileURL33(path68.resolve(process20.argv[1])).href;
|
|
38348
38858
|
if (import.meta.url === argvUrl) {
|
|
38349
38859
|
return true;
|
|
38350
38860
|
}
|
|
38351
38861
|
try {
|
|
38352
|
-
const here =
|
|
38353
|
-
const argv =
|
|
38862
|
+
const here = fs67.realpathSync(fileURLToPath44(import.meta.url));
|
|
38863
|
+
const argv = fs67.realpathSync(path68.resolve(process20.argv[1]));
|
|
38354
38864
|
return here === argv;
|
|
38355
38865
|
} catch {
|
|
38356
38866
|
return false;
|
|
@@ -38369,7 +38879,7 @@ var init_cmd_conformance = __esm({
|
|
|
38369
38879
|
init_router_target_paths();
|
|
38370
38880
|
init_report_conformance_funnel();
|
|
38371
38881
|
init_cmd_doctor();
|
|
38372
|
-
_HERE21 =
|
|
38882
|
+
_HERE21 = fileURLToPath44(import.meta.url);
|
|
38373
38883
|
PACKAGE_ROOT2 = resolvePackageRoot(import.meta.url);
|
|
38374
38884
|
CONFORMANCE_CHECK_IDS = [
|
|
38375
38885
|
"txlog-clean",
|
|
@@ -38380,9 +38890,9 @@ var init_cmd_conformance = __esm({
|
|
|
38380
38890
|
];
|
|
38381
38891
|
THIN_STUB_MARKER = "Routed rule \u2014 load the body on trigger-match";
|
|
38382
38892
|
USAGE3 = "usage: agent-config conformance [-h] [--project PROJECT] [--json]\n [--skip-dispatcher] [--funnel]\n";
|
|
38383
|
-
if (
|
|
38893
|
+
if (_isCliEntry30() || process20.argv[1] === _HERE21) {
|
|
38384
38894
|
try {
|
|
38385
|
-
process20.exitCode =
|
|
38895
|
+
process20.exitCode = main33(process20.argv.slice(2));
|
|
38386
38896
|
} catch (e) {
|
|
38387
38897
|
if (e instanceof ArgparseExit4) {
|
|
38388
38898
|
process20.exitCode = e.code;
|
|
@@ -38408,7 +38918,7 @@ __export(settings_exports, {
|
|
|
38408
38918
|
read_tier_usage_settings: () => read_tier_usage_settings
|
|
38409
38919
|
});
|
|
38410
38920
|
import { createRequire as createRequire6 } from "node:module";
|
|
38411
|
-
import * as
|
|
38921
|
+
import * as fs68 from "node:fs";
|
|
38412
38922
|
function _isPlainObject8(v) {
|
|
38413
38923
|
return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
|
|
38414
38924
|
}
|
|
@@ -38445,7 +38955,7 @@ function _coerce_path(value, def) {
|
|
|
38445
38955
|
}
|
|
38446
38956
|
function _isFile13(p) {
|
|
38447
38957
|
try {
|
|
38448
|
-
return
|
|
38958
|
+
return fs68.statSync(p).isFile();
|
|
38449
38959
|
} catch {
|
|
38450
38960
|
return false;
|
|
38451
38961
|
}
|
|
@@ -38456,7 +38966,7 @@ function read_settings(p) {
|
|
|
38456
38966
|
if (_isFile13(p)) {
|
|
38457
38967
|
let raw = {};
|
|
38458
38968
|
try {
|
|
38459
|
-
raw = YAML8.parse(
|
|
38969
|
+
raw = YAML8.parse(fs68.readFileSync(p, "utf-8"), { version: "1.1" });
|
|
38460
38970
|
if (raw === null || raw === void 0) {
|
|
38461
38971
|
raw = {};
|
|
38462
38972
|
}
|
|
@@ -38490,7 +39000,7 @@ function read_tier_usage_settings(p) {
|
|
|
38490
39000
|
if (_isFile13(p)) {
|
|
38491
39001
|
let raw = {};
|
|
38492
39002
|
try {
|
|
38493
|
-
raw = YAML8.parse(
|
|
39003
|
+
raw = YAML8.parse(fs68.readFileSync(p, "utf-8"), { version: "1.1" });
|
|
38494
39004
|
if (raw === null || raw === void 0) {
|
|
38495
39005
|
raw = {};
|
|
38496
39006
|
}
|
|
@@ -39028,7 +39538,7 @@ __export(aggregator_exports, {
|
|
|
39028
39538
|
aggregate: () => aggregate2,
|
|
39029
39539
|
rank_artefacts: () => rank_artefacts
|
|
39030
39540
|
});
|
|
39031
|
-
import * as
|
|
39541
|
+
import * as fs69 from "node:fs";
|
|
39032
39542
|
function _key(kind, artId) {
|
|
39033
39543
|
return `${kind}\0${artId}`;
|
|
39034
39544
|
}
|
|
@@ -39065,7 +39575,7 @@ function* _iter_events(log_path) {
|
|
|
39065
39575
|
if (!_isFile14(log_path)) {
|
|
39066
39576
|
return;
|
|
39067
39577
|
}
|
|
39068
|
-
const text =
|
|
39578
|
+
const text = fs69.readFileSync(log_path, "utf-8");
|
|
39069
39579
|
const lines = _pyFileLines(text);
|
|
39070
39580
|
let lineNo = 0;
|
|
39071
39581
|
for (const line of lines) {
|
|
@@ -39099,7 +39609,7 @@ function _pyFileLines(text) {
|
|
|
39099
39609
|
}
|
|
39100
39610
|
function _isFile14(p) {
|
|
39101
39611
|
try {
|
|
39102
|
-
return
|
|
39612
|
+
return fs69.statSync(p).isFile();
|
|
39103
39613
|
} catch {
|
|
39104
39614
|
return false;
|
|
39105
39615
|
}
|
|
@@ -39443,14 +39953,14 @@ function _pyRound5(value, ndigits = 0) {
|
|
|
39443
39953
|
}
|
|
39444
39954
|
const sign = value < 0 ? -1 : 1;
|
|
39445
39955
|
const abs = Math.abs(value);
|
|
39446
|
-
const
|
|
39447
|
-
if (
|
|
39956
|
+
const str4 = abs.toPrecision(17);
|
|
39957
|
+
if (str4.includes("e") || str4.includes("E")) {
|
|
39448
39958
|
const factor = 10 ** ndigits;
|
|
39449
39959
|
return value > 0 ? Math.round(abs * factor) / factor * sign : -Math.round(abs * factor) / factor;
|
|
39450
39960
|
}
|
|
39451
|
-
const dot =
|
|
39452
|
-
const intPart = dot === -1 ?
|
|
39453
|
-
let fracPart = dot === -1 ? "" :
|
|
39961
|
+
const dot = str4.indexOf(".");
|
|
39962
|
+
const intPart = dot === -1 ? str4 : str4.slice(0, dot);
|
|
39963
|
+
let fracPart = dot === -1 ? "" : str4.slice(dot + 1);
|
|
39454
39964
|
while (fracPart.length <= ndigits) {
|
|
39455
39965
|
fracPart += "0";
|
|
39456
39966
|
}
|
|
@@ -39478,13 +39988,13 @@ function _pyFixed(value, ndigits) {
|
|
|
39478
39988
|
}
|
|
39479
39989
|
const sign = value < 0 ? "-" : "";
|
|
39480
39990
|
const abs = Math.abs(value);
|
|
39481
|
-
const
|
|
39482
|
-
if (
|
|
39991
|
+
const str4 = abs.toPrecision(17);
|
|
39992
|
+
if (str4.includes("e") || str4.includes("E")) {
|
|
39483
39993
|
return sign + abs.toFixed(ndigits);
|
|
39484
39994
|
}
|
|
39485
|
-
const dot =
|
|
39486
|
-
const intPart = dot === -1 ?
|
|
39487
|
-
let fracPart = dot === -1 ? "" :
|
|
39995
|
+
const dot = str4.indexOf(".");
|
|
39996
|
+
const intPart = dot === -1 ? str4 : str4.slice(0, dot);
|
|
39997
|
+
let fracPart = dot === -1 ? "" : str4.slice(dot + 1);
|
|
39488
39998
|
while (fracPart.length <= ndigits) {
|
|
39489
39999
|
fracPart += "0";
|
|
39490
40000
|
}
|
|
@@ -39613,7 +40123,7 @@ var init_report_renderer = __esm({
|
|
|
39613
40123
|
});
|
|
39614
40124
|
|
|
39615
40125
|
// src/scripts/ai_council/bundler.ts
|
|
39616
|
-
import * as
|
|
40126
|
+
import * as fs70 from "node:fs";
|
|
39617
40127
|
function _context(mode, text, manifest = [], excluded = []) {
|
|
39618
40128
|
return { mode, text, manifest, excluded };
|
|
39619
40129
|
}
|
|
@@ -39671,10 +40181,10 @@ function bundle_prompt(text) {
|
|
|
39671
40181
|
return _context("prompt", _enforceSize(redacted, "prompt"), ["<inline prompt>"]);
|
|
39672
40182
|
}
|
|
39673
40183
|
function bundle_roadmap(p) {
|
|
39674
|
-
if (!
|
|
40184
|
+
if (!fs70.existsSync(p)) {
|
|
39675
40185
|
throw new FileNotFoundError2(`Roadmap not found: ${p}`);
|
|
39676
40186
|
}
|
|
39677
|
-
const raw =
|
|
40187
|
+
const raw = fs70.readFileSync(p, { encoding: "utf-8" });
|
|
39678
40188
|
const redacted = redact(raw);
|
|
39679
40189
|
return _context(
|
|
39680
40190
|
"roadmap",
|
|
@@ -40285,8 +40795,8 @@ not. Cite the peer-reviewer label and the targeted response label
|
|
|
40285
40795
|
});
|
|
40286
40796
|
|
|
40287
40797
|
// src/scripts/ai_council/advisors.ts
|
|
40288
|
-
import * as
|
|
40289
|
-
import * as
|
|
40798
|
+
import * as fs71 from "node:fs";
|
|
40799
|
+
import * as path69 from "node:path";
|
|
40290
40800
|
function _split_frontmatter2(raw) {
|
|
40291
40801
|
const match = _FRONTMATTER_RE2.exec(raw);
|
|
40292
40802
|
if (!match) {
|
|
@@ -40314,12 +40824,12 @@ function _display_name_from(advisor_name, frontmatter) {
|
|
|
40314
40824
|
}
|
|
40315
40825
|
function resolve_persona_text(persona_path, repo_root) {
|
|
40316
40826
|
const candidates = [
|
|
40317
|
-
|
|
40318
|
-
|
|
40827
|
+
path69.join(repo_root, "dist/agent-src", persona_path),
|
|
40828
|
+
path69.join(repo_root, ".agent-src.uncondensed", persona_path)
|
|
40319
40829
|
];
|
|
40320
40830
|
for (const candidate of candidates) {
|
|
40321
|
-
if (
|
|
40322
|
-
const raw =
|
|
40831
|
+
if (fs71.existsSync(candidate)) {
|
|
40832
|
+
const raw = fs71.readFileSync(candidate, "utf-8");
|
|
40323
40833
|
const [meta, body] = _split_frontmatter2(raw);
|
|
40324
40834
|
return [body.trim(), meta];
|
|
40325
40835
|
}
|
|
@@ -40623,7 +41133,7 @@ __export(low_impact_corpus_exports, {
|
|
|
40623
41133
|
load_validated_phrases: () => load_validated_phrases,
|
|
40624
41134
|
parse_corpus_strict: () => parse_corpus_strict
|
|
40625
41135
|
});
|
|
40626
|
-
import * as
|
|
41136
|
+
import * as fs72 from "node:fs";
|
|
40627
41137
|
function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
|
|
40628
41138
|
return { phrase, normalised, section, line_no, trailing_metadata };
|
|
40629
41139
|
}
|
|
@@ -40796,10 +41306,10 @@ function _checkHeadingDrift(text, title) {
|
|
|
40796
41306
|
}
|
|
40797
41307
|
function parse_corpus_strict(corpusPath) {
|
|
40798
41308
|
const p = corpusPath;
|
|
40799
|
-
if (!
|
|
41309
|
+
if (!fs72.existsSync(p)) {
|
|
40800
41310
|
return new CorpusParseResult();
|
|
40801
41311
|
}
|
|
40802
|
-
const text =
|
|
41312
|
+
const text = fs72.readFileSync(p, { encoding: "utf-8" });
|
|
40803
41313
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
40804
41314
|
const resultSections = {
|
|
40805
41315
|
validated: [],
|
|
@@ -40862,10 +41372,10 @@ function load_anti_example_phrases(corpusPath) {
|
|
|
40862
41372
|
}
|
|
40863
41373
|
function load_corpus_lock(yamlPath) {
|
|
40864
41374
|
const p = yamlPath;
|
|
40865
|
-
if (!
|
|
41375
|
+
if (!fs72.existsSync(p)) {
|
|
40866
41376
|
return new CorpusParseResult();
|
|
40867
41377
|
}
|
|
40868
|
-
const parsed = (0, import_yaml7.parse)(
|
|
41378
|
+
const parsed = (0, import_yaml7.parse)(fs72.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
|
|
40869
41379
|
const doc = parsed === null || parsed === void 0 ? {} : parsed;
|
|
40870
41380
|
const schemaVersion = doc["schema_version"];
|
|
40871
41381
|
if (schemaVersion !== 1) {
|
|
@@ -40927,7 +41437,7 @@ function _deriveLockPath(corpusPath) {
|
|
|
40927
41437
|
}
|
|
40928
41438
|
function _loadSectionFromLock(corpusPath, section) {
|
|
40929
41439
|
const lockPath = _deriveLockPath(corpusPath);
|
|
40930
|
-
if (!
|
|
41440
|
+
if (!fs72.existsSync(lockPath)) {
|
|
40931
41441
|
return null;
|
|
40932
41442
|
}
|
|
40933
41443
|
try {
|
|
@@ -40939,10 +41449,10 @@ function _loadSectionFromLock(corpusPath, section) {
|
|
|
40939
41449
|
}
|
|
40940
41450
|
function _loadSectionLenient(corpusPath, section) {
|
|
40941
41451
|
const p = corpusPath;
|
|
40942
|
-
if (!
|
|
41452
|
+
if (!fs72.existsSync(p)) {
|
|
40943
41453
|
return [];
|
|
40944
41454
|
}
|
|
40945
|
-
const text =
|
|
41455
|
+
const text = fs72.readFileSync(p, { encoding: "utf-8" });
|
|
40946
41456
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
40947
41457
|
const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
|
|
40948
41458
|
if (bounds === null) {
|
|
@@ -41722,8 +42232,8 @@ var init_necessity = __esm({
|
|
|
41722
42232
|
});
|
|
41723
42233
|
|
|
41724
42234
|
// src/scripts/ai_council/budget_guard.ts
|
|
41725
|
-
import * as
|
|
41726
|
-
import * as
|
|
42235
|
+
import * as fs73 from "node:fs";
|
|
42236
|
+
import * as path70 from "node:path";
|
|
41727
42237
|
function _resolveLedgerPath(p) {
|
|
41728
42238
|
if (p !== null) {
|
|
41729
42239
|
return p;
|
|
@@ -41738,18 +42248,18 @@ function _nowUtcMs() {
|
|
|
41738
42248
|
return Date.now();
|
|
41739
42249
|
}
|
|
41740
42250
|
function _ensureLedgerDir(p) {
|
|
41741
|
-
const parent =
|
|
42251
|
+
const parent = path70.dirname(p);
|
|
41742
42252
|
try {
|
|
41743
|
-
|
|
42253
|
+
fs73.mkdirSync(parent, { recursive: true });
|
|
41744
42254
|
let mode;
|
|
41745
42255
|
try {
|
|
41746
|
-
mode =
|
|
42256
|
+
mode = fs73.statSync(parent).mode & 511;
|
|
41747
42257
|
} catch {
|
|
41748
42258
|
mode = 448;
|
|
41749
42259
|
}
|
|
41750
42260
|
if (mode !== 448) {
|
|
41751
42261
|
try {
|
|
41752
|
-
|
|
42262
|
+
fs73.chmodSync(parent, 448);
|
|
41753
42263
|
} catch {
|
|
41754
42264
|
}
|
|
41755
42265
|
}
|
|
@@ -41761,18 +42271,18 @@ function _ensureLedgerDir(p) {
|
|
|
41761
42271
|
}
|
|
41762
42272
|
}
|
|
41763
42273
|
function _ensureLedgerFileMode(p) {
|
|
41764
|
-
if (!
|
|
42274
|
+
if (!fs73.existsSync(p)) {
|
|
41765
42275
|
return;
|
|
41766
42276
|
}
|
|
41767
42277
|
let current;
|
|
41768
42278
|
try {
|
|
41769
|
-
current =
|
|
42279
|
+
current = fs73.statSync(p).mode & 511;
|
|
41770
42280
|
} catch {
|
|
41771
42281
|
return;
|
|
41772
42282
|
}
|
|
41773
42283
|
if (current !== 384) {
|
|
41774
42284
|
try {
|
|
41775
|
-
|
|
42285
|
+
fs73.chmodSync(p, 384);
|
|
41776
42286
|
} catch {
|
|
41777
42287
|
}
|
|
41778
42288
|
}
|
|
@@ -41924,11 +42434,11 @@ function pyNumToStr(n) {
|
|
|
41924
42434
|
}
|
|
41925
42435
|
function read_entries2(p = null) {
|
|
41926
42436
|
const resolved = _resolveLedgerPath(p);
|
|
41927
|
-
if (!
|
|
42437
|
+
if (!fs73.existsSync(resolved)) {
|
|
41928
42438
|
return [];
|
|
41929
42439
|
}
|
|
41930
42440
|
const out = [];
|
|
41931
|
-
const text =
|
|
42441
|
+
const text = fs73.readFileSync(resolved, "utf-8");
|
|
41932
42442
|
for (const rawLine of text.split(/\r\n|\r|\n/u)) {
|
|
41933
42443
|
const line = rawLine.trim();
|
|
41934
42444
|
if (line === "") {
|
|
@@ -42031,7 +42541,7 @@ function record_spend(usd, provider, model, options = {}) {
|
|
|
42031
42541
|
)}
|
|
42032
42542
|
`;
|
|
42033
42543
|
try {
|
|
42034
|
-
|
|
42544
|
+
fs73.appendFileSync(p, entry, { encoding: "utf-8" });
|
|
42035
42545
|
} catch (exc) {
|
|
42036
42546
|
process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
|
|
42037
42547
|
`);
|
|
@@ -42047,12 +42557,12 @@ function _pyRound6(value) {
|
|
|
42047
42557
|
const ndigits = 6;
|
|
42048
42558
|
const sign = value < 0 ? -1 : 1;
|
|
42049
42559
|
const abs = Math.abs(value);
|
|
42050
|
-
const
|
|
42051
|
-
if (
|
|
42560
|
+
const str4 = abs.toPrecision(17);
|
|
42561
|
+
if (str4.includes("e") || str4.includes("E")) {
|
|
42052
42562
|
const factor = 10 ** ndigits;
|
|
42053
42563
|
return value > 0 ? Math.round(abs * factor) / factor * sign : -Math.round(abs * factor) / factor;
|
|
42054
42564
|
}
|
|
42055
|
-
const [intPart, fracPartRaw = ""] =
|
|
42565
|
+
const [intPart, fracPartRaw = ""] = str4.split(".");
|
|
42056
42566
|
let fracPart = fracPartRaw;
|
|
42057
42567
|
while (fracPart.length <= ndigits) {
|
|
42058
42568
|
fracPart += "0";
|
|
@@ -42093,12 +42603,12 @@ function pyRound(value, ndigits = 0) {
|
|
|
42093
42603
|
}
|
|
42094
42604
|
const sign = value < 0 ? -1 : 1;
|
|
42095
42605
|
const abs = Math.abs(value);
|
|
42096
|
-
let
|
|
42097
|
-
if (
|
|
42606
|
+
let str4 = abs.toPrecision(17);
|
|
42607
|
+
if (str4.includes("e") || str4.includes("E")) {
|
|
42098
42608
|
const factor2 = 10 ** ndigits;
|
|
42099
42609
|
return value > 0 ? Math.round(abs * factor2) / factor2 * sign : -Math.round(abs * factor2) / factor2;
|
|
42100
42610
|
}
|
|
42101
|
-
let [intPart, fracPart = ""] =
|
|
42611
|
+
let [intPart, fracPart = ""] = str4.split(".");
|
|
42102
42612
|
while (fracPart.length <= ndigits) {
|
|
42103
42613
|
fracPart += "0";
|
|
42104
42614
|
}
|
|
@@ -42154,8 +42664,8 @@ function aggregate_scores(findings, scores) {
|
|
|
42154
42664
|
by_id.get(s.finding_id).push(s);
|
|
42155
42665
|
}
|
|
42156
42666
|
const out = /* @__PURE__ */ new Map();
|
|
42157
|
-
for (const [fid,
|
|
42158
|
-
if (
|
|
42667
|
+
for (const [fid, fs78] of by_id) {
|
|
42668
|
+
if (fs78.length === 0) {
|
|
42159
42669
|
out.set(
|
|
42160
42670
|
fid,
|
|
42161
42671
|
new ConsensusMetadata({
|
|
@@ -42171,13 +42681,13 @@ function aggregate_scores(findings, scores) {
|
|
|
42171
42681
|
);
|
|
42172
42682
|
continue;
|
|
42173
42683
|
}
|
|
42174
|
-
const mean2 =
|
|
42175
|
-
const agree_rate =
|
|
42684
|
+
const mean2 = fs78.reduce((acc, s) => acc + s.score, 0) / fs78.length;
|
|
42685
|
+
const agree_rate = fs78.filter((s) => s.agree).length / fs78.length;
|
|
42176
42686
|
const strength = mean2 / 10 * agree_rate;
|
|
42177
|
-
const dissent =
|
|
42178
|
-
const concur =
|
|
42179
|
-
const scorers =
|
|
42180
|
-
const dissent_reasons =
|
|
42687
|
+
const dissent = fs78.filter((s) => !s.agree).length;
|
|
42688
|
+
const concur = fs78.filter((s) => s.agree).length;
|
|
42689
|
+
const scorers = fs78.map((s) => s.scorer);
|
|
42690
|
+
const dissent_reasons = fs78.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
|
|
42181
42691
|
const mean_rounded = pyRound(mean2, 2);
|
|
42182
42692
|
out.set(
|
|
42183
42693
|
fid,
|
|
@@ -42652,9 +43162,9 @@ var init_stance_tally = __esm({
|
|
|
42652
43162
|
});
|
|
42653
43163
|
|
|
42654
43164
|
// src/scripts/ai_council/blind_review.ts
|
|
42655
|
-
import { createHash as
|
|
43165
|
+
import { createHash as createHash12 } from "node:crypto";
|
|
42656
43166
|
function _sha256_hex(s) {
|
|
42657
|
-
return
|
|
43167
|
+
return createHash12("sha256").update(s, "utf-8").digest("hex");
|
|
42658
43168
|
}
|
|
42659
43169
|
function deterministic_shuffle_indices(seed, n) {
|
|
42660
43170
|
const keyed = Array.from({ length: n }, (_, i) => ({ i, key: _sha256_hex(`${seed}\0${i}`) }));
|
|
@@ -44112,18 +44622,18 @@ __export(project_context_exports, {
|
|
|
44112
44622
|
REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
|
|
44113
44623
|
detect_project_context: () => detect_project_context
|
|
44114
44624
|
});
|
|
44115
|
-
import * as
|
|
44116
|
-
import * as
|
|
44625
|
+
import * as fs74 from "node:fs";
|
|
44626
|
+
import * as path71 from "node:path";
|
|
44117
44627
|
function _isPlainObject11(v) {
|
|
44118
44628
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
44119
44629
|
}
|
|
44120
44630
|
function _read_json(p) {
|
|
44121
|
-
if (!
|
|
44631
|
+
if (!fs74.existsSync(p)) {
|
|
44122
44632
|
return null;
|
|
44123
44633
|
}
|
|
44124
44634
|
let raw;
|
|
44125
44635
|
try {
|
|
44126
|
-
raw =
|
|
44636
|
+
raw = fs74.readFileSync(p, "utf-8");
|
|
44127
44637
|
} catch {
|
|
44128
44638
|
return null;
|
|
44129
44639
|
}
|
|
@@ -44145,7 +44655,7 @@ function _name_from(composer, pkg, root) {
|
|
|
44145
44655
|
}
|
|
44146
44656
|
}
|
|
44147
44657
|
try {
|
|
44148
|
-
const base =
|
|
44658
|
+
const base = path71.basename(root);
|
|
44149
44659
|
return base || null;
|
|
44150
44660
|
} catch {
|
|
44151
44661
|
return null;
|
|
@@ -44214,12 +44724,12 @@ function _splitlines10(text) {
|
|
|
44214
44724
|
return parts;
|
|
44215
44725
|
}
|
|
44216
44726
|
function _purpose_from_readme(p) {
|
|
44217
|
-
if (!
|
|
44727
|
+
if (!fs74.existsSync(p)) {
|
|
44218
44728
|
return null;
|
|
44219
44729
|
}
|
|
44220
44730
|
let text;
|
|
44221
44731
|
try {
|
|
44222
|
-
text =
|
|
44732
|
+
text = fs74.readFileSync(p, "utf-8");
|
|
44223
44733
|
} catch {
|
|
44224
44734
|
return null;
|
|
44225
44735
|
}
|
|
@@ -44303,13 +44813,13 @@ function _rfind(haystack, needle) {
|
|
|
44303
44813
|
return -1;
|
|
44304
44814
|
}
|
|
44305
44815
|
function detect_project_context(root) {
|
|
44306
|
-
const resolvedRoot =
|
|
44307
|
-
const composer = _read_json(
|
|
44308
|
-
const pkg = _read_json(
|
|
44816
|
+
const resolvedRoot = path71.resolve(root ?? process.cwd());
|
|
44817
|
+
const composer = _read_json(path71.join(resolvedRoot, "composer.json"));
|
|
44818
|
+
const pkg = _read_json(path71.join(resolvedRoot, "package.json"));
|
|
44309
44819
|
return new ProjectContext(
|
|
44310
44820
|
_name_from(composer, pkg, resolvedRoot),
|
|
44311
44821
|
_stack_from(composer, pkg),
|
|
44312
|
-
_purpose_from_readme(
|
|
44822
|
+
_purpose_from_readme(path71.join(resolvedRoot, "README.md"))
|
|
44313
44823
|
);
|
|
44314
44824
|
}
|
|
44315
44825
|
var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
|
|
@@ -44579,8 +45089,8 @@ __export(shadow_dispatch_exports, {
|
|
|
44579
45089
|
slo_banner: () => slo_banner,
|
|
44580
45090
|
slo_status: () => slo_status
|
|
44581
45091
|
});
|
|
44582
|
-
import * as
|
|
44583
|
-
import { createHash as
|
|
45092
|
+
import * as fs75 from "node:fs";
|
|
45093
|
+
import { createHash as createHash13 } from "node:crypto";
|
|
44584
45094
|
function should_shadow(sampleRate, opts = {}) {
|
|
44585
45095
|
const rate = Math.max(0, Math.min(1, sampleRate));
|
|
44586
45096
|
const rng = opts.rng ?? null;
|
|
@@ -44589,7 +45099,7 @@ function should_shadow(sampleRate, opts = {}) {
|
|
|
44589
45099
|
}
|
|
44590
45100
|
function _hashQuery(query) {
|
|
44591
45101
|
const redacted = redact(query);
|
|
44592
|
-
return
|
|
45102
|
+
return createHash13("sha256").update(Buffer.from(redacted, "utf-8")).digest("hex").slice(0, 16);
|
|
44593
45103
|
}
|
|
44594
45104
|
function _privacyDropped(redacted) {
|
|
44595
45105
|
const stripped = _strip7(redacted);
|
|
@@ -44617,7 +45127,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
44617
45127
|
escalated,
|
|
44618
45128
|
escalation_reason: escalationReason
|
|
44619
45129
|
};
|
|
44620
|
-
|
|
45130
|
+
fs75.mkdirSync(_dirname2(logPath), { recursive: true });
|
|
44621
45131
|
const row = _pyJsonDumps2({
|
|
44622
45132
|
timestamp: decision.timestamp,
|
|
44623
45133
|
query_hash: decision.query_hash,
|
|
@@ -44627,7 +45137,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
44627
45137
|
escalated: decision.escalated,
|
|
44628
45138
|
escalation_reason: decision.escalation_reason
|
|
44629
45139
|
}) + "\n";
|
|
44630
|
-
|
|
45140
|
+
fs75.appendFileSync(logPath, row, { encoding: "utf-8" });
|
|
44631
45141
|
return decision;
|
|
44632
45142
|
}
|
|
44633
45143
|
function _isoNowSeconds() {
|
|
@@ -44636,10 +45146,10 @@ function _isoNowSeconds() {
|
|
|
44636
45146
|
return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}+00:00`;
|
|
44637
45147
|
}
|
|
44638
45148
|
function* _iterLog(logPath) {
|
|
44639
|
-
if (!
|
|
45149
|
+
if (!fs75.existsSync(logPath)) {
|
|
44640
45150
|
return;
|
|
44641
45151
|
}
|
|
44642
|
-
const content =
|
|
45152
|
+
const content = fs75.readFileSync(logPath, { encoding: "utf-8" });
|
|
44643
45153
|
for (const rawLine of _splitlines11(content)) {
|
|
44644
45154
|
const line = _strip7(rawLine);
|
|
44645
45155
|
if (!line) {
|
|
@@ -45561,11 +46071,11 @@ __export(council_cli_exports, {
|
|
|
45561
46071
|
cmd_status: () => cmd_status,
|
|
45562
46072
|
format_estimate_table: () => format_estimate_table,
|
|
45563
46073
|
load_settings: () => load_settings,
|
|
45564
|
-
main: () =>
|
|
46074
|
+
main: () => main34
|
|
45565
46075
|
});
|
|
45566
|
-
import * as
|
|
45567
|
-
import * as
|
|
45568
|
-
import { fileURLToPath as
|
|
46076
|
+
import * as fs76 from "node:fs";
|
|
46077
|
+
import * as path72 from "node:path";
|
|
46078
|
+
import { fileURLToPath as fileURLToPath45, pathToFileURL as pathToFileURL34 } from "node:url";
|
|
45569
46079
|
function _pyFixed6(x, ndigits) {
|
|
45570
46080
|
if (!Number.isFinite(x)) {
|
|
45571
46081
|
return String(x);
|
|
@@ -45773,7 +46283,7 @@ function _stderr2(s) {
|
|
|
45773
46283
|
function load_settings(p = SETTINGS_FILE2, opts = {}) {
|
|
45774
46284
|
const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
|
|
45775
46285
|
const settings = load_agent_settings({ project_path: p });
|
|
45776
|
-
if (
|
|
46286
|
+
if (fs76.existsSync(ai_council_path)) {
|
|
45777
46287
|
const cfg = load_council_config(ai_council_path);
|
|
45778
46288
|
settings["ai_council"] = _synthesize_ai_council_block(cfg);
|
|
45779
46289
|
}
|
|
@@ -46282,7 +46792,7 @@ function build_question(opts) {
|
|
|
46282
46792
|
let ctx;
|
|
46283
46793
|
let artefact;
|
|
46284
46794
|
if (input_mode === "prompt") {
|
|
46285
|
-
const text =
|
|
46795
|
+
const text = fs76.readFileSync(input_path, "utf-8");
|
|
46286
46796
|
ctx = bundle_prompt(text);
|
|
46287
46797
|
artefact = String(input_path);
|
|
46288
46798
|
} else if (input_mode === "roadmap") {
|
|
@@ -46425,9 +46935,9 @@ function _maybe_write_decision_replay(opts) {
|
|
|
46425
46935
|
include_member_arguments: include_args
|
|
46426
46936
|
})
|
|
46427
46937
|
);
|
|
46428
|
-
const target =
|
|
46429
|
-
|
|
46430
|
-
|
|
46938
|
+
const target = path72.join(path72.dirname(opts.out_path), "decision-replay.md");
|
|
46939
|
+
fs76.mkdirSync(path72.dirname(target), { recursive: true });
|
|
46940
|
+
fs76.writeFileSync(target, replay, { encoding: "utf-8" });
|
|
46431
46941
|
return target;
|
|
46432
46942
|
}
|
|
46433
46943
|
function _peer_review_active(ai_cfg, args) {
|
|
@@ -47116,7 +47626,7 @@ function cmd_status(args, opts = {}) {
|
|
|
47116
47626
|
const env = opts.env ?? process.env;
|
|
47117
47627
|
const override = env[COUNCIL_CONFIG_ENV];
|
|
47118
47628
|
const path_ = resolve_config_path(REPO_ROOT11, { env });
|
|
47119
|
-
const exists3 =
|
|
47629
|
+
const exists3 = fs76.existsSync(String(path_));
|
|
47120
47630
|
const provenance = override ? `${COUNCIL_CONFIG_ENV} override` : "user-global";
|
|
47121
47631
|
let cfg = null;
|
|
47122
47632
|
let parse_error = null;
|
|
@@ -47526,8 +48036,8 @@ function cmd_run(args, opts = {}) {
|
|
|
47526
48036
|
kind: "responses",
|
|
47527
48037
|
subcommand: "run"
|
|
47528
48038
|
});
|
|
47529
|
-
|
|
47530
|
-
|
|
48039
|
+
fs76.mkdirSync(path72.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
48040
|
+
fs76.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
|
|
47531
48041
|
_stdout2(
|
|
47532
48042
|
`
|
|
47533
48043
|
council:run \xB7 wrote ${out_path} (estimated $${_pyFixed6(estimated_total, 4)} / actual $${_pyFixed6(actual_total, 4)})
|
|
@@ -47552,7 +48062,7 @@ function _debate_round_filename(round_number) {
|
|
|
47552
48062
|
return `debate-round-${round_number}.json`;
|
|
47553
48063
|
}
|
|
47554
48064
|
function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
47555
|
-
|
|
48065
|
+
fs76.mkdirSync(_resolveTarget(out_dir), { recursive: true });
|
|
47556
48066
|
let actual_total = 0;
|
|
47557
48067
|
for (const r of responses) {
|
|
47558
48068
|
if (r.error) {
|
|
@@ -47576,15 +48086,15 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
|
47576
48086
|
prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
|
|
47577
48087
|
responses: _serialise_responses(responses)
|
|
47578
48088
|
};
|
|
47579
|
-
const out_path =
|
|
47580
|
-
|
|
48089
|
+
const out_path = path72.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
|
|
48090
|
+
fs76.writeFileSync(out_path, _jsonDumpsIndent22(payload) + "\n", { encoding: "utf-8" });
|
|
47581
48091
|
return out_path;
|
|
47582
48092
|
}
|
|
47583
48093
|
function _load_debate_seed(p, expected_members) {
|
|
47584
|
-
if (!
|
|
48094
|
+
if (!fs76.existsSync(p)) {
|
|
47585
48095
|
throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
|
|
47586
48096
|
}
|
|
47587
|
-
const payload = JSON.parse(
|
|
48097
|
+
const payload = JSON.parse(fs76.readFileSync(p, "utf-8"));
|
|
47588
48098
|
const source_members = (payload["members"] || []).slice();
|
|
47589
48099
|
const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
|
|
47590
48100
|
if (!_listEq(source_members, expected_labels)) {
|
|
@@ -47630,7 +48140,7 @@ function _readStdinLine() {
|
|
|
47630
48140
|
try {
|
|
47631
48141
|
const buf = Buffer.alloc(4096);
|
|
47632
48142
|
const fd = 0;
|
|
47633
|
-
const n =
|
|
48143
|
+
const n = fs76.readSync(fd, buf, 0, buf.length, null);
|
|
47634
48144
|
return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
|
|
47635
48145
|
} catch {
|
|
47636
48146
|
return "";
|
|
@@ -47859,7 +48369,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
|
|
|
47859
48369
|
return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
|
|
47860
48370
|
}
|
|
47861
48371
|
function cmd_render(args) {
|
|
47862
|
-
const payload = JSON.parse(
|
|
48372
|
+
const payload = JSON.parse(fs76.readFileSync(args.responses, "utf-8"));
|
|
47863
48373
|
const items = payload["responses"] || [];
|
|
47864
48374
|
const explicit = _getattr3(args, "prompt_mode", null);
|
|
47865
48375
|
const mode = explicit || payload["prompt_mode"] || payload["mode"];
|
|
@@ -47888,8 +48398,8 @@ function cmd_render(args) {
|
|
|
47888
48398
|
kind: "sessions",
|
|
47889
48399
|
subcommand: "render"
|
|
47890
48400
|
});
|
|
47891
|
-
|
|
47892
|
-
|
|
48401
|
+
fs76.mkdirSync(path72.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
48402
|
+
fs76.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
|
|
47893
48403
|
_stdout2(`council:render \xB7 wrote ${out_path}
|
|
47894
48404
|
`);
|
|
47895
48405
|
return 0;
|
|
@@ -47900,15 +48410,15 @@ function cmd_render(args) {
|
|
|
47900
48410
|
function _cmd_replay_low_impact_stats(args) {
|
|
47901
48411
|
const li = low_impact_exports;
|
|
47902
48412
|
const responses_path = args.responses;
|
|
47903
|
-
const log_path =
|
|
47904
|
-
if (!
|
|
48413
|
+
const log_path = path72.join(path72.dirname(responses_path), "low-impact-resolutions.md");
|
|
48414
|
+
if (!fs76.existsSync(log_path)) {
|
|
47905
48415
|
_stdout2(
|
|
47906
48416
|
`council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
|
|
47907
48417
|
`
|
|
47908
48418
|
);
|
|
47909
48419
|
return 0;
|
|
47910
48420
|
}
|
|
47911
|
-
const body =
|
|
48421
|
+
const body = fs76.readFileSync(log_path, "utf-8");
|
|
47912
48422
|
const stats = li.parse_low_impact_log(body);
|
|
47913
48423
|
const out = li.render_low_impact_stats(stats);
|
|
47914
48424
|
if (_getattr3(args, "output", null)) {
|
|
@@ -47916,8 +48426,8 @@ function _cmd_replay_low_impact_stats(args) {
|
|
|
47916
48426
|
kind: "sessions",
|
|
47917
48427
|
subcommand: "replay"
|
|
47918
48428
|
});
|
|
47919
|
-
|
|
47920
|
-
|
|
48429
|
+
fs76.mkdirSync(path72.dirname(_resolveTarget(target)), { recursive: true });
|
|
48430
|
+
fs76.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
|
|
47921
48431
|
_stdout2(`council:replay \xB7 wrote ${target}
|
|
47922
48432
|
`);
|
|
47923
48433
|
return 0;
|
|
@@ -47929,7 +48439,7 @@ function cmd_replay(args) {
|
|
|
47929
48439
|
if (_getattr3(args, "low_impact_stats", false)) {
|
|
47930
48440
|
return _cmd_replay_low_impact_stats(args);
|
|
47931
48441
|
}
|
|
47932
|
-
const payload = JSON.parse(
|
|
48442
|
+
const payload = JSON.parse(fs76.readFileSync(args.responses, "utf-8"));
|
|
47933
48443
|
const consensus = _deserialise_consensus(payload["consensus"]);
|
|
47934
48444
|
if (consensus === null) {
|
|
47935
48445
|
_stderr2(
|
|
@@ -47954,8 +48464,8 @@ function cmd_replay(args) {
|
|
|
47954
48464
|
kind: "sessions",
|
|
47955
48465
|
subcommand: "replay"
|
|
47956
48466
|
});
|
|
47957
|
-
|
|
47958
|
-
|
|
48467
|
+
fs76.mkdirSync(path72.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
48468
|
+
fs76.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
|
|
47959
48469
|
_stdout2(`council:replay \xB7 wrote ${out_path}
|
|
47960
48470
|
`);
|
|
47961
48471
|
} else {
|
|
@@ -48012,8 +48522,8 @@ function cmd_quota(args, opts = {}) {
|
|
|
48012
48522
|
}
|
|
48013
48523
|
function _validate_council_output_path(path_str, opts) {
|
|
48014
48524
|
const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
|
|
48015
|
-
const expected_abs = _resolveReal(
|
|
48016
|
-
const target =
|
|
48525
|
+
const expected_abs = _resolveReal(path72.join(REPO_ROOT11, expected_rel));
|
|
48526
|
+
const target = path72.isAbsolute(path_str) ? path_str : path72.join(REPO_ROOT11, path_str);
|
|
48017
48527
|
const target_resolved = _resolveReal(target);
|
|
48018
48528
|
if (!_isRelativeTo(target_resolved, expected_abs)) {
|
|
48019
48529
|
throw new ArgumentTypeError(
|
|
@@ -48023,12 +48533,12 @@ function _validate_council_output_path(path_str, opts) {
|
|
|
48023
48533
|
return path_str;
|
|
48024
48534
|
}
|
|
48025
48535
|
function _resolveTarget(path_str) {
|
|
48026
|
-
return
|
|
48536
|
+
return path72.isAbsolute(path_str) ? path_str : path72.join(REPO_ROOT11, path_str);
|
|
48027
48537
|
}
|
|
48028
48538
|
function _resolveReal(p) {
|
|
48029
|
-
const abs =
|
|
48539
|
+
const abs = path72.resolve(p);
|
|
48030
48540
|
try {
|
|
48031
|
-
return
|
|
48541
|
+
return fs76.realpathSync(abs);
|
|
48032
48542
|
} catch {
|
|
48033
48543
|
return abs;
|
|
48034
48544
|
}
|
|
@@ -48037,8 +48547,8 @@ function _isRelativeTo(target, base) {
|
|
|
48037
48547
|
if (target === base) {
|
|
48038
48548
|
return true;
|
|
48039
48549
|
}
|
|
48040
|
-
const rel =
|
|
48041
|
-
return rel !== "" && !rel.startsWith("..") && !
|
|
48550
|
+
const rel = path72.relative(base, target);
|
|
48551
|
+
return rel !== "" && !rel.startsWith("..") && !path72.isAbsolute(rel);
|
|
48042
48552
|
}
|
|
48043
48553
|
function _topError(message) {
|
|
48044
48554
|
_stderr2(_TOP_USAGE2);
|
|
@@ -48363,7 +48873,7 @@ function _parse_siblings_overrides(items) {
|
|
|
48363
48873
|
function _isFileNotFound(exc) {
|
|
48364
48874
|
return exc instanceof FileNotFoundError3 || exc instanceof Error && exc.code === "ENOENT";
|
|
48365
48875
|
}
|
|
48366
|
-
function
|
|
48876
|
+
function main34(argv = null) {
|
|
48367
48877
|
const args = _parseArgs7(argv ?? process.argv.slice(2));
|
|
48368
48878
|
try {
|
|
48369
48879
|
if (args.cmd === "estimate") {
|
|
@@ -48405,17 +48915,17 @@ function main33(argv = null) {
|
|
|
48405
48915
|
}
|
|
48406
48916
|
return 1;
|
|
48407
48917
|
}
|
|
48408
|
-
function
|
|
48918
|
+
function _isCliEntry31() {
|
|
48409
48919
|
if (process.argv[1] === void 0) {
|
|
48410
48920
|
return false;
|
|
48411
48921
|
}
|
|
48412
|
-
const argvUrl =
|
|
48922
|
+
const argvUrl = pathToFileURL34(path72.resolve(process.argv[1])).href;
|
|
48413
48923
|
if (import.meta.url === argvUrl) {
|
|
48414
48924
|
return true;
|
|
48415
48925
|
}
|
|
48416
48926
|
try {
|
|
48417
|
-
const here =
|
|
48418
|
-
const argv =
|
|
48927
|
+
const here = fs76.realpathSync(fileURLToPath45(import.meta.url));
|
|
48928
|
+
const argv = fs76.realpathSync(path72.resolve(process.argv[1]));
|
|
48419
48929
|
return here === argv;
|
|
48420
48930
|
} catch {
|
|
48421
48931
|
return false;
|
|
@@ -48473,7 +48983,7 @@ var init_council_cli = __esm({
|
|
|
48473
48983
|
"xai",
|
|
48474
48984
|
"perplexity"
|
|
48475
48985
|
]);
|
|
48476
|
-
_HERE22 =
|
|
48986
|
+
_HERE22 = path72.dirname(fileURLToPath45(import.meta.url));
|
|
48477
48987
|
[REPO_ROOT11] = resolve_project_root(null);
|
|
48478
48988
|
SETTINGS_FILE2 = project_settings_path(REPO_ROOT11);
|
|
48479
48989
|
AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT11);
|
|
@@ -48506,9 +49016,9 @@ var init_council_cli = __esm({
|
|
|
48506
49016
|
{estimate,run,debate,render,replay,quota,shadow-report,status}
|
|
48507
49017
|
...
|
|
48508
49018
|
`;
|
|
48509
|
-
if (
|
|
49019
|
+
if (_isCliEntry31()) {
|
|
48510
49020
|
try {
|
|
48511
|
-
process.exitCode =
|
|
49021
|
+
process.exitCode = main34(process.argv.slice(2));
|
|
48512
49022
|
} catch (err) {
|
|
48513
49023
|
if (!(err instanceof _ArgExit2)) {
|
|
48514
49024
|
throw err;
|
|
@@ -48537,7 +49047,7 @@ function run_enveloped(spec) {
|
|
|
48537
49047
|
if (cmd === void 0) {
|
|
48538
49048
|
throw new Error("envelope argv must not be empty");
|
|
48539
49049
|
}
|
|
48540
|
-
return new Promise((
|
|
49050
|
+
return new Promise((resolve43) => {
|
|
48541
49051
|
execFile(
|
|
48542
49052
|
cmd,
|
|
48543
49053
|
args,
|
|
@@ -48560,7 +49070,7 @@ function run_enveloped(spec) {
|
|
|
48560
49070
|
}
|
|
48561
49071
|
const [out, outTrunc] = _truncate(String(stdout ?? ""), spec.max_output_bytes);
|
|
48562
49072
|
const [err, errTrunc] = _truncate(String(stderr ?? ""), spec.max_output_bytes);
|
|
48563
|
-
|
|
49073
|
+
resolve43({
|
|
48564
49074
|
exit_code: timedOut ? null : exitCode,
|
|
48565
49075
|
timed_out: timedOut,
|
|
48566
49076
|
stdout: out,
|
|
@@ -48581,8 +49091,8 @@ var init_safety_envelope = __esm({
|
|
|
48581
49091
|
});
|
|
48582
49092
|
|
|
48583
49093
|
// src/scripts/mcp_server/__main__.ts
|
|
48584
|
-
import * as
|
|
48585
|
-
import { fileURLToPath as
|
|
49094
|
+
import * as path74 from "node:path";
|
|
49095
|
+
import { fileURLToPath as fileURLToPath47 } from "node:url";
|
|
48586
49096
|
|
|
48587
49097
|
// src/scripts/mcp_server/index.ts
|
|
48588
49098
|
var __version__ = "0.1.0";
|
|
@@ -48629,9 +49139,9 @@ init_prompts();
|
|
|
48629
49139
|
init_resources();
|
|
48630
49140
|
|
|
48631
49141
|
// src/scripts/mcp_server/tools.ts
|
|
48632
|
-
import * as
|
|
48633
|
-
import * as
|
|
48634
|
-
import { fileURLToPath as
|
|
49142
|
+
import * as fs77 from "node:fs";
|
|
49143
|
+
import * as path73 from "node:path";
|
|
49144
|
+
import { fileURLToPath as fileURLToPath46 } from "node:url";
|
|
48635
49145
|
|
|
48636
49146
|
// src/scripts/chat_history.ts
|
|
48637
49147
|
init_memory_lookup();
|
|
@@ -50864,9 +51374,9 @@ function _strip8(s) {
|
|
|
50864
51374
|
}
|
|
50865
51375
|
function _resolvePath2(p) {
|
|
50866
51376
|
try {
|
|
50867
|
-
return
|
|
51377
|
+
return fs77.realpathSync(p);
|
|
50868
51378
|
} catch {
|
|
50869
|
-
return
|
|
51379
|
+
return path73.resolve(p);
|
|
50870
51380
|
}
|
|
50871
51381
|
}
|
|
50872
51382
|
function _resolveConsumerRoot(override) {
|
|
@@ -50876,14 +51386,14 @@ function _resolveConsumerRoot(override) {
|
|
|
50876
51386
|
return _resolvePath2(process.cwd());
|
|
50877
51387
|
}
|
|
50878
51388
|
function _relativeUnder(target, root) {
|
|
50879
|
-
const rel =
|
|
51389
|
+
const rel = path73.relative(root, target);
|
|
50880
51390
|
if (rel === "") {
|
|
50881
51391
|
return "";
|
|
50882
51392
|
}
|
|
50883
|
-
if (rel.startsWith("..") ||
|
|
51393
|
+
if (rel.startsWith("..") || path73.isAbsolute(rel)) {
|
|
50884
51394
|
return null;
|
|
50885
51395
|
}
|
|
50886
|
-
return rel.split(
|
|
51396
|
+
return rel.split(path73.sep).join("/");
|
|
50887
51397
|
}
|
|
50888
51398
|
function _reprStrList(values) {
|
|
50889
51399
|
return `[${values.map((v) => `'${v}'`).join(", ")}]`;
|
|
@@ -50892,11 +51402,11 @@ function _validateInTreePath(raw, consumerRoot) {
|
|
|
50892
51402
|
const root = _resolvePath2(consumerRoot);
|
|
50893
51403
|
let target;
|
|
50894
51404
|
if (raw === null || raw === void 0 || raw === "") {
|
|
50895
|
-
target =
|
|
50896
|
-
} else if (
|
|
51405
|
+
target = path73.join(root, "agents", "runtime", ".agent-chat-history");
|
|
51406
|
+
} else if (path73.isAbsolute(raw)) {
|
|
50897
51407
|
target = _resolvePath2(raw);
|
|
50898
51408
|
} else {
|
|
50899
|
-
target = _resolvePath2(
|
|
51409
|
+
target = _resolvePath2(path73.join(root, raw));
|
|
50900
51410
|
}
|
|
50901
51411
|
const rel = _relativeUnder(target, root);
|
|
50902
51412
|
if (rel === null) {
|
|
@@ -50934,11 +51444,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
|
|
|
50934
51444
|
if (typeof raw !== "string") {
|
|
50935
51445
|
throw new Error("'paths' entries must be strings");
|
|
50936
51446
|
}
|
|
50937
|
-
const resolved =
|
|
51447
|
+
const resolved = path73.isAbsolute(raw) ? _resolvePath2(raw) : _resolvePath2(path73.join(root, raw));
|
|
50938
51448
|
if (_relativeUnder(resolved, root) === null) {
|
|
50939
51449
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
50940
51450
|
}
|
|
50941
|
-
if (
|
|
51451
|
+
if (fs77.existsSync(resolved)) {
|
|
50942
51452
|
paths.push(resolved);
|
|
50943
51453
|
}
|
|
50944
51454
|
}
|
|
@@ -50975,7 +51485,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
50975
51485
|
if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
|
|
50976
51486
|
throw new Error("'min_schema_version' must be an integer");
|
|
50977
51487
|
}
|
|
50978
|
-
const existingHeader =
|
|
51488
|
+
const existingHeader = fs77.existsSync(target) ? _chReadHeader(target) : null;
|
|
50979
51489
|
const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
|
|
50980
51490
|
if (observed < minSchema) {
|
|
50981
51491
|
throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
|
|
@@ -50990,8 +51500,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
50990
51500
|
session: session === void 0 ? null : session
|
|
50991
51501
|
};
|
|
50992
51502
|
}
|
|
50993
|
-
if (!
|
|
50994
|
-
|
|
51503
|
+
if (!fs77.existsSync(target) || _chReadHeader(target) === null) {
|
|
51504
|
+
fs77.mkdirSync(path73.dirname(target), { recursive: true });
|
|
50995
51505
|
_chInit(target);
|
|
50996
51506
|
}
|
|
50997
51507
|
_chAppend(entry, target, session ?? null);
|
|
@@ -51035,7 +51545,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
|
|
|
51035
51545
|
if (detail !== "full" && detail !== "index") {
|
|
51036
51546
|
throw new Error("'detail' must be 'index' or 'full'");
|
|
51037
51547
|
}
|
|
51038
|
-
if (!
|
|
51548
|
+
if (!fs77.existsSync(target)) {
|
|
51039
51549
|
return { path: target, entries: [], count: 0 };
|
|
51040
51550
|
}
|
|
51041
51551
|
if (around !== void 0 && around !== null) {
|
|
@@ -51137,8 +51647,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
|
|
|
51137
51647
|
}
|
|
51138
51648
|
return result;
|
|
51139
51649
|
}
|
|
51140
|
-
var _PACKAGE_ROOT3 =
|
|
51141
|
-
|
|
51650
|
+
var _PACKAGE_ROOT3 = path73.resolve(
|
|
51651
|
+
path73.dirname(fileURLToPath46(import.meta.url)),
|
|
51142
51652
|
"..",
|
|
51143
51653
|
"..",
|
|
51144
51654
|
".."
|
|
@@ -51182,10 +51692,10 @@ async function _memorySignalHandler(args, consumerRoot) {
|
|
|
51182
51692
|
async function _roadmapProgressHandler(args, consumerRoot) {
|
|
51183
51693
|
const dryRun = _pyTruthy6(args.dry_run ?? false);
|
|
51184
51694
|
const root = _resolvePath2(consumerRoot);
|
|
51185
|
-
const roadmapRoot =
|
|
51186
|
-
const target =
|
|
51695
|
+
const roadmapRoot = path73.join(root, "agents", "roadmaps");
|
|
51696
|
+
const target = path73.join(root, "agents", "roadmaps-progress.md");
|
|
51187
51697
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
51188
|
-
if (!
|
|
51698
|
+
if (!fs77.existsSync(roadmapRoot)) {
|
|
51189
51699
|
return {
|
|
51190
51700
|
written: false,
|
|
51191
51701
|
path: target,
|
|
@@ -51200,7 +51710,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
|
|
|
51200
51710
|
const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
|
|
51201
51711
|
const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
|
|
51202
51712
|
if (!dryRun) {
|
|
51203
|
-
|
|
51713
|
+
fs77.writeFileSync(target, content, "utf-8");
|
|
51204
51714
|
}
|
|
51205
51715
|
return {
|
|
51206
51716
|
written: !dryRun,
|
|
@@ -51221,11 +51731,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
51221
51731
|
let dashboardRegenerated = false;
|
|
51222
51732
|
if (archived.length > 0) {
|
|
51223
51733
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
51224
|
-
const roadmapRoot =
|
|
51225
|
-
if (
|
|
51734
|
+
const roadmapRoot = path73.join(root, "agents", "roadmaps");
|
|
51735
|
+
if (fs77.existsSync(roadmapRoot)) {
|
|
51226
51736
|
const roadmaps = urp.collect(roadmapRoot);
|
|
51227
|
-
|
|
51228
|
-
|
|
51737
|
+
fs77.writeFileSync(
|
|
51738
|
+
path73.join(root, "agents", "roadmaps-progress.md"),
|
|
51229
51739
|
urp.render(roadmaps, urp.collect_bundles(root)),
|
|
51230
51740
|
"utf-8"
|
|
51231
51741
|
);
|
|
@@ -51241,9 +51751,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
51241
51751
|
async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
51242
51752
|
const check = _pyTruthy6(args.check ?? false);
|
|
51243
51753
|
const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
|
|
51244
|
-
const out =
|
|
51754
|
+
const out = path73.join(_PACKAGE_ROOT3, "CAPABILITIES.yaml");
|
|
51245
51755
|
const content = cap.build();
|
|
51246
|
-
const onDisk =
|
|
51756
|
+
const onDisk = fs77.existsSync(out) ? fs77.readFileSync(out, "utf-8") : "";
|
|
51247
51757
|
const drift = onDisk !== content;
|
|
51248
51758
|
if (check) {
|
|
51249
51759
|
return { check: true, written: false, drift, path: out };
|
|
@@ -51254,7 +51764,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
|
51254
51764
|
`CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
|
|
51255
51765
|
);
|
|
51256
51766
|
}
|
|
51257
|
-
|
|
51767
|
+
fs77.writeFileSync(out, content, "utf-8");
|
|
51258
51768
|
return { check: false, written: true, drift, path: out };
|
|
51259
51769
|
}
|
|
51260
51770
|
async function _runDoctorLeg(consumerRoot) {
|
|
@@ -51354,11 +51864,11 @@ async function _councilEstimateHandler(args, consumerRoot) {
|
|
|
51354
51864
|
throw new Error("'depth' must be 'shallow' or 'deep' when provided");
|
|
51355
51865
|
}
|
|
51356
51866
|
const root = _resolvePath2(consumerRoot);
|
|
51357
|
-
const target =
|
|
51867
|
+
const target = path73.isAbsolute(inputRaw) ? _resolvePath2(inputRaw) : _resolvePath2(path73.join(root, inputRaw));
|
|
51358
51868
|
if (_relativeUnder(target, root) === null) {
|
|
51359
51869
|
throw new Error(`path escapes consumer_root: ${target}`);
|
|
51360
51870
|
}
|
|
51361
|
-
if (!
|
|
51871
|
+
if (!fs77.existsSync(target)) {
|
|
51362
51872
|
throw new Error(`input_path not found: ${target}`);
|
|
51363
51873
|
}
|
|
51364
51874
|
const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
|
|
@@ -51420,18 +51930,18 @@ async function _runTestsHandler(args, consumerRoot) {
|
|
|
51420
51930
|
if (typeof relPathRaw !== "string" || !_strip8(relPathRaw)) {
|
|
51421
51931
|
throw new Error("'path' must be a non-empty string when provided");
|
|
51422
51932
|
}
|
|
51423
|
-
const resolved =
|
|
51933
|
+
const resolved = path73.isAbsolute(relPathRaw) ? _resolvePath2(relPathRaw) : _resolvePath2(path73.join(root, relPathRaw));
|
|
51424
51934
|
const rel = _relativeUnder(resolved, root);
|
|
51425
51935
|
if (rel === null) {
|
|
51426
51936
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
51427
51937
|
}
|
|
51428
|
-
if (!
|
|
51938
|
+
if (!fs77.existsSync(resolved)) {
|
|
51429
51939
|
throw new Error(`path not found: ${resolved}`);
|
|
51430
51940
|
}
|
|
51431
51941
|
relArg = rel;
|
|
51432
51942
|
}
|
|
51433
|
-
const vitestEntry =
|
|
51434
|
-
if (!
|
|
51943
|
+
const vitestEntry = path73.join(root, "node_modules", "vitest", "vitest.mjs");
|
|
51944
|
+
if (!fs77.existsSync(vitestEntry)) {
|
|
51435
51945
|
throw new Error(
|
|
51436
51946
|
"run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
|
|
51437
51947
|
);
|
|
@@ -52037,8 +52547,8 @@ function _strCmp3(a, b) {
|
|
|
52037
52547
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
52038
52548
|
}
|
|
52039
52549
|
function _pathlibCompare3(a, b) {
|
|
52040
|
-
const pa = a.split(
|
|
52041
|
-
const pb = b.split(
|
|
52550
|
+
const pa = a.split(path73.sep);
|
|
52551
|
+
const pb = b.split(path73.sep);
|
|
52042
52552
|
const n = Math.min(pa.length, pb.length);
|
|
52043
52553
|
for (let i = 0; i < n; i++) {
|
|
52044
52554
|
const c = _strCmp3(pa[i], pb[i]);
|
|
@@ -52257,18 +52767,18 @@ async function _serveOverSdk(server) {
|
|
|
52257
52767
|
const transport = new StdioServerTransport();
|
|
52258
52768
|
await sdkServer.connect(transport);
|
|
52259
52769
|
}
|
|
52260
|
-
function
|
|
52770
|
+
function main35() {
|
|
52261
52771
|
void run_stdio();
|
|
52262
52772
|
}
|
|
52263
52773
|
|
|
52264
52774
|
// src/scripts/mcp_server/__main__.ts
|
|
52265
|
-
var _selfPath =
|
|
52266
|
-
var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 &&
|
|
52775
|
+
var _selfPath = fileURLToPath47(import.meta.url);
|
|
52776
|
+
var _invokedDirectly2 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path74.resolve(process.argv[1]) === path74.resolve(_selfPath);
|
|
52267
52777
|
if (_invokedDirectly2) {
|
|
52268
|
-
|
|
52778
|
+
main35();
|
|
52269
52779
|
}
|
|
52270
52780
|
export {
|
|
52271
|
-
|
|
52781
|
+
main35 as main
|
|
52272
52782
|
};
|
|
52273
52783
|
/*! Bundled license information:
|
|
52274
52784
|
|