@tekmidian/pai 0.48.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-Bgv1lFFA.mjs → program-BX67-4I2.mjs} +536 -260
- 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/audit.md +1 -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-Bgv1lFFA.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
|
@@ -2028,7 +2028,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2028
2028
|
}
|
|
2029
2029
|
return void 0;
|
|
2030
2030
|
}
|
|
2031
|
-
var
|
|
2031
|
+
var YAMLMap2 = class extends Collection.Collection {
|
|
2032
2032
|
static get tagName() {
|
|
2033
2033
|
return "tag:yaml.org,2002:map";
|
|
2034
2034
|
}
|
|
@@ -2145,7 +2145,7 @@ var require_YAMLMap = __commonJS({
|
|
|
2145
2145
|
});
|
|
2146
2146
|
}
|
|
2147
2147
|
};
|
|
2148
|
-
exports.YAMLMap =
|
|
2148
|
+
exports.YAMLMap = YAMLMap2;
|
|
2149
2149
|
exports.findPair = findPair;
|
|
2150
2150
|
}
|
|
2151
2151
|
});
|
|
@@ -2155,18 +2155,18 @@ var require_map = __commonJS({
|
|
|
2155
2155
|
"node_modules/yaml/dist/schema/common/map.js"(exports) {
|
|
2156
2156
|
"use strict";
|
|
2157
2157
|
var identity = require_identity();
|
|
2158
|
-
var
|
|
2158
|
+
var YAMLMap2 = require_YAMLMap();
|
|
2159
2159
|
var map = {
|
|
2160
2160
|
collection: "map",
|
|
2161
2161
|
default: true,
|
|
2162
|
-
nodeClass:
|
|
2162
|
+
nodeClass: YAMLMap2.YAMLMap,
|
|
2163
2163
|
tag: "tag:yaml.org,2002:map",
|
|
2164
2164
|
resolve(map2, onError) {
|
|
2165
2165
|
if (!identity.isMap(map2))
|
|
2166
2166
|
onError("Expected a mapping for this tag");
|
|
2167
2167
|
return map2;
|
|
2168
2168
|
},
|
|
2169
|
-
createNode: (schema, obj, ctx) =>
|
|
2169
|
+
createNode: (schema, obj, ctx) => YAMLMap2.YAMLMap.from(schema, obj, ctx)
|
|
2170
2170
|
};
|
|
2171
2171
|
exports.map = map;
|
|
2172
2172
|
}
|
|
@@ -2734,17 +2734,17 @@ var require_omap = __commonJS({
|
|
|
2734
2734
|
"use strict";
|
|
2735
2735
|
var identity = require_identity();
|
|
2736
2736
|
var toJS = require_toJS();
|
|
2737
|
-
var
|
|
2737
|
+
var YAMLMap2 = require_YAMLMap();
|
|
2738
2738
|
var YAMLSeq = require_YAMLSeq();
|
|
2739
2739
|
var pairs = require_pairs();
|
|
2740
2740
|
var YAMLOMap = class _YAMLOMap extends YAMLSeq.YAMLSeq {
|
|
2741
2741
|
constructor() {
|
|
2742
2742
|
super();
|
|
2743
|
-
this.add =
|
|
2744
|
-
this.delete =
|
|
2745
|
-
this.get =
|
|
2746
|
-
this.has =
|
|
2747
|
-
this.set =
|
|
2743
|
+
this.add = YAMLMap2.YAMLMap.prototype.add.bind(this);
|
|
2744
|
+
this.delete = YAMLMap2.YAMLMap.prototype.delete.bind(this);
|
|
2745
|
+
this.get = YAMLMap2.YAMLMap.prototype.get.bind(this);
|
|
2746
|
+
this.has = YAMLMap2.YAMLMap.prototype.has.bind(this);
|
|
2747
|
+
this.set = YAMLMap2.YAMLMap.prototype.set.bind(this);
|
|
2748
2748
|
this.tag = _YAMLOMap.tag;
|
|
2749
2749
|
}
|
|
2750
2750
|
/**
|
|
@@ -2972,8 +2972,8 @@ var require_set = __commonJS({
|
|
|
2972
2972
|
"use strict";
|
|
2973
2973
|
var identity = require_identity();
|
|
2974
2974
|
var Pair = require_Pair();
|
|
2975
|
-
var
|
|
2976
|
-
var YAMLSet = class _YAMLSet extends
|
|
2975
|
+
var YAMLMap2 = require_YAMLMap();
|
|
2976
|
+
var YAMLSet = class _YAMLSet extends YAMLMap2.YAMLMap {
|
|
2977
2977
|
constructor(schema) {
|
|
2978
2978
|
super(schema);
|
|
2979
2979
|
this.tag = _YAMLSet.tag;
|
|
@@ -2986,7 +2986,7 @@ var require_set = __commonJS({
|
|
|
2986
2986
|
pair = new Pair.Pair(key.key, null);
|
|
2987
2987
|
else
|
|
2988
2988
|
pair = new Pair.Pair(key, null);
|
|
2989
|
-
const prev =
|
|
2989
|
+
const prev = YAMLMap2.findPair(this.items, pair.key);
|
|
2990
2990
|
if (!prev)
|
|
2991
2991
|
this.items.push(pair);
|
|
2992
2992
|
}
|
|
@@ -2995,13 +2995,13 @@ var require_set = __commonJS({
|
|
|
2995
2995
|
* Otherwise, returns the value of that Pair's key.
|
|
2996
2996
|
*/
|
|
2997
2997
|
get(key, keepPair) {
|
|
2998
|
-
const pair =
|
|
2998
|
+
const pair = YAMLMap2.findPair(this.items, key);
|
|
2999
2999
|
return !keepPair && identity.isPair(pair) ? identity.isScalar(pair.key) ? pair.key.value : pair.key : pair;
|
|
3000
3000
|
}
|
|
3001
3001
|
set(key, value) {
|
|
3002
3002
|
if (typeof value !== "boolean")
|
|
3003
3003
|
throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);
|
|
3004
|
-
const prev =
|
|
3004
|
+
const prev = YAMLMap2.findPair(this.items, key);
|
|
3005
3005
|
if (prev && !value) {
|
|
3006
3006
|
this.items.splice(this.items.indexOf(prev), 1);
|
|
3007
3007
|
} else if (!prev && value) {
|
|
@@ -3408,7 +3408,7 @@ var require_Document = __commonJS({
|
|
|
3408
3408
|
var applyReviver = require_applyReviver();
|
|
3409
3409
|
var createNode = require_createNode();
|
|
3410
3410
|
var directives = require_directives();
|
|
3411
|
-
var
|
|
3411
|
+
var Document4 = class _Document {
|
|
3412
3412
|
constructor(value, replacer, options) {
|
|
3413
3413
|
this.commentBefore = null;
|
|
3414
3414
|
this.comment = null;
|
|
@@ -3698,7 +3698,7 @@ var require_Document = __commonJS({
|
|
|
3698
3698
|
return true;
|
|
3699
3699
|
throw new Error("Expected a YAML collection as document contents");
|
|
3700
3700
|
}
|
|
3701
|
-
exports.Document =
|
|
3701
|
+
exports.Document = Document4;
|
|
3702
3702
|
}
|
|
3703
3703
|
});
|
|
3704
3704
|
|
|
@@ -3982,14 +3982,14 @@ var require_resolve_block_map = __commonJS({
|
|
|
3982
3982
|
"node_modules/yaml/dist/compose/resolve-block-map.js"(exports) {
|
|
3983
3983
|
"use strict";
|
|
3984
3984
|
var Pair = require_Pair();
|
|
3985
|
-
var
|
|
3985
|
+
var YAMLMap2 = require_YAMLMap();
|
|
3986
3986
|
var resolveProps = require_resolve_props();
|
|
3987
3987
|
var utilContainsNewline = require_util_contains_newline();
|
|
3988
3988
|
var utilFlowIndentCheck = require_util_flow_indent_check();
|
|
3989
3989
|
var utilMapIncludes = require_util_map_includes();
|
|
3990
3990
|
var startColMsg = "All mapping items must start at the same column";
|
|
3991
3991
|
function resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {
|
|
3992
|
-
const NodeClass = tag?.nodeClass ??
|
|
3992
|
+
const NodeClass = tag?.nodeClass ?? YAMLMap2.YAMLMap;
|
|
3993
3993
|
const map = new NodeClass(ctx.schema);
|
|
3994
3994
|
if (ctx.atRoot)
|
|
3995
3995
|
ctx.atRoot = false;
|
|
@@ -4185,7 +4185,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4185
4185
|
"use strict";
|
|
4186
4186
|
var identity = require_identity();
|
|
4187
4187
|
var Pair = require_Pair();
|
|
4188
|
-
var
|
|
4188
|
+
var YAMLMap2 = require_YAMLMap();
|
|
4189
4189
|
var YAMLSeq = require_YAMLSeq();
|
|
4190
4190
|
var resolveEnd = require_resolve_end();
|
|
4191
4191
|
var resolveProps = require_resolve_props();
|
|
@@ -4196,7 +4196,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4196
4196
|
function resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {
|
|
4197
4197
|
const isMap = fc.start.source === "{";
|
|
4198
4198
|
const fcName = isMap ? "flow map" : "flow sequence";
|
|
4199
|
-
const NodeClass = tag?.nodeClass ?? (isMap ?
|
|
4199
|
+
const NodeClass = tag?.nodeClass ?? (isMap ? YAMLMap2.YAMLMap : YAMLSeq.YAMLSeq);
|
|
4200
4200
|
const coll = new NodeClass(ctx.schema);
|
|
4201
4201
|
coll.flow = true;
|
|
4202
4202
|
const atRoot = ctx.atRoot;
|
|
@@ -4333,7 +4333,7 @@ var require_resolve_flow_collection = __commonJS({
|
|
|
4333
4333
|
onError(keyStart, "DUPLICATE_KEY", "Map keys must be unique");
|
|
4334
4334
|
map.items.push(pair);
|
|
4335
4335
|
} else {
|
|
4336
|
-
const map = new
|
|
4336
|
+
const map = new YAMLMap2.YAMLMap(ctx.schema);
|
|
4337
4337
|
map.flow = true;
|
|
4338
4338
|
map.items.push(pair);
|
|
4339
4339
|
const endRange = (valueNode ?? keyNode).range;
|
|
@@ -4379,7 +4379,7 @@ var require_compose_collection = __commonJS({
|
|
|
4379
4379
|
"use strict";
|
|
4380
4380
|
var identity = require_identity();
|
|
4381
4381
|
var Scalar2 = require_Scalar();
|
|
4382
|
-
var
|
|
4382
|
+
var YAMLMap2 = require_YAMLMap();
|
|
4383
4383
|
var YAMLSeq = require_YAMLSeq();
|
|
4384
4384
|
var resolveBlockMap = require_resolve_block_map();
|
|
4385
4385
|
var resolveBlockSeq = require_resolve_block_seq();
|
|
@@ -4407,7 +4407,7 @@ var require_compose_collection = __commonJS({
|
|
|
4407
4407
|
}
|
|
4408
4408
|
}
|
|
4409
4409
|
const expType = token.type === "block-map" ? "map" : token.type === "block-seq" ? "seq" : token.start.source === "{" ? "map" : "seq";
|
|
4410
|
-
if (!tagToken || !tagName || tagName === "!" || tagName ===
|
|
4410
|
+
if (!tagToken || !tagName || tagName === "!" || tagName === YAMLMap2.YAMLMap.tagName && expType === "map" || tagName === YAMLSeq.YAMLSeq.tagName && expType === "seq") {
|
|
4411
4411
|
return resolveCollection(CN, ctx, token, onError, tagName);
|
|
4412
4412
|
}
|
|
4413
4413
|
let tag = ctx.schema.tags.find((t) => t.tag === tagName && t.collection === expType);
|
|
@@ -5063,13 +5063,13 @@ var require_compose_node = __commonJS({
|
|
|
5063
5063
|
var require_compose_doc = __commonJS({
|
|
5064
5064
|
"node_modules/yaml/dist/compose/compose-doc.js"(exports) {
|
|
5065
5065
|
"use strict";
|
|
5066
|
-
var
|
|
5066
|
+
var Document4 = require_Document();
|
|
5067
5067
|
var composeNode = require_compose_node();
|
|
5068
5068
|
var resolveEnd = require_resolve_end();
|
|
5069
5069
|
var resolveProps = require_resolve_props();
|
|
5070
5070
|
function composeDoc(options, directives, { offset, start, value, end }, onError) {
|
|
5071
5071
|
const opts = Object.assign({ _directives: directives }, options);
|
|
5072
|
-
const doc = new
|
|
5072
|
+
const doc = new Document4.Document(void 0, opts);
|
|
5073
5073
|
const ctx = {
|
|
5074
5074
|
atKey: false,
|
|
5075
5075
|
atRoot: true,
|
|
@@ -5108,7 +5108,7 @@ var require_composer = __commonJS({
|
|
|
5108
5108
|
"use strict";
|
|
5109
5109
|
var node_process = __require("process");
|
|
5110
5110
|
var directives = require_directives();
|
|
5111
|
-
var
|
|
5111
|
+
var Document4 = require_Document();
|
|
5112
5112
|
var errors = require_errors();
|
|
5113
5113
|
var identity = require_identity();
|
|
5114
5114
|
var composeDoc = require_compose_doc();
|
|
@@ -5297,7 +5297,7 @@ ${end.comment}` : end.comment;
|
|
|
5297
5297
|
this.doc = null;
|
|
5298
5298
|
} else if (forceDoc) {
|
|
5299
5299
|
const opts = Object.assign({ _directives: this.directives }, this.options);
|
|
5300
|
-
const doc = new
|
|
5300
|
+
const doc = new Document4.Document(void 0, opts);
|
|
5301
5301
|
if (this.atDirectives)
|
|
5302
5302
|
this.onError(endOffset, "MISSING_CHAR", "Missing directives-end indicator line");
|
|
5303
5303
|
doc.range = [0, endOffset, endOffset];
|
|
@@ -7219,7 +7219,7 @@ var require_public_api = __commonJS({
|
|
|
7219
7219
|
"node_modules/yaml/dist/public-api.js"(exports) {
|
|
7220
7220
|
"use strict";
|
|
7221
7221
|
var composer = require_composer();
|
|
7222
|
-
var
|
|
7222
|
+
var Document4 = require_Document();
|
|
7223
7223
|
var errors = require_errors();
|
|
7224
7224
|
var log = require_log();
|
|
7225
7225
|
var identity = require_identity();
|
|
@@ -7244,7 +7244,7 @@ var require_public_api = __commonJS({
|
|
|
7244
7244
|
return docs;
|
|
7245
7245
|
return Object.assign([], { empty: true }, composer$1.streamInfo());
|
|
7246
7246
|
}
|
|
7247
|
-
function
|
|
7247
|
+
function parseDocument4(source, options = {}) {
|
|
7248
7248
|
const { lineCounter: lineCounter2, prettyErrors } = parseOptions(options);
|
|
7249
7249
|
const parser$1 = new parser.Parser(lineCounter2?.addNewLine);
|
|
7250
7250
|
const composer$1 = new composer.Composer(options);
|
|
@@ -7270,7 +7270,7 @@ var require_public_api = __commonJS({
|
|
|
7270
7270
|
} else if (options === void 0 && reviver && typeof reviver === "object") {
|
|
7271
7271
|
options = reviver;
|
|
7272
7272
|
}
|
|
7273
|
-
const doc =
|
|
7273
|
+
const doc = parseDocument4(src, options);
|
|
7274
7274
|
if (!doc)
|
|
7275
7275
|
return null;
|
|
7276
7276
|
doc.warnings.forEach((warning) => log.warn(doc.options.logLevel, warning));
|
|
@@ -7302,11 +7302,11 @@ var require_public_api = __commonJS({
|
|
|
7302
7302
|
}
|
|
7303
7303
|
if (identity.isDocument(value) && !_replacer)
|
|
7304
7304
|
return value.toString(options);
|
|
7305
|
-
return new
|
|
7305
|
+
return new Document4.Document(value, _replacer, options).toString(options);
|
|
7306
7306
|
}
|
|
7307
7307
|
exports.parse = parse;
|
|
7308
7308
|
exports.parseAllDocuments = parseAllDocuments;
|
|
7309
|
-
exports.parseDocument =
|
|
7309
|
+
exports.parseDocument = parseDocument4;
|
|
7310
7310
|
exports.stringify = stringify;
|
|
7311
7311
|
}
|
|
7312
7312
|
});
|
|
@@ -7316,14 +7316,14 @@ var require_dist = __commonJS({
|
|
|
7316
7316
|
"node_modules/yaml/dist/index.js"(exports) {
|
|
7317
7317
|
"use strict";
|
|
7318
7318
|
var composer = require_composer();
|
|
7319
|
-
var
|
|
7319
|
+
var Document4 = require_Document();
|
|
7320
7320
|
var Schema = require_Schema();
|
|
7321
7321
|
var errors = require_errors();
|
|
7322
7322
|
var Alias = require_Alias();
|
|
7323
7323
|
var identity = require_identity();
|
|
7324
7324
|
var Pair = require_Pair();
|
|
7325
7325
|
var Scalar2 = require_Scalar();
|
|
7326
|
-
var
|
|
7326
|
+
var YAMLMap2 = require_YAMLMap();
|
|
7327
7327
|
var YAMLSeq = require_YAMLSeq();
|
|
7328
7328
|
var cst = require_cst();
|
|
7329
7329
|
var lexer = require_lexer();
|
|
@@ -7332,7 +7332,7 @@ var require_dist = __commonJS({
|
|
|
7332
7332
|
var publicApi = require_public_api();
|
|
7333
7333
|
var visit = require_visit();
|
|
7334
7334
|
exports.Composer = composer.Composer;
|
|
7335
|
-
exports.Document =
|
|
7335
|
+
exports.Document = Document4.Document;
|
|
7336
7336
|
exports.Schema = Schema.Schema;
|
|
7337
7337
|
exports.YAMLError = errors.YAMLError;
|
|
7338
7338
|
exports.YAMLParseError = errors.YAMLParseError;
|
|
@@ -7348,7 +7348,7 @@ var require_dist = __commonJS({
|
|
|
7348
7348
|
exports.isSeq = identity.isSeq;
|
|
7349
7349
|
exports.Pair = Pair.Pair;
|
|
7350
7350
|
exports.Scalar = Scalar2.Scalar;
|
|
7351
|
-
exports.YAMLMap =
|
|
7351
|
+
exports.YAMLMap = YAMLMap2.YAMLMap;
|
|
7352
7352
|
exports.YAMLSeq = YAMLSeq.YAMLSeq;
|
|
7353
7353
|
exports.CST = cst;
|
|
7354
7354
|
exports.Lexer = lexer.Lexer;
|
|
@@ -7364,48 +7364,16 @@ var require_dist = __commonJS({
|
|
|
7364
7364
|
});
|
|
7365
7365
|
|
|
7366
7366
|
// src/workers/standalone/proxy.ts
|
|
7367
|
-
import { writeFileSync as writeFileSync3, mkdirSync as
|
|
7367
|
+
import { writeFileSync as writeFileSync3, mkdirSync as mkdirSync3 } from "node:fs";
|
|
7368
7368
|
|
|
7369
7369
|
// src/workers/config.ts
|
|
7370
|
-
import { existsSync as
|
|
7370
|
+
import { existsSync as existsSync5, readFileSync as readFileSync5 } from "node:fs";
|
|
7371
7371
|
import { homedir as homedir4 } from "node:os";
|
|
7372
|
-
import { join as
|
|
7373
|
-
|
|
7374
|
-
// src/config/json-store.ts
|
|
7375
|
-
import {
|
|
7376
|
-
existsSync,
|
|
7377
|
-
readFileSync,
|
|
7378
|
-
writeFileSync,
|
|
7379
|
-
copyFileSync,
|
|
7380
|
-
renameSync,
|
|
7381
|
-
unlinkSync,
|
|
7382
|
-
mkdirSync
|
|
7383
|
-
} from "node:fs";
|
|
7384
|
-
function readJsonStrict(path, label = path) {
|
|
7385
|
-
if (!existsSync(path)) return {};
|
|
7386
|
-
let raw;
|
|
7387
|
-
try {
|
|
7388
|
-
raw = readFileSync(path, "utf8");
|
|
7389
|
-
} catch (e) {
|
|
7390
|
-
throw new Error(
|
|
7391
|
-
`Could not read ${label}: ${e instanceof Error ? e.message : String(e)}
|
|
7392
|
-
Refusing to continue \u2014 writing now would replace its contents with ours alone.`
|
|
7393
|
-
);
|
|
7394
|
-
}
|
|
7395
|
-
try {
|
|
7396
|
-
return JSON.parse(raw);
|
|
7397
|
-
} catch (e) {
|
|
7398
|
-
throw new Error(
|
|
7399
|
-
`${label} exists but is not valid JSON: ${e instanceof Error ? e.message : String(e)}
|
|
7400
|
-
Refusing to continue \u2014 overwriting it would destroy whatever it holds.
|
|
7401
|
-
Repair the file, or move it aside and re-run this command.`
|
|
7402
|
-
);
|
|
7403
|
-
}
|
|
7404
|
-
}
|
|
7372
|
+
import { join as join5 } from "node:path";
|
|
7405
7373
|
|
|
7406
7374
|
// src/daemon/config.ts
|
|
7407
7375
|
import { homedir as homedir2, userInfo } from "node:os";
|
|
7408
|
-
import { join as
|
|
7376
|
+
import { join as join3, dirname as dirname3 } from "node:path";
|
|
7409
7377
|
|
|
7410
7378
|
// src/notifications/types.ts
|
|
7411
7379
|
var DEFAULT_ROUTING = {
|
|
@@ -7459,7 +7427,7 @@ function paiSocketPath() {
|
|
|
7459
7427
|
}
|
|
7460
7428
|
|
|
7461
7429
|
// src/config/pai-home.ts
|
|
7462
|
-
import { existsSync
|
|
7430
|
+
import { existsSync, mkdirSync, readFileSync, copyFileSync, renameSync, readdirSync, statSync } from "node:fs";
|
|
7463
7431
|
import { homedir } from "node:os";
|
|
7464
7432
|
import { join, dirname } from "node:path";
|
|
7465
7433
|
function paiHomeDir() {
|
|
@@ -7470,9 +7438,9 @@ function paiHomePath(...segments) {
|
|
|
7470
7438
|
}
|
|
7471
7439
|
var noticesPrinted = /* @__PURE__ */ new Set();
|
|
7472
7440
|
function resolvePaiFile(newPath, oldCandidates, migrateHint) {
|
|
7473
|
-
if (
|
|
7441
|
+
if (existsSync(newPath)) return newPath;
|
|
7474
7442
|
for (const old of oldCandidates) {
|
|
7475
|
-
if (
|
|
7443
|
+
if (existsSync(old)) {
|
|
7476
7444
|
if (!noticesPrinted.has(newPath)) {
|
|
7477
7445
|
noticesPrinted.add(newPath);
|
|
7478
7446
|
process.stderr.write(
|
|
@@ -7486,6 +7454,74 @@ function resolvePaiFile(newPath, oldCandidates, migrateHint) {
|
|
|
7486
7454
|
return newPath;
|
|
7487
7455
|
}
|
|
7488
7456
|
|
|
7457
|
+
// src/config/main-config.ts
|
|
7458
|
+
var import_yaml2 = __toESM(require_dist(), 1);
|
|
7459
|
+
import { existsSync as existsSync3, readFileSync as readFileSync3, renameSync as renameSync3 } from "node:fs";
|
|
7460
|
+
import { dirname as dirname2, join as join2, basename } from "node:path";
|
|
7461
|
+
|
|
7462
|
+
// src/config/json-store.ts
|
|
7463
|
+
import {
|
|
7464
|
+
existsSync as existsSync2,
|
|
7465
|
+
readFileSync as readFileSync2,
|
|
7466
|
+
writeFileSync,
|
|
7467
|
+
copyFileSync as copyFileSync2,
|
|
7468
|
+
renameSync as renameSync2,
|
|
7469
|
+
unlinkSync,
|
|
7470
|
+
mkdirSync as mkdirSync2
|
|
7471
|
+
} from "node:fs";
|
|
7472
|
+
function readJsonStrict(path, label = path) {
|
|
7473
|
+
if (!existsSync2(path)) return {};
|
|
7474
|
+
let raw;
|
|
7475
|
+
try {
|
|
7476
|
+
raw = readFileSync2(path, "utf8");
|
|
7477
|
+
} catch (e) {
|
|
7478
|
+
throw new Error(
|
|
7479
|
+
`Could not read ${label}: ${e instanceof Error ? e.message : String(e)}
|
|
7480
|
+
Refusing to continue \u2014 writing now would replace its contents with ours alone.`
|
|
7481
|
+
);
|
|
7482
|
+
}
|
|
7483
|
+
try {
|
|
7484
|
+
return JSON.parse(raw);
|
|
7485
|
+
} catch (e) {
|
|
7486
|
+
throw new Error(
|
|
7487
|
+
`${label} exists but is not valid JSON: ${e instanceof Error ? e.message : String(e)}
|
|
7488
|
+
Refusing to continue \u2014 overwriting it would destroy whatever it holds.
|
|
7489
|
+
Repair the file, or move it aside and re-run this command.`
|
|
7490
|
+
);
|
|
7491
|
+
}
|
|
7492
|
+
}
|
|
7493
|
+
|
|
7494
|
+
// src/config/yaml-store.ts
|
|
7495
|
+
var import_yaml = __toESM(require_dist(), 1);
|
|
7496
|
+
|
|
7497
|
+
// src/config/main-config.ts
|
|
7498
|
+
var MainConfigError = class extends Error {
|
|
7499
|
+
};
|
|
7500
|
+
function yamlSiblingPath(jsonPath) {
|
|
7501
|
+
return join2(dirname2(jsonPath), "config.yaml");
|
|
7502
|
+
}
|
|
7503
|
+
function readDualFormatConfigRaw(jsonPath, yamlPath = yamlSiblingPath(jsonPath)) {
|
|
7504
|
+
if (existsSync3(yamlPath)) {
|
|
7505
|
+
let text;
|
|
7506
|
+
try {
|
|
7507
|
+
text = readFileSync3(yamlPath, "utf8");
|
|
7508
|
+
} catch (e) {
|
|
7509
|
+
throw new MainConfigError(`Could not read ${yamlPath}: ${e instanceof Error ? e.message : String(e)}`);
|
|
7510
|
+
}
|
|
7511
|
+
const doc = (0, import_yaml2.parseDocument)(text);
|
|
7512
|
+
if (doc.errors.length) {
|
|
7513
|
+
throw new MainConfigError(`${yamlPath}: ${doc.errors[0].message}`);
|
|
7514
|
+
}
|
|
7515
|
+
const parsed = doc.toJS();
|
|
7516
|
+
if (parsed === null || parsed === void 0) return {};
|
|
7517
|
+
if (typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
7518
|
+
throw new MainConfigError(`${yamlPath}: top level must be a mapping`);
|
|
7519
|
+
}
|
|
7520
|
+
return parsed;
|
|
7521
|
+
}
|
|
7522
|
+
return readJsonStrict(jsonPath, jsonPath);
|
|
7523
|
+
}
|
|
7524
|
+
|
|
7489
7525
|
// src/daemon/config.ts
|
|
7490
7526
|
function perUserDbName() {
|
|
7491
7527
|
const username = userInfo().username;
|
|
@@ -7496,6 +7532,14 @@ function perUserConnectionString() {
|
|
|
7496
7532
|
const db = perUserDbName();
|
|
7497
7533
|
return `postgresql://pai:pai@localhost:5432/${db}`;
|
|
7498
7534
|
}
|
|
7535
|
+
var DEFAULT_SESSIONS_CACHE_KEEPALIVE = {
|
|
7536
|
+
enabled: false,
|
|
7537
|
+
idleMinutes: 50,
|
|
7538
|
+
maxBeats: 6,
|
|
7539
|
+
activeHours: "08:00-22:00",
|
|
7540
|
+
minContextTokens: 2e4,
|
|
7541
|
+
prompt: "keepalive"
|
|
7542
|
+
};
|
|
7499
7543
|
var DEFAULTS = {
|
|
7500
7544
|
socketPath: paiSocketPath(),
|
|
7501
7545
|
indexIntervalSecs: 300,
|
|
@@ -7514,6 +7558,7 @@ var DEFAULTS = {
|
|
|
7514
7558
|
// Deliberately empty. An install must not guess who the user is: a wrong
|
|
7515
7559
|
// guess here is an address that can be mailed without review.
|
|
7516
7560
|
identity: { selfEmails: [] },
|
|
7561
|
+
sessions: { cacheKeepalive: { ...DEFAULT_SESSIONS_CACHE_KEEPALIVE } },
|
|
7517
7562
|
search: {
|
|
7518
7563
|
mode: "keyword",
|
|
7519
7564
|
rerank: true,
|
|
@@ -7523,30 +7568,37 @@ var DEFAULTS = {
|
|
|
7523
7568
|
}
|
|
7524
7569
|
};
|
|
7525
7570
|
var NEW_CONFIG_FILE = paiHomePath("config.json");
|
|
7526
|
-
var OLD_CONFIG_FILE =
|
|
7527
|
-
var LEGACY_CONFIG_FILE =
|
|
7571
|
+
var OLD_CONFIG_FILE = join3(homedir2(), ".claude", "pai.json");
|
|
7572
|
+
var LEGACY_CONFIG_FILE = join3(homedir2(), ".config", "pai", "config.json");
|
|
7528
7573
|
function paiConfigFilePath() {
|
|
7529
7574
|
const override = process.env.PAI_CONFIG_FILE;
|
|
7530
7575
|
if (override) return override;
|
|
7531
7576
|
return resolvePaiFile(NEW_CONFIG_FILE, [OLD_CONFIG_FILE, LEGACY_CONFIG_FILE], "pai config migrate");
|
|
7532
7577
|
}
|
|
7533
7578
|
var CONFIG_FILE = paiConfigFilePath();
|
|
7534
|
-
var CONFIG_DIR =
|
|
7579
|
+
var CONFIG_DIR = dirname3(CONFIG_FILE);
|
|
7580
|
+
function readMainConfigRaw(path = CONFIG_FILE) {
|
|
7581
|
+
try {
|
|
7582
|
+
return readDualFormatConfigRaw(path);
|
|
7583
|
+
} catch (e) {
|
|
7584
|
+
throw e instanceof MainConfigError ? new Error(e.message) : e;
|
|
7585
|
+
}
|
|
7586
|
+
}
|
|
7535
7587
|
|
|
7536
7588
|
// src/workers/workers-config.ts
|
|
7537
|
-
var
|
|
7538
|
-
import { existsSync as
|
|
7589
|
+
var import_yaml3 = __toESM(require_dist(), 1);
|
|
7590
|
+
import { existsSync as existsSync4, readFileSync as readFileSync4, writeFileSync as writeFileSync2, chmodSync } from "node:fs";
|
|
7539
7591
|
import { homedir as homedir3 } from "node:os";
|
|
7540
|
-
import { dirname as
|
|
7592
|
+
import { dirname as dirname4, join as join4 } from "node:path";
|
|
7541
7593
|
var WORKERS_YAML_FILENAME = "workers.yaml";
|
|
7542
7594
|
function defaultWorkersYamlPath() {
|
|
7543
7595
|
return paiHomePath(WORKERS_YAML_FILENAME);
|
|
7544
7596
|
}
|
|
7545
7597
|
function oldWorkersYamlPath() {
|
|
7546
|
-
return
|
|
7598
|
+
return join4(homedir3(), ".claude", WORKERS_YAML_FILENAME);
|
|
7547
7599
|
}
|
|
7548
7600
|
function legacyWorkersYamlPath() {
|
|
7549
|
-
return
|
|
7601
|
+
return join4(homedir3(), ".config", "pai", WORKERS_YAML_FILENAME);
|
|
7550
7602
|
}
|
|
7551
7603
|
function workersYamlPath() {
|
|
7552
7604
|
const override = process.env.PAI_WORKERS_YAML;
|
|
@@ -7651,7 +7703,8 @@ function parseWorkersYamlDocument(doc, yamlPath) {
|
|
|
7651
7703
|
const provider = typeof target === "string" ? target.split("/")[0] : target.provider;
|
|
7652
7704
|
const alias = typeof target === "string" ? target.split("/")[1] : void 0;
|
|
7653
7705
|
if (provider !== void 0) {
|
|
7654
|
-
|
|
7706
|
+
const native = provider === ANTHROPIC_NATIVE;
|
|
7707
|
+
if (!native && !providers[provider]) {
|
|
7655
7708
|
withLine(
|
|
7656
7709
|
doc,
|
|
7657
7710
|
["classes", cls],
|
|
@@ -7661,19 +7714,36 @@ function parseWorkersYamlDocument(doc, yamlPath) {
|
|
|
7661
7714
|
)
|
|
7662
7715
|
);
|
|
7663
7716
|
}
|
|
7664
|
-
if (alias !== void 0
|
|
7665
|
-
|
|
7666
|
-
|
|
7667
|
-
|
|
7668
|
-
|
|
7669
|
-
|
|
7670
|
-
|
|
7671
|
-
|
|
7672
|
-
|
|
7717
|
+
if (alias !== void 0) {
|
|
7718
|
+
if (!isModelCapability(alias)) {
|
|
7719
|
+
withLine(
|
|
7720
|
+
doc,
|
|
7721
|
+
["classes", cls],
|
|
7722
|
+
yamlPath,
|
|
7723
|
+
new WorkersConfigError(
|
|
7724
|
+
`classes.${cls}: "${alias}" is not a valid capability name (must match ^[a-z][a-z0-9-]*$)`
|
|
7725
|
+
)
|
|
7726
|
+
);
|
|
7727
|
+
} else if (!native && providers[provider] && alias !== "default" && !providers[provider].models[alias]) {
|
|
7728
|
+
withLine(
|
|
7729
|
+
doc,
|
|
7730
|
+
["classes", cls],
|
|
7731
|
+
yamlPath,
|
|
7732
|
+
new WorkersConfigError(`classes.${cls}: provider "${provider}" has no "${alias}" model configured`)
|
|
7733
|
+
);
|
|
7734
|
+
}
|
|
7673
7735
|
}
|
|
7674
7736
|
}
|
|
7675
7737
|
}
|
|
7676
7738
|
}
|
|
7739
|
+
let capabilities = {};
|
|
7740
|
+
if (r.capabilities !== void 0) {
|
|
7741
|
+
try {
|
|
7742
|
+
capabilities = parseCapabilitiesValue(r.capabilities, "capabilities");
|
|
7743
|
+
} catch (e) {
|
|
7744
|
+
withLine(doc, ["capabilities"], yamlPath, e);
|
|
7745
|
+
}
|
|
7746
|
+
}
|
|
7677
7747
|
let mcpSets = {};
|
|
7678
7748
|
if (r.mcp_sets !== void 0) {
|
|
7679
7749
|
try {
|
|
@@ -7695,19 +7765,19 @@ function parseWorkersYamlDocument(doc, yamlPath) {
|
|
|
7695
7765
|
)
|
|
7696
7766
|
);
|
|
7697
7767
|
}
|
|
7698
|
-
return { active, providers, classes, mcpSets, nativeModels };
|
|
7768
|
+
return { active, providers, classes, capabilities, mcpSets, nativeModels };
|
|
7699
7769
|
}
|
|
7700
7770
|
function readWorkersYaml(yamlPath) {
|
|
7701
|
-
if (!
|
|
7771
|
+
if (!existsSync4(yamlPath)) return null;
|
|
7702
7772
|
let text;
|
|
7703
7773
|
try {
|
|
7704
|
-
text =
|
|
7774
|
+
text = readFileSync4(yamlPath, "utf8");
|
|
7705
7775
|
} catch (e) {
|
|
7706
7776
|
throw new WorkersConfigError(
|
|
7707
7777
|
`Could not read ${yamlPath}: ${e instanceof Error ? e.message : String(e)}`
|
|
7708
7778
|
);
|
|
7709
7779
|
}
|
|
7710
|
-
const doc = (0,
|
|
7780
|
+
const doc = (0, import_yaml3.parseDocument)(text);
|
|
7711
7781
|
if (doc.errors.length) {
|
|
7712
7782
|
throw new WorkersConfigError(`${yamlPath}: ${doc.errors[0].message}`);
|
|
7713
7783
|
}
|
|
@@ -7731,8 +7801,9 @@ var PROVIDER_TAGS = [
|
|
|
7731
7801
|
"reasoning"
|
|
7732
7802
|
];
|
|
7733
7803
|
var MODEL_CAPABILITIES = ["default", "fast", "image"];
|
|
7804
|
+
var CAPABILITY_NAME_RE = /^[a-z][a-z0-9-]*$/;
|
|
7734
7805
|
function isModelCapability(v) {
|
|
7735
|
-
return
|
|
7806
|
+
return CAPABILITY_NAME_RE.test(v);
|
|
7736
7807
|
}
|
|
7737
7808
|
var DEFAULT_LOG_DIR = "~/.claude/logs/workers";
|
|
7738
7809
|
var DEFAULT_PANE = {
|
|
@@ -7760,6 +7831,7 @@ function defaultWorkersConfig() {
|
|
|
7760
7831
|
providers: {},
|
|
7761
7832
|
classes: {},
|
|
7762
7833
|
mcpSets: { ...DEFAULT_MCP_SETS },
|
|
7834
|
+
capabilities: {},
|
|
7763
7835
|
pane: { ...DEFAULT_PANE },
|
|
7764
7836
|
logDir: DEFAULT_LOG_DIR,
|
|
7765
7837
|
routing: { ...DEFAULT_ROUTING2, order: [] },
|
|
@@ -7787,7 +7859,10 @@ function parseModelsBlock(pathPrefix, modelsRaw) {
|
|
|
7787
7859
|
for (const key of Object.keys(m)) {
|
|
7788
7860
|
if (key === "default") continue;
|
|
7789
7861
|
if (!isModelCapability(key)) {
|
|
7790
|
-
bad(
|
|
7862
|
+
bad(
|
|
7863
|
+
`${pathPrefix}.${key}`,
|
|
7864
|
+
`"${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)`
|
|
7865
|
+
);
|
|
7791
7866
|
}
|
|
7792
7867
|
const id = str(m[key]);
|
|
7793
7868
|
if (!id) bad(`${pathPrefix}.${key}`, "must be a non-empty model id");
|
|
@@ -7809,8 +7884,8 @@ function parseProvider(name, raw) {
|
|
|
7809
7884
|
bad(`.providers.${name}.protocol`, `"${str(p.protocol)}" is neither "anthropic" nor "openai"`);
|
|
7810
7885
|
}
|
|
7811
7886
|
const engine = p.engine === void 0 ? "claude" : str(p.engine);
|
|
7812
|
-
if (engine !== "claude" && engine !== "codex") {
|
|
7813
|
-
bad(`.providers.${name}.engine`, `"${str(p.engine)}" is
|
|
7887
|
+
if (engine !== "claude" && engine !== "codex" && engine !== "image") {
|
|
7888
|
+
bad(`.providers.${name}.engine`, `"${str(p.engine)}" is none of "claude", "codex", "image"`);
|
|
7814
7889
|
}
|
|
7815
7890
|
const baseUrl = str(p.baseUrl);
|
|
7816
7891
|
if (!baseUrl && protocol !== "openai") bad(`.providers.${name}.baseUrl`, "is required");
|
|
@@ -8018,6 +8093,23 @@ function parseMcpSetsValue(raw, badPathPrefix) {
|
|
|
8018
8093
|
}
|
|
8019
8094
|
return mcpSets;
|
|
8020
8095
|
}
|
|
8096
|
+
function parseCapabilitiesValue(raw, badPathPrefix) {
|
|
8097
|
+
const capabilities = {};
|
|
8098
|
+
if (raw === void 0) return capabilities;
|
|
8099
|
+
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
8100
|
+
bad(badPathPrefix, "must be an object of capability name \u2192 [provider names]");
|
|
8101
|
+
}
|
|
8102
|
+
for (const [name, order] of Object.entries(raw)) {
|
|
8103
|
+
if (!isModelCapability(name)) {
|
|
8104
|
+
bad(`${badPathPrefix}.${name}`, `"${name}" is not a valid capability name (must match ^[a-z][a-z0-9-]*$)`);
|
|
8105
|
+
}
|
|
8106
|
+
if (!Array.isArray(order) || order.length === 0 || order.some((x) => typeof x !== "string" || !x)) {
|
|
8107
|
+
bad(`${badPathPrefix}.${name}`, "must be a non-empty array of provider names");
|
|
8108
|
+
}
|
|
8109
|
+
capabilities[name] = order;
|
|
8110
|
+
}
|
|
8111
|
+
return capabilities;
|
|
8112
|
+
}
|
|
8021
8113
|
function parseWorkersConfig(raw) {
|
|
8022
8114
|
const d = defaultWorkersConfig();
|
|
8023
8115
|
if (raw === void 0 || raw === null) return d;
|
|
@@ -8037,6 +8129,7 @@ function parseWorkersConfig(raw) {
|
|
|
8037
8129
|
const classesRaw = w.classes !== void 0 ? w.classes : w.roles;
|
|
8038
8130
|
const classes = parseClassesValue(classesRaw, w.classes !== void 0 ? ".classes" : ".roles");
|
|
8039
8131
|
const mcpSets = parseMcpSetsValue(w.mcpSets, ".mcpSets");
|
|
8132
|
+
const capabilities = parseCapabilitiesValue(w.capabilities, ".capabilities");
|
|
8040
8133
|
let pane = { ...DEFAULT_PANE };
|
|
8041
8134
|
if (w.pane !== void 0) {
|
|
8042
8135
|
if (typeof w.pane !== "object" || w.pane === null) bad(".pane", "must be an object");
|
|
@@ -8146,6 +8239,7 @@ function parseWorkersConfig(raw) {
|
|
|
8146
8239
|
providers,
|
|
8147
8240
|
classes,
|
|
8148
8241
|
mcpSets,
|
|
8242
|
+
capabilities,
|
|
8149
8243
|
pane,
|
|
8150
8244
|
logDir: str(w.logDir) || d.logDir,
|
|
8151
8245
|
routing,
|
|
@@ -8156,7 +8250,7 @@ function parseWorkersConfig(raw) {
|
|
|
8156
8250
|
};
|
|
8157
8251
|
}
|
|
8158
8252
|
function readWorkersSection(path = CONFIG_FILE) {
|
|
8159
|
-
const raw =
|
|
8253
|
+
const raw = readMainConfigRaw(path);
|
|
8160
8254
|
const workers = parseWorkersConfig(raw.workers);
|
|
8161
8255
|
const yaml = readWorkersYaml(workersYamlPath());
|
|
8162
8256
|
if (yaml) {
|
|
@@ -8164,12 +8258,13 @@ function readWorkersSection(path = CONFIG_FILE) {
|
|
|
8164
8258
|
workers.providers = yaml.data.providers;
|
|
8165
8259
|
workers.classes = yaml.data.classes;
|
|
8166
8260
|
workers.mcpSets = yaml.data.mcpSets;
|
|
8261
|
+
workers.capabilities = yaml.data.capabilities;
|
|
8167
8262
|
workers.nativeModels = yaml.data.nativeModels;
|
|
8168
8263
|
}
|
|
8169
8264
|
return { raw, workers };
|
|
8170
8265
|
}
|
|
8171
8266
|
function expandHome(p) {
|
|
8172
|
-
if (p === "~" || p.startsWith("~/")) return
|
|
8267
|
+
if (p === "~" || p.startsWith("~/")) return join5(homedir4(), p.slice(1));
|
|
8173
8268
|
return p;
|
|
8174
8269
|
}
|
|
8175
8270
|
function providerKeyPath(p) {
|
|
@@ -8181,7 +8276,7 @@ function resolveProviderKey(p) {
|
|
|
8181
8276
|
if (!keyPath) return null;
|
|
8182
8277
|
let content;
|
|
8183
8278
|
try {
|
|
8184
|
-
content =
|
|
8279
|
+
content = readFileSync5(keyPath, "utf8");
|
|
8185
8280
|
} catch {
|
|
8186
8281
|
throw new WorkersConfigError(`key file not readable: ${keyPath}`);
|
|
8187
8282
|
}
|
|
@@ -8199,7 +8294,7 @@ function workersLogDir(config) {
|
|
|
8199
8294
|
|
|
8200
8295
|
// src/workers/proxy/server.ts
|
|
8201
8296
|
import { createServer } from "node:http";
|
|
8202
|
-
import { dirname as
|
|
8297
|
+
import { dirname as dirname5, join as join6 } from "node:path";
|
|
8203
8298
|
|
|
8204
8299
|
// src/workers/proxy/translate.ts
|
|
8205
8300
|
function systemText(system) {
|
|
@@ -8473,7 +8568,7 @@ var DEFAULT_PROXY_PORT = 8797;
|
|
|
8473
8568
|
var HOST = "127.0.0.1";
|
|
8474
8569
|
var configProviders = () => readWorkersSection().workers.providers;
|
|
8475
8570
|
function proxyPidPath(logDir2) {
|
|
8476
|
-
return
|
|
8571
|
+
return join6(logDir2, "proxy.pid");
|
|
8477
8572
|
}
|
|
8478
8573
|
function createProxyServer(opts = {}) {
|
|
8479
8574
|
const resolveProvider = opts.resolveProvider ?? configProviders;
|
|
@@ -8622,7 +8717,7 @@ try {
|
|
|
8622
8717
|
var server = createProxyServer();
|
|
8623
8718
|
listenProxy(server, port).then((bound) => {
|
|
8624
8719
|
if (logDir) {
|
|
8625
|
-
|
|
8720
|
+
mkdirSync3(logDir, { recursive: true });
|
|
8626
8721
|
writeFileSync3(proxyPidPath(logDir), `${process.pid}
|
|
8627
8722
|
`, "utf8");
|
|
8628
8723
|
}
|