@event4u/agent-config 17.0.0 → 17.1.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 +104 -485
- package/README.md +2 -1
- package/dist/agent-src/contexts/execution/host-capability-manifest.md +5 -3
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/agent-src/templates/roadmaps.md +5 -1
- package/dist/cli-delegate/{chunk-IROAQ77A.js → chunk-3PK3VZHB.js} +107 -9
- package/dist/cli-delegate/{chunk-2SFOOFJJ.js → chunk-BZJ4Y3CI.js} +1 -1
- package/dist/cli-delegate/{chunk-CAL76ADI.js → chunk-CMZEKSNN.js} +52 -10
- package/dist/cli-delegate/{chunk-ESUNQ5XR.js → chunk-E3CFULNX.js} +22 -4
- package/dist/cli-delegate/{chunk-GOMILC3O.js → chunk-QBHEI5N4.js} +4 -3
- package/dist/cli-delegate/{chunk-SIOMDAKL.js → chunk-VYZGJLCA.js} +29 -39
- package/dist/cli-delegate/chunk-W5JXMF2T.js +77 -0
- package/dist/cli-delegate/{chunk-4SHNERBL.js → chunk-XIAPY44N.js} +1 -1
- package/dist/cli-delegate/{chunk-JHMMWNJ2.js → chunk-YHAPONWV.js} +1 -1
- package/dist/cli-delegate/cmd_conformance.js +9 -8
- package/dist/cli-delegate/cmd_doctor.js +4 -4
- package/dist/cli-delegate/cmd_doctor_neighbours.js +2 -2
- package/dist/cli-delegate/cmd_explain.js +1 -1
- package/dist/cli-delegate/cmd_export.js +6 -6
- package/dist/cli-delegate/cmd_fleet.js +3 -3
- package/dist/cli-delegate/cmd_preflight.js +3 -3
- package/dist/cli-delegate/cmd_prune.js +6 -6
- package/dist/cli-delegate/cmd_settings_migrate.js +6 -6
- package/dist/cli-delegate/cmd_settings_set.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +6 -6
- package/dist/cli-delegate/cmd_uninstall.js +6 -6
- package/dist/cli-delegate/cmd_update.js +9 -13
- package/dist/cli-delegate/cmd_validate.js +6 -6
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +4 -4
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +98 -74
- package/dist/hooks/dispatch.sha256 +1 -1
- package/dist/install/claudeRuleRewrite.js +10 -3
- package/dist/install/conflict.js +24 -2
- package/dist/install/conflictTracker.js +14 -3
- package/dist/install/install.mjs +222 -117
- package/dist/install/installThinLayer.js +1 -0
- package/dist/install/loggedWrites.js +142 -0
- package/dist/install/paths.js +12 -2
- package/dist/install/preserve.js +25 -4
- package/dist/install/txlog.js +10 -6
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +845 -294
- package/dist/scripts/_lib/egress_rules.js +4 -1
- package/dist/scripts/_lib/identifier_redaction.js +35 -2
- package/dist/scripts/ai_council/seat_policy.js +7 -1
- package/dist/server/schemas/settings.js +1 -1
- package/package.json +1 -1
- package/src/config/ci-local-parity.yml +1 -1
- package/src/config/gate-coverage.yml +27 -7
- package/src/config/gate-violation-baselines.json +8 -2
- package/src/config/hook-bundle-budget.json +2 -2
- package/src/config/production-entries.json +18 -0
- package/src/config/release-gate-locality.yml +0 -7
- package/src/install/claudeRuleRewrite.ts +10 -1
- package/src/install/conflict.ts +24 -1
- package/src/install/conflictTracker.ts +18 -2
- package/src/install/installThinLayer.ts +6 -0
- package/src/install/loggedWrites.ts +148 -0
- package/src/install/paths.ts +11 -2
- package/src/install/preserve.ts +40 -4
- package/src/install/txlog.ts +10 -6
- package/src/scripts/_cli/cmd_conformance.ts +3 -2
- package/src/scripts/_cli/cmd_update.ts +15 -17
- package/src/scripts/_lib/council_settings_block.ts +9 -2
- package/src/scripts/_lib/egress_rules.ts +4 -1
- package/src/scripts/_lib/host_capability.ts +10 -5
- package/src/scripts/_lib/identifier_redaction.ts +38 -2
- package/src/scripts/_lib/price_freshness.ts +112 -0
- package/src/scripts/_lib/production_reach.ts +194 -0
- package/src/scripts/_lib/quota_parked.ts +17 -28
- package/src/scripts/_lib/release_findings_ingest.ts +13 -335
- package/src/scripts/_lib/tier_downshift_verdict.ts +81 -35
- package/src/scripts/ai_council/chairman.ts +5 -2
- package/src/scripts/ai_council/clients.ts +4 -3
- package/src/scripts/ai_council/free_hand_shadow.ts +24 -12
- package/src/scripts/ai_council/free_route_catalog.ts +142 -5
- package/src/scripts/ai_council/free_route_client.ts +4 -0
- package/src/scripts/ai_council/hand_payload.ts +115 -7
- package/src/scripts/ai_council/orchestrator.ts +7 -10
- package/src/scripts/ai_council/route_chooser.ts +1 -1
- package/src/scripts/ai_council/route_member.ts +66 -4
- package/src/scripts/ai_council/seat_policy.ts +8 -1
- package/src/scripts/ai_council/self_hosted_probe.ts +327 -0
- package/src/scripts/ai_council/status_surface.ts +2 -0
- package/src/scripts/ask_transport.ts +137 -15
- package/src/scripts/check_finding_dispositions.ts +25 -71
- package/src/scripts/check_release_pr_shape.ts +3 -3
- package/src/scripts/check_step_production_reach.ts +257 -0
- package/src/scripts/council_cli.ts +10 -8
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +3 -0
- package/src/scripts/hooks/dispatch_hook.ts +2 -2
- package/src/scripts/hooks/payload_stub.ts +27 -0
- package/src/scripts/hooks/spawn_guard_shadow_hook.ts +29 -70
- package/src/scripts/hooks/subagent_ledger_hook.ts +80 -0
- package/src/scripts/install.ts +2 -2
- package/src/scripts/lint_decision_classes.ts +34 -0
- package/src/scripts/lint_hook_manifest.ts +24 -0
- package/src/scripts/lint_roadmap_blockers.ts +52 -3
- package/src/scripts/release.ts +5 -9
- package/src/scripts/release_drill.ts +11 -165
- package/src/scripts/release_publication.ts +0 -9
- package/src/scripts/report_production_reach.ts +35 -0
- package/src/scripts/worker_reuse_shadow_report.ts +399 -1
- package/src/server/schemas/settings.ts +1 -1
- package/dist/cli-delegate/chunk-A4QJ6ENT.js +0 -50
- /package/dist/cli-delegate/{chunk-E6XNBVE4.js → chunk-KR5ZIFPO.js} +0 -0
package/dist/mcp/server.mjs
CHANGED
|
@@ -2115,17 +2115,17 @@ var require_visit = __commonJS({
|
|
|
2115
2115
|
visit.BREAK = BREAK;
|
|
2116
2116
|
visit.SKIP = SKIP;
|
|
2117
2117
|
visit.REMOVE = REMOVE;
|
|
2118
|
-
function visit_(key, node2, visitor,
|
|
2119
|
-
const ctrl = callVisitor(key, node2, visitor,
|
|
2118
|
+
function visit_(key, node2, visitor, path144) {
|
|
2119
|
+
const ctrl = callVisitor(key, node2, visitor, path144);
|
|
2120
2120
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2121
|
-
replaceNode(key,
|
|
2122
|
-
return visit_(key, ctrl, visitor,
|
|
2121
|
+
replaceNode(key, path144, ctrl);
|
|
2122
|
+
return visit_(key, ctrl, visitor, path144);
|
|
2123
2123
|
}
|
|
2124
2124
|
if (typeof ctrl !== "symbol") {
|
|
2125
2125
|
if (identity.isCollection(node2)) {
|
|
2126
|
-
|
|
2126
|
+
path144 = Object.freeze(path144.concat(node2));
|
|
2127
2127
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
2128
|
-
const ci = visit_(i, node2.items[i], visitor,
|
|
2128
|
+
const ci = visit_(i, node2.items[i], visitor, path144);
|
|
2129
2129
|
if (typeof ci === "number")
|
|
2130
2130
|
i = ci - 1;
|
|
2131
2131
|
else if (ci === BREAK)
|
|
@@ -2136,13 +2136,13 @@ var require_visit = __commonJS({
|
|
|
2136
2136
|
}
|
|
2137
2137
|
}
|
|
2138
2138
|
} else if (identity.isPair(node2)) {
|
|
2139
|
-
|
|
2140
|
-
const ck = visit_("key", node2.key, visitor,
|
|
2139
|
+
path144 = Object.freeze(path144.concat(node2));
|
|
2140
|
+
const ck = visit_("key", node2.key, visitor, path144);
|
|
2141
2141
|
if (ck === BREAK)
|
|
2142
2142
|
return BREAK;
|
|
2143
2143
|
else if (ck === REMOVE)
|
|
2144
2144
|
node2.key = null;
|
|
2145
|
-
const cv = visit_("value", node2.value, visitor,
|
|
2145
|
+
const cv = visit_("value", node2.value, visitor, path144);
|
|
2146
2146
|
if (cv === BREAK)
|
|
2147
2147
|
return BREAK;
|
|
2148
2148
|
else if (cv === REMOVE)
|
|
@@ -2163,17 +2163,17 @@ var require_visit = __commonJS({
|
|
|
2163
2163
|
visitAsync.BREAK = BREAK;
|
|
2164
2164
|
visitAsync.SKIP = SKIP;
|
|
2165
2165
|
visitAsync.REMOVE = REMOVE;
|
|
2166
|
-
async function visitAsync_(key, node2, visitor,
|
|
2167
|
-
const ctrl = await callVisitor(key, node2, visitor,
|
|
2166
|
+
async function visitAsync_(key, node2, visitor, path144) {
|
|
2167
|
+
const ctrl = await callVisitor(key, node2, visitor, path144);
|
|
2168
2168
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
2169
|
-
replaceNode(key,
|
|
2170
|
-
return visitAsync_(key, ctrl, visitor,
|
|
2169
|
+
replaceNode(key, path144, ctrl);
|
|
2170
|
+
return visitAsync_(key, ctrl, visitor, path144);
|
|
2171
2171
|
}
|
|
2172
2172
|
if (typeof ctrl !== "symbol") {
|
|
2173
2173
|
if (identity.isCollection(node2)) {
|
|
2174
|
-
|
|
2174
|
+
path144 = Object.freeze(path144.concat(node2));
|
|
2175
2175
|
for (let i = 0; i < node2.items.length; ++i) {
|
|
2176
|
-
const ci = await visitAsync_(i, node2.items[i], visitor,
|
|
2176
|
+
const ci = await visitAsync_(i, node2.items[i], visitor, path144);
|
|
2177
2177
|
if (typeof ci === "number")
|
|
2178
2178
|
i = ci - 1;
|
|
2179
2179
|
else if (ci === BREAK)
|
|
@@ -2184,13 +2184,13 @@ var require_visit = __commonJS({
|
|
|
2184
2184
|
}
|
|
2185
2185
|
}
|
|
2186
2186
|
} else if (identity.isPair(node2)) {
|
|
2187
|
-
|
|
2188
|
-
const ck = await visitAsync_("key", node2.key, visitor,
|
|
2187
|
+
path144 = Object.freeze(path144.concat(node2));
|
|
2188
|
+
const ck = await visitAsync_("key", node2.key, visitor, path144);
|
|
2189
2189
|
if (ck === BREAK)
|
|
2190
2190
|
return BREAK;
|
|
2191
2191
|
else if (ck === REMOVE)
|
|
2192
2192
|
node2.key = null;
|
|
2193
|
-
const cv = await visitAsync_("value", node2.value, visitor,
|
|
2193
|
+
const cv = await visitAsync_("value", node2.value, visitor, path144);
|
|
2194
2194
|
if (cv === BREAK)
|
|
2195
2195
|
return BREAK;
|
|
2196
2196
|
else if (cv === REMOVE)
|
|
@@ -2217,23 +2217,23 @@ var require_visit = __commonJS({
|
|
|
2217
2217
|
}
|
|
2218
2218
|
return visitor;
|
|
2219
2219
|
}
|
|
2220
|
-
function callVisitor(key, node2, visitor,
|
|
2220
|
+
function callVisitor(key, node2, visitor, path144) {
|
|
2221
2221
|
if (typeof visitor === "function")
|
|
2222
|
-
return visitor(key, node2,
|
|
2222
|
+
return visitor(key, node2, path144);
|
|
2223
2223
|
if (identity.isMap(node2))
|
|
2224
|
-
return visitor.Map?.(key, node2,
|
|
2224
|
+
return visitor.Map?.(key, node2, path144);
|
|
2225
2225
|
if (identity.isSeq(node2))
|
|
2226
|
-
return visitor.Seq?.(key, node2,
|
|
2226
|
+
return visitor.Seq?.(key, node2, path144);
|
|
2227
2227
|
if (identity.isPair(node2))
|
|
2228
|
-
return visitor.Pair?.(key, node2,
|
|
2228
|
+
return visitor.Pair?.(key, node2, path144);
|
|
2229
2229
|
if (identity.isScalar(node2))
|
|
2230
|
-
return visitor.Scalar?.(key, node2,
|
|
2230
|
+
return visitor.Scalar?.(key, node2, path144);
|
|
2231
2231
|
if (identity.isAlias(node2))
|
|
2232
|
-
return visitor.Alias?.(key, node2,
|
|
2232
|
+
return visitor.Alias?.(key, node2, path144);
|
|
2233
2233
|
return void 0;
|
|
2234
2234
|
}
|
|
2235
|
-
function replaceNode(key,
|
|
2236
|
-
const parent =
|
|
2235
|
+
function replaceNode(key, path144, node2) {
|
|
2236
|
+
const parent = path144[path144.length - 1];
|
|
2237
2237
|
if (identity.isCollection(parent)) {
|
|
2238
2238
|
parent.items[key] = node2;
|
|
2239
2239
|
} else if (identity.isPair(parent)) {
|
|
@@ -2843,10 +2843,10 @@ var require_Collection = __commonJS({
|
|
|
2843
2843
|
var createNode = require_createNode();
|
|
2844
2844
|
var identity = require_identity();
|
|
2845
2845
|
var Node = require_Node();
|
|
2846
|
-
function collectionFromPath(schema,
|
|
2846
|
+
function collectionFromPath(schema, path144, value) {
|
|
2847
2847
|
let v = value;
|
|
2848
|
-
for (let i =
|
|
2849
|
-
const k =
|
|
2848
|
+
for (let i = path144.length - 1; i >= 0; --i) {
|
|
2849
|
+
const k = path144[i];
|
|
2850
2850
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
2851
2851
|
const a = [];
|
|
2852
2852
|
a[k] = v;
|
|
@@ -2865,7 +2865,7 @@ var require_Collection = __commonJS({
|
|
|
2865
2865
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
2866
2866
|
});
|
|
2867
2867
|
}
|
|
2868
|
-
var isEmptyPath = (
|
|
2868
|
+
var isEmptyPath = (path144) => path144 == null || typeof path144 === "object" && !!path144[Symbol.iterator]().next().done;
|
|
2869
2869
|
var Collection = class extends Node.NodeBase {
|
|
2870
2870
|
constructor(type, schema) {
|
|
2871
2871
|
super(type);
|
|
@@ -2895,11 +2895,11 @@ var require_Collection = __commonJS({
|
|
|
2895
2895
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
2896
2896
|
* that already exists in the map.
|
|
2897
2897
|
*/
|
|
2898
|
-
addIn(
|
|
2899
|
-
if (isEmptyPath(
|
|
2898
|
+
addIn(path144, value) {
|
|
2899
|
+
if (isEmptyPath(path144))
|
|
2900
2900
|
this.add(value);
|
|
2901
2901
|
else {
|
|
2902
|
-
const [key, ...rest] =
|
|
2902
|
+
const [key, ...rest] = path144;
|
|
2903
2903
|
const node2 = this.get(key, true);
|
|
2904
2904
|
if (identity.isCollection(node2))
|
|
2905
2905
|
node2.addIn(rest, value);
|
|
@@ -2913,8 +2913,8 @@ var require_Collection = __commonJS({
|
|
|
2913
2913
|
* Removes a value from the collection.
|
|
2914
2914
|
* @returns `true` if the item was found and removed.
|
|
2915
2915
|
*/
|
|
2916
|
-
deleteIn(
|
|
2917
|
-
const [key, ...rest] =
|
|
2916
|
+
deleteIn(path144) {
|
|
2917
|
+
const [key, ...rest] = path144;
|
|
2918
2918
|
if (rest.length === 0)
|
|
2919
2919
|
return this.delete(key);
|
|
2920
2920
|
const node2 = this.get(key, true);
|
|
@@ -2928,8 +2928,8 @@ var require_Collection = __commonJS({
|
|
|
2928
2928
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
2929
2929
|
* `true` (collections are always returned intact).
|
|
2930
2930
|
*/
|
|
2931
|
-
getIn(
|
|
2932
|
-
const [key, ...rest] =
|
|
2931
|
+
getIn(path144, keepScalar) {
|
|
2932
|
+
const [key, ...rest] = path144;
|
|
2933
2933
|
const node2 = this.get(key, true);
|
|
2934
2934
|
if (rest.length === 0)
|
|
2935
2935
|
return !keepScalar && identity.isScalar(node2) ? node2.value : node2;
|
|
@@ -2947,8 +2947,8 @@ var require_Collection = __commonJS({
|
|
|
2947
2947
|
/**
|
|
2948
2948
|
* Checks if the collection includes a value with the key `key`.
|
|
2949
2949
|
*/
|
|
2950
|
-
hasIn(
|
|
2951
|
-
const [key, ...rest] =
|
|
2950
|
+
hasIn(path144) {
|
|
2951
|
+
const [key, ...rest] = path144;
|
|
2952
2952
|
if (rest.length === 0)
|
|
2953
2953
|
return this.has(key);
|
|
2954
2954
|
const node2 = this.get(key, true);
|
|
@@ -2958,8 +2958,8 @@ var require_Collection = __commonJS({
|
|
|
2958
2958
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
2959
2959
|
* boolean to add/remove the item from the set.
|
|
2960
2960
|
*/
|
|
2961
|
-
setIn(
|
|
2962
|
-
const [key, ...rest] =
|
|
2961
|
+
setIn(path144, value) {
|
|
2962
|
+
const [key, ...rest] = path144;
|
|
2963
2963
|
if (rest.length === 0) {
|
|
2964
2964
|
this.set(key, value);
|
|
2965
2965
|
} else {
|
|
@@ -5474,9 +5474,9 @@ var require_Document = __commonJS({
|
|
|
5474
5474
|
this.contents.add(value);
|
|
5475
5475
|
}
|
|
5476
5476
|
/** Adds a value to the document. */
|
|
5477
|
-
addIn(
|
|
5477
|
+
addIn(path144, value) {
|
|
5478
5478
|
if (assertCollection(this.contents))
|
|
5479
|
-
this.contents.addIn(
|
|
5479
|
+
this.contents.addIn(path144, value);
|
|
5480
5480
|
}
|
|
5481
5481
|
/**
|
|
5482
5482
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -5551,14 +5551,14 @@ var require_Document = __commonJS({
|
|
|
5551
5551
|
* Removes a value from the document.
|
|
5552
5552
|
* @returns `true` if the item was found and removed.
|
|
5553
5553
|
*/
|
|
5554
|
-
deleteIn(
|
|
5555
|
-
if (Collection.isEmptyPath(
|
|
5554
|
+
deleteIn(path144) {
|
|
5555
|
+
if (Collection.isEmptyPath(path144)) {
|
|
5556
5556
|
if (this.contents == null)
|
|
5557
5557
|
return false;
|
|
5558
5558
|
this.contents = null;
|
|
5559
5559
|
return true;
|
|
5560
5560
|
}
|
|
5561
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
5561
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path144) : false;
|
|
5562
5562
|
}
|
|
5563
5563
|
/**
|
|
5564
5564
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -5573,10 +5573,10 @@ var require_Document = __commonJS({
|
|
|
5573
5573
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
5574
5574
|
* `true` (collections are always returned intact).
|
|
5575
5575
|
*/
|
|
5576
|
-
getIn(
|
|
5577
|
-
if (Collection.isEmptyPath(
|
|
5576
|
+
getIn(path144, keepScalar) {
|
|
5577
|
+
if (Collection.isEmptyPath(path144))
|
|
5578
5578
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
5579
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
5579
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path144, keepScalar) : void 0;
|
|
5580
5580
|
}
|
|
5581
5581
|
/**
|
|
5582
5582
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -5587,10 +5587,10 @@ var require_Document = __commonJS({
|
|
|
5587
5587
|
/**
|
|
5588
5588
|
* Checks if the document includes a value at `path`.
|
|
5589
5589
|
*/
|
|
5590
|
-
hasIn(
|
|
5591
|
-
if (Collection.isEmptyPath(
|
|
5590
|
+
hasIn(path144) {
|
|
5591
|
+
if (Collection.isEmptyPath(path144))
|
|
5592
5592
|
return this.contents !== void 0;
|
|
5593
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
5593
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path144) : false;
|
|
5594
5594
|
}
|
|
5595
5595
|
/**
|
|
5596
5596
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -5607,13 +5607,13 @@ var require_Document = __commonJS({
|
|
|
5607
5607
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
5608
5608
|
* boolean to add/remove the item from the set.
|
|
5609
5609
|
*/
|
|
5610
|
-
setIn(
|
|
5611
|
-
if (Collection.isEmptyPath(
|
|
5610
|
+
setIn(path144, value) {
|
|
5611
|
+
if (Collection.isEmptyPath(path144)) {
|
|
5612
5612
|
this.contents = value;
|
|
5613
5613
|
} else if (this.contents == null) {
|
|
5614
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
5614
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path144), value);
|
|
5615
5615
|
} else if (assertCollection(this.contents)) {
|
|
5616
|
-
this.contents.setIn(
|
|
5616
|
+
this.contents.setIn(path144, value);
|
|
5617
5617
|
}
|
|
5618
5618
|
}
|
|
5619
5619
|
/**
|
|
@@ -7573,9 +7573,9 @@ var require_cst_visit = __commonJS({
|
|
|
7573
7573
|
visit.BREAK = BREAK;
|
|
7574
7574
|
visit.SKIP = SKIP;
|
|
7575
7575
|
visit.REMOVE = REMOVE;
|
|
7576
|
-
visit.itemAtPath = (cst,
|
|
7576
|
+
visit.itemAtPath = (cst, path144) => {
|
|
7577
7577
|
let item = cst;
|
|
7578
|
-
for (const [field, index] of
|
|
7578
|
+
for (const [field, index] of path144) {
|
|
7579
7579
|
const tok = item?.[field];
|
|
7580
7580
|
if (tok && "items" in tok) {
|
|
7581
7581
|
item = tok.items[index];
|
|
@@ -7584,23 +7584,23 @@ var require_cst_visit = __commonJS({
|
|
|
7584
7584
|
}
|
|
7585
7585
|
return item;
|
|
7586
7586
|
};
|
|
7587
|
-
visit.parentCollection = (cst,
|
|
7588
|
-
const parent = visit.itemAtPath(cst,
|
|
7589
|
-
const field =
|
|
7587
|
+
visit.parentCollection = (cst, path144) => {
|
|
7588
|
+
const parent = visit.itemAtPath(cst, path144.slice(0, -1));
|
|
7589
|
+
const field = path144[path144.length - 1][0];
|
|
7590
7590
|
const coll = parent?.[field];
|
|
7591
7591
|
if (coll && "items" in coll)
|
|
7592
7592
|
return coll;
|
|
7593
7593
|
throw new Error("Parent collection not found");
|
|
7594
7594
|
};
|
|
7595
|
-
function _visit(
|
|
7596
|
-
let ctrl = visitor(item,
|
|
7595
|
+
function _visit(path144, item, visitor) {
|
|
7596
|
+
let ctrl = visitor(item, path144);
|
|
7597
7597
|
if (typeof ctrl === "symbol")
|
|
7598
7598
|
return ctrl;
|
|
7599
7599
|
for (const field of ["key", "value"]) {
|
|
7600
7600
|
const token = item[field];
|
|
7601
7601
|
if (token && "items" in token) {
|
|
7602
7602
|
for (let i = 0; i < token.items.length; ++i) {
|
|
7603
|
-
const ci = _visit(Object.freeze(
|
|
7603
|
+
const ci = _visit(Object.freeze(path144.concat([[field, i]])), token.items[i], visitor);
|
|
7604
7604
|
if (typeof ci === "number")
|
|
7605
7605
|
i = ci - 1;
|
|
7606
7606
|
else if (ci === BREAK)
|
|
@@ -7611,10 +7611,10 @@ var require_cst_visit = __commonJS({
|
|
|
7611
7611
|
}
|
|
7612
7612
|
}
|
|
7613
7613
|
if (typeof ctrl === "function" && field === "key")
|
|
7614
|
-
ctrl = ctrl(item,
|
|
7614
|
+
ctrl = ctrl(item, path144);
|
|
7615
7615
|
}
|
|
7616
7616
|
}
|
|
7617
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
7617
|
+
return typeof ctrl === "function" ? ctrl(item, path144) : ctrl;
|
|
7618
7618
|
}
|
|
7619
7619
|
exports.visit = visit;
|
|
7620
7620
|
}
|
|
@@ -8916,14 +8916,14 @@ var require_parser = __commonJS({
|
|
|
8916
8916
|
case "scalar":
|
|
8917
8917
|
case "single-quoted-scalar":
|
|
8918
8918
|
case "double-quoted-scalar": {
|
|
8919
|
-
const
|
|
8919
|
+
const fs149 = this.flowScalar(this.type);
|
|
8920
8920
|
if (atNextItem || it.value) {
|
|
8921
|
-
map.items.push({ start, key:
|
|
8921
|
+
map.items.push({ start, key: fs149, sep: [] });
|
|
8922
8922
|
this.onKeyLine = true;
|
|
8923
8923
|
} else if (it.sep) {
|
|
8924
|
-
this.stack.push(
|
|
8924
|
+
this.stack.push(fs149);
|
|
8925
8925
|
} else {
|
|
8926
|
-
Object.assign(it, { key:
|
|
8926
|
+
Object.assign(it, { key: fs149, sep: [] });
|
|
8927
8927
|
this.onKeyLine = true;
|
|
8928
8928
|
}
|
|
8929
8929
|
return;
|
|
@@ -9051,13 +9051,13 @@ var require_parser = __commonJS({
|
|
|
9051
9051
|
case "scalar":
|
|
9052
9052
|
case "single-quoted-scalar":
|
|
9053
9053
|
case "double-quoted-scalar": {
|
|
9054
|
-
const
|
|
9054
|
+
const fs149 = this.flowScalar(this.type);
|
|
9055
9055
|
if (!it || it.value)
|
|
9056
|
-
fc.items.push({ start: [], key:
|
|
9056
|
+
fc.items.push({ start: [], key: fs149, sep: [] });
|
|
9057
9057
|
else if (it.sep)
|
|
9058
|
-
this.stack.push(
|
|
9058
|
+
this.stack.push(fs149);
|
|
9059
9059
|
else
|
|
9060
|
-
Object.assign(it, { key:
|
|
9060
|
+
Object.assign(it, { key: fs149, sep: [] });
|
|
9061
9061
|
return;
|
|
9062
9062
|
}
|
|
9063
9063
|
case "flow-map-end":
|
|
@@ -14692,18 +14692,18 @@ function manifest_path(project_root, env) {
|
|
|
14692
14692
|
}
|
|
14693
14693
|
return fsPath.join(project_root, DEFAULT_MANIFEST_RELATIVE);
|
|
14694
14694
|
}
|
|
14695
|
-
function read_manifest(
|
|
14695
|
+
function read_manifest(path144) {
|
|
14696
14696
|
let text;
|
|
14697
14697
|
try {
|
|
14698
|
-
text = require_read_text(
|
|
14698
|
+
text = require_read_text(path144);
|
|
14699
14699
|
} catch {
|
|
14700
14700
|
return null;
|
|
14701
14701
|
}
|
|
14702
14702
|
const data = _parse_manual(text);
|
|
14703
14703
|
return _normalise_v2_shape(data);
|
|
14704
14704
|
}
|
|
14705
|
-
function require_read_text(
|
|
14706
|
-
return fs18.readFileSync(
|
|
14705
|
+
function require_read_text(path144) {
|
|
14706
|
+
return fs18.readFileSync(path144, { encoding: "utf-8" });
|
|
14707
14707
|
}
|
|
14708
14708
|
function _normalise_v2_shape(data) {
|
|
14709
14709
|
if (data["tools"] === void 0 || data["tools"] === null) {
|
|
@@ -14884,9 +14884,9 @@ function stable_sort(items, key) {
|
|
|
14884
14884
|
return a.index - b.index;
|
|
14885
14885
|
}).map((entry) => entry.item);
|
|
14886
14886
|
}
|
|
14887
|
-
function write_manifest(
|
|
14887
|
+
function write_manifest(path144, version, tools, options = {}) {
|
|
14888
14888
|
const rendered = _render(version, tools, { deploy_roots: options.deploy_roots ?? null });
|
|
14889
|
-
return write_atomic(
|
|
14889
|
+
return write_atomic(path144, rendered);
|
|
14890
14890
|
}
|
|
14891
14891
|
function upsert_tool(existing, options) {
|
|
14892
14892
|
const {
|
|
@@ -28553,8 +28553,8 @@ function lockfile_path(env) {
|
|
|
28553
28553
|
}
|
|
28554
28554
|
return write_target("installed.lock", { env: env ?? null });
|
|
28555
28555
|
}
|
|
28556
|
-
function read_lockfile(
|
|
28557
|
-
const target =
|
|
28556
|
+
function read_lockfile(path144) {
|
|
28557
|
+
const target = path144 ?? lockfile_path();
|
|
28558
28558
|
let text;
|
|
28559
28559
|
try {
|
|
28560
28560
|
text = fs59.readFileSync(target, { encoding: "utf-8" });
|
|
@@ -31132,6 +31132,7 @@ var init_subagent_response = __esm({
|
|
|
31132
31132
|
});
|
|
31133
31133
|
|
|
31134
31134
|
// src/scripts/hooks/subagent_ledger_hook.ts
|
|
31135
|
+
import { execFileSync as execFileSync3 } from "node:child_process";
|
|
31135
31136
|
import * as crypto4 from "node:crypto";
|
|
31136
31137
|
import * as fs66 from "node:fs";
|
|
31137
31138
|
import * as path68 from "node:path";
|
|
@@ -31287,6 +31288,40 @@ function appendLedgerLine(root, ts, line) {
|
|
|
31287
31288
|
fs66.appendFileSync(file, `${JSON.stringify(line)}
|
|
31288
31289
|
`, "utf8");
|
|
31289
31290
|
}
|
|
31291
|
+
function writeIndexEntry(root, ts, key, value) {
|
|
31292
|
+
if (is_replay_mode()) return;
|
|
31293
|
+
const dir = path68.join(root, LEDGER_DIR, INDEX_SUBDIR, ts.slice(0, 7));
|
|
31294
|
+
fs66.mkdirSync(dir, { recursive: true });
|
|
31295
|
+
const tmp = path68.join(dir, `.${key}.${process.pid}.tmp`);
|
|
31296
|
+
try {
|
|
31297
|
+
fs66.writeFileSync(tmp, value, "utf8");
|
|
31298
|
+
fs66.renameSync(tmp, path68.join(dir, key));
|
|
31299
|
+
} finally {
|
|
31300
|
+
fs66.rmSync(tmp, { force: true });
|
|
31301
|
+
}
|
|
31302
|
+
}
|
|
31303
|
+
function headOf(dir) {
|
|
31304
|
+
try {
|
|
31305
|
+
const env = Object.fromEntries(Object.entries(process.env).filter(([k]) => !k.startsWith("GIT_")));
|
|
31306
|
+
return execFileSync3("git", ["-C", dir, "rev-parse", "HEAD"], { encoding: "utf8", timeout: 2e3, stdio: ["ignore", "pipe", "ignore"], env }).trim() || null;
|
|
31307
|
+
} catch {
|
|
31308
|
+
return null;
|
|
31309
|
+
}
|
|
31310
|
+
}
|
|
31311
|
+
function stateStamp(cwd) {
|
|
31312
|
+
let epoch = null;
|
|
31313
|
+
try {
|
|
31314
|
+
epoch = fs66.statSync(fileURLToPath31(import.meta.url)).mtimeMs;
|
|
31315
|
+
} catch {
|
|
31316
|
+
}
|
|
31317
|
+
return typeof cwd === "string" && cwd ? { head: headOf(cwd), cwd_key: refFor(cwd), epoch } : { head: null, cwd_key: null, epoch };
|
|
31318
|
+
}
|
|
31319
|
+
function stopIndexKey(sessionId, ref) {
|
|
31320
|
+
return refFor(`subagent-stop\0${sessionId}\0${ref}`);
|
|
31321
|
+
}
|
|
31322
|
+
function recordStopIndex(root, ts, sessionId, ref) {
|
|
31323
|
+
writeIndexEntry(root, ts, stopIndexKey(sessionId, ref), "");
|
|
31324
|
+
}
|
|
31290
31325
|
function armsExceeded(elapsedMs) {
|
|
31291
31326
|
if (elapsedMs === null || !Number.isFinite(elapsedMs)) return [];
|
|
31292
31327
|
return WALL_CLOCK_ARMS_MS.filter((a) => elapsedMs >= a.ms).map((a) => a.label);
|
|
@@ -31448,8 +31483,13 @@ function handleStop(root, payload, nowIso, sessionId) {
|
|
|
31448
31483
|
// Beside the count, never instead of it: the count says how wrong the
|
|
31449
31484
|
// candidate was, this says whether it was aimed at the envelope.
|
|
31450
31485
|
envelope_field_hits: parse8.field_hits,
|
|
31451
|
-
concurrent_open: countOpen(root)
|
|
31486
|
+
concurrent_open: countOpen(root),
|
|
31487
|
+
...stateStamp(payload["cwd"])
|
|
31452
31488
|
});
|
|
31489
|
+
try {
|
|
31490
|
+
if (sessionId !== null) recordStopIndex(root, nowIso, sessionId, ref);
|
|
31491
|
+
} catch {
|
|
31492
|
+
}
|
|
31453
31493
|
}
|
|
31454
31494
|
function processEnvelope(envelope, consumerRoot) {
|
|
31455
31495
|
try {
|
|
@@ -31500,7 +31540,7 @@ function _isCliEntry14() {
|
|
|
31500
31540
|
return false;
|
|
31501
31541
|
}
|
|
31502
31542
|
}
|
|
31503
|
-
var LEDGER_DIR, OPEN_SUBDIR, OPEN_RECORD_TTL_MS, DEPTH_BASES, WALL_CLOCK_ARMS_MS;
|
|
31543
|
+
var LEDGER_DIR, OPEN_SUBDIR, OPEN_RECORD_TTL_MS, DEPTH_BASES, INDEX_SUBDIR, WALL_CLOCK_ARMS_MS;
|
|
31504
31544
|
var init_subagent_ledger_hook = __esm({
|
|
31505
31545
|
"src/scripts/hooks/subagent_ledger_hook.ts"() {
|
|
31506
31546
|
"use strict";
|
|
@@ -31512,6 +31552,7 @@ var init_subagent_ledger_hook = __esm({
|
|
|
31512
31552
|
OPEN_SUBDIR = "open";
|
|
31513
31553
|
OPEN_RECORD_TTL_MS = 24 * 60 * 60 * 1e3;
|
|
31514
31554
|
DEPTH_BASES = /* @__PURE__ */ new Set(["observed", "asserted-parent", "assumed-root"]);
|
|
31555
|
+
INDEX_SUBDIR = "index";
|
|
31515
31556
|
WALL_CLOCK_ARMS_MS = [
|
|
31516
31557
|
{ label: "5m", ms: 5 * 60 * 1e3 },
|
|
31517
31558
|
{ label: "15m", ms: 15 * 60 * 1e3 },
|
|
@@ -31899,7 +31940,7 @@ var init_pricing = __esm({
|
|
|
31899
31940
|
});
|
|
31900
31941
|
|
|
31901
31942
|
// src/scripts/cache_realization_report.ts
|
|
31902
|
-
import { execFileSync as
|
|
31943
|
+
import { execFileSync as execFileSync4 } from "node:child_process";
|
|
31903
31944
|
import * as fs68 from "node:fs";
|
|
31904
31945
|
import { homedir as homedir13 } from "node:os";
|
|
31905
31946
|
import * as path70 from "node:path";
|
|
@@ -32195,7 +32236,7 @@ function encodeProjectPath(cwd) {
|
|
|
32195
32236
|
}
|
|
32196
32237
|
function listGitWorktrees(cwd) {
|
|
32197
32238
|
try {
|
|
32198
|
-
const out =
|
|
32239
|
+
const out = execFileSync4("git", ["worktree", "list", "--porcelain"], { cwd, encoding: "utf-8", timeout: 1e4 });
|
|
32199
32240
|
const paths = [];
|
|
32200
32241
|
for (const line of out.split("\n")) {
|
|
32201
32242
|
if (line.startsWith("worktree ")) paths.push(line.slice("worktree ".length).trim());
|
|
@@ -32268,7 +32309,7 @@ function computeWorktreeFragmentation(projectsRoot, worktreePaths, maxAgeDays) {
|
|
|
32268
32309
|
}
|
|
32269
32310
|
function hostVersion() {
|
|
32270
32311
|
try {
|
|
32271
|
-
const out =
|
|
32312
|
+
const out = execFileSync4("claude", ["--version"], { encoding: "utf-8", timeout: 5e3 }).trim();
|
|
32272
32313
|
return out.length > 0 ? out : "unknown";
|
|
32273
32314
|
} catch {
|
|
32274
32315
|
return "unknown";
|
|
@@ -33061,7 +33102,13 @@ function parseSeatFields(name, raw) {
|
|
|
33061
33102
|
function isUnpaidBilling(billing) {
|
|
33062
33103
|
return billing !== void 0 && billing !== null && !_PAID_BILLING.has(billing);
|
|
33063
33104
|
}
|
|
33064
|
-
function seatRoleRefusal(role, billing, seat = "this seat") {
|
|
33105
|
+
function seatRoleRefusal(role, billing, seat = "this seat", route = false) {
|
|
33106
|
+
if (HEAD_ROLES.has(role) && route) {
|
|
33107
|
+
return {
|
|
33108
|
+
reason: "route_head_role",
|
|
33109
|
+
message: `${seat} is a base_url route and may not hold the ${role} role, whatever billing it reports (ADR-257)`
|
|
33110
|
+
};
|
|
33111
|
+
}
|
|
33065
33112
|
if (!HEAD_ROLES.has(role) || !isUnpaidBilling(billing)) return null;
|
|
33066
33113
|
return {
|
|
33067
33114
|
reason: "unpaid_head_role",
|
|
@@ -34347,7 +34394,8 @@ function probeHostCapabilities(hostId) {
|
|
|
34347
34394
|
const base = resolveHostCapabilities(hostId);
|
|
34348
34395
|
const flag2 = process18.env.CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS;
|
|
34349
34396
|
const probedAgentTeams = typeof flag2 === "string" && flag2 !== "";
|
|
34350
|
-
|
|
34397
|
+
const probedResume = probedAgentTeams && hostId === "claude";
|
|
34398
|
+
return { ...base, agent_teams: base.agent_teams || probedAgentTeams, worker_resume: base.worker_resume || probedResume };
|
|
34351
34399
|
}
|
|
34352
34400
|
function describeHostCapabilities(hostId) {
|
|
34353
34401
|
const manifest = probeHostCapabilities(hostId);
|
|
@@ -34356,9 +34404,9 @@ function describeHostCapabilities(hostId) {
|
|
|
34356
34404
|
const probedAgentTeams = typeof flag2 === "string" && flag2 !== "";
|
|
34357
34405
|
const sources = {};
|
|
34358
34406
|
for (const field of CAPABILITY_FIELDS) {
|
|
34359
|
-
if (row !== void 0 && typeof row[field] === "boolean") {
|
|
34407
|
+
if (row !== void 0 && typeof row[field] === "boolean" && !(row[field] === false && manifest[field] === true)) {
|
|
34360
34408
|
sources[field] = "registry";
|
|
34361
|
-
} else if (field === "agent_teams" && probedAgentTeams) {
|
|
34409
|
+
} else if ((field === "agent_teams" || field === "worker_resume" && hostId === "claude") && probedAgentTeams) {
|
|
34362
34410
|
sources[field] = "live-probe";
|
|
34363
34411
|
} else {
|
|
34364
34412
|
sources[field] = "default";
|
|
@@ -38727,9 +38775,10 @@ ${user_prompt}`;
|
|
|
38727
38775
|
_cli_calls_path;
|
|
38728
38776
|
/** Attribution label for every booking this client makes. */
|
|
38729
38777
|
_consumer;
|
|
38730
|
-
/** The session the last answered call ran in; `resumeNext` continues it once,
|
|
38778
|
+
/** The session the last answered call ran in; `resumeNext` continues it once, never while `blind`. */
|
|
38731
38779
|
lastSession = null;
|
|
38732
38780
|
resumeNext = null;
|
|
38781
|
+
blind = false;
|
|
38733
38782
|
static _AUTH_FAILURE_PATTERNS = [
|
|
38734
38783
|
"authentication",
|
|
38735
38784
|
"unauthorized",
|
|
@@ -39090,7 +39139,7 @@ ${stdinPayload ?? ""}`);
|
|
|
39090
39139
|
void max_tokens;
|
|
39091
39140
|
return [
|
|
39092
39141
|
this.binary,
|
|
39093
|
-
...seatResumeArgs(this.name, this.resumeNext, { blind:
|
|
39142
|
+
...seatResumeArgs(this.name, this.resumeNext, { blind: this.blind, now_ms: Date.now() }),
|
|
39094
39143
|
"--print",
|
|
39095
39144
|
// The seat never needs the user environment; only a version the light
|
|
39096
39145
|
// launch was probed on gets the flag (`LIGHT_LAUNCH_PROBES`).
|
|
@@ -39193,7 +39242,7 @@ ${stdinPayload ?? ""}`);
|
|
|
39193
39242
|
void user_prompt;
|
|
39194
39243
|
void max_tokens;
|
|
39195
39244
|
const modelArgs = this.model === OPENAI_CLI_VENDOR_DEFAULT ? [] : ["--model", this.model];
|
|
39196
|
-
const resume = seatResumeArgs(this.name, this.resumeNext, { blind:
|
|
39245
|
+
const resume = seatResumeArgs(this.name, this.resumeNext, { blind: this.blind, now_ms: Date.now() });
|
|
39197
39246
|
const bound = resume.length === 0 ? boundFor("openai") : resumeBound(boundFor("openai"));
|
|
39198
39247
|
return [this.binary, "exec", ...resume, "--json", "--skip-git-repo-check", ...bound, ...modelArgs, "-"];
|
|
39199
39248
|
}
|
|
@@ -42407,7 +42456,7 @@ var init_review_gate = __esm({
|
|
|
42407
42456
|
|
|
42408
42457
|
// src/scripts/_lib/foreign_scan.ts
|
|
42409
42458
|
import * as fs93 from "node:fs";
|
|
42410
|
-
function rglob2(root, isDir6,
|
|
42459
|
+
function rglob2(root, isDir6, join120) {
|
|
42411
42460
|
const out = [];
|
|
42412
42461
|
const walk = (dir) => {
|
|
42413
42462
|
let entries;
|
|
@@ -42418,7 +42467,7 @@ function rglob2(root, isDir6, join118) {
|
|
|
42418
42467
|
}
|
|
42419
42468
|
entries.sort((a, b) => a.name < b.name ? -1 : a.name > b.name ? 1 : 0);
|
|
42420
42469
|
for (const ent of entries) {
|
|
42421
|
-
const full2 =
|
|
42470
|
+
const full2 = join120(dir, ent.name);
|
|
42422
42471
|
out.push(full2);
|
|
42423
42472
|
let dirLike = ent.isDirectory();
|
|
42424
42473
|
if (ent.isSymbolicLink()) {
|
|
@@ -48204,8 +48253,40 @@ var init_cmd_doctor = __esm({
|
|
|
48204
48253
|
}
|
|
48205
48254
|
});
|
|
48206
48255
|
|
|
48256
|
+
// src/install/paths.ts
|
|
48257
|
+
import { homedir as homedir22, tmpdir as tmpdir4 } from "node:os";
|
|
48258
|
+
import { join as join92 } from "node:path";
|
|
48259
|
+
function resolveHome(home) {
|
|
48260
|
+
if (home && home.length > 0) {
|
|
48261
|
+
return home;
|
|
48262
|
+
}
|
|
48263
|
+
const fromOs = homedir22();
|
|
48264
|
+
if (!fromOs) {
|
|
48265
|
+
throw new Error(
|
|
48266
|
+
"Cannot resolve home directory \u2014 both $HOME (POSIX) and $USERPROFILE (Windows) are unset."
|
|
48267
|
+
);
|
|
48268
|
+
}
|
|
48269
|
+
return fromOs;
|
|
48270
|
+
}
|
|
48271
|
+
function getInstallRoot(home) {
|
|
48272
|
+
return join92(resolveHome(home), INSTALL_ROOT_SUBPATH);
|
|
48273
|
+
}
|
|
48274
|
+
function getLogPath(home) {
|
|
48275
|
+
const configHome = home ? void 0 : process.env["EVENT4U_CONFIG_HOME"];
|
|
48276
|
+
if (configHome) return join92(configHome, INSTALL_LOG_FILENAME);
|
|
48277
|
+
return join92(getInstallRoot(home), INSTALL_LOG_FILENAME);
|
|
48278
|
+
}
|
|
48279
|
+
var INSTALL_ROOT_SUBPATH, INSTALL_LOG_FILENAME;
|
|
48280
|
+
var init_paths = __esm({
|
|
48281
|
+
"src/install/paths.ts"() {
|
|
48282
|
+
"use strict";
|
|
48283
|
+
INSTALL_ROOT_SUBPATH = ".event4u/agent-config";
|
|
48284
|
+
INSTALL_LOG_FILENAME = "install-log.jsonl";
|
|
48285
|
+
}
|
|
48286
|
+
});
|
|
48287
|
+
|
|
48207
48288
|
// src/install/txlog.ts
|
|
48208
|
-
import { createReadStream, createWriteStream, existsSync as existsSync49, readFileSync as readFileSync83, renameSync as
|
|
48289
|
+
import { createReadStream, createWriteStream, existsSync as existsSync49, readFileSync as readFileSync83, renameSync as renameSync13, statSync as statSync50, unlinkSync as unlinkSync10 } from "node:fs";
|
|
48209
48290
|
function readRecentEntries(logPath) {
|
|
48210
48291
|
if (!existsSync49(logPath)) {
|
|
48211
48292
|
return [];
|
|
@@ -48245,21 +48326,21 @@ var init_txlog = __esm({
|
|
|
48245
48326
|
});
|
|
48246
48327
|
|
|
48247
48328
|
// src/install/detect.ts
|
|
48248
|
-
import { existsSync as existsSync50, readFileSync as readFileSync84, readdirSync as readdirSync48, statSync as
|
|
48249
|
-
import { join as
|
|
48329
|
+
import { existsSync as existsSync50, readFileSync as readFileSync84, readdirSync as readdirSync48, statSync as statSync51 } from "node:fs";
|
|
48330
|
+
import { join as join93, resolve as resolve57 } from "node:path";
|
|
48250
48331
|
function detectToolPresence(root) {
|
|
48251
48332
|
return {
|
|
48252
|
-
augment: isDir5(
|
|
48253
|
-
claude: isDir5(
|
|
48254
|
-
cursor: isDir5(
|
|
48255
|
-
cline: isDir5(
|
|
48256
|
-
windsurf: isDir5(
|
|
48257
|
-
agentsMd: existsSync50(
|
|
48333
|
+
augment: isDir5(join93(root, ".augment")),
|
|
48334
|
+
claude: isDir5(join93(root, ".claude")),
|
|
48335
|
+
cursor: isDir5(join93(root, ".cursor")),
|
|
48336
|
+
cline: isDir5(join93(root, ".clinerules")),
|
|
48337
|
+
windsurf: isDir5(join93(root, ".windsurf")) || existsSync50(join93(root, ".windsurfrules")),
|
|
48338
|
+
agentsMd: existsSync50(join93(root, "AGENTS.md"))
|
|
48258
48339
|
};
|
|
48259
48340
|
}
|
|
48260
|
-
function isDir5(
|
|
48341
|
+
function isDir5(path144) {
|
|
48261
48342
|
try {
|
|
48262
|
-
return
|
|
48343
|
+
return statSync51(path144).isDirectory();
|
|
48263
48344
|
} catch {
|
|
48264
48345
|
return false;
|
|
48265
48346
|
}
|
|
@@ -50573,7 +50654,7 @@ function defaultSpawn(argv, cwd, timeout_ms) {
|
|
|
50573
50654
|
}
|
|
50574
50655
|
function runTouchedFileQuality(opts) {
|
|
50575
50656
|
const timeout_ms = opts.timeout_ms ?? DEFAULT_TIMEOUT_MS;
|
|
50576
|
-
const
|
|
50657
|
+
const spawn3 = opts.spawn ?? defaultSpawn;
|
|
50577
50658
|
const out = [];
|
|
50578
50659
|
for (const plan of planQualityRuns(opts.commands, opts.files)) {
|
|
50579
50660
|
if (plan.argv === null) {
|
|
@@ -50593,7 +50674,7 @@ function runTouchedFileQuality(opts) {
|
|
|
50593
50674
|
let output2 = "";
|
|
50594
50675
|
let enoent = false;
|
|
50595
50676
|
try {
|
|
50596
|
-
const res =
|
|
50677
|
+
const res = spawn3(plan.argv, opts.root, timeout_ms);
|
|
50597
50678
|
status3 = res.status;
|
|
50598
50679
|
output2 = res.output;
|
|
50599
50680
|
enoent = res.enoent;
|
|
@@ -57479,7 +57560,7 @@ function installLogPath() {
|
|
|
57479
57560
|
if (override && override.trim().length > 0) {
|
|
57480
57561
|
return override;
|
|
57481
57562
|
}
|
|
57482
|
-
return
|
|
57563
|
+
return getLogPath();
|
|
57483
57564
|
}
|
|
57484
57565
|
function _installLogExpected(projectRoot) {
|
|
57485
57566
|
return fs132.existsSync(manifest_path(projectRoot));
|
|
@@ -57941,6 +58022,7 @@ var init_cmd_conformance = __esm({
|
|
|
57941
58022
|
YAML9 = __toESM(require_dist(), 1);
|
|
57942
58023
|
init_installed_tools();
|
|
57943
58024
|
init_atomic();
|
|
58025
|
+
init_paths();
|
|
57944
58026
|
init_txlog();
|
|
57945
58027
|
init_detect2();
|
|
57946
58028
|
init_package_root();
|
|
@@ -59363,12 +59445,13 @@ function markerFile(repoRoot, runId) {
|
|
|
59363
59445
|
function writeQuotaParked(repoRoot, runId, providers, now2 = () => /* @__PURE__ */ new Date(), source = "council") {
|
|
59364
59446
|
const file = markerFile(repoRoot, runId);
|
|
59365
59447
|
const existing = readMarker(file);
|
|
59448
|
+
const host2 = source === "host";
|
|
59366
59449
|
const merged = [.../* @__PURE__ */ new Set([...existing?.providers ?? [], ...providers])].sort();
|
|
59367
59450
|
const marker = {
|
|
59368
59451
|
run_id: runId,
|
|
59369
59452
|
providers: merged,
|
|
59370
|
-
parked_at: existing?.parked_at ?? now2().toISOString(),
|
|
59371
|
-
source: existing?.source ?? source
|
|
59453
|
+
parked_at: (host2 ? null : existing?.parked_at) ?? now2().toISOString(),
|
|
59454
|
+
source: host2 ? source : existing?.source ?? source
|
|
59372
59455
|
};
|
|
59373
59456
|
fs135.mkdirSync(path132.dirname(file), { recursive: true });
|
|
59374
59457
|
fs135.writeFileSync(file, `${JSON.stringify(marker, null, 2)}
|
|
@@ -59376,20 +59459,18 @@ function writeQuotaParked(repoRoot, runId, providers, now2 = () => /* @__PURE__
|
|
|
59376
59459
|
return marker;
|
|
59377
59460
|
}
|
|
59378
59461
|
function recentHostMarker(repoRoot, nowMs = Date.now(), windowMs = HOST_RATE_WINDOW_MS) {
|
|
59379
|
-
|
|
59462
|
+
return allMarkers(repoRoot).some((m) => {
|
|
59463
|
+
const age = nowMs - Date.parse(m.parked_at);
|
|
59464
|
+
return m.source === "host" && age >= 0 && age < windowMs;
|
|
59465
|
+
});
|
|
59466
|
+
}
|
|
59467
|
+
function allMarkers(repoRoot) {
|
|
59468
|
+
const dir = path132.join(repoRoot, QUOTA_PARKED_DIR_REL);
|
|
59380
59469
|
try {
|
|
59381
|
-
|
|
59470
|
+
return fs135.readdirSync(dir).flatMap((n) => n.endsWith(".json") ? readMarker(path132.join(dir, n)) ?? [] : []);
|
|
59382
59471
|
} catch {
|
|
59383
|
-
return
|
|
59384
|
-
}
|
|
59385
|
-
for (const name of names) {
|
|
59386
|
-
if (!name.endsWith(".json")) continue;
|
|
59387
|
-
const m = readMarker(path132.join(repoRoot, QUOTA_PARKED_DIR_REL, name));
|
|
59388
|
-
if (m === null || m.source !== "host") continue;
|
|
59389
|
-
const at2 = Date.parse(m.parked_at);
|
|
59390
|
-
if (Number.isFinite(at2) && nowMs - at2 >= 0 && nowMs - at2 < windowMs) return true;
|
|
59472
|
+
return [];
|
|
59391
59473
|
}
|
|
59392
|
-
return false;
|
|
59393
59474
|
}
|
|
59394
59475
|
function readMarker(file) {
|
|
59395
59476
|
try {
|
|
@@ -59508,7 +59589,8 @@ function select_chairman(mode, member, deliberated, candidates) {
|
|
|
59508
59589
|
annotation: `Chairman: host (member ${_q(member)} unavailable \u2014 host fallback)`
|
|
59509
59590
|
};
|
|
59510
59591
|
}
|
|
59511
|
-
const
|
|
59592
|
+
const c = candidates.find((x) => x.name === member);
|
|
59593
|
+
const refusal = seatRoleRefusal("synthesis", c?.billing, member, c?.route === true);
|
|
59512
59594
|
if (refusal !== null) {
|
|
59513
59595
|
return {
|
|
59514
59596
|
member: null,
|
|
@@ -59530,7 +59612,7 @@ function select_chairman(mode, member, deliberated, candidates) {
|
|
|
59530
59612
|
annotation: "Chairman: host (no non-panel member available)"
|
|
59531
59613
|
};
|
|
59532
59614
|
}
|
|
59533
|
-
const pool = nonPanel.filter((c) => seatRoleRefusal("synthesis", c.billing) === null);
|
|
59615
|
+
const pool = nonPanel.filter((c) => seatRoleRefusal("synthesis", c.billing, c.name, c.route === true) === null);
|
|
59534
59616
|
if (pool.length === 0) {
|
|
59535
59617
|
return { member: null, annotation: "Chairman: host (no paid non-panel member available)" };
|
|
59536
59618
|
}
|
|
@@ -59648,8 +59730,8 @@ function aggregate_scores(findings, scores) {
|
|
|
59648
59730
|
by_id.get(s.finding_id).push(s);
|
|
59649
59731
|
}
|
|
59650
59732
|
const out = /* @__PURE__ */ new Map();
|
|
59651
|
-
for (const [fid,
|
|
59652
|
-
if (
|
|
59733
|
+
for (const [fid, fs149] of by_id) {
|
|
59734
|
+
if (fs149.length === 0) {
|
|
59653
59735
|
out.set(
|
|
59654
59736
|
fid,
|
|
59655
59737
|
new ConsensusMetadata({
|
|
@@ -59665,13 +59747,13 @@ function aggregate_scores(findings, scores) {
|
|
|
59665
59747
|
);
|
|
59666
59748
|
continue;
|
|
59667
59749
|
}
|
|
59668
|
-
const mean2 =
|
|
59669
|
-
const agree_rate =
|
|
59750
|
+
const mean2 = fs149.reduce((acc, s) => acc + s.score, 0) / fs149.length;
|
|
59751
|
+
const agree_rate = fs149.filter((s) => s.agree).length / fs149.length;
|
|
59670
59752
|
const strength = mean2 / 10 * agree_rate;
|
|
59671
|
-
const dissent =
|
|
59672
|
-
const concur =
|
|
59673
|
-
const scorers =
|
|
59674
|
-
const dissent_reasons =
|
|
59753
|
+
const dissent = fs149.filter((s) => !s.agree).length;
|
|
59754
|
+
const concur = fs149.filter((s) => s.agree).length;
|
|
59755
|
+
const scorers = fs149.map((s) => s.scorer);
|
|
59756
|
+
const dissent_reasons = fs149.filter((s) => !s.agree).map((s) => [s.scorer, s.reason]);
|
|
59675
59757
|
const mean_rounded = pyRound2(mean2, 2);
|
|
59676
59758
|
out.set(
|
|
59677
59759
|
fid,
|
|
@@ -61215,6 +61297,259 @@ var init_solo_dispatch = __esm({
|
|
|
61215
61297
|
}
|
|
61216
61298
|
});
|
|
61217
61299
|
|
|
61300
|
+
// src/scripts/ai_council/self_hosted_probe.ts
|
|
61301
|
+
import { spawn as spawn2, spawnSync as spawnSync23 } from "node:child_process";
|
|
61302
|
+
import * as fs139 from "node:fs";
|
|
61303
|
+
import * as os28 from "node:os";
|
|
61304
|
+
import * as path135 from "node:path";
|
|
61305
|
+
function _json(deps, args) {
|
|
61306
|
+
const r = deps.run("curl", ["-s", "-f", "--max-time", String(QUERY_TIMEOUT_S), ...args], (QUERY_TIMEOUT_S + 1) * 1e3);
|
|
61307
|
+
if (r === null || r.status !== 0 || r.stdout.trim() === "") return null;
|
|
61308
|
+
try {
|
|
61309
|
+
const v = JSON.parse(r.stdout);
|
|
61310
|
+
return v !== null && typeof v === "object" && !Array.isArray(v) ? v : null;
|
|
61311
|
+
} catch {
|
|
61312
|
+
return null;
|
|
61313
|
+
}
|
|
61314
|
+
}
|
|
61315
|
+
function _isCloudModel(model) {
|
|
61316
|
+
return /(?:^|[:\-])cloud$/i.test(model.trim());
|
|
61317
|
+
}
|
|
61318
|
+
function _weightsAt(deps, file) {
|
|
61319
|
+
const size = deps.fileSize(file);
|
|
61320
|
+
return size !== null && size > MIN_WEIGHTS_BYTES ? "local" : "remote";
|
|
61321
|
+
}
|
|
61322
|
+
function _expandHome(deps, p) {
|
|
61323
|
+
return p.startsWith("~/") ? path135.join(deps.home, p.slice(2)) : p;
|
|
61324
|
+
}
|
|
61325
|
+
function _ollamaModelsDir(deps) {
|
|
61326
|
+
const override = (deps.env["OLLAMA_MODELS"] ?? "").trim();
|
|
61327
|
+
return override !== "" ? _expandHome(deps, override) : path135.join(deps.home, ".ollama", "models");
|
|
61328
|
+
}
|
|
61329
|
+
function _ollamaWeights(deps, origin, model) {
|
|
61330
|
+
const show = _json(deps, ["-X", "POST", "-H", "content-type: application/json", "-d", JSON.stringify({ model }), `${origin}/api/show`]);
|
|
61331
|
+
if (show === null) return null;
|
|
61332
|
+
if (show["remote_host"] !== void 0 || show["remote_model"] !== void 0) return "remote";
|
|
61333
|
+
const modelfile = typeof show["modelfile"] === "string" ? show["modelfile"] : "";
|
|
61334
|
+
for (const line of modelfile.split("\n")) {
|
|
61335
|
+
const m = /^FROM\s+(\S+)/.exec(line.trim());
|
|
61336
|
+
if (m === null) continue;
|
|
61337
|
+
const ref = m[1];
|
|
61338
|
+
const digest = /^sha256[:-]([0-9a-f]+)$/i.exec(ref);
|
|
61339
|
+
if (digest !== null) return _weightsAt(deps, path135.join(_ollamaModelsDir(deps), "blobs", `sha256-${digest[1]}`));
|
|
61340
|
+
if (ref.startsWith("/") || ref.startsWith("~/")) return _weightsAt(deps, _expandHome(deps, ref));
|
|
61341
|
+
}
|
|
61342
|
+
return "unknown";
|
|
61343
|
+
}
|
|
61344
|
+
function _llamaServerWeights(deps, origin) {
|
|
61345
|
+
const props = _json(deps, [`${origin}/props`]);
|
|
61346
|
+
if (props === null) return null;
|
|
61347
|
+
const p = props["model_path"];
|
|
61348
|
+
return typeof p === "string" && p !== "" ? _weightsAt(deps, _expandHome(deps, p)) : "unknown";
|
|
61349
|
+
}
|
|
61350
|
+
function _lmStudioWeights(deps, origin, model) {
|
|
61351
|
+
const list = _json(deps, [`${origin}/api/v0/models`]);
|
|
61352
|
+
if (list === null) return null;
|
|
61353
|
+
const data = Array.isArray(list["data"]) ? list["data"] : [];
|
|
61354
|
+
const entry = data.find((d) => d !== null && typeof d === "object" && d["id"] === model);
|
|
61355
|
+
const p = entry?.["path"];
|
|
61356
|
+
if (typeof p !== "string" || p === "") return "unknown";
|
|
61357
|
+
if (p.startsWith("/") || p.startsWith("~/")) return _weightsAt(deps, _expandHome(deps, p));
|
|
61358
|
+
for (const dir of [path135.join(deps.home, ".lmstudio", "models"), path135.join(deps.home, ".cache", "lm-studio", "models")]) {
|
|
61359
|
+
if (_weightsAt(deps, path135.join(dir, p)) === "local") return "local";
|
|
61360
|
+
}
|
|
61361
|
+
return "remote";
|
|
61362
|
+
}
|
|
61363
|
+
function _weights(deps, origin, model) {
|
|
61364
|
+
if (_isCloudModel(model)) return "remote";
|
|
61365
|
+
return _ollamaWeights(deps, origin, model) ?? _llamaServerWeights(deps, origin) ?? _lmStudioWeights(deps, origin, model) ?? "unknown";
|
|
61366
|
+
}
|
|
61367
|
+
function _isLoopbackHost(host2) {
|
|
61368
|
+
const h = host2.replace(/^\[|\]$/g, "").toLowerCase();
|
|
61369
|
+
if (h === "::1" || h === "localhost") return true;
|
|
61370
|
+
return /^(?:::ffff:)?127\.\d{1,3}\.\d{1,3}\.\d{1,3}$/.test(h);
|
|
61371
|
+
}
|
|
61372
|
+
function _remoteHosts(stdout) {
|
|
61373
|
+
const hosts = [];
|
|
61374
|
+
for (const line of stdout.split("\n")) {
|
|
61375
|
+
const m = /->(\S+)/.exec(line);
|
|
61376
|
+
if (m === null) continue;
|
|
61377
|
+
const remote = m[1];
|
|
61378
|
+
hosts.push(remote.startsWith("[") ? remote.slice(0, remote.indexOf("]") + 1) : remote.slice(0, remote.lastIndexOf(":")));
|
|
61379
|
+
}
|
|
61380
|
+
return hosts;
|
|
61381
|
+
}
|
|
61382
|
+
function _sample(deps, pids) {
|
|
61383
|
+
const r = deps.run("lsof", ["-nP", "-a", "-p", pids, "-iTCP", "-sTCP:ESTABLISHED"], 5e3);
|
|
61384
|
+
if (r === null || r.status !== 0 && r.stdout.trim() !== "" || r.status > 1) return null;
|
|
61385
|
+
return _remoteHosts(r.stdout).some((h) => !_isLoopbackHost(h));
|
|
61386
|
+
}
|
|
61387
|
+
function _running(deps, pid) {
|
|
61388
|
+
const r = deps.run("ps", ["-o", "stat=", "-p", String(pid)], 2e3);
|
|
61389
|
+
if (r === null) return true;
|
|
61390
|
+
const stat = r.stdout.trim();
|
|
61391
|
+
return r.status === 0 && stat !== "" && !stat.startsWith("Z");
|
|
61392
|
+
}
|
|
61393
|
+
function _completed(text) {
|
|
61394
|
+
if (text === null || text.trim() === "") return false;
|
|
61395
|
+
try {
|
|
61396
|
+
const v = JSON.parse(text);
|
|
61397
|
+
return v !== null && Array.isArray(v["choices"]) && v["choices"].length > 0;
|
|
61398
|
+
} catch {
|
|
61399
|
+
return false;
|
|
61400
|
+
}
|
|
61401
|
+
}
|
|
61402
|
+
function _authHeaderArgs(deps, route, dir) {
|
|
61403
|
+
const ref = route.api_key_ref;
|
|
61404
|
+
if (typeof ref !== "string" || ref === "") return [];
|
|
61405
|
+
const key = deps.resolveKey(ref);
|
|
61406
|
+
if (key === null || key === "") return [];
|
|
61407
|
+
const file = path135.join(dir, "auth.header");
|
|
61408
|
+
deps.writeText(file, `Authorization: Bearer ${key}
|
|
61409
|
+
`);
|
|
61410
|
+
return ["-H", `@${file}`];
|
|
61411
|
+
}
|
|
61412
|
+
function _outbound(deps, route, url, model) {
|
|
61413
|
+
const port = url.port !== "" ? url.port : url.protocol === "https:" ? "443" : "80";
|
|
61414
|
+
const listen = deps.run("lsof", ["-nP", `-iTCP:${port}`, "-sTCP:LISTEN", "-t"], 5e3);
|
|
61415
|
+
if (listen === null) return null;
|
|
61416
|
+
const pids = [...new Set(listen.stdout.split("\n").map((s) => s.trim()).filter((s) => /^\d+$/.test(s)))];
|
|
61417
|
+
if (pids.length === 0) return null;
|
|
61418
|
+
const pidList = pids.join(",");
|
|
61419
|
+
let seen = _sample(deps, pidList);
|
|
61420
|
+
if (seen === null) return null;
|
|
61421
|
+
const dir = deps.tmpDir();
|
|
61422
|
+
try {
|
|
61423
|
+
const out = path135.join(dir, "out.json");
|
|
61424
|
+
const body = JSON.stringify({ model, max_tokens: 8, messages: [{ role: "user", content: "Reply with OK." }] });
|
|
61425
|
+
const pid = deps.start("curl", [
|
|
61426
|
+
"-s",
|
|
61427
|
+
"--max-time",
|
|
61428
|
+
String(CALL_TIMEOUT_S),
|
|
61429
|
+
"-o",
|
|
61430
|
+
out,
|
|
61431
|
+
"-H",
|
|
61432
|
+
"content-type: application/json",
|
|
61433
|
+
..._authHeaderArgs(deps, route, dir),
|
|
61434
|
+
"-d",
|
|
61435
|
+
body,
|
|
61436
|
+
`${route.base_url}/chat/completions`
|
|
61437
|
+
]);
|
|
61438
|
+
if (pid === null) return null;
|
|
61439
|
+
const deadline = deps.now() + (CALL_TIMEOUT_S + 5) * 1e3;
|
|
61440
|
+
while (_running(deps, pid)) {
|
|
61441
|
+
const s = _sample(deps, pidList);
|
|
61442
|
+
if (s === null) return null;
|
|
61443
|
+
seen = seen || s;
|
|
61444
|
+
if (deps.now() > deadline) {
|
|
61445
|
+
deps.run("kill", [String(pid)], 2e3);
|
|
61446
|
+
return null;
|
|
61447
|
+
}
|
|
61448
|
+
deps.sleep(50);
|
|
61449
|
+
}
|
|
61450
|
+
const last = _sample(deps, pidList);
|
|
61451
|
+
if (last === null) return null;
|
|
61452
|
+
seen = seen || last;
|
|
61453
|
+
return _completed(deps.readText(out)) ? seen : null;
|
|
61454
|
+
} finally {
|
|
61455
|
+
deps.remove(dir);
|
|
61456
|
+
}
|
|
61457
|
+
}
|
|
61458
|
+
function makeSelfHostedProbe(deps) {
|
|
61459
|
+
return (route, model) => {
|
|
61460
|
+
if (!route.loopback || model === "") return UNPROVEN;
|
|
61461
|
+
try {
|
|
61462
|
+
const url = new URL(route.base_url);
|
|
61463
|
+
const weights = _weights(deps, url.origin, model);
|
|
61464
|
+
if (weights !== "local") return { weights, outbound: null };
|
|
61465
|
+
return { weights, outbound: _outbound(deps, route, url, model) };
|
|
61466
|
+
} catch {
|
|
61467
|
+
return UNPROVEN;
|
|
61468
|
+
}
|
|
61469
|
+
};
|
|
61470
|
+
}
|
|
61471
|
+
function _definite(r) {
|
|
61472
|
+
return r.weights === "remote" || r.weights === "local" && r.outbound !== null;
|
|
61473
|
+
}
|
|
61474
|
+
function makeMemoisedProbe(probe, now2, ttlMs = SELF_HOSTED_PROBE_TTL_MS) {
|
|
61475
|
+
const memo = /* @__PURE__ */ new Map();
|
|
61476
|
+
return (route, model) => {
|
|
61477
|
+
const key = `${route.base_url}\0${model}`;
|
|
61478
|
+
const hit = memo.get(key);
|
|
61479
|
+
if (hit !== void 0 && now2() < hit.until) return hit.result;
|
|
61480
|
+
memo.delete(key);
|
|
61481
|
+
const result = probe(route, model);
|
|
61482
|
+
if (_definite(result)) memo.set(key, { result, until: now2() + ttlMs });
|
|
61483
|
+
return result;
|
|
61484
|
+
};
|
|
61485
|
+
}
|
|
61486
|
+
var UNPROVEN, MIN_WEIGHTS_BYTES, QUERY_TIMEOUT_S, CALL_TIMEOUT_S, SELF_HOSTED_PROBE_TTL_MS, _sleeper, NODE_PROBE_DEPS, SELF_HOSTED_PROBE;
|
|
61487
|
+
var init_self_hosted_probe = __esm({
|
|
61488
|
+
"src/scripts/ai_council/self_hosted_probe.ts"() {
|
|
61489
|
+
"use strict";
|
|
61490
|
+
init_config();
|
|
61491
|
+
UNPROVEN = { weights: "unknown", outbound: null };
|
|
61492
|
+
MIN_WEIGHTS_BYTES = 50 * 1024 * 1024;
|
|
61493
|
+
QUERY_TIMEOUT_S = 5;
|
|
61494
|
+
CALL_TIMEOUT_S = 60;
|
|
61495
|
+
SELF_HOSTED_PROBE_TTL_MS = 10 * 60 * 1e3;
|
|
61496
|
+
_sleeper = new Int32Array(new SharedArrayBuffer(4));
|
|
61497
|
+
NODE_PROBE_DEPS = {
|
|
61498
|
+
run(cmd, args, timeoutMs) {
|
|
61499
|
+
const r = spawnSync23(cmd, args, { encoding: "utf-8", timeout: timeoutMs, stdio: ["ignore", "pipe", "ignore"] });
|
|
61500
|
+
if (r.error !== void 0 || r.status === null) return null;
|
|
61501
|
+
return { status: r.status, stdout: r.stdout ?? "" };
|
|
61502
|
+
},
|
|
61503
|
+
start(cmd, args) {
|
|
61504
|
+
try {
|
|
61505
|
+
const child = spawn2(cmd, args, { stdio: "ignore" });
|
|
61506
|
+
child.on("error", () => void 0);
|
|
61507
|
+
child.unref();
|
|
61508
|
+
return child.pid ?? null;
|
|
61509
|
+
} catch {
|
|
61510
|
+
return null;
|
|
61511
|
+
}
|
|
61512
|
+
},
|
|
61513
|
+
fileSize(p) {
|
|
61514
|
+
try {
|
|
61515
|
+
const st = fs139.statSync(p);
|
|
61516
|
+
return st.isFile() ? st.size : null;
|
|
61517
|
+
} catch {
|
|
61518
|
+
return null;
|
|
61519
|
+
}
|
|
61520
|
+
},
|
|
61521
|
+
readText(p) {
|
|
61522
|
+
try {
|
|
61523
|
+
return fs139.readFileSync(p, "utf-8");
|
|
61524
|
+
} catch {
|
|
61525
|
+
return null;
|
|
61526
|
+
}
|
|
61527
|
+
},
|
|
61528
|
+
writeText(p, text) {
|
|
61529
|
+
fs139.writeFileSync(p, text, { encoding: "utf-8", mode: 384, flag: "wx" });
|
|
61530
|
+
},
|
|
61531
|
+
remove(p) {
|
|
61532
|
+
fs139.rmSync(p, { force: true, recursive: true });
|
|
61533
|
+
},
|
|
61534
|
+
tmpDir: () => fs139.mkdtempSync(path135.join(os28.tmpdir(), "self-hosted-probe-")),
|
|
61535
|
+
resolveKey(ref) {
|
|
61536
|
+
try {
|
|
61537
|
+
return resolve_api_key(ref);
|
|
61538
|
+
} catch {
|
|
61539
|
+
return null;
|
|
61540
|
+
}
|
|
61541
|
+
},
|
|
61542
|
+
env: process.env,
|
|
61543
|
+
home: os28.homedir(),
|
|
61544
|
+
now: () => Date.now(),
|
|
61545
|
+
sleep: (ms) => {
|
|
61546
|
+
Atomics.wait(_sleeper, 0, 0, ms);
|
|
61547
|
+
}
|
|
61548
|
+
};
|
|
61549
|
+
SELF_HOSTED_PROBE = makeMemoisedProbe(makeSelfHostedProbe(NODE_PROBE_DEPS), () => Date.now());
|
|
61550
|
+
}
|
|
61551
|
+
});
|
|
61552
|
+
|
|
61218
61553
|
// src/scripts/ai_council/status_surface.ts
|
|
61219
61554
|
function resolvedTransportFor(name, member, report2, contentClass) {
|
|
61220
61555
|
if (member.route !== void 0 && member.route !== null) {
|
|
@@ -61223,7 +61558,8 @@ function resolvedTransportFor(name, member, report2, contentClass) {
|
|
|
61223
61558
|
route: member.route,
|
|
61224
61559
|
model: member.model ?? "",
|
|
61225
61560
|
contentClass: contentClass ?? null,
|
|
61226
|
-
keyPresent: keyResolves(member.api_key_ref)
|
|
61561
|
+
keyPresent: keyResolves(member.api_key_ref),
|
|
61562
|
+
probe: SELF_HOSTED_PROBE
|
|
61227
61563
|
});
|
|
61228
61564
|
return { ...resolved, configuredMode: "api" };
|
|
61229
61565
|
}
|
|
@@ -61269,6 +61605,7 @@ var init_status_surface = __esm({
|
|
|
61269
61605
|
init_content_ceiling();
|
|
61270
61606
|
init_config();
|
|
61271
61607
|
init_free_route();
|
|
61608
|
+
init_self_hosted_probe();
|
|
61272
61609
|
init_transport_resolver();
|
|
61273
61610
|
NO_DISABLED_REASON = "disabled, no reason recorded";
|
|
61274
61611
|
}
|
|
@@ -61286,6 +61623,7 @@ var init_free_route_client = __esm({
|
|
|
61286
61623
|
FreeRouteClient = class extends ExternalAIClient {
|
|
61287
61624
|
base_url;
|
|
61288
61625
|
billing;
|
|
61626
|
+
content_ceiling;
|
|
61289
61627
|
_apiKey;
|
|
61290
61628
|
_post;
|
|
61291
61629
|
constructor(opts) {
|
|
@@ -61294,6 +61632,7 @@ var init_free_route_client = __esm({
|
|
|
61294
61632
|
this.model = opts.model;
|
|
61295
61633
|
this.base_url = opts.base_url.replace(/\/+$/, "");
|
|
61296
61634
|
this.billing = opts.billing;
|
|
61635
|
+
this.content_ceiling = opts.content_ceiling;
|
|
61297
61636
|
this.billable = opts.billing === "per-token";
|
|
61298
61637
|
this._apiKey = opts.api_key;
|
|
61299
61638
|
this._post = opts.post ?? curlJsonPost;
|
|
@@ -61352,15 +61691,187 @@ var init_free_route_client = __esm({
|
|
|
61352
61691
|
}
|
|
61353
61692
|
});
|
|
61354
61693
|
|
|
61694
|
+
// src/scripts/ai_council/free_route_catalog.ts
|
|
61695
|
+
import fs140 from "node:fs";
|
|
61696
|
+
import path136 from "node:path";
|
|
61697
|
+
import { pathToFileURL as pathToFileURL42 } from "node:url";
|
|
61698
|
+
function _storePath(repoRoot) {
|
|
61699
|
+
return path136.join(repoRoot, ROUTE_MODELS_RELPATH);
|
|
61700
|
+
}
|
|
61701
|
+
function _readStore(repoRoot) {
|
|
61702
|
+
try {
|
|
61703
|
+
const raw = JSON.parse(fs140.readFileSync(_storePath(repoRoot), "utf8"));
|
|
61704
|
+
return raw !== null && typeof raw === "object" && !Array.isArray(raw) ? raw : {};
|
|
61705
|
+
} catch {
|
|
61706
|
+
return {};
|
|
61707
|
+
}
|
|
61708
|
+
}
|
|
61709
|
+
function _writeStore(repoRoot, store) {
|
|
61710
|
+
const target = _storePath(repoRoot);
|
|
61711
|
+
fs140.mkdirSync(path136.dirname(target), { recursive: true });
|
|
61712
|
+
const tmp = `${target}.${process.pid}.tmp`;
|
|
61713
|
+
fs140.writeFileSync(tmp, `${JSON.stringify(store, null, 2)}
|
|
61714
|
+
`, "utf8");
|
|
61715
|
+
fs140.renameSync(tmp, target);
|
|
61716
|
+
}
|
|
61717
|
+
function readRouteRoster(repoRoot, routeKey) {
|
|
61718
|
+
const row = _readStore(repoRoot)[routeKey];
|
|
61719
|
+
if (row === void 0 || !Array.isArray(row.models)) return { status: "unknown", reason: "never discovered" };
|
|
61720
|
+
return { status: "known", models: row.models, observed_at: row.observed_at };
|
|
61721
|
+
}
|
|
61722
|
+
async function firstPartyIds(url, opts) {
|
|
61723
|
+
const res = await (opts.fetchImpl ?? fetch)(url, {
|
|
61724
|
+
headers: { accept: "application/json" },
|
|
61725
|
+
signal: AbortSignal.timeout(opts.timeoutMs ?? 15e3)
|
|
61726
|
+
});
|
|
61727
|
+
if (!res.ok) throw new Error(`first-party list HTTP ${res.status}`);
|
|
61728
|
+
const body = await res.json();
|
|
61729
|
+
if (!Array.isArray(body)) throw new Error("first-party list is not a list");
|
|
61730
|
+
const ids = /* @__PURE__ */ new Map();
|
|
61731
|
+
for (const m of body) {
|
|
61732
|
+
if (m === null || typeof m !== "object") continue;
|
|
61733
|
+
const e = m;
|
|
61734
|
+
if (e["community"] !== false) continue;
|
|
61735
|
+
const names = [e["name"], ...Array.isArray(e["aliases"]) ? e["aliases"] : []].filter((n) => typeof n === "string");
|
|
61736
|
+
const entry = new Set(names);
|
|
61737
|
+
for (const n of names) ids.set(n, entry);
|
|
61738
|
+
}
|
|
61739
|
+
return ids;
|
|
61740
|
+
}
|
|
61741
|
+
async function servedIdOf(baseUrl, model, opts) {
|
|
61742
|
+
try {
|
|
61743
|
+
const headers = { "content-type": "application/json", accept: "application/json" };
|
|
61744
|
+
if (opts.apiKey) headers["authorization"] = `Bearer ${opts.apiKey}`;
|
|
61745
|
+
const res = await (opts.fetchImpl ?? fetch)(`${baseUrl.replace(/\/+$/, "")}/chat/completions`, {
|
|
61746
|
+
method: "POST",
|
|
61747
|
+
headers,
|
|
61748
|
+
body: JSON.stringify({ model, max_tokens: 16, messages: [{ role: "user", content: "Reply with: ok" }] }),
|
|
61749
|
+
signal: AbortSignal.timeout(opts.timeoutMs ?? 15e3)
|
|
61750
|
+
});
|
|
61751
|
+
if (!res.ok) return "";
|
|
61752
|
+
const served = (await res.json()).model;
|
|
61753
|
+
return typeof served === "string" ? served : "";
|
|
61754
|
+
} catch {
|
|
61755
|
+
return "";
|
|
61756
|
+
}
|
|
61757
|
+
}
|
|
61758
|
+
async function discoverRouteModels(routeKey, baseUrl, opts) {
|
|
61759
|
+
const store = _readStore(opts.repoRoot);
|
|
61760
|
+
let models;
|
|
61761
|
+
try {
|
|
61762
|
+
const headers = { accept: "application/json" };
|
|
61763
|
+
if (opts.apiKey) headers["authorization"] = `Bearer ${opts.apiKey}`;
|
|
61764
|
+
const res = await (opts.fetchImpl ?? fetch)(`${baseUrl.replace(/\/+$/, "")}/models`, {
|
|
61765
|
+
headers,
|
|
61766
|
+
signal: AbortSignal.timeout(opts.timeoutMs ?? 15e3)
|
|
61767
|
+
});
|
|
61768
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
61769
|
+
const body = await res.json();
|
|
61770
|
+
if (!Array.isArray(body.data)) throw new Error("no data array in the /models answer");
|
|
61771
|
+
models = body.data.map((m) => m !== null && typeof m === "object" ? m["id"] : void 0).filter((id) => typeof id === "string" && id !== "");
|
|
61772
|
+
if (opts.firstPartyListUrl) {
|
|
61773
|
+
const fp = await firstPartyIds(opts.firstPartyListUrl, opts);
|
|
61774
|
+
const resolved = [];
|
|
61775
|
+
for (const id of models.filter((m) => fp.has(m))) {
|
|
61776
|
+
const aliases = fp.get(id);
|
|
61777
|
+
const served = aliases.size > 1 ? await servedIdOf(baseUrl, id, opts) : "";
|
|
61778
|
+
if (served === "" || served === id) resolved.push(id);
|
|
61779
|
+
else if (aliases.has(served)) resolved.push(served);
|
|
61780
|
+
}
|
|
61781
|
+
models = [...new Set(resolved)];
|
|
61782
|
+
}
|
|
61783
|
+
} catch (exc) {
|
|
61784
|
+
if (routeKey in store) {
|
|
61785
|
+
delete store[routeKey];
|
|
61786
|
+
_writeStore(opts.repoRoot, store);
|
|
61787
|
+
}
|
|
61788
|
+
return { status: "unknown", reason: exc instanceof Error ? exc.message : String(exc) };
|
|
61789
|
+
}
|
|
61790
|
+
const observed_at = (opts.now ?? /* @__PURE__ */ new Date()).toISOString();
|
|
61791
|
+
store[routeKey] = { base_url: baseUrl, models, observed_at };
|
|
61792
|
+
_writeStore(opts.repoRoot, store);
|
|
61793
|
+
return { status: "known", models, observed_at };
|
|
61794
|
+
}
|
|
61795
|
+
async function main45(argv, deps = {}) {
|
|
61796
|
+
const out = deps.stdout ?? ((line) => process.stdout.write(`${line}
|
|
61797
|
+
`));
|
|
61798
|
+
const [cmd, ...rest] = argv;
|
|
61799
|
+
const rootAt = rest.indexOf("--root");
|
|
61800
|
+
const rootArg = rootAt === -1 ? null : rest[rootAt + 1] ?? "";
|
|
61801
|
+
if (cmd !== "discover" || rootArg === "" || rest.length !== (rootAt === -1 ? 0 : 2)) {
|
|
61802
|
+
out(USAGE6);
|
|
61803
|
+
return 2;
|
|
61804
|
+
}
|
|
61805
|
+
const [repoRoot] = resolve_project_root(rootArg);
|
|
61806
|
+
let unknown = 0;
|
|
61807
|
+
for (const row of ROUTE_CATALOG) {
|
|
61808
|
+
if (row.first_party_list === void 0) continue;
|
|
61809
|
+
const roster = await discoverRouteModels(row.id, row.base_url, {
|
|
61810
|
+
repoRoot,
|
|
61811
|
+
firstPartyListUrl: row.first_party_list,
|
|
61812
|
+
...deps.fetchImpl ? { fetchImpl: deps.fetchImpl } : {},
|
|
61813
|
+
...deps.now ? { now: deps.now } : {}
|
|
61814
|
+
});
|
|
61815
|
+
if (roster.status === "known") {
|
|
61816
|
+
out(`${row.id}: known (${roster.models.length} first-party models, observed ${roster.observed_at})`);
|
|
61817
|
+
} else {
|
|
61818
|
+
unknown += 1;
|
|
61819
|
+
out(`${row.id}: unknown (${roster.reason})`);
|
|
61820
|
+
}
|
|
61821
|
+
}
|
|
61822
|
+
out(`roster: ${path136.join(repoRoot, ROUTE_MODELS_RELPATH)}`);
|
|
61823
|
+
return unknown === 0 ? 0 : 1;
|
|
61824
|
+
}
|
|
61825
|
+
var ROUTE_CATALOG, ROUTE_MODELS_RELPATH, USAGE6;
|
|
61826
|
+
var init_free_route_catalog = __esm({
|
|
61827
|
+
"src/scripts/ai_council/free_route_catalog.ts"() {
|
|
61828
|
+
"use strict";
|
|
61829
|
+
init_agent_settings();
|
|
61830
|
+
init_free_route();
|
|
61831
|
+
ROUTE_CATALOG = [
|
|
61832
|
+
{
|
|
61833
|
+
id: "pollinations",
|
|
61834
|
+
base_url: "https://text.pollinations.ai/openai",
|
|
61835
|
+
keyless: true,
|
|
61836
|
+
first_party_list: "https://text.pollinations.ai/models",
|
|
61837
|
+
attestation: {
|
|
61838
|
+
checked: "2026-10-22",
|
|
61839
|
+
source_url: "https://pollinations.ai/privacy",
|
|
61840
|
+
trains_on_prompts: false,
|
|
61841
|
+
retention: "prompts and outputs processed transiently, with short-lived response caches; the selected model's inference host sets its own retention",
|
|
61842
|
+
client_distribution_eea_ch_uk: "unknown"
|
|
61843
|
+
}
|
|
61844
|
+
},
|
|
61845
|
+
{ id: "groq", base_url: "https://api.groq.com/openai/v1", keyless: false, attestation: null },
|
|
61846
|
+
{ id: "cerebras", base_url: "https://api.cerebras.ai/v1", keyless: false, attestation: null },
|
|
61847
|
+
{ id: "openrouter", base_url: "https://openrouter.ai/api/v1", keyless: false, attestation: null },
|
|
61848
|
+
{ id: "huggingface", base_url: "https://router.huggingface.co/v1", keyless: false, attestation: null },
|
|
61849
|
+
{ id: "nvidia", base_url: "https://integrate.api.nvidia.com/v1", keyless: false, attestation: null }
|
|
61850
|
+
];
|
|
61851
|
+
ROUTE_MODELS_RELPATH = path136.join("agents", "runtime", "state", "council-route-models.json");
|
|
61852
|
+
USAGE6 = "usage: free_route_catalog discover [--root <dir>]";
|
|
61853
|
+
if (process.argv[1] !== void 0 && import.meta.url === pathToFileURL42(path136.resolve(process.argv[1])).href) {
|
|
61854
|
+
void main45(process.argv.slice(2)).then((code) => process.exit(code));
|
|
61855
|
+
}
|
|
61856
|
+
}
|
|
61857
|
+
});
|
|
61858
|
+
|
|
61355
61859
|
// src/scripts/ai_council/route_member.ts
|
|
61356
|
-
function routeMemberFor(name, cfg, contentClass, modelOverride, probe =
|
|
61860
|
+
function routeMemberFor(name, cfg, contentClass, modelOverride, probe = SELF_HOSTED_PROBE, stateRoot, now2 = /* @__PURE__ */ new Date()) {
|
|
61357
61861
|
const parsed = parseRouteFields(name, cfg, Object.hasOwn(PROVIDER_TABLE, name));
|
|
61358
61862
|
if ("error" in parsed) return { absent: { member: name, reason: "policy_unknown", detail: parsed.error } };
|
|
61359
61863
|
const route = parsed.route;
|
|
61360
61864
|
if (route === null) return null;
|
|
61361
61865
|
const model = modelOverride || (typeof cfg["model"] === "string" ? cfg["model"] : "");
|
|
61866
|
+
const gate = firstPartyGate(route.base_url, model, stateRoot ?? resolve_project_root(null)[0], now2);
|
|
61867
|
+
if (gate !== null) return { absent: { member: name, reason: "policy_model_mismatch", detail: gate } };
|
|
61362
61868
|
const ref = typeof cfg["api_key_ref"] === "string" ? cfg["api_key_ref"] : null;
|
|
61363
|
-
|
|
61869
|
+
let probed;
|
|
61870
|
+
const keyedProbe = (r, m) => {
|
|
61871
|
+
const withKey = { ...r, api_key_ref: ref };
|
|
61872
|
+
return probed = probe(withKey, m);
|
|
61873
|
+
};
|
|
61874
|
+
const t = resolveRouteTransport({ name, route, model, contentClass, keyPresent: keyResolves(ref), probe: keyedProbe });
|
|
61364
61875
|
if (!t.available) {
|
|
61365
61876
|
return { absent: { member: name, reason: t.absentReason ?? "unavailable", detail: t.reason ?? "route unavailable" } };
|
|
61366
61877
|
}
|
|
@@ -61370,18 +61881,54 @@ function routeMemberFor(name, cfg, contentClass, modelOverride, probe = UNPROVEN
|
|
|
61370
61881
|
model,
|
|
61371
61882
|
base_url: route.base_url,
|
|
61372
61883
|
api_key: ref === null ? null : resolve_api_key(ref, `ai_council.members.${name}`),
|
|
61373
|
-
billing: t.billing
|
|
61884
|
+
billing: t.billing,
|
|
61885
|
+
content_ceiling: routeCeiling(route, probed)
|
|
61374
61886
|
})
|
|
61375
61887
|
};
|
|
61376
61888
|
}
|
|
61889
|
+
function stampSeatCeilings(members, membersCfg) {
|
|
61890
|
+
for (const m of members) {
|
|
61891
|
+
const seat = m;
|
|
61892
|
+
if (m instanceof FreeRouteClient || seat["content_ceiling"] !== void 0) continue;
|
|
61893
|
+
const cfg = membersCfg[m.name];
|
|
61894
|
+
const declared = typeof cfg === "object" && cfg !== null ? cfg["content_ceiling"] : void 0;
|
|
61895
|
+
seat["content_ceiling"] = classifyContentClass(declared, DEFAULT_SEAT_CEILING);
|
|
61896
|
+
}
|
|
61897
|
+
}
|
|
61898
|
+
function firstPartyGate(baseUrl, model, stateRoot, now2) {
|
|
61899
|
+
const key = routeIdentity(baseUrl);
|
|
61900
|
+
const row = ROUTE_CATALOG.find((r) => r.first_party_list !== void 0 && routeIdentity(r.base_url) === key);
|
|
61901
|
+
if (row === void 0) return null;
|
|
61902
|
+
const roster = readRouteRoster(stateRoot, row.id);
|
|
61903
|
+
if (roster.status !== "known") return `${row.id}: no discovered first-party roster (${roster.reason})`;
|
|
61904
|
+
if (now2.getTime() - Date.parse(roster.observed_at) > FIRST_PARTY_ROSTER_MAX_AGE_MS) {
|
|
61905
|
+
return `${row.id}: first-party roster from ${roster.observed_at} is older than a day`;
|
|
61906
|
+
}
|
|
61907
|
+
if (!roster.models.includes(model)) return `${row.id}: ${model} is not in the route's first-party roster`;
|
|
61908
|
+
return null;
|
|
61909
|
+
}
|
|
61910
|
+
function routeIdentity(url) {
|
|
61911
|
+
try {
|
|
61912
|
+
const u = new URL(url);
|
|
61913
|
+
return `${u.host}${u.pathname.replace(/\/+$/, "")}`;
|
|
61914
|
+
} catch {
|
|
61915
|
+
return url.trim().toLowerCase().replace(/\/+$/, "");
|
|
61916
|
+
}
|
|
61917
|
+
}
|
|
61918
|
+
var FIRST_PARTY_ROSTER_MAX_AGE_MS;
|
|
61377
61919
|
var init_route_member = __esm({
|
|
61378
61920
|
"src/scripts/ai_council/route_member.ts"() {
|
|
61379
61921
|
"use strict";
|
|
61922
|
+
init_agent_settings();
|
|
61380
61923
|
init_environment_detector();
|
|
61381
61924
|
init_config();
|
|
61925
|
+
init_content_ceiling();
|
|
61382
61926
|
init_free_route_client();
|
|
61927
|
+
init_free_route_catalog();
|
|
61383
61928
|
init_free_route();
|
|
61929
|
+
init_self_hosted_probe();
|
|
61384
61930
|
init_status_surface();
|
|
61931
|
+
FIRST_PARTY_ROSTER_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
61385
61932
|
}
|
|
61386
61933
|
});
|
|
61387
61934
|
|
|
@@ -61840,15 +62387,15 @@ var init_qualification = __esm({
|
|
|
61840
62387
|
});
|
|
61841
62388
|
|
|
61842
62389
|
// src/scripts/ai_council/probe_store.ts
|
|
61843
|
-
import
|
|
61844
|
-
import
|
|
62390
|
+
import fs141 from "node:fs";
|
|
62391
|
+
import path137 from "node:path";
|
|
61845
62392
|
function probeStorePath(root) {
|
|
61846
|
-
return
|
|
62393
|
+
return path137.join(root, PROBE_STORE_RELPATH);
|
|
61847
62394
|
}
|
|
61848
62395
|
function readProbeStore(root) {
|
|
61849
62396
|
let raw;
|
|
61850
62397
|
try {
|
|
61851
|
-
raw =
|
|
62398
|
+
raw = fs141.readFileSync(probeStorePath(root), "utf8");
|
|
61852
62399
|
} catch {
|
|
61853
62400
|
return EMPTY;
|
|
61854
62401
|
}
|
|
@@ -61898,8 +62445,8 @@ function recordProbes(root, entries) {
|
|
|
61898
62445
|
members[e.name] = { at: e.at, outcome: e.outcome };
|
|
61899
62446
|
}
|
|
61900
62447
|
const target = probeStorePath(root);
|
|
61901
|
-
|
|
61902
|
-
|
|
62448
|
+
fs141.mkdirSync(path137.dirname(target), { recursive: true });
|
|
62449
|
+
fs141.writeFileSync(target, `${JSON.stringify({ schema: 1, members }, null, 2)}
|
|
61903
62450
|
`, "utf8");
|
|
61904
62451
|
} catch {
|
|
61905
62452
|
}
|
|
@@ -61913,7 +62460,7 @@ var init_probe_store = __esm({
|
|
|
61913
62460
|
"use strict";
|
|
61914
62461
|
init_env_kill_switch();
|
|
61915
62462
|
_KILL_SWITCH_ENV2 = "AGENT_CONFIG_NO_EVENTS_LOG";
|
|
61916
|
-
PROBE_STORE_RELPATH =
|
|
62463
|
+
PROBE_STORE_RELPATH = path137.join("agents", "runtime", "state", "council-probes.json");
|
|
61917
62464
|
EMPTY = { schema: 1, members: {} };
|
|
61918
62465
|
VALID_OUTCOMES = /* @__PURE__ */ new Set([
|
|
61919
62466
|
"ok",
|
|
@@ -62055,6 +62602,11 @@ function synthesizeAiCouncilBlock(cfg) {
|
|
|
62055
62602
|
if (m.prompt_cache_ttl !== "5m") {
|
|
62056
62603
|
entry["prompt_cache_ttl"] = m.prompt_cache_ttl;
|
|
62057
62604
|
}
|
|
62605
|
+
if (m.route) {
|
|
62606
|
+
entry["base_url"] = m.route.base_url;
|
|
62607
|
+
entry["content_ceiling"] = m.route.declared_ceiling;
|
|
62608
|
+
if (m.route.proof !== null) entry["billing_proof"] = { ...m.route.proof };
|
|
62609
|
+
}
|
|
62058
62610
|
members[name] = entry;
|
|
62059
62611
|
}
|
|
62060
62612
|
const advisors = {};
|
|
@@ -62217,10 +62769,10 @@ var init_council_fallback_posture = __esm({
|
|
|
62217
62769
|
});
|
|
62218
62770
|
|
|
62219
62771
|
// src/scripts/_lib/billing_grant.ts
|
|
62220
|
-
import * as
|
|
62221
|
-
import * as
|
|
62772
|
+
import * as fs142 from "node:fs";
|
|
62773
|
+
import * as path138 from "node:path";
|
|
62222
62774
|
function grantFile(repoRoot, runId) {
|
|
62223
|
-
return
|
|
62775
|
+
return path138.join(
|
|
62224
62776
|
repoRoot,
|
|
62225
62777
|
BILLING_GRANT_DIR_REL,
|
|
62226
62778
|
`${runId.replace(/[^A-Za-z0-9_-]/g, "_")}.json`
|
|
@@ -62231,8 +62783,8 @@ function issueBillingGrant(repoRoot, runId, now2 = () => /* @__PURE__ */ new Dat
|
|
|
62231
62783
|
const existing = _read2(file);
|
|
62232
62784
|
if (existing !== null && existing.run_id === runId) return existing;
|
|
62233
62785
|
const grant = { run_id: runId, issued_at: now2().toISOString() };
|
|
62234
|
-
|
|
62235
|
-
|
|
62786
|
+
fs142.mkdirSync(path138.dirname(file), { recursive: true });
|
|
62787
|
+
fs142.writeFileSync(file, `${JSON.stringify(grant, null, 2)}
|
|
62236
62788
|
`, "utf8");
|
|
62237
62789
|
return grant;
|
|
62238
62790
|
}
|
|
@@ -62250,13 +62802,13 @@ function hasBillingGrant(repoRoot, env = process.env, now2 = () => /* @__PURE__
|
|
|
62250
62802
|
}
|
|
62251
62803
|
function revokeBillingGrant(repoRoot, runId) {
|
|
62252
62804
|
try {
|
|
62253
|
-
|
|
62805
|
+
fs142.unlinkSync(grantFile(repoRoot, runId));
|
|
62254
62806
|
} catch {
|
|
62255
62807
|
}
|
|
62256
62808
|
}
|
|
62257
62809
|
function _read2(file) {
|
|
62258
62810
|
try {
|
|
62259
|
-
const raw = JSON.parse(
|
|
62811
|
+
const raw = JSON.parse(fs142.readFileSync(file, "utf8"));
|
|
62260
62812
|
if (raw === null || typeof raw !== "object") return null;
|
|
62261
62813
|
const o = raw;
|
|
62262
62814
|
if (typeof o.run_id !== "string" || typeof o.issued_at !== "string") return null;
|
|
@@ -62277,7 +62829,7 @@ var init_billing_grant = __esm({
|
|
|
62277
62829
|
"src/scripts/_lib/billing_grant.ts"() {
|
|
62278
62830
|
"use strict";
|
|
62279
62831
|
BILLING_GRANT_ENV = "AC_BILLING_GRANT";
|
|
62280
|
-
BILLING_GRANT_DIR_REL =
|
|
62832
|
+
BILLING_GRANT_DIR_REL = path138.join("agents", "runtime", "billing-grants");
|
|
62281
62833
|
BILLING_GRANT_MAX_AGE_MS = 24 * 60 * 60 * 1e3;
|
|
62282
62834
|
}
|
|
62283
62835
|
});
|
|
@@ -62431,7 +62983,7 @@ __export(low_impact_corpus_exports, {
|
|
|
62431
62983
|
load_validated_phrases: () => load_validated_phrases,
|
|
62432
62984
|
parse_corpus_strict: () => parse_corpus_strict
|
|
62433
62985
|
});
|
|
62434
|
-
import * as
|
|
62986
|
+
import * as fs143 from "node:fs";
|
|
62435
62987
|
function _entry(phrase, normalised, section, line_no, trailing_metadata = "") {
|
|
62436
62988
|
return { phrase, normalised, section, line_no, trailing_metadata };
|
|
62437
62989
|
}
|
|
@@ -62604,10 +63156,10 @@ function _checkHeadingDrift(text, title) {
|
|
|
62604
63156
|
}
|
|
62605
63157
|
function parse_corpus_strict(corpusPath) {
|
|
62606
63158
|
const p = corpusPath;
|
|
62607
|
-
if (!
|
|
63159
|
+
if (!fs143.existsSync(p)) {
|
|
62608
63160
|
return new CorpusParseResult();
|
|
62609
63161
|
}
|
|
62610
|
-
const text =
|
|
63162
|
+
const text = fs143.readFileSync(p, { encoding: "utf-8" });
|
|
62611
63163
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
62612
63164
|
const resultSections = {
|
|
62613
63165
|
validated: [],
|
|
@@ -62670,10 +63222,10 @@ function load_anti_example_phrases(corpusPath) {
|
|
|
62670
63222
|
}
|
|
62671
63223
|
function load_corpus_lock(yamlPath) {
|
|
62672
63224
|
const p = yamlPath;
|
|
62673
|
-
if (!
|
|
63225
|
+
if (!fs143.existsSync(p)) {
|
|
62674
63226
|
return new CorpusParseResult();
|
|
62675
63227
|
}
|
|
62676
|
-
const parsed = (0, import_yaml13.parse)(
|
|
63228
|
+
const parsed = (0, import_yaml13.parse)(fs143.readFileSync(p, { encoding: "utf-8" }), { version: "1.1" });
|
|
62677
63229
|
const doc = parsed === null || parsed === void 0 ? {} : parsed;
|
|
62678
63230
|
const schemaVersion = doc["schema_version"];
|
|
62679
63231
|
if (schemaVersion !== 1) {
|
|
@@ -62735,7 +63287,7 @@ function _deriveLockPath(corpusPath) {
|
|
|
62735
63287
|
}
|
|
62736
63288
|
function _loadSectionFromLock(corpusPath, section) {
|
|
62737
63289
|
const lockPath = _deriveLockPath(corpusPath);
|
|
62738
|
-
if (!
|
|
63290
|
+
if (!fs143.existsSync(lockPath)) {
|
|
62739
63291
|
return null;
|
|
62740
63292
|
}
|
|
62741
63293
|
try {
|
|
@@ -62747,10 +63299,10 @@ function _loadSectionFromLock(corpusPath, section) {
|
|
|
62747
63299
|
}
|
|
62748
63300
|
function _loadSectionLenient(corpusPath, section) {
|
|
62749
63301
|
const p = corpusPath;
|
|
62750
|
-
if (!
|
|
63302
|
+
if (!fs143.existsSync(p)) {
|
|
62751
63303
|
return [];
|
|
62752
63304
|
}
|
|
62753
|
-
const text =
|
|
63305
|
+
const text = fs143.readFileSync(p, { encoding: "utf-8" });
|
|
62754
63306
|
const allTitles = _SECTION_KEYS.map((k) => _SECTION_TITLES[k]);
|
|
62755
63307
|
const bounds = _sectionBounds(text, _SECTION_TITLES[section], allTitles);
|
|
62756
63308
|
if (bounds === null) {
|
|
@@ -63882,8 +64434,8 @@ var init_consensus_round = __esm({
|
|
|
63882
64434
|
|
|
63883
64435
|
// src/scripts/ai_council/budget_guard.ts
|
|
63884
64436
|
import { randomUUID as randomUUID2 } from "node:crypto";
|
|
63885
|
-
import * as
|
|
63886
|
-
import * as
|
|
64437
|
+
import * as fs144 from "node:fs";
|
|
64438
|
+
import * as path139 from "node:path";
|
|
63887
64439
|
function _resolveLedgerPath(p) {
|
|
63888
64440
|
if (p !== null) {
|
|
63889
64441
|
return p;
|
|
@@ -63898,18 +64450,18 @@ function _nowUtcMs() {
|
|
|
63898
64450
|
return Date.now();
|
|
63899
64451
|
}
|
|
63900
64452
|
function _ensureLedgerDir(p) {
|
|
63901
|
-
const parent =
|
|
64453
|
+
const parent = path139.dirname(p);
|
|
63902
64454
|
try {
|
|
63903
|
-
|
|
64455
|
+
fs144.mkdirSync(parent, { recursive: true });
|
|
63904
64456
|
let mode;
|
|
63905
64457
|
try {
|
|
63906
|
-
mode =
|
|
64458
|
+
mode = fs144.statSync(parent).mode & 511;
|
|
63907
64459
|
} catch {
|
|
63908
64460
|
mode = 448;
|
|
63909
64461
|
}
|
|
63910
64462
|
if (mode !== 448) {
|
|
63911
64463
|
try {
|
|
63912
|
-
|
|
64464
|
+
fs144.chmodSync(parent, 448);
|
|
63913
64465
|
} catch {
|
|
63914
64466
|
}
|
|
63915
64467
|
}
|
|
@@ -63921,18 +64473,18 @@ function _ensureLedgerDir(p) {
|
|
|
63921
64473
|
}
|
|
63922
64474
|
}
|
|
63923
64475
|
function _ensureLedgerFileMode(p) {
|
|
63924
|
-
if (!
|
|
64476
|
+
if (!fs144.existsSync(p)) {
|
|
63925
64477
|
return;
|
|
63926
64478
|
}
|
|
63927
64479
|
let current2;
|
|
63928
64480
|
try {
|
|
63929
|
-
current2 =
|
|
64481
|
+
current2 = fs144.statSync(p).mode & 511;
|
|
63930
64482
|
} catch {
|
|
63931
64483
|
return;
|
|
63932
64484
|
}
|
|
63933
64485
|
if (current2 !== 384) {
|
|
63934
64486
|
try {
|
|
63935
|
-
|
|
64487
|
+
fs144.chmodSync(p, 384);
|
|
63936
64488
|
} catch {
|
|
63937
64489
|
}
|
|
63938
64490
|
}
|
|
@@ -64093,11 +64645,11 @@ function pyNumToStr(n) {
|
|
|
64093
64645
|
}
|
|
64094
64646
|
function read_entries2(p = null) {
|
|
64095
64647
|
const resolved = _resolveLedgerPath(p);
|
|
64096
|
-
if (!
|
|
64648
|
+
if (!fs144.existsSync(resolved)) {
|
|
64097
64649
|
return [];
|
|
64098
64650
|
}
|
|
64099
64651
|
const out = [];
|
|
64100
|
-
const text =
|
|
64652
|
+
const text = fs144.readFileSync(resolved, "utf-8");
|
|
64101
64653
|
for (const rawLine of text.split(/\r\n|\r|\n/u)) {
|
|
64102
64654
|
const line = rawLine.trim();
|
|
64103
64655
|
if (line === "") {
|
|
@@ -64227,7 +64779,7 @@ function record_spend(usd, provider, model, options = {}) {
|
|
|
64227
64779
|
)}
|
|
64228
64780
|
`;
|
|
64229
64781
|
try {
|
|
64230
|
-
|
|
64782
|
+
fs144.appendFileSync(p, entry, { encoding: "utf-8" });
|
|
64231
64783
|
} catch (exc) {
|
|
64232
64784
|
process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
|
|
64233
64785
|
`);
|
|
@@ -64257,12 +64809,12 @@ function _withLedgerLock(p, waitMs, fn) {
|
|
|
64257
64809
|
let fd = null;
|
|
64258
64810
|
while (fd === null) {
|
|
64259
64811
|
try {
|
|
64260
|
-
fd =
|
|
64812
|
+
fd = fs144.openSync(lockPath, "wx", 384);
|
|
64261
64813
|
break;
|
|
64262
64814
|
} catch {
|
|
64263
64815
|
try {
|
|
64264
|
-
if (Date.now() -
|
|
64265
|
-
|
|
64816
|
+
if (Date.now() - fs144.statSync(lockPath).mtimeMs > RESERVATION_LOCK_STALE_MS) {
|
|
64817
|
+
fs144.unlinkSync(lockPath);
|
|
64266
64818
|
}
|
|
64267
64819
|
} catch {
|
|
64268
64820
|
}
|
|
@@ -64275,16 +64827,16 @@ function _withLedgerLock(p, waitMs, fn) {
|
|
|
64275
64827
|
try {
|
|
64276
64828
|
return fn();
|
|
64277
64829
|
} finally {
|
|
64278
|
-
|
|
64830
|
+
fs144.closeSync(fd);
|
|
64279
64831
|
try {
|
|
64280
|
-
|
|
64832
|
+
fs144.unlinkSync(lockPath);
|
|
64281
64833
|
} catch {
|
|
64282
64834
|
}
|
|
64283
64835
|
}
|
|
64284
64836
|
}
|
|
64285
64837
|
function _appendLine(p, line) {
|
|
64286
64838
|
try {
|
|
64287
|
-
|
|
64839
|
+
fs144.appendFileSync(p, `${line}
|
|
64288
64840
|
`, { encoding: "utf-8" });
|
|
64289
64841
|
} catch (exc) {
|
|
64290
64842
|
process.stderr.write(`[council:budget_guard] write failed: ${_errStr(exc)}
|
|
@@ -65200,16 +65752,13 @@ ${STANCE_LINE_CONTRACT}`,
|
|
|
65200
65752
|
});
|
|
65201
65753
|
const seat = member;
|
|
65202
65754
|
if (seat.lastSession !== void 0) seat.resumeNext = seat.lastSession;
|
|
65203
|
-
|
|
65204
|
-
|
|
65205
|
-
on_overrun,
|
|
65206
|
-
|
|
65207
|
-
|
|
65208
|
-
|
|
65209
|
-
|
|
65210
|
-
fallback_ledger,
|
|
65211
|
-
fallback_twins
|
|
65212
|
-
});
|
|
65755
|
+
let rr;
|
|
65756
|
+
try {
|
|
65757
|
+
const round = { table, on_overrun, project, original_ask, advisor_plans, cli_fallback, fallback_ledger, fallback_twins };
|
|
65758
|
+
rr = _run_round([member], repairQ, resolvedBudget, spent, round);
|
|
65759
|
+
} finally {
|
|
65760
|
+
if (seat.resumeNext !== void 0) seat.resumeNext = null;
|
|
65761
|
+
}
|
|
65213
65762
|
const rep = rr[0];
|
|
65214
65763
|
if (rep !== void 0) {
|
|
65215
65764
|
opts.on_stance_repair_result?.(rep);
|
|
@@ -66145,18 +66694,18 @@ __export(project_context_exports, {
|
|
|
66145
66694
|
REPO_PURPOSE_MAX_CHARS: () => REPO_PURPOSE_MAX_CHARS,
|
|
66146
66695
|
detect_project_context: () => detect_project_context
|
|
66147
66696
|
});
|
|
66148
|
-
import * as
|
|
66149
|
-
import * as
|
|
66697
|
+
import * as fs145 from "node:fs";
|
|
66698
|
+
import * as path140 from "node:path";
|
|
66150
66699
|
function _isPlainObject11(v) {
|
|
66151
66700
|
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
66152
66701
|
}
|
|
66153
66702
|
function _read_json2(p) {
|
|
66154
|
-
if (!
|
|
66703
|
+
if (!fs145.existsSync(p)) {
|
|
66155
66704
|
return null;
|
|
66156
66705
|
}
|
|
66157
66706
|
let raw;
|
|
66158
66707
|
try {
|
|
66159
|
-
raw =
|
|
66708
|
+
raw = fs145.readFileSync(p, "utf-8");
|
|
66160
66709
|
} catch {
|
|
66161
66710
|
return null;
|
|
66162
66711
|
}
|
|
@@ -66178,7 +66727,7 @@ function _name_from(composer, pkg, root) {
|
|
|
66178
66727
|
}
|
|
66179
66728
|
}
|
|
66180
66729
|
try {
|
|
66181
|
-
const base =
|
|
66730
|
+
const base = path140.basename(root);
|
|
66182
66731
|
return base || null;
|
|
66183
66732
|
} catch {
|
|
66184
66733
|
return null;
|
|
@@ -66247,12 +66796,12 @@ function _splitlines12(text) {
|
|
|
66247
66796
|
return parts;
|
|
66248
66797
|
}
|
|
66249
66798
|
function _purpose_from_readme(p) {
|
|
66250
|
-
if (!
|
|
66799
|
+
if (!fs145.existsSync(p)) {
|
|
66251
66800
|
return null;
|
|
66252
66801
|
}
|
|
66253
66802
|
let text;
|
|
66254
66803
|
try {
|
|
66255
|
-
text =
|
|
66804
|
+
text = fs145.readFileSync(p, "utf-8");
|
|
66256
66805
|
} catch {
|
|
66257
66806
|
return null;
|
|
66258
66807
|
}
|
|
@@ -66336,13 +66885,13 @@ function _rfind(haystack, needle) {
|
|
|
66336
66885
|
return -1;
|
|
66337
66886
|
}
|
|
66338
66887
|
function detect_project_context(root) {
|
|
66339
|
-
const resolvedRoot =
|
|
66340
|
-
const composer = _read_json2(
|
|
66341
|
-
const pkg = _read_json2(
|
|
66888
|
+
const resolvedRoot = path140.resolve(root ?? process.cwd());
|
|
66889
|
+
const composer = _read_json2(path140.join(resolvedRoot, "composer.json"));
|
|
66890
|
+
const pkg = _read_json2(path140.join(resolvedRoot, "package.json"));
|
|
66342
66891
|
return new ProjectContext(
|
|
66343
66892
|
_name_from(composer, pkg, resolvedRoot),
|
|
66344
66893
|
_stack_from(composer, pkg),
|
|
66345
|
-
_purpose_from_readme(
|
|
66894
|
+
_purpose_from_readme(path140.join(resolvedRoot, "README.md"))
|
|
66346
66895
|
);
|
|
66347
66896
|
}
|
|
66348
66897
|
var REPO_PURPOSE_MAX_CHARS, _HEADING_RE, _BADGE_RE, _HTML_RE, ProjectContext;
|
|
@@ -66612,7 +67161,7 @@ __export(shadow_dispatch_exports, {
|
|
|
66612
67161
|
slo_banner: () => slo_banner,
|
|
66613
67162
|
slo_status: () => slo_status
|
|
66614
67163
|
});
|
|
66615
|
-
import * as
|
|
67164
|
+
import * as fs146 from "node:fs";
|
|
66616
67165
|
import { createHash as createHash25 } from "node:crypto";
|
|
66617
67166
|
function should_shadow(sampleRate, opts = {}) {
|
|
66618
67167
|
const rate = Math.max(0, Math.min(1, sampleRate));
|
|
@@ -66653,7 +67202,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
66653
67202
|
escalated,
|
|
66654
67203
|
escalation_reason: escalationReason
|
|
66655
67204
|
};
|
|
66656
|
-
|
|
67205
|
+
fs146.mkdirSync(_dirname2(logPath), { recursive: true });
|
|
66657
67206
|
const row = _pyJsonDumps2({
|
|
66658
67207
|
timestamp: decision.timestamp,
|
|
66659
67208
|
query_hash: decision.query_hash,
|
|
@@ -66663,7 +67212,7 @@ function record_shadow_decision(logPath, opts) {
|
|
|
66663
67212
|
escalated: decision.escalated,
|
|
66664
67213
|
escalation_reason: decision.escalation_reason
|
|
66665
67214
|
}) + "\n";
|
|
66666
|
-
|
|
67215
|
+
fs146.appendFileSync(logPath, row, { encoding: "utf-8" });
|
|
66667
67216
|
return decision;
|
|
66668
67217
|
}
|
|
66669
67218
|
function _isoNowSeconds() {
|
|
@@ -66672,10 +67221,10 @@ function _isoNowSeconds() {
|
|
|
66672
67221
|
return `${pad(d.getUTCFullYear(), 4)}-${pad(d.getUTCMonth() + 1)}-${pad(d.getUTCDate())}T${pad(d.getUTCHours())}:${pad(d.getUTCMinutes())}:${pad(d.getUTCSeconds())}+00:00`;
|
|
66673
67222
|
}
|
|
66674
67223
|
function* _iterLog(logPath) {
|
|
66675
|
-
if (!
|
|
67224
|
+
if (!fs146.existsSync(logPath)) {
|
|
66676
67225
|
return;
|
|
66677
67226
|
}
|
|
66678
|
-
const content =
|
|
67227
|
+
const content = fs146.readFileSync(logPath, { encoding: "utf-8" });
|
|
66679
67228
|
for (const rawLine of _splitlines13(content)) {
|
|
66680
67229
|
const line = _strip9(rawLine);
|
|
66681
67230
|
if (!line) {
|
|
@@ -67604,11 +68153,11 @@ __export(council_cli_exports, {
|
|
|
67604
68153
|
cmd_status: () => cmd_status,
|
|
67605
68154
|
format_estimate_table: () => format_estimate_table,
|
|
67606
68155
|
load_settings: () => load_settings,
|
|
67607
|
-
main: () =>
|
|
68156
|
+
main: () => main46
|
|
67608
68157
|
});
|
|
67609
|
-
import * as
|
|
67610
|
-
import * as
|
|
67611
|
-
import { fileURLToPath as fileURLToPath59, pathToFileURL as
|
|
68158
|
+
import * as fs147 from "node:fs";
|
|
68159
|
+
import * as path141 from "node:path";
|
|
68160
|
+
import { fileURLToPath as fileURLToPath59, pathToFileURL as pathToFileURL43 } from "node:url";
|
|
67612
68161
|
function _pyFixed6(x, ndigits) {
|
|
67613
68162
|
if (!Number.isFinite(x)) {
|
|
67614
68163
|
return String(x);
|
|
@@ -67816,7 +68365,7 @@ function _stderr2(s) {
|
|
|
67816
68365
|
function load_settings(p = SETTINGS_FILE3, opts = {}) {
|
|
67817
68366
|
const ai_council_path = opts.ai_council_path ?? AI_COUNCIL_FILE;
|
|
67818
68367
|
const settings = load_agent_settings({ project_path: p });
|
|
67819
|
-
if (
|
|
68368
|
+
if (fs147.existsSync(ai_council_path)) {
|
|
67820
68369
|
const cfg = load_council_config(ai_council_path);
|
|
67821
68370
|
settings["ai_council"] = synthesizeAiCouncilBlock(cfg);
|
|
67822
68371
|
}
|
|
@@ -68058,6 +68607,7 @@ function build_members(settings, opts = {}) {
|
|
|
68058
68607
|
`no council member has \`enabled: true\` \u2014 enable at least one under members.* in ${COUNCIL_CONFIG_USER_GLOBAL_REL} (user-global root; never the project tree, ADR-104). \`agent-config council:status\` prints the resolved path.`
|
|
68059
68608
|
);
|
|
68060
68609
|
}
|
|
68610
|
+
stampSeatCeilings(members, members_cfg);
|
|
68061
68611
|
wireCouncilFallback(fallback_out, ai, {
|
|
68062
68612
|
repoRoot: REPO_ROOT13,
|
|
68063
68613
|
isDict: _isDict4,
|
|
@@ -68193,7 +68743,7 @@ function build_question(opts) {
|
|
|
68193
68743
|
let ctx;
|
|
68194
68744
|
let artefact;
|
|
68195
68745
|
if (input_mode === "prompt") {
|
|
68196
|
-
const text =
|
|
68746
|
+
const text = fs147.readFileSync(input_path, "utf-8");
|
|
68197
68747
|
ctx = bundle_prompt(text);
|
|
68198
68748
|
artefact = String(input_path);
|
|
68199
68749
|
} else if (input_mode === "roadmap") {
|
|
@@ -68337,9 +68887,9 @@ function _maybe_write_decision_replay(opts) {
|
|
|
68337
68887
|
include_member_arguments: include_args
|
|
68338
68888
|
})
|
|
68339
68889
|
);
|
|
68340
|
-
const target =
|
|
68341
|
-
|
|
68342
|
-
|
|
68890
|
+
const target = path141.join(path141.dirname(opts.out_path), "decision-replay.md");
|
|
68891
|
+
fs147.mkdirSync(path141.dirname(target), { recursive: true });
|
|
68892
|
+
fs147.writeFileSync(target, replay, { encoding: "utf-8" });
|
|
68343
68893
|
return target;
|
|
68344
68894
|
}
|
|
68345
68895
|
function _peer_review_active(ai_cfg, args) {
|
|
@@ -68379,7 +68929,7 @@ function chairman_candidates(membersRaw) {
|
|
|
68379
68929
|
candidates.push({
|
|
68380
68930
|
name,
|
|
68381
68931
|
tier: typeof md["tier"] === "number" ? md["tier"] : null,
|
|
68382
|
-
...billing !== null ? { billing } : {}
|
|
68932
|
+
...billing !== null ? { billing, route: true } : {}
|
|
68383
68933
|
});
|
|
68384
68934
|
}
|
|
68385
68935
|
return candidates;
|
|
@@ -68442,12 +68992,13 @@ ${transcript}`;
|
|
|
68442
68992
|
user_prompt: synth_prompt,
|
|
68443
68993
|
max_tokens: question.max_tokens
|
|
68444
68994
|
});
|
|
68445
|
-
|
|
68446
|
-
|
|
68447
|
-
|
|
68448
|
-
original_ask: args.original_ask,
|
|
68449
|
-
|
|
68450
|
-
|
|
68995
|
+
if (client instanceof CliClient) client.blind = blind;
|
|
68996
|
+
let out;
|
|
68997
|
+
try {
|
|
68998
|
+
out = consult([client], synthQ, budget, { table, project, original_ask: args.original_ask, cli_fallback });
|
|
68999
|
+
} finally {
|
|
69000
|
+
if (client instanceof CliClient) client.blind = false;
|
|
69001
|
+
}
|
|
68451
69002
|
const r = out[0] ?? null;
|
|
68452
69003
|
if (r === null || r.error !== null || r.text.trim() === "") {
|
|
68453
69004
|
return {
|
|
@@ -69020,7 +69571,7 @@ function cmd_status(args, opts = {}) {
|
|
|
69020
69571
|
const env = opts.env ?? process.env;
|
|
69021
69572
|
const override = env[COUNCIL_CONFIG_ENV];
|
|
69022
69573
|
const path_ = resolve_config_path(REPO_ROOT13, { env });
|
|
69023
|
-
const exists3 =
|
|
69574
|
+
const exists3 = fs147.existsSync(String(path_));
|
|
69024
69575
|
const provenance = override ? `${COUNCIL_CONFIG_ENV} override` : "user-global";
|
|
69025
69576
|
let cfg = null;
|
|
69026
69577
|
let parse_error = null;
|
|
@@ -69494,8 +70045,8 @@ function cmd_run(args, opts = {}) {
|
|
|
69494
70045
|
kind: "responses",
|
|
69495
70046
|
subcommand: "run"
|
|
69496
70047
|
});
|
|
69497
|
-
|
|
69498
|
-
|
|
70048
|
+
fs147.mkdirSync(path141.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
70049
|
+
fs147.writeFileSync(_resolveTarget(out_path), _jsonDumpsIndent2(payload) + "\n", { encoding: "utf-8" });
|
|
69499
70050
|
const _all_subscription = allSeatsNonBillable(all_responses);
|
|
69500
70051
|
_stdout2(
|
|
69501
70052
|
`
|
|
@@ -69521,7 +70072,7 @@ function _debate_round_filename(round_number) {
|
|
|
69521
70072
|
return `debate-round-${round_number}.json`;
|
|
69522
70073
|
}
|
|
69523
70074
|
function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
69524
|
-
|
|
70075
|
+
fs147.mkdirSync(_resolveTarget(out_dir), { recursive: true });
|
|
69525
70076
|
const actual_total = sumBillableCost(responses, opts.table);
|
|
69526
70077
|
const payload = {
|
|
69527
70078
|
schema_version: SCHEMA_VERSION9,
|
|
@@ -69538,15 +70089,15 @@ function _write_debate_round(out_dir, round_number, responses, opts) {
|
|
|
69538
70089
|
prompt_cache_round_gap_ms: opts.cache_gap_ms_since_previous_round ?? null,
|
|
69539
70090
|
responses: serializeResponses(responses)
|
|
69540
70091
|
};
|
|
69541
|
-
const out_path =
|
|
69542
|
-
|
|
70092
|
+
const out_path = path141.join(_resolveTarget(out_dir), _debate_round_filename(round_number));
|
|
70093
|
+
fs147.writeFileSync(out_path, _jsonDumpsIndent2(payload) + "\n", { encoding: "utf-8" });
|
|
69543
70094
|
return out_path;
|
|
69544
70095
|
}
|
|
69545
70096
|
function _load_debate_seed(p, expected_members) {
|
|
69546
|
-
if (!
|
|
70097
|
+
if (!fs147.existsSync(p)) {
|
|
69547
70098
|
throw new FileNotFoundError3(`--continue-as-debate path not found: ${p}`);
|
|
69548
70099
|
}
|
|
69549
|
-
const payload = JSON.parse(
|
|
70100
|
+
const payload = JSON.parse(fs147.readFileSync(p, "utf-8"));
|
|
69550
70101
|
const source_members = (payload["members"] || []).slice();
|
|
69551
70102
|
const expected_labels = expected_members.map((m) => `${m.name}/${m.model}`);
|
|
69552
70103
|
if (!_listEq(source_members, expected_labels)) {
|
|
@@ -69592,7 +70143,7 @@ function _readStdinLine() {
|
|
|
69592
70143
|
try {
|
|
69593
70144
|
const buf = Buffer.alloc(4096);
|
|
69594
70145
|
const fd = 0;
|
|
69595
|
-
const n =
|
|
70146
|
+
const n = fs147.readSync(fd, buf, 0, buf.length, null);
|
|
69596
70147
|
return buf.toString("utf-8", 0, n).split("\n")[0]?.trim().toLowerCase() ?? "";
|
|
69597
70148
|
} catch {
|
|
69598
70149
|
return "";
|
|
@@ -69823,7 +70374,7 @@ council:debate \xB7 ${all_rounds.length} round(s) complete \xB7 actual $${_pyFix
|
|
|
69823
70374
|
return errors_last.length > 0 && errors_last.length === last.length ? 1 : 0;
|
|
69824
70375
|
}
|
|
69825
70376
|
function cmd_render(args) {
|
|
69826
|
-
const payload = JSON.parse(
|
|
70377
|
+
const payload = JSON.parse(fs147.readFileSync(args.responses, "utf-8"));
|
|
69827
70378
|
const items = payload["responses"] || [];
|
|
69828
70379
|
const explicit = _getattr3(args, "prompt_mode", null);
|
|
69829
70380
|
const mode = explicit || payload["prompt_mode"] || payload["mode"];
|
|
@@ -69852,8 +70403,8 @@ function cmd_render(args) {
|
|
|
69852
70403
|
kind: "sessions",
|
|
69853
70404
|
subcommand: "render"
|
|
69854
70405
|
});
|
|
69855
|
-
|
|
69856
|
-
|
|
70406
|
+
fs147.mkdirSync(path141.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
70407
|
+
fs147.writeFileSync(_resolveTarget(out_path), body + "\n", { encoding: "utf-8" });
|
|
69857
70408
|
_stdout2(`council:render \xB7 wrote ${out_path}
|
|
69858
70409
|
`);
|
|
69859
70410
|
return 0;
|
|
@@ -69864,15 +70415,15 @@ function cmd_render(args) {
|
|
|
69864
70415
|
function _cmd_replay_low_impact_stats(args) {
|
|
69865
70416
|
const li = low_impact_exports;
|
|
69866
70417
|
const responses_path = args.responses;
|
|
69867
|
-
const log_path =
|
|
69868
|
-
if (!
|
|
70418
|
+
const log_path = path141.join(path141.dirname(responses_path), "low-impact-resolutions.md");
|
|
70419
|
+
if (!fs147.existsSync(log_path)) {
|
|
69869
70420
|
_stdout2(
|
|
69870
70421
|
`council:replay \xB7 no low-impact-resolutions.md alongside ${responses_path} \u2014 session had no fast-path entries.
|
|
69871
70422
|
`
|
|
69872
70423
|
);
|
|
69873
70424
|
return 0;
|
|
69874
70425
|
}
|
|
69875
|
-
const body =
|
|
70426
|
+
const body = fs147.readFileSync(log_path, "utf-8");
|
|
69876
70427
|
const stats = li.parse_low_impact_log(body);
|
|
69877
70428
|
const out = li.render_low_impact_stats(stats);
|
|
69878
70429
|
if (_getattr3(args, "output", null)) {
|
|
@@ -69880,8 +70431,8 @@ function _cmd_replay_low_impact_stats(args) {
|
|
|
69880
70431
|
kind: "sessions",
|
|
69881
70432
|
subcommand: "replay"
|
|
69882
70433
|
});
|
|
69883
|
-
|
|
69884
|
-
|
|
70434
|
+
fs147.mkdirSync(path141.dirname(_resolveTarget(target)), { recursive: true });
|
|
70435
|
+
fs147.writeFileSync(_resolveTarget(target), out, { encoding: "utf-8" });
|
|
69885
70436
|
_stdout2(`council:replay \xB7 wrote ${target}
|
|
69886
70437
|
`);
|
|
69887
70438
|
return 0;
|
|
@@ -69893,7 +70444,7 @@ function cmd_replay(args) {
|
|
|
69893
70444
|
if (_getattr3(args, "low_impact_stats", false)) {
|
|
69894
70445
|
return _cmd_replay_low_impact_stats(args);
|
|
69895
70446
|
}
|
|
69896
|
-
const payload = JSON.parse(
|
|
70447
|
+
const payload = JSON.parse(fs147.readFileSync(args.responses, "utf-8"));
|
|
69897
70448
|
const consensus = _deserialise_consensus(payload["consensus"]);
|
|
69898
70449
|
if (consensus === null) {
|
|
69899
70450
|
_stderr2(
|
|
@@ -69918,8 +70469,8 @@ function cmd_replay(args) {
|
|
|
69918
70469
|
kind: "sessions",
|
|
69919
70470
|
subcommand: "replay"
|
|
69920
70471
|
});
|
|
69921
|
-
|
|
69922
|
-
|
|
70472
|
+
fs147.mkdirSync(path141.dirname(_resolveTarget(out_path)), { recursive: true });
|
|
70473
|
+
fs147.writeFileSync(_resolveTarget(out_path), body, { encoding: "utf-8" });
|
|
69923
70474
|
_stdout2(`council:replay \xB7 wrote ${out_path}
|
|
69924
70475
|
`);
|
|
69925
70476
|
} else {
|
|
@@ -69976,8 +70527,8 @@ function cmd_quota(args, opts = {}) {
|
|
|
69976
70527
|
}
|
|
69977
70528
|
function _validate_council_output_path(path_str, opts) {
|
|
69978
70529
|
const expected_rel = COUNCIL_CANONICAL_DIRS[opts.kind];
|
|
69979
|
-
const expected_abs = _resolveReal2(
|
|
69980
|
-
const target =
|
|
70530
|
+
const expected_abs = _resolveReal2(path141.join(REPO_ROOT13, expected_rel));
|
|
70531
|
+
const target = path141.isAbsolute(path_str) ? path_str : path141.join(REPO_ROOT13, path_str);
|
|
69981
70532
|
const target_resolved = _resolveReal2(target);
|
|
69982
70533
|
if (!_isRelativeTo(target_resolved, expected_abs)) {
|
|
69983
70534
|
throw new ArgumentTypeError(
|
|
@@ -69987,12 +70538,12 @@ function _validate_council_output_path(path_str, opts) {
|
|
|
69987
70538
|
return path_str;
|
|
69988
70539
|
}
|
|
69989
70540
|
function _resolveTarget(path_str) {
|
|
69990
|
-
return
|
|
70541
|
+
return path141.isAbsolute(path_str) ? path_str : path141.join(REPO_ROOT13, path_str);
|
|
69991
70542
|
}
|
|
69992
70543
|
function _resolveReal2(p) {
|
|
69993
|
-
const abs =
|
|
70544
|
+
const abs = path141.resolve(p);
|
|
69994
70545
|
try {
|
|
69995
|
-
return
|
|
70546
|
+
return fs147.realpathSync(abs);
|
|
69996
70547
|
} catch {
|
|
69997
70548
|
return abs;
|
|
69998
70549
|
}
|
|
@@ -70001,8 +70552,8 @@ function _isRelativeTo(target, base) {
|
|
|
70001
70552
|
if (target === base) {
|
|
70002
70553
|
return true;
|
|
70003
70554
|
}
|
|
70004
|
-
const rel2 =
|
|
70005
|
-
return rel2 !== "" && !rel2.startsWith("..") && !
|
|
70555
|
+
const rel2 = path141.relative(base, target);
|
|
70556
|
+
return rel2 !== "" && !rel2.startsWith("..") && !path141.isAbsolute(rel2);
|
|
70006
70557
|
}
|
|
70007
70558
|
function _topError(message) {
|
|
70008
70559
|
_stderr2(_TOP_USAGE2);
|
|
@@ -70327,7 +70878,7 @@ function _parse_siblings_overrides(items) {
|
|
|
70327
70878
|
function _isFileNotFound(exc) {
|
|
70328
70879
|
return exc instanceof FileNotFoundError3 || exc instanceof Error && exc.code === "ENOENT";
|
|
70329
70880
|
}
|
|
70330
|
-
function
|
|
70881
|
+
function main46(argv = null) {
|
|
70331
70882
|
const args = _parseArgs7(argv ?? process.argv.slice(2));
|
|
70332
70883
|
try {
|
|
70333
70884
|
if (args.cmd === "estimate") {
|
|
@@ -70375,13 +70926,13 @@ function _isCliEntry36() {
|
|
|
70375
70926
|
if (process.argv[1] === void 0) {
|
|
70376
70927
|
return false;
|
|
70377
70928
|
}
|
|
70378
|
-
const argvUrl =
|
|
70929
|
+
const argvUrl = pathToFileURL43(path141.resolve(process.argv[1])).href;
|
|
70379
70930
|
if (import.meta.url === argvUrl) {
|
|
70380
70931
|
return true;
|
|
70381
70932
|
}
|
|
70382
70933
|
try {
|
|
70383
|
-
const here =
|
|
70384
|
-
const argv =
|
|
70934
|
+
const here = fs147.realpathSync(fileURLToPath59(import.meta.url));
|
|
70935
|
+
const argv = fs147.realpathSync(path141.resolve(process.argv[1]));
|
|
70385
70936
|
return here === argv;
|
|
70386
70937
|
} catch {
|
|
70387
70938
|
return false;
|
|
@@ -70456,7 +71007,7 @@ var init_council_cli = __esm({
|
|
|
70456
71007
|
"xai",
|
|
70457
71008
|
"perplexity"
|
|
70458
71009
|
]);
|
|
70459
|
-
_HERE30 =
|
|
71010
|
+
_HERE30 = path141.dirname(fileURLToPath59(import.meta.url));
|
|
70460
71011
|
[REPO_ROOT13] = resolve_project_root(null);
|
|
70461
71012
|
SETTINGS_FILE3 = project_settings_path(REPO_ROOT13);
|
|
70462
71013
|
AI_COUNCIL_FILE = resolve_config_path(REPO_ROOT13);
|
|
@@ -70491,7 +71042,7 @@ var init_council_cli = __esm({
|
|
|
70491
71042
|
`;
|
|
70492
71043
|
if (_isCliEntry36()) {
|
|
70493
71044
|
try {
|
|
70494
|
-
process.exitCode =
|
|
71045
|
+
process.exitCode = main46(process.argv.slice(2));
|
|
70495
71046
|
} catch (err) {
|
|
70496
71047
|
if (!(err instanceof _ArgExit2)) {
|
|
70497
71048
|
throw err;
|
|
@@ -70564,7 +71115,7 @@ var init_safety_envelope = __esm({
|
|
|
70564
71115
|
});
|
|
70565
71116
|
|
|
70566
71117
|
// src/scripts/mcp_server/__main__.ts
|
|
70567
|
-
import * as
|
|
71118
|
+
import * as path143 from "node:path";
|
|
70568
71119
|
import { fileURLToPath as fileURLToPath61 } from "node:url";
|
|
70569
71120
|
|
|
70570
71121
|
// src/scripts/mcp_server/index.ts
|
|
@@ -70612,8 +71163,8 @@ init_prompts();
|
|
|
70612
71163
|
init_resources();
|
|
70613
71164
|
|
|
70614
71165
|
// src/scripts/mcp_server/tools.ts
|
|
70615
|
-
import * as
|
|
70616
|
-
import * as
|
|
71166
|
+
import * as fs148 from "node:fs";
|
|
71167
|
+
import * as path142 from "node:path";
|
|
70617
71168
|
import { fileURLToPath as fileURLToPath60 } from "node:url";
|
|
70618
71169
|
|
|
70619
71170
|
// src/scripts/chat_history.ts
|
|
@@ -74983,14 +75534,14 @@ function _resolveConsumerRoot(override) {
|
|
|
74983
75534
|
return resolvePath(process.cwd());
|
|
74984
75535
|
}
|
|
74985
75536
|
function _relativeUnder(target, root) {
|
|
74986
|
-
const rel2 =
|
|
75537
|
+
const rel2 = path142.relative(root, target);
|
|
74987
75538
|
if (rel2 === "") {
|
|
74988
75539
|
return "";
|
|
74989
75540
|
}
|
|
74990
|
-
if (rel2.startsWith("..") ||
|
|
75541
|
+
if (rel2.startsWith("..") || path142.isAbsolute(rel2)) {
|
|
74991
75542
|
return null;
|
|
74992
75543
|
}
|
|
74993
|
-
return rel2.split(
|
|
75544
|
+
return rel2.split(path142.sep).join("/");
|
|
74994
75545
|
}
|
|
74995
75546
|
function _reprStrList(values) {
|
|
74996
75547
|
return `[${values.map((v) => `'${v}'`).join(", ")}]`;
|
|
@@ -74999,11 +75550,11 @@ function _validateInTreePath(raw, consumerRoot) {
|
|
|
74999
75550
|
const root = resolvePath(consumerRoot);
|
|
75000
75551
|
let target;
|
|
75001
75552
|
if (raw === null || raw === void 0 || raw === "") {
|
|
75002
|
-
target =
|
|
75003
|
-
} else if (
|
|
75553
|
+
target = path142.join(root, "agents", "runtime", ".agent-chat-history");
|
|
75554
|
+
} else if (path142.isAbsolute(raw)) {
|
|
75004
75555
|
target = resolvePath(raw);
|
|
75005
75556
|
} else {
|
|
75006
|
-
target = resolvePath(
|
|
75557
|
+
target = resolvePath(path142.join(root, raw));
|
|
75007
75558
|
}
|
|
75008
75559
|
const rel2 = _relativeUnder(target, root);
|
|
75009
75560
|
if (rel2 === null) {
|
|
@@ -75041,11 +75592,11 @@ async function _lintSkillsHandler(args, consumerRoot) {
|
|
|
75041
75592
|
if (typeof raw !== "string") {
|
|
75042
75593
|
throw new Error("'paths' entries must be strings");
|
|
75043
75594
|
}
|
|
75044
|
-
const resolved =
|
|
75595
|
+
const resolved = path142.isAbsolute(raw) ? resolvePath(raw) : resolvePath(path142.join(root, raw));
|
|
75045
75596
|
if (_relativeUnder(resolved, root) === null) {
|
|
75046
75597
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
75047
75598
|
}
|
|
75048
|
-
if (
|
|
75599
|
+
if (fs148.existsSync(resolved)) {
|
|
75049
75600
|
paths.push(resolved);
|
|
75050
75601
|
}
|
|
75051
75602
|
}
|
|
@@ -75082,7 +75633,7 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
75082
75633
|
if (typeof minSchema !== "number" || !Number.isInteger(minSchema) || typeof minSchema === "boolean") {
|
|
75083
75634
|
throw new Error("'min_schema_version' must be an integer");
|
|
75084
75635
|
}
|
|
75085
|
-
const existingHeader =
|
|
75636
|
+
const existingHeader = fs148.existsSync(target) ? _chReadHeader(target) : null;
|
|
75086
75637
|
const observed = existingHeader !== null && typeof existingHeader === "object" ? _pyInt7(existingHeader.v ?? 0) : SCHEMA_VERSION3;
|
|
75087
75638
|
if (observed < minSchema) {
|
|
75088
75639
|
throw new Error(`chat-history schema ${observed} below required ${minSchema}`);
|
|
@@ -75097,8 +75648,8 @@ async function _chatHistoryAppendHandler(args, consumerRoot) {
|
|
|
75097
75648
|
session: session === void 0 ? null : session
|
|
75098
75649
|
};
|
|
75099
75650
|
}
|
|
75100
|
-
if (!
|
|
75101
|
-
|
|
75651
|
+
if (!fs148.existsSync(target) || _chReadHeader(target) === null) {
|
|
75652
|
+
fs148.mkdirSync(path142.dirname(target), { recursive: true });
|
|
75102
75653
|
_chInit(target);
|
|
75103
75654
|
}
|
|
75104
75655
|
_chAppend(entry, target, session ?? null);
|
|
@@ -75142,7 +75693,7 @@ async function _chatHistoryReadHandler(args, consumerRoot) {
|
|
|
75142
75693
|
if (detail !== "full" && detail !== "index") {
|
|
75143
75694
|
throw new Error("'detail' must be 'index' or 'full'");
|
|
75144
75695
|
}
|
|
75145
|
-
if (!
|
|
75696
|
+
if (!fs148.existsSync(target)) {
|
|
75146
75697
|
return { path: target, entries: [], count: 0 };
|
|
75147
75698
|
}
|
|
75148
75699
|
if (around !== void 0 && around !== null) {
|
|
@@ -75244,8 +75795,8 @@ async function _memoryStatusHandler(_args, consumerRoot) {
|
|
|
75244
75795
|
}
|
|
75245
75796
|
return result;
|
|
75246
75797
|
}
|
|
75247
|
-
var _PACKAGE_ROOT3 =
|
|
75248
|
-
|
|
75798
|
+
var _PACKAGE_ROOT3 = path142.resolve(
|
|
75799
|
+
path142.dirname(fileURLToPath60(import.meta.url)),
|
|
75249
75800
|
"..",
|
|
75250
75801
|
"..",
|
|
75251
75802
|
".."
|
|
@@ -75289,10 +75840,10 @@ async function _memorySignalHandler(args, consumerRoot) {
|
|
|
75289
75840
|
async function _roadmapProgressHandler(args, consumerRoot) {
|
|
75290
75841
|
const dryRun = _pyTruthy6(args.dry_run ?? false);
|
|
75291
75842
|
const root = resolvePath(consumerRoot);
|
|
75292
|
-
const roadmapRoot =
|
|
75293
|
-
const target =
|
|
75843
|
+
const roadmapRoot = path142.join(root, "agents", "roadmaps");
|
|
75844
|
+
const target = path142.join(root, "agents", "roadmaps-progress.md");
|
|
75294
75845
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
75295
|
-
if (!
|
|
75846
|
+
if (!fs148.existsSync(roadmapRoot)) {
|
|
75296
75847
|
return {
|
|
75297
75848
|
written: false,
|
|
75298
75849
|
path: target,
|
|
@@ -75307,7 +75858,7 @@ async function _roadmapProgressHandler(args, consumerRoot) {
|
|
|
75307
75858
|
const stepsDone = roadmaps.reduce((s, r) => s + r.done, 0);
|
|
75308
75859
|
const stepsTotal = roadmaps.reduce((s, r) => s + r.total_active, 0);
|
|
75309
75860
|
if (!dryRun) {
|
|
75310
|
-
|
|
75861
|
+
fs148.writeFileSync(target, content, "utf-8");
|
|
75311
75862
|
}
|
|
75312
75863
|
return {
|
|
75313
75864
|
written: !dryRun,
|
|
@@ -75328,11 +75879,11 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
75328
75879
|
let dashboardRegenerated = false;
|
|
75329
75880
|
if (archived.length > 0) {
|
|
75330
75881
|
const urp = await Promise.resolve().then(() => (init_update_roadmap_progress(), update_roadmap_progress_exports));
|
|
75331
|
-
const roadmapRoot =
|
|
75332
|
-
if (
|
|
75882
|
+
const roadmapRoot = path142.join(root, "agents", "roadmaps");
|
|
75883
|
+
if (fs148.existsSync(roadmapRoot)) {
|
|
75333
75884
|
const roadmaps = urp.collect(roadmapRoot);
|
|
75334
|
-
|
|
75335
|
-
|
|
75885
|
+
fs148.writeFileSync(
|
|
75886
|
+
path142.join(root, "agents", "roadmaps-progress.md"),
|
|
75336
75887
|
urp.render(roadmaps, urp.collect_bundles(root), roadmapRoot),
|
|
75337
75888
|
"utf-8"
|
|
75338
75889
|
);
|
|
@@ -75348,9 +75899,9 @@ async function _roadmapArchiveHandler(_args, consumerRoot) {
|
|
|
75348
75899
|
async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
75349
75900
|
const check = _pyTruthy6(args.check ?? false);
|
|
75350
75901
|
const cap = await Promise.resolve().then(() => (init_generate_capabilities_index(), generate_capabilities_index_exports));
|
|
75351
|
-
const out =
|
|
75902
|
+
const out = path142.join(_PACKAGE_ROOT3, "CAPABILITIES.yaml");
|
|
75352
75903
|
const content = cap.build();
|
|
75353
|
-
const onDisk =
|
|
75904
|
+
const onDisk = fs148.existsSync(out) ? fs148.readFileSync(out, "utf-8") : "";
|
|
75354
75905
|
const drift = onDisk !== content;
|
|
75355
75906
|
if (check) {
|
|
75356
75907
|
return { check: true, written: false, drift, path: out };
|
|
@@ -75361,7 +75912,7 @@ async function _capabilitiesIndexHandler(args, consumerRoot) {
|
|
|
75361
75912
|
`CAPABILITIES.yaml path escapes consumer_root: ${out} not under ${root}`
|
|
75362
75913
|
);
|
|
75363
75914
|
}
|
|
75364
|
-
|
|
75915
|
+
fs148.writeFileSync(out, content, "utf-8");
|
|
75365
75916
|
return { check: false, written: true, drift, path: out };
|
|
75366
75917
|
}
|
|
75367
75918
|
async function _runDoctorLeg(consumerRoot) {
|
|
@@ -75461,11 +76012,11 @@ async function _councilEstimateHandler(args, consumerRoot) {
|
|
|
75461
76012
|
throw new Error("'depth' must be 'shallow' or 'deep' when provided");
|
|
75462
76013
|
}
|
|
75463
76014
|
const root = resolvePath(consumerRoot);
|
|
75464
|
-
const target =
|
|
76015
|
+
const target = path142.isAbsolute(inputRaw) ? resolvePath(inputRaw) : resolvePath(path142.join(root, inputRaw));
|
|
75465
76016
|
if (_relativeUnder(target, root) === null) {
|
|
75466
76017
|
throw new Error(`path escapes consumer_root: ${target}`);
|
|
75467
76018
|
}
|
|
75468
|
-
if (!
|
|
76019
|
+
if (!fs148.existsSync(target)) {
|
|
75469
76020
|
throw new Error(`input_path not found: ${target}`);
|
|
75470
76021
|
}
|
|
75471
76022
|
const cli = await Promise.resolve().then(() => (init_council_cli(), council_cli_exports));
|
|
@@ -75527,18 +76078,18 @@ async function _runTestsHandler(args, consumerRoot) {
|
|
|
75527
76078
|
if (typeof relPathRaw !== "string" || !strip(relPathRaw)) {
|
|
75528
76079
|
throw new Error("'path' must be a non-empty string when provided");
|
|
75529
76080
|
}
|
|
75530
|
-
const resolved =
|
|
76081
|
+
const resolved = path142.isAbsolute(relPathRaw) ? resolvePath(relPathRaw) : resolvePath(path142.join(root, relPathRaw));
|
|
75531
76082
|
const rel2 = _relativeUnder(resolved, root);
|
|
75532
76083
|
if (rel2 === null) {
|
|
75533
76084
|
throw new Error(`path escapes consumer_root: ${resolved}`);
|
|
75534
76085
|
}
|
|
75535
|
-
if (!
|
|
76086
|
+
if (!fs148.existsSync(resolved)) {
|
|
75536
76087
|
throw new Error(`path not found: ${resolved}`);
|
|
75537
76088
|
}
|
|
75538
76089
|
relArg = rel2;
|
|
75539
76090
|
}
|
|
75540
|
-
const vitestEntry =
|
|
75541
|
-
if (!
|
|
76091
|
+
const vitestEntry = path142.join(root, "node_modules", "vitest", "vitest.mjs");
|
|
76092
|
+
if (!fs148.existsSync(vitestEntry)) {
|
|
75542
76093
|
throw new Error(
|
|
75543
76094
|
"run_tests pilot supports vitest projects only \u2014 node_modules/vitest/vitest.mjs not found under consumer_root"
|
|
75544
76095
|
);
|
|
@@ -76146,8 +76697,8 @@ function _strCmp3(a, b) {
|
|
|
76146
76697
|
return a < b ? -1 : a > b ? 1 : 0;
|
|
76147
76698
|
}
|
|
76148
76699
|
function _pathlibCompare4(a, b) {
|
|
76149
|
-
const pa = a.split(
|
|
76150
|
-
const pb = b.split(
|
|
76700
|
+
const pa = a.split(path142.sep);
|
|
76701
|
+
const pb = b.split(path142.sep);
|
|
76151
76702
|
const n = Math.min(pa.length, pb.length);
|
|
76152
76703
|
for (let i = 0; i < n; i++) {
|
|
76153
76704
|
const c = _strCmp3(pa[i], pb[i]);
|
|
@@ -76366,18 +76917,18 @@ async function _serveOverSdk(server) {
|
|
|
76366
76917
|
const transport = new StdioServerTransport();
|
|
76367
76918
|
await sdkServer.connect(transport);
|
|
76368
76919
|
}
|
|
76369
|
-
function
|
|
76920
|
+
function main47() {
|
|
76370
76921
|
void run_stdio();
|
|
76371
76922
|
}
|
|
76372
76923
|
|
|
76373
76924
|
// src/scripts/mcp_server/__main__.ts
|
|
76374
76925
|
var _selfPath = fileURLToPath61(import.meta.url);
|
|
76375
|
-
var _invokedDirectly3 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 &&
|
|
76926
|
+
var _invokedDirectly3 = globalThis.__AC_MCP_BUNDLE_DIRECT === true || process.argv[1] !== void 0 && path143.resolve(process.argv[1]) === path143.resolve(_selfPath);
|
|
76376
76927
|
if (_invokedDirectly3) {
|
|
76377
|
-
|
|
76928
|
+
main47();
|
|
76378
76929
|
}
|
|
76379
76930
|
export {
|
|
76380
|
-
|
|
76931
|
+
main47 as main
|
|
76381
76932
|
};
|
|
76382
76933
|
/*! Bundled license information:
|
|
76383
76934
|
|