@event4u/agent-config 16.4.0 → 16.5.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/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +40 -191
- package/README.md +1 -1
- package/dist/agent-src/commands/design.md +1 -1
- package/dist/agent-src/guidelines/design-antipatterns.md +1 -1
- package/dist/agent-src/rules/token-budget-discipline.md +2 -2
- package/dist/agent-src/skills/accessibility-auditor/data/aria-patterns.csv +2 -0
- package/dist/agent-src/skills/accessibility-auditor/data/manifest.json +3 -3
- package/dist/agent-src/skills/canvas-design/SKILL.md +4 -2
- package/dist/agent-src/skills/design-intelligence/references/integration-mapping.md +13 -10
- package/dist/agent-src/skills/fe-design/references/design-patterns.md +49 -2
- package/dist/agent-src/skills/frontend-render-security/SKILL.md +9 -0
- package/dist/agent-src/skills/iconography/SKILL.md +4 -2
- package/dist/agent-src/skills/image-provider-routing/SKILL.md +16 -5
- package/dist/agent-src/skills/logo-generation/SKILL.md +12 -8
- package/dist/agent-src/skills/svg-authoring/SKILL.md +318 -0
- package/dist/agent-src/skills/wireframe/SKILL.md +5 -2
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli/commands/uiRender.js +201 -4
- package/dist/cli/commands/uiRenderAsset.js +1308 -0
- package/dist/cli/commands/uiRenderAssetCompare.js +752 -0
- package/dist/cli/commands/uiRenderAssetGrid.js +265 -0
- package/dist/cli/commands/uiRenderAssetGrounds.js +323 -0
- package/dist/cli/commands/uiRenderAssetIsolation.js +85 -0
- package/dist/cli/commands/uiRenderAssetTypes.js +145 -0
- package/dist/cli/main.js +47 -1
- package/dist/cli/registry.js +1 -1
- package/dist/cli-delegate/{chunk-MSUL5NYP.js → chunk-4DBG5K7M.js} +1 -1
- package/dist/cli-delegate/{chunk-AED2VQGM.js → chunk-TMWYUOK4.js} +10 -1
- package/dist/cli-delegate/cmd_conformance.js +395 -214
- package/dist/cli-delegate/cmd_handoff.js +2 -2
- package/dist/cli-delegate/cmd_session_recycle.js +2 -2
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +47 -22
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +6 -6
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +19 -15
- package/dist/discovery/trust-report.md +2 -2
- package/dist/discovery/workspaces.json +13 -9
- package/dist/hooks/dispatch.js +1073 -808
- package/dist/hooks/dispatch.sha256 +1 -1
- package/dist/hooks/svg_rules.chunk.cjs +1626 -0
- package/dist/hooks/svg_rules.chunk.cjs.sha256 +1 -0
- package/dist/mcp/registry-manifest.json +3 -3
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +931 -735
- package/dist/scripts/_lib/scan_scope.js +105 -0
- package/dist/scripts/_lib/svg_dom.js +284 -0
- package/dist/scripts/_lib/svg_geometry.js +477 -0
- package/dist/scripts/_lib/svg_motion.js +179 -0
- package/dist/scripts/_lib/svg_rules.js +1337 -0
- package/dist/scripts/_lib/svg_urls.js +67 -0
- package/dist/scripts/lint_svg_asset.js +324 -0
- package/docs/guidelines/design-antipatterns.md +1 -1
- package/package.json +4 -3
- package/src/config/gate-violation-baselines.json +3 -3
- package/src/config/routing-coverage-seed.json +9 -2
- package/src/scripts/_lib/svg_dom.ts +318 -0
- package/src/scripts/_lib/svg_geometry.ts +480 -0
- package/src/scripts/_lib/svg_motion.ts +208 -0
- package/src/scripts/_lib/svg_rules.ts +1453 -0
- package/src/scripts/_lib/svg_urls.ts +72 -0
- package/src/scripts/_lib/verification_command.ts +59 -0
- package/src/scripts/_lib/verify_clause.ts +27 -17
- package/src/scripts/hooks/block_speaking_inbox_dir.ts +16 -1
- package/src/scripts/hooks/design_pass_hook.ts +157 -3
- package/src/scripts/hooks/svg_obligation.ts +497 -0
- package/src/scripts/hooks/svg_rules_loader.ts +133 -0
- package/src/scripts/hooks/turn_end_gate_hook.ts +5 -3
- package/src/scripts/lint_consolidation_lineage.ts +6 -3
- package/src/scripts/lint_design_quality.ts +60 -12
- package/src/scripts/lint_motion_authority_drift.ts +27 -0
- package/src/scripts/lint_svg_asset.ts +365 -0
package/dist/mcp/server.mjs
CHANGED
|
@@ -1054,11 +1054,11 @@ function _strip_slashes(s) {
|
|
|
1054
1054
|
return s.replace(/^\/+/, "").replace(/\/+$/, "");
|
|
1055
1055
|
}
|
|
1056
1056
|
function _relative_to(child, root) {
|
|
1057
|
-
const
|
|
1058
|
-
if (
|
|
1057
|
+
const rel2 = path4.relative(root, child);
|
|
1058
|
+
if (rel2 === "" || rel2.startsWith("..") || path4.isAbsolute(rel2)) {
|
|
1059
1059
|
throw new Error(`${child} is not in the subpath of ${root}`);
|
|
1060
1060
|
}
|
|
1061
|
-
return
|
|
1061
|
+
return rel2;
|
|
1062
1062
|
}
|
|
1063
1063
|
function _posix_join(a, b) {
|
|
1064
1064
|
return `${a.split(path4.sep).join("/")}/${b}`;
|
|
@@ -1293,17 +1293,17 @@ function _strip_frontmatter(text) {
|
|
|
1293
1293
|
}
|
|
1294
1294
|
return [meta, _lstripNewlines(body)];
|
|
1295
1295
|
}
|
|
1296
|
-
function _splitMax(text,
|
|
1296
|
+
function _splitMax(text, sep26, maxsplit) {
|
|
1297
1297
|
const out = [];
|
|
1298
1298
|
let rest = text;
|
|
1299
1299
|
let count = 0;
|
|
1300
1300
|
while (count < maxsplit) {
|
|
1301
|
-
const idx = rest.indexOf(
|
|
1301
|
+
const idx = rest.indexOf(sep26);
|
|
1302
1302
|
if (idx === -1) {
|
|
1303
1303
|
break;
|
|
1304
1304
|
}
|
|
1305
1305
|
out.push(rest.slice(0, idx));
|
|
1306
|
-
rest = rest.slice(idx +
|
|
1306
|
+
rest = rest.slice(idx + sep26.length);
|
|
1307
1307
|
count += 1;
|
|
1308
1308
|
}
|
|
1309
1309
|
out.push(rest);
|
|
@@ -1549,8 +1549,8 @@ function scan_commands(root) {
|
|
|
1549
1549
|
if (!_isFile(p)) {
|
|
1550
1550
|
continue;
|
|
1551
1551
|
}
|
|
1552
|
-
const
|
|
1553
|
-
const fallback =
|
|
1552
|
+
const rel2 = path5.relative(cmd_root, p).replace(/\.md$/, "");
|
|
1553
|
+
const fallback = rel2.split(path5.sep).join("-");
|
|
1554
1554
|
let prompt;
|
|
1555
1555
|
try {
|
|
1556
1556
|
prompt = _load_file(p, "command", fallback);
|
|
@@ -1903,8 +1903,8 @@ function _scan_tree(root, options) {
|
|
|
1903
1903
|
if (!_isFile2(p)) {
|
|
1904
1904
|
continue;
|
|
1905
1905
|
}
|
|
1906
|
-
const
|
|
1907
|
-
const slug =
|
|
1906
|
+
const rel2 = path6.relative(root, p).replace(/\.md$/, "");
|
|
1907
|
+
const slug = rel2.split(path6.sep).join("/");
|
|
1908
1908
|
try {
|
|
1909
1909
|
out.push(_load(p, { uri: `${scheme}://${slug}`, fallback_name: slug, kind }));
|
|
1910
1910
|
} catch (exc) {
|
|
@@ -2120,17 +2120,17 @@ var require_visit = __commonJS({
|
|
|
2120
2120
|
visit.BREAK = BREAK;
|
|
2121
2121
|
visit.SKIP = SKIP;
|
|
2122
2122
|
visit.REMOVE = REMOVE;
|
|
2123
|
-
function visit_(key, node2, visitor,
|
|
2124
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
2123
|
+
function visit_(key, node2, visitor, path124) {
|
|
2124
|
+
const ctrl = callVisitor(key, node2, visitor, path124);
|
|
2125
2125
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2126
|
-
replaceNode(key,
|
|
2127
|
-
return visit_(key, ctrl, visitor,
|
|
2126
|
+
replaceNode(key, path124, ctrl);
|
|
2127
|
+
return visit_(key, ctrl, visitor, path124);
|
|
2128
2128
|
}
|
|
2129
2129
|
if (typeof ctrl !== "symbol") {
|
|
2130
2130
|
if (identity.isCollection(node2)) {
|
|
2131
|
-
|
|
2131
|
+
path124 = Object.freeze(path124.concat(node2));
|
|
2132
2132
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
2133
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
2133
|
+
const ci = visit_(i, node2.items[i], visitor, path124);
|
|
2134
2134
|
if (typeof ci === "number")
|
|
2135
2135
|
i = ci - 1;
|
|
2136
2136
|
else if (ci === BREAK)
|
|
@@ -2141,13 +2141,13 @@ var require_visit = __commonJS({
|
|
|
2141
2141
|
}
|
|
2142
2142
|
}
|
|
2143
2143
|
} else if (identity.isPair(node2)) {
|
|
2144
|
-
|
|
2145
|
-
const ck = visit_("key", node2.key, visitor,
|
|
2144
|
+
path124 = Object.freeze(path124.concat(node2));
|
|
2145
|
+
const ck = visit_("key", node2.key, visitor, path124);
|
|
2146
2146
|
if (ck === BREAK)
|
|
2147
2147
|
return BREAK;
|
|
2148
2148
|
else if (ck === REMOVE)
|
|
2149
2149
|
node2.key = null;
|
|
2150
|
-
const cv = visit_("value", node2.value, visitor,
|
|
2150
|
+
const cv = visit_("value", node2.value, visitor, path124);
|
|
2151
2151
|
if (cv === BREAK)
|
|
2152
2152
|
return BREAK;
|
|
2153
2153
|
else if (cv === REMOVE)
|
|
@@ -2168,17 +2168,17 @@ var require_visit = __commonJS({
|
|
|
2168
2168
|
visitAsync.BREAK = BREAK;
|
|
2169
2169
|
visitAsync.SKIP = SKIP;
|
|
2170
2170
|
visitAsync.REMOVE = REMOVE;
|
|
2171
|
-
async function visitAsync_(key, node2, visitor,
|
|
2172
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
2171
|
+
async function visitAsync_(key, node2, visitor, path124) {
|
|
2172
|
+
const ctrl = await callVisitor(key, node2, visitor, path124);
|
|
2173
2173
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2174
|
-
replaceNode(key,
|
|
2175
|
-
return visitAsync_(key, ctrl, visitor,
|
|
2174
|
+
replaceNode(key, path124, ctrl);
|
|
2175
|
+
return visitAsync_(key, ctrl, visitor, path124);
|
|
2176
2176
|
}
|
|
2177
2177
|
if (typeof ctrl !== "symbol") {
|
|
2178
2178
|
if (identity.isCollection(node2)) {
|
|
2179
|
-
|
|
2179
|
+
path124 = Object.freeze(path124.concat(node2));
|
|
2180
2180
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
2181
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
2181
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path124);
|
|
2182
2182
|
if (typeof ci === "number")
|
|
2183
2183
|
i = ci - 1;
|
|
2184
2184
|
else if (ci === BREAK)
|
|
@@ -2189,13 +2189,13 @@ var require_visit = __commonJS({
|
|
|
2189
2189
|
}
|
|
2190
2190
|
}
|
|
2191
2191
|
} else if (identity.isPair(node2)) {
|
|
2192
|
-
|
|
2193
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
2192
|
+
path124 = Object.freeze(path124.concat(node2));
|
|
2193
|
+
const ck = await visitAsync_("key", node2.key, visitor, path124);
|
|
2194
2194
|
if (ck === BREAK)
|
|
2195
2195
|
return BREAK;
|
|
2196
2196
|
else if (ck === REMOVE)
|
|
2197
2197
|
node2.key = null;
|
|
2198
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
2198
|
+
const cv = await visitAsync_("value", node2.value, visitor, path124);
|
|
2199
2199
|
if (cv === BREAK)
|
|
2200
2200
|
return BREAK;
|
|
2201
2201
|
else if (cv === REMOVE)
|
|
@@ -2222,23 +2222,23 @@ var require_visit = __commonJS({
|
|
|
2222
2222
|
}
|
|
2223
2223
|
return visitor;
|
|
2224
2224
|
}
|
|
2225
|
-
function callVisitor(key, node2, visitor,
|
|
2225
|
+
function callVisitor(key, node2, visitor, path124) {
|
|
2226
2226
|
if (typeof visitor === "function")
|
|
2227
|
-
return visitor(key, node2,
|
|
2227
|
+
return visitor(key, node2, path124);
|
|
2228
2228
|
if (identity.isMap(node2))
|
|
2229
|
-
return visitor.Map?.(key, node2,
|
|
2229
|
+
return visitor.Map?.(key, node2, path124);
|
|
2230
2230
|
if (identity.isSeq(node2))
|
|
2231
|
-
return visitor.Seq?.(key, node2,
|
|
2231
|
+
return visitor.Seq?.(key, node2, path124);
|
|
2232
2232
|
if (identity.isPair(node2))
|
|
2233
|
-
return visitor.Pair?.(key, node2,
|
|
2233
|
+
return visitor.Pair?.(key, node2, path124);
|
|
2234
2234
|
if (identity.isScalar(node2))
|
|
2235
|
-
return visitor.Scalar?.(key, node2,
|
|
2235
|
+
return visitor.Scalar?.(key, node2, path124);
|
|
2236
2236
|
if (identity.isAlias(node2))
|
|
2237
|
-
return visitor.Alias?.(key, node2,
|
|
2237
|
+
return visitor.Alias?.(key, node2, path124);
|
|
2238
2238
|
return void 0;
|
|
2239
2239
|
}
|
|
2240
|
-
function replaceNode(key,
|
|
2241
|
-
const parent =
|
|
2240
|
+
function replaceNode(key, path124, node2) {
|
|
2241
|
+
const parent = path124[path124.length - 1];
|
|
2242
2242
|
if (identity.isCollection(parent)) {
|
|
2243
2243
|
parent.items[key] = node2;
|
|
2244
2244
|
} else if (identity.isPair(parent)) {
|
|
@@ -2848,10 +2848,10 @@ var require_Collection = __commonJS({
|
|
|
2848
2848
|
var createNode = require_createNode();
|
|
2849
2849
|
var identity = require_identity();
|
|
2850
2850
|
var Node = require_Node();
|
|
2851
|
-
function collectionFromPath(schema,
|
|
2851
|
+
function collectionFromPath(schema, path124, value) {
|
|
2852
2852
|
let v = value;
|
|
2853
|
-
for (let i =
|
|
2854
|
-
const k =
|
|
2853
|
+
for (let i = path124.length - 1; i >= 0; --i) {
|
|
2854
|
+
const k = path124[i];
|
|
2855
2855
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2856
2856
|
const a = [];
|
|
2857
2857
|
a[k] = v;
|
|
@@ -2870,7 +2870,7 @@ var require_Collection = __commonJS({
|
|
|
2870
2870
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2871
2871
|
});
|
|
2872
2872
|
}
|
|
2873
|
-
var isEmptyPath = (
|
|
2873
|
+
var isEmptyPath = (path124) => path124 == null || typeof path124 === "object" && !!path124[Symbol.iterator]().next().done;
|
|
2874
2874
|
var Collection = class extends Node.NodeBase {
|
|
2875
2875
|
constructor(type, schema) {
|
|
2876
2876
|
super(type);
|
|
@@ -2900,11 +2900,11 @@ var require_Collection = __commonJS({
|
|
|
2900
2900
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2901
2901
|
* that already exists in the map.
|
|
2902
2902
|
*/
|
|
2903
|
-
addIn(
|
|
2904
|
-
if (isEmptyPath(
|
|
2903
|
+
addIn(path124, value) {
|
|
2904
|
+
if (isEmptyPath(path124))
|
|
2905
2905
|
this.add(value);
|
|
2906
2906
|
else {
|
|
2907
|
-
const [key, ...rest] =
|
|
2907
|
+
const [key, ...rest] = path124;
|
|
2908
2908
|
const node2 = this.get(key, true);
|
|
2909
2909
|
if (identity.isCollection(node2))
|
|
2910
2910
|
node2.addIn(rest, value);
|
|
@@ -2918,8 +2918,8 @@ var require_Collection = __commonJS({
|
|
|
2918
2918
|
* Removes a value from the collection.
|
|
2919
2919
|
* @returns `true` if the item was found and removed.
|
|
2920
2920
|
*/
|
|
2921
|
-
deleteIn(
|
|
2922
|
-
const [key, ...rest] =
|
|
2921
|
+
deleteIn(path124) {
|
|
2922
|
+
const [key, ...rest] = path124;
|
|
2923
2923
|
if (rest.length === 0)
|
|
2924
2924
|
return this.delete(key);
|
|
2925
2925
|
const node2 = this.get(key, true);
|
|
@@ -2933,8 +2933,8 @@ var require_Collection = __commonJS({
|
|
|
2933
2933
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2934
2934
|
* `true` (collections are always returned intact).
|
|
2935
2935
|
*/
|
|
2936
|
-
getIn(
|
|
2937
|
-
const [key, ...rest] =
|
|
2936
|
+
getIn(path124, keepScalar) {
|
|
2937
|
+
const [key, ...rest] = path124;
|
|
2938
2938
|
const node2 = this.get(key, true);
|
|
2939
2939
|
if (rest.length === 0)
|
|
2940
2940
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -2952,8 +2952,8 @@ var require_Collection = __commonJS({
|
|
|
2952
2952
|
/**
|
|
2953
2953
|
* Checks if the collection includes a value with the key `key`.
|
|
2954
2954
|
*/
|
|
2955
|
-
hasIn(
|
|
2956
|
-
const [key, ...rest] =
|
|
2955
|
+
hasIn(path124) {
|
|
2956
|
+
const [key, ...rest] = path124;
|
|
2957
2957
|
if (rest.length === 0)
|
|
2958
2958
|
return this.has(key);
|
|
2959
2959
|
const node2 = this.get(key, true);
|
|
@@ -2963,8 +2963,8 @@ var require_Collection = __commonJS({
|
|
|
2963
2963
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2964
2964
|
* boolean to add/remove the item from the set.
|
|
2965
2965
|
*/
|
|
2966
|
-
setIn(
|
|
2967
|
-
const [key, ...rest] =
|
|
2966
|
+
setIn(path124, value) {
|
|
2967
|
+
const [key, ...rest] = path124;
|
|
2968
2968
|
if (rest.length === 0) {
|
|
2969
2969
|
this.set(key, value);
|
|
2970
2970
|
} else {
|
|
@@ -5479,9 +5479,9 @@ var require_Document = __commonJS({
|
|
|
5479
5479
|
this.contents.add(value);
|
|
5480
5480
|
}
|
|
5481
5481
|
/** Adds a value to the document. */
|
|
5482
|
-
addIn(
|
|
5482
|
+
addIn(path124, value) {
|
|
5483
5483
|
if (assertCollection(this.contents))
|
|
5484
|
-
this.contents.addIn(
|
|
5484
|
+
this.contents.addIn(path124, value);
|
|
5485
5485
|
}
|
|
5486
5486
|
/**
|
|
5487
5487
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -5556,14 +5556,14 @@ var require_Document = __commonJS({
|
|
|
5556
5556
|
* Removes a value from the document.
|
|
5557
5557
|
* @returns `true` if the item was found and removed.
|
|
5558
5558
|
*/
|
|
5559
|
-
deleteIn(
|
|
5560
|
-
if (Collection.isEmptyPath(
|
|
5559
|
+
deleteIn(path124) {
|
|
5560
|
+
if (Collection.isEmptyPath(path124)) {
|
|
5561
5561
|
if (this.contents == null)
|
|
5562
5562
|
return false;
|
|
5563
5563
|
this.contents = null;
|
|
5564
5564
|
return true;
|
|
5565
5565
|
}
|
|
5566
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
5566
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path124) : false;
|
|
5567
5567
|
}
|
|
5568
5568
|
/**
|
|
5569
5569
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -5578,10 +5578,10 @@ var require_Document = __commonJS({
|
|
|
5578
5578
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5579
5579
|
* `true` (collections are always returned intact).
|
|
5580
5580
|
*/
|
|
5581
|
-
getIn(
|
|
5582
|
-
if (Collection.isEmptyPath(
|
|
5581
|
+
getIn(path124, keepScalar) {
|
|
5582
|
+
if (Collection.isEmptyPath(path124))
|
|
5583
5583
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
5584
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
5584
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path124, keepScalar) : void 0;
|
|
5585
5585
|
}
|
|
5586
5586
|
/**
|
|
5587
5587
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -5592,10 +5592,10 @@ var require_Document = __commonJS({
|
|
|
5592
5592
|
/**
|
|
5593
5593
|
* Checks if the document includes a value at `path`.
|
|
5594
5594
|
*/
|
|
5595
|
-
hasIn(
|
|
5596
|
-
if (Collection.isEmptyPath(
|
|
5595
|
+
hasIn(path124) {
|
|
5596
|
+
if (Collection.isEmptyPath(path124))
|
|
5597
5597
|
return this.contents !== void 0;
|
|
5598
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
5598
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path124) : false;
|
|
5599
5599
|
}
|
|
5600
5600
|
/**
|
|
5601
5601
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -5612,13 +5612,13 @@ var require_Document = __commonJS({
|
|
|
5612
5612
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
5613
5613
|
* boolean to add/remove the item from the set.
|
|
5614
5614
|
*/
|
|
5615
|
-
setIn(
|
|
5616
|
-
if (Collection.isEmptyPath(
|
|
5615
|
+
setIn(path124, value) {
|
|
5616
|
+
if (Collection.isEmptyPath(path124)) {
|
|
5617
5617
|
this.contents = value;
|
|
5618
5618
|
} else if (this.contents == null) {
|
|
5619
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
5619
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path124), value);
|
|
5620
5620
|
} else if (assertCollection(this.contents)) {
|
|
5621
|
-
this.contents.setIn(
|
|
5621
|
+
this.contents.setIn(path124, value);
|
|
5622
5622
|
}
|
|
5623
5623
|
}
|
|
5624
5624
|
/**
|
|
@@ -6004,10 +6004,10 @@ var require_resolve_block_map = __commonJS({
|
|
|
6004
6004
|
let offset = bm.offset;
|
|
6005
6005
|
let commentEnd = null;
|
|
6006
6006
|
for (const collItem of bm.items) {
|
|
6007
|
-
const { start, key, sep:
|
|
6007
|
+
const { start, key, sep: sep26, value } = collItem;
|
|
6008
6008
|
const keyProps = resolveProps.resolveProps(start, {
|
|
6009
6009
|
indicator: "explicit-key-ind",
|
|
6010
|
-
next: key ??
|
|
6010
|
+
next: key ?? sep26?.[0],
|
|
6011
6011
|
offset,
|
|
6012
6012
|
onError,
|
|
6013
6013
|
parentIndent: bm.indent,
|
|
@@ -6021,7 +6021,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
6021
6021
|
else if ("indent" in key && key.indent !== bm.indent)
|
|
6022
6022
|
onError(offset, "BAD_INDENT", startColMsg);
|
|
6023
6023
|
}
|
|
6024
|
-
if (!keyProps.anchor && !keyProps.tag && !
|
|
6024
|
+
if (!keyProps.anchor && !keyProps.tag && !sep26) {
|
|
6025
6025
|
commentEnd = keyProps.end;
|
|
6026
6026
|
if (keyProps.comment) {
|
|
6027
6027
|
if (map.comment)
|
|
@@ -6045,7 +6045,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
6045
6045
|
ctx.atKey = false;
|
|
6046
6046
|
if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))
|
|
6047
6047
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
6048
|
-
const valueProps = resolveProps.resolveProps(
|
|
6048
|
+
const valueProps = resolveProps.resolveProps(sep26 ?? [], {
|
|
6049
6049
|
indicator: "map-value-ind",
|
|
6050
6050
|
next: value,
|
|
6051
6051
|
offset: keyNode.range[2],
|
|
@@ -6061,7 +6061,7 @@ var require_resolve_block_map = __commonJS({
|
|
|
6061
6061
|
if (ctx.options.strict && keyProps.start < valueProps.found.offset - 1024)
|
|
6062
6062
|
onError(keyNode.range, "KEY_OVER_1024_CHARS", "The : indicator must be at most 1024 chars after the start of an implicit block mapping key");
|
|
6063
6063
|
}
|
|
6064
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset,
|
|
6064
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : composeEmptyNode(ctx, offset, sep26, null, valueProps, onError);
|
|
6065
6065
|
if (ctx.schema.compat)
|
|
6066
6066
|
utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);
|
|
6067
6067
|
offset = valueNode.range[2];
|
|
@@ -6152,7 +6152,7 @@ var require_resolve_end = __commonJS({
|
|
|
6152
6152
|
let comment = "";
|
|
6153
6153
|
if (end) {
|
|
6154
6154
|
let hasSpace = false;
|
|
6155
|
-
let
|
|
6155
|
+
let sep26 = "";
|
|
6156
6156
|
for (const token of end) {
|
|
6157
6157
|
const { source, type } = token;
|
|
6158
6158
|
switch (type) {
|
|
@@ -6166,13 +6166,13 @@ var require_resolve_end = __commonJS({
|
|
|
6166
6166
|
if (!comment)
|
|
6167
6167
|
comment = cb;
|
|
6168
6168
|
else
|
|
6169
|
-
comment +=
|
|
6170
|
-
|
|
6169
|
+
comment += sep26 + cb;
|
|
6170
|
+
sep26 = "";
|
|
6171
6171
|
break;
|
|
6172
6172
|
}
|
|
6173
6173
|
case "newline":
|
|
6174
6174
|
if (comment)
|
|
6175
|
-
|
|
6175
|
+
sep26 += source;
|
|
6176
6176
|
hasSpace = true;
|
|
6177
6177
|
break;
|
|
6178
6178
|
default:
|
|
@@ -6215,18 +6215,18 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
6215
6215
|
let offset = fc.offset + fc.start.source.length;
|
|
6216
6216
|
for (let i = 0; i < fc.items.length; ++i) {
|
|
6217
6217
|
const collItem = fc.items[i];
|
|
6218
|
-
const { start, key, sep:
|
|
6218
|
+
const { start, key, sep: sep26, value } = collItem;
|
|
6219
6219
|
const props = resolveProps.resolveProps(start, {
|
|
6220
6220
|
flow: fcName,
|
|
6221
6221
|
indicator: "explicit-key-ind",
|
|
6222
|
-
next: key ??
|
|
6222
|
+
next: key ?? sep26?.[0],
|
|
6223
6223
|
offset,
|
|
6224
6224
|
onError,
|
|
6225
6225
|
parentIndent: fc.indent,
|
|
6226
6226
|
startOnNewline: false
|
|
6227
6227
|
});
|
|
6228
6228
|
if (!props.found) {
|
|
6229
|
-
if (!props.anchor && !props.tag && !
|
|
6229
|
+
if (!props.anchor && !props.tag && !sep26 && !value) {
|
|
6230
6230
|
if (i === 0 && props.comma)
|
|
6231
6231
|
onError(props.comma, "UNEXPECTED_TOKEN", `Unexpected , in ${fcName}`);
|
|
6232
6232
|
else if (i < fc.items.length - 1)
|
|
@@ -6280,8 +6280,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
6280
6280
|
}
|
|
6281
6281
|
}
|
|
6282
6282
|
}
|
|
6283
|
-
if (!isMap && !
|
|
6284
|
-
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end,
|
|
6283
|
+
if (!isMap && !sep26 && !props.found) {
|
|
6284
|
+
const valueNode = value ? composeNode(ctx, value, props, onError) : composeEmptyNode(ctx, props.end, sep26, null, props, onError);
|
|
6285
6285
|
coll.items.push(valueNode);
|
|
6286
6286
|
offset = valueNode.range[2];
|
|
6287
6287
|
if (isBlock(value))
|
|
@@ -6293,7 +6293,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
6293
6293
|
if (isBlock(key))
|
|
6294
6294
|
onError(keyNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
6295
6295
|
ctx.atKey = false;
|
|
6296
|
-
const valueProps = resolveProps.resolveProps(
|
|
6296
|
+
const valueProps = resolveProps.resolveProps(sep26 ?? [], {
|
|
6297
6297
|
flow: fcName,
|
|
6298
6298
|
indicator: "map-value-ind",
|
|
6299
6299
|
next: value,
|
|
@@ -6304,8 +6304,8 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
6304
6304
|
});
|
|
6305
6305
|
if (valueProps.found) {
|
|
6306
6306
|
if (!isMap && !props.found && ctx.options.strict) {
|
|
6307
|
-
if (
|
|
6308
|
-
for (const st of
|
|
6307
|
+
if (sep26)
|
|
6308
|
+
for (const st of sep26) {
|
|
6309
6309
|
if (st === valueProps.found)
|
|
6310
6310
|
break;
|
|
6311
6311
|
if (st.type === "newline") {
|
|
@@ -6322,7 +6322,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
6322
6322
|
else
|
|
6323
6323
|
onError(valueProps.start, "MISSING_CHAR", `Missing , or : between ${fcName} items`);
|
|
6324
6324
|
}
|
|
6325
|
-
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end,
|
|
6325
|
+
const valueNode = value ? composeNode(ctx, value, valueProps, onError) : valueProps.found ? composeEmptyNode(ctx, valueProps.end, sep26, null, valueProps, onError) : null;
|
|
6326
6326
|
if (valueNode) {
|
|
6327
6327
|
if (isBlock(value))
|
|
6328
6328
|
onError(valueNode.range, "BLOCK_IN_FLOW", blockMsg);
|
|
@@ -6502,7 +6502,7 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
6502
6502
|
chompStart = i + 1;
|
|
6503
6503
|
}
|
|
6504
6504
|
let value = "";
|
|
6505
|
-
let
|
|
6505
|
+
let sep26 = "";
|
|
6506
6506
|
let prevMoreIndented = false;
|
|
6507
6507
|
for (let i = 0; i < contentStart; ++i)
|
|
6508
6508
|
value += lines[i][0].slice(trimIndent) + "\n";
|
|
@@ -6519,24 +6519,24 @@ var require_resolve_block_scalar = __commonJS({
|
|
|
6519
6519
|
indent = "";
|
|
6520
6520
|
}
|
|
6521
6521
|
if (type === Scalar.Scalar.BLOCK_LITERAL) {
|
|
6522
|
-
value +=
|
|
6523
|
-
|
|
6522
|
+
value += sep26 + indent.slice(trimIndent) + content;
|
|
6523
|
+
sep26 = "\n";
|
|
6524
6524
|
} else if (indent.length > trimIndent || content[0] === " ") {
|
|
6525
|
-
if (
|
|
6526
|
-
|
|
6527
|
-
else if (!prevMoreIndented &&
|
|
6528
|
-
|
|
6529
|
-
value +=
|
|
6530
|
-
|
|
6525
|
+
if (sep26 === " ")
|
|
6526
|
+
sep26 = "\n";
|
|
6527
|
+
else if (!prevMoreIndented && sep26 === "\n")
|
|
6528
|
+
sep26 = "\n\n";
|
|
6529
|
+
value += sep26 + indent.slice(trimIndent) + content;
|
|
6530
|
+
sep26 = "\n";
|
|
6531
6531
|
prevMoreIndented = true;
|
|
6532
6532
|
} else if (content === "") {
|
|
6533
|
-
if (
|
|
6533
|
+
if (sep26 === "\n")
|
|
6534
6534
|
value += "\n";
|
|
6535
6535
|
else
|
|
6536
|
-
|
|
6536
|
+
sep26 = "\n";
|
|
6537
6537
|
} else {
|
|
6538
|
-
value +=
|
|
6539
|
-
|
|
6538
|
+
value += sep26 + content;
|
|
6539
|
+
sep26 = " ";
|
|
6540
6540
|
prevMoreIndented = false;
|
|
6541
6541
|
}
|
|
6542
6542
|
}
|
|
@@ -6639,7 +6639,7 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
6639
6639
|
const { offset, type, source, end } = scalar;
|
|
6640
6640
|
let _type;
|
|
6641
6641
|
let value;
|
|
6642
|
-
const _onError = (
|
|
6642
|
+
const _onError = (rel2, code, msg) => onError(offset + rel2, code, msg);
|
|
6643
6643
|
switch (type) {
|
|
6644
6644
|
case "scalar":
|
|
6645
6645
|
_type = Scalar.Scalar.PLAIN;
|
|
@@ -6718,25 +6718,25 @@ var require_resolve_flow_scalar = __commonJS({
|
|
|
6718
6718
|
if (!match)
|
|
6719
6719
|
return source;
|
|
6720
6720
|
let res = match[1];
|
|
6721
|
-
let
|
|
6721
|
+
let sep26 = " ";
|
|
6722
6722
|
let pos = first.lastIndex;
|
|
6723
6723
|
line.lastIndex = pos;
|
|
6724
6724
|
while (match = line.exec(source)) {
|
|
6725
6725
|
if (match[1] === "") {
|
|
6726
|
-
if (
|
|
6727
|
-
res +=
|
|
6726
|
+
if (sep26 === "\n")
|
|
6727
|
+
res += sep26;
|
|
6728
6728
|
else
|
|
6729
|
-
|
|
6729
|
+
sep26 = "\n";
|
|
6730
6730
|
} else {
|
|
6731
|
-
res +=
|
|
6732
|
-
|
|
6731
|
+
res += sep26 + match[1];
|
|
6732
|
+
sep26 = " ";
|
|
6733
6733
|
}
|
|
6734
6734
|
pos = line.lastIndex;
|
|
6735
6735
|
}
|
|
6736
6736
|
const last = /[ \t]*(.*)/sy;
|
|
6737
6737
|
last.lastIndex = pos;
|
|
6738
6738
|
match = last.exec(source);
|
|
6739
|
-
return res +
|
|
6739
|
+
return res + sep26 + (match?.[1] ?? "");
|
|
6740
6740
|
}
|
|
6741
6741
|
function doubleQuotedValue(source, onError) {
|
|
6742
6742
|
let res = "";
|
|
@@ -7546,14 +7546,14 @@ var require_cst_stringify = __commonJS({
|
|
|
7546
7546
|
}
|
|
7547
7547
|
}
|
|
7548
7548
|
}
|
|
7549
|
-
function stringifyItem({ start, key, sep:
|
|
7549
|
+
function stringifyItem({ start, key, sep: sep26, value }) {
|
|
7550
7550
|
let res = "";
|
|
7551
7551
|
for (const st of start)
|
|
7552
7552
|
res += st.source;
|
|
7553
7553
|
if (key)
|
|
7554
7554
|
res += stringifyToken(key);
|
|
7555
|
-
if (
|
|
7556
|
-
for (const st of
|
|
7555
|
+
if (sep26)
|
|
7556
|
+
for (const st of sep26)
|
|
7557
7557
|
res += st.source;
|
|
7558
7558
|
if (value)
|
|
7559
7559
|
res += stringifyToken(value);
|
|
@@ -7578,9 +7578,9 @@ var require_cst_visit = __commonJS({
|
|
|
7578
7578
|
visit.BREAK = BREAK;
|
|
7579
7579
|
visit.SKIP = SKIP;
|
|
7580
7580
|
visit.REMOVE = REMOVE;
|
|
7581
|
-
visit.itemAtPath = (cst,
|
|
7581
|
+
visit.itemAtPath = (cst, path124) => {
|
|
7582
7582
|
let item = cst;
|
|
7583
|
-
for (const [field, index] of
|
|
7583
|
+
for (const [field, index] of path124) {
|
|
7584
7584
|
const tok = item?.[field];
|
|
7585
7585
|
if (tok && "items" in tok) {
|
|
7586
7586
|
item = tok.items[index];
|
|
@@ -7589,23 +7589,23 @@ var require_cst_visit = __commonJS({
|
|
|
7589
7589
|
}
|
|
7590
7590
|
return item;
|
|
7591
7591
|
};
|
|
7592
|
-
visit.parentCollection = (cst,
|
|
7593
|
-
const parent = visit.itemAtPath(cst,
|
|
7594
|
-
const field =
|
|
7592
|
+
visit.parentCollection = (cst, path124) => {
|
|
7593
|
+
const parent = visit.itemAtPath(cst, path124.slice(0, -1));
|
|
7594
|
+
const field = path124[path124.length - 1][0];
|
|
7595
7595
|
const coll = parent?.[field];
|
|
7596
7596
|
if (coll && "items" in coll)
|
|
7597
7597
|
return coll;
|
|
7598
7598
|
throw new Error("Parent collection not found");
|
|
7599
7599
|
};
|
|
7600
|
-
function _visit(
|
|
7601
|
-
let ctrl = visitor(item,
|
|
7600
|
+
function _visit(path124, item, visitor) {
|
|
7601
|
+
let ctrl = visitor(item, path124);
|
|
7602
7602
|
if (typeof ctrl === "symbol")
|
|
7603
7603
|
return ctrl;
|
|
7604
7604
|
for (const field of ["key", "value"]) {
|
|
7605
7605
|
const token = item[field];
|
|
7606
7606
|
if (token && "items" in token) {
|
|
7607
7607
|
for (let i = 0; i < token.items.length; ++i) {
|
|
7608
|
-
const ci = _visit(Object.freeze(
|
|
7608
|
+
const ci = _visit(Object.freeze(path124.concat([[field, i]])), token.items[i], visitor);
|
|
7609
7609
|
if (typeof ci === "number")
|
|
7610
7610
|
i = ci - 1;
|
|
7611
7611
|
else if (ci === BREAK)
|
|
@@ -7616,10 +7616,10 @@ var require_cst_visit = __commonJS({
|
|
|
7616
7616
|
}
|
|
7617
7617
|
}
|
|
7618
7618
|
if (typeof ctrl === "function" && field === "key")
|
|
7619
|
-
ctrl = ctrl(item,
|
|
7619
|
+
ctrl = ctrl(item, path124);
|
|
7620
7620
|
}
|
|
7621
7621
|
}
|
|
7622
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
7622
|
+
return typeof ctrl === "function" ? ctrl(item, path124) : ctrl;
|
|
7623
7623
|
}
|
|
7624
7624
|
exports.visit = visit;
|
|
7625
7625
|
}
|
|
@@ -8720,18 +8720,18 @@ var require_parser = __commonJS({
|
|
|
8720
8720
|
if (this.type === "map-value-ind") {
|
|
8721
8721
|
const prev = getPrevProps(this.peek(2));
|
|
8722
8722
|
const start = getFirstKeyStartProps(prev);
|
|
8723
|
-
let
|
|
8723
|
+
let sep26;
|
|
8724
8724
|
if (scalar.end) {
|
|
8725
|
-
|
|
8726
|
-
|
|
8725
|
+
sep26 = scalar.end;
|
|
8726
|
+
sep26.push(this.sourceToken);
|
|
8727
8727
|
delete scalar.end;
|
|
8728
8728
|
} else
|
|
8729
|
-
|
|
8729
|
+
sep26 = [this.sourceToken];
|
|
8730
8730
|
const map = {
|
|
8731
8731
|
type: "block-map",
|
|
8732
8732
|
offset: scalar.offset,
|
|
8733
8733
|
indent: scalar.indent,
|
|
8734
|
-
items: [{ start, key: scalar, sep:
|
|
8734
|
+
items: [{ start, key: scalar, sep: sep26 }]
|
|
8735
8735
|
};
|
|
8736
8736
|
this.onKeyLine = true;
|
|
8737
8737
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -8884,15 +8884,15 @@ var require_parser = __commonJS({
|
|
|
8884
8884
|
} else if (isFlowToken(it.key) && !includesToken(it.sep, "newline")) {
|
|
8885
8885
|
const start2 = getFirstKeyStartProps(it.start);
|
|
8886
8886
|
const key = it.key;
|
|
8887
|
-
const
|
|
8888
|
-
|
|
8887
|
+
const sep26 = it.sep;
|
|
8888
|
+
sep26.push(this.sourceToken);
|
|
8889
8889
|
delete it.key;
|
|
8890
8890
|
delete it.sep;
|
|
8891
8891
|
this.stack.push({
|
|
8892
8892
|
type: "block-map",
|
|
8893
8893
|
offset: this.offset,
|
|
8894
8894
|
indent: this.indent,
|
|
8895
|
-
items: [{ start: start2, key, sep:
|
|
8895
|
+
items: [{ start: start2, key, sep: sep26 }]
|
|
8896
8896
|
});
|
|
8897
8897
|
} else if (start.length > 0) {
|
|
8898
8898
|
it.sep = it.sep.concat(start, this.sourceToken);
|
|
@@ -8921,14 +8921,14 @@ var require_parser = __commonJS({
|
|
|
8921
8921
|
case "scalar":
|
|
8922
8922
|
case "single-quoted-scalar":
|
|
8923
8923
|
case "double-quoted-scalar": {
|
|
8924
|
-
const
|
|
8924
|
+
const fs130 = this.flowScalar(this.type);
|
|
8925
8925
|
if (atNextItem || it.value) {
|
|
8926
|
-
map.items.push({ start, key:
|
|
8926
|
+
map.items.push({ start, key: fs130, sep: [] });
|
|
8927
8927
|
this.onKeyLine = true;
|
|
8928
8928
|
} else if (it.sep) {
|
|
8929
|
-
this.stack.push(
|
|
8929
|
+
this.stack.push(fs130);
|
|
8930
8930
|
} else {
|
|
8931
|
-
Object.assign(it, { key:
|
|
8931
|
+
Object.assign(it, { key: fs130, sep: [] });
|
|
8932
8932
|
this.onKeyLine = true;
|
|
8933
8933
|
}
|
|
8934
8934
|
return;
|
|
@@ -9056,13 +9056,13 @@ var require_parser = __commonJS({
|
|
|
9056
9056
|
case "scalar":
|
|
9057
9057
|
case "single-quoted-scalar":
|
|
9058
9058
|
case "double-quoted-scalar": {
|
|
9059
|
-
const
|
|
9059
|
+
const fs130 = this.flowScalar(this.type);
|
|
9060
9060
|
if (!it || it.value)
|
|
9061
|
-
fc.items.push({ start: [], key:
|
|
9061
|
+
fc.items.push({ start: [], key: fs130, sep: [] });
|
|
9062
9062
|
else if (it.sep)
|
|
9063
|
-
this.stack.push(
|
|
9063
|
+
this.stack.push(fs130);
|
|
9064
9064
|
else
|
|
9065
|
-
Object.assign(it, { key:
|
|
9065
|
+
Object.assign(it, { key: fs130, sep: [] });
|
|
9066
9066
|
return;
|
|
9067
9067
|
}
|
|
9068
9068
|
case "flow-map-end":
|
|
@@ -9086,13 +9086,13 @@ var require_parser = __commonJS({
|
|
|
9086
9086
|
const prev = getPrevProps(parent);
|
|
9087
9087
|
const start = getFirstKeyStartProps(prev);
|
|
9088
9088
|
fixFlowSeqItems(fc);
|
|
9089
|
-
const
|
|
9090
|
-
|
|
9089
|
+
const sep26 = fc.end.splice(1, fc.end.length);
|
|
9090
|
+
sep26.push(this.sourceToken);
|
|
9091
9091
|
const map = {
|
|
9092
9092
|
type: "block-map",
|
|
9093
9093
|
offset: fc.offset,
|
|
9094
9094
|
indent: fc.indent,
|
|
9095
|
-
items: [{ start, key: fc, sep:
|
|
9095
|
+
items: [{ start, key: fc, sep: sep26 }]
|
|
9096
9096
|
};
|
|
9097
9097
|
this.onKeyLine = true;
|
|
9098
9098
|
this.stack[this.stack.length - 1] = map;
|
|
@@ -9381,9 +9381,9 @@ function is_example_path(rel_path) {
|
|
|
9381
9381
|
function path_weight(rel_path) {
|
|
9382
9382
|
return is_example_path(rel_path) ? 0.25 : 1;
|
|
9383
9383
|
}
|
|
9384
|
-
function source_identity(
|
|
9385
|
-
if (!
|
|
9386
|
-
const tail =
|
|
9384
|
+
function source_identity(rel2) {
|
|
9385
|
+
if (!rel2.startsWith(PROJECTION_PREFIX)) return rel2;
|
|
9386
|
+
const tail = rel2.slice(PROJECTION_PREFIX.length);
|
|
9387
9387
|
for (const [lane, sourceRoot] of PROJECTION_SOURCE_LANES) {
|
|
9388
9388
|
if (tail.startsWith(lane)) return sourceRoot + tail.slice(lane.length);
|
|
9389
9389
|
}
|
|
@@ -9422,17 +9422,17 @@ function _splitlines(text) {
|
|
|
9422
9422
|
return out;
|
|
9423
9423
|
}
|
|
9424
9424
|
function scan_file(filePath) {
|
|
9425
|
-
let
|
|
9425
|
+
let rel2;
|
|
9426
9426
|
if (path7.isAbsolute(filePath)) {
|
|
9427
9427
|
const root = path7.resolve(ROOT);
|
|
9428
9428
|
const resolved = path7.resolve(filePath);
|
|
9429
9429
|
if (resolved === root || resolved.startsWith(root + path7.sep)) {
|
|
9430
|
-
|
|
9430
|
+
rel2 = path7.relative(root, resolved).split(path7.sep).join("/");
|
|
9431
9431
|
} else {
|
|
9432
|
-
|
|
9432
|
+
rel2 = path7.basename(filePath);
|
|
9433
9433
|
}
|
|
9434
9434
|
} else {
|
|
9435
|
-
|
|
9435
|
+
rel2 = filePath.split(path7.sep).join("/");
|
|
9436
9436
|
}
|
|
9437
9437
|
const raw = fs7.readFileSync(filePath, "utf-8");
|
|
9438
9438
|
const lines = _splitlines(raw);
|
|
@@ -9483,33 +9483,33 @@ function scan_file(filePath) {
|
|
|
9483
9483
|
}
|
|
9484
9484
|
return new ScannedFile(
|
|
9485
9485
|
filePath,
|
|
9486
|
-
|
|
9486
|
+
rel2,
|
|
9487
9487
|
lines,
|
|
9488
9488
|
in_example,
|
|
9489
9489
|
in_any,
|
|
9490
9490
|
pragmas,
|
|
9491
|
-
path_weight(
|
|
9491
|
+
path_weight(rel2),
|
|
9492
9492
|
pragmaHashes
|
|
9493
9493
|
);
|
|
9494
9494
|
}
|
|
9495
9495
|
function scan_path(filePath, base) {
|
|
9496
9496
|
const sf = scan_file(filePath);
|
|
9497
|
-
let
|
|
9497
|
+
let rel2;
|
|
9498
9498
|
const baseResolved = path7.resolve(base);
|
|
9499
9499
|
const fileResolved = path7.resolve(filePath);
|
|
9500
9500
|
if (fileResolved === baseResolved || fileResolved.startsWith(baseResolved + path7.sep)) {
|
|
9501
|
-
|
|
9501
|
+
rel2 = path7.relative(baseResolved, fileResolved).split(path7.sep).join("/");
|
|
9502
9502
|
} else {
|
|
9503
|
-
|
|
9503
|
+
rel2 = path7.basename(filePath);
|
|
9504
9504
|
}
|
|
9505
9505
|
return new ScannedFile(
|
|
9506
9506
|
sf.path,
|
|
9507
|
-
|
|
9507
|
+
rel2,
|
|
9508
9508
|
sf.lines,
|
|
9509
9509
|
sf.in_example_fence,
|
|
9510
9510
|
sf.in_any_fence,
|
|
9511
9511
|
sf.pragmas,
|
|
9512
|
-
path_weight(
|
|
9512
|
+
path_weight(rel2),
|
|
9513
9513
|
sf.pragma_hashes
|
|
9514
9514
|
);
|
|
9515
9515
|
}
|
|
@@ -9844,9 +9844,9 @@ var init_security_lint = __esm({
|
|
|
9844
9844
|
/** check id → the sha256 fingerprints that pragma accepts. Empty = unbound. */
|
|
9845
9845
|
pragma_hashes;
|
|
9846
9846
|
weight;
|
|
9847
|
-
constructor(pathArg,
|
|
9847
|
+
constructor(pathArg, rel2, lines, in_example_fence, in_any_fence, pragmas, weight, pragma_hashes = {}) {
|
|
9848
9848
|
this.path = pathArg;
|
|
9849
|
-
this.rel =
|
|
9849
|
+
this.rel = rel2;
|
|
9850
9850
|
this.lines = lines;
|
|
9851
9851
|
this.in_example_fence = in_example_fence;
|
|
9852
9852
|
this.in_any_fence = in_any_fence;
|
|
@@ -10059,15 +10059,15 @@ function _scan(sf) {
|
|
|
10059
10059
|
}
|
|
10060
10060
|
return finish(out);
|
|
10061
10061
|
}
|
|
10062
|
-
function _isGenerated(
|
|
10063
|
-
return _GENERATED_PREFIXES.some((p) =>
|
|
10062
|
+
function _isGenerated(rel2) {
|
|
10063
|
+
return _GENERATED_PREFIXES.some((p) => rel2.startsWith(p));
|
|
10064
10064
|
}
|
|
10065
10065
|
function _isRawControlCodepoint(cp) {
|
|
10066
10066
|
if (cp === 9 || cp === 10 || cp === 13) return false;
|
|
10067
10067
|
return cp <= 31 || cp >= 127 && cp <= 159;
|
|
10068
10068
|
}
|
|
10069
|
-
function _extensionOf(
|
|
10070
|
-
const base =
|
|
10069
|
+
function _extensionOf(rel2) {
|
|
10070
|
+
const base = rel2.slice(rel2.lastIndexOf("/") + 1);
|
|
10071
10071
|
const dot = base.lastIndexOf(".");
|
|
10072
10072
|
return dot <= 0 ? "" : base.slice(dot + 1).toLowerCase();
|
|
10073
10073
|
}
|
|
@@ -10082,18 +10082,18 @@ function _trackedFiles() {
|
|
|
10082
10082
|
function _eligibleSourceFiles() {
|
|
10083
10083
|
const tracked = _trackedFiles();
|
|
10084
10084
|
if (tracked === null) return null;
|
|
10085
|
-
return tracked.filter((
|
|
10085
|
+
return tracked.filter((rel2) => !_isGenerated(rel2) && !_BINARY_EXT.has(_extensionOf(rel2)));
|
|
10086
10086
|
}
|
|
10087
10087
|
function _scanSourceControlBytes(files = null) {
|
|
10088
10088
|
const tracked = files ?? _eligibleSourceFiles();
|
|
10089
10089
|
if (tracked === null) return [];
|
|
10090
10090
|
const out = [];
|
|
10091
|
-
for (const
|
|
10092
|
-
if (_isGenerated(
|
|
10093
|
-
if (_BINARY_EXT.has(_extensionOf(
|
|
10091
|
+
for (const rel2 of tracked) {
|
|
10092
|
+
if (_isGenerated(rel2)) continue;
|
|
10093
|
+
if (_BINARY_EXT.has(_extensionOf(rel2))) continue;
|
|
10094
10094
|
let data;
|
|
10095
10095
|
try {
|
|
10096
|
-
data = fs8.readFileSync(path8.join(ROOT,
|
|
10096
|
+
data = fs8.readFileSync(path8.join(ROOT, rel2));
|
|
10097
10097
|
} catch {
|
|
10098
10098
|
continue;
|
|
10099
10099
|
}
|
|
@@ -10114,7 +10114,7 @@ function _scanSourceControlBytes(files = null) {
|
|
|
10114
10114
|
const hex = cp.toString(16).toUpperCase().padStart(2, "0");
|
|
10115
10115
|
out.push(
|
|
10116
10116
|
new Finding(
|
|
10117
|
-
|
|
10117
|
+
rel2,
|
|
10118
10118
|
line,
|
|
10119
10119
|
CHECK,
|
|
10120
10120
|
"HIGH",
|
|
@@ -10224,8 +10224,8 @@ function main(argv = null) {
|
|
|
10224
10224
|
if (args.fix) {
|
|
10225
10225
|
for (const p of [...flagged].sort()) {
|
|
10226
10226
|
const sanitized = _sanitize(p);
|
|
10227
|
-
const
|
|
10228
|
-
process.stdout.write(` fixed \u2192 ${
|
|
10227
|
+
const rel2 = path8.relative(path8.resolve(ROOT), path8.resolve(sanitized));
|
|
10228
|
+
process.stdout.write(` fixed \u2192 ${rel2.split(path8.sep).join("/")}
|
|
10229
10229
|
`);
|
|
10230
10230
|
}
|
|
10231
10231
|
}
|
|
@@ -14539,18 +14539,18 @@ function manifest_path(project_root, env) {
|
|
|
14539
14539
|
}
|
|
14540
14540
|
return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
|
|
14541
14541
|
}
|
|
14542
|
-
function read_manifest(
|
|
14542
|
+
function read_manifest(path124) {
|
|
14543
14543
|
let text;
|
|
14544
14544
|
try {
|
|
14545
|
-
text = require_read_text(
|
|
14545
|
+
text = require_read_text(path124);
|
|
14546
14546
|
} catch {
|
|
14547
14547
|
return null;
|
|
14548
14548
|
}
|
|
14549
14549
|
const data = _parse_manual(text);
|
|
14550
14550
|
return _normalise_v2_shape(data);
|
|
14551
14551
|
}
|
|
14552
|
-
function require_read_text(
|
|
14553
|
-
return fs18.readFileSync(
|
|
14552
|
+
function require_read_text(path124) {
|
|
14553
|
+
return fs18.readFileSync(path124, { encoding: "utf-8" });
|
|
14554
14554
|
}
|
|
14555
14555
|
function _normalise_v2_shape(data) {
|
|
14556
14556
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -14731,9 +14731,9 @@ function stable_sort(items, key) {
|
|
|
14731
14731
|
return a.index - b.index;
|
|
14732
14732
|
}).map((entry) => entry.item);
|
|
14733
14733
|
}
|
|
14734
|
-
function write_manifest(
|
|
14734
|
+
function write_manifest(path124, version, tools, options = {}) {
|
|
14735
14735
|
const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
14736
|
-
return write_atomic(
|
|
14736
|
+
return write_atomic(path124, rendered);
|
|
14737
14737
|
}
|
|
14738
14738
|
function upsert_tool(existing, options) {
|
|
14739
14739
|
const {
|
|
@@ -15965,8 +15965,8 @@ function looksLikeGraph(p) {
|
|
|
15965
15965
|
function detectSources(root, nativeCache) {
|
|
15966
15966
|
const abs = path22.resolve(root);
|
|
15967
15967
|
const out = [];
|
|
15968
|
-
for (const
|
|
15969
|
-
const p = path22.join(abs,
|
|
15968
|
+
for (const rel2 of consumerCandidates(abs)) {
|
|
15969
|
+
const p = path22.join(abs, rel2);
|
|
15970
15970
|
if (fs25.existsSync(p)) {
|
|
15971
15971
|
const { ok, sha } = looksLikeGraph(p);
|
|
15972
15972
|
if (ok) out.push({ kind: "consumer", path: p, present: true, ...freshness(abs, p, sha) });
|
|
@@ -15993,10 +15993,10 @@ function computeVerdict(root, nativeCache) {
|
|
|
15993
15993
|
const abs = path22.resolve(root);
|
|
15994
15994
|
const verdicts = detectSources(root, nativeCache);
|
|
15995
15995
|
const picked = pickSource(verdicts);
|
|
15996
|
-
const
|
|
15996
|
+
const rel2 = (p) => path22.relative(abs, p).split(path22.sep).join("/");
|
|
15997
15997
|
const verdict = picked === null ? "ABSENT" : picked.stale ? "STALE" : "FRESH";
|
|
15998
15998
|
const sources = verdicts.map((v) => {
|
|
15999
|
-
const s = { kind: v.kind, path:
|
|
15999
|
+
const s = { kind: v.kind, path: rel2(v.path), present: v.present };
|
|
16000
16000
|
if (v.stale !== void 0) s.stale = v.stale;
|
|
16001
16001
|
if (v.commits_behind !== void 0) s.commits_behind = v.commits_behind;
|
|
16002
16002
|
if (v.note !== void 0) s.note = v.note;
|
|
@@ -16005,7 +16005,7 @@ function computeVerdict(root, nativeCache) {
|
|
|
16005
16005
|
return {
|
|
16006
16006
|
verdict,
|
|
16007
16007
|
behind_commits: picked?.commits_behind ?? null,
|
|
16008
|
-
source: picked ? { kind: picked.kind, path:
|
|
16008
|
+
source: picked ? { kind: picked.kind, path: rel2(picked.path) } : null,
|
|
16009
16009
|
sources
|
|
16010
16010
|
};
|
|
16011
16011
|
}
|
|
@@ -16895,11 +16895,11 @@ function _isFile6(p) {
|
|
|
16895
16895
|
}
|
|
16896
16896
|
}
|
|
16897
16897
|
function resolve_guideline(root, logical_rel) {
|
|
16898
|
-
const
|
|
16899
|
-
if (!
|
|
16898
|
+
const rel2 = logical_rel.replaceAll("\\", "/").replace(/^\/+/, "");
|
|
16899
|
+
if (!rel2.startsWith(GUIDELINES_LOGICAL_PREFIX)) {
|
|
16900
16900
|
return null;
|
|
16901
16901
|
}
|
|
16902
|
-
const suffix =
|
|
16902
|
+
const suffix = rel2.slice(GUIDELINES_LOGICAL_PREFIX.length);
|
|
16903
16903
|
if (suffix.length === 0 || suffix.split("/").includes("..")) {
|
|
16904
16904
|
return null;
|
|
16905
16905
|
}
|
|
@@ -17014,20 +17014,20 @@ function _rglobSorted2(root, pattern) {
|
|
|
17014
17014
|
return out;
|
|
17015
17015
|
}
|
|
17016
17016
|
function _relativeToPosix(child, root) {
|
|
17017
|
-
const
|
|
17018
|
-
return
|
|
17017
|
+
const rel2 = path30.relative(root, child);
|
|
17018
|
+
return rel2.split(path30.sep).join("/");
|
|
17019
17019
|
}
|
|
17020
17020
|
function _isUnder(child, root) {
|
|
17021
|
-
const
|
|
17022
|
-
return
|
|
17021
|
+
const rel2 = path30.relative(root, child);
|
|
17022
|
+
return rel2 !== "" && !rel2.startsWith("..") && !path30.isAbsolute(rel2);
|
|
17023
17023
|
}
|
|
17024
17024
|
function _domains_command_logical(p) {
|
|
17025
17025
|
const dom = _roots.SRC_DOMAINS;
|
|
17026
17026
|
if (p !== dom && !_isUnder(p, dom)) {
|
|
17027
17027
|
return null;
|
|
17028
17028
|
}
|
|
17029
|
-
const
|
|
17030
|
-
const parts =
|
|
17029
|
+
const rel2 = _relativeToPosix(p, dom);
|
|
17030
|
+
const parts = rel2.split("/");
|
|
17031
17031
|
if (parts.length < 3 || parts[parts.length - 1] !== "command.md") {
|
|
17032
17032
|
return null;
|
|
17033
17033
|
}
|
|
@@ -17035,8 +17035,8 @@ function _domains_command_logical(p) {
|
|
|
17035
17035
|
return `commands/${subpath}.md`;
|
|
17036
17036
|
}
|
|
17037
17037
|
function _isScratchPack(domains_root, full) {
|
|
17038
|
-
const
|
|
17039
|
-
const first =
|
|
17038
|
+
const rel2 = path30.relative(domains_root, full);
|
|
17039
|
+
const first = rel2.split(path30.sep)[0];
|
|
17040
17040
|
return first !== void 0 && first.startsWith("__");
|
|
17041
17041
|
}
|
|
17042
17042
|
function* _iter_domains_commands() {
|
|
@@ -17129,40 +17129,40 @@ function* iter_commands() {
|
|
|
17129
17129
|
if (!_isFile7(p)) {
|
|
17130
17130
|
continue;
|
|
17131
17131
|
}
|
|
17132
|
-
const
|
|
17133
|
-
if (seen.has(
|
|
17132
|
+
const rel2 = `commands/${_relativeToPosix(p, base)}`;
|
|
17133
|
+
if (seen.has(rel2)) {
|
|
17134
17134
|
continue;
|
|
17135
17135
|
}
|
|
17136
|
-
seen.add(
|
|
17136
|
+
seen.add(rel2);
|
|
17137
17137
|
yield p;
|
|
17138
17138
|
}
|
|
17139
17139
|
}
|
|
17140
|
-
for (const [p,
|
|
17141
|
-
if (seen.has(
|
|
17140
|
+
for (const [p, rel2] of _iter_domains_commands()) {
|
|
17141
|
+
if (seen.has(rel2)) {
|
|
17142
17142
|
continue;
|
|
17143
17143
|
}
|
|
17144
|
-
seen.add(
|
|
17144
|
+
seen.add(rel2);
|
|
17145
17145
|
yield p;
|
|
17146
17146
|
}
|
|
17147
17147
|
}
|
|
17148
17148
|
function resolve_logical(logical_rel) {
|
|
17149
|
-
const
|
|
17149
|
+
const rel2 = logical_rel.replaceAll("\\", "/").replace(/^\/+/, "");
|
|
17150
17150
|
for (const [root, prefix] of _root_specs()) {
|
|
17151
17151
|
let p;
|
|
17152
17152
|
if (prefix) {
|
|
17153
|
-
if (!
|
|
17153
|
+
if (!rel2.startsWith(prefix)) {
|
|
17154
17154
|
continue;
|
|
17155
17155
|
}
|
|
17156
|
-
p = path30.join(root,
|
|
17156
|
+
p = path30.join(root, rel2.slice(prefix.length));
|
|
17157
17157
|
} else {
|
|
17158
|
-
p = path30.join(root,
|
|
17158
|
+
p = path30.join(root, rel2);
|
|
17159
17159
|
}
|
|
17160
17160
|
if (_exists3(p)) {
|
|
17161
17161
|
return p;
|
|
17162
17162
|
}
|
|
17163
17163
|
}
|
|
17164
|
-
if (
|
|
17165
|
-
const subpath =
|
|
17164
|
+
if (rel2.startsWith("commands/") && rel2.endsWith(".md") && _isDir5(_roots.SRC_DOMAINS)) {
|
|
17165
|
+
const subpath = rel2.slice("commands/".length, rel2.length - ".md".length);
|
|
17166
17166
|
for (const packDir of _iterdirSorted3(_roots.SRC_DOMAINS)) {
|
|
17167
17167
|
const cand = path30.join(packDir, subpath, "command.md");
|
|
17168
17168
|
if (_isFile7(cand)) {
|
|
@@ -17170,7 +17170,7 @@ function resolve_logical(logical_rel) {
|
|
|
17170
17170
|
}
|
|
17171
17171
|
}
|
|
17172
17172
|
}
|
|
17173
|
-
const guideline = resolve_guideline(_roots.ROOT,
|
|
17173
|
+
const guideline = resolve_guideline(_roots.ROOT, rel2);
|
|
17174
17174
|
if (guideline !== null) {
|
|
17175
17175
|
return guideline;
|
|
17176
17176
|
}
|
|
@@ -21868,17 +21868,17 @@ function freshMatch(pattern, text) {
|
|
|
21868
21868
|
const re = new RegExp(pattern.source, pattern.flags);
|
|
21869
21869
|
return re.exec(text);
|
|
21870
21870
|
}
|
|
21871
|
-
function splitN(text,
|
|
21871
|
+
function splitN(text, sep26, maxsplit) {
|
|
21872
21872
|
const parts = [];
|
|
21873
21873
|
let rest = text;
|
|
21874
21874
|
let count = 0;
|
|
21875
21875
|
while (count < maxsplit) {
|
|
21876
|
-
const idx = rest.indexOf(
|
|
21876
|
+
const idx = rest.indexOf(sep26);
|
|
21877
21877
|
if (idx === -1) {
|
|
21878
21878
|
break;
|
|
21879
21879
|
}
|
|
21880
21880
|
parts.push(rest.slice(0, idx));
|
|
21881
|
-
rest = rest.slice(idx +
|
|
21881
|
+
rest = rest.slice(idx + sep26.length);
|
|
21882
21882
|
count += 1;
|
|
21883
21883
|
}
|
|
21884
21884
|
parts.push(rest);
|
|
@@ -21915,8 +21915,8 @@ function iterdir(dir) {
|
|
|
21915
21915
|
function isUnder(child, parent) {
|
|
21916
21916
|
const c = path33.resolve(child);
|
|
21917
21917
|
const par = path33.resolve(parent);
|
|
21918
|
-
const
|
|
21919
|
-
return
|
|
21918
|
+
const rel2 = path33.relative(par, c);
|
|
21919
|
+
return rel2 !== "" && !rel2.startsWith("..") && !path33.isAbsolute(rel2);
|
|
21920
21920
|
}
|
|
21921
21921
|
function relPosix(child, parent) {
|
|
21922
21922
|
return path33.relative(path33.resolve(parent), path33.resolve(child)).split(path33.sep).join("/");
|
|
@@ -22743,14 +22743,14 @@ function isTrackedInGit(abs, repo_root2) {
|
|
|
22743
22743
|
return r.status === 0;
|
|
22744
22744
|
}
|
|
22745
22745
|
function evaluateDashboardState(inp) {
|
|
22746
|
-
const { mode, present, trackedInGit, current, rel } = inp;
|
|
22746
|
+
const { mode, present, trackedInGit, current, rel: rel2 } = inp;
|
|
22747
22747
|
const regen = inp.regen ?? REGEN;
|
|
22748
22748
|
const noun = inp.noun ?? "dashboard";
|
|
22749
22749
|
if (mode === "untracked" && trackedInGit) {
|
|
22750
22750
|
return {
|
|
22751
22751
|
stale: true,
|
|
22752
|
-
error: `\u274C ${
|
|
22753
|
-
git rm --cached ${
|
|
22752
|
+
error: `\u274C ${rel2} is still tracked by git, but this repository runs \`--untracked-mode\`. Untrack it, keeping the working-tree file:
|
|
22753
|
+
git rm --cached ${rel2}
|
|
22754
22754
|
`,
|
|
22755
22755
|
ok: null
|
|
22756
22756
|
};
|
|
@@ -22759,7 +22759,7 @@ function evaluateDashboardState(inp) {
|
|
|
22759
22759
|
if (mode === "tracked") {
|
|
22760
22760
|
return {
|
|
22761
22761
|
stale: true,
|
|
22762
|
-
error: `\u274C ${
|
|
22762
|
+
error: `\u274C ${rel2} is missing. ` + regen.replace("to regenerate", "to generate it") + ` If this repository deliberately does not commit the ${noun}, pass \`--untracked-mode\`.
|
|
22763
22763
|
`,
|
|
22764
22764
|
ok: null
|
|
22765
22765
|
};
|
|
@@ -22767,15 +22767,15 @@ function evaluateDashboardState(inp) {
|
|
|
22767
22767
|
return {
|
|
22768
22768
|
stale: false,
|
|
22769
22769
|
error: null,
|
|
22770
|
-
ok: `\u2705 ${
|
|
22770
|
+
ok: `\u2705 ${rel2} is not committed here (--untracked-mode) and no stale copy is on disk.
|
|
22771
22771
|
`
|
|
22772
22772
|
};
|
|
22773
22773
|
}
|
|
22774
22774
|
if (!current) {
|
|
22775
|
-
return { stale: true, error: `\u274C ${
|
|
22775
|
+
return { stale: true, error: `\u274C ${rel2} is stale. ${regen}
|
|
22776
22776
|
`, ok: null };
|
|
22777
22777
|
}
|
|
22778
|
-
return { stale: false, error: null, ok: `\u2705 ${
|
|
22778
|
+
return { stale: false, error: null, ok: `\u2705 ${rel2} is up to date.
|
|
22779
22779
|
` };
|
|
22780
22780
|
}
|
|
22781
22781
|
function evaluateDashboardOnDisk(opts) {
|
|
@@ -22959,10 +22959,10 @@ function scan(root, today) {
|
|
|
22959
22959
|
}
|
|
22960
22960
|
function release_dates(root) {
|
|
22961
22961
|
const out = [];
|
|
22962
|
-
for (const
|
|
22962
|
+
for (const rel2 of CHANGELOG_ERAS) {
|
|
22963
22963
|
let text;
|
|
22964
22964
|
try {
|
|
22965
|
-
text = fs40.readFileSync(path37.join(root,
|
|
22965
|
+
text = fs40.readFileSync(path37.join(root, rel2), "utf8");
|
|
22966
22966
|
} catch {
|
|
22967
22967
|
continue;
|
|
22968
22968
|
}
|
|
@@ -23640,8 +23640,8 @@ function parse_roadmap(p, roadmap_root) {
|
|
|
23640
23640
|
}
|
|
23641
23641
|
const title_match = TITLE_RE.exec(text);
|
|
23642
23642
|
const title = title_match ? _strip3(title_match[1]) : _stem2(p);
|
|
23643
|
-
const
|
|
23644
|
-
const stats = new RoadmapStats(p,
|
|
23643
|
+
const rel2 = _relPosix(roadmap_root, p);
|
|
23644
|
+
const stats = new RoadmapStats(p, rel2, title, [], parse_blockers(text));
|
|
23645
23645
|
for (let i = 0; i < phase_matches.length; i++) {
|
|
23646
23646
|
const cur = phase_matches[i];
|
|
23647
23647
|
const start = cur.end;
|
|
@@ -23661,8 +23661,8 @@ function _stem2(p) {
|
|
|
23661
23661
|
function _relPosix(root, p) {
|
|
23662
23662
|
return path39.relative(root, p).split(path39.sep).join("/");
|
|
23663
23663
|
}
|
|
23664
|
-
function _blockerAnchor(
|
|
23665
|
-
const stem3 =
|
|
23664
|
+
function _blockerAnchor(rel2) {
|
|
23665
|
+
const stem3 = rel2.endsWith(".md") ? rel2.slice(0, -3) : rel2;
|
|
23666
23666
|
return "blockers-" + stem3.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
|
|
23667
23667
|
}
|
|
23668
23668
|
function bar(pct5, width = 10) {
|
|
@@ -24140,9 +24140,9 @@ function main12(argv) {
|
|
|
24140
24140
|
}
|
|
24141
24141
|
};
|
|
24142
24142
|
if (args.check) {
|
|
24143
|
-
const
|
|
24143
|
+
const rel2 = _relPosix(repo_root2, target);
|
|
24144
24144
|
const r = reportCheckVerdict({
|
|
24145
|
-
verdict: evaluateDashboardOnDisk({ mode: args.mode, target, repo_root: repo_root2, rendered: new_text, rel }),
|
|
24145
|
+
verdict: evaluateDashboardOnDisk({ mode: args.mode, target, repo_root: repo_root2, rendered: new_text, rel: rel2 }),
|
|
24146
24146
|
complete,
|
|
24147
24147
|
pending,
|
|
24148
24148
|
dashboardOnly: args.dashboard_only,
|
|
@@ -24260,9 +24260,9 @@ var init_update_roadmap_progress = __esm({
|
|
|
24260
24260
|
title;
|
|
24261
24261
|
phases;
|
|
24262
24262
|
blockers;
|
|
24263
|
-
constructor(p,
|
|
24263
|
+
constructor(p, rel2, title, phases = [], blockers = []) {
|
|
24264
24264
|
this.path = p;
|
|
24265
|
-
this.rel =
|
|
24265
|
+
this.rel = rel2;
|
|
24266
24266
|
this.title = title;
|
|
24267
24267
|
this.phases = phases;
|
|
24268
24268
|
this.blockers = blockers;
|
|
@@ -24412,8 +24412,8 @@ function _title(sourceText, sourceSlug) {
|
|
|
24412
24412
|
const h1 = /^#[ \t]+(.+?)[ \t]*$/m.exec(sourceText.replace(/^---\n[\s\S]*?\n---\n/, ""));
|
|
24413
24413
|
return h1 !== null ? h1[1] : sourceSlug.replace(/-/g, " ");
|
|
24414
24414
|
}
|
|
24415
|
-
function planCarry(root,
|
|
24416
|
-
const sourceSlug =
|
|
24415
|
+
function planCarry(root, rel2, text, openBlockerIds, date, ownerDecision = "ask") {
|
|
24416
|
+
const sourceSlug = rel2.replace(/\.md$/, "");
|
|
24417
24417
|
const lines = text.split("\n");
|
|
24418
24418
|
const steps = _bareSteps(lines);
|
|
24419
24419
|
if (steps.length === 0) return { refused: "no bare `[~]` step to carry" };
|
|
@@ -24587,8 +24587,8 @@ function _branch_touched_paths(root, base) {
|
|
|
24587
24587
|
}
|
|
24588
24588
|
return out;
|
|
24589
24589
|
}
|
|
24590
|
-
function _is_frozen_record(
|
|
24591
|
-
const norm =
|
|
24590
|
+
function _is_frozen_record(rel2) {
|
|
24591
|
+
const norm = rel2.split(path41.sep).join("/");
|
|
24592
24592
|
return _FROZEN_RECORD_PREFIXES.some((p) => norm.startsWith(p)) || norm.endsWith(".patch");
|
|
24593
24593
|
}
|
|
24594
24594
|
function _inbound_ref_rewrite(root, old_rel, new_rel, dry_run, tracked = true) {
|
|
@@ -24604,14 +24604,14 @@ function _inbound_ref_rewrite(root, old_rel, new_rel, dry_run, tracked = true) {
|
|
|
24604
24604
|
candidates = _fs_grep_files(root, old_rel);
|
|
24605
24605
|
}
|
|
24606
24606
|
for (const line of candidates) {
|
|
24607
|
-
const
|
|
24608
|
-
if (!
|
|
24607
|
+
const rel2 = line.trim();
|
|
24608
|
+
if (!rel2 || rel2 === old_rel) {
|
|
24609
24609
|
continue;
|
|
24610
24610
|
}
|
|
24611
|
-
if (_is_frozen_record(
|
|
24611
|
+
if (_is_frozen_record(rel2)) {
|
|
24612
24612
|
continue;
|
|
24613
24613
|
}
|
|
24614
|
-
const fp = path41.join(root,
|
|
24614
|
+
const fp = path41.join(root, rel2);
|
|
24615
24615
|
let text;
|
|
24616
24616
|
try {
|
|
24617
24617
|
text = fs44.readFileSync(fp, { encoding: "utf-8" });
|
|
@@ -24624,7 +24624,7 @@ function _inbound_ref_rewrite(root, old_rel, new_rel, dry_run, tracked = true) {
|
|
|
24624
24624
|
if (!dry_run) {
|
|
24625
24625
|
fs44.writeFileSync(fp, _replaceAll(text, old_rel, new_rel), { encoding: "utf-8" });
|
|
24626
24626
|
}
|
|
24627
|
-
changed.push(
|
|
24627
|
+
changed.push(rel2);
|
|
24628
24628
|
}
|
|
24629
24629
|
return changed;
|
|
24630
24630
|
}
|
|
@@ -24655,12 +24655,12 @@ function _blockerStatuses(text) {
|
|
|
24655
24655
|
}
|
|
24656
24656
|
return out;
|
|
24657
24657
|
}
|
|
24658
|
-
function _indexContent(root,
|
|
24659
|
-
const cp = _run(["git", "show", `:${
|
|
24658
|
+
function _indexContent(root, rel2) {
|
|
24659
|
+
const cp = _run(["git", "show", `:${rel2}`], root);
|
|
24660
24660
|
return cp.returncode === 0 ? cp.stdout : null;
|
|
24661
24661
|
}
|
|
24662
|
-
function _blockerDivergence(root,
|
|
24663
|
-
const staged = _indexContent(root,
|
|
24662
|
+
function _blockerDivergence(root, rel2, workTreeText) {
|
|
24663
|
+
const staged = _indexContent(root, rel2);
|
|
24664
24664
|
if (staged === null) {
|
|
24665
24665
|
return [];
|
|
24666
24666
|
}
|
|
@@ -24748,8 +24748,8 @@ function parseDeferredItems(text) {
|
|
|
24748
24748
|
}
|
|
24749
24749
|
return out;
|
|
24750
24750
|
}
|
|
24751
|
-
function deferralProblems(root,
|
|
24752
|
-
const sourceSlug =
|
|
24751
|
+
function deferralProblems(root, rel2, text, alsoArchiving = /* @__PURE__ */ new Set()) {
|
|
24752
|
+
const sourceSlug = rel2.replace(/\.md$/, "");
|
|
24753
24753
|
const problems = [];
|
|
24754
24754
|
for (const item of parseDeferredItems(text)) {
|
|
24755
24755
|
const label2 = item.text === "" ? "(unnamed step)" : item.text;
|
|
@@ -24925,19 +24925,19 @@ function archive_completed(root, opts) {
|
|
|
24925
24925
|
}
|
|
24926
24926
|
return archived;
|
|
24927
24927
|
}
|
|
24928
|
-
function _ownerDecisionBlock(
|
|
24928
|
+
function _ownerDecisionBlock(rel2, plan) {
|
|
24929
24929
|
const ids = plan.ownerBlockers.join(", ");
|
|
24930
24930
|
const park = `agents/roadmaps/later/${plan.destSlug}.md`;
|
|
24931
24931
|
const step = plan.firstStep.split("\n").map((l) => ` ${l}`).join("\n");
|
|
24932
24932
|
const record = {
|
|
24933
|
-
roadmap: `agents/roadmaps/${
|
|
24933
|
+
roadmap: `agents/roadmaps/${rel2}`,
|
|
24934
24934
|
owner_blockers: plan.ownerBlockers,
|
|
24935
24935
|
deferred_steps: plan.carried,
|
|
24936
24936
|
park_to: park,
|
|
24937
|
-
archive_command: `./agent-config roadmap:archive --all --owner-decision later --only ${
|
|
24937
|
+
archive_command: `./agent-config roadmap:archive --all --owner-decision later --only ${rel2}`,
|
|
24938
24938
|
first_step: plan.firstStep
|
|
24939
24939
|
};
|
|
24940
|
-
return ` \u2753 ${
|
|
24940
|
+
return ` \u2753 ${rel2}: ${plan.carried} deferred step(s) wait on owner blocker(s) ${ids} \u2014 not archived; the owner decides:
|
|
24941
24941
|
1. Archive it \u2014 the steps and their blockers park in ${park}
|
|
24942
24942
|
(${record.archive_command})
|
|
24943
24943
|
2. Work them step by step, starting with:
|
|
@@ -24983,9 +24983,9 @@ function _regen_archive_index(root, dry_run) {
|
|
|
24983
24983
|
return;
|
|
24984
24984
|
}
|
|
24985
24985
|
_runTwin(root, script);
|
|
24986
|
-
for (const
|
|
24987
|
-
if (_isFile10(path41.join(root,
|
|
24988
|
-
_run(["git", "add", "--",
|
|
24986
|
+
for (const rel2 of ["agents/roadmaps/archive/INDEX.md", "agents/roadmaps/archive/index.json"]) {
|
|
24987
|
+
if (_isFile10(path41.join(root, rel2))) {
|
|
24988
|
+
_run(["git", "add", "--", rel2], root);
|
|
24989
24989
|
}
|
|
24990
24990
|
}
|
|
24991
24991
|
}
|
|
@@ -25904,8 +25904,8 @@ function atomicAppendLine(target, line) {
|
|
|
25904
25904
|
} catch {
|
|
25905
25905
|
existing = "";
|
|
25906
25906
|
}
|
|
25907
|
-
const
|
|
25908
|
-
atomicWriteFile(target, `${existing}${
|
|
25907
|
+
const sep26 = existing.length > 0 && !existing.endsWith("\n") ? "\n" : "";
|
|
25908
|
+
atomicWriteFile(target, `${existing}${sep26}${line}
|
|
25909
25909
|
`);
|
|
25910
25910
|
}
|
|
25911
25911
|
function randSuffix() {
|
|
@@ -27106,8 +27106,8 @@ function lockfile_path(env) {
|
|
|
27106
27106
|
}
|
|
27107
27107
|
return write_target("installed.lock", { env: env ?? null });
|
|
27108
27108
|
}
|
|
27109
|
-
function read_lockfile(
|
|
27110
|
-
const target =
|
|
27109
|
+
function read_lockfile(path124) {
|
|
27110
|
+
const target = path124 ?? lockfile_path();
|
|
27111
27111
|
let text;
|
|
27112
27112
|
try {
|
|
27113
27113
|
text = fs56.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -27378,10 +27378,10 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
|
|
|
27378
27378
|
const entries = fs57.readdirSync(node2).sort((a, b) => a < b ? -1 : a > b ? 1 : 0);
|
|
27379
27379
|
for (const name of entries) {
|
|
27380
27380
|
const entry = path53.join(node2, name);
|
|
27381
|
-
const
|
|
27381
|
+
const rel2 = join_rel(prefix, name);
|
|
27382
27382
|
const lst = fs57.lstatSync(entry);
|
|
27383
27383
|
if (lst.isDirectory() && !lst.isSymbolicLink()) {
|
|
27384
|
-
_walk(entry,
|
|
27384
|
+
_walk(entry, rel2);
|
|
27385
27385
|
continue;
|
|
27386
27386
|
}
|
|
27387
27387
|
let resolved_is_dir = false;
|
|
@@ -27391,13 +27391,13 @@ function expected_deploy_files(src, dest_rel, file_filter = null) {
|
|
|
27391
27391
|
resolved_is_dir = false;
|
|
27392
27392
|
}
|
|
27393
27393
|
if (resolved_is_dir) {
|
|
27394
|
-
_walk(fs57.realpathSync(entry),
|
|
27394
|
+
_walk(fs57.realpathSync(entry), rel2);
|
|
27395
27395
|
continue;
|
|
27396
27396
|
}
|
|
27397
27397
|
if (file_filter !== null && !file_filter(entry)) {
|
|
27398
27398
|
continue;
|
|
27399
27399
|
}
|
|
27400
|
-
out.add(as_posix(
|
|
27400
|
+
out.add(as_posix(rel2));
|
|
27401
27401
|
}
|
|
27402
27402
|
};
|
|
27403
27403
|
_walk(src, dest_rel);
|
|
@@ -27431,11 +27431,11 @@ function reap_stale(tool_id, anchor, current_files, inventory, dry_run = false)
|
|
|
27431
27431
|
const deleted = [];
|
|
27432
27432
|
const prune_candidates = /* @__PURE__ */ new Set();
|
|
27433
27433
|
const orphans = difference(prev_files, current_files);
|
|
27434
|
-
for (const
|
|
27435
|
-
if (typeof
|
|
27434
|
+
for (const rel2 of sorted_strings(orphans)) {
|
|
27435
|
+
if (typeof rel2 !== "string" || !rel2 || rel2.startsWith("/") || rel2.startsWith("..")) {
|
|
27436
27436
|
continue;
|
|
27437
27437
|
}
|
|
27438
|
-
const target = path53.join(anchor_resolved,
|
|
27438
|
+
const target = path53.join(anchor_resolved, rel2);
|
|
27439
27439
|
try {
|
|
27440
27440
|
relative_to(resolve_path(path53.dirname(target)), anchor_resolved);
|
|
27441
27441
|
} catch {
|
|
@@ -27493,8 +27493,8 @@ function reap_tagged_orphans(anchor, dest_subs, current_files, package_tag, dry_
|
|
|
27493
27493
|
if (md_lst.isDirectory()) {
|
|
27494
27494
|
continue;
|
|
27495
27495
|
}
|
|
27496
|
-
const
|
|
27497
|
-
if (current_files.has(
|
|
27496
|
+
const rel2 = relative_to_posix(md, anchor_resolved);
|
|
27497
|
+
if (current_files.has(rel2)) {
|
|
27498
27498
|
continue;
|
|
27499
27499
|
}
|
|
27500
27500
|
try {
|
|
@@ -27562,18 +27562,18 @@ function prune_empty_dirs(prune_candidates, anchor_resolved) {
|
|
|
27562
27562
|
}
|
|
27563
27563
|
}
|
|
27564
27564
|
function is_ancestor(anchor, node2) {
|
|
27565
|
-
const
|
|
27566
|
-
return
|
|
27565
|
+
const rel2 = path53.relative(anchor, node2);
|
|
27566
|
+
return rel2 !== "" && !rel2.startsWith("..") && !path53.isAbsolute(rel2);
|
|
27567
27567
|
}
|
|
27568
27568
|
function relative_to(child, parent) {
|
|
27569
27569
|
if (child === parent) {
|
|
27570
27570
|
return "";
|
|
27571
27571
|
}
|
|
27572
|
-
const
|
|
27573
|
-
if (
|
|
27572
|
+
const rel2 = path53.relative(parent, child);
|
|
27573
|
+
if (rel2.startsWith("..") || path53.isAbsolute(rel2)) {
|
|
27574
27574
|
throw new Error(`'${child}' is not in the subpath of '${parent}'`);
|
|
27575
27575
|
}
|
|
27576
|
-
return
|
|
27576
|
+
return rel2;
|
|
27577
27577
|
}
|
|
27578
27578
|
function relative_to_posix(child, parent) {
|
|
27579
27579
|
return path53.relative(parent, child).split(path53.sep).join("/");
|
|
@@ -27650,9 +27650,9 @@ function recorded_absolute_files(inventory, home) {
|
|
|
27650
27650
|
const files = e["files"];
|
|
27651
27651
|
if (typeof anchor !== "string" || !Array.isArray(files)) continue;
|
|
27652
27652
|
const expanded = expanduser_at(anchor, home);
|
|
27653
|
-
for (const
|
|
27654
|
-
if (typeof
|
|
27655
|
-
const lexical = path53.resolve(expanded,
|
|
27653
|
+
for (const rel2 of files) {
|
|
27654
|
+
if (typeof rel2 !== "string") continue;
|
|
27655
|
+
const lexical = path53.resolve(expanded, rel2);
|
|
27656
27656
|
out.add(lexical);
|
|
27657
27657
|
out.add(resolve_path(lexical));
|
|
27658
27658
|
}
|
|
@@ -29762,17 +29762,17 @@ function _split_frontmatter(text) {
|
|
|
29762
29762
|
}
|
|
29763
29763
|
return [parts[1], parts[2]];
|
|
29764
29764
|
}
|
|
29765
|
-
function _pySplit(s,
|
|
29765
|
+
function _pySplit(s, sep26, maxsplit) {
|
|
29766
29766
|
const out = [];
|
|
29767
29767
|
let rest = s;
|
|
29768
29768
|
let n = 0;
|
|
29769
29769
|
while (n < maxsplit) {
|
|
29770
|
-
const idx = rest.indexOf(
|
|
29770
|
+
const idx = rest.indexOf(sep26);
|
|
29771
29771
|
if (idx === -1) {
|
|
29772
29772
|
break;
|
|
29773
29773
|
}
|
|
29774
29774
|
out.push(rest.slice(0, idx));
|
|
29775
|
-
rest = rest.slice(idx +
|
|
29775
|
+
rest = rest.slice(idx + sep26.length);
|
|
29776
29776
|
n++;
|
|
29777
29777
|
}
|
|
29778
29778
|
out.push(rest);
|
|
@@ -30505,10 +30505,10 @@ function parseClaudeMdImports(claudeMdPath) {
|
|
|
30505
30505
|
for (const line of text.split("\n")) {
|
|
30506
30506
|
const m = IMPORT_LINE_RE.exec(line.trim());
|
|
30507
30507
|
if (!m) continue;
|
|
30508
|
-
const
|
|
30509
|
-
const resolved = path64.isAbsolute(
|
|
30508
|
+
const rel2 = m[1];
|
|
30509
|
+
const resolved = path64.isAbsolute(rel2) ? rel2 : path64.join(base, rel2);
|
|
30510
30510
|
const chars = readCharsIfExists(resolved);
|
|
30511
|
-
if (chars > 0) out.push({ file:
|
|
30511
|
+
if (chars > 0) out.push({ file: rel2, chars });
|
|
30512
30512
|
}
|
|
30513
30513
|
return out;
|
|
30514
30514
|
}
|
|
@@ -31311,13 +31311,13 @@ function checkSettingsResolution(iterOverrides) {
|
|
|
31311
31311
|
remedy: ""
|
|
31312
31312
|
};
|
|
31313
31313
|
}
|
|
31314
|
-
function checkRouterArtifact(repoRoot,
|
|
31315
|
-
const abs = path67.join(repoRoot,
|
|
31314
|
+
function checkRouterArtifact(repoRoot, rel2 = "dist/router.json") {
|
|
31315
|
+
const abs = path67.join(repoRoot, rel2);
|
|
31316
31316
|
if (!fs67.existsSync(abs)) {
|
|
31317
31317
|
return {
|
|
31318
31318
|
id: "router-artifact",
|
|
31319
31319
|
status: "warn",
|
|
31320
|
-
message: `${
|
|
31320
|
+
message: `${rel2} is absent \u2014 no rule router is deployed`,
|
|
31321
31321
|
remedy: "task generate-tools"
|
|
31322
31322
|
};
|
|
31323
31323
|
}
|
|
@@ -31328,7 +31328,7 @@ function checkRouterArtifact(repoRoot, rel = "dist/router.json") {
|
|
|
31328
31328
|
return {
|
|
31329
31329
|
id: "router-artifact",
|
|
31330
31330
|
status: "fail",
|
|
31331
|
-
message: `${
|
|
31331
|
+
message: `${rel2} exists but does NOT parse: ${e instanceof Error ? e.message : String(e)}`,
|
|
31332
31332
|
remedy: "task generate-tools (a present-but-unparseable router loads as zero rules)"
|
|
31333
31333
|
};
|
|
31334
31334
|
}
|
|
@@ -31337,11 +31337,11 @@ function checkRouterArtifact(repoRoot, rel = "dist/router.json") {
|
|
|
31337
31337
|
return {
|
|
31338
31338
|
id: "router-artifact",
|
|
31339
31339
|
status: "warn",
|
|
31340
|
-
message: `${
|
|
31340
|
+
message: `${rel2} parses and carries ZERO rules \u2014 a router with no rules routes nothing`,
|
|
31341
31341
|
remedy: "task generate-tools"
|
|
31342
31342
|
};
|
|
31343
31343
|
}
|
|
31344
|
-
return { id: "router-artifact", status: "ok", message: `${
|
|
31344
|
+
return { id: "router-artifact", status: "ok", message: `${rel2} parses \xB7 ${String(rules)} rule(s)`, remedy: "" };
|
|
31345
31345
|
}
|
|
31346
31346
|
function _routerRuleCount(doc) {
|
|
31347
31347
|
if (doc === null || typeof doc !== "object") return 0;
|
|
@@ -31741,27 +31741,27 @@ function classifyNamedPath(projectRoot, entry) {
|
|
|
31741
31741
|
for (const { test, reason } of UNRESOLVABLE_REASONS) {
|
|
31742
31742
|
if (test(entry.raw)) return { ...entry, normalised: null, outcome: "unresolvable", reason };
|
|
31743
31743
|
}
|
|
31744
|
-
const
|
|
31745
|
-
if (
|
|
31744
|
+
const rel2 = entry.raw.replace(/^\.\//, "").replace(/\/$/, "");
|
|
31745
|
+
if (rel2 === "") {
|
|
31746
31746
|
return { ...entry, normalised: null, outcome: "unresolvable", reason: "empty after normalisation" };
|
|
31747
31747
|
}
|
|
31748
|
-
const abs = path68.join(projectRoot,
|
|
31748
|
+
const abs = path68.join(projectRoot, rel2);
|
|
31749
31749
|
if (!path68.resolve(abs).startsWith(path68.resolve(projectRoot))) {
|
|
31750
|
-
return { ...entry, normalised:
|
|
31750
|
+
return { ...entry, normalised: rel2, outcome: "unresolvable", reason: "escapes the repository root" };
|
|
31751
31751
|
}
|
|
31752
|
-
return { ...entry, normalised:
|
|
31752
|
+
return { ...entry, normalised: rel2, outcome: fs68.existsSync(abs) ? "present" : "dangling" };
|
|
31753
31753
|
}
|
|
31754
31754
|
function resolveInstructionPaths(projectRoot) {
|
|
31755
31755
|
const out = [];
|
|
31756
|
-
for (const
|
|
31757
|
-
const abs = path68.join(projectRoot,
|
|
31756
|
+
for (const rel2 of ROOT_INSTRUCTION_FILES) {
|
|
31757
|
+
const abs = path68.join(projectRoot, rel2);
|
|
31758
31758
|
let text;
|
|
31759
31759
|
try {
|
|
31760
31760
|
text = fs68.readFileSync(abs, "utf8");
|
|
31761
31761
|
} catch {
|
|
31762
31762
|
continue;
|
|
31763
31763
|
}
|
|
31764
|
-
for (const entry of extractNamedPaths(projectRoot,
|
|
31764
|
+
for (const entry of extractNamedPaths(projectRoot, rel2, text)) {
|
|
31765
31765
|
out.push(classifyNamedPath(projectRoot, entry));
|
|
31766
31766
|
}
|
|
31767
31767
|
}
|
|
@@ -31799,15 +31799,15 @@ function checkInstructionPaths(projectRoot) {
|
|
|
31799
31799
|
}
|
|
31800
31800
|
function readVersionPins(projectRoot) {
|
|
31801
31801
|
const out = [];
|
|
31802
|
-
for (const { rel, legacy } of SETTINGS_PIN_FILES) {
|
|
31802
|
+
for (const { rel: rel2, legacy } of SETTINGS_PIN_FILES) {
|
|
31803
31803
|
let text;
|
|
31804
31804
|
try {
|
|
31805
|
-
text = fs68.readFileSync(path68.join(projectRoot,
|
|
31805
|
+
text = fs68.readFileSync(path68.join(projectRoot, rel2), "utf8");
|
|
31806
31806
|
} catch {
|
|
31807
31807
|
continue;
|
|
31808
31808
|
}
|
|
31809
31809
|
const m = PIN_RE.exec(text);
|
|
31810
|
-
if (m?.[1] !== void 0) out.push({ file:
|
|
31810
|
+
if (m?.[1] !== void 0) out.push({ file: rel2, legacy, version: m[1] });
|
|
31811
31811
|
}
|
|
31812
31812
|
return out;
|
|
31813
31813
|
}
|
|
@@ -36940,8 +36940,8 @@ function binOnPath(name, pathEnv) {
|
|
|
36940
36940
|
return resolveBinaryPath(name, pathEnv) !== null;
|
|
36941
36941
|
}
|
|
36942
36942
|
function isToolInstalled(signal, home, pathEnv) {
|
|
36943
|
-
for (const
|
|
36944
|
-
if (existsSync37(join65(home,
|
|
36943
|
+
for (const rel2 of signal.homePaths ?? []) {
|
|
36944
|
+
if (existsSync37(join65(home, rel2))) return true;
|
|
36945
36945
|
}
|
|
36946
36946
|
for (const abs of signal.absPaths ?? []) {
|
|
36947
36947
|
if (existsSync37(abs)) return true;
|
|
@@ -37100,8 +37100,8 @@ function classifyCodexAuth(authPath) {
|
|
|
37100
37100
|
function cliSubscriptionEvidence(provider, home, env, claudeConfigDir, probeKeychain) {
|
|
37101
37101
|
if (provider === "anthropic") {
|
|
37102
37102
|
const configDir = claudeConfigDir;
|
|
37103
|
-
for (const
|
|
37104
|
-
const p = path75.join(configDir,
|
|
37103
|
+
for (const rel2 of [".credentials.json", "credentials.json"]) {
|
|
37104
|
+
const p = path75.join(configDir, rel2);
|
|
37105
37105
|
if (isFile4(p)) return { source: "cli-subscription", evidence: p };
|
|
37106
37106
|
}
|
|
37107
37107
|
if (probeKeychain(CLAUDE_KEYCHAIN_SERVICE)) {
|
|
@@ -38309,7 +38309,7 @@ var init_review_gate = __esm({
|
|
|
38309
38309
|
|
|
38310
38310
|
// src/scripts/_lib/foreign_scan.ts
|
|
38311
38311
|
import * as fs78 from "node:fs";
|
|
38312
|
-
function rglob2(root, isDir6,
|
|
38312
|
+
function rglob2(root, isDir6, join101) {
|
|
38313
38313
|
const out = [];
|
|
38314
38314
|
const walk = (dir) => {
|
|
38315
38315
|
let entries;
|
|
@@ -38320,7 +38320,7 @@ function rglob2(root, isDir6, join100) {
|
|
|
38320
38320
|
}
|
|
38321
38321
|
entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
38322
38322
|
for (const ent of entries) {
|
|
38323
|
-
const full =
|
|
38323
|
+
const full = join101(dir, ent.name);
|
|
38324
38324
|
out.push(full);
|
|
38325
38325
|
let dirLike = ent.isDirectory();
|
|
38326
38326
|
if (ent.isSymbolicLink()) {
|
|
@@ -39491,8 +39491,8 @@ function _exec_block(body) {
|
|
|
39491
39491
|
}
|
|
39492
39492
|
return out;
|
|
39493
39493
|
}
|
|
39494
|
-
function grantSurface(
|
|
39495
|
-
return
|
|
39494
|
+
function grantSurface(rel2) {
|
|
39495
|
+
return rel2.replace(/\\/g, "/").includes("src/subagents/") ? "subagent" : "skill-like";
|
|
39496
39496
|
}
|
|
39497
39497
|
function _scan4(sf) {
|
|
39498
39498
|
const pragmaForm = sf.pragma_form(CHECK4);
|
|
@@ -41035,9 +41035,9 @@ function runContradictions(projectRoot, packageRoot, opts = {}) {
|
|
|
41035
41035
|
}
|
|
41036
41036
|
if (pairs.length === 0) return { lines: renderReview([]), rows: [] };
|
|
41037
41037
|
let rubric = "";
|
|
41038
|
-
for (const
|
|
41038
|
+
for (const rel2 of [["dist", "agent-src", "rules"], ["src", "rules"]]) {
|
|
41039
41039
|
try {
|
|
41040
|
-
rubric = fs88.readFileSync(path87.join(packageRoot, ...
|
|
41040
|
+
rubric = fs88.readFileSync(path87.join(packageRoot, ...rel2, "neighbour-precedence.md"), "utf-8");
|
|
41041
41041
|
break;
|
|
41042
41042
|
} catch {
|
|
41043
41043
|
}
|
|
@@ -42015,9 +42015,9 @@ function _foreign_records(project_root, foreign) {
|
|
|
42015
42015
|
const out = [];
|
|
42016
42016
|
for (const p of foreign) {
|
|
42017
42017
|
let path_str;
|
|
42018
|
-
const
|
|
42019
|
-
if (
|
|
42020
|
-
path_str =
|
|
42018
|
+
const rel2 = relativeTo(p, project_root);
|
|
42019
|
+
if (rel2 !== null) {
|
|
42020
|
+
path_str = rel2;
|
|
42021
42021
|
} else {
|
|
42022
42022
|
path_str = String(p);
|
|
42023
42023
|
}
|
|
@@ -42031,12 +42031,12 @@ function _foreign_records(project_root, foreign) {
|
|
|
42031
42031
|
return out;
|
|
42032
42032
|
}
|
|
42033
42033
|
function relativeTo(p, base) {
|
|
42034
|
-
const
|
|
42035
|
-
if (
|
|
42036
|
-
if (
|
|
42034
|
+
const rel2 = path90.relative(base, p);
|
|
42035
|
+
if (rel2 === "") return rel2;
|
|
42036
|
+
if (rel2.startsWith("..") || path90.isAbsolute(rel2)) {
|
|
42037
42037
|
return null;
|
|
42038
42038
|
}
|
|
42039
|
-
return
|
|
42039
|
+
return rel2;
|
|
42040
42040
|
}
|
|
42041
42041
|
function _check_scope(project_root) {
|
|
42042
42042
|
for (const marker of ["pnpm-workspace.yaml", "lerna.json"]) {
|
|
@@ -42212,8 +42212,8 @@ function shutilWhich(name) {
|
|
|
42212
42212
|
return isExecutableFile(name) ? name : null;
|
|
42213
42213
|
}
|
|
42214
42214
|
const pathEnv = process19.env["PATH"] || "";
|
|
42215
|
-
const
|
|
42216
|
-
const dirs = pathEnv.split(
|
|
42215
|
+
const sep26 = process19.platform === "win32" ? ";" : ":";
|
|
42216
|
+
const dirs = pathEnv.split(sep26);
|
|
42217
42217
|
const exts = process19.platform === "win32" ? (process19.env["PATHEXT"] || ".COM;.EXE;.BAT;.CMD").split(";") : [""];
|
|
42218
42218
|
const seenDirs = /* @__PURE__ */ new Set();
|
|
42219
42219
|
for (const dir of dirs) {
|
|
@@ -42486,20 +42486,20 @@ function _check_mcp_mode(project_root) {
|
|
|
42486
42486
|
["mcp.json", "root"]
|
|
42487
42487
|
];
|
|
42488
42488
|
const found = [];
|
|
42489
|
-
for (const [
|
|
42490
|
-
const p = path90.join(project_root,
|
|
42489
|
+
for (const [rel2, label2] of candidates) {
|
|
42490
|
+
const p = path90.join(project_root, rel2);
|
|
42491
42491
|
if (!pathExists2(p)) {
|
|
42492
42492
|
continue;
|
|
42493
42493
|
}
|
|
42494
42494
|
try {
|
|
42495
42495
|
JSON.parse(readText2(p));
|
|
42496
|
-
found.push(`${label2} (${
|
|
42496
|
+
found.push(`${label2} (${rel2})`);
|
|
42497
42497
|
} catch {
|
|
42498
42498
|
return {
|
|
42499
42499
|
id: "mcp-mode",
|
|
42500
42500
|
status: "warn",
|
|
42501
|
-
message: `MCP config at ${
|
|
42502
|
-
remedy: `fix or remove \`${
|
|
42501
|
+
message: `MCP config at ${rel2} is not valid JSON`,
|
|
42502
|
+
remedy: `fix or remove \`${rel2}\` (see docs/architecture.md \xA7 MCP)`
|
|
42503
42503
|
};
|
|
42504
42504
|
}
|
|
42505
42505
|
}
|
|
@@ -42571,11 +42571,11 @@ function _check_stale_orphans() {
|
|
|
42571
42571
|
if (!md.endsWith(".md")) {
|
|
42572
42572
|
continue;
|
|
42573
42573
|
}
|
|
42574
|
-
const
|
|
42575
|
-
if (
|
|
42574
|
+
const rel2 = relativeTo(md, anchor);
|
|
42575
|
+
if (rel2 === null) {
|
|
42576
42576
|
continue;
|
|
42577
42577
|
}
|
|
42578
|
-
const relPosix2 =
|
|
42578
|
+
const relPosix2 = rel2.split(path90.sep).join("/");
|
|
42579
42579
|
if (recorded_set.has(relPosix2)) {
|
|
42580
42580
|
continue;
|
|
42581
42581
|
}
|
|
@@ -42623,8 +42623,8 @@ function _check_rule_scope_drift(project_root) {
|
|
|
42623
42623
|
}
|
|
42624
42624
|
let rules_dir = null;
|
|
42625
42625
|
let found = 0;
|
|
42626
|
-
for (const
|
|
42627
|
-
const cand = path90.join(project_root,
|
|
42626
|
+
for (const rel2 of _RULE_PROJECTION_DIRS) {
|
|
42627
|
+
const cand = path90.join(project_root, rel2);
|
|
42628
42628
|
if (!isDir4(cand)) {
|
|
42629
42629
|
continue;
|
|
42630
42630
|
}
|
|
@@ -42656,11 +42656,11 @@ function _check_rule_scope_drift(project_root) {
|
|
|
42656
42656
|
try {
|
|
42657
42657
|
unexpected = excludedRuleBasenames(rules_dir, scope);
|
|
42658
42658
|
} catch (exc) {
|
|
42659
|
-
const
|
|
42659
|
+
const rel2 = relativeTo(rules_dir, project_root) ?? rules_dir;
|
|
42660
42660
|
return {
|
|
42661
42661
|
id: "rule-scope-drift",
|
|
42662
42662
|
status: "fail",
|
|
42663
|
-
message: `cannot inspect ${
|
|
42663
|
+
message: `cannot inspect ${rel2}: ${osErrorStr2(exc)}`,
|
|
42664
42664
|
remedy: "check read permissions on the projected rule tree"
|
|
42665
42665
|
};
|
|
42666
42666
|
}
|
|
@@ -42691,8 +42691,8 @@ function _check_duplicate_scope_rules(project_root, userRulesDirOverride) {
|
|
|
42691
42691
|
const cand = path90.join(project_root, "dist", "agent-src", "rules");
|
|
42692
42692
|
if (isDir4(cand)) project_rules_dir = cand;
|
|
42693
42693
|
} else {
|
|
42694
|
-
for (const
|
|
42695
|
-
const cand = path90.join(project_root,
|
|
42694
|
+
for (const rel2 of _RULE_PROJECTION_DIRS) {
|
|
42695
|
+
const cand = path90.join(project_root, rel2);
|
|
42696
42696
|
if (isDir4(cand)) {
|
|
42697
42697
|
project_rules_dir = cand;
|
|
42698
42698
|
break;
|
|
@@ -42735,9 +42735,9 @@ function _check_mcp_beta_readiness(project_root) {
|
|
|
42735
42735
|
};
|
|
42736
42736
|
}
|
|
42737
42737
|
const pending = [];
|
|
42738
|
-
for (const [gate_id,
|
|
42739
|
-
if (!pathExists2(path90.join(project_root,
|
|
42740
|
-
pending.push(`${gate_id} (${
|
|
42738
|
+
for (const [gate_id, rel2] of MCP_BETA_GATES) {
|
|
42739
|
+
if (!pathExists2(path90.join(project_root, rel2))) {
|
|
42740
|
+
pending.push(`${gate_id} (${rel2})`);
|
|
42741
42741
|
}
|
|
42742
42742
|
}
|
|
42743
42743
|
if (pending.length === 0) {
|
|
@@ -44233,9 +44233,9 @@ function detectToolPresence(root) {
|
|
|
44233
44233
|
agentsMd: existsSync45(join76(root, "AGENTS.md"))
|
|
44234
44234
|
};
|
|
44235
44235
|
}
|
|
44236
|
-
function isDir5(
|
|
44236
|
+
function isDir5(path124) {
|
|
44237
44237
|
try {
|
|
44238
|
-
return statSync48(
|
|
44238
|
+
return statSync48(path124).isDirectory();
|
|
44239
44239
|
} catch {
|
|
44240
44240
|
return false;
|
|
44241
44241
|
}
|
|
@@ -44300,10 +44300,10 @@ var init_thin_rules = __esm({
|
|
|
44300
44300
|
|
|
44301
44301
|
// src/scripts/router_target_paths.mjs
|
|
44302
44302
|
function parseRouteTarget(target) {
|
|
44303
|
-
const
|
|
44304
|
-
if (
|
|
44305
|
-
const kind = target.slice(0,
|
|
44306
|
-
const id = target.slice(
|
|
44303
|
+
const sep26 = target.indexOf(":");
|
|
44304
|
+
if (sep26 <= 0) return null;
|
|
44305
|
+
const kind = target.slice(0, sep26);
|
|
44306
|
+
const id = target.slice(sep26 + 1);
|
|
44307
44307
|
if (!id) return null;
|
|
44308
44308
|
if (!Object.prototype.hasOwnProperty.call(ROUTE_TARGET_TEMPLATES, kind)) return null;
|
|
44309
44309
|
return { kind, id };
|
|
@@ -46328,6 +46328,8 @@ function segmentVerifies(rawWords) {
|
|
|
46328
46328
|
case "node":
|
|
46329
46329
|
case "deno":
|
|
46330
46330
|
return rest.some((a) => a === "test" || a.startsWith("--test"));
|
|
46331
|
+
case "agent-config":
|
|
46332
|
+
return false;
|
|
46331
46333
|
case "scripts-run": {
|
|
46332
46334
|
const script = bareName(arg1);
|
|
46333
46335
|
return /^(check|lint|verify|validate)[-_]/.test(script);
|
|
@@ -46344,6 +46346,12 @@ function isVerificationCommand(command) {
|
|
|
46344
46346
|
function mightBeVerification(command) {
|
|
46345
46347
|
return _WIDE_CANDIDATE_RE.test(command);
|
|
46346
46348
|
}
|
|
46349
|
+
function isAssetRenderCommand(command) {
|
|
46350
|
+
return /\bui:render\b/.test(command) && /--profile[= ]\s*asset\b/.test(command);
|
|
46351
|
+
}
|
|
46352
|
+
function isVerificationAttempt(command) {
|
|
46353
|
+
return isVerificationCommand(command) || isAssetRenderCommand(command);
|
|
46354
|
+
}
|
|
46347
46355
|
var VERIFY_BINARIES, DELEGATING_HEADS, PATH_PREFIXES, VERIFY_WORD, NPM_SCRIPT_WORD, _WIDE_CANDIDATE_RE;
|
|
46348
46356
|
var init_verification_command = __esm({
|
|
46349
46357
|
"src/scripts/_lib/verification_command.ts"() {
|
|
@@ -48454,11 +48462,11 @@ function _rglobMdSorted4(dir) {
|
|
|
48454
48462
|
return out;
|
|
48455
48463
|
}
|
|
48456
48464
|
function _relToPosixOrAbs(child, root) {
|
|
48457
|
-
const
|
|
48458
|
-
if (
|
|
48465
|
+
const rel2 = path98.relative(root, child);
|
|
48466
|
+
if (rel2 === "" || rel2.startsWith("..") || path98.isAbsolute(rel2)) {
|
|
48459
48467
|
return child.split(path98.sep).join("/");
|
|
48460
48468
|
}
|
|
48461
|
-
return
|
|
48469
|
+
return rel2.split(path98.sep).join("/");
|
|
48462
48470
|
}
|
|
48463
48471
|
function cmd_scan_dir(root) {
|
|
48464
48472
|
let roots;
|
|
@@ -48707,15 +48715,15 @@ function toRepoRelative(root, paths) {
|
|
|
48707
48715
|
});
|
|
48708
48716
|
}
|
|
48709
48717
|
function _relativeInside(from, to) {
|
|
48710
|
-
let
|
|
48718
|
+
let rel2;
|
|
48711
48719
|
try {
|
|
48712
|
-
|
|
48720
|
+
rel2 = path99.relative(from, to);
|
|
48713
48721
|
} catch {
|
|
48714
48722
|
return null;
|
|
48715
48723
|
}
|
|
48716
|
-
if (
|
|
48717
|
-
if (
|
|
48718
|
-
return
|
|
48724
|
+
if (rel2 === "") return ".";
|
|
48725
|
+
if (rel2 === ".." || rel2.startsWith(`..${path99.sep}`) || path99.isAbsolute(rel2)) return null;
|
|
48726
|
+
return rel2.split(path99.sep).join("/");
|
|
48719
48727
|
}
|
|
48720
48728
|
function _resolveReal(p) {
|
|
48721
48729
|
const abs = path99.resolve(p);
|
|
@@ -48838,6 +48846,192 @@ var init_graph_feeder_record = __esm({
|
|
|
48838
48846
|
}
|
|
48839
48847
|
});
|
|
48840
48848
|
|
|
48849
|
+
// src/scripts/hooks/svg_obligation.ts
|
|
48850
|
+
import * as crypto7 from "node:crypto";
|
|
48851
|
+
import * as fs101 from "node:fs";
|
|
48852
|
+
import * as path100 from "node:path";
|
|
48853
|
+
function hasErrorFinding(m) {
|
|
48854
|
+
const f = m.asset?.findings;
|
|
48855
|
+
return Array.isArray(f) && f.some((x) => x?.severity === "error");
|
|
48856
|
+
}
|
|
48857
|
+
function isPlantedFixture(relPath, root = "") {
|
|
48858
|
+
const norm = rel(root, relPath);
|
|
48859
|
+
return PLANTED_PREFIXES.some((prefix) => norm.startsWith(prefix));
|
|
48860
|
+
}
|
|
48861
|
+
function readAssetManifests(root) {
|
|
48862
|
+
const dir = path100.join(root, RENDER_REL);
|
|
48863
|
+
let entries;
|
|
48864
|
+
try {
|
|
48865
|
+
entries = fs101.readdirSync(dir);
|
|
48866
|
+
} catch {
|
|
48867
|
+
return [];
|
|
48868
|
+
}
|
|
48869
|
+
const out = [];
|
|
48870
|
+
for (const name of entries) {
|
|
48871
|
+
let raw;
|
|
48872
|
+
try {
|
|
48873
|
+
raw = fs101.readFileSync(path100.join(dir, name, "manifest.json"), "utf8");
|
|
48874
|
+
} catch {
|
|
48875
|
+
continue;
|
|
48876
|
+
}
|
|
48877
|
+
try {
|
|
48878
|
+
const parsed = JSON.parse(raw);
|
|
48879
|
+
if (parsed.profile === "asset") out.push(parsed);
|
|
48880
|
+
} catch {
|
|
48881
|
+
}
|
|
48882
|
+
}
|
|
48883
|
+
return out;
|
|
48884
|
+
}
|
|
48885
|
+
function dischargeFor(manifests, digest) {
|
|
48886
|
+
let staticOnly = false;
|
|
48887
|
+
for (const m of manifests) {
|
|
48888
|
+
if (m.verification === "verified" && m.asset?.digest === digest && !hasErrorFinding(m)) {
|
|
48889
|
+
return "verified";
|
|
48890
|
+
}
|
|
48891
|
+
if (m.reason === "renderer-absent" && m.static?.digest === digest && m.static.errors === 0) {
|
|
48892
|
+
staticOnly = true;
|
|
48893
|
+
}
|
|
48894
|
+
}
|
|
48895
|
+
return staticOnly ? "static-only" : null;
|
|
48896
|
+
}
|
|
48897
|
+
function readSvgObligations(root, inputs) {
|
|
48898
|
+
const open = [];
|
|
48899
|
+
const discharged = [];
|
|
48900
|
+
const seen = /* @__PURE__ */ new Set();
|
|
48901
|
+
let manifests = null;
|
|
48902
|
+
for (const { path: raw, rendered } of inputs.edits) {
|
|
48903
|
+
if (!/\.svg$/i.test(raw)) continue;
|
|
48904
|
+
const relPath = rel(root, raw);
|
|
48905
|
+
if (seen.has(relPath)) continue;
|
|
48906
|
+
seen.add(relPath);
|
|
48907
|
+
if (isPlantedFixture(relPath, root)) continue;
|
|
48908
|
+
const abs = path100.isAbsolute(raw) ? raw : path100.join(root, relPath);
|
|
48909
|
+
let bytes;
|
|
48910
|
+
try {
|
|
48911
|
+
bytes = fs101.readFileSync(abs);
|
|
48912
|
+
} catch {
|
|
48913
|
+
continue;
|
|
48914
|
+
}
|
|
48915
|
+
const digest = crypto7.createHash("sha256").update(bytes).digest("hex");
|
|
48916
|
+
if (!renderNames(rendered, relPath)) {
|
|
48917
|
+
open.push({
|
|
48918
|
+
file: relPath,
|
|
48919
|
+
reason: "no `ui:render --profile asset` naming this file ran after THIS file's last edit, so no manifest on disk can be attributed to it \u2014 a manifest written by any other route, and a render of some other file, both discharge nothing"
|
|
48920
|
+
});
|
|
48921
|
+
continue;
|
|
48922
|
+
}
|
|
48923
|
+
if (inputs.renderDirTampered) {
|
|
48924
|
+
open.push({
|
|
48925
|
+
file: relPath,
|
|
48926
|
+
reason: "this turn wrote into the render directory by a route other than `ui:render`, so no manifest there is evidence of a render \u2014 re-run the render in a turn that does not touch it"
|
|
48927
|
+
});
|
|
48928
|
+
continue;
|
|
48929
|
+
}
|
|
48930
|
+
manifests ??= readAssetManifests(root);
|
|
48931
|
+
const kind = dischargeFor(manifests, digest);
|
|
48932
|
+
if (kind === null) {
|
|
48933
|
+
open.push({
|
|
48934
|
+
file: relPath,
|
|
48935
|
+
reason: "no asset manifest matches this file's current digest \u2014 a render that is `verified`, or a `renderer-absent` one whose static witness reports 0 errors on the same digest, discharges it"
|
|
48936
|
+
});
|
|
48937
|
+
continue;
|
|
48938
|
+
}
|
|
48939
|
+
discharged.push({ file: relPath, kind });
|
|
48940
|
+
}
|
|
48941
|
+
return { open, discharged };
|
|
48942
|
+
}
|
|
48943
|
+
function renderNames(commands, relPath) {
|
|
48944
|
+
const base = relPath.split("/").pop() ?? relPath;
|
|
48945
|
+
return commands.some((c) => {
|
|
48946
|
+
const slashed = c.split(path100.sep).join("/");
|
|
48947
|
+
const bounded = (needle) => new RegExp(`(^|[\\s/'"])${escapeRe(needle)}(\\s|$|['"])`).test(slashed);
|
|
48948
|
+
return bounded(relPath) || bounded(base);
|
|
48949
|
+
});
|
|
48950
|
+
}
|
|
48951
|
+
function isPureRender(command) {
|
|
48952
|
+
if (!isAssetRenderCommand(command)) return false;
|
|
48953
|
+
const [head, ...pipes] = command.replace(/^\s*cd\s+[^;&|<>`$\n]+&&\s*/, "").replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ").split("|");
|
|
48954
|
+
if (/[;&<>`\n]|\$\(/.test(head ?? "")) return false;
|
|
48955
|
+
return pipes.every((p) => /^\s*(tail|head|grep|jq|cat|less|wc)\b[^;&<>`|]*$/.test(p) && !/\$\(/.test(p));
|
|
48956
|
+
}
|
|
48957
|
+
function writesRenderDir(command) {
|
|
48958
|
+
if (isPureRender(command)) return false;
|
|
48959
|
+
const slashed = command.split(path100.sep).join("/");
|
|
48960
|
+
const names = /(^|[\s/'"])(render\/|manifest\.json\b)/.test(slashed) || slashed.includes("state/render");
|
|
48961
|
+
const writes = />(?!&)|\b(tee|sponge)\b|\b(cp|mv|ln|install|rsync|dd)\s|\bsed\s+-i|\bwriteFile|\b(python[\d.]*|perl|ruby|node|deno|bun|php|osascript)\b/.test(
|
|
48962
|
+
slashed.replace(/\s\d?>&\d\b/g, " ").replace(/\s2>\s*\/dev\/null\b/g, " ")
|
|
48963
|
+
);
|
|
48964
|
+
return names && writes;
|
|
48965
|
+
}
|
|
48966
|
+
function escapeRe(s) {
|
|
48967
|
+
return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
48968
|
+
}
|
|
48969
|
+
function openSvgObligation(workspaceRoot, toolCalls) {
|
|
48970
|
+
const lastEditOf = /* @__PURE__ */ new Map();
|
|
48971
|
+
for (let i = 0; i < toolCalls.length; i += 1) {
|
|
48972
|
+
const c = toolCalls[i];
|
|
48973
|
+
if (!EDIT_TOOLS2.has(c.name) || c.path === void 0) continue;
|
|
48974
|
+
lastEditOf.set(c.path, i);
|
|
48975
|
+
}
|
|
48976
|
+
if (lastEditOf.size === 0) return null;
|
|
48977
|
+
const edits = [...lastEditOf].map(([p, at]) => {
|
|
48978
|
+
const rendered = [];
|
|
48979
|
+
for (let i = at + 1; i < toolCalls.length; i += 1) {
|
|
48980
|
+
const c = toolCalls[i];
|
|
48981
|
+
if (c.name === "Bash" && c.command !== void 0 && isPureRender(c.command)) {
|
|
48982
|
+
rendered.push(c.command);
|
|
48983
|
+
}
|
|
48984
|
+
}
|
|
48985
|
+
return { path: p, rendered };
|
|
48986
|
+
});
|
|
48987
|
+
const renderDir = RENDER_REL.split(path100.sep).join("/");
|
|
48988
|
+
const renderDirTampered = toolCalls.some((c) => {
|
|
48989
|
+
if (EDIT_TOOLS2.has(c.name) && c.path !== void 0) {
|
|
48990
|
+
return rel(workspaceRoot, c.path).startsWith(`${renderDir}/`);
|
|
48991
|
+
}
|
|
48992
|
+
return c.name === "Bash" && c.command !== void 0 && writesRenderDir(c.command);
|
|
48993
|
+
});
|
|
48994
|
+
let reading;
|
|
48995
|
+
try {
|
|
48996
|
+
reading = readSvgObligations(workspaceRoot, { edits, renderDirTampered });
|
|
48997
|
+
} catch {
|
|
48998
|
+
return null;
|
|
48999
|
+
}
|
|
49000
|
+
const first = reading.open[0];
|
|
49001
|
+
if (first === void 0) return null;
|
|
49002
|
+
const more = reading.open.length > 1 ? ` (and ${String(reading.open.length - 1)} more)` : "";
|
|
49003
|
+
return {
|
|
49004
|
+
// Reported under `verification` rather than a seventh detector id: it
|
|
49005
|
+
// IS a verification finding — a file changed and nothing that can fail
|
|
49006
|
+
// ran over it — and a new id would ripple through DETECTOR_IDS, the
|
|
49007
|
+
// per-detector counters and the demotion contract for a distinction the
|
|
49008
|
+
// operator never makes.
|
|
49009
|
+
detector: "verification",
|
|
49010
|
+
mode: "transcript",
|
|
49011
|
+
evidence: first.file,
|
|
49012
|
+
reason: `this turn edited an .svg and no render describes it${more} \u2014 ${first.reason}. A bare \`ui:render --profile asset\` that rendered nothing, and a test or lint run over other files, both discharge nothing: the gate reads the render, never the call.`
|
|
49013
|
+
};
|
|
49014
|
+
}
|
|
49015
|
+
var EDIT_TOOLS2, RENDER_REL, PLANTED_PREFIXES, rel;
|
|
49016
|
+
var init_svg_obligation = __esm({
|
|
49017
|
+
"src/scripts/hooks/svg_obligation.ts"() {
|
|
49018
|
+
"use strict";
|
|
49019
|
+
init_verification_command();
|
|
49020
|
+
EDIT_TOOLS2 = /* @__PURE__ */ new Set(["Edit", "Write", "MultiEdit", "NotebookEdit"]);
|
|
49021
|
+
RENDER_REL = path100.join("agents", "runtime", "state", "render");
|
|
49022
|
+
PLANTED_PREFIXES = [
|
|
49023
|
+
"tests/design-artifacts/fixtures/",
|
|
49024
|
+
"tests/design-artifacts/scenarios/"
|
|
49025
|
+
];
|
|
49026
|
+
rel = (root, p) => {
|
|
49027
|
+
const slashed = p.split(path100.sep).join("/");
|
|
49028
|
+
if (!path100.isAbsolute(p)) return path100.posix.normalize(slashed).replace(/^\.\//, "");
|
|
49029
|
+
const inside = path100.relative(root, p).split(path100.sep).join("/");
|
|
49030
|
+
return inside === "" || inside.startsWith("../") ? slashed : inside;
|
|
49031
|
+
};
|
|
49032
|
+
}
|
|
49033
|
+
});
|
|
49034
|
+
|
|
48841
49035
|
// src/scripts/hooks/envelope.ts
|
|
48842
49036
|
function _isObject5(obj) {
|
|
48843
49037
|
return typeof obj === "object" && obj !== null && !Array.isArray(obj);
|
|
@@ -49080,15 +49274,15 @@ var init_exit_codes = __esm({
|
|
|
49080
49274
|
});
|
|
49081
49275
|
|
|
49082
49276
|
// src/scripts/hooks/subagent_ledger_hook.ts
|
|
49083
|
-
import * as
|
|
49084
|
-
import * as
|
|
49085
|
-
import * as
|
|
49277
|
+
import * as crypto8 from "node:crypto";
|
|
49278
|
+
import * as fs102 from "node:fs";
|
|
49279
|
+
import * as path101 from "node:path";
|
|
49086
49280
|
import { fileURLToPath as fileURLToPath47, pathToFileURL as pathToFileURL31 } from "node:url";
|
|
49087
49281
|
function isObject2(v) {
|
|
49088
49282
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
49089
49283
|
}
|
|
49090
49284
|
function refFor(agentId) {
|
|
49091
|
-
return
|
|
49285
|
+
return crypto8.createHash("sha256").update(agentId, "utf8").digest("hex").slice(0, 12);
|
|
49092
49286
|
}
|
|
49093
49287
|
function unwrapPayload(envelope) {
|
|
49094
49288
|
const inner = envelope["payload"];
|
|
@@ -49174,10 +49368,10 @@ function _jsonObjectCandidates(message) {
|
|
|
49174
49368
|
return out;
|
|
49175
49369
|
}
|
|
49176
49370
|
function openDir(root) {
|
|
49177
|
-
return
|
|
49371
|
+
return path101.join(root, LEDGER_DIR, OPEN_SUBDIR);
|
|
49178
49372
|
}
|
|
49179
49373
|
function openFile(root, ref) {
|
|
49180
|
-
return
|
|
49374
|
+
return path101.join(openDir(root), `${ref}.json`);
|
|
49181
49375
|
}
|
|
49182
49376
|
function _asOpenRecord(value, expectedRef) {
|
|
49183
49377
|
if (!isObject2(value)) return null;
|
|
@@ -49203,7 +49397,7 @@ function readOpenRecords(root) {
|
|
|
49203
49397
|
const out = /* @__PURE__ */ new Map();
|
|
49204
49398
|
let names;
|
|
49205
49399
|
try {
|
|
49206
|
-
names =
|
|
49400
|
+
names = fs102.readdirSync(openDir(root));
|
|
49207
49401
|
} catch {
|
|
49208
49402
|
return out;
|
|
49209
49403
|
}
|
|
@@ -49211,7 +49405,7 @@ function readOpenRecords(root) {
|
|
|
49211
49405
|
if (!name.endsWith(".json")) continue;
|
|
49212
49406
|
const expectedRef = name.slice(0, -".json".length);
|
|
49213
49407
|
try {
|
|
49214
|
-
const raw =
|
|
49408
|
+
const raw = fs102.readFileSync(path101.join(openDir(root), name), "utf8");
|
|
49215
49409
|
const rec = _asOpenRecord(JSON.parse(raw), expectedRef);
|
|
49216
49410
|
if (rec) out.set(rec.ref, rec);
|
|
49217
49411
|
} catch {
|
|
@@ -49226,13 +49420,13 @@ function resolveDepth(parentRef, open) {
|
|
|
49226
49420
|
return { depth: parent.depth + 1, depth_basis: "observed" };
|
|
49227
49421
|
}
|
|
49228
49422
|
function ledgerFileFor2(root, ts) {
|
|
49229
|
-
return
|
|
49423
|
+
return path101.join(root, LEDGER_DIR, `${ts.slice(0, 7)}.jsonl`);
|
|
49230
49424
|
}
|
|
49231
49425
|
function appendLedgerLine(root, ts, line) {
|
|
49232
49426
|
if (is_replay_mode()) return;
|
|
49233
49427
|
const file = ledgerFileFor2(root, ts);
|
|
49234
|
-
|
|
49235
|
-
|
|
49428
|
+
fs102.mkdirSync(path101.dirname(file), { recursive: true });
|
|
49429
|
+
fs102.appendFileSync(file, `${JSON.stringify(line)}
|
|
49236
49430
|
`, "utf8");
|
|
49237
49431
|
}
|
|
49238
49432
|
function armsExceeded(elapsedMs) {
|
|
@@ -49240,7 +49434,7 @@ function armsExceeded(elapsedMs) {
|
|
|
49240
49434
|
return WALL_CLOCK_ARMS_MS.filter((a) => elapsedMs >= a.ms).map((a) => a.label);
|
|
49241
49435
|
}
|
|
49242
49436
|
function openRecordStats(root, nowMs = Date.now()) {
|
|
49243
|
-
const ledgerPresent =
|
|
49437
|
+
const ledgerPresent = fs102.existsSync(path101.join(root, LEDGER_DIR));
|
|
49244
49438
|
const open = readOpenRecords(root);
|
|
49245
49439
|
let maxDepth = 0;
|
|
49246
49440
|
let counted = 0;
|
|
@@ -49268,13 +49462,13 @@ function writeOpenRecord(root, rec) {
|
|
|
49268
49462
|
function removeOpenRecord(root, ref) {
|
|
49269
49463
|
if (is_replay_mode()) return;
|
|
49270
49464
|
try {
|
|
49271
|
-
|
|
49465
|
+
fs102.unlinkSync(openFile(root, ref));
|
|
49272
49466
|
} catch {
|
|
49273
49467
|
}
|
|
49274
49468
|
}
|
|
49275
49469
|
function countOpen(root) {
|
|
49276
49470
|
try {
|
|
49277
|
-
return
|
|
49471
|
+
return fs102.readdirSync(openDir(root)).filter((n) => n.endsWith(".json")).length;
|
|
49278
49472
|
} catch {
|
|
49279
49473
|
return 0;
|
|
49280
49474
|
}
|
|
@@ -49440,10 +49634,10 @@ function _isCliEntry26() {
|
|
|
49440
49634
|
return false;
|
|
49441
49635
|
}
|
|
49442
49636
|
if (process.argv[1] === void 0) return false;
|
|
49443
|
-
const argvUrl = pathToFileURL31(
|
|
49637
|
+
const argvUrl = pathToFileURL31(path101.resolve(process.argv[1])).href;
|
|
49444
49638
|
if (import.meta.url === argvUrl) return true;
|
|
49445
49639
|
try {
|
|
49446
|
-
return
|
|
49640
|
+
return fs102.realpathSync(fileURLToPath47(import.meta.url)) === fs102.realpathSync(path101.resolve(process.argv[1]));
|
|
49447
49641
|
} catch {
|
|
49448
49642
|
return false;
|
|
49449
49643
|
}
|
|
@@ -49456,7 +49650,7 @@ var init_subagent_ledger_hook = __esm({
|
|
|
49456
49650
|
init_state_io();
|
|
49457
49651
|
init_hook_stdin();
|
|
49458
49652
|
init_exit_codes();
|
|
49459
|
-
LEDGER_DIR =
|
|
49653
|
+
LEDGER_DIR = path101.join("agents", "runtime", "state", "subagent-ledger");
|
|
49460
49654
|
OPEN_SUBDIR = "open";
|
|
49461
49655
|
OPEN_RECORD_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
49462
49656
|
DEPTH_BASES = /* @__PURE__ */ new Set(["observed", "asserted-parent", "assumed-root"]);
|
|
@@ -49471,17 +49665,17 @@ var init_subagent_ledger_hook = __esm({
|
|
|
49471
49665
|
});
|
|
49472
49666
|
|
|
49473
49667
|
// src/scripts/_lib/turn_end_refusals.ts
|
|
49474
|
-
import * as
|
|
49475
|
-
import * as
|
|
49476
|
-
import * as
|
|
49668
|
+
import * as crypto9 from "node:crypto";
|
|
49669
|
+
import * as fs103 from "node:fs";
|
|
49670
|
+
import * as path102 from "node:path";
|
|
49477
49671
|
function refusalStateDir(workspaceRoot) {
|
|
49478
|
-
return
|
|
49672
|
+
return path102.join(workspaceRoot, REFUSAL_STATE_REL);
|
|
49479
49673
|
}
|
|
49480
49674
|
function deriveSessionKey(sessionId) {
|
|
49481
|
-
return
|
|
49675
|
+
return crypto9.createHash("sha256").update(sessionId).digest("hex").slice(0, 32);
|
|
49482
49676
|
}
|
|
49483
49677
|
function sessionRefusalFile(workspaceRoot, sessionKey) {
|
|
49484
|
-
return
|
|
49678
|
+
return path102.join(refusalStateDir(workspaceRoot), `${sessionKey}.json`);
|
|
49485
49679
|
}
|
|
49486
49680
|
function emptyCounts() {
|
|
49487
49681
|
const out = {};
|
|
@@ -49581,7 +49775,7 @@ function emptyRetryCounts() {
|
|
|
49581
49775
|
return out;
|
|
49582
49776
|
}
|
|
49583
49777
|
function sessionShadowFile(workspaceRoot, sessionKey) {
|
|
49584
|
-
return
|
|
49778
|
+
return path102.join(refusalStateDir(workspaceRoot), `${sessionKey}${SHADOW_SUFFIX}`);
|
|
49585
49779
|
}
|
|
49586
49780
|
function parseShadowRecord(raw) {
|
|
49587
49781
|
let decoded;
|
|
@@ -49657,7 +49851,7 @@ function foldShadow(prev, input) {
|
|
|
49657
49851
|
function shadowSetBy(workspaceRoot, sessionKey) {
|
|
49658
49852
|
let raw;
|
|
49659
49853
|
try {
|
|
49660
|
-
raw =
|
|
49854
|
+
raw = fs103.readFileSync(sessionRefusalFile(workspaceRoot, sessionKey), "utf-8");
|
|
49661
49855
|
} catch (err) {
|
|
49662
49856
|
const code = err?.code;
|
|
49663
49857
|
return code === "ENOENT" ? "foreign" : "unknown";
|
|
@@ -49677,7 +49871,7 @@ var init_turn_end_refusals = __esm({
|
|
|
49677
49871
|
"pending-decision",
|
|
49678
49872
|
"untested"
|
|
49679
49873
|
];
|
|
49680
|
-
REFUSAL_STATE_REL =
|
|
49874
|
+
REFUSAL_STATE_REL = path102.join("agents", "runtime", "state", "turn-end-gate");
|
|
49681
49875
|
SHADOW_LAYERS = ["stop_hook_active", "refused_turn"];
|
|
49682
49876
|
SHADOW_MAX_ROWS = 200;
|
|
49683
49877
|
SHADOW_SUFFIX = ".shadow.json";
|
|
@@ -49686,8 +49880,8 @@ var init_turn_end_refusals = __esm({
|
|
|
49686
49880
|
|
|
49687
49881
|
// src/scripts/_lib/review_baseline.ts
|
|
49688
49882
|
import { spawnSync as spawnSync16 } from "node:child_process";
|
|
49689
|
-
import * as
|
|
49690
|
-
import * as
|
|
49883
|
+
import * as fs104 from "node:fs";
|
|
49884
|
+
import * as path103 from "node:path";
|
|
49691
49885
|
function currentHeadSha(cwd) {
|
|
49692
49886
|
try {
|
|
49693
49887
|
const r = spawnSync16("git", ["rev-parse", "HEAD"], { cwd, encoding: "utf8" });
|
|
@@ -49699,10 +49893,10 @@ function currentHeadSha(cwd) {
|
|
|
49699
49893
|
}
|
|
49700
49894
|
}
|
|
49701
49895
|
function baselineStateDir(workspaceRoot) {
|
|
49702
|
-
return
|
|
49896
|
+
return path103.join(workspaceRoot, BASELINE_STATE_REL);
|
|
49703
49897
|
}
|
|
49704
49898
|
function baselineStateFile(workspaceRoot, sessionKey) {
|
|
49705
|
-
return
|
|
49899
|
+
return path103.join(baselineStateDir(workspaceRoot), `${sessionKey}.json`);
|
|
49706
49900
|
}
|
|
49707
49901
|
function parseBaseline(raw) {
|
|
49708
49902
|
let decoded;
|
|
@@ -49730,7 +49924,7 @@ function readBaseline(workspaceRoot, sessionKey) {
|
|
|
49730
49924
|
const file = baselineStateFile(workspaceRoot, sessionKey);
|
|
49731
49925
|
let raw;
|
|
49732
49926
|
try {
|
|
49733
|
-
raw =
|
|
49927
|
+
raw = fs104.readFileSync(file, "utf-8");
|
|
49734
49928
|
} catch (exc) {
|
|
49735
49929
|
const code = exc?.code;
|
|
49736
49930
|
return code === "ENOENT" ? "absent" : "unreadable";
|
|
@@ -49757,7 +49951,7 @@ var BASELINE_STATE_REL;
|
|
|
49757
49951
|
var init_review_baseline = __esm({
|
|
49758
49952
|
"src/scripts/_lib/review_baseline.ts"() {
|
|
49759
49953
|
"use strict";
|
|
49760
|
-
BASELINE_STATE_REL =
|
|
49954
|
+
BASELINE_STATE_REL = path103.join("agents", "runtime", "state", "review-baseline");
|
|
49761
49955
|
}
|
|
49762
49956
|
});
|
|
49763
49957
|
|
|
@@ -49853,23 +50047,23 @@ var init_review_skipped_record = __esm({
|
|
|
49853
50047
|
|
|
49854
50048
|
// src/scripts/hooks/end_review_nudge_hook.ts
|
|
49855
50049
|
import { spawnSync as spawnSync17 } from "node:child_process";
|
|
49856
|
-
import * as
|
|
49857
|
-
import * as
|
|
50050
|
+
import * as crypto10 from "node:crypto";
|
|
50051
|
+
import * as fs105 from "node:fs";
|
|
49858
50052
|
import * as os18 from "node:os";
|
|
49859
|
-
import * as
|
|
50053
|
+
import * as path104 from "node:path";
|
|
49860
50054
|
import { fileURLToPath as fileURLToPath48, pathToFileURL as pathToFileURL32 } from "node:url";
|
|
49861
50055
|
function isSafeTranscriptPath(rawPath, opts = {}) {
|
|
49862
50056
|
if (!rawPath || !/\.jsonl$/i.test(rawPath)) return false;
|
|
49863
50057
|
const homeDir = opts.homeDir ?? os18.homedir();
|
|
49864
50058
|
const maxBytes = opts.maxBytes ?? TRANSCRIPT_SCAN_MAX_BYTES;
|
|
49865
50059
|
try {
|
|
49866
|
-
const realHome =
|
|
49867
|
-
const realPath =
|
|
49868
|
-
const
|
|
49869
|
-
if (
|
|
50060
|
+
const realHome = fs105.realpathSync(homeDir);
|
|
50061
|
+
const realPath = fs105.realpathSync(rawPath);
|
|
50062
|
+
const relative25 = path104.relative(realHome, realPath);
|
|
50063
|
+
if (relative25 === "" || relative25.startsWith("..") || path104.isAbsolute(relative25)) {
|
|
49870
50064
|
return false;
|
|
49871
50065
|
}
|
|
49872
|
-
const { size } =
|
|
50066
|
+
const { size } = fs105.statSync(realPath);
|
|
49873
50067
|
return size <= maxBytes;
|
|
49874
50068
|
} catch {
|
|
49875
50069
|
return false;
|
|
@@ -49924,13 +50118,13 @@ function untrackedNonDocFiles(cwd) {
|
|
|
49924
50118
|
}
|
|
49925
50119
|
function untrackedFileLineCount(cwd, relPath) {
|
|
49926
50120
|
try {
|
|
49927
|
-
const abs =
|
|
49928
|
-
const size =
|
|
50121
|
+
const abs = path104.resolve(cwd, relPath);
|
|
50122
|
+
const size = fs105.statSync(abs).size;
|
|
49929
50123
|
if (size === 0) return 0;
|
|
49930
50124
|
if (size > UNTRACKED_FILE_READ_CAP_BYTES) {
|
|
49931
50125
|
return MUTATION_LINE_THRESHOLD + 1;
|
|
49932
50126
|
}
|
|
49933
|
-
const buf =
|
|
50127
|
+
const buf = fs105.readFileSync(abs);
|
|
49934
50128
|
if (buf.length === 0) return 0;
|
|
49935
50129
|
const probe = buf.subarray(0, Math.min(buf.length, BINARY_PROBE_BYTES));
|
|
49936
50130
|
if (probe.includes(0)) return 0;
|
|
@@ -50012,33 +50206,33 @@ function appendReviewSkippedTelemetry(workspaceRoot, diffLines, mutationMeasure,
|
|
|
50012
50206
|
diff_lines: diffLines,
|
|
50013
50207
|
mutation_measure: mutationMeasure,
|
|
50014
50208
|
ts,
|
|
50015
|
-
id:
|
|
50209
|
+
id: crypto10.randomUUID(),
|
|
50016
50210
|
baseline
|
|
50017
50211
|
});
|
|
50018
50212
|
if (errors.length || line === null) return;
|
|
50019
50213
|
try {
|
|
50020
|
-
const dir =
|
|
50021
|
-
|
|
50022
|
-
const file =
|
|
50023
|
-
|
|
50214
|
+
const dir = path104.join(workspaceRoot, "agents", "runtime", "state", "audit");
|
|
50215
|
+
fs105.mkdirSync(dir, { recursive: true });
|
|
50216
|
+
const file = path104.join(dir, `${ts.slice(0, 7)}.jsonl`);
|
|
50217
|
+
fs105.appendFileSync(file, `${JSON.stringify(line)}
|
|
50024
50218
|
`, "utf8");
|
|
50025
50219
|
} catch {
|
|
50026
50220
|
}
|
|
50027
50221
|
}
|
|
50028
50222
|
function sessionStateDir(workspaceRoot) {
|
|
50029
|
-
return
|
|
50223
|
+
return path104.join(workspaceRoot, "agents", "runtime", "state", "end-review-nudge");
|
|
50030
50224
|
}
|
|
50031
50225
|
function sessionStateFile(workspaceRoot, sessionKey) {
|
|
50032
|
-
return
|
|
50226
|
+
return path104.join(sessionStateDir(workspaceRoot), `${sessionKey}.json`);
|
|
50033
50227
|
}
|
|
50034
50228
|
function deriveSessionKey2(envelope, payload) {
|
|
50035
50229
|
const raw = str3(envelope["session_id"]) || str3(payload["transcript_path"] ?? payload["transcriptPath"]);
|
|
50036
50230
|
const material = raw || "unknown-session";
|
|
50037
|
-
return
|
|
50231
|
+
return crypto10.createHash("sha256").update(material).digest("hex");
|
|
50038
50232
|
}
|
|
50039
50233
|
function hasFiredThisSession(workspaceRoot, sessionKey) {
|
|
50040
50234
|
try {
|
|
50041
|
-
return
|
|
50235
|
+
return fs105.existsSync(sessionStateFile(workspaceRoot, sessionKey));
|
|
50042
50236
|
} catch {
|
|
50043
50237
|
return false;
|
|
50044
50238
|
}
|
|
@@ -50094,7 +50288,7 @@ function main35() {
|
|
|
50094
50288
|
let reviewerRan = false;
|
|
50095
50289
|
if (transcriptPath && isSafeTranscriptPath(transcriptPath)) {
|
|
50096
50290
|
try {
|
|
50097
|
-
reviewerRan = scanTranscriptForReviewer(
|
|
50291
|
+
reviewerRan = scanTranscriptForReviewer(fs105.readFileSync(transcriptPath, "utf-8"));
|
|
50098
50292
|
} catch {
|
|
50099
50293
|
reviewerRan = false;
|
|
50100
50294
|
}
|
|
@@ -50129,13 +50323,13 @@ function _isCliEntry27() {
|
|
|
50129
50323
|
if (process.argv[1] === void 0) {
|
|
50130
50324
|
return false;
|
|
50131
50325
|
}
|
|
50132
|
-
const argvUrl = pathToFileURL32(
|
|
50326
|
+
const argvUrl = pathToFileURL32(path104.resolve(process.argv[1])).href;
|
|
50133
50327
|
if (import.meta.url === argvUrl) {
|
|
50134
50328
|
return true;
|
|
50135
50329
|
}
|
|
50136
50330
|
try {
|
|
50137
|
-
const here =
|
|
50138
|
-
const argv =
|
|
50331
|
+
const here = fs105.realpathSync(fileURLToPath48(import.meta.url));
|
|
50332
|
+
const argv = fs105.realpathSync(path104.resolve(process.argv[1]));
|
|
50139
50333
|
return here === argv;
|
|
50140
50334
|
} catch {
|
|
50141
50335
|
return false;
|
|
@@ -50174,7 +50368,7 @@ var init_end_review_nudge_hook = __esm({
|
|
|
50174
50368
|
});
|
|
50175
50369
|
|
|
50176
50370
|
// src/scripts/_lib/turn_end_transcript.ts
|
|
50177
|
-
import * as
|
|
50371
|
+
import * as fs106 from "node:fs";
|
|
50178
50372
|
function readTranscriptTail(transcriptPath, opts = {}) {
|
|
50179
50373
|
const empty = {
|
|
50180
50374
|
lastAssistant: "",
|
|
@@ -50185,10 +50379,10 @@ function readTranscriptTail(transcriptPath, opts = {}) {
|
|
|
50185
50379
|
if (!transcriptPath || !isSafeTranscriptPath(transcriptPath, opts)) return empty;
|
|
50186
50380
|
let lines;
|
|
50187
50381
|
try {
|
|
50188
|
-
if (opts.maxBytes !== void 0 &&
|
|
50382
|
+
if (opts.maxBytes !== void 0 && fs106.statSync(transcriptPath).size > opts.maxBytes) {
|
|
50189
50383
|
return empty;
|
|
50190
50384
|
}
|
|
50191
|
-
lines =
|
|
50385
|
+
lines = fs106.readFileSync(transcriptPath, "utf-8").split("\n");
|
|
50192
50386
|
} catch {
|
|
50193
50387
|
return empty;
|
|
50194
50388
|
}
|
|
@@ -50278,8 +50472,8 @@ var init_turn_end_transcript = __esm({
|
|
|
50278
50472
|
});
|
|
50279
50473
|
|
|
50280
50474
|
// src/scripts/hooks/turn_end_gate_hook.ts
|
|
50281
|
-
import * as
|
|
50282
|
-
import * as
|
|
50475
|
+
import * as fs107 from "node:fs";
|
|
50476
|
+
import * as path105 from "node:path";
|
|
50283
50477
|
import { fileURLToPath as fileURLToPath49, pathToFileURL as pathToFileURL33 } from "node:url";
|
|
50284
50478
|
function stripFencedBlocks(text) {
|
|
50285
50479
|
const out = [];
|
|
@@ -50337,7 +50531,7 @@ function detectPromissory(reply) {
|
|
|
50337
50531
|
function readCiSettled(workspaceRoot, session_id) {
|
|
50338
50532
|
if (!hasStableSessionId(session_id)) return { seen: false, settled: false };
|
|
50339
50533
|
try {
|
|
50340
|
-
const raw =
|
|
50534
|
+
const raw = fs107.readFileSync(path105.join(workspaceRoot, statePathFor2(session_id)), "utf-8");
|
|
50341
50535
|
const decoded = JSON.parse(raw);
|
|
50342
50536
|
if (!owns_session_state(decoded, session_id)) return { seen: false, settled: false };
|
|
50343
50537
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
@@ -50371,8 +50565,8 @@ function detectCompletionClaim(reply, ci) {
|
|
|
50371
50565
|
function readLanguagePin(workspaceRoot, session_id) {
|
|
50372
50566
|
if (!hasStableSessionId(session_id)) return "und";
|
|
50373
50567
|
try {
|
|
50374
|
-
const raw =
|
|
50375
|
-
|
|
50568
|
+
const raw = fs107.readFileSync(
|
|
50569
|
+
path105.join(workspaceRoot, statePathFor(session_id)),
|
|
50376
50570
|
"utf-8"
|
|
50377
50571
|
);
|
|
50378
50572
|
const decoded = JSON.parse(raw);
|
|
@@ -50418,7 +50612,7 @@ function detectUnverifiedEdit(toolCalls, runState = null) {
|
|
|
50418
50612
|
}
|
|
50419
50613
|
for (let i = lastEdit + 1; i < toolCalls.length; i += 1) {
|
|
50420
50614
|
const c = toolCalls[i];
|
|
50421
|
-
if (c.name === "Bash" && c.command !== void 0 &&
|
|
50615
|
+
if (c.name === "Bash" && c.command !== void 0 && isVerificationAttempt(c.command)) {
|
|
50422
50616
|
return null;
|
|
50423
50617
|
}
|
|
50424
50618
|
}
|
|
@@ -50427,7 +50621,7 @@ function detectUnverifiedEdit(toolCalls, runState = null) {
|
|
|
50427
50621
|
// The path, never the diff: the evidence span is quoted into a refusal,
|
|
50428
50622
|
// and `ToolCall` is shaped so a file body cannot reach it.
|
|
50429
50623
|
evidence: edited,
|
|
50430
|
-
reason: "this turn changed a file and then ran no verification command \u2014 no test, type-check, lint or
|
|
50624
|
+
reason: "this turn changed a file and then ran no verification command \u2014 no test, type-check, lint, build or asset render follows the last edit (verify-before-complete: a claim without a fresh run is unverified)",
|
|
50431
50625
|
mode: "transcript"
|
|
50432
50626
|
};
|
|
50433
50627
|
}
|
|
@@ -50477,7 +50671,7 @@ function sessionStateFile2(workspaceRoot, sessionKey) {
|
|
|
50477
50671
|
}
|
|
50478
50672
|
function alreadyRefusedTurn(workspaceRoot, sessionKey, turnOrdinal) {
|
|
50479
50673
|
try {
|
|
50480
|
-
const raw =
|
|
50674
|
+
const raw = fs107.readFileSync(sessionStateFile2(workspaceRoot, sessionKey), "utf-8");
|
|
50481
50675
|
const decoded = JSON.parse(raw);
|
|
50482
50676
|
if (typeof decoded === "object" && decoded !== null && !Array.isArray(decoded)) {
|
|
50483
50677
|
return decoded["refused_turn"] === turnOrdinal;
|
|
@@ -50491,7 +50685,7 @@ function markRefusedTurn(workspaceRoot, sessionKey, turnOrdinal, detectors, prom
|
|
|
50491
50685
|
const file = sessionStateFile2(workspaceRoot, sessionKey);
|
|
50492
50686
|
let prev = null;
|
|
50493
50687
|
try {
|
|
50494
|
-
prev = parseRecord(
|
|
50688
|
+
prev = parseRecord(fs107.readFileSync(file, "utf-8"));
|
|
50495
50689
|
} catch {
|
|
50496
50690
|
}
|
|
50497
50691
|
let version;
|
|
@@ -50588,6 +50782,7 @@ function runDetectors(inputs) {
|
|
|
50588
50782
|
// on a completion CLAIM, and a turn waiting on a subagent has not
|
|
50589
50783
|
// finished — so its closing is not the claim F is about. Same slot,
|
|
50590
50784
|
// opposite trigger, opposite treatment of `dispatchOpen`.
|
|
50785
|
+
openSvgObligation(workspaceRoot, toolCalls),
|
|
50591
50786
|
dispatchOpen ? null : detectUntestedChange(lastAssistant, toolCalls, runState)
|
|
50592
50787
|
]) {
|
|
50593
50788
|
if (f) findings.push(f);
|
|
@@ -50632,7 +50827,7 @@ function recordShadow(inputs, layer) {
|
|
|
50632
50827
|
const file = sessionShadowFile(inputs.workspaceRoot, inputs.sessionKey);
|
|
50633
50828
|
let prev = null;
|
|
50634
50829
|
try {
|
|
50635
|
-
prev = parseShadowRecord(
|
|
50830
|
+
prev = parseShadowRecord(fs107.readFileSync(file, "utf-8"));
|
|
50636
50831
|
} catch {
|
|
50637
50832
|
}
|
|
50638
50833
|
atomic_write_json(
|
|
@@ -50700,13 +50895,13 @@ function _isCliEntry28() {
|
|
|
50700
50895
|
if (process.argv[1] === void 0) {
|
|
50701
50896
|
return false;
|
|
50702
50897
|
}
|
|
50703
|
-
const argvUrl = pathToFileURL33(
|
|
50898
|
+
const argvUrl = pathToFileURL33(path105.resolve(process.argv[1])).href;
|
|
50704
50899
|
if (import.meta.url === argvUrl) {
|
|
50705
50900
|
return true;
|
|
50706
50901
|
}
|
|
50707
50902
|
try {
|
|
50708
|
-
const here =
|
|
50709
|
-
const argv =
|
|
50903
|
+
const here = fs107.realpathSync(fileURLToPath49(import.meta.url));
|
|
50904
|
+
const argv = fs107.realpathSync(path105.resolve(process.argv[1]));
|
|
50710
50905
|
return here === argv;
|
|
50711
50906
|
} catch {
|
|
50712
50907
|
return false;
|
|
@@ -50722,6 +50917,7 @@ var init_turn_end_gate_hook = __esm({
|
|
|
50722
50917
|
init_graph_feeder_record();
|
|
50723
50918
|
init_detect();
|
|
50724
50919
|
init_verification_command();
|
|
50920
|
+
init_svg_obligation();
|
|
50725
50921
|
init_verification_evidence();
|
|
50726
50922
|
init_envelope();
|
|
50727
50923
|
init_hook_stdin();
|
|
@@ -50813,9 +51009,9 @@ var init_test_delta = __esm({
|
|
|
50813
51009
|
|
|
50814
51010
|
// src/scripts/hooks/evidence_independence.ts
|
|
50815
51011
|
import { spawnSync as spawnSync18 } from "node:child_process";
|
|
50816
|
-
import
|
|
50817
|
-
import
|
|
50818
|
-
import
|
|
51012
|
+
import crypto11 from "node:crypto";
|
|
51013
|
+
import fs108 from "node:fs";
|
|
51014
|
+
import path106 from "node:path";
|
|
50819
51015
|
import { fileURLToPath as fileURLToPath50, pathToFileURL as pathToFileURL34 } from "node:url";
|
|
50820
51016
|
function _isObject6(v) {
|
|
50821
51017
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -50853,8 +51049,8 @@ function extractDispatch(envelope) {
|
|
|
50853
51049
|
}
|
|
50854
51050
|
function _ledgerStamp(consumer_root, session_id) {
|
|
50855
51051
|
try {
|
|
50856
|
-
const raw =
|
|
50857
|
-
|
|
51052
|
+
const raw = fs108.readFileSync(
|
|
51053
|
+
path106.join(consumer_root, ledgerFileFor(session_id)),
|
|
50858
51054
|
"utf8"
|
|
50859
51055
|
);
|
|
50860
51056
|
const d = JSON.parse(raw);
|
|
@@ -50865,7 +51061,7 @@ function _ledgerStamp(consumer_root, session_id) {
|
|
|
50865
51061
|
}
|
|
50866
51062
|
function _load2(target) {
|
|
50867
51063
|
try {
|
|
50868
|
-
const decoded = JSON.parse(
|
|
51064
|
+
const decoded = JSON.parse(fs108.readFileSync(target, "utf8"));
|
|
50869
51065
|
if (_isObject6(decoded) && Array.isArray(decoded["evaluations"])) {
|
|
50870
51066
|
return decoded;
|
|
50871
51067
|
}
|
|
@@ -50947,7 +51143,7 @@ function run5(stdin_text, options) {
|
|
|
50947
51143
|
return EXIT_ALLOW4;
|
|
50948
51144
|
}
|
|
50949
51145
|
}
|
|
50950
|
-
const target =
|
|
51146
|
+
const target = path106.join(options.consumer_root, STATE_FILE4);
|
|
50951
51147
|
const state = _load2(target);
|
|
50952
51148
|
const session_id = typeof envelope["session_id"] === "string" ? envelope["session_id"] : "";
|
|
50953
51149
|
const turnMarker = `${session_id}:${_ledgerStamp(options.consumer_root, session_id)}`;
|
|
@@ -50970,7 +51166,7 @@ function run5(stdin_text, options) {
|
|
|
50970
51166
|
if (decision.evaluations > state.evaluations.length) {
|
|
50971
51167
|
state.evaluations.push({
|
|
50972
51168
|
at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
50973
|
-
digest:
|
|
51169
|
+
digest: crypto11.createHash("sha256").update(prompt).digest("hex").slice(0, 16),
|
|
50974
51170
|
prompt_chars: prompt.length
|
|
50975
51171
|
});
|
|
50976
51172
|
try {
|
|
@@ -51015,13 +51211,13 @@ function _isCliEntry29() {
|
|
|
51015
51211
|
if (process.argv[1] === void 0) {
|
|
51016
51212
|
return false;
|
|
51017
51213
|
}
|
|
51018
|
-
const argvUrl = pathToFileURL34(
|
|
51214
|
+
const argvUrl = pathToFileURL34(path106.resolve(process.argv[1])).href;
|
|
51019
51215
|
if (import.meta.url === argvUrl) {
|
|
51020
51216
|
return true;
|
|
51021
51217
|
}
|
|
51022
51218
|
try {
|
|
51023
|
-
const here =
|
|
51024
|
-
const argv =
|
|
51219
|
+
const here = fs108.realpathSync(fileURLToPath50(import.meta.url));
|
|
51220
|
+
const argv = fs108.realpathSync(path106.resolve(process.argv[1]));
|
|
51025
51221
|
return here === argv;
|
|
51026
51222
|
} catch {
|
|
51027
51223
|
return false;
|
|
@@ -51036,7 +51232,7 @@ var init_evidence_independence = __esm({
|
|
|
51036
51232
|
init_test_delta();
|
|
51037
51233
|
init_exit_codes();
|
|
51038
51234
|
init_git_authorization_hook();
|
|
51039
|
-
STATE_FILE4 =
|
|
51235
|
+
STATE_FILE4 = path106.join("agents", "state", "evidence-dispatch.json");
|
|
51040
51236
|
DISPATCH_TOOLS = /* @__PURE__ */ new Set([
|
|
51041
51237
|
"Agent",
|
|
51042
51238
|
"Task",
|
|
@@ -51372,8 +51568,8 @@ var init_subagent_routing = __esm({
|
|
|
51372
51568
|
});
|
|
51373
51569
|
|
|
51374
51570
|
// src/scripts/hooks/delegation_nudge_hook.ts
|
|
51375
|
-
import
|
|
51376
|
-
import
|
|
51571
|
+
import fs109 from "node:fs";
|
|
51572
|
+
import path107 from "node:path";
|
|
51377
51573
|
import { fileURLToPath as fileURLToPath51, pathToFileURL as pathToFileURL35 } from "node:url";
|
|
51378
51574
|
function _isObject7(v) {
|
|
51379
51575
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
@@ -51585,13 +51781,13 @@ function _isCliEntry30() {
|
|
|
51585
51781
|
if (process.argv[1] === void 0) {
|
|
51586
51782
|
return false;
|
|
51587
51783
|
}
|
|
51588
|
-
const argvUrl = pathToFileURL35(
|
|
51784
|
+
const argvUrl = pathToFileURL35(path107.resolve(process.argv[1])).href;
|
|
51589
51785
|
if (import.meta.url === argvUrl) {
|
|
51590
51786
|
return true;
|
|
51591
51787
|
}
|
|
51592
51788
|
try {
|
|
51593
|
-
const here =
|
|
51594
|
-
const argv =
|
|
51789
|
+
const here = fs109.realpathSync(fileURLToPath51(import.meta.url));
|
|
51790
|
+
const argv = fs109.realpathSync(path107.resolve(process.argv[1]));
|
|
51595
51791
|
return here === argv;
|
|
51596
51792
|
} catch {
|
|
51597
51793
|
return false;
|
|
@@ -51624,10 +51820,10 @@ var init_delegation_nudge_hook = __esm({
|
|
|
51624
51820
|
});
|
|
51625
51821
|
|
|
51626
51822
|
// src/scripts/conformance_scan.ts
|
|
51627
|
-
import { createHash as
|
|
51628
|
-
import
|
|
51823
|
+
import { createHash as createHash19 } from "node:crypto";
|
|
51824
|
+
import fs110 from "node:fs";
|
|
51629
51825
|
import os19 from "node:os";
|
|
51630
|
-
import
|
|
51826
|
+
import path108 from "node:path";
|
|
51631
51827
|
import { fileURLToPath as fileURLToPath52, pathToFileURL as pathToFileURL36 } from "node:url";
|
|
51632
51828
|
function spansCarrierChange(firstAts) {
|
|
51633
51829
|
const stamps = firstAts.filter((s) => s !== "").sort();
|
|
@@ -51970,7 +52166,7 @@ function scanSession(sessionId, lines) {
|
|
|
51970
52166
|
}
|
|
51971
52167
|
function defaultStore(projectDir) {
|
|
51972
52168
|
const slug = projectStoreSlug(projectDir);
|
|
51973
|
-
return
|
|
52169
|
+
return path108.join(process.env["HOME"] ?? "", ".claude", "projects", slug);
|
|
51974
52170
|
}
|
|
51975
52171
|
function _tokens(chars) {
|
|
51976
52172
|
return Math.round(chars / 4);
|
|
@@ -51981,13 +52177,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
51981
52177
|
return {
|
|
51982
52178
|
project: {
|
|
51983
52179
|
dir: projectRulesDir,
|
|
51984
|
-
present:
|
|
52180
|
+
present: fs110.existsSync(projectRulesDir),
|
|
51985
52181
|
files: p.files,
|
|
51986
52182
|
tokens: _tokens(p.chars)
|
|
51987
52183
|
},
|
|
51988
52184
|
global: {
|
|
51989
52185
|
dir: globalRulesDir,
|
|
51990
|
-
present:
|
|
52186
|
+
present: fs110.existsSync(globalRulesDir),
|
|
51991
52187
|
files: g.files,
|
|
51992
52188
|
tokens: _tokens(g.chars)
|
|
51993
52189
|
},
|
|
@@ -51995,13 +52191,13 @@ function measureDelivered(projectRulesDir, globalRulesDir) {
|
|
|
51995
52191
|
};
|
|
51996
52192
|
}
|
|
51997
52193
|
function storeKey(store) {
|
|
51998
|
-
return
|
|
52194
|
+
return createHash19("sha256").update(path108.resolve(store)).digest("hex").slice(0, 12);
|
|
51999
52195
|
}
|
|
52000
52196
|
function scanStore(store, limit) {
|
|
52001
|
-
const files =
|
|
52197
|
+
const files = fs110.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ f, m: fs110.statSync(path108.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.f);
|
|
52002
52198
|
const per_session = [];
|
|
52003
52199
|
for (const f of files) {
|
|
52004
|
-
const lines =
|
|
52200
|
+
const lines = fs110.readFileSync(path108.join(store, f), "utf8").split("\n");
|
|
52005
52201
|
const r = scanSession(f.replace(/\.jsonl$/, "").slice(0, 8), lines);
|
|
52006
52202
|
if (r.assistant_turns > 0) {
|
|
52007
52203
|
per_session.push(r);
|
|
@@ -52029,10 +52225,10 @@ function scanStore(store, limit) {
|
|
|
52029
52225
|
const task_completeness_rate_pct = completeness_windows === 0 ? 0 : Number((100 * task_completeness / completeness_windows).toFixed(1));
|
|
52030
52226
|
const era = spansCarrierChange(per_session.map((s) => s.first_at));
|
|
52031
52227
|
const delivered = measureDelivered(
|
|
52032
|
-
|
|
52033
|
-
|
|
52228
|
+
path108.join(REPO_ROOT8, ".claude", "rules"),
|
|
52229
|
+
path108.join(process.env["HOME"] ?? os19.homedir(), ".claude", "rules")
|
|
52034
52230
|
);
|
|
52035
|
-
const ownStore =
|
|
52231
|
+
const ownStore = path108.resolve(store) === path108.resolve(defaultStore(REPO_ROOT8));
|
|
52036
52232
|
return {
|
|
52037
52233
|
scanned_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
52038
52234
|
store,
|
|
@@ -52062,8 +52258,8 @@ function scanStore(store, limit) {
|
|
|
52062
52258
|
};
|
|
52063
52259
|
}
|
|
52064
52260
|
function recordRate(file, scanned_at, rate) {
|
|
52065
|
-
|
|
52066
|
-
|
|
52261
|
+
fs110.mkdirSync(path108.dirname(file), { recursive: true });
|
|
52262
|
+
fs110.appendFileSync(file, `${JSON.stringify({ measured_at: scanned_at, ...rate })}
|
|
52067
52263
|
`, "utf8");
|
|
52068
52264
|
}
|
|
52069
52265
|
function render3(report2) {
|
|
@@ -52194,14 +52390,14 @@ function main39(argv) {
|
|
|
52194
52390
|
return 2;
|
|
52195
52391
|
}
|
|
52196
52392
|
const resolved = store ?? defaultStore(process.cwd());
|
|
52197
|
-
if (!
|
|
52393
|
+
if (!fs110.existsSync(resolved)) {
|
|
52198
52394
|
process.stderr.write(`conformance:behavior: no transcript store at ${resolved}
|
|
52199
52395
|
`);
|
|
52200
52396
|
return 1;
|
|
52201
52397
|
}
|
|
52202
52398
|
const report2 = scanStore(resolved, Number.isFinite(limit) && limit > 0 ? limit : 30);
|
|
52203
52399
|
if (out) {
|
|
52204
|
-
|
|
52400
|
+
fs110.writeFileSync(out, `${JSON.stringify(report2, null, 2)}
|
|
52205
52401
|
`, "utf8");
|
|
52206
52402
|
}
|
|
52207
52403
|
if (record) {
|
|
@@ -52209,7 +52405,7 @@ function main39(argv) {
|
|
|
52209
52405
|
}
|
|
52210
52406
|
if (why !== null) {
|
|
52211
52407
|
const id = why;
|
|
52212
|
-
|
|
52408
|
+
fs110.writeSync(
|
|
52213
52409
|
1,
|
|
52214
52410
|
json ? `${JSON.stringify(
|
|
52215
52411
|
{
|
|
@@ -52229,7 +52425,7 @@ function main39(argv) {
|
|
|
52229
52425
|
);
|
|
52230
52426
|
return 0;
|
|
52231
52427
|
}
|
|
52232
|
-
|
|
52428
|
+
fs110.writeSync(1, json ? `${JSON.stringify(report2, null, 2)}
|
|
52233
52429
|
` : `${render3(report2)}
|
|
52234
52430
|
`);
|
|
52235
52431
|
return 0;
|
|
@@ -52241,13 +52437,13 @@ function _isCliEntry31() {
|
|
|
52241
52437
|
if (process.argv[1] === void 0) {
|
|
52242
52438
|
return false;
|
|
52243
52439
|
}
|
|
52244
|
-
const argvUrl = pathToFileURL36(
|
|
52440
|
+
const argvUrl = pathToFileURL36(path108.resolve(process.argv[1])).href;
|
|
52245
52441
|
if (import.meta.url === argvUrl) {
|
|
52246
52442
|
return true;
|
|
52247
52443
|
}
|
|
52248
52444
|
try {
|
|
52249
|
-
const here =
|
|
52250
|
-
const argv =
|
|
52445
|
+
const here = fs110.realpathSync(fileURLToPath52(import.meta.url));
|
|
52446
|
+
const argv = fs110.realpathSync(path108.resolve(process.argv[1]));
|
|
52251
52447
|
return here === argv;
|
|
52252
52448
|
} catch {
|
|
52253
52449
|
return false;
|
|
@@ -52268,7 +52464,7 @@ var init_conformance_scan = __esm({
|
|
|
52268
52464
|
init_turn_end_gate_hook();
|
|
52269
52465
|
init_evidence_independence();
|
|
52270
52466
|
init_delegation_nudge_hook();
|
|
52271
|
-
REPO_ROOT8 =
|
|
52467
|
+
REPO_ROOT8 = path108.resolve(path108.dirname(fileURLToPath52(import.meta.url)), "..", "..");
|
|
52272
52468
|
OBSERVED_BAND = { low: 9.1, high: 39.2 };
|
|
52273
52469
|
BAND_MIN_TURNS = 1978;
|
|
52274
52470
|
CARRIER_CHANGES = [
|
|
@@ -52295,7 +52491,7 @@ var init_conformance_scan = __esm({
|
|
|
52295
52491
|
};
|
|
52296
52492
|
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;
|
|
52297
52493
|
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;
|
|
52298
|
-
DEFAULT_RATE_SERIES =
|
|
52494
|
+
DEFAULT_RATE_SERIES = path108.join(
|
|
52299
52495
|
REPO_ROOT8,
|
|
52300
52496
|
"agents",
|
|
52301
52497
|
"runtime",
|
|
@@ -52309,14 +52505,14 @@ var init_conformance_scan = __esm({
|
|
|
52309
52505
|
});
|
|
52310
52506
|
|
|
52311
52507
|
// src/scripts/report_carrier_divergence.ts
|
|
52312
|
-
import * as
|
|
52508
|
+
import * as fs111 from "node:fs";
|
|
52313
52509
|
import * as os20 from "node:os";
|
|
52314
|
-
import * as
|
|
52510
|
+
import * as path109 from "node:path";
|
|
52315
52511
|
import process20 from "node:process";
|
|
52316
52512
|
import { fileURLToPath as fileURLToPath53, pathToFileURL as pathToFileURL37 } from "node:url";
|
|
52317
52513
|
function _listRules(dir) {
|
|
52318
52514
|
try {
|
|
52319
|
-
return
|
|
52515
|
+
return fs111.readdirSync(dir).filter((f) => f.endsWith(".md")).sort();
|
|
52320
52516
|
} catch {
|
|
52321
52517
|
return [];
|
|
52322
52518
|
}
|
|
@@ -52324,7 +52520,7 @@ function _listRules(dir) {
|
|
|
52324
52520
|
function _ruleType(file) {
|
|
52325
52521
|
let text;
|
|
52326
52522
|
try {
|
|
52327
|
-
text =
|
|
52523
|
+
text = fs111.readFileSync(file, "utf-8");
|
|
52328
52524
|
} catch {
|
|
52329
52525
|
return "";
|
|
52330
52526
|
}
|
|
@@ -52335,8 +52531,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
52335
52531
|
const out = {
|
|
52336
52532
|
projectDir,
|
|
52337
52533
|
globalDir,
|
|
52338
|
-
globalPresent:
|
|
52339
|
-
projectPresent:
|
|
52534
|
+
globalPresent: fs111.existsSync(globalDir),
|
|
52535
|
+
projectPresent: fs111.existsSync(projectDir),
|
|
52340
52536
|
shared: 0,
|
|
52341
52537
|
identical: [],
|
|
52342
52538
|
provenanceOnly: [],
|
|
@@ -52359,7 +52555,7 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
52359
52555
|
}
|
|
52360
52556
|
if (!inP && inG) {
|
|
52361
52557
|
out.globalOnly.push(rule);
|
|
52362
|
-
if (sourceDir !== void 0 && _ruleType(
|
|
52558
|
+
if (sourceDir !== void 0 && _ruleType(path109.join(sourceDir, rule)) === "manual") {
|
|
52363
52559
|
out.manualOnlyGlobal.push(rule);
|
|
52364
52560
|
}
|
|
52365
52561
|
continue;
|
|
@@ -52369,8 +52565,8 @@ function compareCarriers(projectDir, globalDir, sourceDir) {
|
|
|
52369
52565
|
let projectCopy;
|
|
52370
52566
|
let globalCopy;
|
|
52371
52567
|
try {
|
|
52372
|
-
projectCopy =
|
|
52373
|
-
globalCopy =
|
|
52568
|
+
projectCopy = fs111.readFileSync(path109.join(projectDir, rule));
|
|
52569
|
+
globalCopy = fs111.readFileSync(path109.join(globalDir, rule));
|
|
52374
52570
|
verdict = comparePair(projectCopy, globalCopy);
|
|
52375
52571
|
} catch {
|
|
52376
52572
|
out.shared -= 1;
|
|
@@ -52517,9 +52713,9 @@ function render4(d) {
|
|
|
52517
52713
|
}
|
|
52518
52714
|
function main40(argv) {
|
|
52519
52715
|
const args = argv ?? process20.argv.slice(2);
|
|
52520
|
-
let projectDir =
|
|
52521
|
-
let globalDir =
|
|
52522
|
-
let sourceDir =
|
|
52716
|
+
let projectDir = path109.join(REPO_ROOT9, PROJECT_RULES);
|
|
52717
|
+
let globalDir = path109.join(os20.homedir(), GLOBAL_RULES);
|
|
52718
|
+
let sourceDir = path109.join(REPO_ROOT9, PROJECTION_SOURCE);
|
|
52523
52719
|
const value = (i) => {
|
|
52524
52720
|
const v = args[i + 1];
|
|
52525
52721
|
return v === void 0 || v.startsWith("-") ? null : v;
|
|
@@ -52533,7 +52729,7 @@ function main40(argv) {
|
|
|
52533
52729
|
`);
|
|
52534
52730
|
return 1;
|
|
52535
52731
|
}
|
|
52536
|
-
const resolved =
|
|
52732
|
+
const resolved = path109.resolve(v);
|
|
52537
52733
|
if (a === "--project") projectDir = resolved;
|
|
52538
52734
|
else if (a === "--global") globalDir = resolved;
|
|
52539
52735
|
else sourceDir = resolved;
|
|
@@ -52555,9 +52751,9 @@ function main40(argv) {
|
|
|
52555
52751
|
}
|
|
52556
52752
|
function _isCliEntry32() {
|
|
52557
52753
|
if (process20.argv[1] === void 0) return false;
|
|
52558
|
-
if (import.meta.url === pathToFileURL37(
|
|
52754
|
+
if (import.meta.url === pathToFileURL37(path109.resolve(process20.argv[1])).href) return true;
|
|
52559
52755
|
try {
|
|
52560
|
-
return
|
|
52756
|
+
return fs111.realpathSync(_HERE25) === fs111.realpathSync(path109.resolve(process20.argv[1]));
|
|
52561
52757
|
} catch {
|
|
52562
52758
|
return false;
|
|
52563
52759
|
}
|
|
@@ -52568,10 +52764,10 @@ var init_report_carrier_divergence = __esm({
|
|
|
52568
52764
|
"use strict";
|
|
52569
52765
|
init_carrier_divergence();
|
|
52570
52766
|
_HERE25 = fileURLToPath53(import.meta.url);
|
|
52571
|
-
REPO_ROOT9 =
|
|
52572
|
-
PROJECT_RULES =
|
|
52573
|
-
PROJECTION_SOURCE =
|
|
52574
|
-
GLOBAL_RULES =
|
|
52767
|
+
REPO_ROOT9 = path109.resolve(path109.dirname(_HERE25), "..", "..");
|
|
52768
|
+
PROJECT_RULES = path109.join(".claude", "rules");
|
|
52769
|
+
PROJECTION_SOURCE = path109.join("dist", "agent-src", "rules");
|
|
52770
|
+
GLOBAL_RULES = path109.join(".claude", "rules");
|
|
52575
52771
|
if (_isCliEntry32()) {
|
|
52576
52772
|
process20.exit(main40());
|
|
52577
52773
|
}
|
|
@@ -52579,9 +52775,9 @@ var init_report_carrier_divergence = __esm({
|
|
|
52579
52775
|
});
|
|
52580
52776
|
|
|
52581
52777
|
// src/scripts/report_skill_activation.ts
|
|
52582
|
-
import * as
|
|
52778
|
+
import * as fs112 from "node:fs";
|
|
52583
52779
|
import * as os21 from "node:os";
|
|
52584
|
-
import * as
|
|
52780
|
+
import * as path110 from "node:path";
|
|
52585
52781
|
import { fileURLToPath as fileURLToPath54, pathToFileURL as pathToFileURL38 } from "node:url";
|
|
52586
52782
|
function censusSkills(root) {
|
|
52587
52783
|
const out = {
|
|
@@ -52590,25 +52786,25 @@ function censusSkills(root) {
|
|
|
52590
52786
|
withTriggerCorpus: [],
|
|
52591
52787
|
withDeterministicObligation: []
|
|
52592
52788
|
};
|
|
52593
|
-
if (!
|
|
52789
|
+
if (!fs112.existsSync(root)) {
|
|
52594
52790
|
return out;
|
|
52595
52791
|
}
|
|
52596
|
-
for (const entry of
|
|
52792
|
+
for (const entry of fs112.readdirSync(root, { withFileTypes: true }).sort((a, b) => a.name.localeCompare(b.name))) {
|
|
52597
52793
|
if (!entry.isDirectory()) {
|
|
52598
52794
|
continue;
|
|
52599
52795
|
}
|
|
52600
|
-
const file =
|
|
52601
|
-
if (!
|
|
52796
|
+
const file = path110.join(root, entry.name, "SKILL.md");
|
|
52797
|
+
if (!fs112.existsSync(file)) {
|
|
52602
52798
|
continue;
|
|
52603
52799
|
}
|
|
52604
52800
|
out.total += 1;
|
|
52605
|
-
const text =
|
|
52801
|
+
const text = fs112.readFileSync(file, "utf8");
|
|
52606
52802
|
const fmEnd = text.startsWith("---") ? text.indexOf("\n---", 3) : -1;
|
|
52607
52803
|
const fm = fmEnd === -1 ? "" : text.slice(0, fmEnd);
|
|
52608
52804
|
if (TRIGGER_KEYS.some((k) => new RegExp(`^${k}`, "m").test(fm))) {
|
|
52609
52805
|
out.withTriggerKey.push(entry.name);
|
|
52610
52806
|
}
|
|
52611
|
-
if (
|
|
52807
|
+
if (fs112.existsSync(path110.join(root, entry.name, "evals", "triggers.json"))) {
|
|
52612
52808
|
out.withTriggerCorpus.push(entry.name);
|
|
52613
52809
|
}
|
|
52614
52810
|
const body = fmEnd === -1 ? text : text.slice(fmEnd + 4);
|
|
@@ -52619,17 +52815,17 @@ function censusSkills(root) {
|
|
|
52619
52815
|
return out;
|
|
52620
52816
|
}
|
|
52621
52817
|
function defaultStore2(cwd) {
|
|
52622
|
-
return
|
|
52818
|
+
return path110.join(os21.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
52623
52819
|
}
|
|
52624
52820
|
function measureUsage(store, limit) {
|
|
52625
52821
|
const rep = { store, sessions: 0, assistantTurns: 0, invocations: 0, bySkill: {} };
|
|
52626
|
-
if (!
|
|
52822
|
+
if (!fs112.existsSync(store)) {
|
|
52627
52823
|
return rep;
|
|
52628
52824
|
}
|
|
52629
|
-
const files =
|
|
52825
|
+
const files = fs112.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => path110.join(store, f)).sort((a, b) => fs112.statSync(b).mtimeMs - fs112.statSync(a).mtimeMs).slice(0, limit);
|
|
52630
52826
|
rep.sessions = files.length;
|
|
52631
52827
|
for (const file of files) {
|
|
52632
|
-
for (const line of
|
|
52828
|
+
for (const line of fs112.readFileSync(file, "utf8").split("\n")) {
|
|
52633
52829
|
if (!line.trim()) {
|
|
52634
52830
|
continue;
|
|
52635
52831
|
}
|
|
@@ -52701,15 +52897,15 @@ function buildRecord(census2, usage, today) {
|
|
|
52701
52897
|
assistant_turns: usage.reduce((a, u) => a + u.assistantTurns, 0),
|
|
52702
52898
|
invocations: usage.reduce((a, u) => a + u.invocations, 0),
|
|
52703
52899
|
distinct_skills_invoked: distinct.size,
|
|
52704
|
-
stores: usage.map((u) =>
|
|
52900
|
+
stores: usage.map((u) => path110.basename(u.store))
|
|
52705
52901
|
};
|
|
52706
52902
|
}
|
|
52707
52903
|
function readRecord(repoRoot) {
|
|
52708
|
-
const file =
|
|
52709
|
-
if (!
|
|
52904
|
+
const file = path110.join(repoRoot, RECORD_PATH);
|
|
52905
|
+
if (!fs112.existsSync(file)) {
|
|
52710
52906
|
return null;
|
|
52711
52907
|
}
|
|
52712
|
-
return JSON.parse(
|
|
52908
|
+
return JSON.parse(fs112.readFileSync(file, "utf8"));
|
|
52713
52909
|
}
|
|
52714
52910
|
function render5(census2, usage, published = null) {
|
|
52715
52911
|
const lines = [];
|
|
@@ -52744,7 +52940,7 @@ function render5(census2, usage, published = null) {
|
|
|
52744
52940
|
}
|
|
52745
52941
|
totalInv += u.invocations;
|
|
52746
52942
|
lines.push(
|
|
52747
|
-
` ${
|
|
52943
|
+
` ${path110.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)}`
|
|
52748
52944
|
);
|
|
52749
52945
|
}
|
|
52750
52946
|
lines.push("");
|
|
@@ -52847,7 +53043,7 @@ function main41(argv) {
|
|
|
52847
53043
|
if (stores.length === 0) {
|
|
52848
53044
|
stores.push(defaultStore2(REPO_ROOT10));
|
|
52849
53045
|
}
|
|
52850
|
-
const census2 = censusSkills(
|
|
53046
|
+
const census2 = censusSkills(path110.join(root, SKILLS_ROOT));
|
|
52851
53047
|
const usage = stores.map((s) => measureUsage(s, limit));
|
|
52852
53048
|
process.stdout.write(`${render5(census2, usage, readRecord(root))}
|
|
52853
53049
|
`);
|
|
@@ -52868,9 +53064,9 @@ function main41(argv) {
|
|
|
52868
53064
|
return 1;
|
|
52869
53065
|
}
|
|
52870
53066
|
const today = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
52871
|
-
const file =
|
|
52872
|
-
|
|
52873
|
-
|
|
53067
|
+
const file = path110.join(root, RECORD_PATH);
|
|
53068
|
+
fs112.mkdirSync(path110.dirname(file), { recursive: true });
|
|
53069
|
+
fs112.writeFileSync(file, `${JSON.stringify(buildRecord(census2, usage, today), null, 2)}
|
|
52874
53070
|
`);
|
|
52875
53071
|
process.stdout.write(`
|
|
52876
53072
|
wrote ${RECORD_PATH} (measured ${today})
|
|
@@ -52884,22 +53080,22 @@ var init_report_skill_activation = __esm({
|
|
|
52884
53080
|
init_cc_transcript();
|
|
52885
53081
|
init_scan_scope();
|
|
52886
53082
|
_HERE26 = fileURLToPath54(import.meta.url);
|
|
52887
|
-
REPO_ROOT10 =
|
|
53083
|
+
REPO_ROOT10 = path110.resolve(path110.dirname(_HERE26), "..", "..");
|
|
52888
53084
|
SKILLS_ROOT = "src/skills";
|
|
52889
53085
|
TRIGGER_KEYS = ["triggers:", "trigger_description:", "file_pattern:", "path_prefix:"];
|
|
52890
53086
|
DETERMINISTIC_RE = /^\s*(?:[-*]\s*)?(?:\*\*)?(MUST|NEVER|ALWAYS)\b/m;
|
|
52891
53087
|
RECORD_PATH = "agents/evidence/metrics/skill-activation-census.json";
|
|
52892
53088
|
USAGE4 = "usage: report_skill_activation [--root DIR] [--limit N] [--store PATH]... [--emit] [--allow-empty-store]\n";
|
|
52893
|
-
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL38(
|
|
53089
|
+
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL38(path110.resolve(process.argv[1])).href) {
|
|
52894
53090
|
process.exit(main41(process.argv.slice(2)));
|
|
52895
53091
|
}
|
|
52896
53092
|
}
|
|
52897
53093
|
});
|
|
52898
53094
|
|
|
52899
53095
|
// src/scripts/report_skill_obligation_violations.ts
|
|
52900
|
-
import * as
|
|
53096
|
+
import * as fs113 from "node:fs";
|
|
52901
53097
|
import * as os22 from "node:os";
|
|
52902
|
-
import * as
|
|
53098
|
+
import * as path111 from "node:path";
|
|
52903
53099
|
import process21 from "node:process";
|
|
52904
53100
|
import { fileURLToPath as fileURLToPath55, pathToFileURL as pathToFileURL39 } from "node:url";
|
|
52905
53101
|
function _verb(line) {
|
|
@@ -52920,7 +53116,7 @@ function _artefacts(line) {
|
|
|
52920
53116
|
return out;
|
|
52921
53117
|
}
|
|
52922
53118
|
function extractObligations(repoRoot) {
|
|
52923
|
-
const skillsRoot =
|
|
53119
|
+
const skillsRoot = path111.join(repoRoot, SKILLS_ROOT);
|
|
52924
53120
|
const census2 = censusSkills(skillsRoot);
|
|
52925
53121
|
const out = {
|
|
52926
53122
|
skills: census2.withDeterministicObligation,
|
|
@@ -52934,7 +53130,7 @@ function extractObligations(repoRoot) {
|
|
|
52934
53130
|
for (const skill of census2.withDeterministicObligation) {
|
|
52935
53131
|
let text;
|
|
52936
53132
|
try {
|
|
52937
|
-
text =
|
|
53133
|
+
text = fs113.readFileSync(path111.join(skillsRoot, skill, "SKILL.md"), "utf-8");
|
|
52938
53134
|
} catch {
|
|
52939
53135
|
continue;
|
|
52940
53136
|
}
|
|
@@ -53036,7 +53232,7 @@ function scanSessionForViolations(session, lines, forbidden, parsed) {
|
|
|
53036
53232
|
return flags;
|
|
53037
53233
|
}
|
|
53038
53234
|
function defaultStore3(cwd) {
|
|
53039
|
-
return
|
|
53235
|
+
return path111.join(os22.homedir(), ".claude", "projects", projectStoreSlug(cwd));
|
|
53040
53236
|
}
|
|
53041
53237
|
function scanStore2(repoRoot, store, limit) {
|
|
53042
53238
|
const census2 = extractObligations(repoRoot);
|
|
@@ -53049,14 +53245,14 @@ function scanStore2(repoRoot, store, limit) {
|
|
|
53049
53245
|
};
|
|
53050
53246
|
let files;
|
|
53051
53247
|
try {
|
|
53052
|
-
files =
|
|
53248
|
+
files = fs113.readdirSync(store).filter((f) => f.endsWith(".jsonl")).map((f) => ({ p: path111.join(store, f), m: fs113.statSync(path111.join(store, f)).mtimeMs })).sort((a, b) => b.m - a.m).slice(0, limit).map((x) => x.p);
|
|
53053
53249
|
} catch {
|
|
53054
53250
|
return report2;
|
|
53055
53251
|
}
|
|
53056
53252
|
report2.sessions = files.length;
|
|
53057
53253
|
for (const file of files) {
|
|
53058
|
-
const lines =
|
|
53059
|
-
const id =
|
|
53254
|
+
const lines = fs113.readFileSync(file, "utf-8").split("\n");
|
|
53255
|
+
const id = path111.basename(file).replace(/\.jsonl$/, "").slice(0, 8);
|
|
53060
53256
|
const entries = _parseSession(lines);
|
|
53061
53257
|
if (loadedSkillsFrom(entries).size > 0) report2.sessionsWithASkill += 1;
|
|
53062
53258
|
report2.flags.push(...scanSessionForViolations(id, lines, census2.forbidden, entries));
|
|
@@ -53181,9 +53377,9 @@ function main42(argv) {
|
|
|
53181
53377
|
}
|
|
53182
53378
|
function _isCliEntry33() {
|
|
53183
53379
|
if (process21.argv[1] === void 0) return false;
|
|
53184
|
-
if (import.meta.url === pathToFileURL39(
|
|
53380
|
+
if (import.meta.url === pathToFileURL39(path111.resolve(process21.argv[1])).href) return true;
|
|
53185
53381
|
try {
|
|
53186
|
-
return
|
|
53382
|
+
return fs113.realpathSync(_HERE27) === fs113.realpathSync(path111.resolve(process21.argv[1]));
|
|
53187
53383
|
} catch {
|
|
53188
53384
|
return false;
|
|
53189
53385
|
}
|
|
@@ -53196,7 +53392,7 @@ var init_report_skill_obligation_violations = __esm({
|
|
|
53196
53392
|
init_transcript_entry();
|
|
53197
53393
|
init_report_skill_activation();
|
|
53198
53394
|
_HERE27 = fileURLToPath55(import.meta.url);
|
|
53199
|
-
REPO_ROOT11 =
|
|
53395
|
+
REPO_ROOT11 = path111.resolve(path111.dirname(_HERE27), "..", "..");
|
|
53200
53396
|
OBLIGATION_LINE_RE = new RegExp(`${DETERMINISTIC_RE.source}.*`, "gm");
|
|
53201
53397
|
PATH_RE2 = /`([A-Za-z0-9_./-]*\/[A-Za-z0-9_.-]+\.[a-z]{2,6})`/g;
|
|
53202
53398
|
CMD_RE = /`([a-z][a-z0-9-]*(?: [a-z][a-z0-9:._-]*){1,3})`/g;
|
|
@@ -53237,24 +53433,24 @@ var init_report_skill_obligation_violations = __esm({
|
|
|
53237
53433
|
});
|
|
53238
53434
|
|
|
53239
53435
|
// src/scripts/report_conformance_funnel.ts
|
|
53240
|
-
import * as
|
|
53436
|
+
import * as fs114 from "node:fs";
|
|
53241
53437
|
import * as os23 from "node:os";
|
|
53242
|
-
import * as
|
|
53438
|
+
import * as path112 from "node:path";
|
|
53243
53439
|
import process22 from "node:process";
|
|
53244
53440
|
import { fileURLToPath as fileURLToPath56, pathToFileURL as pathToFileURL40 } from "node:url";
|
|
53245
53441
|
function buildFunnel(opts = {}) {
|
|
53246
53442
|
const repoRoot = opts.repoRoot ?? REPO_ROOT12;
|
|
53247
|
-
const projectRulesDir = opts.projectRulesDir ??
|
|
53248
|
-
const globalRulesDir = opts.globalRulesDir ??
|
|
53249
|
-
const sourceDir = opts.sourceDir ??
|
|
53443
|
+
const projectRulesDir = opts.projectRulesDir ?? path112.join(repoRoot, PROJECT_RULES);
|
|
53444
|
+
const globalRulesDir = opts.globalRulesDir ?? path112.join(os23.homedir(), GLOBAL_RULES);
|
|
53445
|
+
const sourceDir = opts.sourceDir ?? path112.join(repoRoot, PROJECTION_SOURCE);
|
|
53250
53446
|
const store = opts.store ?? defaultStore(repoRoot);
|
|
53251
53447
|
const limit = opts.limit ?? 30;
|
|
53252
53448
|
return {
|
|
53253
53449
|
delivered: measureDelivered(projectRulesDir, globalRulesDir),
|
|
53254
53450
|
divergence: compareCarriers(projectRulesDir, globalRulesDir, sourceDir),
|
|
53255
|
-
skills: censusSkills(
|
|
53451
|
+
skills: censusSkills(path112.join(repoRoot, SKILLS_ROOT)),
|
|
53256
53452
|
usage: measureUsage(store, limit),
|
|
53257
|
-
storePresent:
|
|
53453
|
+
storePresent: fs114.existsSync(store),
|
|
53258
53454
|
sk2: scanStore2(repoRoot, store, limit)
|
|
53259
53455
|
};
|
|
53260
53456
|
}
|
|
@@ -53395,7 +53591,7 @@ function main43(argv) {
|
|
|
53395
53591
|
`);
|
|
53396
53592
|
return 1;
|
|
53397
53593
|
}
|
|
53398
|
-
const resolved =
|
|
53594
|
+
const resolved = path112.resolve(v);
|
|
53399
53595
|
if (a === "--store") opts.store = resolved;
|
|
53400
53596
|
else if (a === "--project") opts.projectRulesDir = resolved;
|
|
53401
53597
|
else if (a === "--global") opts.globalRulesDir = resolved;
|
|
@@ -53427,9 +53623,9 @@ function main43(argv) {
|
|
|
53427
53623
|
}
|
|
53428
53624
|
function _isCliEntry34() {
|
|
53429
53625
|
if (process22.argv[1] === void 0) return false;
|
|
53430
|
-
if (import.meta.url === pathToFileURL40(
|
|
53626
|
+
if (import.meta.url === pathToFileURL40(path112.resolve(process22.argv[1])).href) return true;
|
|
53431
53627
|
try {
|
|
53432
|
-
return
|
|
53628
|
+
return fs114.realpathSync(_HERE28) === fs114.realpathSync(path112.resolve(process22.argv[1]));
|
|
53433
53629
|
} catch {
|
|
53434
53630
|
return false;
|
|
53435
53631
|
}
|
|
@@ -53443,7 +53639,7 @@ var init_report_conformance_funnel = __esm({
|
|
|
53443
53639
|
init_report_skill_activation();
|
|
53444
53640
|
init_report_skill_obligation_violations();
|
|
53445
53641
|
_HERE28 = fileURLToPath56(import.meta.url);
|
|
53446
|
-
REPO_ROOT12 =
|
|
53642
|
+
REPO_ROOT12 = path112.resolve(path112.dirname(_HERE28), "..", "..");
|
|
53447
53643
|
if (_isCliEntry34()) {
|
|
53448
53644
|
process22.exit(main43());
|
|
53449
53645
|
}
|
|
@@ -53471,9 +53667,9 @@ __export(cmd_conformance_exports, {
|
|
|
53471
53667
|
routeTargetPaths: () => routeTargetPaths,
|
|
53472
53668
|
runConformanceChecks: () => runConformanceChecks
|
|
53473
53669
|
});
|
|
53474
|
-
import * as
|
|
53670
|
+
import * as fs115 from "node:fs";
|
|
53475
53671
|
import * as os24 from "node:os";
|
|
53476
|
-
import * as
|
|
53672
|
+
import * as path113 from "node:path";
|
|
53477
53673
|
import process23 from "node:process";
|
|
53478
53674
|
import { spawnSync as spawnSync19 } from "node:child_process";
|
|
53479
53675
|
import { fileURLToPath as fileURLToPath57, pathToFileURL as pathToFileURL41 } from "node:url";
|
|
@@ -53490,20 +53686,20 @@ function conformanceLogPath() {
|
|
|
53490
53686
|
if (override && override.trim().length > 0) {
|
|
53491
53687
|
return override;
|
|
53492
53688
|
}
|
|
53493
|
-
return
|
|
53689
|
+
return path113.join(os24.homedir(), ".event4u", "agent-config", "conformance-log.jsonl");
|
|
53494
53690
|
}
|
|
53495
53691
|
function installLogPath() {
|
|
53496
53692
|
const override = process23.env["AGENT_CONFIG_INSTALL_LOG"];
|
|
53497
53693
|
if (override && override.trim().length > 0) {
|
|
53498
53694
|
return override;
|
|
53499
53695
|
}
|
|
53500
|
-
return
|
|
53696
|
+
return path113.join(os24.homedir(), ".event4u", "agent-config", "install-log.jsonl");
|
|
53501
53697
|
}
|
|
53502
53698
|
function _installLogExpected(projectRoot) {
|
|
53503
|
-
return
|
|
53699
|
+
return fs115.existsSync(manifest_path(projectRoot));
|
|
53504
53700
|
}
|
|
53505
53701
|
function _check_txlog_clean(logPath = installLogPath(), projectRoot = null) {
|
|
53506
|
-
const entries =
|
|
53702
|
+
const entries = fs115.existsSync(logPath) ? readRecentEntries(logPath) : [];
|
|
53507
53703
|
if (entries.length === 0) {
|
|
53508
53704
|
if (projectRoot !== null && _installLogExpected(projectRoot)) {
|
|
53509
53705
|
return {
|
|
@@ -53537,11 +53733,11 @@ function _check_txlog_clean(logPath = installLogPath(), projectRoot = null) {
|
|
|
53537
53733
|
};
|
|
53538
53734
|
}
|
|
53539
53735
|
function routeTargetPaths(target) {
|
|
53540
|
-
return routeTargetPathsPosix(target).map((
|
|
53736
|
+
return routeTargetPathsPosix(target).map((rel2) => path113.join(...rel2.split("/")));
|
|
53541
53737
|
}
|
|
53542
53738
|
function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
53543
|
-
const routerPath =
|
|
53544
|
-
if (!
|
|
53739
|
+
const routerPath = path113.join(packageRoot, "dist", "router.json");
|
|
53740
|
+
if (!fs115.existsSync(routerPath)) {
|
|
53545
53741
|
return {
|
|
53546
53742
|
id: "router-pointers",
|
|
53547
53743
|
status: "fail",
|
|
@@ -53551,7 +53747,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
53551
53747
|
}
|
|
53552
53748
|
let router;
|
|
53553
53749
|
try {
|
|
53554
|
-
router = JSON.parse(
|
|
53750
|
+
router = JSON.parse(fs115.readFileSync(routerPath, "utf8"));
|
|
53555
53751
|
} catch (exc) {
|
|
53556
53752
|
return {
|
|
53557
53753
|
id: "router-pointers",
|
|
@@ -53560,13 +53756,13 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
53560
53756
|
remedy: "reinstall the package \u2014 dist/router.json is corrupt"
|
|
53561
53757
|
};
|
|
53562
53758
|
}
|
|
53563
|
-
const rulesDir =
|
|
53759
|
+
const rulesDir = path113.join(packageRoot, "dist", "agent-src", "rules");
|
|
53564
53760
|
const broken = [];
|
|
53565
53761
|
let ids = 0;
|
|
53566
53762
|
let targets = 0;
|
|
53567
53763
|
for (const kernelId of router["kernel"] ?? []) {
|
|
53568
53764
|
ids += 1;
|
|
53569
|
-
if (!
|
|
53765
|
+
if (!fs115.existsSync(path113.join(rulesDir, `${kernelId}.md`))) {
|
|
53570
53766
|
broken.push(`kernel:${kernelId} \u2192 rules/${kernelId}.md missing`);
|
|
53571
53767
|
}
|
|
53572
53768
|
}
|
|
@@ -53574,7 +53770,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
53574
53770
|
for (const entry of router[tier] ?? []) {
|
|
53575
53771
|
const ruleId = String(entry["id"] ?? "");
|
|
53576
53772
|
ids += 1;
|
|
53577
|
-
if (!
|
|
53773
|
+
if (!fs115.existsSync(path113.join(rulesDir, `${ruleId}.md`))) {
|
|
53578
53774
|
broken.push(`${tier}:${ruleId} \u2192 rules/${ruleId}.md missing`);
|
|
53579
53775
|
}
|
|
53580
53776
|
for (const target of entry["routes_to"] ?? []) {
|
|
@@ -53584,7 +53780,7 @@ function _check_router_pointers(packageRoot = PACKAGE_ROOT2) {
|
|
|
53584
53780
|
broken.push(`${ruleId} \u2192 unparseable routes_to ${JSON.stringify(target)}`);
|
|
53585
53781
|
continue;
|
|
53586
53782
|
}
|
|
53587
|
-
if (!candidates.some((
|
|
53783
|
+
if (!candidates.some((rel2) => fs115.existsSync(path113.join(packageRoot, rel2)))) {
|
|
53588
53784
|
broken.push(`${ruleId} \u2192 ${target} (${candidates[0]} missing)`);
|
|
53589
53785
|
}
|
|
53590
53786
|
}
|
|
@@ -53616,9 +53812,9 @@ function detectSmokePlatform(projectRoot) {
|
|
|
53616
53812
|
return "claude";
|
|
53617
53813
|
}
|
|
53618
53814
|
function dispatcherRunner(packageRoot) {
|
|
53619
|
-
const localTsx =
|
|
53620
|
-
const script =
|
|
53621
|
-
if (
|
|
53815
|
+
const localTsx = path113.join(packageRoot, "node_modules", ".bin", "tsx");
|
|
53816
|
+
const script = path113.join(packageRoot, "src", "scripts", "hooks", "dispatch_hook.ts");
|
|
53817
|
+
if (fs115.existsSync(localTsx)) {
|
|
53622
53818
|
return [localTsx, script];
|
|
53623
53819
|
}
|
|
53624
53820
|
return ["npx", "tsx", script];
|
|
@@ -53668,12 +53864,12 @@ function _check_hook_dispatcher(projectRoot, packageRoot = PACKAGE_ROOT2, opts =
|
|
|
53668
53864
|
};
|
|
53669
53865
|
}
|
|
53670
53866
|
function readSettingsMode(projectRoot) {
|
|
53671
|
-
const settingsPath =
|
|
53672
|
-
if (!
|
|
53867
|
+
const settingsPath = path113.join(projectRoot, ".agent-settings.yml");
|
|
53868
|
+
if (!fs115.existsSync(settingsPath)) {
|
|
53673
53869
|
return "eager-all";
|
|
53674
53870
|
}
|
|
53675
53871
|
try {
|
|
53676
|
-
const parsed = YAML9.parse(
|
|
53872
|
+
const parsed = YAML9.parse(fs115.readFileSync(settingsPath, "utf8"));
|
|
53677
53873
|
const lean = parsed?.["lean_projection"] ?? null;
|
|
53678
53874
|
const mode = lean?.["mode"];
|
|
53679
53875
|
return typeof mode === "string" && mode.length > 0 ? mode : "eager-all";
|
|
@@ -53684,7 +53880,7 @@ function readSettingsMode(projectRoot) {
|
|
|
53684
53880
|
function kernelIdsFromRouter(packageRoot) {
|
|
53685
53881
|
try {
|
|
53686
53882
|
const router = JSON.parse(
|
|
53687
|
-
|
|
53883
|
+
fs115.readFileSync(path113.join(packageRoot, "dist", "router.json"), "utf8")
|
|
53688
53884
|
);
|
|
53689
53885
|
return new Set((router["kernel"] ?? []).map(String));
|
|
53690
53886
|
} catch {
|
|
@@ -53701,8 +53897,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
53701
53897
|
remedy: "set lean_projection.mode to 'eager-all' or 'thin' in .agent-settings.yml"
|
|
53702
53898
|
};
|
|
53703
53899
|
}
|
|
53704
|
-
const rulesDir = projectedRulesDir ??
|
|
53705
|
-
if (!
|
|
53900
|
+
const rulesDir = projectedRulesDir ?? path113.join(projectRoot, ".augment", "rules");
|
|
53901
|
+
if (!fs115.existsSync(rulesDir)) {
|
|
53706
53902
|
return {
|
|
53707
53903
|
id: "lean-projection",
|
|
53708
53904
|
status: "skipped",
|
|
@@ -53711,7 +53907,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
53711
53907
|
};
|
|
53712
53908
|
}
|
|
53713
53909
|
const kernel = kernelIdsFromRouter(packageRoot);
|
|
53714
|
-
const files =
|
|
53910
|
+
const files = fs115.readdirSync(rulesDir).filter((f) => f.endsWith(".md") && f !== "INDEX.md").sort();
|
|
53715
53911
|
const nonKernel = files.filter((f) => !kernel.has(f.replace(/\.md$/, "")));
|
|
53716
53912
|
if (nonKernel.length === 0) {
|
|
53717
53913
|
return {
|
|
@@ -53725,7 +53921,7 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
53725
53921
|
for (const f of nonKernel) {
|
|
53726
53922
|
let text = "";
|
|
53727
53923
|
try {
|
|
53728
|
-
text =
|
|
53924
|
+
text = fs115.readFileSync(path113.join(rulesDir, f), "utf8");
|
|
53729
53925
|
} catch {
|
|
53730
53926
|
continue;
|
|
53731
53927
|
}
|
|
@@ -53756,8 +53952,8 @@ function _check_lean_projection(projectRoot, packageRoot = PACKAGE_ROOT2, projec
|
|
|
53756
53952
|
function _check_host_manifest(projectRoot) {
|
|
53757
53953
|
const detected = Object.entries(detectToolPresence(projectRoot)).filter(([, v]) => v === true).map(([k]) => k);
|
|
53758
53954
|
const detectedNote = detected.length > 0 ? `detected surfaces: ${detected.join(", ")}` : "no surfaces detected";
|
|
53759
|
-
const settingsPath =
|
|
53760
|
-
if (!
|
|
53955
|
+
const settingsPath = path113.join(projectRoot, ".agent-settings.yml");
|
|
53956
|
+
if (!fs115.existsSync(settingsPath)) {
|
|
53761
53957
|
return {
|
|
53762
53958
|
id: "host-manifest",
|
|
53763
53959
|
status: "ok",
|
|
@@ -53767,7 +53963,7 @@ function _check_host_manifest(projectRoot) {
|
|
|
53767
53963
|
}
|
|
53768
53964
|
let parsed = null;
|
|
53769
53965
|
try {
|
|
53770
|
-
parsed = YAML9.parse(
|
|
53966
|
+
parsed = YAML9.parse(fs115.readFileSync(settingsPath, "utf8"));
|
|
53771
53967
|
} catch (exc) {
|
|
53772
53968
|
return {
|
|
53773
53969
|
id: "host-manifest",
|
|
@@ -53940,13 +54136,13 @@ function _isCliEntry35() {
|
|
|
53940
54136
|
if (process23.argv[1] === void 0) {
|
|
53941
54137
|
return false;
|
|
53942
54138
|
}
|
|
53943
|
-
const argvUrl = pathToFileURL41(
|
|
54139
|
+
const argvUrl = pathToFileURL41(path113.resolve(process23.argv[1])).href;
|
|
53944
54140
|
if (import.meta.url === argvUrl) {
|
|
53945
54141
|
return true;
|
|
53946
54142
|
}
|
|
53947
54143
|
try {
|
|
53948
|
-
const here =
|
|
53949
|
-
const argv =
|
|
54144
|
+
const here = fs115.realpathSync(fileURLToPath57(import.meta.url));
|
|
54145
|
+
const argv = fs115.realpathSync(path113.resolve(process23.argv[1]));
|
|
53950
54146
|
return here === argv;
|
|
53951
54147
|
} catch {
|
|
53952
54148
|
return false;
|
|
@@ -54018,7 +54214,7 @@ __export(settings_exports, {
|
|
|
54018
54214
|
read_tier_usage_settings: () => read_tier_usage_settings
|
|
54019
54215
|
});
|
|
54020
54216
|
import { createRequire as createRequire7 } from "node:module";
|
|
54021
|
-
import * as
|
|
54217
|
+
import * as fs116 from "node:fs";
|
|
54022
54218
|
function _isPlainObject8(v) {
|
|
54023
54219
|
return typeof v === "object" && v !== null && !Array.isArray(v) && !(v instanceof Date);
|
|
54024
54220
|
}
|
|
@@ -54055,7 +54251,7 @@ function _coerce_path(value, def) {
|
|
|
54055
54251
|
}
|
|
54056
54252
|
function _isFile16(p) {
|
|
54057
54253
|
try {
|
|
54058
|
-
return
|
|
54254
|
+
return fs116.statSync(p).isFile();
|
|
54059
54255
|
} catch {
|
|
54060
54256
|
return false;
|
|
54061
54257
|
}
|
|
@@ -54066,7 +54262,7 @@ function _read_telemetry_section(p, key) {
|
|
|
54066
54262
|
}
|
|
54067
54263
|
let raw = {};
|
|
54068
54264
|
try {
|
|
54069
|
-
raw = YAML10.parse(
|
|
54265
|
+
raw = YAML10.parse(fs116.readFileSync(p, "utf-8"), { version: "1.1" });
|
|
54070
54266
|
if (raw === null || raw === void 0) {
|
|
54071
54267
|
raw = {};
|
|
54072
54268
|
}
|
|
@@ -54710,7 +54906,7 @@ __export(aggregator_exports, {
|
|
|
54710
54906
|
aggregate: () => aggregate2,
|
|
54711
54907
|
rank_artefacts: () => rank_artefacts
|
|
54712
54908
|
});
|
|
54713
|
-
import * as
|
|
54909
|
+
import * as fs117 from "node:fs";
|
|
54714
54910
|
function _key(kind, artId) {
|
|
54715
54911
|
return `${kind}\0${artId}`;
|
|
54716
54912
|
}
|
|
@@ -54747,7 +54943,7 @@ function* _iter_events(log_path) {
|
|
|
54747
54943
|
if (!_isFile17(log_path)) {
|
|
54748
54944
|
return;
|
|
54749
54945
|
}
|
|
54750
|
-
const text =
|
|
54946
|
+
const text = fs117.readFileSync(log_path, "utf-8");
|
|
54751
54947
|
const lines = _pyFileLines(text);
|
|
54752
54948
|
let lineNo = 0;
|
|
54753
54949
|
for (const line of lines) {
|
|
@@ -54781,7 +54977,7 @@ function _pyFileLines(text) {
|
|
|
54781
54977
|
}
|
|
54782
54978
|
function _isFile17(p) {
|
|
54783
54979
|
try {
|
|
54784
|
-
return
|
|
54980
|
+
return fs117.statSync(p).isFile();
|
|
54785
54981
|
} catch {
|
|
54786
54982
|
return false;
|
|
54787
54983
|
}
|
|
@@ -55369,7 +55565,7 @@ var init_report_renderer = __esm({
|
|
|
55369
55565
|
});
|
|
55370
55566
|
|
|
55371
55567
|
// src/scripts/ai_council/bundler.ts
|
|
55372
|
-
import * as
|
|
55568
|
+
import * as fs118 from "node:fs";
|
|
55373
55569
|
function _context(mode, text, manifest = [], excluded = []) {
|
|
55374
55570
|
return { mode, text, manifest, excluded };
|
|
55375
55571
|
}
|
|
@@ -55427,10 +55623,10 @@ function bundle_prompt(text) {
|
|
|
55427
55623
|
return _context("prompt", _enforceSize(redacted, "prompt"), ["<inline prompt>"]);
|
|
55428
55624
|
}
|
|
55429
55625
|
function bundle_roadmap(p) {
|
|
55430
|
-
if (!
|
|
55626
|
+
if (!fs118.existsSync(p)) {
|
|
55431
55627
|
throw new FileNotFoundError2(`Roadmap not found: ${p}`);
|
|
55432
55628
|
}
|
|
55433
|
-
const raw =
|
|
55629
|
+
const raw = fs118.readFileSync(p, { encoding: "utf-8" });
|
|
55434
55630
|
const redacted = redact(raw);
|
|
55435
55631
|
return _context(
|
|
55436
55632
|
"roadmap",
|
|
@@ -55608,8 +55804,8 @@ function aggregate_scores(findings, scores) {
|
|
|
55608
55804
|
by_id.get(s.finding_id).push(s);
|
|
55609
55805
|
}
|
|
55610
55806
|
const out = /* @__PURE__ */ new Map();
|
|
55611
|
-
for (const [fid,
|
|
55612
|
-
if (
|
|
55807
|
+
for (const [fid, fs130] of by_id) {
|
|
55808
|
+
if (fs130.length === 0) {
|
|
55613
55809
|
out.set(
|
|
55614
55810
|
fid,
|
|
55615
55811
|
new ConsensusMetadata({
|
|
@@ -55625,13 +55821,13 @@ function aggregate_scores(findings, scores) {
|
|
|
55625
55821
|
);
|
|
55626
55822
|
continue;
|
|
55627
55823
|
}
|
|
55628
|
-
const mean2 =
|
|
55629
|
-
const agree_rate =
|
|
55824
|
+
const mean2 = fs130.reduce((acc, s) => acc + s.score, 0) / fs130.length;
|
|
55825
|
+
const agree_rate = fs130.filter((s) => s.agree).length / fs130.length;
|
|
55630
55826
|
const strength = mean2 / 10 * agree_rate;
|
|
55631
|
-
const dissent =
|
|
55632
|
-
const concur =
|
|
55633
|
-
const scorers =
|
|
55634
|
-
const dissent_reasons =
|
|
55827
|
+
const dissent = fs130.filter((s) => !s.agree).length;
|
|
55828
|
+
const concur = fs130.filter((s) => s.agree).length;
|
|
55829
|
+
const scorers = fs130.map((s) => s.scorer);
|
|
55830
|
+
const dissent_reasons = fs130.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
|
|
55635
55831
|
const mean_rounded = pyRound2(mean2, 2);
|
|
55636
55832
|
out.set(
|
|
55637
55833
|
fid,
|
|
@@ -55958,9 +56154,9 @@ var init_consensus = __esm({
|
|
|
55958
56154
|
});
|
|
55959
56155
|
|
|
55960
56156
|
// src/scripts/ai_council/blind_review.ts
|
|
55961
|
-
import { createHash as
|
|
56157
|
+
import { createHash as createHash20 } from "node:crypto";
|
|
55962
56158
|
function _sha256_hex(s) {
|
|
55963
|
-
return
|
|
56159
|
+
return createHash20("sha256").update(s, "utf-8").digest("hex");
|
|
55964
56160
|
}
|
|
55965
56161
|
function deterministic_shuffle_indices(seed, n) {
|
|
55966
56162
|
const keyed = Array.from({ length: n }, (_, i) => ({ i, key: _sha256_hex(`${seed}\0${i}`) }));
|
|
@@ -56071,26 +56267,26 @@ One sentence, and the single strongest reason.`;
|
|
|
56071
56267
|
});
|
|
56072
56268
|
|
|
56073
56269
|
// src/scripts/ai_council/recouncil_guard.ts
|
|
56074
|
-
import * as
|
|
56075
|
-
import * as
|
|
56270
|
+
import * as fs119 from "node:fs";
|
|
56271
|
+
import * as path114 from "node:path";
|
|
56076
56272
|
function configFingerprint(members, rounds) {
|
|
56077
56273
|
return `${[...members].sort().join(",")}|rounds=${String(rounds)}`;
|
|
56078
56274
|
}
|
|
56079
56275
|
function readPriorRuns(responsesDir, repoRoot) {
|
|
56080
56276
|
let names;
|
|
56081
56277
|
try {
|
|
56082
|
-
names =
|
|
56278
|
+
names = fs119.readdirSync(responsesDir).filter((f) => f.endsWith(".md"));
|
|
56083
56279
|
} catch {
|
|
56084
56280
|
return [];
|
|
56085
56281
|
}
|
|
56086
56282
|
const out = [];
|
|
56087
56283
|
for (const name of names) {
|
|
56088
|
-
const abs =
|
|
56284
|
+
const abs = path114.join(responsesDir, name);
|
|
56089
56285
|
let head;
|
|
56090
56286
|
let stat;
|
|
56091
56287
|
try {
|
|
56092
|
-
stat =
|
|
56093
|
-
const text =
|
|
56288
|
+
stat = fs119.statSync(abs);
|
|
56289
|
+
const text = fs119.readFileSync(abs, "utf8");
|
|
56094
56290
|
const json = _leadingJson(text);
|
|
56095
56291
|
if (json === null) continue;
|
|
56096
56292
|
head = JSON.parse(json);
|
|
@@ -56104,7 +56300,7 @@ function readPriorRuns(responsesDir, repoRoot) {
|
|
|
56104
56300
|
let questionText = null;
|
|
56105
56301
|
if (questionPath !== "") {
|
|
56106
56302
|
try {
|
|
56107
|
-
const q =
|
|
56303
|
+
const q = fs119.readFileSync(path114.join(repoRoot, questionPath), "utf8");
|
|
56108
56304
|
questionHash = _sha256_hex(q);
|
|
56109
56305
|
questionText = q;
|
|
56110
56306
|
} catch {
|
|
@@ -56185,14 +56381,14 @@ function warnIfRecounciled(repoRoot, questionFile, fallbackText, members, rounds
|
|
|
56185
56381
|
try {
|
|
56186
56382
|
let text = fallbackText;
|
|
56187
56383
|
try {
|
|
56188
|
-
text =
|
|
56384
|
+
text = fs119.readFileSync(path114.resolve(repoRoot, questionFile), "utf8");
|
|
56189
56385
|
} catch {
|
|
56190
56386
|
}
|
|
56191
56387
|
const v = checkRecouncil(
|
|
56192
56388
|
text,
|
|
56193
56389
|
// `name/model` — the SAME shape the artefact writer records.
|
|
56194
56390
|
configFingerprint(members.map((m) => `${m.name}/${m.model}`), rounds),
|
|
56195
|
-
readPriorRuns(
|
|
56391
|
+
readPriorRuns(path114.join(repoRoot, "agents/runtime/council/responses"), repoRoot)
|
|
56196
56392
|
);
|
|
56197
56393
|
if (v !== null) write(renderRecouncilWarning(v));
|
|
56198
56394
|
} catch {
|
|
@@ -56209,7 +56405,7 @@ var init_recouncil_guard = __esm({
|
|
|
56209
56405
|
});
|
|
56210
56406
|
|
|
56211
56407
|
// src/scripts/_lib/untrusted_content.ts
|
|
56212
|
-
import * as
|
|
56408
|
+
import * as crypto12 from "node:crypto";
|
|
56213
56409
|
function assertNonce(nonce) {
|
|
56214
56410
|
if (nonce.length < MIN_NONCE_LENGTH || !NONCE_SHAPE.test(nonce)) {
|
|
56215
56411
|
throw new Error(
|
|
@@ -56218,7 +56414,7 @@ function assertNonce(nonce) {
|
|
|
56218
56414
|
}
|
|
56219
56415
|
}
|
|
56220
56416
|
function newNonce() {
|
|
56221
|
-
return
|
|
56417
|
+
return crypto12.randomBytes(NONCE_BYTES).toString("hex");
|
|
56222
56418
|
}
|
|
56223
56419
|
function wrapUntrustedBlocks(blocks, options = {}) {
|
|
56224
56420
|
if (blocks.length === 0) {
|
|
@@ -56821,8 +57017,8 @@ not. Cite the peer-reviewer label and the targeted response label
|
|
|
56821
57017
|
});
|
|
56822
57018
|
|
|
56823
57019
|
// src/scripts/ai_council/advisors.ts
|
|
56824
|
-
import * as
|
|
56825
|
-
import * as
|
|
57020
|
+
import * as fs120 from "node:fs";
|
|
57021
|
+
import * as path115 from "node:path";
|
|
56826
57022
|
function _split_frontmatter2(raw) {
|
|
56827
57023
|
const match = _FRONTMATTER_RE2.exec(raw);
|
|
56828
57024
|
if (!match) {
|
|
@@ -56850,12 +57046,12 @@ function _display_name_from(advisor_name, frontmatter) {
|
|
|
56850
57046
|
}
|
|
56851
57047
|
function resolve_persona_text(persona_path, repo_root2) {
|
|
56852
57048
|
const candidates = [
|
|
56853
|
-
|
|
56854
|
-
|
|
57049
|
+
path115.join(repo_root2, "dist/agent-src", persona_path),
|
|
57050
|
+
path115.join(repo_root2, ".agent-src.uncondensed", persona_path)
|
|
56855
57051
|
];
|
|
56856
57052
|
for (const candidate of candidates) {
|
|
56857
|
-
if (
|
|
56858
|
-
const raw =
|
|
57053
|
+
if (fs120.existsSync(candidate)) {
|
|
57054
|
+
const raw = fs120.readFileSync(candidate, "utf-8");
|
|
56859
57055
|
const [meta, body] = _split_frontmatter2(raw);
|
|
56860
57056
|
return [body.trim(), meta];
|
|
56861
57057
|
}
|
|
@@ -57663,15 +57859,15 @@ var init_qualification = __esm({
|
|
|
57663
57859
|
});
|
|
57664
57860
|
|
|
57665
57861
|
// src/scripts/ai_council/probe_store.ts
|
|
57666
|
-
import
|
|
57667
|
-
import
|
|
57862
|
+
import fs121 from "node:fs";
|
|
57863
|
+
import path116 from "node:path";
|
|
57668
57864
|
function probeStorePath(root) {
|
|
57669
|
-
return
|
|
57865
|
+
return path116.join(root, PROBE_STORE_RELPATH);
|
|
57670
57866
|
}
|
|
57671
57867
|
function readProbeStore(root) {
|
|
57672
57868
|
let raw;
|
|
57673
57869
|
try {
|
|
57674
|
-
raw =
|
|
57870
|
+
raw = fs121.readFileSync(probeStorePath(root), "utf8");
|
|
57675
57871
|
} catch {
|
|
57676
57872
|
return EMPTY;
|
|
57677
57873
|
}
|
|
@@ -57721,8 +57917,8 @@ function recordProbes(root, entries) {
|
|
|
57721
57917
|
members[e.name] = { at: e.at, outcome: e.outcome };
|
|
57722
57918
|
}
|
|
57723
57919
|
const target = probeStorePath(root);
|
|
57724
|
-
|
|
57725
|
-
|
|
57920
|
+
fs121.mkdirSync(path116.dirname(target), { recursive: true });
|
|
57921
|
+
fs121.writeFileSync(target, `${JSON.stringify({ schema: 1, members }, null, 2)}
|
|
57726
57922
|
`, "utf8");
|
|
57727
57923
|
} catch {
|
|
57728
57924
|
}
|
|
@@ -57736,7 +57932,7 @@ var init_probe_store = __esm({
|
|
|
57736
57932
|
"use strict";
|
|
57737
57933
|
init_env_kill_switch();
|
|
57738
57934
|
_KILL_SWITCH_ENV2 = "AGENT_CONFIG_NO_EVENTS_LOG";
|
|
57739
|
-
PROBE_STORE_RELPATH =
|
|
57935
|
+
PROBE_STORE_RELPATH = path116.join("agents", "runtime", "state", "council-probes.json");
|
|
57740
57936
|
EMPTY = { schema: 1, members: {} };
|
|
57741
57937
|
VALID_OUTCOMES = /* @__PURE__ */ new Set([
|
|
57742
57938
|
"ok",
|
|
@@ -58040,10 +58236,10 @@ var init_council_fallback_posture = __esm({
|
|
|
58040
58236
|
});
|
|
58041
58237
|
|
|
58042
58238
|
// src/scripts/_lib/billing_grant.ts
|
|
58043
|
-
import * as
|
|
58044
|
-
import * as
|
|
58239
|
+
import * as fs122 from "node:fs";
|
|
58240
|
+
import * as path117 from "node:path";
|
|
58045
58241
|
function grantFile(repoRoot, runId) {
|
|
58046
|
-
return
|
|
58242
|
+
return path117.join(
|
|
58047
58243
|
repoRoot,
|
|
58048
58244
|
BILLING_GRANT_DIR_REL,
|
|
58049
58245
|
`${runId.replace(/[^A-Za-z0-9_-]/g, "_")}.json`
|
|
@@ -58054,8 +58250,8 @@ function issueBillingGrant(repoRoot, runId, now2 = () => /* @__PURE__ */ new Dat
|
|
|
58054
58250
|
const existing = _read2(file);
|
|
58055
58251
|
if (existing !== null && existing.run_id === runId) return existing;
|
|
58056
58252
|
const grant = { run_id: runId, issued_at: now2().toISOString() };
|
|
58057
|
-
|
|
58058
|
-
|
|
58253
|
+
fs122.mkdirSync(path117.dirname(file), { recursive: true });
|
|
58254
|
+
fs122.writeFileSync(file, `${JSON.stringify(grant, null, 2)}
|
|
58059
58255
|
`, "utf8");
|
|
58060
58256
|
return grant;
|
|
58061
58257
|
}
|
|
@@ -58073,13 +58269,13 @@ function hasBillingGrant(repoRoot, env = process.env, now2 = () => /* @__PURE__
|
|
|
58073
58269
|
}
|
|
58074
58270
|
function revokeBillingGrant(repoRoot, runId) {
|
|
58075
58271
|
try {
|
|
58076
|
-
|
|
58272
|
+
fs122.unlinkSync(grantFile(repoRoot, runId));
|
|
58077
58273
|
} catch {
|
|
58078
58274
|
}
|
|
58079
58275
|
}
|
|
58080
58276
|
function _read2(file) {
|
|
58081
58277
|
try {
|
|
58082
|
-
const raw = JSON.parse(
|
|
58278
|
+
const raw = JSON.parse(fs122.readFileSync(file, "utf8"));
|
|
58083
58279
|
if (raw === null || typeof raw !== "object") return null;
|
|
58084
58280
|
const o = raw;
|
|
58085
58281
|
if (typeof o.run_id !== "string" || typeof o.issued_at !== "string") return null;
|
|
@@ -58100,7 +58296,7 @@ var init_billing_grant = __esm({
|
|
|
58100
58296
|
"src/scripts/_lib/billing_grant.ts"() {
|
|
58101
58297
|
"use strict";
|
|
58102
58298
|
BILLING_GRANT_ENV = "AC_BILLING_GRANT";
|
|
58103
|
-
BILLING_GRANT_DIR_REL =
|
|
58299
|
+
BILLING_GRANT_DIR_REL = path117.join("agents", "runtime", "billing-grants");
|
|
58104
58300
|
BILLING_GRANT_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
58105
58301
|
}
|
|
58106
58302
|
});
|
|
@@ -58189,10 +58385,10 @@ var init_council_fallback_wiring = __esm({
|
|
|
58189
58385
|
});
|
|
58190
58386
|
|
|
58191
58387
|
// src/scripts/_lib/quota_parked.ts
|
|
58192
|
-
import * as
|
|
58193
|
-
import * as
|
|
58388
|
+
import * as fs123 from "node:fs";
|
|
58389
|
+
import * as path118 from "node:path";
|
|
58194
58390
|
function markerFile(repoRoot, runId) {
|
|
58195
|
-
return
|
|
58391
|
+
return path118.join(
|
|
58196
58392
|
repoRoot,
|
|
58197
58393
|
QUOTA_PARKED_DIR_REL,
|
|
58198
58394
|
`${runId.replace(/[^A-Za-z0-9_-]/g, "_")}.json`
|
|
@@ -58207,14 +58403,14 @@ function writeQuotaParked(repoRoot, runId, providers, now2 = () => /* @__PURE__
|
|
|
58207
58403
|
providers: merged,
|
|
58208
58404
|
parked_at: existing?.parked_at ?? now2().toISOString()
|
|
58209
58405
|
};
|
|
58210
|
-
|
|
58211
|
-
|
|
58406
|
+
fs123.mkdirSync(path118.dirname(file), { recursive: true });
|
|
58407
|
+
fs123.writeFileSync(file, `${JSON.stringify(marker, null, 2)}
|
|
58212
58408
|
`, "utf8");
|
|
58213
58409
|
return marker;
|
|
58214
58410
|
}
|
|
58215
58411
|
function readMarker(file) {
|
|
58216
58412
|
try {
|
|
58217
|
-
const raw = JSON.parse(
|
|
58413
|
+
const raw = JSON.parse(fs123.readFileSync(file, "utf8"));
|
|
58218
58414
|
if (raw === null || typeof raw !== "object") return null;
|
|
58219
58415
|
const o = raw;
|
|
58220
58416
|
if (typeof o["run_id"] !== "string" || typeof o["parked_at"] !== "string") return null;
|
|
@@ -58229,7 +58425,7 @@ var QUOTA_PARKED_DIR_REL;
|
|
|
58229
58425
|
var init_quota_parked = __esm({
|
|
58230
58426
|
"src/scripts/_lib/quota_parked.ts"() {
|
|
58231
58427
|
"use strict";
|
|
58232
|
-
QUOTA_PARKED_DIR_REL =
|
|
58428
|
+
QUOTA_PARKED_DIR_REL = path118.join("agents", "runtime", "state", "quota-parked");
|
|
58233
58429
|
}
|
|
58234
58430
|
});
|
|
58235
58431
|
|
|
@@ -58299,7 +58495,7 @@ __export(low_impact_corpus_exports, {
|
|
|
58299
58495
|
load_validated_phrases: () => load_validated_phrases,
|
|
58300
58496
|
parse_corpus_strict: () => parse_corpus_strict
|
|
58301
58497
|
});
|
|
58302
|
-
import * as
|
|
58498
|
+
import * as fs124 from "node:fs";
|
|
58303
58499
|
function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
|
|
58304
58500
|
return { phrase, normalised, section, line_no, trailing_metadata };
|
|
58305
58501
|
}
|
|
@@ -58472,10 +58668,10 @@ function _checkHeadingDrift(text, title) {
|
|
|
58472
58668
|
}
|
|
58473
58669
|
function parse_corpus_strict(corpusPath) {
|
|
58474
58670
|
const p = corpusPath;
|
|
58475
|
-
if (!
|
|
58671
|
+
if (!fs124.existsSync(p)) {
|
|
58476
58672
|
return new CorpusParseResult();
|
|
58477
58673
|
}
|
|
58478
|
-
const text =
|
|
58674
|
+
const text = fs124.readFileSync(p, { encoding: "utf-8" });
|
|
58479
58675
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
58480
58676
|
const resultSections = {
|
|
58481
58677
|
validated: [],
|
|
@@ -58538,10 +58734,10 @@ function load_anti_example_phrases(corpusPath) {
|
|
|
58538
58734
|
}
|
|
58539
58735
|
function load_corpus_lock(yamlPath) {
|
|
58540
58736
|
const p = yamlPath;
|
|
58541
|
-
if (!
|
|
58737
|
+
if (!fs124.existsSync(p)) {
|
|
58542
58738
|
return new CorpusParseResult();
|
|
58543
58739
|
}
|
|
58544
|
-
const parsed = (0, import_yaml10.parse)(
|
|
58740
|
+
const parsed = (0, import_yaml10.parse)(fs124.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
|
|
58545
58741
|
const doc = parsed === null || parsed === void 0 ? {} : parsed;
|
|
58546
58742
|
const schemaVersion = doc["schema_version"];
|
|
58547
58743
|
if (schemaVersion !== 1) {
|
|
@@ -58603,7 +58799,7 @@ function _deriveLockPath(corpusPath) {
|
|
|
58603
58799
|
}
|
|
58604
58800
|
function _loadSectionFromLock(corpusPath, section) {
|
|
58605
58801
|
const lockPath = _deriveLockPath(corpusPath);
|
|
58606
|
-
if (!
|
|
58802
|
+
if (!fs124.existsSync(lockPath)) {
|
|
58607
58803
|
return null;
|
|
58608
58804
|
}
|
|
58609
58805
|
try {
|
|
@@ -58615,10 +58811,10 @@ function _loadSectionFromLock(corpusPath, section) {
|
|
|
58615
58811
|
}
|
|
58616
58812
|
function _loadSectionLenient(corpusPath, section) {
|
|
58617
58813
|
const p = corpusPath;
|
|
58618
|
-
if (!
|
|
58814
|
+
if (!fs124.existsSync(p)) {
|
|
58619
58815
|
return [];
|
|
58620
58816
|
}
|
|
58621
|
-
const text =
|
|
58817
|
+
const text = fs124.readFileSync(p, { encoding: "utf-8" });
|
|
58622
58818
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
58623
58819
|
const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
|
|
58624
58820
|
if (bounds === null) {
|
|
@@ -59746,8 +59942,8 @@ var init_consensus_round = __esm({
|
|
|
59746
59942
|
});
|
|
59747
59943
|
|
|
59748
59944
|
// src/scripts/ai_council/budget_guard.ts
|
|
59749
|
-
import * as
|
|
59750
|
-
import * as
|
|
59945
|
+
import * as fs125 from "node:fs";
|
|
59946
|
+
import * as path119 from "node:path";
|
|
59751
59947
|
function _resolveLedgerPath(p) {
|
|
59752
59948
|
if (p !== null) {
|
|
59753
59949
|
return p;
|
|
@@ -59762,18 +59958,18 @@ function _nowUtcMs() {
|
|
|
59762
59958
|
return Date.now();
|
|
59763
59959
|
}
|
|
59764
59960
|
function _ensureLedgerDir(p) {
|
|
59765
|
-
const parent =
|
|
59961
|
+
const parent = path119.dirname(p);
|
|
59766
59962
|
try {
|
|
59767
|
-
|
|
59963
|
+
fs125.mkdirSync(parent, { recursive: true });
|
|
59768
59964
|
let mode;
|
|
59769
59965
|
try {
|
|
59770
|
-
mode =
|
|
59966
|
+
mode = fs125.statSync(parent).mode & 511;
|
|
59771
59967
|
} catch {
|
|
59772
59968
|
mode = 448;
|
|
59773
59969
|
}
|
|
59774
59970
|
if (mode !== 448) {
|
|
59775
59971
|
try {
|
|
59776
|
-
|
|
59972
|
+
fs125.chmodSync(parent, 448);
|
|
59777
59973
|
} catch {
|
|
59778
59974
|
}
|
|
59779
59975
|
}
|
|
@@ -59785,18 +59981,18 @@ function _ensureLedgerDir(p) {
|
|
|
59785
59981
|
}
|
|
59786
59982
|
}
|
|
59787
59983
|
function _ensureLedgerFileMode(p) {
|
|
59788
|
-
if (!
|
|
59984
|
+
if (!fs125.existsSync(p)) {
|
|
59789
59985
|
return;
|
|
59790
59986
|
}
|
|
59791
59987
|
let current;
|
|
59792
59988
|
try {
|
|
59793
|
-
current =
|
|
59989
|
+
current = fs125.statSync(p).mode & 511;
|
|
59794
59990
|
} catch {
|
|
59795
59991
|
return;
|
|
59796
59992
|
}
|
|
59797
59993
|
if (current !== 384) {
|
|
59798
59994
|
try {
|
|
59799
|
-
|
|
59995
|
+
fs125.chmodSync(p, 384);
|
|
59800
59996
|
} catch {
|
|
59801
59997
|
}
|
|
59802
59998
|
}
|
|
@@ -59948,11 +60144,11 @@ function pyNumToStr(n) {
|
|
|
59948
60144
|
}
|
|
59949
60145
|
function read_entries2(p = null) {
|
|
59950
60146
|
const resolved = _resolveLedgerPath(p);
|
|
59951
|
-
if (!
|
|
60147
|
+
if (!fs125.existsSync(resolved)) {
|
|
59952
60148
|
return [];
|
|
59953
60149
|
}
|
|
59954
60150
|
const out = [];
|
|
59955
|
-
const text =
|
|
60151
|
+
const text = fs125.readFileSync(resolved, "utf-8");
|
|
59956
60152
|
for (const rawLine of text.split(/\r\n|\r|\n/u)) {
|
|
59957
60153
|
const line = rawLine.trim();
|
|
59958
60154
|
if (line === "") {
|
|
@@ -60055,7 +60251,7 @@ function record_spend(usd, provider, model, options = {}) {
|
|
|
60055
60251
|
)}
|
|
60056
60252
|
`;
|
|
60057
60253
|
try {
|
|
60058
|
-
|
|
60254
|
+
fs125.appendFileSync(p, entry, { encoding: "utf-8" });
|
|
60059
60255
|
} catch (exc) {
|
|
60060
60256
|
process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
|
|
60061
60257
|
`);
|
|
@@ -61719,18 +61915,18 @@ __export(project_context_exports, {
|
|
|
61719
61915
|
REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
|
|
61720
61916
|
detect_project_context: () => detect_project_context
|
|
61721
61917
|
});
|
|
61722
|
-
import * as
|
|
61723
|
-
import * as
|
|
61918
|
+
import * as fs126 from "node:fs";
|
|
61919
|
+
import * as path120 from "node:path";
|
|
61724
61920
|
function _isPlainObject11(v) {
|
|
61725
61921
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
61726
61922
|
}
|
|
61727
61923
|
function _read_json2(p) {
|
|
61728
|
-
if (!
|
|
61924
|
+
if (!fs126.existsSync(p)) {
|
|
61729
61925
|
return null;
|
|
61730
61926
|
}
|
|
61731
61927
|
let raw;
|
|
61732
61928
|
try {
|
|
61733
|
-
raw =
|
|
61929
|
+
raw = fs126.readFileSync(p, "utf-8");
|
|
61734
61930
|
} catch {
|
|
61735
61931
|
return null;
|
|
61736
61932
|
}
|
|
@@ -61752,7 +61948,7 @@ function _name_from(composer, pkg, root) {
|
|
|
61752
61948
|
}
|
|
61753
61949
|
}
|
|
61754
61950
|
try {
|
|
61755
|
-
const base =
|
|
61951
|
+
const base = path120.basename(root);
|
|
61756
61952
|
return base || null;
|
|
61757
61953
|
} catch {
|
|
61758
61954
|
return null;
|
|
@@ -61821,12 +62017,12 @@ function _splitlines12(text) {
|
|
|
61821
62017
|
return parts;
|
|
61822
62018
|
}
|
|
61823
62019
|
function _purpose_from_readme(p) {
|
|
61824
|
-
if (!
|
|
62020
|
+
if (!fs126.existsSync(p)) {
|
|
61825
62021
|
return null;
|
|
61826
62022
|
}
|
|
61827
62023
|
let text;
|
|
61828
62024
|
try {
|
|
61829
|
-
text =
|
|
62025
|
+
text = fs126.readFileSync(p, "utf-8");
|
|
61830
62026
|
} catch {
|
|
61831
62027
|
return null;
|
|
61832
62028
|
}
|
|
@@ -61910,13 +62106,13 @@ function _rfind(haystack, needle) {
|
|
|
61910
62106
|
return -1;
|
|
61911
62107
|
}
|
|
61912
62108
|
function detect_project_context(root) {
|
|
61913
|
-
const resolvedRoot =
|
|
61914
|
-
const composer = _read_json2(
|
|
61915
|
-
const pkg = _read_json2(
|
|
62109
|
+
const resolvedRoot = path120.resolve(root ?? process.cwd());
|
|
62110
|
+
const composer = _read_json2(path120.join(resolvedRoot, "composer.json"));
|
|
62111
|
+
const pkg = _read_json2(path120.join(resolvedRoot, "package.json"));
|
|
61916
62112
|
return new ProjectContext(
|
|
61917
62113
|
_name_from(composer, pkg, resolvedRoot),
|
|
61918
62114
|
_stack_from(composer, pkg),
|
|
61919
|
-
_purpose_from_readme(
|
|
62115
|
+
_purpose_from_readme(path120.join(resolvedRoot, "README.md"))
|
|
61920
62116
|
);
|
|
61921
62117
|
}
|
|
61922
62118
|
var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
|
|
@@ -62186,8 +62382,8 @@ __export(shadow_dispatch_exports, {
|
|
|
62186
62382
|
slo_banner: () => slo_banner,
|
|
62187
62383
|
slo_status: () => slo_status
|
|
62188
62384
|
});
|
|
62189
|
-
import * as
|
|
62190
|
-
import { createHash as
|
|
62385
|
+
import * as fs127 from "node:fs";
|
|
62386
|
+
import { createHash as createHash21 } from "node:crypto";
|
|
62191
62387
|
function should_shadow(sampleRate, opts = {}) {
|
|
62192
62388
|
const rate = Math.max(0, Math.min(1, sampleRate));
|
|
62193
62389
|
const rng = opts.rng ?? null;
|
|
@@ -62196,7 +62392,7 @@ function should_shadow(sampleRate, opts = {}) {
|
|
|
62196
62392
|
}
|
|
62197
62393
|
function _hashQuery(query2) {
|
|
62198
62394
|
const redacted = redact(query2);
|
|
62199
|
-
return
|
|
62395
|
+
return createHash21("sha256").update(Buffer.from(redacted, "utf-8")).digest("hex").slice(0, 16);
|
|
62200
62396
|
}
|
|
62201
62397
|
function _privacyDropped(redacted) {
|
|
62202
62398
|
const stripped = _strip8(redacted);
|
|
@@ -62224,7 +62420,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
62224
62420
|
escalated,
|
|
62225
62421
|
escalation_reason: escalationReason
|
|
62226
62422
|
};
|
|
62227
|
-
|
|
62423
|
+
fs127.mkdirSync(_dirname2(logPath), { recursive: true });
|
|
62228
62424
|
const row = _pyJsonDumps2({
|
|
62229
62425
|
timestamp: decision.timestamp,
|
|
62230
62426
|
query_hash: decision.query_hash,
|
|
@@ -62234,7 +62430,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
62234
62430
|
escalated: decision.escalated,
|
|
62235
62431
|
escalation_reason: decision.escalation_reason
|
|
62236
62432
|
}) + "\n";
|
|
62237
|
-
|
|
62433
|
+
fs127.appendFileSync(logPath, row, { encoding: "utf-8" });
|
|
62238
62434
|
return decision;
|
|
62239
62435
|
}
|
|
62240
62436
|
function _isoNowSeconds() {
|
|
@@ -62243,10 +62439,10 @@ function _isoNowSeconds() {
|
|
|
62243
62439
|
return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}+00:00`;
|
|
62244
62440
|
}
|
|
62245
62441
|
function* _iterLog(logPath) {
|
|
62246
|
-
if (!
|
|
62442
|
+
if (!fs127.existsSync(logPath)) {
|
|
62247
62443
|
return;
|
|
62248
62444
|
}
|
|
62249
|
-
const content =
|
|
62445
|
+
const content = fs127.readFileSync(logPath, { encoding: "utf-8" });
|
|
62250
62446
|
for (const rawLine of _splitlines13(content)) {
|
|
62251
62447
|
const line = _strip8(rawLine);
|
|
62252
62448
|
if (!line) {
|
|
@@ -63173,8 +63369,8 @@ __export(council_cli_exports, {
|
|
|
63173
63369
|
load_settings: () => load_settings,
|
|
63174
63370
|
main: () => main45
|
|
63175
63371
|
});
|
|
63176
|
-
import * as
|
|
63177
|
-
import * as
|
|
63372
|
+
import * as fs128 from "node:fs";
|
|
63373
|
+
import * as path121 from "node:path";
|
|
63178
63374
|
import { fileURLToPath as fileURLToPath58, pathToFileURL as pathToFileURL42 } from "node:url";
|
|
63179
63375
|
function _pyFixed6(x, ndigits) {
|
|
63180
63376
|
if (!Number.isFinite(x)) {
|
|
@@ -63383,7 +63579,7 @@ function _stderr2(s) {
|
|
|
63383
63579
|
function load_settings(p = SETTINGS_FILE3, opts = {}) {
|
|
63384
63580
|
const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
|
|
63385
63581
|
const settings = load_agent_settings({ project_path: p });
|
|
63386
|
-
if (
|
|
63582
|
+
if (fs128.existsSync(ai_council_path)) {
|
|
63387
63583
|
const cfg = load_council_config(ai_council_path);
|
|
63388
63584
|
settings["ai_council"] = synthesizeAiCouncilBlock(cfg);
|
|
63389
63585
|
}
|
|
@@ -63749,7 +63945,7 @@ function build_question(opts) {
|
|
|
63749
63945
|
let ctx;
|
|
63750
63946
|
let artefact;
|
|
63751
63947
|
if (input_mode === "prompt") {
|
|
63752
|
-
const text =
|
|
63948
|
+
const text = fs128.readFileSync(input_path, "utf-8");
|
|
63753
63949
|
ctx = bundle_prompt(text);
|
|
63754
63950
|
artefact = String(input_path);
|
|
63755
63951
|
} else if (input_mode === "roadmap") {
|
|
@@ -63893,9 +64089,9 @@ function _maybe_write_decision_replay(opts) {
|
|
|
63893
64089
|
include_member_arguments: include_args
|
|
63894
64090
|
})
|
|
63895
64091
|
);
|
|
63896
|
-
const target =
|
|
63897
|
-
|
|
63898
|
-
|
|
64092
|
+
const target = path121.join(path121.dirname(opts.out_path), "decision-replay.md");
|
|
64093
|
+
fs128.mkdirSync(path121.dirname(target), { recursive: true });
|
|
64094
|
+
fs128.writeFileSync(target, replay, { encoding: "utf-8" });
|
|
63899
64095
|
return target;
|
|
63900
64096
|
}
|
|
63901
64097
|
function _peer_review_active(ai_cfg, args) {
|
|
@@ -64568,7 +64764,7 @@ function cmd_status(args, opts = {}) {
|
|
|
64568
64764
|
const env = opts.env ?? process.env;
|
|
64569
64765
|
const override = env[COUNCIL_CONFIG_ENV];
|
|
64570
64766
|
const path_ = resolve_config_path(REPO_ROOT13, { env });
|
|
64571
|
-
const exists3 =
|
|
64767
|
+
const exists3 = fs128.existsSync(String(path_));
|
|
64572
64768
|
const provenance = override ? `${COUNCIL_CONFIG_ENV} override` : "user-global";
|
|
64573
64769
|
let cfg = null;
|
|
64574
64770
|
let parse_error = null;
|
|
@@ -65039,8 +65235,8 @@ function cmd_run(args, opts = {}) {
|
|
|
65039
65235
|
kind: "responses",
|
|
65040
65236
|
subcommand: "run"
|
|
65041
65237
|
});
|
|
65042
|
-
|
|
65043
|
-
|
|
65238
|
+
fs128.mkdirSync(path121.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
65239
|
+
fs128.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent2(payload) + "\n", { encoding: "utf-8" });
|
|
65044
65240
|
const _all_subscription = allSeatsNonBillable(all_responses);
|
|
65045
65241
|
_stdout2(
|
|
65046
65242
|
`
|
|
@@ -65066,7 +65262,7 @@ function _debate_round_filename(round_number) {
|
|
|
65066
65262
|
return `debate-round-${round_number}.json`;
|
|
65067
65263
|
}
|
|
65068
65264
|
function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
65069
|
-
|
|
65265
|
+
fs128.mkdirSync(_resolveTarget(out_dir), { recursive: true });
|
|
65070
65266
|
const actual_total = sumBillableCost(responses, opts.table);
|
|
65071
65267
|
const payload = {
|
|
65072
65268
|
schema_version: SCHEMA_VERSION9,
|
|
@@ -65083,15 +65279,15 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
|
65083
65279
|
prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
|
|
65084
65280
|
responses: serializeResponses(responses)
|
|
65085
65281
|
};
|
|
65086
|
-
const out_path =
|
|
65087
|
-
|
|
65282
|
+
const out_path = path121.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
|
|
65283
|
+
fs128.writeFileSync(out_path, _jsonDumpsIndent2(payload) + "\n", { encoding: "utf-8" });
|
|
65088
65284
|
return out_path;
|
|
65089
65285
|
}
|
|
65090
65286
|
function _load_debate_seed(p, expected_members) {
|
|
65091
|
-
if (!
|
|
65287
|
+
if (!fs128.existsSync(p)) {
|
|
65092
65288
|
throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
|
|
65093
65289
|
}
|
|
65094
|
-
const payload = JSON.parse(
|
|
65290
|
+
const payload = JSON.parse(fs128.readFileSync(p, "utf-8"));
|
|
65095
65291
|
const source_members = (payload["members"] || []).slice();
|
|
65096
65292
|
const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
|
|
65097
65293
|
if (!_listEq(source_members, expected_labels)) {
|
|
@@ -65137,7 +65333,7 @@ function _readStdinLine() {
|
|
|
65137
65333
|
try {
|
|
65138
65334
|
const buf = Buffer.alloc(4096);
|
|
65139
65335
|
const fd = 0;
|
|
65140
|
-
const n =
|
|
65336
|
+
const n = fs128.readSync(fd, buf, 0, buf.length, null);
|
|
65141
65337
|
return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
|
|
65142
65338
|
} catch {
|
|
65143
65339
|
return "";
|
|
@@ -65368,7 +65564,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
|
|
|
65368
65564
|
return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
|
|
65369
65565
|
}
|
|
65370
65566
|
function cmd_render(args) {
|
|
65371
|
-
const payload = JSON.parse(
|
|
65567
|
+
const payload = JSON.parse(fs128.readFileSync(args.responses, "utf-8"));
|
|
65372
65568
|
const items = payload["responses"] || [];
|
|
65373
65569
|
const explicit = _getattr3(args, "prompt_mode", null);
|
|
65374
65570
|
const mode = explicit || payload["prompt_mode"] || payload["mode"];
|
|
@@ -65397,8 +65593,8 @@ function cmd_render(args) {
|
|
|
65397
65593
|
kind: "sessions",
|
|
65398
65594
|
subcommand: "render"
|
|
65399
65595
|
});
|
|
65400
|
-
|
|
65401
|
-
|
|
65596
|
+
fs128.mkdirSync(path121.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
65597
|
+
fs128.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
|
|
65402
65598
|
_stdout2(`council:render \xB7 wrote ${out_path}
|
|
65403
65599
|
`);
|
|
65404
65600
|
return 0;
|
|
@@ -65409,15 +65605,15 @@ function cmd_render(args) {
|
|
|
65409
65605
|
function _cmd_replay_low_impact_stats(args) {
|
|
65410
65606
|
const li = low_impact_exports;
|
|
65411
65607
|
const responses_path = args.responses;
|
|
65412
|
-
const log_path =
|
|
65413
|
-
if (!
|
|
65608
|
+
const log_path = path121.join(path121.dirname(responses_path), "low-impact-resolutions.md");
|
|
65609
|
+
if (!fs128.existsSync(log_path)) {
|
|
65414
65610
|
_stdout2(
|
|
65415
65611
|
`council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
|
|
65416
65612
|
`
|
|
65417
65613
|
);
|
|
65418
65614
|
return 0;
|
|
65419
65615
|
}
|
|
65420
|
-
const body =
|
|
65616
|
+
const body = fs128.readFileSync(log_path, "utf-8");
|
|
65421
65617
|
const stats = li.parse_low_impact_log(body);
|
|
65422
65618
|
const out = li.render_low_impact_stats(stats);
|
|
65423
65619
|
if (_getattr3(args, "output", null)) {
|
|
@@ -65425,8 +65621,8 @@ function _cmd_replay_low_impact_stats(args) {
|
|
|
65425
65621
|
kind: "sessions",
|
|
65426
65622
|
subcommand: "replay"
|
|
65427
65623
|
});
|
|
65428
|
-
|
|
65429
|
-
|
|
65624
|
+
fs128.mkdirSync(path121.dirname(_resolveTarget(target)), { recursive: true });
|
|
65625
|
+
fs128.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
|
|
65430
65626
|
_stdout2(`council:replay \xB7 wrote ${target}
|
|
65431
65627
|
`);
|
|
65432
65628
|
return 0;
|
|
@@ -65438,7 +65634,7 @@ function cmd_replay(args) {
|
|
|
65438
65634
|
if (_getattr3(args, "low_impact_stats", false)) {
|
|
65439
65635
|
return _cmd_replay_low_impact_stats(args);
|
|
65440
65636
|
}
|
|
65441
|
-
const payload = JSON.parse(
|
|
65637
|
+
const payload = JSON.parse(fs128.readFileSync(args.responses, "utf-8"));
|
|
65442
65638
|
const consensus = _deserialise_consensus(payload["consensus"]);
|
|
65443
65639
|
if (consensus === null) {
|
|
65444
65640
|
_stderr2(
|
|
@@ -65463,8 +65659,8 @@ function cmd_replay(args) {
|
|
|
65463
65659
|
kind: "sessions",
|
|
65464
65660
|
subcommand: "replay"
|
|
65465
65661
|
});
|
|
65466
|
-
|
|
65467
|
-
|
|
65662
|
+
fs128.mkdirSync(path121.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
65663
|
+
fs128.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
|
|
65468
65664
|
_stdout2(`council:replay \xB7 wrote ${out_path}
|
|
65469
65665
|
`);
|
|
65470
65666
|
} else {
|
|
@@ -65521,8 +65717,8 @@ function cmd_quota(args, opts = {}) {
|
|
|
65521
65717
|
}
|
|
65522
65718
|
function _validate_council_output_path(path_str, opts) {
|
|
65523
65719
|
const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
|
|
65524
|
-
const expected_abs = _resolveReal2(
|
|
65525
|
-
const target =
|
|
65720
|
+
const expected_abs = _resolveReal2(path121.join(REPO_ROOT13, expected_rel));
|
|
65721
|
+
const target = path121.isAbsolute(path_str) ? path_str : path121.join(REPO_ROOT13, path_str);
|
|
65526
65722
|
const target_resolved = _resolveReal2(target);
|
|
65527
65723
|
if (!_isRelativeTo(target_resolved, expected_abs)) {
|
|
65528
65724
|
throw new ArgumentTypeError(
|
|
@@ -65532,12 +65728,12 @@ function _validate_council_output_path(path_str, opts) {
|
|
|
65532
65728
|
return path_str;
|
|
65533
65729
|
}
|
|
65534
65730
|
function _resolveTarget(path_str) {
|
|
65535
|
-
return
|
|
65731
|
+
return path121.isAbsolute(path_str) ? path_str : path121.join(REPO_ROOT13, path_str);
|
|
65536
65732
|
}
|
|
65537
65733
|
function _resolveReal2(p) {
|
|
65538
|
-
const abs =
|
|
65734
|
+
const abs = path121.resolve(p);
|
|
65539
65735
|
try {
|
|
65540
|
-
return
|
|
65736
|
+
return fs128.realpathSync(abs);
|
|
65541
65737
|
} catch {
|
|
65542
65738
|
return abs;
|
|
65543
65739
|
}
|
|
@@ -65546,8 +65742,8 @@ function _isRelativeTo(target, base) {
|
|
|
65546
65742
|
if (target === base) {
|
|
65547
65743
|
return true;
|
|
65548
65744
|
}
|
|
65549
|
-
const
|
|
65550
|
-
return
|
|
65745
|
+
const rel2 = path121.relative(base, target);
|
|
65746
|
+
return rel2 !== "" && !rel2.startsWith("..") && !path121.isAbsolute(rel2);
|
|
65551
65747
|
}
|
|
65552
65748
|
function _topError(message) {
|
|
65553
65749
|
_stderr2(_TOP_USAGE2);
|
|
@@ -65920,13 +66116,13 @@ function _isCliEntry36() {
|
|
|
65920
66116
|
if (process.argv[1] === void 0) {
|
|
65921
66117
|
return false;
|
|
65922
66118
|
}
|
|
65923
|
-
const argvUrl = pathToFileURL42(
|
|
66119
|
+
const argvUrl = pathToFileURL42(path121.resolve(process.argv[1])).href;
|
|
65924
66120
|
if (import.meta.url === argvUrl) {
|
|
65925
66121
|
return true;
|
|
65926
66122
|
}
|
|
65927
66123
|
try {
|
|
65928
|
-
const here =
|
|
65929
|
-
const argv =
|
|
66124
|
+
const here = fs128.realpathSync(fileURLToPath58(import.meta.url));
|
|
66125
|
+
const argv = fs128.realpathSync(path121.resolve(process.argv[1]));
|
|
65930
66126
|
return here === argv;
|
|
65931
66127
|
} catch {
|
|
65932
66128
|
return false;
|
|
@@ -65998,7 +66194,7 @@ var init_council_cli = __esm({
|
|
|
65998
66194
|
"xai",
|
|
65999
66195
|
"perplexity"
|
|
66000
66196
|
]);
|
|
66001
|
-
_HERE30 =
|
|
66197
|
+
_HERE30 = path121.dirname(fileURLToPath58(import.meta.url));
|
|
66002
66198
|
[REPO_ROOT13] = resolve_project_root(null);
|
|
66003
66199
|
SETTINGS_FILE3 = project_settings_path(REPO_ROOT13);
|
|
66004
66200
|
AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT13);
|
|
@@ -66106,7 +66302,7 @@ var init_safety_envelope = __esm({
|
|
|
66106
66302
|
});
|
|
66107
66303
|
|
|
66108
66304
|
// src/scripts/mcp_server/__main__.ts
|
|
66109
|
-
import * as
|
|
66305
|
+
import * as path123 from "node:path";
|
|
66110
66306
|
import { fileURLToPath as fileURLToPath60 } from "node:url";
|
|
66111
66307
|
|
|
66112
66308
|
// src/scripts/mcp_server/index.ts
|
|
@@ -66154,8 +66350,8 @@ init_prompts();
|
|
|
66154
66350
|
init_resources();
|
|
66155
66351
|
|
|
66156
66352
|
// src/scripts/mcp_server/tools.ts
|
|
66157
|
-
import * as
|
|
66158
|
-
import * as
|
|
66353
|
+
import * as fs129 from "node:fs";
|
|
66354
|
+
import * as path122 from "node:path";
|
|
66159
66355
|
import { fileURLToPath as fileURLToPath59 } from "node:url";
|
|
66160
66356
|
|
|
66161
66357
|
// src/scripts/chat_history.ts
|
|
@@ -69136,8 +69332,8 @@ function idDirname(id) {
|
|
|
69136
69332
|
const i = id.lastIndexOf("/");
|
|
69137
69333
|
return i === -1 ? "" : id.slice(0, i);
|
|
69138
69334
|
}
|
|
69139
|
-
function idJoin(dir,
|
|
69140
|
-
const parts = (dir === "" ? [] : dir.split("/")).concat(
|
|
69335
|
+
function idJoin(dir, rel2) {
|
|
69336
|
+
const parts = (dir === "" ? [] : dir.split("/")).concat(rel2.split("/"));
|
|
69141
69337
|
const out = [];
|
|
69142
69338
|
for (const p of parts) {
|
|
69143
69339
|
if (p === "" || p === ".") continue;
|
|
@@ -69326,8 +69522,8 @@ function buildGraph(files, extracts, resolution = EMPTY_RESOLUTION_CONFIG) {
|
|
|
69326
69522
|
}
|
|
69327
69523
|
function resolveRawEdge(r, ex) {
|
|
69328
69524
|
if (r.relation === "member") {
|
|
69329
|
-
const
|
|
69330
|
-
const target = `${r.sourceId}${
|
|
69525
|
+
const sep26 = r.sourceId.includes("#") ? "::" : "#";
|
|
69526
|
+
const target = `${r.sourceId}${sep26}${r.targetName}`;
|
|
69331
69527
|
emit2({
|
|
69332
69528
|
source: r.sourceId,
|
|
69333
69529
|
target: nodeIds.has(target) ? target : `symbol:${r.targetName}`,
|
|
@@ -69555,14 +69751,14 @@ async function buildFromRepo(root, cachePath, opts = {}) {
|
|
|
69555
69751
|
const fullPaths = discoverFiles(abs);
|
|
69556
69752
|
const files = [];
|
|
69557
69753
|
for (const full of fullPaths) {
|
|
69558
|
-
const
|
|
69754
|
+
const rel2 = toPosixRel(abs, full);
|
|
69559
69755
|
let source;
|
|
69560
69756
|
try {
|
|
69561
69757
|
source = fs24.readFileSync(full, "utf-8");
|
|
69562
69758
|
} catch {
|
|
69563
69759
|
continue;
|
|
69564
69760
|
}
|
|
69565
|
-
files.push({ path:
|
|
69761
|
+
files.push({ path: rel2, source });
|
|
69566
69762
|
}
|
|
69567
69763
|
const prior = opts.update && cachePath ? readSidecar(sidecarPath(cachePath)) : null;
|
|
69568
69764
|
const priorFiles = prior?.files ?? {};
|
|
@@ -69686,7 +69882,7 @@ function cmdValidate(argv) {
|
|
|
69686
69882
|
return 1;
|
|
69687
69883
|
}
|
|
69688
69884
|
const twinState = twinChecksumState(p, parsed.source_checksum);
|
|
69689
|
-
const
|
|
69885
|
+
const rel2 = path25.relative(REPO_ROOT, p);
|
|
69690
69886
|
if (twinState.kind === "mismatch") {
|
|
69691
69887
|
process7.stderr.write(
|
|
69692
69888
|
`\u274C SQLite twin disagrees with the canonical JSON: twin ${twinState.twin} \u2260 json ${twinState.json}
|
|
@@ -69696,7 +69892,7 @@ function cmdValidate(argv) {
|
|
|
69696
69892
|
);
|
|
69697
69893
|
return 1;
|
|
69698
69894
|
}
|
|
69699
|
-
process7.stdout.write(`\u2705 graph schema valid: ${
|
|
69895
|
+
process7.stdout.write(`\u2705 graph schema valid: ${rel2} \xB7 twin: ${twinState.kind}
|
|
69700
69896
|
`);
|
|
69701
69897
|
return 0;
|
|
69702
69898
|
}
|
|
@@ -70352,8 +70548,8 @@ var GRAPH_TOOLS = {
|
|
|
70352
70548
|
const dir = str(args, "direction");
|
|
70353
70549
|
if (dir === "in" || dir === "out" || dir === "both") opts.direction = dir;
|
|
70354
70550
|
opts.depth = num(args, "depth", 1);
|
|
70355
|
-
const
|
|
70356
|
-
if (RELATIONS2.includes(
|
|
70551
|
+
const rel2 = str(args, "relation");
|
|
70552
|
+
if (RELATIONS2.includes(rel2)) opts.relation = rel2;
|
|
70357
70553
|
return withGraph(root, (g) => ({ staleness, ...node(g, id, opts) }));
|
|
70358
70554
|
}
|
|
70359
70555
|
},
|
|
@@ -70480,14 +70676,14 @@ function _resolveConsumerRoot(override) {
|
|
|
70480
70676
|
return resolvePath(process.cwd());
|
|
70481
70677
|
}
|
|
70482
70678
|
function _relativeUnder(target, root) {
|
|
70483
|
-
const
|
|
70484
|
-
if (
|
|
70679
|
+
const rel2 = path122.relative(root, target);
|
|
70680
|
+
if (rel2 === "") {
|
|
70485
70681
|
return "";
|
|
70486
70682
|
}
|
|
70487
|
-
if (
|
|
70683
|
+
if (rel2.startsWith("..") || path122.isAbsolute(rel2)) {
|
|
70488
70684
|
return null;
|
|
70489
70685
|
}
|
|
70490
|
-
return
|
|
70686
|
+
return rel2.split(path122.sep).join("/");
|
|
70491
70687
|
}
|
|
70492
70688
|
function _reprStrList(values) {
|
|
70493
70689
|
return `[${values.map((v) => `'${v}'`).join(", ")}]`;
|
|
@@ -70496,19 +70692,19 @@ function _validateInTreePath(raw, consumerRoot) {
|
|
|
70496
70692
|
const root = resolvePath(consumerRoot);
|
|
70497
70693
|
let target;
|
|
70498
70694
|
if (raw === null || raw === void 0 || raw === "") {
|
|
70499
|
-
target =
|
|
70500
|
-
} else if (
|
|
70695
|
+
target = path122.join(root, "agents", "runtime", ".agent-chat-history");
|
|
70696
|
+
} else if (path122.isAbsolute(raw)) {
|
|
70501
70697
|
target = resolvePath(raw);
|
|
70502
70698
|
} else {
|
|
70503
|
-
target = resolvePath(
|
|
70699
|
+
target = resolvePath(path122.join(root, raw));
|
|
70504
70700
|
}
|
|
70505
|
-
const
|
|
70506
|
-
if (
|
|
70701
|
+
const rel2 = _relativeUnder(target, root);
|
|
70702
|
+
if (rel2 === null) {
|
|
70507
70703
|
throw new Error(`path escapes consumer_root: ${target} not under ${root}`);
|
|
70508
70704
|
}
|
|
70509
|
-
if (!_ALLOWED_WRITE_REL_PATHS.has(
|
|
70705
|
+
if (!_ALLOWED_WRITE_REL_PATHS.has(rel2)) {
|
|
70510
70706
|
throw new Error(
|
|
70511
|
-
`path not in write allowlist: '${
|
|
70707
|
+
`path not in write allowlist: '${rel2}' (allowed: ${_reprStrList([..._ALLOWED_WRITE_REL_PATHS].sort())})`
|
|
70512
70708
|
);
|
|
70513
70709
|
}
|
|
70514
70710
|
return target;
|
|
@@ -70538,11 +70734,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
|
|
|
70538
70734
|
if (typeof raw !== "string") {
|
|
70539
70735
|
throw new Error("'paths' entries must be strings");
|
|
70540
70736
|
}
|
|
70541
|
-
const resolved =
|
|
70737
|
+
const resolved = path122.isAbsolute(raw) ? resolvePath(raw) : resolvePath(path122.join(root, raw));
|
|
70542
70738
|
if (_relativeUnder(resolved, root) === null) {
|
|
70543
70739
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
70544
70740
|
}
|
|
70545
|
-
if (
|
|
70741
|
+
if (fs129.existsSync(resolved)) {
|
|
70546
70742
|
paths.push(resolved);
|
|
70547
70743
|
}
|
|
70548
70744
|
}
|
|
@@ -70579,7 +70775,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
70579
70775
|
if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
|
|
70580
70776
|
throw new Error("'min_schema_version' must be an integer");
|
|
70581
70777
|
}
|
|
70582
|
-
const existingHeader =
|
|
70778
|
+
const existingHeader = fs129.existsSync(target) ? _chReadHeader(target) : null;
|
|
70583
70779
|
const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
|
|
70584
70780
|
if (observed < minSchema) {
|
|
70585
70781
|
throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
|
|
@@ -70594,8 +70790,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
70594
70790
|
session: session === void 0 ? null : session
|
|
70595
70791
|
};
|
|
70596
70792
|
}
|
|
70597
|
-
if (!
|
|
70598
|
-
|
|
70793
|
+
if (!fs129.existsSync(target) || _chReadHeader(target) === null) {
|
|
70794
|
+
fs129.mkdirSync(path122.dirname(target), { recursive: true });
|
|
70599
70795
|
_chInit(target);
|
|
70600
70796
|
}
|
|
70601
70797
|
_chAppend(entry, target, session ?? null);
|
|
@@ -70639,7 +70835,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
|
|
|
70639
70835
|
if (detail !== "full" && detail !== "index") {
|
|
70640
70836
|
throw new Error("'detail' must be 'index' or 'full'");
|
|
70641
70837
|
}
|
|
70642
|
-
if (!
|
|
70838
|
+
if (!fs129.existsSync(target)) {
|
|
70643
70839
|
return { path: target, entries: [], count: 0 };
|
|
70644
70840
|
}
|
|
70645
70841
|
if (around !== void 0 && around !== null) {
|
|
@@ -70741,8 +70937,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
|
|
|
70741
70937
|
}
|
|
70742
70938
|
return result;
|
|
70743
70939
|
}
|
|
70744
|
-
var _PACKAGE_ROOT3 =
|
|
70745
|
-
|
|
70940
|
+
var _PACKAGE_ROOT3 = path122.resolve(
|
|
70941
|
+
path122.dirname(fileURLToPath59(import.meta.url)),
|
|
70746
70942
|
"..",
|
|
70747
70943
|
"..",
|
|
70748
70944
|
".."
|
|
@@ -70786,10 +70982,10 @@ async function _memorySignalHandler(args, consumerRoot) {
|
|
|
70786
70982
|
async function _roadmapProgressHandler(args, consumerRoot) {
|
|
70787
70983
|
const dryRun = _pyTruthy6(args.dry_run ?? false);
|
|
70788
70984
|
const root = resolvePath(consumerRoot);
|
|
70789
|
-
const roadmapRoot =
|
|
70790
|
-
const target =
|
|
70985
|
+
const roadmapRoot = path122.join(root, "agents", "roadmaps");
|
|
70986
|
+
const target = path122.join(root, "agents", "roadmaps-progress.md");
|
|
70791
70987
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
70792
|
-
if (!
|
|
70988
|
+
if (!fs129.existsSync(roadmapRoot)) {
|
|
70793
70989
|
return {
|
|
70794
70990
|
written: false,
|
|
70795
70991
|
path: target,
|
|
@@ -70804,7 +71000,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
|
|
|
70804
71000
|
const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
|
|
70805
71001
|
const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
|
|
70806
71002
|
if (!dryRun) {
|
|
70807
|
-
|
|
71003
|
+
fs129.writeFileSync(target, content, "utf-8");
|
|
70808
71004
|
}
|
|
70809
71005
|
return {
|
|
70810
71006
|
written: !dryRun,
|
|
@@ -70825,11 +71021,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
70825
71021
|
let dashboardRegenerated = false;
|
|
70826
71022
|
if (archived.length > 0) {
|
|
70827
71023
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
70828
|
-
const roadmapRoot =
|
|
70829
|
-
if (
|
|
71024
|
+
const roadmapRoot = path122.join(root, "agents", "roadmaps");
|
|
71025
|
+
if (fs129.existsSync(roadmapRoot)) {
|
|
70830
71026
|
const roadmaps = urp.collect(roadmapRoot);
|
|
70831
|
-
|
|
70832
|
-
|
|
71027
|
+
fs129.writeFileSync(
|
|
71028
|
+
path122.join(root, "agents", "roadmaps-progress.md"),
|
|
70833
71029
|
urp.render(roadmaps, urp.collect_bundles(root), roadmapRoot),
|
|
70834
71030
|
"utf-8"
|
|
70835
71031
|
);
|
|
@@ -70845,9 +71041,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
70845
71041
|
async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
70846
71042
|
const check = _pyTruthy6(args.check ?? false);
|
|
70847
71043
|
const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
|
|
70848
|
-
const out =
|
|
71044
|
+
const out = path122.join(_PACKAGE_ROOT3, "CAPABILITIES.yaml");
|
|
70849
71045
|
const content = cap.build();
|
|
70850
|
-
const onDisk =
|
|
71046
|
+
const onDisk = fs129.existsSync(out) ? fs129.readFileSync(out, "utf-8") : "";
|
|
70851
71047
|
const drift = onDisk !== content;
|
|
70852
71048
|
if (check) {
|
|
70853
71049
|
return { check: true, written: false, drift, path: out };
|
|
@@ -70858,7 +71054,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
|
70858
71054
|
`CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
|
|
70859
71055
|
);
|
|
70860
71056
|
}
|
|
70861
|
-
|
|
71057
|
+
fs129.writeFileSync(out, content, "utf-8");
|
|
70862
71058
|
return { check: false, written: true, drift, path: out };
|
|
70863
71059
|
}
|
|
70864
71060
|
async function _runDoctorLeg(consumerRoot) {
|
|
@@ -70958,11 +71154,11 @@ async function _councilEstimateHandler(args, consumerRoot) {
|
|
|
70958
71154
|
throw new Error("'depth' must be 'shallow' or 'deep' when provided");
|
|
70959
71155
|
}
|
|
70960
71156
|
const root = resolvePath(consumerRoot);
|
|
70961
|
-
const target =
|
|
71157
|
+
const target = path122.isAbsolute(inputRaw) ? resolvePath(inputRaw) : resolvePath(path122.join(root, inputRaw));
|
|
70962
71158
|
if (_relativeUnder(target, root) === null) {
|
|
70963
71159
|
throw new Error(`path escapes consumer_root: ${target}`);
|
|
70964
71160
|
}
|
|
70965
|
-
if (!
|
|
71161
|
+
if (!fs129.existsSync(target)) {
|
|
70966
71162
|
throw new Error(`input_path not found: ${target}`);
|
|
70967
71163
|
}
|
|
70968
71164
|
const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
|
|
@@ -71024,18 +71220,18 @@ async function _runTestsHandler(args, consumerRoot) {
|
|
|
71024
71220
|
if (typeof relPathRaw !== "string" || !strip(relPathRaw)) {
|
|
71025
71221
|
throw new Error("'path' must be a non-empty string when provided");
|
|
71026
71222
|
}
|
|
71027
|
-
const resolved =
|
|
71028
|
-
const
|
|
71029
|
-
if (
|
|
71223
|
+
const resolved = path122.isAbsolute(relPathRaw) ? resolvePath(relPathRaw) : resolvePath(path122.join(root, relPathRaw));
|
|
71224
|
+
const rel2 = _relativeUnder(resolved, root);
|
|
71225
|
+
if (rel2 === null) {
|
|
71030
71226
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
71031
71227
|
}
|
|
71032
|
-
if (!
|
|
71228
|
+
if (!fs129.existsSync(resolved)) {
|
|
71033
71229
|
throw new Error(`path not found: ${resolved}`);
|
|
71034
71230
|
}
|
|
71035
|
-
relArg =
|
|
71231
|
+
relArg = rel2;
|
|
71036
71232
|
}
|
|
71037
|
-
const vitestEntry =
|
|
71038
|
-
if (!
|
|
71233
|
+
const vitestEntry = path122.join(root, "node_modules", "vitest", "vitest.mjs");
|
|
71234
|
+
if (!fs129.existsSync(vitestEntry)) {
|
|
71039
71235
|
throw new Error(
|
|
71040
71236
|
"run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
|
|
71041
71237
|
);
|
|
@@ -71665,8 +71861,8 @@ function _strCmp3(a, b) {
|
|
|
71665
71861
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
71666
71862
|
}
|
|
71667
71863
|
function _pathlibCompare4(a, b) {
|
|
71668
|
-
const pa = a.split(
|
|
71669
|
-
const pb = b.split(
|
|
71864
|
+
const pa = a.split(path122.sep);
|
|
71865
|
+
const pb = b.split(path122.sep);
|
|
71670
71866
|
const n = Math.min(pa.length, pb.length);
|
|
71671
71867
|
for (let i = 0; i < n; i++) {
|
|
71672
71868
|
const c = _strCmp3(pa[i], pb[i]);
|
|
@@ -71891,7 +72087,7 @@ function main46() {
|
|
|
71891
72087
|
|
|
71892
72088
|
// src/scripts/mcp_server/__main__.ts
|
|
71893
72089
|
var _selfPath = fileURLToPath60(import.meta.url);
|
|
71894
|
-
var _invokedDirectly3 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 &&
|
|
72090
|
+
var _invokedDirectly3 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path123.resolve(process.argv[1]) === path123.resolve(_selfPath);
|
|
71895
72091
|
if (_invokedDirectly3) {
|
|
71896
72092
|
main46();
|
|
71897
72093
|
}
|