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