@tekmidian/pai 0.49.0 → 0.50.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-BX67-4I2.mjs} +233 -277
- package/dist/program-BX67-4I2.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/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/user-prompt/whisper-rules.test.ts +56 -1
- package/src/hooks/ts/user-prompt/whisper-rules.ts +24 -0
- package/statusline-command.sh +81 -6
- 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;
|
|
@@ -7366,43 +7366,11 @@ var require_dist = __commonJS({
|
|
|
7366
7366
|
|
|
7367
7367
|
// src/workers/config.ts
|
|
7368
7368
|
import { homedir as homedir4 } from "node:os";
|
|
7369
|
-
import { join as
|
|
7370
|
-
|
|
7371
|
-
// src/config/json-store.ts
|
|
7372
|
-
import {
|
|
7373
|
-
existsSync,
|
|
7374
|
-
readFileSync,
|
|
7375
|
-
writeFileSync,
|
|
7376
|
-
copyFileSync,
|
|
7377
|
-
renameSync,
|
|
7378
|
-
unlinkSync,
|
|
7379
|
-
mkdirSync
|
|
7380
|
-
} from "node:fs";
|
|
7381
|
-
function readJsonStrict(path, label = path) {
|
|
7382
|
-
if (!existsSync(path)) return {};
|
|
7383
|
-
let raw;
|
|
7384
|
-
try {
|
|
7385
|
-
raw = readFileSync(path, "utf8");
|
|
7386
|
-
} catch (e) {
|
|
7387
|
-
throw new Error(
|
|
7388
|
-
`Could not read ${label}: ${e instanceof Error ? e.message : String(e)}
|
|
7389
|
-
Refusing to continue \u2014 writing now would replace its contents with ours alone.`
|
|
7390
|
-
);
|
|
7391
|
-
}
|
|
7392
|
-
try {
|
|
7393
|
-
return JSON.parse(raw);
|
|
7394
|
-
} catch (e) {
|
|
7395
|
-
throw new Error(
|
|
7396
|
-
`${label} exists but is not valid JSON: ${e instanceof Error ? e.message : String(e)}
|
|
7397
|
-
Refusing to continue \u2014 overwriting it would destroy whatever it holds.
|
|
7398
|
-
Repair the file, or move it aside and re-run this command.`
|
|
7399
|
-
);
|
|
7400
|
-
}
|
|
7401
|
-
}
|
|
7369
|
+
import { join as join5 } from "node:path";
|
|
7402
7370
|
|
|
7403
7371
|
// src/daemon/config.ts
|
|
7404
7372
|
import { homedir as homedir2, userInfo } from "node:os";
|
|
7405
|
-
import { join as
|
|
7373
|
+
import { join as join3, dirname as dirname3 } from "node:path";
|
|
7406
7374
|
|
|
7407
7375
|
// src/notifications/types.ts
|
|
7408
7376
|
var DEFAULT_ROUTING = {
|
|
@@ -7456,7 +7424,7 @@ function paiSocketPath() {
|
|
|
7456
7424
|
}
|
|
7457
7425
|
|
|
7458
7426
|
// src/config/pai-home.ts
|
|
7459
|
-
import { existsSync
|
|
7427
|
+
import { existsSync, mkdirSync, readFileSync, copyFileSync, renameSync, readdirSync, statSync } from "node:fs";
|
|
7460
7428
|
import { homedir } from "node:os";
|
|
7461
7429
|
import { join, dirname } from "node:path";
|
|
7462
7430
|
function paiHomeDir() {
|
|
@@ -7467,9 +7435,9 @@ function paiHomePath(...segments) {
|
|
|
7467
7435
|
}
|
|
7468
7436
|
var noticesPrinted = /* @__PURE__ */ new Set();
|
|
7469
7437
|
function resolvePaiFile(newPath, oldCandidates, migrateHint) {
|
|
7470
|
-
if (
|
|
7438
|
+
if (existsSync(newPath)) return newPath;
|
|
7471
7439
|
for (const old of oldCandidates) {
|
|
7472
|
-
if (
|
|
7440
|
+
if (existsSync(old)) {
|
|
7473
7441
|
if (!noticesPrinted.has(newPath)) {
|
|
7474
7442
|
noticesPrinted.add(newPath);
|
|
7475
7443
|
process.stderr.write(
|
|
@@ -7483,6 +7451,74 @@ function resolvePaiFile(newPath, oldCandidates, migrateHint) {
|
|
|
7483
7451
|
return newPath;
|
|
7484
7452
|
}
|
|
7485
7453
|
|
|
7454
|
+
// src/config/main-config.ts
|
|
7455
|
+
var import_yaml2 = __toESM(require_dist(), 1);
|
|
7456
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, renameSync as renameSync3 } from "node:fs";
|
|
7457
|
+
import { dirname as dirname2, join as join2, basename } from "node:path";
|
|
7458
|
+
|
|
7459
|
+
// src/config/json-store.ts
|
|
7460
|
+
import {
|
|
7461
|
+
existsSync as existsSync2,
|
|
7462
|
+
readFileSync as readFileSync2,
|
|
7463
|
+
writeFileSync,
|
|
7464
|
+
copyFileSync as copyFileSync2,
|
|
7465
|
+
renameSync as renameSync2,
|
|
7466
|
+
unlinkSync,
|
|
7467
|
+
mkdirSync as mkdirSync2
|
|
7468
|
+
} from "node:fs";
|
|
7469
|
+
function readJsonStrict(path, label = path) {
|
|
7470
|
+
if (!existsSync2(path)) return {};
|
|
7471
|
+
let raw;
|
|
7472
|
+
try {
|
|
7473
|
+
raw = readFileSync2(path, "utf8");
|
|
7474
|
+
} catch (e) {
|
|
7475
|
+
throw new Error(
|
|
7476
|
+
`Could not read ${label}: ${e instanceof Error ? e.message : String(e)}
|
|
7477
|
+
Refusing to continue \u2014 writing now would replace its contents with ours alone.`
|
|
7478
|
+
);
|
|
7479
|
+
}
|
|
7480
|
+
try {
|
|
7481
|
+
return JSON.parse(raw);
|
|
7482
|
+
} catch (e) {
|
|
7483
|
+
throw new Error(
|
|
7484
|
+
`${label} exists but is not valid JSON: ${e instanceof Error ? e.message : String(e)}
|
|
7485
|
+
Refusing to continue \u2014 overwriting it would destroy whatever it holds.
|
|
7486
|
+
Repair the file, or move it aside and re-run this command.`
|
|
7487
|
+
);
|
|
7488
|
+
}
|
|
7489
|
+
}
|
|
7490
|
+
|
|
7491
|
+
// src/config/yaml-store.ts
|
|
7492
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
7493
|
+
|
|
7494
|
+
// src/config/main-config.ts
|
|
7495
|
+
var MainConfigError = class extends Error {
|
|
7496
|
+
};
|
|
7497
|
+
function yamlSiblingPath(jsonPath) {
|
|
7498
|
+
return join2(dirname2(jsonPath), "config.yaml");
|
|
7499
|
+
}
|
|
7500
|
+
function readDualFormatConfigRaw(jsonPath, yamlPath = yamlSiblingPath(jsonPath)) {
|
|
7501
|
+
if (existsSync3(yamlPath)) {
|
|
7502
|
+
let text;
|
|
7503
|
+
try {
|
|
7504
|
+
text = readFileSync3(yamlPath, "utf8");
|
|
7505
|
+
} catch (e) {
|
|
7506
|
+
throw new MainConfigError(`Could not read ${yamlPath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
7507
|
+
}
|
|
7508
|
+
const doc = (0, import_yaml2.parseDocument)(text);
|
|
7509
|
+
if (doc.errors.length) {
|
|
7510
|
+
throw new MainConfigError(`${yamlPath}: ${doc.errors[0].message}`);
|
|
7511
|
+
}
|
|
7512
|
+
const parsed = doc.toJS();
|
|
7513
|
+
if (parsed === null || parsed === void 0) return {};
|
|
7514
|
+
if (typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
7515
|
+
throw new MainConfigError(`${yamlPath}: top level must be a mapping`);
|
|
7516
|
+
}
|
|
7517
|
+
return parsed;
|
|
7518
|
+
}
|
|
7519
|
+
return readJsonStrict(jsonPath, jsonPath);
|
|
7520
|
+
}
|
|
7521
|
+
|
|
7486
7522
|
// src/daemon/config.ts
|
|
7487
7523
|
function perUserDbName() {
|
|
7488
7524
|
const username = userInfo().username;
|
|
@@ -7493,6 +7529,14 @@ function perUserConnectionString() {
|
|
|
7493
7529
|
const db = perUserDbName();
|
|
7494
7530
|
return `postgresql://pai:pai@localhost:5432/${db}`;
|
|
7495
7531
|
}
|
|
7532
|
+
var DEFAULT_SESSIONS_CACHE_KEEPALIVE = {
|
|
7533
|
+
enabled: false,
|
|
7534
|
+
idleMinutes: 50,
|
|
7535
|
+
maxBeats: 6,
|
|
7536
|
+
activeHours: "08:00-22:00",
|
|
7537
|
+
minContextTokens: 2e4,
|
|
7538
|
+
prompt: "keepalive"
|
|
7539
|
+
};
|
|
7496
7540
|
var DEFAULTS = {
|
|
7497
7541
|
socketPath: paiSocketPath(),
|
|
7498
7542
|
indexIntervalSecs: 300,
|
|
@@ -7511,6 +7555,7 @@ var DEFAULTS = {
|
|
|
7511
7555
|
// Deliberately empty. An install must not guess who the user is: a wrong
|
|
7512
7556
|
// guess here is an address that can be mailed without review.
|
|
7513
7557
|
identity: { selfEmails: [] },
|
|
7558
|
+
sessions: { cacheKeepalive: { ...DEFAULT_SESSIONS_CACHE_KEEPALIVE } },
|
|
7514
7559
|
search: {
|
|
7515
7560
|
mode: "keyword",
|
|
7516
7561
|
rerank: true,
|
|
@@ -7520,30 +7565,37 @@ var DEFAULTS = {
|
|
|
7520
7565
|
}
|
|
7521
7566
|
};
|
|
7522
7567
|
var NEW_CONFIG_FILE = paiHomePath("config.json");
|
|
7523
|
-
var OLD_CONFIG_FILE =
|
|
7524
|
-
var LEGACY_CONFIG_FILE =
|
|
7568
|
+
var OLD_CONFIG_FILE = join3(homedir2(), ".claude", "pai.json");
|
|
7569
|
+
var LEGACY_CONFIG_FILE = join3(homedir2(), ".config", "pai", "config.json");
|
|
7525
7570
|
function paiConfigFilePath() {
|
|
7526
7571
|
const override = process.env.PAI_CONFIG_FILE;
|
|
7527
7572
|
if (override) return override;
|
|
7528
7573
|
return resolvePaiFile(NEW_CONFIG_FILE, [OLD_CONFIG_FILE, LEGACY_CONFIG_FILE], "pai config migrate");
|
|
7529
7574
|
}
|
|
7530
7575
|
var CONFIG_FILE = paiConfigFilePath();
|
|
7531
|
-
var CONFIG_DIR =
|
|
7576
|
+
var CONFIG_DIR = dirname3(CONFIG_FILE);
|
|
7577
|
+
function readMainConfigRaw(path = CONFIG_FILE) {
|
|
7578
|
+
try {
|
|
7579
|
+
return readDualFormatConfigRaw(path);
|
|
7580
|
+
} catch (e) {
|
|
7581
|
+
throw e instanceof MainConfigError ? new Error(e.message) : e;
|
|
7582
|
+
}
|
|
7583
|
+
}
|
|
7532
7584
|
|
|
7533
7585
|
// src/workers/workers-config.ts
|
|
7534
|
-
var
|
|
7535
|
-
import { existsSync as
|
|
7586
|
+
var import_yaml3 = __toESM(require_dist(), 1);
|
|
7587
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2, chmodSync } from "node:fs";
|
|
7536
7588
|
import { homedir as homedir3 } from "node:os";
|
|
7537
|
-
import { dirname as
|
|
7589
|
+
import { dirname as dirname4, join as join4 } from "node:path";
|
|
7538
7590
|
var WORKERS_YAML_FILENAME = "workers.yaml";
|
|
7539
7591
|
function defaultWorkersYamlPath() {
|
|
7540
7592
|
return paiHomePath(WORKERS_YAML_FILENAME);
|
|
7541
7593
|
}
|
|
7542
7594
|
function oldWorkersYamlPath() {
|
|
7543
|
-
return
|
|
7595
|
+
return join4(homedir3(), ".claude", WORKERS_YAML_FILENAME);
|
|
7544
7596
|
}
|
|
7545
7597
|
function legacyWorkersYamlPath() {
|
|
7546
|
-
return
|
|
7598
|
+
return join4(homedir3(), ".config", "pai", WORKERS_YAML_FILENAME);
|
|
7547
7599
|
}
|
|
7548
7600
|
function workersYamlPath() {
|
|
7549
7601
|
const override = process.env.PAI_WORKERS_YAML;
|
|
@@ -7648,7 +7700,8 @@ function parseWorkersYamlDocument(doc, yamlPath) {
|
|
|
7648
7700
|
const provider = typeof target === "string" ? target.split("/")[0] : target.provider;
|
|
7649
7701
|
const alias = typeof target === "string" ? target.split("/")[1] : void 0;
|
|
7650
7702
|
if (provider !== void 0) {
|
|
7651
|
-
|
|
7703
|
+
const native = provider === ANTHROPIC_NATIVE;
|
|
7704
|
+
if (!native && !providers[provider]) {
|
|
7652
7705
|
withLine(
|
|
7653
7706
|
doc,
|
|
7654
7707
|
["classes", cls],
|
|
@@ -7658,19 +7711,36 @@ function parseWorkersYamlDocument(doc, yamlPath) {
|
|
|
7658
7711
|
)
|
|
7659
7712
|
);
|
|
7660
7713
|
}
|
|
7661
|
-
if (alias !== void 0
|
|
7662
|
-
|
|
7663
|
-
|
|
7664
|
-
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7714
|
+
if (alias !== void 0) {
|
|
7715
|
+
if (!isModelCapability(alias)) {
|
|
7716
|
+
withLine(
|
|
7717
|
+
doc,
|
|
7718
|
+
["classes", cls],
|
|
7719
|
+
yamlPath,
|
|
7720
|
+
new WorkersConfigError(
|
|
7721
|
+
`classes.${cls}: "${alias}" is not a valid capability name (must match ^[a-z][a-z0-9-]*$)`
|
|
7722
|
+
)
|
|
7723
|
+
);
|
|
7724
|
+
} else if (!native && providers[provider] && alias !== "default" && !providers[provider].models[alias]) {
|
|
7725
|
+
withLine(
|
|
7726
|
+
doc,
|
|
7727
|
+
["classes", cls],
|
|
7728
|
+
yamlPath,
|
|
7729
|
+
new WorkersConfigError(`classes.${cls}: provider "${provider}" has no "${alias}" model configured`)
|
|
7730
|
+
);
|
|
7731
|
+
}
|
|
7670
7732
|
}
|
|
7671
7733
|
}
|
|
7672
7734
|
}
|
|
7673
7735
|
}
|
|
7736
|
+
let capabilities = {};
|
|
7737
|
+
if (r.capabilities !== void 0) {
|
|
7738
|
+
try {
|
|
7739
|
+
capabilities = parseCapabilitiesValue(r.capabilities, "capabilities");
|
|
7740
|
+
} catch (e) {
|
|
7741
|
+
withLine(doc, ["capabilities"], yamlPath, e);
|
|
7742
|
+
}
|
|
7743
|
+
}
|
|
7674
7744
|
let mcpSets = {};
|
|
7675
7745
|
if (r.mcp_sets !== void 0) {
|
|
7676
7746
|
try {
|
|
@@ -7692,19 +7762,19 @@ function parseWorkersYamlDocument(doc, yamlPath) {
|
|
|
7692
7762
|
)
|
|
7693
7763
|
);
|
|
7694
7764
|
}
|
|
7695
|
-
return { active, providers, classes, mcpSets, nativeModels };
|
|
7765
|
+
return { active, providers, classes, capabilities, mcpSets, nativeModels };
|
|
7696
7766
|
}
|
|
7697
7767
|
function readWorkersYaml(yamlPath) {
|
|
7698
|
-
if (!
|
|
7768
|
+
if (!existsSync4(yamlPath)) return null;
|
|
7699
7769
|
let text;
|
|
7700
7770
|
try {
|
|
7701
|
-
text =
|
|
7771
|
+
text = readFileSync4(yamlPath, "utf8");
|
|
7702
7772
|
} catch (e) {
|
|
7703
7773
|
throw new WorkersConfigError(
|
|
7704
7774
|
`Could not read ${yamlPath}: ${e instanceof Error ? e.message : String(e)}`
|
|
7705
7775
|
);
|
|
7706
7776
|
}
|
|
7707
|
-
const doc = (0,
|
|
7777
|
+
const doc = (0, import_yaml3.parseDocument)(text);
|
|
7708
7778
|
if (doc.errors.length) {
|
|
7709
7779
|
throw new WorkersConfigError(`${yamlPath}: ${doc.errors[0].message}`);
|
|
7710
7780
|
}
|
|
@@ -7728,8 +7798,9 @@ var PROVIDER_TAGS = [
|
|
|
7728
7798
|
"reasoning"
|
|
7729
7799
|
];
|
|
7730
7800
|
var MODEL_CAPABILITIES = ["default", "fast", "image"];
|
|
7801
|
+
var CAPABILITY_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
7731
7802
|
function isModelCapability(v) {
|
|
7732
|
-
return
|
|
7803
|
+
return CAPABILITY_NAME_RE.test(v);
|
|
7733
7804
|
}
|
|
7734
7805
|
var DEFAULT_LOG_DIR = "~/.claude/logs/workers";
|
|
7735
7806
|
var DEFAULT_PANE = {
|
|
@@ -7757,6 +7828,7 @@ function defaultWorkersConfig() {
|
|
|
7757
7828
|
providers: {},
|
|
7758
7829
|
classes: {},
|
|
7759
7830
|
mcpSets: { ...DEFAULT_MCP_SETS },
|
|
7831
|
+
capabilities: {},
|
|
7760
7832
|
pane: { ...DEFAULT_PANE },
|
|
7761
7833
|
logDir: DEFAULT_LOG_DIR,
|
|
7762
7834
|
routing: { ...DEFAULT_ROUTING2, order: [] },
|
|
@@ -7784,7 +7856,10 @@ function parseModelsBlock(pathPrefix, modelsRaw) {
|
|
|
7784
7856
|
for (const key of Object.keys(m)) {
|
|
7785
7857
|
if (key === "default") continue;
|
|
7786
7858
|
if (!isModelCapability(key)) {
|
|
7787
|
-
bad(
|
|
7859
|
+
bad(
|
|
7860
|
+
`${pathPrefix}.${key}`,
|
|
7861
|
+
`"${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)`
|
|
7862
|
+
);
|
|
7788
7863
|
}
|
|
7789
7864
|
const id = str(m[key]);
|
|
7790
7865
|
if (!id) bad(`${pathPrefix}.${key}`, "must be a non-empty model id");
|
|
@@ -7806,8 +7881,8 @@ function parseProvider(name, raw) {
|
|
|
7806
7881
|
bad(`.providers.${name}.protocol`, `"${str(p.protocol)}" is neither "anthropic" nor "openai"`);
|
|
7807
7882
|
}
|
|
7808
7883
|
const engine = p.engine === void 0 ? "claude" : str(p.engine);
|
|
7809
|
-
if (engine !== "claude" && engine !== "codex") {
|
|
7810
|
-
bad(`.providers.${name}.engine`, `"${str(p.engine)}" is
|
|
7884
|
+
if (engine !== "claude" && engine !== "codex" && engine !== "image") {
|
|
7885
|
+
bad(`.providers.${name}.engine`, `"${str(p.engine)}" is none of "claude", "codex", "image"`);
|
|
7811
7886
|
}
|
|
7812
7887
|
const baseUrl = str(p.baseUrl);
|
|
7813
7888
|
if (!baseUrl && protocol !== "openai") bad(`.providers.${name}.baseUrl`, "is required");
|
|
@@ -8015,6 +8090,23 @@ function parseMcpSetsValue(raw, badPathPrefix) {
|
|
|
8015
8090
|
}
|
|
8016
8091
|
return mcpSets;
|
|
8017
8092
|
}
|
|
8093
|
+
function parseCapabilitiesValue(raw, badPathPrefix) {
|
|
8094
|
+
const capabilities = {};
|
|
8095
|
+
if (raw === void 0) return capabilities;
|
|
8096
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
8097
|
+
bad(badPathPrefix, "must be an object of capability name \u2192 [provider names]");
|
|
8098
|
+
}
|
|
8099
|
+
for (const [name, order] of Object.entries(raw)) {
|
|
8100
|
+
if (!isModelCapability(name)) {
|
|
8101
|
+
bad(`${badPathPrefix}.${name}`, `"${name}" is not a valid capability name (must match ^[a-z][a-z0-9-]*$)`);
|
|
8102
|
+
}
|
|
8103
|
+
if (!Array.isArray(order) || order.length === 0 || order.some((x) => typeof x !== "string" || !x)) {
|
|
8104
|
+
bad(`${badPathPrefix}.${name}`, "must be a non-empty array of provider names");
|
|
8105
|
+
}
|
|
8106
|
+
capabilities[name] = order;
|
|
8107
|
+
}
|
|
8108
|
+
return capabilities;
|
|
8109
|
+
}
|
|
8018
8110
|
function parseWorkersConfig(raw) {
|
|
8019
8111
|
const d = defaultWorkersConfig();
|
|
8020
8112
|
if (raw === void 0 || raw === null) return d;
|
|
@@ -8034,6 +8126,7 @@ function parseWorkersConfig(raw) {
|
|
|
8034
8126
|
const classesRaw = w.classes !== void 0 ? w.classes : w.roles;
|
|
8035
8127
|
const classes = parseClassesValue(classesRaw, w.classes !== void 0 ? ".classes" : ".roles");
|
|
8036
8128
|
const mcpSets = parseMcpSetsValue(w.mcpSets, ".mcpSets");
|
|
8129
|
+
const capabilities = parseCapabilitiesValue(w.capabilities, ".capabilities");
|
|
8037
8130
|
let pane = { ...DEFAULT_PANE };
|
|
8038
8131
|
if (w.pane !== void 0) {
|
|
8039
8132
|
if (typeof w.pane !== "object" || w.pane === null) bad(".pane", "must be an object");
|
|
@@ -8143,6 +8236,7 @@ function parseWorkersConfig(raw) {
|
|
|
8143
8236
|
providers,
|
|
8144
8237
|
classes,
|
|
8145
8238
|
mcpSets,
|
|
8239
|
+
capabilities,
|
|
8146
8240
|
pane,
|
|
8147
8241
|
logDir: str(w.logDir) || d.logDir,
|
|
8148
8242
|
routing,
|
|
@@ -8153,7 +8247,7 @@ function parseWorkersConfig(raw) {
|
|
|
8153
8247
|
};
|
|
8154
8248
|
}
|
|
8155
8249
|
function readWorkersSection(path = CONFIG_FILE) {
|
|
8156
|
-
const raw =
|
|
8250
|
+
const raw = readMainConfigRaw(path);
|
|
8157
8251
|
const workers = parseWorkersConfig(raw.workers);
|
|
8158
8252
|
const yaml = readWorkersYaml(workersYamlPath());
|
|
8159
8253
|
if (yaml) {
|
|
@@ -8161,29 +8255,30 @@ function readWorkersSection(path = CONFIG_FILE) {
|
|
|
8161
8255
|
workers.providers = yaml.data.providers;
|
|
8162
8256
|
workers.classes = yaml.data.classes;
|
|
8163
8257
|
workers.mcpSets = yaml.data.mcpSets;
|
|
8258
|
+
workers.capabilities = yaml.data.capabilities;
|
|
8164
8259
|
workers.nativeModels = yaml.data.nativeModels;
|
|
8165
8260
|
}
|
|
8166
8261
|
return { raw, workers };
|
|
8167
8262
|
}
|
|
8168
8263
|
function expandHome(p) {
|
|
8169
|
-
if (p === "~" || p.startsWith("~/")) return
|
|
8264
|
+
if (p === "~" || p.startsWith("~/")) return join5(homedir4(), p.slice(1));
|
|
8170
8265
|
return p;
|
|
8171
8266
|
}
|
|
8172
8267
|
|
|
8173
8268
|
// src/workers/paths.ts
|
|
8174
|
-
import { join as
|
|
8269
|
+
import { join as join6 } from "node:path";
|
|
8175
8270
|
function workersLogDir(config) {
|
|
8176
8271
|
const expanded = expandHome(config.logDir);
|
|
8177
8272
|
if (config.logDir !== DEFAULT_LOG_DIR) return expanded;
|
|
8178
8273
|
return resolvePaiFile(paiHomePath("logs", "workers"), [expanded], "pai config migrate --logs");
|
|
8179
8274
|
}
|
|
8180
8275
|
function ledgerPath(logDir) {
|
|
8181
|
-
return
|
|
8276
|
+
return join6(logDir, "ledger.log");
|
|
8182
8277
|
}
|
|
8183
8278
|
|
|
8184
8279
|
// src/workers/ledger.ts
|
|
8185
|
-
import { appendFileSync, existsSync as
|
|
8186
|
-
import { dirname as
|
|
8280
|
+
import { appendFileSync, existsSync as existsSync5, mkdirSync as mkdirSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
8281
|
+
import { dirname as dirname5 } from "node:path";
|
|
8187
8282
|
function ledgerStamp(d = /* @__PURE__ */ new Date()) {
|
|
8188
8283
|
const p = (n) => String(n).padStart(2, "0");
|
|
8189
8284
|
return `${d.getFullYear()}-${p(d.getMonth() + 1)}-${p(d.getDate())} ${p(d.getHours())}:${p(d.getMinutes())}:${p(d.getSeconds())}`;
|
|
@@ -8194,8 +8289,8 @@ function appendLedger(path, event, kv, now = /* @__PURE__ */ new Date()) {
|
|
|
8194
8289
|
if (v === void 0 || v === null) continue;
|
|
8195
8290
|
parts.push(`${k}=${String(v).replace(/\s+/g, " ")}`);
|
|
8196
8291
|
}
|
|
8197
|
-
const dir =
|
|
8198
|
-
if (!
|
|
8292
|
+
const dir = dirname5(path);
|
|
8293
|
+
if (!existsSync5(dir)) mkdirSync3(dir, { recursive: true });
|
|
8199
8294
|
const tail = parts.length ? " " + parts.join(" ") : "";
|
|
8200
8295
|
appendFileSync(path, `${ledgerStamp(now)} ${event}${tail}
|
|
8201
8296
|
`, "utf8");
|