@tekmidian/pai 0.49.0 → 0.51.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/dist/{aibroker-client-D5NT0S1N.mjs → aibroker-client-Bu72yPKj.mjs} +1 -1
- package/dist/{aibroker-client-Bn9SnGMa.mjs → aibroker-client-CDIXmq-e.mjs} +1 -1
- package/dist/{aibroker-client-Bn9SnGMa.mjs.map → aibroker-client-CDIXmq-e.mjs.map} +1 -1
- package/dist/{chain-CNSa0A3G.mjs → chain-BBbVbWVv.mjs} +4 -4
- package/dist/{chain-CNSa0A3G.mjs.map → chain-BBbVbWVv.mjs.map} +1 -1
- package/dist/cli/index.mjs +14 -14
- package/dist/cli/program.mjs +14 -14
- package/dist/config-Bn9jpblO.mjs +653 -0
- package/dist/config-Bn9jpblO.mjs.map +1 -0
- package/dist/{config-DxMZjpvY.mjs → config-DYXARgk8.mjs} +180 -151
- package/dist/config-DYXARgk8.mjs.map +1 -0
- package/dist/config-RjeVGJ7K.mjs +3 -0
- package/dist/{context-handover-cache-B9NKSjwR.mjs → context-handover-cache-yOuK9RIk.mjs} +5 -5
- package/dist/{context-handover-cache-B9NKSjwR.mjs.map → context-handover-cache-yOuK9RIk.mjs.map} +1 -1
- package/dist/daemon/index.mjs +13 -12
- package/dist/daemon/index.mjs.map +1 -1
- package/dist/{daemon-DZ4Q0jrs.mjs → daemon-CBTQYtHF.mjs} +49 -30
- package/dist/daemon-CBTQYtHF.mjs.map +1 -0
- package/dist/daemon-Vf7pHnjR.mjs +25 -0
- package/dist/daemon-mcp/index.mjs +186 -23
- package/dist/daemon-mcp/index.mjs.map +1 -1
- package/dist/factory-Ba8j9K7q.mjs +3 -0
- package/dist/{factory-DNYAqjH0.mjs → factory-Bt7TWQje.mjs} +3 -3
- package/dist/{factory-DNYAqjH0.mjs.map → factory-Bt7TWQje.mjs.map} +1 -1
- package/dist/{fallback-IeR2FrFn.mjs → fallback-CIGspCSi.mjs} +260 -10
- package/dist/fallback-CIGspCSi.mjs.map +1 -0
- package/dist/hooks/capture-all-events.mjs +80 -8
- package/dist/hooks/capture-all-events.mjs.map +4 -4
- package/dist/hooks/context-compression-hook.mjs +54 -39
- package/dist/hooks/context-compression-hook.mjs.map +4 -4
- package/dist/hooks/post-compact-inject.mjs +54 -39
- package/dist/hooks/post-compact-inject.mjs.map +4 -4
- package/dist/hooks/route-agents-to-worker.mjs +204 -109
- package/dist/hooks/route-agents-to-worker.mjs.map +4 -4
- package/dist/hooks/whisper-rules.mjs +7613 -9
- package/dist/hooks/whisper-rules.mjs.map +4 -4
- package/dist/hooks/worker-proxy.mjs +204 -109
- package/dist/hooks/worker-proxy.mjs.map +4 -4
- package/dist/hooks/worker-status-line.mjs +211 -116
- package/dist/hooks/worker-status-line.mjs.map +4 -4
- package/dist/hooks/worker-supervision.mjs +208 -113
- package/dist/hooks/worker-supervision.mjs.map +4 -4
- package/dist/{kg-entity-BSjM5xZh.mjs → kg-entity-BSW7ra8i.mjs} +1 -1
- package/dist/{kg-entity-BSjM5xZh.mjs.map → kg-entity-BSW7ra8i.mjs.map} +1 -1
- package/dist/main-resolver-BTastpp4.mjs +7 -0
- package/dist/{main-resolver-DvYu9jbl.mjs → main-resolver-BmZPCmgj.mjs} +3 -3
- package/dist/{main-resolver-DvYu9jbl.mjs.map → main-resolver-BmZPCmgj.mjs.map} +1 -1
- package/dist/{planner-Cn8HmT7l.mjs → planner-BiH9msqq.mjs} +6 -6
- package/dist/{planner-Cn8HmT7l.mjs.map → planner-BiH9msqq.mjs.map} +1 -1
- package/dist/{program-D9-wfmkZ.mjs → program-srUeFUfW.mjs} +5806 -5615
- package/dist/program-srUeFUfW.mjs.map +1 -0
- package/dist/query-feedback-Bm6XvCmg.mjs +3 -0
- package/dist/{query-feedback-CYyOGi3y.mjs → query-feedback-CTs_jx6i.mjs} +1 -1
- package/dist/{query-feedback-CYyOGi3y.mjs.map → query-feedback-CTs_jx6i.mjs.map} +1 -1
- package/dist/{run-Cls0YGgV.mjs → run-TChOnMO_.mjs} +1388 -1183
- package/dist/run-TChOnMO_.mjs.map +1 -0
- package/dist/{server-Ch99xt5K.mjs → server-R9UkCn3v.mjs} +42 -3
- package/dist/server-R9UkCn3v.mjs.map +1 -0
- package/dist/session-keepalive-BuG3wvik.mjs +579 -0
- package/dist/session-keepalive-BuG3wvik.mjs.map +1 -0
- package/dist/skills/VaultContext/SKILL.md +1 -1
- package/dist/{state-DnYGRmS7.mjs → state-Ca0ltLgI.mjs} +1 -1
- package/dist/{state-PJrgfDLW.mjs → state-DwrsOoMi.mjs} +1 -1
- package/dist/{state-PJrgfDLW.mjs.map → state-DwrsOoMi.mjs.map} +1 -1
- package/dist/{tools-B77WHeVZ.mjs → tools-BEqiJt_j.mjs} +13 -13
- package/dist/{tools-B77WHeVZ.mjs.map → tools-BEqiJt_j.mjs.map} +1 -1
- package/dist/{tools-NnR_n-Ja.mjs → tools-BwsOTmjh.mjs} +2 -2
- package/dist/{wakeup-UrhiW-KU.mjs → wakeup-Yk5lQ0jb.mjs} +1 -1
- package/dist/{wakeup-UrhiW-KU.mjs.map → wakeup-Yk5lQ0jb.mjs.map} +1 -1
- package/dist/{work-queue-worker-BA5IDBwQ.mjs → work-queue-worker-B9zVWImP.mjs} +3 -3
- package/dist/{work-queue-worker-BA5IDBwQ.mjs.map → work-queue-worker-B9zVWImP.mjs.map} +1 -1
- package/dist/work-queue-worker-D-DnQ7oh.mjs +14 -0
- package/dist/{zettelkasten-BBjA7GcP.mjs → zettelkasten-DezbXghl.mjs} +2 -2
- package/dist/{zettelkasten-BBjA7GcP.mjs.map → zettelkasten-DezbXghl.mjs.map} +1 -1
- package/docs/cache-keepalive.md +138 -0
- package/docs/commands/README.md +7 -0
- package/docs/commands/audit.md +1 -1
- package/docs/commands/config.md +84 -0
- package/docs/commands/daemon.md +6 -0
- package/docs/commands/worker.md +37 -2
- package/docs/config.md +171 -0
- package/docs/model-catalogue.md +502 -0
- package/docs/provider-independence-details.md +1 -1
- package/docs/task-bus.md +1 -1
- package/docs/worker.md +33 -5
- package/docs/workers-config.md +105 -12
- package/package.json +1 -1
- package/src/hooks/ts/capture-all-events.test.ts +71 -0
- package/src/hooks/ts/capture-all-events.ts +10 -3
- package/src/hooks/ts/lib/context-fill.test.ts +124 -46
- package/src/hooks/ts/lib/context-fill.ts +57 -14
- package/src/hooks/ts/user-prompt/whisper-rules.test.ts +56 -1
- package/src/hooks/ts/user-prompt/whisper-rules.ts +24 -0
- package/statusline-command.sh +103 -16
- package/dist/config-DCu8THKi.mjs +0 -228
- package/dist/config-DCu8THKi.mjs.map +0 -1
- package/dist/config-DeqFqa1N.mjs +0 -3
- package/dist/config-DxMZjpvY.mjs.map +0 -1
- package/dist/daemon-CYpVy_Dw.mjs +0 -24
- package/dist/daemon-DZ4Q0jrs.mjs.map +0 -1
- package/dist/factory-47Qf_df7.mjs +0 -3
- package/dist/fallback-IeR2FrFn.mjs.map +0 -1
- package/dist/indexer-C5Le7XE7.mjs +0 -1
- package/dist/main-resolver-CnfnWa8C.mjs +0 -7
- package/dist/program-D9-wfmkZ.mjs.map +0 -1
- package/dist/query-feedback-C7rSfiXU.mjs +0 -3
- package/dist/run-Cls0YGgV.mjs.map +0 -1
- package/dist/server-Ch99xt5K.mjs.map +0 -1
- package/dist/work-queue-worker-DLM2wlqM.mjs +0 -14
|
@@ -2029,7 +2029,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2029
2029
|
}
|
|
2030
2030
|
return void 0;
|
|
2031
2031
|
}
|
|
2032
|
-
var
|
|
2032
|
+
var YAMLMap2 = class extends Collection.Collection {
|
|
2033
2033
|
static get tagName() {
|
|
2034
2034
|
return "tag:yaml.org,2002:map";
|
|
2035
2035
|
}
|
|
@@ -2146,7 +2146,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2146
2146
|
});
|
|
2147
2147
|
}
|
|
2148
2148
|
};
|
|
2149
|
-
exports.YAMLMap =
|
|
2149
|
+
exports.YAMLMap = YAMLMap2;
|
|
2150
2150
|
exports.findPair = findPair;
|
|
2151
2151
|
}
|
|
2152
2152
|
});
|
|
@@ -2156,18 +2156,18 @@ var require_map = __commonJS({
|
|
|
2156
2156
|
"node_modules/yaml/dist/schema/common/map.js"(exports) {
|
|
2157
2157
|
"use strict";
|
|
2158
2158
|
var identity = require_identity();
|
|
2159
|
-
var
|
|
2159
|
+
var YAMLMap2 = require_YAMLMap();
|
|
2160
2160
|
var map = {
|
|
2161
2161
|
collection: "map",
|
|
2162
2162
|
default: true,
|
|
2163
|
-
nodeClass:
|
|
2163
|
+
nodeClass: YAMLMap2.YAMLMap,
|
|
2164
2164
|
tag: "tag:yaml.org,2002:map",
|
|
2165
2165
|
resolve(map2, onError) {
|
|
2166
2166
|
if (!identity.isMap(map2))
|
|
2167
2167
|
onError("Expected a mapping for this tag");
|
|
2168
2168
|
return map2;
|
|
2169
2169
|
},
|
|
2170
|
-
createNode: (schema, obj, ctx) =>
|
|
2170
|
+
createNode: (schema, obj, ctx) => YAMLMap2.YAMLMap.from(schema, obj, ctx)
|
|
2171
2171
|
};
|
|
2172
2172
|
exports.map = map;
|
|
2173
2173
|
}
|
|
@@ -2735,17 +2735,17 @@ var require_omap = __commonJS({
|
|
|
2735
2735
|
"use strict";
|
|
2736
2736
|
var identity = require_identity();
|
|
2737
2737
|
var toJS = require_toJS();
|
|
2738
|
-
var
|
|
2738
|
+
var YAMLMap2 = require_YAMLMap();
|
|
2739
2739
|
var YAMLSeq = require_YAMLSeq();
|
|
2740
2740
|
var pairs = require_pairs();
|
|
2741
2741
|
var YAMLOMap = class _YAMLOMap extends YAMLSeq.YAMLSeq {
|
|
2742
2742
|
constructor() {
|
|
2743
2743
|
super();
|
|
2744
|
-
this.add =
|
|
2745
|
-
this.delete =
|
|
2746
|
-
this.get =
|
|
2747
|
-
this.has =
|
|
2748
|
-
this.set =
|
|
2744
|
+
this.add = YAMLMap2.YAMLMap.prototype.add.bind(this);
|
|
2745
|
+
this.delete = YAMLMap2.YAMLMap.prototype.delete.bind(this);
|
|
2746
|
+
this.get = YAMLMap2.YAMLMap.prototype.get.bind(this);
|
|
2747
|
+
this.has = YAMLMap2.YAMLMap.prototype.has.bind(this);
|
|
2748
|
+
this.set = YAMLMap2.YAMLMap.prototype.set.bind(this);
|
|
2749
2749
|
this.tag = _YAMLOMap.tag;
|
|
2750
2750
|
}
|
|
2751
2751
|
/**
|
|
@@ -2973,8 +2973,8 @@ var require_set = __commonJS({
|
|
|
2973
2973
|
"use strict";
|
|
2974
2974
|
var identity = require_identity();
|
|
2975
2975
|
var Pair = require_Pair();
|
|
2976
|
-
var
|
|
2977
|
-
var YAMLSet = class _YAMLSet extends
|
|
2976
|
+
var YAMLMap2 = require_YAMLMap();
|
|
2977
|
+
var YAMLSet = class _YAMLSet extends YAMLMap2.YAMLMap {
|
|
2978
2978
|
constructor(schema) {
|
|
2979
2979
|
super(schema);
|
|
2980
2980
|
this.tag = _YAMLSet.tag;
|
|
@@ -2987,7 +2987,7 @@ var require_set = __commonJS({
|
|
|
2987
2987
|
pair = new Pair.Pair(key.key, null);
|
|
2988
2988
|
else
|
|
2989
2989
|
pair = new Pair.Pair(key, null);
|
|
2990
|
-
const prev =
|
|
2990
|
+
const prev = YAMLMap2.findPair(this.items, pair.key);
|
|
2991
2991
|
if (!prev)
|
|
2992
2992
|
this.items.push(pair);
|
|
2993
2993
|
}
|
|
@@ -2996,13 +2996,13 @@ var require_set = __commonJS({
|
|
|
2996
2996
|
* Otherwise, returns the value of that Pair's key.
|
|
2997
2997
|
*/
|
|
2998
2998
|
get(key, keepPair) {
|
|
2999
|
-
const pair =
|
|
2999
|
+
const pair = YAMLMap2.findPair(this.items, key);
|
|
3000
3000
|
return !keepPair && identity.isPair(pair) ? identity.isScalar(pair.key) ? pair.key.value : pair.key : pair;
|
|
3001
3001
|
}
|
|
3002
3002
|
set(key, value) {
|
|
3003
3003
|
if (typeof value !== "boolean")
|
|
3004
3004
|
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
|
|
3005
|
-
const prev =
|
|
3005
|
+
const prev = YAMLMap2.findPair(this.items, key);
|
|
3006
3006
|
if (prev && !value) {
|
|
3007
3007
|
this.items.splice(this.items.indexOf(prev), 1);
|
|
3008
3008
|
} else if (!prev && value) {
|
|
@@ -3409,7 +3409,7 @@ var require_Document = __commonJS({
|
|
|
3409
3409
|
var applyReviver = require_applyReviver();
|
|
3410
3410
|
var createNode = require_createNode();
|
|
3411
3411
|
var directives = require_directives();
|
|
3412
|
-
var
|
|
3412
|
+
var Document4 = class _Document {
|
|
3413
3413
|
constructor(value, replacer, options) {
|
|
3414
3414
|
this.commentBefore = null;
|
|
3415
3415
|
this.comment = null;
|
|
@@ -3699,7 +3699,7 @@ var require_Document = __commonJS({
|
|
|
3699
3699
|
return true;
|
|
3700
3700
|
throw new Error("Expected a YAML collection as document contents");
|
|
3701
3701
|
}
|
|
3702
|
-
exports.Document =
|
|
3702
|
+
exports.Document = Document4;
|
|
3703
3703
|
}
|
|
3704
3704
|
});
|
|
3705
3705
|
|
|
@@ -3983,14 +3983,14 @@ var require_resolve_block_map = __commonJS({
|
|
|
3983
3983
|
"node_modules/yaml/dist/compose/resolve-block-map.js"(exports) {
|
|
3984
3984
|
"use strict";
|
|
3985
3985
|
var Pair = require_Pair();
|
|
3986
|
-
var
|
|
3986
|
+
var YAMLMap2 = require_YAMLMap();
|
|
3987
3987
|
var resolveProps = require_resolve_props();
|
|
3988
3988
|
var utilContainsNewline = require_util_contains_newline();
|
|
3989
3989
|
var utilFlowIndentCheck = require_util_flow_indent_check();
|
|
3990
3990
|
var utilMapIncludes = require_util_map_includes();
|
|
3991
3991
|
var startColMsg = "All mapping items must start at the same column";
|
|
3992
3992
|
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
|
|
3993
|
-
const NodeClass = tag?.nodeClass ??
|
|
3993
|
+
const NodeClass = tag?.nodeClass ?? YAMLMap2.YAMLMap;
|
|
3994
3994
|
const map = new NodeClass(ctx.schema);
|
|
3995
3995
|
if (ctx.atRoot)
|
|
3996
3996
|
ctx.atRoot = false;
|
|
@@ -4186,7 +4186,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4186
4186
|
"use strict";
|
|
4187
4187
|
var identity = require_identity();
|
|
4188
4188
|
var Pair = require_Pair();
|
|
4189
|
-
var
|
|
4189
|
+
var YAMLMap2 = require_YAMLMap();
|
|
4190
4190
|
var YAMLSeq = require_YAMLSeq();
|
|
4191
4191
|
var resolveEnd = require_resolve_end();
|
|
4192
4192
|
var resolveProps = require_resolve_props();
|
|
@@ -4197,7 +4197,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4197
4197
|
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
|
|
4198
4198
|
const isMap = fc.start.source === "{";
|
|
4199
4199
|
const fcName = isMap ? "flow map" : "flow sequence";
|
|
4200
|
-
const NodeClass = tag?.nodeClass ?? (isMap ?
|
|
4200
|
+
const NodeClass = tag?.nodeClass ?? (isMap ? YAMLMap2.YAMLMap : YAMLSeq.YAMLSeq);
|
|
4201
4201
|
const coll = new NodeClass(ctx.schema);
|
|
4202
4202
|
coll.flow = true;
|
|
4203
4203
|
const atRoot = ctx.atRoot;
|
|
@@ -4334,7 +4334,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4334
4334
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4335
4335
|
map.items.push(pair);
|
|
4336
4336
|
} else {
|
|
4337
|
-
const map = new
|
|
4337
|
+
const map = new YAMLMap2.YAMLMap(ctx.schema);
|
|
4338
4338
|
map.flow = true;
|
|
4339
4339
|
map.items.push(pair);
|
|
4340
4340
|
const endRange = (valueNode ?? keyNode).range;
|
|
@@ -4380,7 +4380,7 @@ var require_compose_collection = __commonJS({
|
|
|
4380
4380
|
"use strict";
|
|
4381
4381
|
var identity = require_identity();
|
|
4382
4382
|
var Scalar2 = require_Scalar();
|
|
4383
|
-
var
|
|
4383
|
+
var YAMLMap2 = require_YAMLMap();
|
|
4384
4384
|
var YAMLSeq = require_YAMLSeq();
|
|
4385
4385
|
var resolveBlockMap = require_resolve_block_map();
|
|
4386
4386
|
var resolveBlockSeq = require_resolve_block_seq();
|
|
@@ -4408,7 +4408,7 @@ var require_compose_collection = __commonJS({
|
|
|
4408
4408
|
}
|
|
4409
4409
|
}
|
|
4410
4410
|
const expType = token.type === "block-map" ? "map" : token.type === "block-seq" ? "seq" : token.start.source === "{" ? "map" : "seq";
|
|
4411
|
-
if (!tagToken || !tagName || tagName === "!" || tagName ===
|
|
4411
|
+
if (!tagToken || !tagName || tagName === "!" || tagName === YAMLMap2.YAMLMap.tagName && expType === "map" || tagName === YAMLSeq.YAMLSeq.tagName && expType === "seq") {
|
|
4412
4412
|
return resolveCollection(CN, ctx, token, onError, tagName);
|
|
4413
4413
|
}
|
|
4414
4414
|
let tag = ctx.schema.tags.find((t) => t.tag === tagName && t.collection === expType);
|
|
@@ -5064,13 +5064,13 @@ var require_compose_node = __commonJS({
|
|
|
5064
5064
|
var require_compose_doc = __commonJS({
|
|
5065
5065
|
"node_modules/yaml/dist/compose/compose-doc.js"(exports) {
|
|
5066
5066
|
"use strict";
|
|
5067
|
-
var
|
|
5067
|
+
var Document4 = require_Document();
|
|
5068
5068
|
var composeNode = require_compose_node();
|
|
5069
5069
|
var resolveEnd = require_resolve_end();
|
|
5070
5070
|
var resolveProps = require_resolve_props();
|
|
5071
5071
|
function composeDoc(options, directives, { offset, start, value, end }, onError) {
|
|
5072
5072
|
const opts = Object.assign({ _directives: directives }, options);
|
|
5073
|
-
const doc = new
|
|
5073
|
+
const doc = new Document4.Document(void 0, opts);
|
|
5074
5074
|
const ctx = {
|
|
5075
5075
|
atKey: false,
|
|
5076
5076
|
atRoot: true,
|
|
@@ -5109,7 +5109,7 @@ var require_composer = __commonJS({
|
|
|
5109
5109
|
"use strict";
|
|
5110
5110
|
var node_process = __require("process");
|
|
5111
5111
|
var directives = require_directives();
|
|
5112
|
-
var
|
|
5112
|
+
var Document4 = require_Document();
|
|
5113
5113
|
var errors = require_errors();
|
|
5114
5114
|
var identity = require_identity();
|
|
5115
5115
|
var composeDoc = require_compose_doc();
|
|
@@ -5298,7 +5298,7 @@ ${end.comment}` : end.comment;
|
|
|
5298
5298
|
this.doc = null;
|
|
5299
5299
|
} else if (forceDoc) {
|
|
5300
5300
|
const opts = Object.assign({ _directives: this.directives }, this.options);
|
|
5301
|
-
const doc = new
|
|
5301
|
+
const doc = new Document4.Document(void 0, opts);
|
|
5302
5302
|
if (this.atDirectives)
|
|
5303
5303
|
this.onError(endOffset, "MISSING_CHAR", "Missing directives-end indicator line");
|
|
5304
5304
|
doc.range = [0, endOffset, endOffset];
|
|
@@ -7220,7 +7220,7 @@ var require_public_api = __commonJS({
|
|
|
7220
7220
|
"node_modules/yaml/dist/public-api.js"(exports) {
|
|
7221
7221
|
"use strict";
|
|
7222
7222
|
var composer = require_composer();
|
|
7223
|
-
var
|
|
7223
|
+
var Document4 = require_Document();
|
|
7224
7224
|
var errors = require_errors();
|
|
7225
7225
|
var log = require_log();
|
|
7226
7226
|
var identity = require_identity();
|
|
@@ -7245,7 +7245,7 @@ var require_public_api = __commonJS({
|
|
|
7245
7245
|
return docs;
|
|
7246
7246
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
7247
7247
|
}
|
|
7248
|
-
function
|
|
7248
|
+
function parseDocument4(source, options = {}) {
|
|
7249
7249
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
|
|
7250
7250
|
const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
|
|
7251
7251
|
const composer$1 = new composer.Composer(options);
|
|
@@ -7271,7 +7271,7 @@ var require_public_api = __commonJS({
|
|
|
7271
7271
|
} else if (options === void 0 && reviver && typeof reviver === "object") {
|
|
7272
7272
|
options = reviver;
|
|
7273
7273
|
}
|
|
7274
|
-
const doc =
|
|
7274
|
+
const doc = parseDocument4(src, options);
|
|
7275
7275
|
if (!doc)
|
|
7276
7276
|
return null;
|
|
7277
7277
|
doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
|
|
@@ -7303,11 +7303,11 @@ var require_public_api = __commonJS({
|
|
|
7303
7303
|
}
|
|
7304
7304
|
if (identity.isDocument(value) && !_replacer)
|
|
7305
7305
|
return value.toString(options);
|
|
7306
|
-
return new
|
|
7306
|
+
return new Document4.Document(value, _replacer, options).toString(options);
|
|
7307
7307
|
}
|
|
7308
7308
|
exports.parse = parse;
|
|
7309
7309
|
exports.parseAllDocuments = parseAllDocuments;
|
|
7310
|
-
exports.parseDocument =
|
|
7310
|
+
exports.parseDocument = parseDocument4;
|
|
7311
7311
|
exports.stringify = stringify;
|
|
7312
7312
|
}
|
|
7313
7313
|
});
|
|
@@ -7317,14 +7317,14 @@ var require_dist = __commonJS({
|
|
|
7317
7317
|
"node_modules/yaml/dist/index.js"(exports) {
|
|
7318
7318
|
"use strict";
|
|
7319
7319
|
var composer = require_composer();
|
|
7320
|
-
var
|
|
7320
|
+
var Document4 = require_Document();
|
|
7321
7321
|
var Schema = require_Schema();
|
|
7322
7322
|
var errors = require_errors();
|
|
7323
7323
|
var Alias = require_Alias();
|
|
7324
7324
|
var identity = require_identity();
|
|
7325
7325
|
var Pair = require_Pair();
|
|
7326
7326
|
var Scalar2 = require_Scalar();
|
|
7327
|
-
var
|
|
7327
|
+
var YAMLMap2 = require_YAMLMap();
|
|
7328
7328
|
var YAMLSeq = require_YAMLSeq();
|
|
7329
7329
|
var cst = require_cst();
|
|
7330
7330
|
var lexer = require_lexer();
|
|
@@ -7333,7 +7333,7 @@ var require_dist = __commonJS({
|
|
|
7333
7333
|
var publicApi = require_public_api();
|
|
7334
7334
|
var visit = require_visit();
|
|
7335
7335
|
exports.Composer = composer.Composer;
|
|
7336
|
-
exports.Document =
|
|
7336
|
+
exports.Document = Document4.Document;
|
|
7337
7337
|
exports.Schema = Schema.Schema;
|
|
7338
7338
|
exports.YAMLError = errors.YAMLError;
|
|
7339
7339
|
exports.YAMLParseError = errors.YAMLParseError;
|
|
@@ -7349,7 +7349,7 @@ var require_dist = __commonJS({
|
|
|
7349
7349
|
exports.isSeq = identity.isSeq;
|
|
7350
7350
|
exports.Pair = Pair.Pair;
|
|
7351
7351
|
exports.Scalar = Scalar2.Scalar;
|
|
7352
|
-
exports.YAMLMap =
|
|
7352
|
+
exports.YAMLMap = YAMLMap2.YAMLMap;
|
|
7353
7353
|
exports.YAMLSeq = YAMLSeq.YAMLSeq;
|
|
7354
7354
|
exports.CST = cst;
|
|
7355
7355
|
exports.Lexer = lexer.Lexer;
|
|
@@ -7365,8 +7365,8 @@ var require_dist = __commonJS({
|
|
|
7365
7365
|
});
|
|
7366
7366
|
|
|
7367
7367
|
// src/hooks/ts/user-prompt/worker-supervision.ts
|
|
7368
|
-
import { existsSync as
|
|
7369
|
-
import { join as
|
|
7368
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5, writeFileSync as writeFileSync3 } from "node:fs";
|
|
7369
|
+
import { join as join6 } from "node:path";
|
|
7370
7370
|
|
|
7371
7371
|
// src/hooks/ts/lib/worker-session.ts
|
|
7372
7372
|
function isWorkerSession(env = process.env) {
|
|
@@ -7375,43 +7375,11 @@ function isWorkerSession(env = process.env) {
|
|
|
7375
7375
|
|
|
7376
7376
|
// src/workers/config.ts
|
|
7377
7377
|
import { homedir as homedir4 } from "node:os";
|
|
7378
|
-
import { join as
|
|
7379
|
-
|
|
7380
|
-
// src/config/json-store.ts
|
|
7381
|
-
import {
|
|
7382
|
-
existsSync,
|
|
7383
|
-
readFileSync,
|
|
7384
|
-
writeFileSync,
|
|
7385
|
-
copyFileSync,
|
|
7386
|
-
renameSync,
|
|
7387
|
-
unlinkSync,
|
|
7388
|
-
mkdirSync
|
|
7389
|
-
} from "node:fs";
|
|
7390
|
-
function readJsonStrict(path, label = path) {
|
|
7391
|
-
if (!existsSync(path)) return {};
|
|
7392
|
-
let raw;
|
|
7393
|
-
try {
|
|
7394
|
-
raw = readFileSync(path, "utf8");
|
|
7395
|
-
} catch (e) {
|
|
7396
|
-
throw new Error(
|
|
7397
|
-
`Could not read ${label}: ${e instanceof Error ? e.message : String(e)}
|
|
7398
|
-
Refusing to continue \u2014 writing now would replace its contents with ours alone.`
|
|
7399
|
-
);
|
|
7400
|
-
}
|
|
7401
|
-
try {
|
|
7402
|
-
return JSON.parse(raw);
|
|
7403
|
-
} catch (e) {
|
|
7404
|
-
throw new Error(
|
|
7405
|
-
`${label} exists but is not valid JSON: ${e instanceof Error ? e.message : String(e)}
|
|
7406
|
-
Refusing to continue \u2014 overwriting it would destroy whatever it holds.
|
|
7407
|
-
Repair the file, or move it aside and re-run this command.`
|
|
7408
|
-
);
|
|
7409
|
-
}
|
|
7410
|
-
}
|
|
7378
|
+
import { join as join5 } from "node:path";
|
|
7411
7379
|
|
|
7412
7380
|
// src/daemon/config.ts
|
|
7413
7381
|
import { homedir as homedir2, userInfo } from "node:os";
|
|
7414
|
-
import { join as
|
|
7382
|
+
import { join as join3, dirname as dirname3 } from "node:path";
|
|
7415
7383
|
|
|
7416
7384
|
// src/notifications/types.ts
|
|
7417
7385
|
var DEFAULT_ROUTING = {
|
|
@@ -7465,7 +7433,7 @@ function paiSocketPath() {
|
|
|
7465
7433
|
}
|
|
7466
7434
|
|
|
7467
7435
|
// src/config/pai-home.ts
|
|
7468
|
-
import { existsSync
|
|
7436
|
+
import { existsSync, mkdirSync, readFileSync, copyFileSync, renameSync, readdirSync, statSync } from "node:fs";
|
|
7469
7437
|
import { homedir } from "node:os";
|
|
7470
7438
|
import { join, dirname } from "node:path";
|
|
7471
7439
|
function paiHomeDir() {
|
|
@@ -7476,9 +7444,9 @@ function paiHomePath(...segments) {
|
|
|
7476
7444
|
}
|
|
7477
7445
|
var noticesPrinted = /* @__PURE__ */ new Set();
|
|
7478
7446
|
function resolvePaiFile(newPath, oldCandidates, migrateHint) {
|
|
7479
|
-
if (
|
|
7447
|
+
if (existsSync(newPath)) return newPath;
|
|
7480
7448
|
for (const old of oldCandidates) {
|
|
7481
|
-
if (
|
|
7449
|
+
if (existsSync(old)) {
|
|
7482
7450
|
if (!noticesPrinted.has(newPath)) {
|
|
7483
7451
|
noticesPrinted.add(newPath);
|
|
7484
7452
|
process.stderr.write(
|
|
@@ -7492,6 +7460,74 @@ function resolvePaiFile(newPath, oldCandidates, migrateHint) {
|
|
|
7492
7460
|
return newPath;
|
|
7493
7461
|
}
|
|
7494
7462
|
|
|
7463
|
+
// src/config/main-config.ts
|
|
7464
|
+
var import_yaml2 = __toESM(require_dist(), 1);
|
|
7465
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, renameSync as renameSync3 } from "node:fs";
|
|
7466
|
+
import { dirname as dirname2, join as join2, basename } from "node:path";
|
|
7467
|
+
|
|
7468
|
+
// src/config/json-store.ts
|
|
7469
|
+
import {
|
|
7470
|
+
existsSync as existsSync2,
|
|
7471
|
+
readFileSync as readFileSync2,
|
|
7472
|
+
writeFileSync,
|
|
7473
|
+
copyFileSync as copyFileSync2,
|
|
7474
|
+
renameSync as renameSync2,
|
|
7475
|
+
unlinkSync,
|
|
7476
|
+
mkdirSync as mkdirSync2
|
|
7477
|
+
} from "node:fs";
|
|
7478
|
+
function readJsonStrict(path, label = path) {
|
|
7479
|
+
if (!existsSync2(path)) return {};
|
|
7480
|
+
let raw;
|
|
7481
|
+
try {
|
|
7482
|
+
raw = readFileSync2(path, "utf8");
|
|
7483
|
+
} catch (e) {
|
|
7484
|
+
throw new Error(
|
|
7485
|
+
`Could not read ${label}: ${e instanceof Error ? e.message : String(e)}
|
|
7486
|
+
Refusing to continue \u2014 writing now would replace its contents with ours alone.`
|
|
7487
|
+
);
|
|
7488
|
+
}
|
|
7489
|
+
try {
|
|
7490
|
+
return JSON.parse(raw);
|
|
7491
|
+
} catch (e) {
|
|
7492
|
+
throw new Error(
|
|
7493
|
+
`${label} exists but is not valid JSON: ${e instanceof Error ? e.message : String(e)}
|
|
7494
|
+
Refusing to continue \u2014 overwriting it would destroy whatever it holds.
|
|
7495
|
+
Repair the file, or move it aside and re-run this command.`
|
|
7496
|
+
);
|
|
7497
|
+
}
|
|
7498
|
+
}
|
|
7499
|
+
|
|
7500
|
+
// src/config/yaml-store.ts
|
|
7501
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
7502
|
+
|
|
7503
|
+
// src/config/main-config.ts
|
|
7504
|
+
var MainConfigError = class extends Error {
|
|
7505
|
+
};
|
|
7506
|
+
function yamlSiblingPath(jsonPath) {
|
|
7507
|
+
return join2(dirname2(jsonPath), "config.yaml");
|
|
7508
|
+
}
|
|
7509
|
+
function readDualFormatConfigRaw(jsonPath, yamlPath = yamlSiblingPath(jsonPath)) {
|
|
7510
|
+
if (existsSync3(yamlPath)) {
|
|
7511
|
+
let text;
|
|
7512
|
+
try {
|
|
7513
|
+
text = readFileSync3(yamlPath, "utf8");
|
|
7514
|
+
} catch (e) {
|
|
7515
|
+
throw new MainConfigError(`Could not read ${yamlPath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
7516
|
+
}
|
|
7517
|
+
const doc = (0, import_yaml2.parseDocument)(text);
|
|
7518
|
+
if (doc.errors.length) {
|
|
7519
|
+
throw new MainConfigError(`${yamlPath}: ${doc.errors[0].message}`);
|
|
7520
|
+
}
|
|
7521
|
+
const parsed = doc.toJS();
|
|
7522
|
+
if (parsed === null || parsed === void 0) return {};
|
|
7523
|
+
if (typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
7524
|
+
throw new MainConfigError(`${yamlPath}: top level must be a mapping`);
|
|
7525
|
+
}
|
|
7526
|
+
return parsed;
|
|
7527
|
+
}
|
|
7528
|
+
return readJsonStrict(jsonPath, jsonPath);
|
|
7529
|
+
}
|
|
7530
|
+
|
|
7495
7531
|
// src/daemon/config.ts
|
|
7496
7532
|
function perUserDbName() {
|
|
7497
7533
|
const username = userInfo().username;
|
|
@@ -7502,6 +7538,14 @@ function perUserConnectionString() {
|
|
|
7502
7538
|
const db = perUserDbName();
|
|
7503
7539
|
return `postgresql://pai:pai@localhost:5432/${db}`;
|
|
7504
7540
|
}
|
|
7541
|
+
var DEFAULT_SESSIONS_CACHE_KEEPALIVE = {
|
|
7542
|
+
enabled: false,
|
|
7543
|
+
idleMinutes: 50,
|
|
7544
|
+
maxBeats: 6,
|
|
7545
|
+
activeHours: "08:00-22:00",
|
|
7546
|
+
minContextTokens: 2e4,
|
|
7547
|
+
prompt: "keepalive"
|
|
7548
|
+
};
|
|
7505
7549
|
var DEFAULTS = {
|
|
7506
7550
|
socketPath: paiSocketPath(),
|
|
7507
7551
|
indexIntervalSecs: 300,
|
|
@@ -7520,6 +7564,7 @@ var DEFAULTS = {
|
|
|
7520
7564
|
// Deliberately empty. An install must not guess who the user is: a wrong
|
|
7521
7565
|
// guess here is an address that can be mailed without review.
|
|
7522
7566
|
identity: { selfEmails: [] },
|
|
7567
|
+
sessions: { cacheKeepalive: { ...DEFAULT_SESSIONS_CACHE_KEEPALIVE } },
|
|
7523
7568
|
search: {
|
|
7524
7569
|
mode: "keyword",
|
|
7525
7570
|
rerank: true,
|
|
@@ -7529,30 +7574,37 @@ var DEFAULTS = {
|
|
|
7529
7574
|
}
|
|
7530
7575
|
};
|
|
7531
7576
|
var NEW_CONFIG_FILE = paiHomePath("config.json");
|
|
7532
|
-
var OLD_CONFIG_FILE =
|
|
7533
|
-
var LEGACY_CONFIG_FILE =
|
|
7577
|
+
var OLD_CONFIG_FILE = join3(homedir2(), ".claude", "pai.json");
|
|
7578
|
+
var LEGACY_CONFIG_FILE = join3(homedir2(), ".config", "pai", "config.json");
|
|
7534
7579
|
function paiConfigFilePath() {
|
|
7535
7580
|
const override = process.env.PAI_CONFIG_FILE;
|
|
7536
7581
|
if (override) return override;
|
|
7537
7582
|
return resolvePaiFile(NEW_CONFIG_FILE, [OLD_CONFIG_FILE, LEGACY_CONFIG_FILE], "pai config migrate");
|
|
7538
7583
|
}
|
|
7539
7584
|
var CONFIG_FILE = paiConfigFilePath();
|
|
7540
|
-
var CONFIG_DIR =
|
|
7585
|
+
var CONFIG_DIR = dirname3(CONFIG_FILE);
|
|
7586
|
+
function readMainConfigRaw(path = CONFIG_FILE) {
|
|
7587
|
+
try {
|
|
7588
|
+
return readDualFormatConfigRaw(path);
|
|
7589
|
+
} catch (e) {
|
|
7590
|
+
throw e instanceof MainConfigError ? new Error(e.message) : e;
|
|
7591
|
+
}
|
|
7592
|
+
}
|
|
7541
7593
|
|
|
7542
7594
|
// src/workers/workers-config.ts
|
|
7543
|
-
var
|
|
7544
|
-
import { existsSync as
|
|
7595
|
+
var import_yaml3 = __toESM(require_dist(), 1);
|
|
7596
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2, chmodSync } from "node:fs";
|
|
7545
7597
|
import { homedir as homedir3 } from "node:os";
|
|
7546
|
-
import { dirname as
|
|
7598
|
+
import { dirname as dirname4, join as join4 } from "node:path";
|
|
7547
7599
|
var WORKERS_YAML_FILENAME = "workers.yaml";
|
|
7548
7600
|
function defaultWorkersYamlPath() {
|
|
7549
7601
|
return paiHomePath(WORKERS_YAML_FILENAME);
|
|
7550
7602
|
}
|
|
7551
7603
|
function oldWorkersYamlPath() {
|
|
7552
|
-
return
|
|
7604
|
+
return join4(homedir3(), ".claude", WORKERS_YAML_FILENAME);
|
|
7553
7605
|
}
|
|
7554
7606
|
function legacyWorkersYamlPath() {
|
|
7555
|
-
return
|
|
7607
|
+
return join4(homedir3(), ".config", "pai", WORKERS_YAML_FILENAME);
|
|
7556
7608
|
}
|
|
7557
7609
|
function workersYamlPath() {
|
|
7558
7610
|
const override = process.env.PAI_WORKERS_YAML;
|
|
@@ -7657,7 +7709,8 @@ function parseWorkersYamlDocument(doc, yamlPath) {
|
|
|
7657
7709
|
const provider = typeof target === "string" ? target.split("/")[0] : target.provider;
|
|
7658
7710
|
const alias = typeof target === "string" ? target.split("/")[1] : void 0;
|
|
7659
7711
|
if (provider !== void 0) {
|
|
7660
|
-
|
|
7712
|
+
const native = provider === ANTHROPIC_NATIVE;
|
|
7713
|
+
if (!native && !providers[provider]) {
|
|
7661
7714
|
withLine(
|
|
7662
7715
|
doc,
|
|
7663
7716
|
["classes", cls],
|
|
@@ -7667,19 +7720,36 @@ function parseWorkersYamlDocument(doc, yamlPath) {
|
|
|
7667
7720
|
)
|
|
7668
7721
|
);
|
|
7669
7722
|
}
|
|
7670
|
-
if (alias !== void 0
|
|
7671
|
-
|
|
7672
|
-
|
|
7673
|
-
|
|
7674
|
-
|
|
7675
|
-
|
|
7676
|
-
|
|
7677
|
-
|
|
7678
|
-
|
|
7723
|
+
if (alias !== void 0) {
|
|
7724
|
+
if (!isModelCapability(alias)) {
|
|
7725
|
+
withLine(
|
|
7726
|
+
doc,
|
|
7727
|
+
["classes", cls],
|
|
7728
|
+
yamlPath,
|
|
7729
|
+
new WorkersConfigError(
|
|
7730
|
+
`classes.${cls}: "${alias}" is not a valid capability name (must match ^[a-z][a-z0-9-]*$)`
|
|
7731
|
+
)
|
|
7732
|
+
);
|
|
7733
|
+
} else if (!native && providers[provider] && alias !== "default" && !providers[provider].models[alias]) {
|
|
7734
|
+
withLine(
|
|
7735
|
+
doc,
|
|
7736
|
+
["classes", cls],
|
|
7737
|
+
yamlPath,
|
|
7738
|
+
new WorkersConfigError(`classes.${cls}: provider "${provider}" has no "${alias}" model configured`)
|
|
7739
|
+
);
|
|
7740
|
+
}
|
|
7679
7741
|
}
|
|
7680
7742
|
}
|
|
7681
7743
|
}
|
|
7682
7744
|
}
|
|
7745
|
+
let capabilities = {};
|
|
7746
|
+
if (r.capabilities !== void 0) {
|
|
7747
|
+
try {
|
|
7748
|
+
capabilities = parseCapabilitiesValue(r.capabilities, "capabilities");
|
|
7749
|
+
} catch (e) {
|
|
7750
|
+
withLine(doc, ["capabilities"], yamlPath, e);
|
|
7751
|
+
}
|
|
7752
|
+
}
|
|
7683
7753
|
let mcpSets = {};
|
|
7684
7754
|
if (r.mcp_sets !== void 0) {
|
|
7685
7755
|
try {
|
|
@@ -7701,19 +7771,19 @@ function parseWorkersYamlDocument(doc, yamlPath) {
|
|
|
7701
7771
|
)
|
|
7702
7772
|
);
|
|
7703
7773
|
}
|
|
7704
|
-
return { active, providers, classes, mcpSets, nativeModels };
|
|
7774
|
+
return { active, providers, classes, capabilities, mcpSets, nativeModels };
|
|
7705
7775
|
}
|
|
7706
7776
|
function readWorkersYaml(yamlPath) {
|
|
7707
|
-
if (!
|
|
7777
|
+
if (!existsSync4(yamlPath)) return null;
|
|
7708
7778
|
let text;
|
|
7709
7779
|
try {
|
|
7710
|
-
text =
|
|
7780
|
+
text = readFileSync4(yamlPath, "utf8");
|
|
7711
7781
|
} catch (e) {
|
|
7712
7782
|
throw new WorkersConfigError(
|
|
7713
7783
|
`Could not read ${yamlPath}: ${e instanceof Error ? e.message : String(e)}`
|
|
7714
7784
|
);
|
|
7715
7785
|
}
|
|
7716
|
-
const doc = (0,
|
|
7786
|
+
const doc = (0, import_yaml3.parseDocument)(text);
|
|
7717
7787
|
if (doc.errors.length) {
|
|
7718
7788
|
throw new WorkersConfigError(`${yamlPath}: ${doc.errors[0].message}`);
|
|
7719
7789
|
}
|
|
@@ -7737,8 +7807,9 @@ var PROVIDER_TAGS = [
|
|
|
7737
7807
|
"reasoning"
|
|
7738
7808
|
];
|
|
7739
7809
|
var MODEL_CAPABILITIES = ["default", "fast", "image"];
|
|
7810
|
+
var CAPABILITY_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
7740
7811
|
function isModelCapability(v) {
|
|
7741
|
-
return
|
|
7812
|
+
return CAPABILITY_NAME_RE.test(v);
|
|
7742
7813
|
}
|
|
7743
7814
|
var DEFAULT_LOG_DIR = "~/.claude/logs/workers";
|
|
7744
7815
|
var DEFAULT_PANE = {
|
|
@@ -7766,6 +7837,7 @@ function defaultWorkersConfig() {
|
|
|
7766
7837
|
providers: {},
|
|
7767
7838
|
classes: {},
|
|
7768
7839
|
mcpSets: { ...DEFAULT_MCP_SETS },
|
|
7840
|
+
capabilities: {},
|
|
7769
7841
|
pane: { ...DEFAULT_PANE },
|
|
7770
7842
|
logDir: DEFAULT_LOG_DIR,
|
|
7771
7843
|
routing: { ...DEFAULT_ROUTING2, order: [] },
|
|
@@ -7793,7 +7865,10 @@ function parseModelsBlock(pathPrefix, modelsRaw) {
|
|
|
7793
7865
|
for (const key of Object.keys(m)) {
|
|
7794
7866
|
if (key === "default") continue;
|
|
7795
7867
|
if (!isModelCapability(key)) {
|
|
7796
|
-
bad(
|
|
7868
|
+
bad(
|
|
7869
|
+
`${pathPrefix}.${key}`,
|
|
7870
|
+
`"${key}" is not a valid capability name (must match ^[a-z][a-z0-9-]*$; well-known: ${MODEL_CAPABILITIES.join(", ")}, but any name in that shape is accepted)`
|
|
7871
|
+
);
|
|
7797
7872
|
}
|
|
7798
7873
|
const id = str(m[key]);
|
|
7799
7874
|
if (!id) bad(`${pathPrefix}.${key}`, "must be a non-empty model id");
|
|
@@ -7815,8 +7890,8 @@ function parseProvider(name, raw) {
|
|
|
7815
7890
|
bad(`.providers.${name}.protocol`, `"${str(p.protocol)}" is neither "anthropic" nor "openai"`);
|
|
7816
7891
|
}
|
|
7817
7892
|
const engine = p.engine === void 0 ? "claude" : str(p.engine);
|
|
7818
|
-
if (engine !== "claude" && engine !== "codex") {
|
|
7819
|
-
bad(`.providers.${name}.engine`, `"${str(p.engine)}" is
|
|
7893
|
+
if (engine !== "claude" && engine !== "codex" && engine !== "image") {
|
|
7894
|
+
bad(`.providers.${name}.engine`, `"${str(p.engine)}" is none of "claude", "codex", "image"`);
|
|
7820
7895
|
}
|
|
7821
7896
|
const baseUrl = str(p.baseUrl);
|
|
7822
7897
|
if (!baseUrl && protocol !== "openai") bad(`.providers.${name}.baseUrl`, "is required");
|
|
@@ -8024,6 +8099,23 @@ function parseMcpSetsValue(raw, badPathPrefix) {
|
|
|
8024
8099
|
}
|
|
8025
8100
|
return mcpSets;
|
|
8026
8101
|
}
|
|
8102
|
+
function parseCapabilitiesValue(raw, badPathPrefix) {
|
|
8103
|
+
const capabilities = {};
|
|
8104
|
+
if (raw === void 0) return capabilities;
|
|
8105
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
8106
|
+
bad(badPathPrefix, "must be an object of capability name \u2192 [provider names]");
|
|
8107
|
+
}
|
|
8108
|
+
for (const [name, order] of Object.entries(raw)) {
|
|
8109
|
+
if (!isModelCapability(name)) {
|
|
8110
|
+
bad(`${badPathPrefix}.${name}`, `"${name}" is not a valid capability name (must match ^[a-z][a-z0-9-]*$)`);
|
|
8111
|
+
}
|
|
8112
|
+
if (!Array.isArray(order) || order.length === 0 || order.some((x) => typeof x !== "string" || !x)) {
|
|
8113
|
+
bad(`${badPathPrefix}.${name}`, "must be a non-empty array of provider names");
|
|
8114
|
+
}
|
|
8115
|
+
capabilities[name] = order;
|
|
8116
|
+
}
|
|
8117
|
+
return capabilities;
|
|
8118
|
+
}
|
|
8027
8119
|
function parseWorkersConfig(raw) {
|
|
8028
8120
|
const d = defaultWorkersConfig();
|
|
8029
8121
|
if (raw === void 0 || raw === null) return d;
|
|
@@ -8043,6 +8135,7 @@ function parseWorkersConfig(raw) {
|
|
|
8043
8135
|
const classesRaw = w.classes !== void 0 ? w.classes : w.roles;
|
|
8044
8136
|
const classes = parseClassesValue(classesRaw, w.classes !== void 0 ? ".classes" : ".roles");
|
|
8045
8137
|
const mcpSets = parseMcpSetsValue(w.mcpSets, ".mcpSets");
|
|
8138
|
+
const capabilities = parseCapabilitiesValue(w.capabilities, ".capabilities");
|
|
8046
8139
|
let pane = { ...DEFAULT_PANE };
|
|
8047
8140
|
if (w.pane !== void 0) {
|
|
8048
8141
|
if (typeof w.pane !== "object" || w.pane === null) bad(".pane", "must be an object");
|
|
@@ -8152,6 +8245,7 @@ function parseWorkersConfig(raw) {
|
|
|
8152
8245
|
providers,
|
|
8153
8246
|
classes,
|
|
8154
8247
|
mcpSets,
|
|
8248
|
+
capabilities,
|
|
8155
8249
|
pane,
|
|
8156
8250
|
logDir: str(w.logDir) || d.logDir,
|
|
8157
8251
|
routing,
|
|
@@ -8162,7 +8256,7 @@ function parseWorkersConfig(raw) {
|
|
|
8162
8256
|
};
|
|
8163
8257
|
}
|
|
8164
8258
|
function readWorkersSection(path = CONFIG_FILE) {
|
|
8165
|
-
const raw =
|
|
8259
|
+
const raw = readMainConfigRaw(path);
|
|
8166
8260
|
const workers = parseWorkersConfig(raw.workers);
|
|
8167
8261
|
const yaml = readWorkersYaml(workersYamlPath());
|
|
8168
8262
|
if (yaml) {
|
|
@@ -8170,12 +8264,13 @@ function readWorkersSection(path = CONFIG_FILE) {
|
|
|
8170
8264
|
workers.providers = yaml.data.providers;
|
|
8171
8265
|
workers.classes = yaml.data.classes;
|
|
8172
8266
|
workers.mcpSets = yaml.data.mcpSets;
|
|
8267
|
+
workers.capabilities = yaml.data.capabilities;
|
|
8173
8268
|
workers.nativeModels = yaml.data.nativeModels;
|
|
8174
8269
|
}
|
|
8175
8270
|
return { raw, workers };
|
|
8176
8271
|
}
|
|
8177
8272
|
function expandHome(p) {
|
|
8178
|
-
if (p === "~" || p.startsWith("~/")) return
|
|
8273
|
+
if (p === "~" || p.startsWith("~/")) return join5(homedir4(), p.slice(1));
|
|
8179
8274
|
return p;
|
|
8180
8275
|
}
|
|
8181
8276
|
|
|
@@ -8189,7 +8284,7 @@ function workersLogDir(config) {
|
|
|
8189
8284
|
// src/hooks/ts/user-prompt/worker-supervision.ts
|
|
8190
8285
|
function readCursor(path) {
|
|
8191
8286
|
try {
|
|
8192
|
-
return Math.max(0, Number(
|
|
8287
|
+
return Math.max(0, Number(readFileSync5(path, "utf8").trim()) || 0);
|
|
8193
8288
|
} catch {
|
|
8194
8289
|
return 0;
|
|
8195
8290
|
}
|
|
@@ -8198,7 +8293,7 @@ function main() {
|
|
|
8198
8293
|
if (isWorkerSession()) return;
|
|
8199
8294
|
let raw = "";
|
|
8200
8295
|
try {
|
|
8201
|
-
raw =
|
|
8296
|
+
raw = readFileSync5(0, "utf8");
|
|
8202
8297
|
} catch {
|
|
8203
8298
|
return;
|
|
8204
8299
|
}
|
|
@@ -8217,13 +8312,13 @@ function main() {
|
|
|
8217
8312
|
} catch {
|
|
8218
8313
|
return;
|
|
8219
8314
|
}
|
|
8220
|
-
const dir =
|
|
8221
|
-
const eventsPath =
|
|
8222
|
-
const cursorPath =
|
|
8223
|
-
if (!
|
|
8315
|
+
const dir = join6(logDir, "supervision");
|
|
8316
|
+
const eventsPath = join6(dir, `${session}.events`);
|
|
8317
|
+
const cursorPath = join6(dir, `${session}.cursor`);
|
|
8318
|
+
if (!existsSync5(eventsPath)) return;
|
|
8224
8319
|
let lines;
|
|
8225
8320
|
try {
|
|
8226
|
-
lines =
|
|
8321
|
+
lines = readFileSync5(eventsPath, "utf8").split("\n").filter((l) => l.trim());
|
|
8227
8322
|
} catch {
|
|
8228
8323
|
return;
|
|
8229
8324
|
}
|
|
@@ -8232,7 +8327,7 @@ function main() {
|
|
|
8232
8327
|
let pushedIds = /* @__PURE__ */ new Set();
|
|
8233
8328
|
try {
|
|
8234
8329
|
pushedIds = new Set(
|
|
8235
|
-
|
|
8330
|
+
readFileSync5(join6(dir, `${session}.pushed`), "utf8").split("\n").map((l) => l.trim()).filter(Boolean)
|
|
8236
8331
|
);
|
|
8237
8332
|
} catch {
|
|
8238
8333
|
}
|