@axiom-lattice/core 4.2.6 → 4.2.8
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/index.d.mts +56 -2
- package/dist/index.d.ts +56 -2
- package/dist/index.js +878 -794
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +804 -721
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -14,9 +14,9 @@ var __export = (target, all) => {
|
|
|
14
14
|
};
|
|
15
15
|
var __copyProps = (to, from, except, desc) => {
|
|
16
16
|
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let
|
|
18
|
-
if (!__hasOwnProp.call(to,
|
|
19
|
-
__defProp(to,
|
|
17
|
+
for (let key5 of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key5) && key5 !== except)
|
|
19
|
+
__defProp(to, key5, { get: () => from[key5], enumerable: !(desc = __getOwnPropDesc(from, key5)) || desc.enumerable });
|
|
20
20
|
}
|
|
21
21
|
return to;
|
|
22
22
|
};
|
|
@@ -52,8 +52,8 @@ var init_BaseLatticeManager = __esm({
|
|
|
52
52
|
* @param tenantId 租户ID,全局共享使用 "default"
|
|
53
53
|
* @param key 原始键名
|
|
54
54
|
*/
|
|
55
|
-
getFullKey(tenantId2,
|
|
56
|
-
return `${this.getLatticeType()}:${tenantId2}:${
|
|
55
|
+
getFullKey(tenantId2, key5) {
|
|
56
|
+
return `${this.getLatticeType()}:${tenantId2}:${key5}`;
|
|
57
57
|
}
|
|
58
58
|
// ========== 带租户的新API ==========
|
|
59
59
|
/**
|
|
@@ -62,8 +62,8 @@ var init_BaseLatticeManager = __esm({
|
|
|
62
62
|
* @param key 项目键名(不含前缀)
|
|
63
63
|
* @param item 项目实例
|
|
64
64
|
*/
|
|
65
|
-
registerWithTenant(tenantId2,
|
|
66
|
-
const fullKey = this.getFullKey(tenantId2,
|
|
65
|
+
registerWithTenant(tenantId2, key5, item) {
|
|
66
|
+
const fullKey = this.getFullKey(tenantId2, key5);
|
|
67
67
|
if (_BaseLatticeManager.registry.has(fullKey)) {
|
|
68
68
|
throw new Error(`\u9879\u76EE "${fullKey}" \u5DF2\u7ECF\u5B58\u5728\uFF0C\u65E0\u6CD5\u91CD\u590D\u6CE8\u518C`);
|
|
69
69
|
}
|
|
@@ -74,8 +74,8 @@ var init_BaseLatticeManager = __esm({
|
|
|
74
74
|
* @param tenantId 租户ID
|
|
75
75
|
* @param key 项目键名(不含前缀)
|
|
76
76
|
*/
|
|
77
|
-
getWithTenant(tenantId2,
|
|
78
|
-
const fullKey = this.getFullKey(tenantId2,
|
|
77
|
+
getWithTenant(tenantId2, key5) {
|
|
78
|
+
const fullKey = this.getFullKey(tenantId2, key5);
|
|
79
79
|
return _BaseLatticeManager.registry.get(fullKey);
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
@@ -85,15 +85,15 @@ var init_BaseLatticeManager = __esm({
|
|
|
85
85
|
* @param key 项目键名(不含前缀)
|
|
86
86
|
* @returns 项目实例,如果未找到则返回undefined
|
|
87
87
|
*/
|
|
88
|
-
async getOrLoadWithTenant(tenantId2,
|
|
89
|
-
const item = this.getWithTenant(tenantId2,
|
|
88
|
+
async getOrLoadWithTenant(tenantId2, key5) {
|
|
89
|
+
const item = this.getWithTenant(tenantId2, key5);
|
|
90
90
|
if (item !== void 0) {
|
|
91
91
|
return item;
|
|
92
92
|
}
|
|
93
93
|
if (this.loadItemFromStore) {
|
|
94
|
-
const loadedItem = await this.loadItemFromStore(tenantId2,
|
|
94
|
+
const loadedItem = await this.loadItemFromStore(tenantId2, key5);
|
|
95
95
|
if (loadedItem !== void 0) {
|
|
96
|
-
this.registerWithTenant(tenantId2,
|
|
96
|
+
this.registerWithTenant(tenantId2, key5, loadedItem);
|
|
97
97
|
return loadedItem;
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -104,8 +104,8 @@ var init_BaseLatticeManager = __esm({
|
|
|
104
104
|
* @param tenantId 租户ID
|
|
105
105
|
* @param key 项目键名(不含前缀)
|
|
106
106
|
*/
|
|
107
|
-
hasWithTenant(tenantId2,
|
|
108
|
-
const fullKey = this.getFullKey(tenantId2,
|
|
107
|
+
hasWithTenant(tenantId2, key5) {
|
|
108
|
+
const fullKey = this.getFullKey(tenantId2, key5);
|
|
109
109
|
return _BaseLatticeManager.registry.has(fullKey);
|
|
110
110
|
}
|
|
111
111
|
/**
|
|
@@ -115,14 +115,14 @@ var init_BaseLatticeManager = __esm({
|
|
|
115
115
|
* @param key 项目键名(不含前缀)
|
|
116
116
|
* @returns 如果存在或能从store加载则返回true
|
|
117
117
|
*/
|
|
118
|
-
async hasOrLoadWithTenant(tenantId2,
|
|
119
|
-
if (this.hasWithTenant(tenantId2,
|
|
118
|
+
async hasOrLoadWithTenant(tenantId2, key5) {
|
|
119
|
+
if (this.hasWithTenant(tenantId2, key5)) {
|
|
120
120
|
return true;
|
|
121
121
|
}
|
|
122
122
|
if (this.loadItemFromStore) {
|
|
123
|
-
const loadedItem = await this.loadItemFromStore(tenantId2,
|
|
123
|
+
const loadedItem = await this.loadItemFromStore(tenantId2, key5);
|
|
124
124
|
if (loadedItem !== void 0) {
|
|
125
|
-
this.registerWithTenant(tenantId2,
|
|
125
|
+
this.registerWithTenant(tenantId2, key5, loadedItem);
|
|
126
126
|
return true;
|
|
127
127
|
}
|
|
128
128
|
}
|
|
@@ -133,8 +133,8 @@ var init_BaseLatticeManager = __esm({
|
|
|
133
133
|
* @param tenantId 租户ID
|
|
134
134
|
* @param key 项目键名(不含前缀)
|
|
135
135
|
*/
|
|
136
|
-
removeWithTenant(tenantId2,
|
|
137
|
-
const fullKey = this.getFullKey(tenantId2,
|
|
136
|
+
removeWithTenant(tenantId2, key5) {
|
|
137
|
+
const fullKey = this.getFullKey(tenantId2, key5);
|
|
138
138
|
return _BaseLatticeManager.registry.delete(fullKey);
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
@@ -144,8 +144,8 @@ var init_BaseLatticeManager = __esm({
|
|
|
144
144
|
getAllByTenant(tenantId2) {
|
|
145
145
|
const prefix = `${this.getLatticeType()}:${tenantId2}:`;
|
|
146
146
|
const result = [];
|
|
147
|
-
for (const [
|
|
148
|
-
if (
|
|
147
|
+
for (const [key5, value] of _BaseLatticeManager.registry.entries()) {
|
|
148
|
+
if (key5.startsWith(prefix)) {
|
|
149
149
|
result.push(value);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
@@ -158,13 +158,13 @@ var init_BaseLatticeManager = __esm({
|
|
|
158
158
|
clearByTenant(tenantId2) {
|
|
159
159
|
const prefix = `${this.getLatticeType()}:${tenantId2}:`;
|
|
160
160
|
const keysToDelete = [];
|
|
161
|
-
for (const
|
|
162
|
-
if (
|
|
163
|
-
keysToDelete.push(
|
|
161
|
+
for (const key5 of _BaseLatticeManager.registry.keys()) {
|
|
162
|
+
if (key5.startsWith(prefix)) {
|
|
163
|
+
keysToDelete.push(key5);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
|
-
for (const
|
|
167
|
-
_BaseLatticeManager.registry.delete(
|
|
166
|
+
for (const key5 of keysToDelete) {
|
|
167
|
+
_BaseLatticeManager.registry.delete(key5);
|
|
168
168
|
}
|
|
169
169
|
}
|
|
170
170
|
// ========== 向后兼容的旧API(使用 default 租户) ==========
|
|
@@ -174,16 +174,16 @@ var init_BaseLatticeManager = __esm({
|
|
|
174
174
|
* @param key 项目键名(不含前缀)
|
|
175
175
|
* @param item 项目实例
|
|
176
176
|
*/
|
|
177
|
-
register(
|
|
178
|
-
this.registerWithTenant("default",
|
|
177
|
+
register(key5, item) {
|
|
178
|
+
this.registerWithTenant("default", key5, item);
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* 获取指定项目(向后兼容,使用 "default" 租户)
|
|
182
182
|
* @deprecated Use getWithTenant(tenantId, key) instead
|
|
183
183
|
* @param key 项目键名(不含前缀)
|
|
184
184
|
*/
|
|
185
|
-
get(
|
|
186
|
-
return this.getWithTenant("default",
|
|
185
|
+
get(key5) {
|
|
186
|
+
return this.getWithTenant("default", key5);
|
|
187
187
|
}
|
|
188
188
|
/**
|
|
189
189
|
* 获取所有当前类型的项目(向后兼容,包含所有租户)
|
|
@@ -191,8 +191,8 @@ var init_BaseLatticeManager = __esm({
|
|
|
191
191
|
getAll() {
|
|
192
192
|
const prefix = `${this.getLatticeType()}:`;
|
|
193
193
|
const result = [];
|
|
194
|
-
for (const [
|
|
195
|
-
if (
|
|
194
|
+
for (const [key5, value] of _BaseLatticeManager.registry.entries()) {
|
|
195
|
+
if (key5.startsWith(prefix)) {
|
|
196
196
|
result.push(value);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
@@ -203,16 +203,16 @@ var init_BaseLatticeManager = __esm({
|
|
|
203
203
|
* @deprecated Use hasWithTenant(tenantId, key) instead
|
|
204
204
|
* @param key 项目键名(不含前缀)
|
|
205
205
|
*/
|
|
206
|
-
has(
|
|
207
|
-
return this.hasWithTenant("default",
|
|
206
|
+
has(key5) {
|
|
207
|
+
return this.hasWithTenant("default", key5);
|
|
208
208
|
}
|
|
209
209
|
/**
|
|
210
210
|
* 移除项目(向后兼容,使用 "default" 租户)
|
|
211
211
|
* @deprecated Use removeWithTenant(tenantId, key) instead
|
|
212
212
|
* @param key 项目键名(不含前缀)
|
|
213
213
|
*/
|
|
214
|
-
remove(
|
|
215
|
-
return this.removeWithTenant("default",
|
|
214
|
+
remove(key5) {
|
|
215
|
+
return this.removeWithTenant("default", key5);
|
|
216
216
|
}
|
|
217
217
|
/**
|
|
218
218
|
* 清空当前类型的所有项目(向后兼容,包含所有租户)
|
|
@@ -220,13 +220,13 @@ var init_BaseLatticeManager = __esm({
|
|
|
220
220
|
clear() {
|
|
221
221
|
const prefix = `${this.getLatticeType()}:`;
|
|
222
222
|
const keysToDelete = [];
|
|
223
|
-
for (const
|
|
224
|
-
if (
|
|
225
|
-
keysToDelete.push(
|
|
223
|
+
for (const key5 of _BaseLatticeManager.registry.keys()) {
|
|
224
|
+
if (key5.startsWith(prefix)) {
|
|
225
|
+
keysToDelete.push(key5);
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
for (const
|
|
229
|
-
_BaseLatticeManager.registry.delete(
|
|
228
|
+
for (const key5 of keysToDelete) {
|
|
229
|
+
_BaseLatticeManager.registry.delete(key5);
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
/**
|
|
@@ -235,8 +235,8 @@ var init_BaseLatticeManager = __esm({
|
|
|
235
235
|
count() {
|
|
236
236
|
const prefix = `${this.getLatticeType()}:`;
|
|
237
237
|
let count = 0;
|
|
238
|
-
for (const
|
|
239
|
-
if (
|
|
238
|
+
for (const key5 of _BaseLatticeManager.registry.keys()) {
|
|
239
|
+
if (key5.startsWith(prefix)) {
|
|
240
240
|
count++;
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -250,9 +250,9 @@ var init_BaseLatticeManager = __esm({
|
|
|
250
250
|
const prefix = `${this.getLatticeType()}:`;
|
|
251
251
|
const prefixLength = prefix.length;
|
|
252
252
|
const result = [];
|
|
253
|
-
for (const
|
|
254
|
-
if (
|
|
255
|
-
result.push(
|
|
253
|
+
for (const key5 of _BaseLatticeManager.registry.keys()) {
|
|
254
|
+
if (key5.startsWith(prefix)) {
|
|
255
|
+
result.push(key5.substring(prefixLength));
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
return result;
|
|
@@ -265,9 +265,9 @@ var init_BaseLatticeManager = __esm({
|
|
|
265
265
|
const prefix = `${this.getLatticeType()}:${tenantId2}:`;
|
|
266
266
|
const prefixLength = prefix.length;
|
|
267
267
|
const result = [];
|
|
268
|
-
for (const
|
|
269
|
-
if (
|
|
270
|
-
result.push(
|
|
268
|
+
for (const key5 of _BaseLatticeManager.registry.keys()) {
|
|
269
|
+
if (key5.startsWith(prefix)) {
|
|
270
|
+
result.push(key5.substring(prefixLength));
|
|
271
271
|
}
|
|
272
272
|
}
|
|
273
273
|
return result;
|
|
@@ -313,20 +313,20 @@ var init_MemoryLatticeManager = __esm({
|
|
|
313
313
|
* @param key 保存器键名
|
|
314
314
|
* @param saver 检查点保存器实例
|
|
315
315
|
*/
|
|
316
|
-
registerCheckpointSaver(
|
|
317
|
-
if (_MemoryLatticeManager.checkpointSavers.has(
|
|
318
|
-
console.warn(`\u68C0\u67E5\u70B9\u4FDD\u5B58\u5668 "${
|
|
316
|
+
registerCheckpointSaver(key5, saver) {
|
|
317
|
+
if (_MemoryLatticeManager.checkpointSavers.has(key5)) {
|
|
318
|
+
console.warn(`\u68C0\u67E5\u70B9\u4FDD\u5B58\u5668 "${key5}" \u5DF2\u7ECF\u5B58\u5728\uFF0C\u5C06\u4F1A\u8986\u76D6\u65E7\u7684\u68C0\u67E5\u70B9\u4FDD\u5B58\u5668`);
|
|
319
319
|
}
|
|
320
|
-
_MemoryLatticeManager.checkpointSavers.set(
|
|
320
|
+
_MemoryLatticeManager.checkpointSavers.set(key5, saver);
|
|
321
321
|
}
|
|
322
322
|
/**
|
|
323
323
|
* 获取检查点保存器
|
|
324
324
|
* @param key 保存器键名
|
|
325
325
|
*/
|
|
326
|
-
getCheckpointSaver(
|
|
327
|
-
const saver = _MemoryLatticeManager.checkpointSavers.get(
|
|
326
|
+
getCheckpointSaver(key5) {
|
|
327
|
+
const saver = _MemoryLatticeManager.checkpointSavers.get(key5);
|
|
328
328
|
if (!saver) {
|
|
329
|
-
throw new Error(`\u68C0\u67E5\u70B9\u4FDD\u5B58\u5668 "${
|
|
329
|
+
throw new Error(`\u68C0\u67E5\u70B9\u4FDD\u5B58\u5668 "${key5}" \u4E0D\u5B58\u5728`);
|
|
330
330
|
}
|
|
331
331
|
return saver;
|
|
332
332
|
}
|
|
@@ -340,22 +340,22 @@ var init_MemoryLatticeManager = __esm({
|
|
|
340
340
|
* 检查检查点保存器是否存在
|
|
341
341
|
* @param key 保存器键名
|
|
342
342
|
*/
|
|
343
|
-
hasCheckpointSaver(
|
|
344
|
-
return _MemoryLatticeManager.checkpointSavers.has(
|
|
343
|
+
hasCheckpointSaver(key5) {
|
|
344
|
+
return _MemoryLatticeManager.checkpointSavers.has(key5);
|
|
345
345
|
}
|
|
346
346
|
/**
|
|
347
347
|
* 移除检查点保存器
|
|
348
348
|
* @param key 保存器键名
|
|
349
349
|
*/
|
|
350
|
-
removeCheckpointSaver(
|
|
351
|
-
return _MemoryLatticeManager.checkpointSavers.delete(
|
|
350
|
+
removeCheckpointSaver(key5) {
|
|
351
|
+
return _MemoryLatticeManager.checkpointSavers.delete(key5);
|
|
352
352
|
}
|
|
353
353
|
};
|
|
354
354
|
// 检查点保存器注册表
|
|
355
355
|
_MemoryLatticeManager.checkpointSavers = /* @__PURE__ */ new Map();
|
|
356
356
|
MemoryLatticeManager = _MemoryLatticeManager;
|
|
357
|
-
getCheckpointSaver = (
|
|
358
|
-
registerCheckpointSaver = (
|
|
357
|
+
getCheckpointSaver = (key5) => MemoryLatticeManager.getInstance().getCheckpointSaver(key5);
|
|
358
|
+
registerCheckpointSaver = (key5, saver) => MemoryLatticeManager.getInstance().registerCheckpointSaver(key5, saver);
|
|
359
359
|
}
|
|
360
360
|
});
|
|
361
361
|
|
|
@@ -420,9 +420,9 @@ function toJsonSchema(fields) {
|
|
|
420
420
|
if (!fields || Object.keys(fields).length === 0) return void 0;
|
|
421
421
|
const properties = {};
|
|
422
422
|
const required = [];
|
|
423
|
-
for (const [
|
|
424
|
-
required.push(
|
|
425
|
-
properties[
|
|
423
|
+
for (const [key5, value] of Object.entries(fields)) {
|
|
424
|
+
required.push(key5);
|
|
425
|
+
properties[key5] = fieldToSchema(value);
|
|
426
426
|
}
|
|
427
427
|
return { type: "object", properties, required };
|
|
428
428
|
}
|
|
@@ -556,13 +556,13 @@ function parseStep(raw, index) {
|
|
|
556
556
|
if (entries.length !== 1) {
|
|
557
557
|
throw new Error(`Step at position ${index} must be a single-key mapping`);
|
|
558
558
|
}
|
|
559
|
-
const [
|
|
559
|
+
const [key5, config] = entries[0];
|
|
560
560
|
const mapConfig = config?.map;
|
|
561
561
|
if (mapConfig && typeof mapConfig === "object") {
|
|
562
562
|
return {
|
|
563
563
|
map: {
|
|
564
564
|
source: mapConfig.source,
|
|
565
|
-
label:
|
|
565
|
+
label: key5,
|
|
566
566
|
// always use the YAML key as the label
|
|
567
567
|
if: mapConfig.if !== void 0 ? String(mapConfig.if) : void 0,
|
|
568
568
|
each: {
|
|
@@ -576,11 +576,11 @@ function parseStep(raw, index) {
|
|
|
576
576
|
}
|
|
577
577
|
};
|
|
578
578
|
}
|
|
579
|
-
if (
|
|
579
|
+
if (key5 === "map") {
|
|
580
580
|
throw new Error(`Map steps must use named format: - <label>: { map: { source, each, ... } }. Anonymous "- map:" is not supported.`);
|
|
581
581
|
}
|
|
582
582
|
return {
|
|
583
|
-
label:
|
|
583
|
+
label: key5,
|
|
584
584
|
if: config.if !== void 0 ? String(config.if) : void 0,
|
|
585
585
|
ref: config.ref ?? void 0,
|
|
586
586
|
prompt: String(config.prompt ?? ""),
|
|
@@ -737,8 +737,8 @@ var init_parse_yaml = __esm({
|
|
|
737
737
|
function buildStateAnnotation(fields) {
|
|
738
738
|
const annotations = {};
|
|
739
739
|
if (fields) {
|
|
740
|
-
for (const [
|
|
741
|
-
annotations[
|
|
740
|
+
for (const [key5, field] of Object.entries(fields)) {
|
|
741
|
+
annotations[key5] = (0, import_langgraph12.Annotation)({
|
|
742
742
|
default: () => field.default ?? defaultValueForType(field.type),
|
|
743
743
|
reducer: buildReducer(field.reducer ?? "replace")
|
|
744
744
|
});
|
|
@@ -1660,6 +1660,7 @@ __export(index_exports, {
|
|
|
1660
1660
|
InMemoryProjectMembershipStore: () => InMemoryProjectMembershipStore,
|
|
1661
1661
|
InMemoryProjectRoomCoordinator: () => InMemoryProjectRoomCoordinator,
|
|
1662
1662
|
InMemoryProjectRoomMessageStore: () => InMemoryProjectRoomMessageStore,
|
|
1663
|
+
InMemoryProjectRoomReadStateStore: () => InMemoryProjectRoomReadStateStore,
|
|
1663
1664
|
InMemoryProjectRoomStore: () => InMemoryProjectRoomStore,
|
|
1664
1665
|
InMemoryTaskListStore: () => InMemoryTaskListStore,
|
|
1665
1666
|
InMemoryTaskStore: () => InMemoryTaskStore,
|
|
@@ -2151,22 +2152,22 @@ var ModelLatticeManager = class _ModelLatticeManager extends BaseLatticeManager
|
|
|
2151
2152
|
* @param key Lattice键名
|
|
2152
2153
|
* @param config 模型配置
|
|
2153
2154
|
*/
|
|
2154
|
-
registerLattice(
|
|
2155
|
+
registerLattice(key5, config) {
|
|
2155
2156
|
const client = new ModelLattice(config);
|
|
2156
2157
|
const modelLattice = {
|
|
2157
|
-
key:
|
|
2158
|
+
key: key5,
|
|
2158
2159
|
client
|
|
2159
2160
|
};
|
|
2160
|
-
this.register(
|
|
2161
|
+
this.register(key5, modelLattice);
|
|
2161
2162
|
}
|
|
2162
2163
|
/**
|
|
2163
2164
|
* 获取ModelLattice
|
|
2164
2165
|
* @param key Lattice键名
|
|
2165
2166
|
*/
|
|
2166
|
-
getModelLattice(
|
|
2167
|
-
const modelLattice = this.get(
|
|
2167
|
+
getModelLattice(key5) {
|
|
2168
|
+
const modelLattice = this.get(key5);
|
|
2168
2169
|
if (!modelLattice) {
|
|
2169
|
-
throw new Error(`ModelLattice ${
|
|
2170
|
+
throw new Error(`ModelLattice ${key5} not found`);
|
|
2170
2171
|
}
|
|
2171
2172
|
return modelLattice;
|
|
2172
2173
|
}
|
|
@@ -2180,15 +2181,15 @@ var ModelLatticeManager = class _ModelLatticeManager extends BaseLatticeManager
|
|
|
2180
2181
|
* 检查Lattice是否存在
|
|
2181
2182
|
* @param key Lattice键名
|
|
2182
2183
|
*/
|
|
2183
|
-
hasLattice(
|
|
2184
|
-
return this.has(
|
|
2184
|
+
hasLattice(key5) {
|
|
2185
|
+
return this.has(key5);
|
|
2185
2186
|
}
|
|
2186
2187
|
/**
|
|
2187
2188
|
* 移除Lattice
|
|
2188
2189
|
* @param key Lattice键名
|
|
2189
2190
|
*/
|
|
2190
|
-
removeLattice(
|
|
2191
|
-
return this.remove(
|
|
2191
|
+
removeLattice(key5) {
|
|
2192
|
+
return this.remove(key5);
|
|
2192
2193
|
}
|
|
2193
2194
|
/**
|
|
2194
2195
|
* 清空所有Lattice
|
|
@@ -2210,8 +2211,8 @@ var ModelLatticeManager = class _ModelLatticeManager extends BaseLatticeManager
|
|
|
2210
2211
|
}
|
|
2211
2212
|
};
|
|
2212
2213
|
var modelLatticeManager = ModelLatticeManager.getInstance();
|
|
2213
|
-
var registerModelLattice = (
|
|
2214
|
-
var getModelLattice = (
|
|
2214
|
+
var registerModelLattice = (key5, config) => modelLatticeManager.registerLattice(key5, config);
|
|
2215
|
+
var getModelLattice = (key5) => modelLatticeManager.getModelLattice(key5);
|
|
2215
2216
|
|
|
2216
2217
|
// src/tool_lattice/get_current_date_time/index.ts
|
|
2217
2218
|
var import_zod = __toESM(require("zod"));
|
|
@@ -2277,7 +2278,7 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
2277
2278
|
* @param config 工具配置(定义)
|
|
2278
2279
|
* @param executor 工具执行函数
|
|
2279
2280
|
*/
|
|
2280
|
-
registerLattice(
|
|
2281
|
+
registerLattice(key5, config, executor) {
|
|
2281
2282
|
let toolExecutor;
|
|
2282
2283
|
if (config.needUserApprove) {
|
|
2283
2284
|
toolExecutor = createToolApproveWrapper(
|
|
@@ -2291,18 +2292,18 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
2291
2292
|
};
|
|
2292
2293
|
}
|
|
2293
2294
|
const toolLattice = {
|
|
2294
|
-
key:
|
|
2295
|
+
key: key5,
|
|
2295
2296
|
config,
|
|
2296
2297
|
client: (0, import_tools.tool)(toolExecutor, config)
|
|
2297
2298
|
};
|
|
2298
|
-
this.register(
|
|
2299
|
+
this.register(key5, toolLattice);
|
|
2299
2300
|
}
|
|
2300
2301
|
/**
|
|
2301
2302
|
* 获取ToolLattice
|
|
2302
2303
|
* @param key Lattice键名
|
|
2303
2304
|
*/
|
|
2304
|
-
getToolLattice(
|
|
2305
|
-
return this.get(
|
|
2305
|
+
getToolLattice(key5) {
|
|
2306
|
+
return this.get(key5);
|
|
2306
2307
|
}
|
|
2307
2308
|
/**
|
|
2308
2309
|
* 获取所有Lattice
|
|
@@ -2314,15 +2315,15 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
2314
2315
|
* 检查Lattice是否存在
|
|
2315
2316
|
* @param key Lattice键名
|
|
2316
2317
|
*/
|
|
2317
|
-
hasLattice(
|
|
2318
|
-
return this.has(
|
|
2318
|
+
hasLattice(key5) {
|
|
2319
|
+
return this.has(key5);
|
|
2319
2320
|
}
|
|
2320
2321
|
/**
|
|
2321
2322
|
* 移除Lattice
|
|
2322
2323
|
* @param key Lattice键名
|
|
2323
2324
|
*/
|
|
2324
|
-
removeLattice(
|
|
2325
|
-
return this.remove(
|
|
2325
|
+
removeLattice(key5) {
|
|
2326
|
+
return this.remove(key5);
|
|
2326
2327
|
}
|
|
2327
2328
|
/**
|
|
2328
2329
|
* 清空所有Lattice
|
|
@@ -2346,10 +2347,10 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
2346
2347
|
* 获取工具定义
|
|
2347
2348
|
* @param key Lattice键名
|
|
2348
2349
|
*/
|
|
2349
|
-
getToolDefinition(
|
|
2350
|
-
const toolLattice = this.getToolLattice(
|
|
2350
|
+
getToolDefinition(key5) {
|
|
2351
|
+
const toolLattice = this.getToolLattice(key5);
|
|
2351
2352
|
if (!toolLattice) {
|
|
2352
|
-
throw new Error(`ToolLattice ${
|
|
2353
|
+
throw new Error(`ToolLattice ${key5} not found`);
|
|
2353
2354
|
}
|
|
2354
2355
|
return toolLattice.config;
|
|
2355
2356
|
}
|
|
@@ -2357,10 +2358,10 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
2357
2358
|
* 获取工具客户端
|
|
2358
2359
|
* @param key Lattice键名
|
|
2359
2360
|
*/
|
|
2360
|
-
getToolClient(
|
|
2361
|
-
const toolLattice = this.getToolLattice(
|
|
2361
|
+
getToolClient(key5) {
|
|
2362
|
+
const toolLattice = this.getToolLattice(key5);
|
|
2362
2363
|
if (!toolLattice) {
|
|
2363
|
-
throw new Error(`ToolLattice ${
|
|
2364
|
+
throw new Error(`ToolLattice ${key5} not found`);
|
|
2364
2365
|
}
|
|
2365
2366
|
return toolLattice.client;
|
|
2366
2367
|
}
|
|
@@ -2375,7 +2376,7 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
2375
2376
|
* @param key Lattice键名
|
|
2376
2377
|
* @param tool 已有的StructuredTool实例
|
|
2377
2378
|
*/
|
|
2378
|
-
registerExistingTool(
|
|
2379
|
+
registerExistingTool(key5, tool69) {
|
|
2379
2380
|
const config = {
|
|
2380
2381
|
name: tool69.name,
|
|
2381
2382
|
description: tool69.description,
|
|
@@ -2385,19 +2386,19 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
2385
2386
|
// MCP工具默认不需要用户批准
|
|
2386
2387
|
};
|
|
2387
2388
|
const toolLattice = {
|
|
2388
|
-
key:
|
|
2389
|
+
key: key5,
|
|
2389
2390
|
config,
|
|
2390
2391
|
client: tool69
|
|
2391
2392
|
};
|
|
2392
|
-
this.register(
|
|
2393
|
+
this.register(key5, toolLattice);
|
|
2393
2394
|
}
|
|
2394
2395
|
/**
|
|
2395
2396
|
* 验证工具输入参数
|
|
2396
2397
|
* @param key Lattice键名
|
|
2397
2398
|
* @param input 输入参数
|
|
2398
2399
|
*/
|
|
2399
|
-
validateToolInput(
|
|
2400
|
-
const toolLattice = this.getToolLattice(
|
|
2400
|
+
validateToolInput(key5, input) {
|
|
2401
|
+
const toolLattice = this.getToolLattice(key5);
|
|
2401
2402
|
if (!toolLattice) {
|
|
2402
2403
|
return false;
|
|
2403
2404
|
}
|
|
@@ -2412,13 +2413,13 @@ var ToolLatticeManager = class _ToolLatticeManager extends BaseLatticeManager {
|
|
|
2412
2413
|
}
|
|
2413
2414
|
};
|
|
2414
2415
|
var toolLatticeManager = ToolLatticeManager.getInstance();
|
|
2415
|
-
var registerToolLattice = (
|
|
2416
|
-
var registerExistingTool = (
|
|
2417
|
-
var getToolLattice = (
|
|
2418
|
-
var getToolDefinition = (
|
|
2419
|
-
var getToolClient = (
|
|
2416
|
+
var registerToolLattice = (key5, config, executor) => toolLatticeManager.registerLattice(key5, config, executor);
|
|
2417
|
+
var registerExistingTool = (key5, tool69) => toolLatticeManager.registerExistingTool(key5, tool69);
|
|
2418
|
+
var getToolLattice = (key5) => toolLatticeManager.getToolLattice(key5);
|
|
2419
|
+
var getToolDefinition = (key5) => toolLatticeManager.getToolDefinition(key5);
|
|
2420
|
+
var getToolClient = (key5) => toolLatticeManager.getToolClient(key5);
|
|
2420
2421
|
var getAllToolDefinitions = () => toolLatticeManager.getAllToolDefinitions();
|
|
2421
|
-
var validateToolInput = (
|
|
2422
|
+
var validateToolInput = (key5, input) => toolLatticeManager.validateToolInput(key5, input);
|
|
2422
2423
|
|
|
2423
2424
|
// src/tool_lattice/get_current_date_time/index.ts
|
|
2424
2425
|
registerToolLattice(
|
|
@@ -2523,7 +2524,7 @@ var InMemoryThreadStore = class {
|
|
|
2523
2524
|
if (metadataFilter && Object.keys(metadataFilter).length > 0) {
|
|
2524
2525
|
threads = threads.filter(
|
|
2525
2526
|
(thread) => Object.entries(metadataFilter).every(
|
|
2526
|
-
([
|
|
2527
|
+
([key5, value]) => thread.metadata?.[key5] === value
|
|
2527
2528
|
)
|
|
2528
2529
|
);
|
|
2529
2530
|
}
|
|
@@ -2811,7 +2812,7 @@ function parseFrontmatter(content) {
|
|
|
2811
2812
|
if (currentKey === "metadata" && indent > metadataIndent) {
|
|
2812
2813
|
const colonIndex2 = trimmed.indexOf(":");
|
|
2813
2814
|
if (colonIndex2 !== -1) {
|
|
2814
|
-
const
|
|
2815
|
+
const key6 = trimmed.substring(0, colonIndex2).trim();
|
|
2815
2816
|
let value2 = trimmed.substring(colonIndex2 + 1).trim();
|
|
2816
2817
|
if (value2.startsWith('"') && value2.endsWith('"') || value2.startsWith("'") && value2.endsWith("'")) {
|
|
2817
2818
|
value2 = value2.slice(1, -1);
|
|
@@ -2819,7 +2820,7 @@ function parseFrontmatter(content) {
|
|
|
2819
2820
|
if (!frontmatter.metadata) {
|
|
2820
2821
|
frontmatter.metadata = {};
|
|
2821
2822
|
}
|
|
2822
|
-
frontmatter.metadata[
|
|
2823
|
+
frontmatter.metadata[key6] = value2;
|
|
2823
2824
|
}
|
|
2824
2825
|
continue;
|
|
2825
2826
|
}
|
|
@@ -2844,12 +2845,12 @@ function parseFrontmatter(content) {
|
|
|
2844
2845
|
if (colonIndex === -1) {
|
|
2845
2846
|
continue;
|
|
2846
2847
|
}
|
|
2847
|
-
const
|
|
2848
|
+
const key5 = trimmed.substring(0, colonIndex).trim();
|
|
2848
2849
|
let value = trimmed.substring(colonIndex + 1).trim();
|
|
2849
2850
|
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
2850
2851
|
value = value.slice(1, -1);
|
|
2851
2852
|
}
|
|
2852
|
-
if (
|
|
2853
|
+
if (key5 === "metadata") {
|
|
2853
2854
|
if (value === "" || value === "{}") {
|
|
2854
2855
|
if (i + 1 < lines.length) {
|
|
2855
2856
|
const nextLine = lines[i + 1];
|
|
@@ -2861,17 +2862,17 @@ function parseFrontmatter(content) {
|
|
|
2861
2862
|
continue;
|
|
2862
2863
|
}
|
|
2863
2864
|
}
|
|
2864
|
-
frontmatter[
|
|
2865
|
+
frontmatter[key5] = {};
|
|
2865
2866
|
} else if (value.startsWith("{")) {
|
|
2866
2867
|
try {
|
|
2867
|
-
frontmatter[
|
|
2868
|
+
frontmatter[key5] = JSON.parse(value);
|
|
2868
2869
|
} catch {
|
|
2869
|
-
frontmatter[
|
|
2870
|
+
frontmatter[key5] = {};
|
|
2870
2871
|
}
|
|
2871
2872
|
} else {
|
|
2872
|
-
frontmatter[
|
|
2873
|
+
frontmatter[key5] = {};
|
|
2873
2874
|
}
|
|
2874
|
-
} else if (
|
|
2875
|
+
} else if (key5 === "subSkills") {
|
|
2875
2876
|
if (value === "" || value === "[]") {
|
|
2876
2877
|
if (i + 1 < lines.length) {
|
|
2877
2878
|
const nextLine = lines[i + 1];
|
|
@@ -2883,18 +2884,18 @@ function parseFrontmatter(content) {
|
|
|
2883
2884
|
continue;
|
|
2884
2885
|
}
|
|
2885
2886
|
}
|
|
2886
|
-
frontmatter[
|
|
2887
|
+
frontmatter[key5] = [];
|
|
2887
2888
|
} else if (value.startsWith("[")) {
|
|
2888
2889
|
try {
|
|
2889
|
-
frontmatter[
|
|
2890
|
+
frontmatter[key5] = JSON.parse(value);
|
|
2890
2891
|
} catch {
|
|
2891
|
-
frontmatter[
|
|
2892
|
+
frontmatter[key5] = [];
|
|
2892
2893
|
}
|
|
2893
2894
|
} else {
|
|
2894
|
-
frontmatter[
|
|
2895
|
+
frontmatter[key5] = [];
|
|
2895
2896
|
}
|
|
2896
2897
|
} else {
|
|
2897
|
-
frontmatter[
|
|
2898
|
+
frontmatter[key5] = value;
|
|
2898
2899
|
}
|
|
2899
2900
|
}
|
|
2900
2901
|
return { frontmatter, body };
|
|
@@ -2911,8 +2912,8 @@ function generateFrontmatter(data) {
|
|
|
2911
2912
|
}
|
|
2912
2913
|
if (data.metadata && Object.keys(data.metadata).length > 0) {
|
|
2913
2914
|
lines.push("metadata:");
|
|
2914
|
-
for (const [
|
|
2915
|
-
lines.push(` ${
|
|
2915
|
+
for (const [key5, value] of Object.entries(data.metadata)) {
|
|
2916
|
+
lines.push(` ${key5}: ${value}`);
|
|
2916
2917
|
}
|
|
2917
2918
|
}
|
|
2918
2919
|
if (data.subSkills && data.subSkills.length > 0) {
|
|
@@ -3356,8 +3357,8 @@ var InMemoryWorkspaceStore = class {
|
|
|
3356
3357
|
);
|
|
3357
3358
|
}
|
|
3358
3359
|
async getWorkspaceById(tenantId2, id) {
|
|
3359
|
-
const
|
|
3360
|
-
return this.workspaces.get(
|
|
3360
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3361
|
+
return this.workspaces.get(key5) || null;
|
|
3361
3362
|
}
|
|
3362
3363
|
async createWorkspace(tenantId2, id, data) {
|
|
3363
3364
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -3370,13 +3371,13 @@ var InMemoryWorkspaceStore = class {
|
|
|
3370
3371
|
createdAt: now,
|
|
3371
3372
|
updatedAt: now
|
|
3372
3373
|
};
|
|
3373
|
-
const
|
|
3374
|
-
this.workspaces.set(
|
|
3374
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3375
|
+
this.workspaces.set(key5, workspace);
|
|
3375
3376
|
return workspace;
|
|
3376
3377
|
}
|
|
3377
3378
|
async updateWorkspace(tenantId2, id, updates) {
|
|
3378
|
-
const
|
|
3379
|
-
const existing = this.workspaces.get(
|
|
3379
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3380
|
+
const existing = this.workspaces.get(key5);
|
|
3380
3381
|
if (!existing) {
|
|
3381
3382
|
return null;
|
|
3382
3383
|
}
|
|
@@ -3385,12 +3386,12 @@ var InMemoryWorkspaceStore = class {
|
|
|
3385
3386
|
...updates,
|
|
3386
3387
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3387
3388
|
};
|
|
3388
|
-
this.workspaces.set(
|
|
3389
|
+
this.workspaces.set(key5, updated);
|
|
3389
3390
|
return updated;
|
|
3390
3391
|
}
|
|
3391
3392
|
async deleteWorkspace(tenantId2, id) {
|
|
3392
|
-
const
|
|
3393
|
-
return this.workspaces.delete(
|
|
3393
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3394
|
+
return this.workspaces.delete(key5);
|
|
3394
3395
|
}
|
|
3395
3396
|
clear() {
|
|
3396
3397
|
this.workspaces.clear();
|
|
@@ -3426,15 +3427,15 @@ var InMemoryCapabilityBundleCoordinator = class {
|
|
|
3426
3427
|
}
|
|
3427
3428
|
/** Records a tenant Bundle as present. */
|
|
3428
3429
|
add(tenantId2, bundleId, revision = "") {
|
|
3429
|
-
const
|
|
3430
|
-
this.bundleKeys.add(
|
|
3431
|
-
this.revisions.set(
|
|
3430
|
+
const key5 = this.key(tenantId2, bundleId);
|
|
3431
|
+
this.bundleKeys.add(key5);
|
|
3432
|
+
this.revisions.set(key5, revision);
|
|
3432
3433
|
}
|
|
3433
3434
|
/** Removes a tenant Bundle. */
|
|
3434
3435
|
remove(tenantId2, bundleId) {
|
|
3435
|
-
const
|
|
3436
|
-
this.bundleKeys.delete(
|
|
3437
|
-
this.revisions.delete(
|
|
3436
|
+
const key5 = this.key(tenantId2, bundleId);
|
|
3437
|
+
this.bundleKeys.delete(key5);
|
|
3438
|
+
this.revisions.delete(key5);
|
|
3438
3439
|
}
|
|
3439
3440
|
/** Checks all requested Bundle IDs without yielding to another operation. */
|
|
3440
3441
|
hasAll(tenantId2, bundleIds) {
|
|
@@ -3482,15 +3483,15 @@ var InMemoryProjectStore = class {
|
|
|
3482
3483
|
);
|
|
3483
3484
|
}
|
|
3484
3485
|
async getProjectById(tenantId2, id) {
|
|
3485
|
-
const
|
|
3486
|
-
return this.projects.get(
|
|
3486
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3487
|
+
return this.projects.get(key5) || null;
|
|
3487
3488
|
}
|
|
3488
3489
|
async createProject(tenantId2, workspaceId, id, data) {
|
|
3489
3490
|
(0, import_protocols.assertGenericProjectConfig)(data.config);
|
|
3490
3491
|
return this.capabilityBundles.runProjectUpdate(tenantId2, id, () => {
|
|
3491
3492
|
const now = /* @__PURE__ */ new Date();
|
|
3492
|
-
const
|
|
3493
|
-
const existing = this.projects.get(
|
|
3493
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3494
|
+
const existing = this.projects.get(key5);
|
|
3494
3495
|
const capabilityBundleIds = existing?.config && Object.prototype.hasOwnProperty.call(existing.config, "capabilityBundleIds") ? { capabilityBundleIds: existing.config.capabilityBundleIds } : {};
|
|
3495
3496
|
const project = {
|
|
3496
3497
|
id,
|
|
@@ -3502,7 +3503,7 @@ var InMemoryProjectStore = class {
|
|
|
3502
3503
|
createdAt: existing?.createdAt ?? now,
|
|
3503
3504
|
updatedAt: now
|
|
3504
3505
|
};
|
|
3505
|
-
this.projects.set(
|
|
3506
|
+
this.projects.set(key5, project);
|
|
3506
3507
|
return project;
|
|
3507
3508
|
});
|
|
3508
3509
|
}
|
|
@@ -3516,8 +3517,8 @@ var InMemoryProjectStore = class {
|
|
|
3516
3517
|
async updateProject(tenantId2, id, updates) {
|
|
3517
3518
|
(0, import_protocols.assertGenericProjectConfig)(updates.config);
|
|
3518
3519
|
return this.capabilityBundles.runProjectUpdate(tenantId2, id, () => {
|
|
3519
|
-
const
|
|
3520
|
-
const existing = this.projects.get(
|
|
3520
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3521
|
+
const existing = this.projects.get(key5);
|
|
3521
3522
|
if (!existing) return null;
|
|
3522
3523
|
const updated = {
|
|
3523
3524
|
...existing,
|
|
@@ -3525,26 +3526,26 @@ var InMemoryProjectStore = class {
|
|
|
3525
3526
|
...updates.config === void 0 ? {} : { config: { ...updates.config, ...Object.prototype.hasOwnProperty.call(existing.config ?? {}, "capabilityBundleIds") ? { capabilityBundleIds: existing.config?.capabilityBundleIds } : {} } },
|
|
3526
3527
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3527
3528
|
};
|
|
3528
|
-
this.projects.set(
|
|
3529
|
+
this.projects.set(key5, updated);
|
|
3529
3530
|
return updated;
|
|
3530
3531
|
});
|
|
3531
3532
|
}
|
|
3532
3533
|
async deleteProject(tenantId2, id) {
|
|
3533
3534
|
return this.capabilityBundles.runProjectUpdate(tenantId2, id, () => {
|
|
3534
|
-
const
|
|
3535
|
-
return this.projects.delete(
|
|
3535
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3536
|
+
return this.projects.delete(key5);
|
|
3536
3537
|
});
|
|
3537
3538
|
}
|
|
3538
3539
|
async updateCapabilityBundleIds(tenantId2, projectId, bundleIds, expectedRevisions = {}) {
|
|
3539
3540
|
return this.capabilityBundles.runProjectUpdate(tenantId2, projectId, () => {
|
|
3540
|
-
const
|
|
3541
|
-
const existing = this.projects.get(
|
|
3541
|
+
const key5 = this.getKey(tenantId2, projectId);
|
|
3542
|
+
const existing = this.projects.get(key5);
|
|
3542
3543
|
if (!existing) return { status: "project_not_found" };
|
|
3543
3544
|
if (!this.capabilityBundles.hasAll(tenantId2, bundleIds)) return { status: "bundle_not_found" };
|
|
3544
3545
|
if (!this.capabilityBundles.hasAllAtRevisions(tenantId2, bundleIds, expectedRevisions)) return { status: "bundle_conflict" };
|
|
3545
3546
|
const config = existing.config && typeof existing.config === "object" && !Array.isArray(existing.config) ? existing.config : {};
|
|
3546
3547
|
const updated = { ...existing, config: { ...config, capabilityBundleIds: [...bundleIds] }, updatedAt: /* @__PURE__ */ new Date() };
|
|
3547
|
-
this.projects.set(
|
|
3548
|
+
this.projects.set(key5, updated);
|
|
3548
3549
|
return { status: "updated", project: updated };
|
|
3549
3550
|
});
|
|
3550
3551
|
}
|
|
@@ -3593,15 +3594,15 @@ var InMemoryDatabaseConfigStore = class {
|
|
|
3593
3594
|
* Get database configuration by ID
|
|
3594
3595
|
*/
|
|
3595
3596
|
async getConfigById(tenantId2, id) {
|
|
3596
|
-
const
|
|
3597
|
-
return this.configs.get(
|
|
3597
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3598
|
+
return this.configs.get(key5) || null;
|
|
3598
3599
|
}
|
|
3599
3600
|
/**
|
|
3600
3601
|
* Get database configuration by business key
|
|
3601
3602
|
*/
|
|
3602
|
-
async getConfigByKey(tenantId2,
|
|
3603
|
+
async getConfigByKey(tenantId2, key5) {
|
|
3603
3604
|
const configs = await this.getAllConfigs(tenantId2);
|
|
3604
|
-
return configs.find((config) => config.key ===
|
|
3605
|
+
return configs.find((config) => config.key === key5) || null;
|
|
3605
3606
|
}
|
|
3606
3607
|
/**
|
|
3607
3608
|
* Create a new database configuration
|
|
@@ -3626,8 +3627,8 @@ var InMemoryDatabaseConfigStore = class {
|
|
|
3626
3627
|
* Update an existing database configuration
|
|
3627
3628
|
*/
|
|
3628
3629
|
async updateConfig(tenantId2, id, updates) {
|
|
3629
|
-
const
|
|
3630
|
-
const existing = this.configs.get(
|
|
3630
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3631
|
+
const existing = this.configs.get(key5);
|
|
3631
3632
|
if (!existing) {
|
|
3632
3633
|
return null;
|
|
3633
3634
|
}
|
|
@@ -3640,22 +3641,22 @@ var InMemoryDatabaseConfigStore = class {
|
|
|
3640
3641
|
description: updates.description !== void 0 ? updates.description : existing.description,
|
|
3641
3642
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3642
3643
|
};
|
|
3643
|
-
this.configs.set(
|
|
3644
|
+
this.configs.set(key5, updated);
|
|
3644
3645
|
return updated;
|
|
3645
3646
|
}
|
|
3646
3647
|
/**
|
|
3647
3648
|
* Delete a database configuration by ID
|
|
3648
3649
|
*/
|
|
3649
3650
|
async deleteConfig(tenantId2, id) {
|
|
3650
|
-
const
|
|
3651
|
-
return this.configs.delete(
|
|
3651
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3652
|
+
return this.configs.delete(key5);
|
|
3652
3653
|
}
|
|
3653
3654
|
/**
|
|
3654
3655
|
* Check if configuration exists
|
|
3655
3656
|
*/
|
|
3656
3657
|
async hasConfig(tenantId2, id) {
|
|
3657
|
-
const
|
|
3658
|
-
return this.configs.has(
|
|
3658
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3659
|
+
return this.configs.has(key5);
|
|
3659
3660
|
}
|
|
3660
3661
|
/**
|
|
3661
3662
|
* Clear all configurations (useful for testing)
|
|
@@ -3667,9 +3668,9 @@ var InMemoryDatabaseConfigStore = class {
|
|
|
3667
3668
|
* Clear configurations for a specific tenant
|
|
3668
3669
|
*/
|
|
3669
3670
|
clearByTenant(tenantId2) {
|
|
3670
|
-
for (const
|
|
3671
|
-
if (
|
|
3672
|
-
this.configs.delete(
|
|
3671
|
+
for (const key5 of this.configs.keys()) {
|
|
3672
|
+
if (key5.startsWith(`${tenantId2}:`)) {
|
|
3673
|
+
this.configs.delete(key5);
|
|
3673
3674
|
}
|
|
3674
3675
|
}
|
|
3675
3676
|
}
|
|
@@ -3704,15 +3705,15 @@ var InMemoryMetricsServerConfigStore = class {
|
|
|
3704
3705
|
* Get metrics server configuration by ID
|
|
3705
3706
|
*/
|
|
3706
3707
|
async getConfigById(tenantId2, id) {
|
|
3707
|
-
const
|
|
3708
|
-
return this.configs.get(
|
|
3708
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3709
|
+
return this.configs.get(key5) || null;
|
|
3709
3710
|
}
|
|
3710
3711
|
/**
|
|
3711
3712
|
* Get metrics server configuration by business key
|
|
3712
3713
|
*/
|
|
3713
|
-
async getConfigByKey(tenantId2,
|
|
3714
|
+
async getConfigByKey(tenantId2, key5) {
|
|
3714
3715
|
const configs = await this.getAllConfigs(tenantId2);
|
|
3715
|
-
return configs.find((config) => config.key ===
|
|
3716
|
+
return configs.find((config) => config.key === key5) || null;
|
|
3716
3717
|
}
|
|
3717
3718
|
/**
|
|
3718
3719
|
* Create a new metrics server configuration
|
|
@@ -3737,8 +3738,8 @@ var InMemoryMetricsServerConfigStore = class {
|
|
|
3737
3738
|
* Update an existing metrics server configuration
|
|
3738
3739
|
*/
|
|
3739
3740
|
async updateConfig(tenantId2, id, updates) {
|
|
3740
|
-
const
|
|
3741
|
-
const existing = this.configs.get(
|
|
3741
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3742
|
+
const existing = this.configs.get(key5);
|
|
3742
3743
|
if (!existing) {
|
|
3743
3744
|
return null;
|
|
3744
3745
|
}
|
|
@@ -3751,22 +3752,22 @@ var InMemoryMetricsServerConfigStore = class {
|
|
|
3751
3752
|
description: updates.description !== void 0 ? updates.description : existing.description,
|
|
3752
3753
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3753
3754
|
};
|
|
3754
|
-
this.configs.set(
|
|
3755
|
+
this.configs.set(key5, updated);
|
|
3755
3756
|
return updated;
|
|
3756
3757
|
}
|
|
3757
3758
|
/**
|
|
3758
3759
|
* Delete a metrics server configuration by ID
|
|
3759
3760
|
*/
|
|
3760
3761
|
async deleteConfig(tenantId2, id) {
|
|
3761
|
-
const
|
|
3762
|
-
return this.configs.delete(
|
|
3762
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3763
|
+
return this.configs.delete(key5);
|
|
3763
3764
|
}
|
|
3764
3765
|
/**
|
|
3765
3766
|
* Check if configuration exists
|
|
3766
3767
|
*/
|
|
3767
3768
|
async hasConfig(tenantId2, id) {
|
|
3768
|
-
const
|
|
3769
|
-
return this.configs.has(
|
|
3769
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3770
|
+
return this.configs.has(key5);
|
|
3770
3771
|
}
|
|
3771
3772
|
/**
|
|
3772
3773
|
* Clear all configurations (useful for testing)
|
|
@@ -3778,9 +3779,9 @@ var InMemoryMetricsServerConfigStore = class {
|
|
|
3778
3779
|
* Clear configurations for a specific tenant
|
|
3779
3780
|
*/
|
|
3780
3781
|
clearByTenant(tenantId2) {
|
|
3781
|
-
for (const
|
|
3782
|
-
if (
|
|
3783
|
-
this.configs.delete(
|
|
3782
|
+
for (const key5 of this.configs.keys()) {
|
|
3783
|
+
if (key5.startsWith(`${tenantId2}:`)) {
|
|
3784
|
+
this.configs.delete(key5);
|
|
3784
3785
|
}
|
|
3785
3786
|
}
|
|
3786
3787
|
}
|
|
@@ -3815,15 +3816,15 @@ var InMemoryMcpServerConfigStore = class {
|
|
|
3815
3816
|
* Get MCP server configuration by ID
|
|
3816
3817
|
*/
|
|
3817
3818
|
async getConfigById(tenantId2, id) {
|
|
3818
|
-
const
|
|
3819
|
-
return this.configs.get(
|
|
3819
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3820
|
+
return this.configs.get(key5) || null;
|
|
3820
3821
|
}
|
|
3821
3822
|
/**
|
|
3822
3823
|
* Get MCP server configuration by business key
|
|
3823
3824
|
*/
|
|
3824
|
-
async getConfigByKey(tenantId2,
|
|
3825
|
+
async getConfigByKey(tenantId2, key5) {
|
|
3825
3826
|
const configs = await this.getAllConfigs(tenantId2);
|
|
3826
|
-
return configs.find((config) => config.key ===
|
|
3827
|
+
return configs.find((config) => config.key === key5) || null;
|
|
3827
3828
|
}
|
|
3828
3829
|
/**
|
|
3829
3830
|
* Create a new MCP server configuration
|
|
@@ -3851,8 +3852,8 @@ var InMemoryMcpServerConfigStore = class {
|
|
|
3851
3852
|
* Update an existing MCP server configuration
|
|
3852
3853
|
*/
|
|
3853
3854
|
async updateConfig(tenantId2, id, updates) {
|
|
3854
|
-
const
|
|
3855
|
-
const existing = this.configs.get(
|
|
3855
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3856
|
+
const existing = this.configs.get(key5);
|
|
3856
3857
|
if (!existing) {
|
|
3857
3858
|
return null;
|
|
3858
3859
|
}
|
|
@@ -3867,22 +3868,22 @@ var InMemoryMcpServerConfigStore = class {
|
|
|
3867
3868
|
status: updates.status !== void 0 ? updates.status : existing.status,
|
|
3868
3869
|
updatedAt: /* @__PURE__ */ new Date()
|
|
3869
3870
|
};
|
|
3870
|
-
this.configs.set(
|
|
3871
|
+
this.configs.set(key5, updated);
|
|
3871
3872
|
return updated;
|
|
3872
3873
|
}
|
|
3873
3874
|
/**
|
|
3874
3875
|
* Delete a MCP server configuration by ID
|
|
3875
3876
|
*/
|
|
3876
3877
|
async deleteConfig(tenantId2, id) {
|
|
3877
|
-
const
|
|
3878
|
-
return this.configs.delete(
|
|
3878
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3879
|
+
return this.configs.delete(key5);
|
|
3879
3880
|
}
|
|
3880
3881
|
/**
|
|
3881
3882
|
* Check if configuration exists
|
|
3882
3883
|
*/
|
|
3883
3884
|
async hasConfig(tenantId2, id) {
|
|
3884
|
-
const
|
|
3885
|
-
return this.configs.has(
|
|
3885
|
+
const key5 = this.getKey(tenantId2, id);
|
|
3886
|
+
return this.configs.has(key5);
|
|
3886
3887
|
}
|
|
3887
3888
|
/**
|
|
3888
3889
|
* Clear all configurations (useful for testing)
|
|
@@ -3894,9 +3895,9 @@ var InMemoryMcpServerConfigStore = class {
|
|
|
3894
3895
|
* Clear configurations for a specific tenant
|
|
3895
3896
|
*/
|
|
3896
3897
|
clearByTenant(tenantId2) {
|
|
3897
|
-
for (const
|
|
3898
|
-
if (
|
|
3899
|
-
this.configs.delete(
|
|
3898
|
+
for (const key5 of this.configs.keys()) {
|
|
3899
|
+
if (key5.startsWith(`${tenantId2}:`)) {
|
|
3900
|
+
this.configs.delete(key5);
|
|
3900
3901
|
}
|
|
3901
3902
|
}
|
|
3902
3903
|
}
|
|
@@ -4073,10 +4074,10 @@ var InMemoryCapabilityBundleStore = class {
|
|
|
4073
4074
|
}
|
|
4074
4075
|
async deleteIfUnreferenced(tenantId2, id) {
|
|
4075
4076
|
return this.coordinator.runProjectUpdate(tenantId2, id, () => {
|
|
4076
|
-
const
|
|
4077
|
-
if (!this.bundles.has(
|
|
4077
|
+
const key5 = this.key(tenantId2, id);
|
|
4078
|
+
if (!this.bundles.has(key5)) return "not_found";
|
|
4078
4079
|
if (this.projectStore.isCapabilityBundleReferencedSync(tenantId2, id)) return "in_use";
|
|
4079
|
-
this.bundles.delete(
|
|
4080
|
+
this.bundles.delete(key5);
|
|
4080
4081
|
this.coordinator.remove(tenantId2, id);
|
|
4081
4082
|
return "deleted";
|
|
4082
4083
|
});
|
|
@@ -4610,6 +4611,19 @@ var InMemoryProjectRoomMessageStore = class {
|
|
|
4610
4611
|
async findById(tenantId2, id) {
|
|
4611
4612
|
return this.coordinator.runExclusive((transaction) => transaction.getMessage(tenantId2, id) ?? null);
|
|
4612
4613
|
}
|
|
4614
|
+
/**
|
|
4615
|
+
* Counts messages created strictly after a horizon, optionally excluding one human author.
|
|
4616
|
+
*
|
|
4617
|
+
* @param input - Tenant/room scope, exclusive lower time bound, optional excluded human author.
|
|
4618
|
+
* @returns The number of matching messages.
|
|
4619
|
+
*/
|
|
4620
|
+
async countAfter(input) {
|
|
4621
|
+
if (!validDate(input.after)) {
|
|
4622
|
+
throw new RangeError("Project room message count horizon date is invalid");
|
|
4623
|
+
}
|
|
4624
|
+
const horizon = Date.prototype.getTime.call(input.after);
|
|
4625
|
+
return this.coordinator.runExclusive((transaction) => transaction.getMessages().filter((message) => message.tenantId === input.tenantId && message.roomId === input.roomId && message.createdAt.getTime() > horizon).filter((message) => input.excludeAuthorUserId === void 0 || !(message.author.type === "human" && message.author.userId === input.excludeAuthorUserId)).length);
|
|
4626
|
+
}
|
|
4613
4627
|
createInTransaction(transaction, input) {
|
|
4614
4628
|
if (transaction.getMessage(input.tenantId, input.id) !== void 0) {
|
|
4615
4629
|
throw new ProjectRoomMessageIdConflictError(input.tenantId, input.id);
|
|
@@ -4619,6 +4633,69 @@ var InMemoryProjectRoomMessageStore = class {
|
|
|
4619
4633
|
return structuredClone(message);
|
|
4620
4634
|
}
|
|
4621
4635
|
};
|
|
4636
|
+
function validDate(value) {
|
|
4637
|
+
try {
|
|
4638
|
+
return typeof value === "object" && value !== null && Number.isFinite(Date.prototype.getTime.call(value));
|
|
4639
|
+
} catch {
|
|
4640
|
+
return false;
|
|
4641
|
+
}
|
|
4642
|
+
}
|
|
4643
|
+
|
|
4644
|
+
// src/store_lattice/InMemoryProjectRoomReadStateStore.ts
|
|
4645
|
+
var InMemoryProjectRoomReadStateStore = class {
|
|
4646
|
+
constructor() {
|
|
4647
|
+
this.states = /* @__PURE__ */ new Map();
|
|
4648
|
+
}
|
|
4649
|
+
/**
|
|
4650
|
+
* Returns a defensive copy of the user's read marker.
|
|
4651
|
+
*
|
|
4652
|
+
* @param tenantId - Tenant owning the room.
|
|
4653
|
+
* @param roomId - Room the marker applies to.
|
|
4654
|
+
* @param userId - User the marker belongs to.
|
|
4655
|
+
* @returns The stored read state, or `null` when never reported.
|
|
4656
|
+
*/
|
|
4657
|
+
async get(tenantId2, roomId, userId) {
|
|
4658
|
+
const state = this.states.get(key(tenantId2, roomId, userId));
|
|
4659
|
+
return state ? structuredClone(state) : null;
|
|
4660
|
+
}
|
|
4661
|
+
/**
|
|
4662
|
+
* Upserts the marker with a monotonic lastReadAt and returns the stored state.
|
|
4663
|
+
*
|
|
4664
|
+
* @param input - Tenant/room/user scope and the read horizon to report.
|
|
4665
|
+
* @returns A defensive copy of the stored read state after the write.
|
|
4666
|
+
*
|
|
4667
|
+
* @remarks
|
|
4668
|
+
* `updatedAt` refreshes on every call — even when an older report does not
|
|
4669
|
+
* move the horizon — so it records the last report time, not the last change.
|
|
4670
|
+
*/
|
|
4671
|
+
async markRead(input) {
|
|
4672
|
+
if (!validDate2(input.lastReadAt)) {
|
|
4673
|
+
throw new RangeError("Project room read state lastReadAt is invalid");
|
|
4674
|
+
}
|
|
4675
|
+
const reported = new Date(Date.prototype.getTime.call(input.lastReadAt));
|
|
4676
|
+
const existing = this.states.get(key(input.tenantId, input.roomId, input.userId));
|
|
4677
|
+
const lastReadAt = existing !== void 0 && existing.lastReadAt.getTime() > reported.getTime() ? existing.lastReadAt : reported;
|
|
4678
|
+
const next = {
|
|
4679
|
+
tenantId: input.tenantId,
|
|
4680
|
+
roomId: input.roomId,
|
|
4681
|
+
userId: input.userId,
|
|
4682
|
+
lastReadAt,
|
|
4683
|
+
updatedAt: /* @__PURE__ */ new Date()
|
|
4684
|
+
};
|
|
4685
|
+
this.states.set(key(next.tenantId, next.roomId, next.userId), next);
|
|
4686
|
+
return structuredClone(next);
|
|
4687
|
+
}
|
|
4688
|
+
};
|
|
4689
|
+
function key(tenantId2, roomId, userId) {
|
|
4690
|
+
return JSON.stringify([tenantId2, roomId, userId]);
|
|
4691
|
+
}
|
|
4692
|
+
function validDate2(value) {
|
|
4693
|
+
try {
|
|
4694
|
+
return typeof value === "object" && value !== null && Number.isFinite(Date.prototype.getTime.call(value));
|
|
4695
|
+
} catch {
|
|
4696
|
+
return false;
|
|
4697
|
+
}
|
|
4698
|
+
}
|
|
4622
4699
|
|
|
4623
4700
|
// src/store_lattice/InMemoryUserStore.ts
|
|
4624
4701
|
var InMemoryUserStore = class {
|
|
@@ -4754,8 +4831,8 @@ var InMemoryUserTenantLinkStore = class {
|
|
|
4754
4831
|
);
|
|
4755
4832
|
}
|
|
4756
4833
|
async getLink(userId, tenantId2) {
|
|
4757
|
-
const
|
|
4758
|
-
return this.links.get(
|
|
4834
|
+
const key5 = this.getKey(userId, tenantId2);
|
|
4835
|
+
return this.links.get(key5) || null;
|
|
4759
4836
|
}
|
|
4760
4837
|
async createLink(data) {
|
|
4761
4838
|
const link = {
|
|
@@ -4765,29 +4842,29 @@ var InMemoryUserTenantLinkStore = class {
|
|
|
4765
4842
|
joinedAt: /* @__PURE__ */ new Date(),
|
|
4766
4843
|
metadata: data.metadata ?? {}
|
|
4767
4844
|
};
|
|
4768
|
-
const
|
|
4769
|
-
this.links.set(
|
|
4845
|
+
const key5 = this.getKey(data.userId, data.tenantId);
|
|
4846
|
+
this.links.set(key5, link);
|
|
4770
4847
|
return link;
|
|
4771
4848
|
}
|
|
4772
4849
|
async updateLink(userId, tenantId2, updates) {
|
|
4773
|
-
const
|
|
4774
|
-
const existing = this.links.get(
|
|
4850
|
+
const key5 = this.getKey(userId, tenantId2);
|
|
4851
|
+
const existing = this.links.get(key5);
|
|
4775
4852
|
if (!existing) return null;
|
|
4776
4853
|
const updated = {
|
|
4777
4854
|
...existing,
|
|
4778
4855
|
...updates,
|
|
4779
4856
|
metadata: updates.metadata ?? existing.metadata
|
|
4780
4857
|
};
|
|
4781
|
-
this.links.set(
|
|
4858
|
+
this.links.set(key5, updated);
|
|
4782
4859
|
return updated;
|
|
4783
4860
|
}
|
|
4784
4861
|
async deleteLink(userId, tenantId2) {
|
|
4785
|
-
const
|
|
4786
|
-
return this.links.delete(
|
|
4862
|
+
const key5 = this.getKey(userId, tenantId2);
|
|
4863
|
+
return this.links.delete(key5);
|
|
4787
4864
|
}
|
|
4788
4865
|
async hasLink(userId, tenantId2) {
|
|
4789
|
-
const
|
|
4790
|
-
return this.links.has(
|
|
4866
|
+
const key5 = this.getKey(userId, tenantId2);
|
|
4867
|
+
return this.links.has(key5);
|
|
4791
4868
|
}
|
|
4792
4869
|
clear() {
|
|
4793
4870
|
this.links.clear();
|
|
@@ -5449,9 +5526,9 @@ var InMemoryA2AApiKeyStore = class {
|
|
|
5449
5526
|
constructor() {
|
|
5450
5527
|
this.keys = /* @__PURE__ */ new Map();
|
|
5451
5528
|
}
|
|
5452
|
-
async findByKey(
|
|
5529
|
+
async findByKey(key5) {
|
|
5453
5530
|
for (const record of this.keys.values()) {
|
|
5454
|
-
if (record.key ===
|
|
5531
|
+
if (record.key === key5 && record.enabled) return record;
|
|
5455
5532
|
}
|
|
5456
5533
|
return null;
|
|
5457
5534
|
}
|
|
@@ -5531,7 +5608,7 @@ function cloneTaskValue(value) {
|
|
|
5531
5608
|
if (Array.isArray(value)) return value.map((entry) => cloneTaskValue(entry));
|
|
5532
5609
|
if (value && typeof value === "object") {
|
|
5533
5610
|
return Object.fromEntries(
|
|
5534
|
-
Object.entries(value).map(([
|
|
5611
|
+
Object.entries(value).map(([key5, entry]) => [key5, cloneTaskValue(entry)])
|
|
5535
5612
|
);
|
|
5536
5613
|
}
|
|
5537
5614
|
return value;
|
|
@@ -5687,8 +5764,8 @@ var InMemoryTaskStore = class {
|
|
|
5687
5764
|
if (filter2.parentId) results = results.filter((t) => t.parentId === filter2.parentId);
|
|
5688
5765
|
if (filter2.sourceId) results = results.filter((t) => t.sourceId === filter2.sourceId);
|
|
5689
5766
|
if (filter2.metadata) {
|
|
5690
|
-
for (const [
|
|
5691
|
-
results = results.filter((t) => t.metadata?.[
|
|
5767
|
+
for (const [key5, value] of Object.entries(filter2.metadata)) {
|
|
5768
|
+
results = results.filter((t) => t.metadata?.[key5] === value);
|
|
5692
5769
|
}
|
|
5693
5770
|
}
|
|
5694
5771
|
results.sort((a, b) => b.createdAt.getTime() - a.createdAt.getTime() || b.id.localeCompare(a.id));
|
|
@@ -5903,12 +5980,12 @@ var InMemoryTaskWorkItemStore = class {
|
|
|
5903
5980
|
}
|
|
5904
5981
|
/** Atomically return an existing event or create it once. */
|
|
5905
5982
|
async createIfAbsentByEventKey(params) {
|
|
5906
|
-
const
|
|
5907
|
-
const existing = this.events.get(
|
|
5983
|
+
const key5 = this.eventMapKey(params.tenantId, params.taskId, params.eventKey);
|
|
5984
|
+
const existing = this.events.get(key5);
|
|
5908
5985
|
if (existing) return existing;
|
|
5909
5986
|
const item = this.append(params);
|
|
5910
5987
|
item.eventKey = params.eventKey;
|
|
5911
|
-
this.events.set(
|
|
5988
|
+
this.events.set(key5, item);
|
|
5912
5989
|
return item;
|
|
5913
5990
|
}
|
|
5914
5991
|
/**
|
|
@@ -6074,8 +6151,8 @@ var StoreLatticeManager = class _StoreLatticeManager extends BaseLatticeManager
|
|
|
6074
6151
|
* @param type Store type
|
|
6075
6152
|
* @returns Composite key string
|
|
6076
6153
|
*/
|
|
6077
|
-
getCompositeKey(
|
|
6078
|
-
return `${
|
|
6154
|
+
getCompositeKey(key5, type) {
|
|
6155
|
+
return `${key5}:${type}`;
|
|
6079
6156
|
}
|
|
6080
6157
|
/**
|
|
6081
6158
|
* Register store Lattice with type safety
|
|
@@ -6084,13 +6161,13 @@ var StoreLatticeManager = class _StoreLatticeManager extends BaseLatticeManager
|
|
|
6084
6161
|
* @param type Store type (e.g., "thread")
|
|
6085
6162
|
* @param store Store implementation instance matching the type
|
|
6086
6163
|
*/
|
|
6087
|
-
registerLattice(
|
|
6164
|
+
registerLattice(key5, type, store) {
|
|
6088
6165
|
const storeLattice = {
|
|
6089
|
-
key:
|
|
6166
|
+
key: key5,
|
|
6090
6167
|
type,
|
|
6091
6168
|
store
|
|
6092
6169
|
};
|
|
6093
|
-
const compositeKey = this.getCompositeKey(
|
|
6170
|
+
const compositeKey = this.getCompositeKey(key5, type);
|
|
6094
6171
|
this.register(compositeKey, storeLattice);
|
|
6095
6172
|
}
|
|
6096
6173
|
/**
|
|
@@ -6100,15 +6177,15 @@ var StoreLatticeManager = class _StoreLatticeManager extends BaseLatticeManager
|
|
|
6100
6177
|
* @param type Expected store type for type checking
|
|
6101
6178
|
* @returns StoreLattice with typed store
|
|
6102
6179
|
*/
|
|
6103
|
-
getStoreLattice(
|
|
6104
|
-
const compositeKey = this.getCompositeKey(
|
|
6180
|
+
getStoreLattice(key5, type) {
|
|
6181
|
+
const compositeKey = this.getCompositeKey(key5, type);
|
|
6105
6182
|
const storeLattice = this.get(compositeKey);
|
|
6106
6183
|
if (!storeLattice) {
|
|
6107
|
-
throw new Error(`StoreLattice ${
|
|
6184
|
+
throw new Error(`StoreLattice ${key5}:${type} not found`);
|
|
6108
6185
|
}
|
|
6109
6186
|
if (storeLattice.type !== type) {
|
|
6110
6187
|
throw new Error(
|
|
6111
|
-
`StoreLattice ${
|
|
6188
|
+
`StoreLattice ${key5}:${type} has type "${storeLattice.type}", expected "${type}"`
|
|
6112
6189
|
);
|
|
6113
6190
|
}
|
|
6114
6191
|
return storeLattice;
|
|
@@ -6119,11 +6196,11 @@ var StoreLatticeManager = class _StoreLatticeManager extends BaseLatticeManager
|
|
|
6119
6196
|
* @param type Store type
|
|
6120
6197
|
* @returns StoreLattice (type may be unknown)
|
|
6121
6198
|
*/
|
|
6122
|
-
getStoreLatticeUnsafe(
|
|
6123
|
-
const compositeKey = this.getCompositeKey(
|
|
6199
|
+
getStoreLatticeUnsafe(key5, type) {
|
|
6200
|
+
const compositeKey = this.getCompositeKey(key5, type);
|
|
6124
6201
|
const storeLattice = this.get(compositeKey);
|
|
6125
6202
|
if (!storeLattice) {
|
|
6126
|
-
throw new Error(`StoreLattice ${
|
|
6203
|
+
throw new Error(`StoreLattice ${key5}:${type} not found`);
|
|
6127
6204
|
}
|
|
6128
6205
|
return storeLattice;
|
|
6129
6206
|
}
|
|
@@ -6139,8 +6216,8 @@ var StoreLatticeManager = class _StoreLatticeManager extends BaseLatticeManager
|
|
|
6139
6216
|
* @param key Lattice key name
|
|
6140
6217
|
* @param type Store type
|
|
6141
6218
|
*/
|
|
6142
|
-
hasLattice(
|
|
6143
|
-
const compositeKey = this.getCompositeKey(
|
|
6219
|
+
hasLattice(key5, type) {
|
|
6220
|
+
const compositeKey = this.getCompositeKey(key5, type);
|
|
6144
6221
|
return this.has(compositeKey);
|
|
6145
6222
|
}
|
|
6146
6223
|
/**
|
|
@@ -6149,8 +6226,8 @@ var StoreLatticeManager = class _StoreLatticeManager extends BaseLatticeManager
|
|
|
6149
6226
|
* @param key Lattice key name
|
|
6150
6227
|
* @param type Store type
|
|
6151
6228
|
*/
|
|
6152
|
-
removeLattice(
|
|
6153
|
-
const compositeKey = this.getCompositeKey(
|
|
6229
|
+
removeLattice(key5, type) {
|
|
6230
|
+
const compositeKey = this.getCompositeKey(key5, type);
|
|
6154
6231
|
return this.remove(compositeKey);
|
|
6155
6232
|
}
|
|
6156
6233
|
/**
|
|
@@ -6173,8 +6250,8 @@ var StoreLatticeManager = class _StoreLatticeManager extends BaseLatticeManager
|
|
|
6173
6250
|
}
|
|
6174
6251
|
};
|
|
6175
6252
|
var storeLatticeManager = StoreLatticeManager.getInstance();
|
|
6176
|
-
var registerStoreLattice = (
|
|
6177
|
-
var getStoreLattice = (
|
|
6253
|
+
var registerStoreLattice = (key5, type, store) => storeLatticeManager.registerLattice(key5, type, store);
|
|
6254
|
+
var getStoreLattice = (key5, type) => storeLatticeManager.getStoreLattice(key5, type);
|
|
6178
6255
|
var defaultThreadStore = new InMemoryThreadStore();
|
|
6179
6256
|
var defaultAssistantStore = new InMemoryAssistantStore();
|
|
6180
6257
|
var defaultSkillStore = new FileSystemSkillStore();
|
|
@@ -6191,6 +6268,7 @@ var defaultProjectRoomStore = new InMemoryProjectRoomStore(defaultProjectRoomCoo
|
|
|
6191
6268
|
var defaultProjectMembershipStore = new InMemoryProjectMembershipStore(defaultProjectRoomCoordinator);
|
|
6192
6269
|
var defaultProjectBotMembershipStore = new InMemoryProjectBotMembershipStore(defaultProjectRoomCoordinator);
|
|
6193
6270
|
var defaultProjectRoomMessageStore = new InMemoryProjectRoomMessageStore(defaultProjectRoomCoordinator);
|
|
6271
|
+
var defaultProjectRoomReadStateStore = new InMemoryProjectRoomReadStateStore();
|
|
6194
6272
|
storeLatticeManager.registerLattice("default", "thread", defaultThreadStore);
|
|
6195
6273
|
storeLatticeManager.registerLattice(
|
|
6196
6274
|
"default",
|
|
@@ -6209,6 +6287,7 @@ storeLatticeManager.registerLattice("default", "projectRoom", defaultProjectRoom
|
|
|
6209
6287
|
storeLatticeManager.registerLattice("default", "projectMembership", defaultProjectMembershipStore);
|
|
6210
6288
|
storeLatticeManager.registerLattice("default", "projectBotMembership", defaultProjectBotMembershipStore);
|
|
6211
6289
|
storeLatticeManager.registerLattice("default", "projectRoomMessage", defaultProjectRoomMessageStore);
|
|
6290
|
+
storeLatticeManager.registerLattice("default", "projectRoomReadState", defaultProjectRoomReadStateStore);
|
|
6212
6291
|
var defaultUserStore = new InMemoryUserStore();
|
|
6213
6292
|
var defaultTenantStore = new InMemoryTenantStore();
|
|
6214
6293
|
var defaultUserTenantLinkStore = new InMemoryUserTenantLinkStore();
|
|
@@ -6778,7 +6857,7 @@ var SqlDatabaseManager = class _SqlDatabaseManager {
|
|
|
6778
6857
|
* @param key - Unique identifier for the database within the tenant
|
|
6779
6858
|
* @param config - Database configuration
|
|
6780
6859
|
*/
|
|
6781
|
-
registerDatabase(tenantId2,
|
|
6860
|
+
registerDatabase(tenantId2, key5, config) {
|
|
6782
6861
|
let database;
|
|
6783
6862
|
switch (config.type) {
|
|
6784
6863
|
case "postgres":
|
|
@@ -6793,9 +6872,9 @@ var SqlDatabaseManager = class _SqlDatabaseManager {
|
|
|
6793
6872
|
throw new Error(`Unsupported database type: ${config.type}`);
|
|
6794
6873
|
}
|
|
6795
6874
|
const tenantDbs = this.getTenantDatabases(tenantId2);
|
|
6796
|
-
tenantDbs.set(
|
|
6875
|
+
tenantDbs.set(key5, database);
|
|
6797
6876
|
if (!this.defaultDatabaseKeys.has(tenantId2)) {
|
|
6798
|
-
this.defaultDatabaseKeys.set(tenantId2,
|
|
6877
|
+
this.defaultDatabaseKeys.set(tenantId2, key5);
|
|
6799
6878
|
}
|
|
6800
6879
|
}
|
|
6801
6880
|
/**
|
|
@@ -6803,12 +6882,12 @@ var SqlDatabaseManager = class _SqlDatabaseManager {
|
|
|
6803
6882
|
* @param tenantId - Tenant identifier
|
|
6804
6883
|
* @param key - Database key to set as default
|
|
6805
6884
|
*/
|
|
6806
|
-
setDefaultDatabase(tenantId2,
|
|
6885
|
+
setDefaultDatabase(tenantId2, key5) {
|
|
6807
6886
|
const tenantDbs = this.databases.get(tenantId2);
|
|
6808
|
-
if (!tenantDbs || !tenantDbs.has(
|
|
6809
|
-
throw new Error(`Database '${
|
|
6887
|
+
if (!tenantDbs || !tenantDbs.has(key5)) {
|
|
6888
|
+
throw new Error(`Database '${key5}' not found for tenant '${tenantId2}'`);
|
|
6810
6889
|
}
|
|
6811
|
-
this.defaultDatabaseKeys.set(tenantId2,
|
|
6890
|
+
this.defaultDatabaseKeys.set(tenantId2, key5);
|
|
6812
6891
|
}
|
|
6813
6892
|
/**
|
|
6814
6893
|
* Get a database by key for a specific tenant
|
|
@@ -6818,9 +6897,9 @@ var SqlDatabaseManager = class _SqlDatabaseManager {
|
|
|
6818
6897
|
* @returns ISqlDatabase instance
|
|
6819
6898
|
* @throws Error if tenant or database not found
|
|
6820
6899
|
*/
|
|
6821
|
-
async getDatabase(tenantId2,
|
|
6900
|
+
async getDatabase(tenantId2, key5) {
|
|
6822
6901
|
const tenantDbs = this.databases.get(tenantId2);
|
|
6823
|
-
const dbKey =
|
|
6902
|
+
const dbKey = key5 || this.defaultDatabaseKeys.get(tenantId2);
|
|
6824
6903
|
if (!dbKey) {
|
|
6825
6904
|
throw new Error(`No default database set for tenant '${tenantId2}'`);
|
|
6826
6905
|
}
|
|
@@ -6860,9 +6939,9 @@ var SqlDatabaseManager = class _SqlDatabaseManager {
|
|
|
6860
6939
|
* @param key - Database key
|
|
6861
6940
|
* @returns true if database exists for the tenant
|
|
6862
6941
|
*/
|
|
6863
|
-
hasDatabase(tenantId2,
|
|
6942
|
+
hasDatabase(tenantId2, key5) {
|
|
6864
6943
|
const tenantDbs = this.databases.get(tenantId2);
|
|
6865
|
-
return tenantDbs ? tenantDbs.has(
|
|
6944
|
+
return tenantDbs ? tenantDbs.has(key5) : false;
|
|
6866
6945
|
}
|
|
6867
6946
|
/**
|
|
6868
6947
|
* Get all registered database keys for a tenant
|
|
@@ -6878,14 +6957,14 @@ var SqlDatabaseManager = class _SqlDatabaseManager {
|
|
|
6878
6957
|
* @param tenantId - Tenant identifier
|
|
6879
6958
|
* @param key - Database key
|
|
6880
6959
|
*/
|
|
6881
|
-
async removeDatabase(tenantId2,
|
|
6960
|
+
async removeDatabase(tenantId2, key5) {
|
|
6882
6961
|
const tenantDbs = this.databases.get(tenantId2);
|
|
6883
6962
|
if (!tenantDbs) return;
|
|
6884
|
-
const database = tenantDbs.get(
|
|
6963
|
+
const database = tenantDbs.get(key5);
|
|
6885
6964
|
if (database) {
|
|
6886
6965
|
await database.disconnect();
|
|
6887
|
-
tenantDbs.delete(
|
|
6888
|
-
if (this.defaultDatabaseKeys.get(tenantId2) ===
|
|
6966
|
+
tenantDbs.delete(key5);
|
|
6967
|
+
if (this.defaultDatabaseKeys.get(tenantId2) === key5) {
|
|
6889
6968
|
const remainingKeys = Array.from(tenantDbs.keys());
|
|
6890
6969
|
if (remainingKeys.length > 0) {
|
|
6891
6970
|
this.defaultDatabaseKeys.set(tenantId2, remainingKeys[0]);
|
|
@@ -7004,7 +7083,7 @@ function getEffectiveDatabaseKeys(exeConfig, staticDatabaseKeys) {
|
|
|
7004
7083
|
const runtimeConfig = getRuntimeCapabilityConfig(exeConfig, "sql");
|
|
7005
7084
|
if (runtimeConfig && Object.prototype.hasOwnProperty.call(runtimeConfig, "databaseKeys")) {
|
|
7006
7085
|
const databaseKeys = runtimeConfig.databaseKeys;
|
|
7007
|
-
if (Array.isArray(databaseKeys) && databaseKeys.every((
|
|
7086
|
+
if (Array.isArray(databaseKeys) && databaseKeys.every((key5) => typeof key5 === "string")) {
|
|
7008
7087
|
return databaseKeys;
|
|
7009
7088
|
}
|
|
7010
7089
|
return [];
|
|
@@ -7023,7 +7102,7 @@ var createListTablesSqlTool = ({ databaseKeys, databaseDescriptions, getTenantId
|
|
|
7023
7102
|
|
|
7024
7103
|
Available databases:
|
|
7025
7104
|
${databaseKeys.map(
|
|
7026
|
-
(
|
|
7105
|
+
(key5) => `- ${key5}${databaseDescriptions?.[key5] ? `: ${databaseDescriptions[key5]}` : ""}`
|
|
7027
7106
|
).join("\n")}` : "";
|
|
7028
7107
|
return (0, import_langchain.tool)(
|
|
7029
7108
|
async ({ databaseKey }, _exeConfig) => {
|
|
@@ -7068,7 +7147,7 @@ var createInfoSqlTool = ({ databaseKeys, databaseDescriptions, getTenantId: getT
|
|
|
7068
7147
|
|
|
7069
7148
|
Available databases:
|
|
7070
7149
|
${databaseKeys.map(
|
|
7071
|
-
(
|
|
7150
|
+
(key5) => `- ${key5}${databaseDescriptions?.[key5] ? `: ${databaseDescriptions[key5]}` : ""}`
|
|
7072
7151
|
).join("\n")}` : "";
|
|
7073
7152
|
return (0, import_langchain2.tool)(
|
|
7074
7153
|
async ({
|
|
@@ -7201,7 +7280,7 @@ var createQueryCheckerSqlTool = ({ databaseKeys, databaseDescriptions, getTenant
|
|
|
7201
7280
|
|
|
7202
7281
|
Available databases:
|
|
7203
7282
|
${databaseKeys.map(
|
|
7204
|
-
(
|
|
7283
|
+
(key5) => `- ${key5}${databaseDescriptions?.[key5] ? `: ${databaseDescriptions[key5]}` : ""}`
|
|
7205
7284
|
).join("\n")}` : "";
|
|
7206
7285
|
return (0, import_langchain3.tool)(
|
|
7207
7286
|
async ({
|
|
@@ -7330,7 +7409,7 @@ var createQuerySqlTool = ({ databaseKeys, databaseDescriptions, getTenantId: get
|
|
|
7330
7409
|
|
|
7331
7410
|
Available databases:
|
|
7332
7411
|
${databaseKeys.map(
|
|
7333
|
-
(
|
|
7412
|
+
(key5) => `- ${key5}${databaseDescriptions?.[key5] ? `: ${databaseDescriptions[key5]}` : ""}`
|
|
7334
7413
|
).join("\n")}` : "";
|
|
7335
7414
|
return (0, import_langchain4.tool)(
|
|
7336
7415
|
async ({
|
|
@@ -7375,7 +7454,7 @@ async function getEffectiveServerKeys(exeConfig, staticServerKeys, staticConnect
|
|
|
7375
7454
|
const runtimeConfig = getRuntimeCapabilityConfig(exeConfig, "metrics");
|
|
7376
7455
|
const hasRuntimeKeys = runtimeConfig !== void 0 && Object.prototype.hasOwnProperty.call(runtimeConfig, "serverKeys");
|
|
7377
7456
|
const runtimeKeys = hasRuntimeKeys ? runtimeConfig.serverKeys : void 0;
|
|
7378
|
-
const serverKeys = Array.isArray(runtimeKeys) && runtimeKeys.every((
|
|
7457
|
+
const serverKeys = Array.isArray(runtimeKeys) && runtimeKeys.every((key5) => typeof key5 === "string") ? runtimeKeys : hasRuntimeKeys ? [] : staticServerKeys;
|
|
7379
7458
|
const hasRuntimeConnectAll = runtimeConfig !== void 0 && Object.prototype.hasOwnProperty.call(runtimeConfig, "connectAll");
|
|
7380
7459
|
const connectAll = hasRuntimeConnectAll ? runtimeConfig.connectAll === true && staticConnectAll !== false : staticConnectAll === true;
|
|
7381
7460
|
if (requestedServerKey !== void 0) {
|
|
@@ -7385,7 +7464,7 @@ async function getEffectiveServerKeys(exeConfig, staticServerKeys, staticConnect
|
|
|
7385
7464
|
return serverKeys.includes(requestedServerKey) ? [...serverKeys] : [requestedServerKey];
|
|
7386
7465
|
}
|
|
7387
7466
|
const availableKeys = (await manager.getServerKeys(tenantId2)).map((server) => server.key);
|
|
7388
|
-
return connectAll ? availableKeys : serverKeys.filter((
|
|
7467
|
+
return connectAll ? availableKeys : serverKeys.filter((key5) => availableKeys.includes(key5));
|
|
7389
7468
|
}
|
|
7390
7469
|
function getTenantIdFromConfig2(exeConfig, getTenantId3) {
|
|
7391
7470
|
const runConfig = exeConfig?.configurable?.runConfig || {};
|
|
@@ -7526,9 +7605,9 @@ var SemanticMetricsClient = class {
|
|
|
7526
7605
|
});
|
|
7527
7606
|
}
|
|
7528
7607
|
if (options.labels) {
|
|
7529
|
-
for (const [
|
|
7608
|
+
for (const [key5, value] of Object.entries(options.labels)) {
|
|
7530
7609
|
filters.push({
|
|
7531
|
-
dimension:
|
|
7610
|
+
dimension: key5,
|
|
7532
7611
|
operator: "=",
|
|
7533
7612
|
values: [value]
|
|
7534
7613
|
});
|
|
@@ -7857,7 +7936,7 @@ var PrometheusClient = class {
|
|
|
7857
7936
|
const step = options.step || 60;
|
|
7858
7937
|
let query = metricName;
|
|
7859
7938
|
if (options.labels && Object.keys(options.labels).length > 0) {
|
|
7860
|
-
const labelSelectors = Object.entries(options.labels).map(([
|
|
7939
|
+
const labelSelectors = Object.entries(options.labels).map(([key5, value]) => `${key5}="${value}"`).join(",");
|
|
7861
7940
|
query = `${metricName}{${labelSelectors}}`;
|
|
7862
7941
|
}
|
|
7863
7942
|
try {
|
|
@@ -8062,47 +8141,47 @@ var MetricsServerManager = class _MetricsServerManager {
|
|
|
8062
8141
|
* Resolve a server config for a tenant. Queries the store for freshness.
|
|
8063
8142
|
* When store has no data, falls back to in-memory cache.
|
|
8064
8143
|
*/
|
|
8065
|
-
async _resolveConfig(tenantId2,
|
|
8144
|
+
async _resolveConfig(tenantId2, key5) {
|
|
8066
8145
|
try {
|
|
8067
8146
|
const { store } = getStoreLattice("default", "metrics");
|
|
8068
8147
|
const configStore = store;
|
|
8069
|
-
const entry = await configStore.getConfigByKey(tenantId2,
|
|
8148
|
+
const entry = await configStore.getConfigByKey(tenantId2, key5);
|
|
8070
8149
|
if (entry) return entry.config;
|
|
8071
8150
|
} catch {
|
|
8072
8151
|
}
|
|
8073
8152
|
const tenantConfigs = this.configs.get(tenantId2);
|
|
8074
|
-
const cached = tenantConfigs?.get(
|
|
8153
|
+
const cached = tenantConfigs?.get(key5);
|
|
8075
8154
|
if (cached) return cached;
|
|
8076
|
-
throw new Error(`Metrics server '${
|
|
8155
|
+
throw new Error(`Metrics server '${key5}' not found for tenant '${tenantId2}'`);
|
|
8077
8156
|
}
|
|
8078
8157
|
/**
|
|
8079
8158
|
* Register a metrics server for a tenant. Stores config in memory
|
|
8080
8159
|
* for fallback / programmatic registration use.
|
|
8081
8160
|
*/
|
|
8082
|
-
registerServer(tenantId2,
|
|
8161
|
+
registerServer(tenantId2, key5, config) {
|
|
8083
8162
|
const tenantConfigs = this.getTenantConfigs(tenantId2);
|
|
8084
|
-
tenantConfigs.set(
|
|
8163
|
+
tenantConfigs.set(key5, config);
|
|
8085
8164
|
if (!this.defaultServerKeys.has(tenantId2)) {
|
|
8086
|
-
this.defaultServerKeys.set(tenantId2,
|
|
8165
|
+
this.defaultServerKeys.set(tenantId2, key5);
|
|
8087
8166
|
}
|
|
8088
8167
|
}
|
|
8089
8168
|
/**
|
|
8090
8169
|
* Set the default metrics server for a tenant
|
|
8091
8170
|
*/
|
|
8092
|
-
setDefaultServer(tenantId2,
|
|
8171
|
+
setDefaultServer(tenantId2, key5) {
|
|
8093
8172
|
const tenantConfigs = this.configs.get(tenantId2);
|
|
8094
|
-
if (!tenantConfigs || !tenantConfigs.has(
|
|
8095
|
-
throw new Error(`Metrics server '${
|
|
8173
|
+
if (!tenantConfigs || !tenantConfigs.has(key5)) {
|
|
8174
|
+
throw new Error(`Metrics server '${key5}' not found for tenant '${tenantId2}'`);
|
|
8096
8175
|
}
|
|
8097
|
-
this.defaultServerKeys.set(tenantId2,
|
|
8176
|
+
this.defaultServerKeys.set(tenantId2, key5);
|
|
8098
8177
|
}
|
|
8099
8178
|
/**
|
|
8100
8179
|
* Get a metrics server client for a tenant.
|
|
8101
8180
|
* Always queries the store for the latest config, creates a fresh client.
|
|
8102
8181
|
* Falls back to in-memory cache when store is unavailable.
|
|
8103
8182
|
*/
|
|
8104
|
-
async getClient(tenantId2,
|
|
8105
|
-
const serverKey =
|
|
8183
|
+
async getClient(tenantId2, key5) {
|
|
8184
|
+
const serverKey = key5 || this.defaultServerKeys.get(tenantId2);
|
|
8106
8185
|
if (!serverKey) {
|
|
8107
8186
|
throw new Error(`No default metrics server set for tenant '${tenantId2}'`);
|
|
8108
8187
|
}
|
|
@@ -8114,8 +8193,8 @@ var MetricsServerManager = class _MetricsServerManager {
|
|
|
8114
8193
|
* Always queries the store for freshness.
|
|
8115
8194
|
* Falls back to in-memory cache when store is unavailable.
|
|
8116
8195
|
*/
|
|
8117
|
-
async getConfig(tenantId2,
|
|
8118
|
-
const serverKey =
|
|
8196
|
+
async getConfig(tenantId2, key5) {
|
|
8197
|
+
const serverKey = key5 || this.defaultServerKeys.get(tenantId2);
|
|
8119
8198
|
if (!serverKey) {
|
|
8120
8199
|
throw new Error(`No default metrics server set for tenant '${tenantId2}'`);
|
|
8121
8200
|
}
|
|
@@ -8125,9 +8204,9 @@ var MetricsServerManager = class _MetricsServerManager {
|
|
|
8125
8204
|
* Check if a metrics server exists in the in-memory cache.
|
|
8126
8205
|
* For store-backed existence checks, use getClient() or getConfig().
|
|
8127
8206
|
*/
|
|
8128
|
-
hasServer(tenantId2,
|
|
8207
|
+
hasServer(tenantId2, key5) {
|
|
8129
8208
|
const tenantConfigs = this.configs.get(tenantId2);
|
|
8130
|
-
return tenantConfigs ? tenantConfigs.has(
|
|
8209
|
+
return tenantConfigs ? tenantConfigs.has(key5) : false;
|
|
8131
8210
|
}
|
|
8132
8211
|
/**
|
|
8133
8212
|
* Get all registered metrics server keys for a tenant.
|
|
@@ -8146,22 +8225,22 @@ var MetricsServerManager = class _MetricsServerManager {
|
|
|
8146
8225
|
}
|
|
8147
8226
|
const tenantConfigs = this.configs.get(tenantId2);
|
|
8148
8227
|
if (!tenantConfigs) return [];
|
|
8149
|
-
return Array.from(tenantConfigs.entries()).map(([
|
|
8150
|
-
key:
|
|
8228
|
+
return Array.from(tenantConfigs.entries()).map(([key5, config]) => ({
|
|
8229
|
+
key: key5,
|
|
8151
8230
|
type: config.type
|
|
8152
8231
|
}));
|
|
8153
8232
|
}
|
|
8154
8233
|
/**
|
|
8155
8234
|
* Remove a metrics server for a tenant
|
|
8156
8235
|
*/
|
|
8157
|
-
removeServer(tenantId2,
|
|
8236
|
+
removeServer(tenantId2, key5) {
|
|
8158
8237
|
const tenantConfigs = this.configs.get(tenantId2);
|
|
8159
8238
|
if (!tenantConfigs) return;
|
|
8160
|
-
tenantConfigs.delete(
|
|
8239
|
+
tenantConfigs.delete(key5);
|
|
8161
8240
|
if (tenantConfigs.size === 0) {
|
|
8162
8241
|
this.configs.delete(tenantId2);
|
|
8163
8242
|
}
|
|
8164
|
-
if (this.defaultServerKeys.get(tenantId2) ===
|
|
8243
|
+
if (this.defaultServerKeys.get(tenantId2) === key5) {
|
|
8165
8244
|
const remainingKeys = Array.from(tenantConfigs.keys());
|
|
8166
8245
|
if (remainingKeys.length > 0) {
|
|
8167
8246
|
this.defaultServerKeys.set(tenantId2, remainingKeys[0]);
|
|
@@ -8207,7 +8286,7 @@ var createListMetricsServersTool = ({ serverKeys, serverDescriptions, getTenantI
|
|
|
8207
8286
|
|
|
8208
8287
|
Available metrics servers:
|
|
8209
8288
|
${serverKeys.map(
|
|
8210
|
-
(
|
|
8289
|
+
(key5) => `- ${key5}${serverDescriptions?.[key5] ? `: ${serverDescriptions[key5]}` : ""}`
|
|
8211
8290
|
).join("\n")}` : "";
|
|
8212
8291
|
return (0, import_langchain5.tool)(
|
|
8213
8292
|
async (_input, _exeConfig) => {
|
|
@@ -8217,9 +8296,9 @@ ${serverKeys.map(
|
|
|
8217
8296
|
if (servers.length === 0) {
|
|
8218
8297
|
return "No metrics servers registered.";
|
|
8219
8298
|
}
|
|
8220
|
-
const lines = servers.map(({ key:
|
|
8221
|
-
const desc = serverDescriptions?.[
|
|
8222
|
-
return `- ${
|
|
8299
|
+
const lines = servers.map(({ key: key5, type }) => {
|
|
8300
|
+
const desc = serverDescriptions?.[key5] ? ` - ${serverDescriptions[key5]}` : "";
|
|
8301
|
+
return `- ${key5} (${type})${desc}`;
|
|
8223
8302
|
});
|
|
8224
8303
|
return `Available metrics servers:
|
|
8225
8304
|
${lines.join("\n")}`;
|
|
@@ -8244,7 +8323,7 @@ var createListMetricsDataSourcesTool = ({ serverKeys, serverDescriptions, getTen
|
|
|
8244
8323
|
|
|
8245
8324
|
Configured metrics servers:
|
|
8246
8325
|
${serverKeys.map(
|
|
8247
|
-
(
|
|
8326
|
+
(key5) => `- ${key5}${serverDescriptions?.[key5] ? `: ${serverDescriptions[key5]}` : ""}`
|
|
8248
8327
|
).join("\n")}` : "";
|
|
8249
8328
|
return (0, import_langchain6.tool)(
|
|
8250
8329
|
async (_input, _exeConfig) => {
|
|
@@ -8362,7 +8441,7 @@ var createQueryMetricsListTool = ({ serverKeys, serverDescriptions, getTenantId:
|
|
|
8362
8441
|
|
|
8363
8442
|
Available metrics servers:
|
|
8364
8443
|
${serverKeys.map(
|
|
8365
|
-
(
|
|
8444
|
+
(key5) => `- ${key5}${serverDescriptions?.[key5] ? `: ${serverDescriptions[key5]}` : ""}`
|
|
8366
8445
|
).join("\n")}` : "";
|
|
8367
8446
|
return (0, import_langchain7.tool)(
|
|
8368
8447
|
async ({
|
|
@@ -8521,7 +8600,7 @@ var createQueryMetricDefinitionTool = ({ serverKeys, serverDescriptions, getTena
|
|
|
8521
8600
|
|
|
8522
8601
|
Available metrics servers:
|
|
8523
8602
|
${serverKeys.map(
|
|
8524
|
-
(
|
|
8603
|
+
(key5) => `- ${key5}${serverDescriptions?.[key5] ? `: ${serverDescriptions[key5]}` : ""}`
|
|
8525
8604
|
).join("\n")}` : "";
|
|
8526
8605
|
return (0, import_langchain8.tool)(
|
|
8527
8606
|
async ({
|
|
@@ -8756,7 +8835,7 @@ var createQuerySemanticMetricDataTool = ({ serverKeys, serverDescriptions, getTe
|
|
|
8756
8835
|
|
|
8757
8836
|
Available metrics servers:
|
|
8758
8837
|
${serverKeys.map(
|
|
8759
|
-
(
|
|
8838
|
+
(key5) => `- ${key5}${serverDescriptions?.[key5] ? `: ${serverDescriptions[key5]}` : ""}`
|
|
8760
8839
|
).join("\n")}` : "";
|
|
8761
8840
|
return (0, import_langchain9.tool)(
|
|
8762
8841
|
async ({
|
|
@@ -8843,7 +8922,7 @@ var createQueryTablesListTool = ({ serverKeys, serverDescriptions, getTenantId:
|
|
|
8843
8922
|
|
|
8844
8923
|
Available metrics servers:
|
|
8845
8924
|
${serverKeys.map(
|
|
8846
|
-
(
|
|
8925
|
+
(key5) => `- ${key5}${serverDescriptions?.[key5] ? `: ${serverDescriptions[key5]}` : ""}`
|
|
8847
8926
|
).join("\n")}` : "";
|
|
8848
8927
|
return (0, import_langchain10.tool)(
|
|
8849
8928
|
async ({
|
|
@@ -8949,7 +9028,7 @@ var createQueryTableDefinitionTool = ({ serverKeys, serverDescriptions, getTenan
|
|
|
8949
9028
|
|
|
8950
9029
|
Available metrics servers:
|
|
8951
9030
|
${serverKeys.map(
|
|
8952
|
-
(
|
|
9031
|
+
(key5) => `- ${key5}${serverDescriptions?.[key5] ? `: ${serverDescriptions[key5]}` : ""}`
|
|
8953
9032
|
).join("\n")}` : "";
|
|
8954
9033
|
return (0, import_langchain11.tool)(
|
|
8955
9034
|
async ({
|
|
@@ -9089,7 +9168,7 @@ var createExecuteSqlQueryTool = ({ serverKeys, serverDescriptions, getTenantId:
|
|
|
9089
9168
|
|
|
9090
9169
|
Available metrics servers:
|
|
9091
9170
|
${serverKeys.map(
|
|
9092
|
-
(
|
|
9171
|
+
(key5) => `- ${key5}${serverDescriptions?.[key5] ? `: ${serverDescriptions[key5]}` : ""}`
|
|
9093
9172
|
).join("\n")}` : "";
|
|
9094
9173
|
return (0, import_langchain12.tool)(
|
|
9095
9174
|
async ({
|
|
@@ -9385,24 +9464,24 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
|
|
|
9385
9464
|
getLatticeType() {
|
|
9386
9465
|
return "sandbox_manager";
|
|
9387
9466
|
}
|
|
9388
|
-
registerLattice(
|
|
9389
|
-
this.register(
|
|
9467
|
+
registerLattice(key5, provider) {
|
|
9468
|
+
this.register(key5, provider);
|
|
9390
9469
|
}
|
|
9391
|
-
getSandboxLattice(
|
|
9392
|
-
const lattice = this.get(
|
|
9470
|
+
getSandboxLattice(key5) {
|
|
9471
|
+
const lattice = this.get(key5);
|
|
9393
9472
|
if (!lattice) {
|
|
9394
|
-
throw new Error(`SandboxLattice ${
|
|
9473
|
+
throw new Error(`SandboxLattice ${key5} not found`);
|
|
9395
9474
|
}
|
|
9396
9475
|
return lattice;
|
|
9397
9476
|
}
|
|
9398
9477
|
getAllLattices() {
|
|
9399
9478
|
return this.getAll();
|
|
9400
9479
|
}
|
|
9401
|
-
hasLattice(
|
|
9402
|
-
return this.has(
|
|
9480
|
+
hasLattice(key5) {
|
|
9481
|
+
return this.has(key5);
|
|
9403
9482
|
}
|
|
9404
|
-
removeLattice(
|
|
9405
|
-
return this.remove(
|
|
9483
|
+
removeLattice(key5) {
|
|
9484
|
+
return this.remove(key5);
|
|
9406
9485
|
}
|
|
9407
9486
|
clearLattices() {
|
|
9408
9487
|
this.clear();
|
|
@@ -9527,10 +9606,10 @@ var SandboxLatticeManager = class _SandboxLatticeManager extends BaseLatticeMana
|
|
|
9527
9606
|
}
|
|
9528
9607
|
};
|
|
9529
9608
|
var sandboxLatticeManager = SandboxLatticeManager.getInstance();
|
|
9530
|
-
var getSandBoxManager = (
|
|
9531
|
-
if (!sandboxLatticeManager.hasLattice(
|
|
9609
|
+
var getSandBoxManager = (key5 = "default") => {
|
|
9610
|
+
if (!sandboxLatticeManager.hasLattice(key5)) {
|
|
9532
9611
|
throw new Error(
|
|
9533
|
-
`Sandbox ${
|
|
9612
|
+
`Sandbox ${key5} not configured. Ensure the sandbox provider is registered.`
|
|
9534
9613
|
);
|
|
9535
9614
|
}
|
|
9536
9615
|
return sandboxLatticeManager;
|
|
@@ -11224,8 +11303,8 @@ init_BaseLatticeManager();
|
|
|
11224
11303
|
// src/stt_model_lattice/STTModelLattice.ts
|
|
11225
11304
|
var import_openai2 = require("@langchain/openai");
|
|
11226
11305
|
var STTModelLattice = class {
|
|
11227
|
-
constructor(
|
|
11228
|
-
this.key =
|
|
11306
|
+
constructor(key5, config) {
|
|
11307
|
+
this.key = key5;
|
|
11229
11308
|
this.config = config;
|
|
11230
11309
|
this.client = this;
|
|
11231
11310
|
const apiKey = config.apiKey || (config.apiKeyEnvName ? process.env[config.apiKeyEnvName] : void 0) || process.env.OPENAI_API_KEY || "";
|
|
@@ -11337,45 +11416,45 @@ var STTModelLatticeManager = class _STTModelLatticeManager extends BaseLatticeMa
|
|
|
11337
11416
|
* @param key - Lattice key name
|
|
11338
11417
|
* @param config - STT provider configuration
|
|
11339
11418
|
*/
|
|
11340
|
-
registerLattice(
|
|
11341
|
-
const client = new STTModelLattice(
|
|
11342
|
-
const label = config.model ||
|
|
11419
|
+
registerLattice(key5, config) {
|
|
11420
|
+
const client = new STTModelLattice(key5, config);
|
|
11421
|
+
const label = config.model || key5;
|
|
11343
11422
|
const sttLattice = {
|
|
11344
|
-
key:
|
|
11423
|
+
key: key5,
|
|
11345
11424
|
client,
|
|
11346
11425
|
config,
|
|
11347
11426
|
label
|
|
11348
11427
|
};
|
|
11349
|
-
this.register(
|
|
11428
|
+
this.register(key5, sttLattice);
|
|
11350
11429
|
}
|
|
11351
11430
|
/**
|
|
11352
11431
|
* Get an STT model lattice by key.
|
|
11353
11432
|
*/
|
|
11354
|
-
getSTTModelLattice(
|
|
11355
|
-
const lattice = this.get(
|
|
11433
|
+
getSTTModelLattice(key5) {
|
|
11434
|
+
const lattice = this.get(key5);
|
|
11356
11435
|
if (!lattice) {
|
|
11357
|
-
throw new Error(`STTModelLattice "${
|
|
11436
|
+
throw new Error(`STTModelLattice "${key5}" not found`);
|
|
11358
11437
|
}
|
|
11359
11438
|
return lattice;
|
|
11360
11439
|
}
|
|
11361
11440
|
/**
|
|
11362
11441
|
* Get STT client instance by key (default tenant).
|
|
11363
11442
|
*/
|
|
11364
|
-
getSTTClient(
|
|
11365
|
-
return this.getSTTModelLattice(
|
|
11443
|
+
getSTTClient(key5) {
|
|
11444
|
+
return this.getSTTModelLattice(key5).client;
|
|
11366
11445
|
}
|
|
11367
11446
|
/**
|
|
11368
11447
|
* Get STT client instance by key and tenant.
|
|
11369
11448
|
* @param tenantId - Tenant ID for isolation
|
|
11370
11449
|
* @param key - Lattice key name
|
|
11371
11450
|
*/
|
|
11372
|
-
getSTTClientWithTenant(tenantId2,
|
|
11373
|
-
let lattice = this.getWithTenant(tenantId2,
|
|
11451
|
+
getSTTClientWithTenant(tenantId2, key5) {
|
|
11452
|
+
let lattice = this.getWithTenant(tenantId2, key5);
|
|
11374
11453
|
if (!lattice && tenantId2 !== "default") {
|
|
11375
|
-
lattice = this.getWithTenant("default",
|
|
11454
|
+
lattice = this.getWithTenant("default", key5);
|
|
11376
11455
|
}
|
|
11377
11456
|
if (!lattice) {
|
|
11378
|
-
throw new Error(`STTModelLattice "${
|
|
11457
|
+
throw new Error(`STTModelLattice "${key5}" not found for tenant "${tenantId2}"`);
|
|
11379
11458
|
}
|
|
11380
11459
|
return lattice.client;
|
|
11381
11460
|
}
|
|
@@ -11393,11 +11472,11 @@ var STTModelLatticeManager = class _STTModelLatticeManager extends BaseLatticeMa
|
|
|
11393
11472
|
getAllLattices() {
|
|
11394
11473
|
return this.getAll();
|
|
11395
11474
|
}
|
|
11396
|
-
hasLattice(
|
|
11397
|
-
return this.has(
|
|
11475
|
+
hasLattice(key5) {
|
|
11476
|
+
return this.has(key5);
|
|
11398
11477
|
}
|
|
11399
|
-
removeLattice(
|
|
11400
|
-
return this.remove(
|
|
11478
|
+
removeLattice(key5) {
|
|
11479
|
+
return this.remove(key5);
|
|
11401
11480
|
}
|
|
11402
11481
|
clearLattices() {
|
|
11403
11482
|
this.clear();
|
|
@@ -11410,10 +11489,10 @@ var STTModelLatticeManager = class _STTModelLatticeManager extends BaseLatticeMa
|
|
|
11410
11489
|
}
|
|
11411
11490
|
};
|
|
11412
11491
|
var sttModelLatticeManager = STTModelLatticeManager.getInstance();
|
|
11413
|
-
var registerSTTModelLattice = (
|
|
11414
|
-
var getSTTModelLattice = (
|
|
11415
|
-
var getSTTClient = (
|
|
11416
|
-
var getSTTClientWithTenant = (tenantId2,
|
|
11492
|
+
var registerSTTModelLattice = (key5, config) => sttModelLatticeManager.registerLattice(key5, config);
|
|
11493
|
+
var getSTTModelLattice = (key5) => sttModelLatticeManager.getSTTModelLattice(key5);
|
|
11494
|
+
var getSTTClient = (key5) => sttModelLatticeManager.getSTTClient(key5);
|
|
11495
|
+
var getSTTClientWithTenant = (tenantId2, key5) => sttModelLatticeManager.getSTTClientWithTenant(tenantId2, key5);
|
|
11417
11496
|
|
|
11418
11497
|
// src/deep_agent_new/backends/transcribeAudio.ts
|
|
11419
11498
|
async function transcribeAudio(options) {
|
|
@@ -11436,19 +11515,19 @@ var FileDataSchema = import_v3.z.object({
|
|
|
11436
11515
|
function fileDataReducer(left, right) {
|
|
11437
11516
|
if (left === void 0) {
|
|
11438
11517
|
const result2 = {};
|
|
11439
|
-
for (const [
|
|
11518
|
+
for (const [key5, value] of Object.entries(right)) {
|
|
11440
11519
|
if (value !== null) {
|
|
11441
|
-
result2[
|
|
11520
|
+
result2[key5] = value;
|
|
11442
11521
|
}
|
|
11443
11522
|
}
|
|
11444
11523
|
return result2;
|
|
11445
11524
|
}
|
|
11446
11525
|
const result = { ...left };
|
|
11447
|
-
for (const [
|
|
11526
|
+
for (const [key5, value] of Object.entries(right)) {
|
|
11448
11527
|
if (value === null) {
|
|
11449
|
-
delete result[
|
|
11528
|
+
delete result[key5];
|
|
11450
11529
|
} else {
|
|
11451
|
-
result[
|
|
11530
|
+
result[key5] = value;
|
|
11452
11531
|
}
|
|
11453
11532
|
}
|
|
11454
11533
|
return result;
|
|
@@ -11484,7 +11563,11 @@ Path conventions:
|
|
|
11484
11563
|
- edit_file: edit a file in the filesystem
|
|
11485
11564
|
- delete_file: permanently and irreversibly delete an existing regular file from the filesystem
|
|
11486
11565
|
- glob: find files matching a pattern (e.g., "/project/**/*.py")
|
|
11487
|
-
- grep: search for text within files
|
|
11566
|
+
- grep: search for text within files
|
|
11567
|
+
|
|
11568
|
+
Output formatting:
|
|
11569
|
+
- When mentioning or listing sandbox file paths (e.g. /project/notes/index.md) in your reply, write them as plain markdown text (inline or as a bullet list) so the UI renders them as clickable file links.
|
|
11570
|
+
- Never put a list of file paths inside a fenced code block (triple backticks): paths inside code blocks are not rendered clickable.`;
|
|
11488
11571
|
var LS_TOOL_DESCRIPTION = "List files and directories in a directory";
|
|
11489
11572
|
var READ_FILE_TOOL_DESCRIPTION = "Read the contents of a file. For image files (png, jpg, gif, webp, bmp, svg), returns a visual description when the current model supports vision; otherwise returns an error suggesting a vision-capable model. For audio files (webm, wav, mp3, m4a, ogg, flac, aac, wma, opus, amr), transcribes the content using the default STT model; if none is registered, returns an error with registration instructions.";
|
|
11490
11573
|
var WRITE_FILE_TOOL_DESCRIPTION = "Write content to a new file. Returns an error if the file already exists";
|
|
@@ -12525,8 +12608,8 @@ var LEGACY_BOOTSTRAP_OVERRIDE_PATHS = {
|
|
|
12525
12608
|
};
|
|
12526
12609
|
function buildScaffoldContent(bootstrapFiles = {}) {
|
|
12527
12610
|
const scaffoldContent = { ...DEFAULT_MD_FIRST_CONTENT };
|
|
12528
|
-
for (const [
|
|
12529
|
-
const override = bootstrapFiles[
|
|
12611
|
+
for (const [key5, filePath] of Object.entries(LEGACY_BOOTSTRAP_OVERRIDE_PATHS)) {
|
|
12612
|
+
const override = bootstrapFiles[key5];
|
|
12530
12613
|
if (filePath && override !== void 0) {
|
|
12531
12614
|
scaffoldContent[filePath] = override;
|
|
12532
12615
|
}
|
|
@@ -13065,8 +13148,8 @@ function isMissingManifestError(error) {
|
|
|
13065
13148
|
if (record.statusCode === 404 || record.status === 404 || record.code === "ENOENT") {
|
|
13066
13149
|
return true;
|
|
13067
13150
|
}
|
|
13068
|
-
for (const
|
|
13069
|
-
if (
|
|
13151
|
+
for (const key5 of ["message", "error", "body", "cause"]) {
|
|
13152
|
+
if (key5 in record) values.push(record[key5]);
|
|
13070
13153
|
}
|
|
13071
13154
|
}
|
|
13072
13155
|
return false;
|
|
@@ -13102,13 +13185,13 @@ function parseSkillFrontmatter(content) {
|
|
|
13102
13185
|
if (currentKey === "metadata" && indent > metadataIndent) {
|
|
13103
13186
|
const colonIndex2 = trimmed.indexOf(":");
|
|
13104
13187
|
if (colonIndex2 !== -1) {
|
|
13105
|
-
const
|
|
13188
|
+
const key6 = trimmed.substring(0, colonIndex2).trim();
|
|
13106
13189
|
let value2 = trimmed.substring(colonIndex2 + 1).trim();
|
|
13107
13190
|
if (value2.startsWith('"') && value2.endsWith('"') || value2.startsWith("'") && value2.endsWith("'")) {
|
|
13108
13191
|
value2 = value2.slice(1, -1);
|
|
13109
13192
|
}
|
|
13110
13193
|
if (!meta.metadata) meta.metadata = {};
|
|
13111
|
-
meta.metadata[
|
|
13194
|
+
meta.metadata[key6] = value2;
|
|
13112
13195
|
}
|
|
13113
13196
|
continue;
|
|
13114
13197
|
}
|
|
@@ -13129,12 +13212,12 @@ function parseSkillFrontmatter(content) {
|
|
|
13129
13212
|
}
|
|
13130
13213
|
const colonIndex = trimmed.indexOf(":");
|
|
13131
13214
|
if (colonIndex === -1) continue;
|
|
13132
|
-
const
|
|
13215
|
+
const key5 = trimmed.substring(0, colonIndex).trim();
|
|
13133
13216
|
let value = trimmed.substring(colonIndex + 1).trim();
|
|
13134
13217
|
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
13135
13218
|
value = value.slice(1, -1);
|
|
13136
13219
|
}
|
|
13137
|
-
if (
|
|
13220
|
+
if (key5 === "metadata") {
|
|
13138
13221
|
if (value === "" || value === "{}") {
|
|
13139
13222
|
if (i + 1 < lines.length && (lines[i + 1].match(/^(\s*)/)?.[1].length || 0) > indent) {
|
|
13140
13223
|
currentKey = "metadata";
|
|
@@ -13144,7 +13227,7 @@ function parseSkillFrontmatter(content) {
|
|
|
13144
13227
|
}
|
|
13145
13228
|
}
|
|
13146
13229
|
meta.metadata = value.startsWith("{") ? safeJsonParse(value, {}) : {};
|
|
13147
|
-
} else if (
|
|
13230
|
+
} else if (key5 === "subSkills") {
|
|
13148
13231
|
if (value === "" || value === "[]") {
|
|
13149
13232
|
if (i + 1 < lines.length && (lines[i + 1].match(/^(\s*)/)?.[1].length || 0) > indent && lines[i + 1].trim().startsWith("-")) {
|
|
13150
13233
|
currentKey = "subSkills";
|
|
@@ -13155,7 +13238,7 @@ function parseSkillFrontmatter(content) {
|
|
|
13155
13238
|
}
|
|
13156
13239
|
meta.subSkills = value.startsWith("[") ? safeJsonParse(value, []) : [];
|
|
13157
13240
|
} else {
|
|
13158
|
-
meta[
|
|
13241
|
+
meta[key5] = value;
|
|
13159
13242
|
}
|
|
13160
13243
|
}
|
|
13161
13244
|
return { meta, body };
|
|
@@ -13175,8 +13258,8 @@ function buildSkillFile(meta, body) {
|
|
|
13175
13258
|
}
|
|
13176
13259
|
if (meta.metadata && Object.keys(meta.metadata).length > 0) {
|
|
13177
13260
|
lines.push("metadata:");
|
|
13178
|
-
for (const [
|
|
13179
|
-
lines.push(` ${
|
|
13261
|
+
for (const [key5, value] of Object.entries(meta.metadata)) {
|
|
13262
|
+
lines.push(` ${key5}: ${value}`);
|
|
13180
13263
|
}
|
|
13181
13264
|
}
|
|
13182
13265
|
if (meta.subSkills && meta.subSkills.length > 0) {
|
|
@@ -13214,54 +13297,54 @@ function validateSkillName2(name, pluginType) {
|
|
|
13214
13297
|
var PluginRegistry = class {
|
|
13215
13298
|
/** Register a plugin (overwrites if type conflicts) */
|
|
13216
13299
|
static register(plugin) {
|
|
13217
|
-
const
|
|
13218
|
-
if (!
|
|
13300
|
+
const key5 = plugin.meta.type;
|
|
13301
|
+
if (!key5 || typeof key5 !== "string") {
|
|
13219
13302
|
throw new Error("Plugin type must be a non-empty string");
|
|
13220
13303
|
}
|
|
13221
13304
|
if (plugin.skills) {
|
|
13222
|
-
const prefix = `${
|
|
13305
|
+
const prefix = `${key5}-`;
|
|
13223
13306
|
for (const [name, definition] of Object.entries(plugin.skills)) {
|
|
13224
|
-
validateSkillName2(name,
|
|
13307
|
+
validateSkillName2(name, key5);
|
|
13225
13308
|
if (!name.startsWith(prefix)) {
|
|
13226
13309
|
throw new Error(
|
|
13227
|
-
`Plugin "${
|
|
13310
|
+
`Plugin "${key5}": skill "${name}" must start with "${prefix}". Skill names must be prefixed with the plugin type followed by a hyphen.`
|
|
13228
13311
|
);
|
|
13229
13312
|
}
|
|
13230
13313
|
const rawDefinition = definition;
|
|
13231
13314
|
if (!isRecord2(rawDefinition) || typeof rawDefinition.version !== "string" || rawDefinition.version.trim().length === 0 || typeof rawDefinition.content !== "string") {
|
|
13232
|
-
throw new Error(`Plugin "${
|
|
13315
|
+
throw new Error(`Plugin "${key5}": skill "${name}" version and content must be a string`);
|
|
13233
13316
|
}
|
|
13234
13317
|
const resources3 = rawDefinition.resources;
|
|
13235
13318
|
if (resources3 !== void 0 && !isRecord2(resources3)) {
|
|
13236
|
-
throw new Error(`Plugin "${
|
|
13319
|
+
throw new Error(`Plugin "${key5}": skill "${name}" resources must be an object`);
|
|
13237
13320
|
}
|
|
13238
13321
|
for (const [path8, resource] of Object.entries(resources3 ?? {})) {
|
|
13239
13322
|
try {
|
|
13240
13323
|
validateRelativePath(path8, "resource");
|
|
13241
13324
|
} catch {
|
|
13242
|
-
throw new Error(`Plugin "${
|
|
13325
|
+
throw new Error(`Plugin "${key5}": resource path "${path8}" must be a safe relative path`);
|
|
13243
13326
|
}
|
|
13244
13327
|
if (!isRecord2(resource) || typeof resource.content !== "string") {
|
|
13245
|
-
throw new Error(`Plugin "${
|
|
13328
|
+
throw new Error(`Plugin "${key5}": resource "${path8}" content must be a string`);
|
|
13246
13329
|
}
|
|
13247
13330
|
if (resource.mimeType !== void 0 && typeof resource.mimeType !== "string") {
|
|
13248
|
-
throw new Error(`Plugin "${
|
|
13331
|
+
throw new Error(`Plugin "${key5}": resource "${path8}" mimeType must be a string`);
|
|
13249
13332
|
}
|
|
13250
13333
|
}
|
|
13251
13334
|
}
|
|
13252
13335
|
}
|
|
13253
|
-
if (this.plugins.has(
|
|
13254
|
-
console.warn(`[PluginRegistry] "${
|
|
13336
|
+
if (this.plugins.has(key5)) {
|
|
13337
|
+
console.warn(`[PluginRegistry] "${key5}" overwritten`);
|
|
13255
13338
|
}
|
|
13256
|
-
this.plugins.set(
|
|
13339
|
+
this.plugins.set(key5, plugin);
|
|
13257
13340
|
}
|
|
13258
13341
|
/** Unregister */
|
|
13259
|
-
static unregister(
|
|
13260
|
-
return this.plugins.delete(
|
|
13342
|
+
static unregister(key5) {
|
|
13343
|
+
return this.plugins.delete(key5);
|
|
13261
13344
|
}
|
|
13262
13345
|
/** Get plugin instance */
|
|
13263
|
-
static get(
|
|
13264
|
-
return this.plugins.get(
|
|
13346
|
+
static get(key5) {
|
|
13347
|
+
return this.plugins.get(key5);
|
|
13265
13348
|
}
|
|
13266
13349
|
/** Get a plugin skill definition and its owning plugin type. */
|
|
13267
13350
|
static getSkill(name) {
|
|
@@ -13284,8 +13367,8 @@ var PluginRegistry = class {
|
|
|
13284
13367
|
return definition ? { pluginType, definition } : void 0;
|
|
13285
13368
|
}
|
|
13286
13369
|
/** Check if registered */
|
|
13287
|
-
static has(
|
|
13288
|
-
return this.plugins.has(
|
|
13370
|
+
static has(key5) {
|
|
13371
|
+
return this.plugins.has(key5);
|
|
13289
13372
|
}
|
|
13290
13373
|
/** List all registered plugin keys */
|
|
13291
13374
|
static list() {
|
|
@@ -13343,14 +13426,14 @@ var CustomMiddlewareRegistry = class {
|
|
|
13343
13426
|
* @param factory - Function that receives config (minus `key`) and returns an AgentMiddleware
|
|
13344
13427
|
* @param deprecatedMeta - Optional metadata for API discovery
|
|
13345
13428
|
*/
|
|
13346
|
-
static register(
|
|
13347
|
-
this.factories.set(
|
|
13348
|
-
const existing = PluginRegistry.get(
|
|
13429
|
+
static register(key5, factory, deprecatedMeta) {
|
|
13430
|
+
this.factories.set(key5, factory);
|
|
13431
|
+
const existing = PluginRegistry.get(key5);
|
|
13349
13432
|
if (existing) return;
|
|
13350
13433
|
const plugin = {
|
|
13351
13434
|
meta: {
|
|
13352
|
-
type:
|
|
13353
|
-
name: deprecatedMeta?.name ||
|
|
13435
|
+
type: key5,
|
|
13436
|
+
name: deprecatedMeta?.name || key5,
|
|
13354
13437
|
description: deprecatedMeta?.description || "",
|
|
13355
13438
|
version: deprecatedMeta?.version,
|
|
13356
13439
|
source: deprecatedMeta?.source,
|
|
@@ -13368,9 +13451,9 @@ var CustomMiddlewareRegistry = class {
|
|
|
13368
13451
|
* @param key - The factory key to unregister
|
|
13369
13452
|
* @returns `true` if a factory was removed, `false` if the key was not found
|
|
13370
13453
|
*/
|
|
13371
|
-
static unregister(
|
|
13372
|
-
PluginRegistry.unregister(
|
|
13373
|
-
return this.factories.delete(
|
|
13454
|
+
static unregister(key5) {
|
|
13455
|
+
PluginRegistry.unregister(key5);
|
|
13456
|
+
return this.factories.delete(key5);
|
|
13374
13457
|
}
|
|
13375
13458
|
/**
|
|
13376
13459
|
* Look up a factory by key.
|
|
@@ -13378,10 +13461,10 @@ var CustomMiddlewareRegistry = class {
|
|
|
13378
13461
|
* @param key - The factory key
|
|
13379
13462
|
* @returns The factory function, or `undefined` if not registered
|
|
13380
13463
|
*/
|
|
13381
|
-
static get(
|
|
13382
|
-
const factory = this.factories.get(
|
|
13464
|
+
static get(key5) {
|
|
13465
|
+
const factory = this.factories.get(key5);
|
|
13383
13466
|
if (factory) return factory;
|
|
13384
|
-
const plugin = PluginRegistry.get(
|
|
13467
|
+
const plugin = PluginRegistry.get(key5);
|
|
13385
13468
|
if (plugin?.middleware) {
|
|
13386
13469
|
return ((config) => plugin.middleware(config));
|
|
13387
13470
|
}
|
|
@@ -13390,8 +13473,8 @@ var CustomMiddlewareRegistry = class {
|
|
|
13390
13473
|
/**
|
|
13391
13474
|
* Check whether a factory is registered under the given key.
|
|
13392
13475
|
*/
|
|
13393
|
-
static has(
|
|
13394
|
-
return this.factories.has(
|
|
13476
|
+
static has(key5) {
|
|
13477
|
+
return this.factories.has(key5) || PluginRegistry.has(key5);
|
|
13395
13478
|
}
|
|
13396
13479
|
/**
|
|
13397
13480
|
* Get all currently registered factory keys.
|
|
@@ -13413,21 +13496,21 @@ var ConnectionRegistry = class {
|
|
|
13413
13496
|
this.ensureStore();
|
|
13414
13497
|
return this.store.listByType(tenantId2, type);
|
|
13415
13498
|
}
|
|
13416
|
-
static async get(type,
|
|
13499
|
+
static async get(type, key5, tenantId2) {
|
|
13417
13500
|
this.ensureStore();
|
|
13418
|
-
return this.store.getByKey(tenantId2, type,
|
|
13501
|
+
return this.store.getByKey(tenantId2, type, key5);
|
|
13419
13502
|
}
|
|
13420
13503
|
static async create(entry) {
|
|
13421
13504
|
this.ensureStore();
|
|
13422
13505
|
return this.store.create(entry);
|
|
13423
13506
|
}
|
|
13424
|
-
static async update(tenantId2, type,
|
|
13507
|
+
static async update(tenantId2, type, key5, updates) {
|
|
13425
13508
|
this.ensureStore();
|
|
13426
|
-
return this.store.update(tenantId2, type,
|
|
13509
|
+
return this.store.update(tenantId2, type, key5, updates);
|
|
13427
13510
|
}
|
|
13428
|
-
static async delete(tenantId2, type,
|
|
13511
|
+
static async delete(tenantId2, type, key5) {
|
|
13429
13512
|
this.ensureStore();
|
|
13430
|
-
return this.store.delete(tenantId2, type,
|
|
13513
|
+
return this.store.delete(tenantId2, type, key5);
|
|
13431
13514
|
}
|
|
13432
13515
|
static ensureStore() {
|
|
13433
13516
|
if (!this.store) throw new Error("ConnectionStore not configured");
|
|
@@ -13714,7 +13797,7 @@ async function standardConnectionAllowed(request, capabilityType, config) {
|
|
|
13714
13797
|
(connection2) => connection2.key === resource && connection2.type === capabilityType && connection2.tenantId === tenantId2
|
|
13715
13798
|
);
|
|
13716
13799
|
}
|
|
13717
|
-
if (!Array.isArray(config.connections) || !config.connections.every((
|
|
13800
|
+
if (!Array.isArray(config.connections) || !config.connections.every((key5) => typeof key5 === "string")) {
|
|
13718
13801
|
return false;
|
|
13719
13802
|
}
|
|
13720
13803
|
if (!config.connections.includes(resource)) return false;
|
|
@@ -13914,15 +13997,15 @@ function normalizeLegacyTaskMiddlewareTools(middlewareConfigs) {
|
|
|
13914
13997
|
for (let keyIndex = 0; keyIndex < descriptorKeyCount; keyIndex += 1) {
|
|
13915
13998
|
const keyElement = readOwnArrayElement(descriptorKeys, keyIndex);
|
|
13916
13999
|
if (!keyElement.found) continue;
|
|
13917
|
-
const
|
|
13918
|
-
if (typeof
|
|
13919
|
-
if (
|
|
13920
|
-
const bagEntry = getOwnPropertyDescriptor(descriptors,
|
|
14000
|
+
const key5 = keyElement.value;
|
|
14001
|
+
if (typeof key5 !== "string" && typeof key5 !== "symbol") continue;
|
|
14002
|
+
if (key5 === "allowedTools") continue;
|
|
14003
|
+
const bagEntry = getOwnPropertyDescriptor(descriptors, key5);
|
|
13921
14004
|
const originalDescriptor = readOwnDescriptorField(bagEntry, "value");
|
|
13922
14005
|
if (!originalDescriptor.found || !originalDescriptor.value) continue;
|
|
13923
14006
|
defineProperty(
|
|
13924
14007
|
clone3,
|
|
13925
|
-
|
|
14008
|
+
key5,
|
|
13926
14009
|
sanitizePropertyDescriptor(originalDescriptor.value)
|
|
13927
14010
|
);
|
|
13928
14011
|
}
|
|
@@ -14130,11 +14213,11 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
14130
14213
|
case "custom":
|
|
14131
14214
|
{
|
|
14132
14215
|
const customConfig = config.config;
|
|
14133
|
-
const { key:
|
|
14134
|
-
const factory = CustomMiddlewareRegistry.get(
|
|
14216
|
+
const { key: key5, ...rest } = customConfig;
|
|
14217
|
+
const factory = CustomMiddlewareRegistry.get(key5);
|
|
14135
14218
|
if (factory) {
|
|
14136
14219
|
if (rest.connections?.length && tenantId2) {
|
|
14137
|
-
const resolved = await resolveConnections(
|
|
14220
|
+
const resolved = await resolveConnections(key5, rest.connections, tenantId2);
|
|
14138
14221
|
rest._resolvedConnections = resolved ?? [];
|
|
14139
14222
|
}
|
|
14140
14223
|
const middleware = factory(rest);
|
|
@@ -14144,7 +14227,7 @@ async function createCommonMiddlewares(middlewareConfigs, filesystemBackend, fsI
|
|
|
14144
14227
|
);
|
|
14145
14228
|
} else {
|
|
14146
14229
|
console.warn(
|
|
14147
|
-
`[custom middleware] No factory registered for key "${
|
|
14230
|
+
`[custom middleware] No factory registered for key "${key5}". Use CustomMiddlewareRegistry.register("${key5}", factory) before building the agent.`
|
|
14148
14231
|
);
|
|
14149
14232
|
}
|
|
14150
14233
|
}
|
|
@@ -14530,7 +14613,7 @@ var QueueLatticeManager = class _QueueLatticeManager extends BaseLatticeManager
|
|
|
14530
14613
|
* @param client Optional queue client. If not provided, will create based on config type.
|
|
14531
14614
|
* For REDIS type, client must be provided (use @axiom-lattice/queue-redis).
|
|
14532
14615
|
*/
|
|
14533
|
-
registerLattice(
|
|
14616
|
+
registerLattice(key5, config, client) {
|
|
14534
14617
|
let queueClient;
|
|
14535
14618
|
if (client) {
|
|
14536
14619
|
queueClient = client;
|
|
@@ -14545,7 +14628,7 @@ var QueueLatticeManager = class _QueueLatticeManager extends BaseLatticeManager
|
|
|
14545
14628
|
}
|
|
14546
14629
|
}
|
|
14547
14630
|
const queueLattice = {
|
|
14548
|
-
key:
|
|
14631
|
+
key: key5,
|
|
14549
14632
|
config,
|
|
14550
14633
|
client: queueClient,
|
|
14551
14634
|
push: async (item) => {
|
|
@@ -14558,16 +14641,16 @@ var QueueLatticeManager = class _QueueLatticeManager extends BaseLatticeManager
|
|
|
14558
14641
|
return queueClient.createQueue();
|
|
14559
14642
|
} : void 0
|
|
14560
14643
|
};
|
|
14561
|
-
this.register(
|
|
14644
|
+
this.register(key5, queueLattice);
|
|
14562
14645
|
}
|
|
14563
14646
|
/**
|
|
14564
14647
|
* Get QueueLattice
|
|
14565
14648
|
* @param key Lattice key name
|
|
14566
14649
|
*/
|
|
14567
|
-
getQueueLattice(
|
|
14568
|
-
const queueLattice = this.get(
|
|
14650
|
+
getQueueLattice(key5) {
|
|
14651
|
+
const queueLattice = this.get(key5);
|
|
14569
14652
|
if (!queueLattice) {
|
|
14570
|
-
throw new Error(`QueueLattice ${
|
|
14653
|
+
throw new Error(`QueueLattice ${key5} not found`);
|
|
14571
14654
|
}
|
|
14572
14655
|
return queueLattice;
|
|
14573
14656
|
}
|
|
@@ -14581,15 +14664,15 @@ var QueueLatticeManager = class _QueueLatticeManager extends BaseLatticeManager
|
|
|
14581
14664
|
* Check if Lattice exists
|
|
14582
14665
|
* @param key Lattice key name
|
|
14583
14666
|
*/
|
|
14584
|
-
hasLattice(
|
|
14585
|
-
return this.has(
|
|
14667
|
+
hasLattice(key5) {
|
|
14668
|
+
return this.has(key5);
|
|
14586
14669
|
}
|
|
14587
14670
|
/**
|
|
14588
14671
|
* Remove Lattice
|
|
14589
14672
|
* @param key Lattice key name
|
|
14590
14673
|
*/
|
|
14591
|
-
removeLattice(
|
|
14592
|
-
return this.remove(
|
|
14674
|
+
removeLattice(key5) {
|
|
14675
|
+
return this.remove(key5);
|
|
14593
14676
|
}
|
|
14594
14677
|
/**
|
|
14595
14678
|
* Clear all Lattices
|
|
@@ -14611,8 +14694,8 @@ var QueueLatticeManager = class _QueueLatticeManager extends BaseLatticeManager
|
|
|
14611
14694
|
}
|
|
14612
14695
|
};
|
|
14613
14696
|
var queueLatticeManager = QueueLatticeManager.getInstance();
|
|
14614
|
-
var registerQueueLattice = (
|
|
14615
|
-
var getQueueLattice = (
|
|
14697
|
+
var registerQueueLattice = (key5, config, client) => queueLatticeManager.registerLattice(key5, config, client);
|
|
14698
|
+
var getQueueLattice = (key5) => queueLatticeManager.getQueueLattice(key5);
|
|
14616
14699
|
|
|
14617
14700
|
// src/services/event_bus.ts
|
|
14618
14701
|
var EventBus = class {
|
|
@@ -15138,9 +15221,9 @@ var ChunkBufferLatticeManager = class _ChunkBufferLatticeManager extends BaseLat
|
|
|
15138
15221
|
return "chunk_buffer";
|
|
15139
15222
|
}
|
|
15140
15223
|
};
|
|
15141
|
-
var getChunkBuffer = (
|
|
15142
|
-
var registerChunkBuffer = (
|
|
15143
|
-
var hasChunkBuffer = (
|
|
15224
|
+
var getChunkBuffer = (key5) => ChunkBufferLatticeManager.getInstance().get(key5);
|
|
15225
|
+
var registerChunkBuffer = (key5, buffer2) => ChunkBufferLatticeManager.getInstance().register(key5, buffer2);
|
|
15226
|
+
var hasChunkBuffer = (key5) => ChunkBufferLatticeManager.getInstance().has(key5);
|
|
15144
15227
|
var buffer = new InMemoryChunkBuffer({
|
|
15145
15228
|
ttl: 60 * 60 * 1e3,
|
|
15146
15229
|
// 1 hour TTL
|
|
@@ -15191,8 +15274,8 @@ var COMPOUND_CREDENTIAL_SUFFIXES = [
|
|
|
15191
15274
|
"dbpassword",
|
|
15192
15275
|
"clientsecret"
|
|
15193
15276
|
];
|
|
15194
|
-
function isCredentialBearingKey(
|
|
15195
|
-
const normalizedKey =
|
|
15277
|
+
function isCredentialBearingKey(key5) {
|
|
15278
|
+
const normalizedKey = key5.replace(/[^a-zA-Z0-9]/g, "").toLowerCase();
|
|
15196
15279
|
if (normalizedKey.endsWith("credentialid") || normalizedKey.endsWith("credentialreference")) {
|
|
15197
15280
|
return false;
|
|
15198
15281
|
}
|
|
@@ -15283,21 +15366,21 @@ function validateConfigValue(value, path8, capabilityType, activeAncestors, stat
|
|
|
15283
15366
|
return;
|
|
15284
15367
|
}
|
|
15285
15368
|
try {
|
|
15286
|
-
for (const [
|
|
15287
|
-
const nextPath = pointer(path8,
|
|
15288
|
-
if (UNSAFE_KEYS.has(
|
|
15369
|
+
for (const [key5, entry] of Object.entries(value)) {
|
|
15370
|
+
const nextPath = pointer(path8, key5);
|
|
15371
|
+
if (UNSAFE_KEYS.has(key5)) {
|
|
15289
15372
|
throw new CapabilityBundleValidationError("CAPABILITY_BUNDLE_UNSAFE_KEY", `Unsafe key at ${nextPath}`, {
|
|
15290
15373
|
capabilityType,
|
|
15291
15374
|
fieldPath: nextPath
|
|
15292
15375
|
});
|
|
15293
15376
|
}
|
|
15294
|
-
if (BUNDLE_REFERENCE_KEYS.has(
|
|
15377
|
+
if (BUNDLE_REFERENCE_KEYS.has(key5)) {
|
|
15295
15378
|
throw new CapabilityBundleValidationError("CAPABILITY_BUNDLE_NESTED_REFERENCE", `Nested bundle reference at ${nextPath}`, {
|
|
15296
15379
|
capabilityType,
|
|
15297
15380
|
fieldPath: nextPath
|
|
15298
15381
|
});
|
|
15299
15382
|
}
|
|
15300
|
-
if (isCredentialBearingKey(
|
|
15383
|
+
if (isCredentialBearingKey(key5)) {
|
|
15301
15384
|
throw new CapabilityBundleValidationError(
|
|
15302
15385
|
"CAPABILITY_BUNDLE_CREDENTIALS_FORBIDDEN",
|
|
15303
15386
|
`Credential-like field is forbidden at ${nextPath}`,
|
|
@@ -15358,33 +15441,33 @@ function validateSchemaTypes(value, schema6, path8, capabilityType, isTopLevelCo
|
|
|
15358
15441
|
if (type === "object" && typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
15359
15442
|
const properties = schema6.properties && typeof schema6.properties === "object" ? schema6.properties : {};
|
|
15360
15443
|
if (Array.isArray(schema6.required)) {
|
|
15361
|
-
for (const
|
|
15362
|
-
if (typeof
|
|
15363
|
-
throw new CapabilityBundleValidationError("CAPABILITY_BUNDLE_INVALID_CONFIG", `Required config value is missing at ${pointer(path8,
|
|
15444
|
+
for (const key5 of schema6.required) {
|
|
15445
|
+
if (typeof key5 === "string" && !Object.prototype.hasOwnProperty.call(value, key5)) {
|
|
15446
|
+
throw new CapabilityBundleValidationError("CAPABILITY_BUNDLE_INVALID_CONFIG", `Required config value is missing at ${pointer(path8, key5)}`, {
|
|
15364
15447
|
capabilityType,
|
|
15365
|
-
fieldPath: pointer(path8,
|
|
15448
|
+
fieldPath: pointer(path8, key5)
|
|
15366
15449
|
});
|
|
15367
15450
|
}
|
|
15368
15451
|
}
|
|
15369
15452
|
}
|
|
15370
15453
|
if (schema6.additionalProperties === false) {
|
|
15371
|
-
for (const
|
|
15372
|
-
if (!Object.prototype.hasOwnProperty.call(properties,
|
|
15373
|
-
throw new CapabilityBundleValidationError("CAPABILITY_BUNDLE_INVALID_CONFIG", `Unknown config value at ${pointer(path8,
|
|
15454
|
+
for (const key5 of Object.keys(value)) {
|
|
15455
|
+
if (!Object.prototype.hasOwnProperty.call(properties, key5) && (!isTopLevelConfig || !Object.prototype.hasOwnProperty.call(STANDARD_CONFIG_TYPES, key5))) {
|
|
15456
|
+
throw new CapabilityBundleValidationError("CAPABILITY_BUNDLE_INVALID_CONFIG", `Unknown config value at ${pointer(path8, key5)}`, {
|
|
15374
15457
|
capabilityType,
|
|
15375
|
-
fieldPath: pointer(path8,
|
|
15458
|
+
fieldPath: pointer(path8, key5)
|
|
15376
15459
|
});
|
|
15377
15460
|
}
|
|
15378
15461
|
}
|
|
15379
15462
|
}
|
|
15380
15463
|
}
|
|
15381
15464
|
if (type === "object" && schema6.properties && typeof schema6.properties === "object" && typeof value === "object" && value !== null) {
|
|
15382
|
-
for (const [
|
|
15383
|
-
if (Object.prototype.hasOwnProperty.call(value,
|
|
15465
|
+
for (const [key5, childSchema] of Object.entries(schema6.properties)) {
|
|
15466
|
+
if (Object.prototype.hasOwnProperty.call(value, key5)) {
|
|
15384
15467
|
validateSchemaTypes(
|
|
15385
|
-
value[
|
|
15468
|
+
value[key5],
|
|
15386
15469
|
childSchema,
|
|
15387
|
-
pointer(path8,
|
|
15470
|
+
pointer(path8, key5),
|
|
15388
15471
|
capabilityType,
|
|
15389
15472
|
false
|
|
15390
15473
|
);
|
|
@@ -15400,11 +15483,11 @@ function validateKnownConfigTypes(config, capabilityType, path8) {
|
|
|
15400
15483
|
...LEGACY_PLUGIN_CONNECTION_FIELDS[capabilityType].allowAllField ? { [LEGACY_PLUGIN_CONNECTION_FIELDS[capabilityType].allowAllField]: "boolean" } : {}
|
|
15401
15484
|
} : {}
|
|
15402
15485
|
};
|
|
15403
|
-
for (const [
|
|
15404
|
-
const value = config[
|
|
15486
|
+
for (const [key5, expected] of Object.entries(expectedTypes)) {
|
|
15487
|
+
const value = config[key5];
|
|
15405
15488
|
const invalid = expected === "array" ? !Array.isArray(value) || value.some((entry) => typeof entry !== "string") : typeof value !== expected;
|
|
15406
|
-
if (Object.prototype.hasOwnProperty.call(config,
|
|
15407
|
-
const fieldPath = pointer(path8,
|
|
15489
|
+
if (Object.prototype.hasOwnProperty.call(config, key5) && invalid) {
|
|
15490
|
+
const fieldPath = pointer(path8, key5);
|
|
15408
15491
|
throw new CapabilityBundleValidationError(
|
|
15409
15492
|
"CAPABILITY_BUNDLE_INVALID_CONFIG",
|
|
15410
15493
|
`Config value at ${fieldPath} does not match plugin schema`,
|
|
@@ -15432,19 +15515,19 @@ function validateCapability(value, index) {
|
|
|
15432
15515
|
fieldPath: `/capabilities/${index}/type`
|
|
15433
15516
|
});
|
|
15434
15517
|
}
|
|
15435
|
-
for (const
|
|
15436
|
-
if (isCredentialBearingKey(
|
|
15518
|
+
for (const key5 of Object.keys(capability)) {
|
|
15519
|
+
if (isCredentialBearingKey(key5)) {
|
|
15437
15520
|
throw new CapabilityBundleValidationError(
|
|
15438
15521
|
"CAPABILITY_BUNDLE_CREDENTIALS_FORBIDDEN",
|
|
15439
|
-
`Credential-like field is forbidden at /capabilities/${index}/${
|
|
15440
|
-
{ capabilityType, fieldPath: `/capabilities/${index}/${
|
|
15522
|
+
`Credential-like field is forbidden at /capabilities/${index}/${key5}`,
|
|
15523
|
+
{ capabilityType, fieldPath: `/capabilities/${index}/${key5}` }
|
|
15441
15524
|
);
|
|
15442
15525
|
}
|
|
15443
|
-
if (!CAPABILITY_FIELDS.has(
|
|
15526
|
+
if (!CAPABILITY_FIELDS.has(key5)) {
|
|
15444
15527
|
throw new CapabilityBundleValidationError(
|
|
15445
15528
|
"CAPABILITY_BUNDLE_INVALID_CAPABILITY",
|
|
15446
|
-
`Unknown capability field at /capabilities/${index}/${
|
|
15447
|
-
{ capabilityType, fieldPath: `/capabilities/${index}/${
|
|
15529
|
+
`Unknown capability field at /capabilities/${index}/${key5}`,
|
|
15530
|
+
{ capabilityType, fieldPath: `/capabilities/${index}/${key5}` }
|
|
15448
15531
|
);
|
|
15449
15532
|
}
|
|
15450
15533
|
}
|
|
@@ -15583,7 +15666,7 @@ var CapabilityBundleMergeError = class extends Error {
|
|
|
15583
15666
|
function canonicalize(value) {
|
|
15584
15667
|
if (Array.isArray(value)) return value.map(canonicalize);
|
|
15585
15668
|
if (typeof value === "object" && value !== null) {
|
|
15586
|
-
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([
|
|
15669
|
+
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key5, entry]) => [key5, canonicalize(entry)]));
|
|
15587
15670
|
}
|
|
15588
15671
|
return value;
|
|
15589
15672
|
}
|
|
@@ -15597,8 +15680,8 @@ function createCapabilityRevision(bundles, effectivePolicy) {
|
|
|
15597
15680
|
var LEGACY_UNION_CONFIG_FIELDS = new Set(
|
|
15598
15681
|
Object.values(LEGACY_PLUGIN_CONNECTION_FIELDS).map(({ selectorField }) => selectorField)
|
|
15599
15682
|
);
|
|
15600
|
-
function isStandardConfigField(
|
|
15601
|
-
return
|
|
15683
|
+
function isStandardConfigField(key5) {
|
|
15684
|
+
return key5 === "connections";
|
|
15602
15685
|
}
|
|
15603
15686
|
var OR_CONFIG_FIELDS = /* @__PURE__ */ new Set(["connectAll", "readAll"]);
|
|
15604
15687
|
var UNSAFE_CONFIG_KEYS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
@@ -15612,8 +15695,8 @@ function cloneValue(value) {
|
|
|
15612
15695
|
}
|
|
15613
15696
|
if (typeof value === "object" && value !== null) {
|
|
15614
15697
|
const clone3 = {};
|
|
15615
|
-
for (const [
|
|
15616
|
-
clone3[
|
|
15698
|
+
for (const [key5, entry] of Object.entries(value)) {
|
|
15699
|
+
clone3[key5] = cloneValue(entry);
|
|
15617
15700
|
}
|
|
15618
15701
|
return clone3;
|
|
15619
15702
|
}
|
|
@@ -15639,10 +15722,10 @@ function validateValue(value, bundleId, capabilityType, displayPath, fieldPath,
|
|
|
15639
15722
|
return;
|
|
15640
15723
|
}
|
|
15641
15724
|
if (typeof value === "object") {
|
|
15642
|
-
for (const [
|
|
15643
|
-
const nextDisplayPath = `${displayPath}.${
|
|
15644
|
-
const nextFieldPath = appendPointer(fieldPath,
|
|
15645
|
-
if (rejectUnsafeKeys && UNSAFE_CONFIG_KEYS.has(
|
|
15725
|
+
for (const [key5, entry] of Object.entries(value)) {
|
|
15726
|
+
const nextDisplayPath = `${displayPath}.${key5}`;
|
|
15727
|
+
const nextFieldPath = appendPointer(fieldPath, key5);
|
|
15728
|
+
if (rejectUnsafeKeys && UNSAFE_CONFIG_KEYS.has(key5)) {
|
|
15646
15729
|
throw new CapabilityBundleMergeError(
|
|
15647
15730
|
"CAPABILITY_BUNDLE_UNSAFE_KEY",
|
|
15648
15731
|
`Capability bundle '${bundleId}' contains unsafe key at ${nextDisplayPath}`,
|
|
@@ -15701,21 +15784,21 @@ function mergeUnion(current, next, sources, capabilityType, fieldPath, bundleId)
|
|
|
15701
15784
|
return result;
|
|
15702
15785
|
}
|
|
15703
15786
|
function mergeObject(target, incoming, sources, overrides, capabilityType, bundleId, path8) {
|
|
15704
|
-
for (const [
|
|
15787
|
+
for (const [key5, next] of Object.entries(incoming)) {
|
|
15705
15788
|
if (next === void 0) continue;
|
|
15706
|
-
const fieldPath = appendPointer(path8,
|
|
15707
|
-
const current = target[
|
|
15708
|
-
if (path8 === "/config" && (isStandardConfigField(
|
|
15709
|
-
target[
|
|
15789
|
+
const fieldPath = appendPointer(path8, key5);
|
|
15790
|
+
const current = target[key5];
|
|
15791
|
+
if (path8 === "/config" && (isStandardConfigField(key5) || LEGACY_UNION_CONFIG_FIELDS.has(key5)) && Array.isArray(next)) {
|
|
15792
|
+
target[key5] = mergeUnion(current, next, sources, capabilityType, fieldPath, bundleId);
|
|
15710
15793
|
continue;
|
|
15711
15794
|
}
|
|
15712
|
-
if (path8 === "/config" && OR_CONFIG_FIELDS.has(
|
|
15795
|
+
if (path8 === "/config" && OR_CONFIG_FIELDS.has(key5) && typeof next === "boolean") {
|
|
15713
15796
|
if (next && current !== true) {
|
|
15714
15797
|
setOrdinarySource(sources, capabilityType, fieldPath, bundleId, true);
|
|
15715
15798
|
} else if (current === void 0) {
|
|
15716
15799
|
setOrdinarySource(sources, capabilityType, fieldPath, bundleId, false);
|
|
15717
15800
|
}
|
|
15718
|
-
target[
|
|
15801
|
+
target[key5] = current === true || next;
|
|
15719
15802
|
continue;
|
|
15720
15803
|
}
|
|
15721
15804
|
if (typeof next === "object" && next !== null && !Array.isArray(next)) {
|
|
@@ -15731,10 +15814,10 @@ function mergeObject(target, incoming, sources, overrides, capabilityType, bundl
|
|
|
15731
15814
|
}
|
|
15732
15815
|
if (!currentIsObject) {
|
|
15733
15816
|
removeOrdinarySource(sources, capabilityType, fieldPath);
|
|
15734
|
-
target[
|
|
15817
|
+
target[key5] = {};
|
|
15735
15818
|
}
|
|
15736
15819
|
mergeObject(
|
|
15737
|
-
target[
|
|
15820
|
+
target[key5],
|
|
15738
15821
|
next,
|
|
15739
15822
|
sources,
|
|
15740
15823
|
overrides,
|
|
@@ -15753,7 +15836,7 @@ function mergeObject(target, incoming, sources, overrides, capabilityType, bundl
|
|
|
15753
15836
|
sourceBundleId: bundleId
|
|
15754
15837
|
});
|
|
15755
15838
|
}
|
|
15756
|
-
target[
|
|
15839
|
+
target[key5] = cloneValue(next);
|
|
15757
15840
|
setOrdinarySource(sources, capabilityType, fieldPath, bundleId, next);
|
|
15758
15841
|
}
|
|
15759
15842
|
}
|
|
@@ -16171,8 +16254,8 @@ var CallerRunConfigValidationError = class extends Error {
|
|
|
16171
16254
|
this.name = "CallerRunConfigValidationError";
|
|
16172
16255
|
}
|
|
16173
16256
|
};
|
|
16174
|
-
function callerRunConfigPath(path8,
|
|
16175
|
-
return `${path8}/${
|
|
16257
|
+
function callerRunConfigPath(path8, key5) {
|
|
16258
|
+
return `${path8}/${key5.replace(/~/g, "~0").replace(/\//g, "~1")}`;
|
|
16176
16259
|
}
|
|
16177
16260
|
function cloneRunConfig(value, stripReserved) {
|
|
16178
16261
|
if (value === void 0 || value === null || typeof value !== "object") return {};
|
|
@@ -16212,26 +16295,26 @@ function cloneRunConfig(value, stripReserved) {
|
|
|
16212
16295
|
}
|
|
16213
16296
|
const clone4 = [];
|
|
16214
16297
|
for (let index = 0; index < length; index += 1) {
|
|
16215
|
-
const
|
|
16216
|
-
const data = (0, import_protocols9.descriptorDataValue)(descriptors[
|
|
16298
|
+
const key5 = String(index);
|
|
16299
|
+
const data = (0, import_protocols9.descriptorDataValue)(descriptors[key5]);
|
|
16217
16300
|
if (!data || data.value === void 0) {
|
|
16218
|
-
throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${path8}/${
|
|
16301
|
+
throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${path8}/${key5}`);
|
|
16219
16302
|
}
|
|
16220
|
-
clone4.push(cloneAndStrip(data.value, `${path8}/${
|
|
16303
|
+
clone4.push(cloneAndStrip(data.value, `${path8}/${key5}`, true));
|
|
16221
16304
|
}
|
|
16222
|
-
if (keys.some((
|
|
16305
|
+
if (keys.some((key5) => typeof key5 !== "string" || key5 !== "length" && !/^(0|[1-9]\d*)$/.test(key5))) {
|
|
16223
16306
|
throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${path8}`);
|
|
16224
16307
|
}
|
|
16225
16308
|
return clone4;
|
|
16226
16309
|
}
|
|
16227
16310
|
const clone3 = /* @__PURE__ */ Object.create(null);
|
|
16228
|
-
for (const
|
|
16229
|
-
if (typeof
|
|
16230
|
-
const fieldPath = callerRunConfigPath(path8,
|
|
16231
|
-
const data = (0, import_protocols9.descriptorDataValue)(descriptors[
|
|
16311
|
+
for (const key5 of keys) {
|
|
16312
|
+
if (typeof key5 !== "string") continue;
|
|
16313
|
+
const fieldPath = callerRunConfigPath(path8, key5);
|
|
16314
|
+
const data = (0, import_protocols9.descriptorDataValue)(descriptors[key5]);
|
|
16232
16315
|
if (!data) throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${fieldPath}`);
|
|
16233
|
-
if (stripReserved && RESERVED_CALLER_RUN_KEYS.has(
|
|
16234
|
-
Object.defineProperty(clone3,
|
|
16316
|
+
if (stripReserved && RESERVED_CALLER_RUN_KEYS.has(key5) || data.value === void 0) continue;
|
|
16317
|
+
Object.defineProperty(clone3, key5, {
|
|
16235
16318
|
value: cloneAndStrip(data.value, fieldPath),
|
|
16236
16319
|
enumerable: true,
|
|
16237
16320
|
configurable: true,
|
|
@@ -16277,15 +16360,15 @@ function sanitizeCallerRunConfig(value, preserveDelegatedContext = true) {
|
|
|
16277
16360
|
} catch {
|
|
16278
16361
|
throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${path8}`);
|
|
16279
16362
|
}
|
|
16280
|
-
for (const
|
|
16281
|
-
if (typeof
|
|
16363
|
+
for (const key5 of Reflect.ownKeys(descriptors)) {
|
|
16364
|
+
if (typeof key5 !== "string") {
|
|
16282
16365
|
throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${path8}`);
|
|
16283
16366
|
}
|
|
16284
|
-
const fieldPath = callerRunConfigPath(path8,
|
|
16285
|
-
const descriptor = descriptors[
|
|
16367
|
+
const fieldPath = callerRunConfigPath(path8, key5);
|
|
16368
|
+
const descriptor = descriptors[key5];
|
|
16286
16369
|
const data = (0, import_protocols9.descriptorDataValue)(descriptor);
|
|
16287
16370
|
if (!data) throw new CallerRunConfigValidationError(`Unsupported caller run config value at ${fieldPath}`);
|
|
16288
|
-
if (isCredentialBearingKey(
|
|
16371
|
+
if (isCredentialBearingKey(key5)) {
|
|
16289
16372
|
throw new CapabilityRuntimeResolutionError(
|
|
16290
16373
|
"CAPABILITY_BUNDLE_CREDENTIALS_FORBIDDEN",
|
|
16291
16374
|
`Credential-like caller field is forbidden at ${fieldPath}`,
|
|
@@ -16313,16 +16396,16 @@ function cloneExecutionRunConfigBase(value) {
|
|
|
16313
16396
|
try {
|
|
16314
16397
|
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
16315
16398
|
const clone3 = /* @__PURE__ */ Object.create(null);
|
|
16316
|
-
for (const
|
|
16317
|
-
if (typeof
|
|
16399
|
+
for (const key5 of Reflect.ownKeys(descriptors)) {
|
|
16400
|
+
if (typeof key5 !== "string" && key5 !== DELEGATED_WORKER_SCOPE_TOKEN) {
|
|
16318
16401
|
throw new CallerRunConfigValidationError("Unsupported caller run config value at /run_config");
|
|
16319
16402
|
}
|
|
16320
|
-
const descriptor = descriptors[
|
|
16403
|
+
const descriptor = descriptors[key5];
|
|
16321
16404
|
const data = (0, import_protocols9.descriptorDataValue)(descriptor);
|
|
16322
16405
|
if (!data) {
|
|
16323
16406
|
throw new CallerRunConfigValidationError("Unsupported caller run config value at /run_config");
|
|
16324
16407
|
}
|
|
16325
|
-
Object.defineProperty(clone3,
|
|
16408
|
+
Object.defineProperty(clone3, key5, {
|
|
16326
16409
|
value: data.value,
|
|
16327
16410
|
enumerable: true,
|
|
16328
16411
|
configurable: true,
|
|
@@ -16401,10 +16484,10 @@ var DelegatedScopeNotQueueableError = class extends Error {
|
|
|
16401
16484
|
this.name = "DelegatedScopeNotQueueableError";
|
|
16402
16485
|
}
|
|
16403
16486
|
};
|
|
16404
|
-
function ownDataValue(value,
|
|
16487
|
+
function ownDataValue(value, key5) {
|
|
16405
16488
|
if (typeof value !== "object" || value === null) return void 0;
|
|
16406
16489
|
try {
|
|
16407
|
-
return (0, import_protocols9.descriptorDataValue)(Object.getOwnPropertyDescriptor(value,
|
|
16490
|
+
return (0, import_protocols9.descriptorDataValue)(Object.getOwnPropertyDescriptor(value, key5))?.value;
|
|
16408
16491
|
} catch {
|
|
16409
16492
|
return void 0;
|
|
16410
16493
|
}
|
|
@@ -16420,7 +16503,7 @@ var QUEUE_PROCESSOR_RETRY_BASE_MS = 100;
|
|
|
16420
16503
|
var QUEUE_PROCESSOR_MAX_RETRIES = 3;
|
|
16421
16504
|
function hasExactKeys(record, required, optional = []) {
|
|
16422
16505
|
const allowed = /* @__PURE__ */ new Set([...required, ...optional]);
|
|
16423
|
-
return required.every((
|
|
16506
|
+
return required.every((key5) => Object.prototype.hasOwnProperty.call(record, key5)) && Reflect.ownKeys(record).every((key5) => typeof key5 === "string" && allowed.has(key5));
|
|
16424
16507
|
}
|
|
16425
16508
|
var Agent = class {
|
|
16426
16509
|
/**
|
|
@@ -18012,29 +18095,29 @@ var AgentInstanceManager = class _AgentInstanceManager {
|
|
|
18012
18095
|
* Ensures only one instance per thread exists
|
|
18013
18096
|
*/
|
|
18014
18097
|
getAgent(params) {
|
|
18015
|
-
const
|
|
18016
|
-
if (!this.agents.has(
|
|
18098
|
+
const key5 = this.getKey(params);
|
|
18099
|
+
if (!this.agents.has(key5)) {
|
|
18017
18100
|
const agent = new Agent(params);
|
|
18018
|
-
this.agents.set(
|
|
18101
|
+
this.agents.set(key5, agent);
|
|
18019
18102
|
}
|
|
18020
|
-
return this.agents.get(
|
|
18103
|
+
return this.agents.get(key5);
|
|
18021
18104
|
}
|
|
18022
18105
|
/**
|
|
18023
18106
|
* Check if an agent instance exists for the thread
|
|
18024
18107
|
*/
|
|
18025
18108
|
hasAgent(params) {
|
|
18026
|
-
const
|
|
18027
|
-
return this.agents.has(
|
|
18109
|
+
const key5 = this.getKey(params);
|
|
18110
|
+
return this.agents.has(key5);
|
|
18028
18111
|
}
|
|
18029
18112
|
/**
|
|
18030
18113
|
* Remove agent instance (for cleanup)
|
|
18031
18114
|
*/
|
|
18032
18115
|
removeAgent(params) {
|
|
18033
|
-
const
|
|
18034
|
-
const agent = this.agents.get(
|
|
18116
|
+
const key5 = this.getKey(params);
|
|
18117
|
+
const agent = this.agents.get(key5);
|
|
18035
18118
|
if (agent) {
|
|
18036
18119
|
agent.stopQueueProcessor();
|
|
18037
|
-
this.agents.delete(
|
|
18120
|
+
this.agents.delete(key5);
|
|
18038
18121
|
return true;
|
|
18039
18122
|
}
|
|
18040
18123
|
return false;
|
|
@@ -18252,9 +18335,9 @@ When NOT to use the task tool:
|
|
|
18252
18335
|
- You should use the \`task\` tool whenever you have a complex task that will take multiple steps, and is independent from other tasks that the agent needs to complete. These agents are highly competent and efficient.`;
|
|
18253
18336
|
function filterStateForSubagent(state) {
|
|
18254
18337
|
const filtered = {};
|
|
18255
|
-
for (const [
|
|
18256
|
-
if (!EXCLUDED_STATE_KEYS.includes(
|
|
18257
|
-
filtered[
|
|
18338
|
+
for (const [key5, value] of Object.entries(state)) {
|
|
18339
|
+
if (!EXCLUDED_STATE_KEYS.includes(key5)) {
|
|
18340
|
+
filtered[key5] = value;
|
|
18258
18341
|
}
|
|
18259
18342
|
}
|
|
18260
18343
|
return filtered;
|
|
@@ -19756,7 +19839,7 @@ var ScheduleLatticeManager = class _ScheduleLatticeManager extends BaseLatticeMa
|
|
|
19756
19839
|
* @param config Schedule configuration
|
|
19757
19840
|
* @param client Optional schedule client. If not provided, will create based on config type.
|
|
19758
19841
|
*/
|
|
19759
|
-
registerLattice(
|
|
19842
|
+
registerLattice(key5, config, client) {
|
|
19760
19843
|
let scheduleClient;
|
|
19761
19844
|
if (client) {
|
|
19762
19845
|
scheduleClient = client;
|
|
@@ -19784,7 +19867,7 @@ var ScheduleLatticeManager = class _ScheduleLatticeManager extends BaseLatticeMa
|
|
|
19784
19867
|
}
|
|
19785
19868
|
}
|
|
19786
19869
|
const scheduleLattice = {
|
|
19787
|
-
key:
|
|
19870
|
+
key: key5,
|
|
19788
19871
|
config,
|
|
19789
19872
|
client: scheduleClient,
|
|
19790
19873
|
// Handler registration
|
|
@@ -19841,16 +19924,16 @@ var ScheduleLatticeManager = class _ScheduleLatticeManager extends BaseLatticeMa
|
|
|
19841
19924
|
return scheduleClient.restore();
|
|
19842
19925
|
}
|
|
19843
19926
|
};
|
|
19844
|
-
this.register(
|
|
19927
|
+
this.register(key5, scheduleLattice);
|
|
19845
19928
|
}
|
|
19846
19929
|
/**
|
|
19847
19930
|
* Get ScheduleLattice
|
|
19848
19931
|
* @param key Lattice key name
|
|
19849
19932
|
*/
|
|
19850
|
-
getScheduleLattice(
|
|
19851
|
-
const scheduleLattice = this.get(
|
|
19933
|
+
getScheduleLattice(key5) {
|
|
19934
|
+
const scheduleLattice = this.get(key5);
|
|
19852
19935
|
if (!scheduleLattice) {
|
|
19853
|
-
throw new Error(`ScheduleLattice ${
|
|
19936
|
+
throw new Error(`ScheduleLattice ${key5} not found`);
|
|
19854
19937
|
}
|
|
19855
19938
|
return scheduleLattice;
|
|
19856
19939
|
}
|
|
@@ -19864,15 +19947,15 @@ var ScheduleLatticeManager = class _ScheduleLatticeManager extends BaseLatticeMa
|
|
|
19864
19947
|
* Check if Lattice exists
|
|
19865
19948
|
* @param key Lattice key name
|
|
19866
19949
|
*/
|
|
19867
|
-
hasLattice(
|
|
19868
|
-
return this.has(
|
|
19950
|
+
hasLattice(key5) {
|
|
19951
|
+
return this.has(key5);
|
|
19869
19952
|
}
|
|
19870
19953
|
/**
|
|
19871
19954
|
* Remove Lattice
|
|
19872
19955
|
* @param key Lattice key name
|
|
19873
19956
|
*/
|
|
19874
|
-
removeLattice(
|
|
19875
|
-
return this.remove(
|
|
19957
|
+
removeLattice(key5) {
|
|
19958
|
+
return this.remove(key5);
|
|
19876
19959
|
}
|
|
19877
19960
|
/**
|
|
19878
19961
|
* Clear all Lattices
|
|
@@ -19894,8 +19977,8 @@ var ScheduleLatticeManager = class _ScheduleLatticeManager extends BaseLatticeMa
|
|
|
19894
19977
|
}
|
|
19895
19978
|
};
|
|
19896
19979
|
var scheduleLatticeManager = ScheduleLatticeManager.getInstance();
|
|
19897
|
-
var registerScheduleLattice = (
|
|
19898
|
-
var getScheduleLattice = (
|
|
19980
|
+
var registerScheduleLattice = (key5, config, client) => scheduleLatticeManager.registerLattice(key5, config, client);
|
|
19981
|
+
var getScheduleLattice = (key5) => scheduleLatticeManager.getScheduleLattice(key5);
|
|
19899
19982
|
|
|
19900
19983
|
// src/deep_agent_new/middleware/scheduler.ts
|
|
19901
19984
|
var SCHEDULE_LATTICE_KEY = "default";
|
|
@@ -20489,9 +20572,9 @@ var FilesystemBackend = class {
|
|
|
20489
20572
|
* @returns Resolved absolute path string
|
|
20490
20573
|
* @throws Error if path traversal detected or path outside root
|
|
20491
20574
|
*/
|
|
20492
|
-
resolvePath(
|
|
20575
|
+
resolvePath(key5) {
|
|
20493
20576
|
if (this.virtualMode) {
|
|
20494
|
-
let normalizedKey =
|
|
20577
|
+
let normalizedKey = key5;
|
|
20495
20578
|
if (normalizedKey === "~" || normalizedKey === "~/") {
|
|
20496
20579
|
normalizedKey = "/";
|
|
20497
20580
|
} else if (normalizedKey.startsWith("~/")) {
|
|
@@ -20508,7 +20591,7 @@ var FilesystemBackend = class {
|
|
|
20508
20591
|
}
|
|
20509
20592
|
return full;
|
|
20510
20593
|
}
|
|
20511
|
-
let target =
|
|
20594
|
+
let target = key5;
|
|
20512
20595
|
if (target.startsWith("~/")) {
|
|
20513
20596
|
target = `/${target.slice(2)}`;
|
|
20514
20597
|
}
|
|
@@ -21088,15 +21171,15 @@ var CompositeBackend = class {
|
|
|
21088
21171
|
* @returns Tuple of [backend, stripped_key] where stripped_key has the route
|
|
21089
21172
|
* prefix removed (but keeps leading slash).
|
|
21090
21173
|
*/
|
|
21091
|
-
getBackendAndKey(
|
|
21174
|
+
getBackendAndKey(key5) {
|
|
21092
21175
|
for (const [prefix, backend] of this.sortedRoutes) {
|
|
21093
|
-
if (
|
|
21094
|
-
const suffix =
|
|
21176
|
+
if (key5.startsWith(prefix)) {
|
|
21177
|
+
const suffix = key5.substring(prefix.length);
|
|
21095
21178
|
const strippedKey = suffix ? "/" + suffix : "/";
|
|
21096
21179
|
return [backend, strippedKey];
|
|
21097
21180
|
}
|
|
21098
21181
|
}
|
|
21099
|
-
return [this.default,
|
|
21182
|
+
return [this.default, key5];
|
|
21100
21183
|
}
|
|
21101
21184
|
/**
|
|
21102
21185
|
* List files and directories in the specified directory (non-recursive).
|
|
@@ -23648,9 +23731,9 @@ var _A2ARemoteClient = class _A2ARemoteClient {
|
|
|
23648
23731
|
else terminalText = t;
|
|
23649
23732
|
},
|
|
23650
23733
|
onArtifact: (artifact, append) => {
|
|
23651
|
-
const
|
|
23652
|
-
const previous = artifacts.get(
|
|
23653
|
-
artifacts.set(
|
|
23734
|
+
const key5 = artifact.artifactId || artifact.name || `artifact-${artifactSequence}`;
|
|
23735
|
+
const previous = artifacts.get(key5);
|
|
23736
|
+
artifacts.set(key5, {
|
|
23654
23737
|
name: artifact.name,
|
|
23655
23738
|
text: append && previous ? previous.text + artifact.text : artifact.text,
|
|
23656
23739
|
sequence: artifactSequence++
|
|
@@ -23889,9 +23972,9 @@ var WorkflowAgentGraphBuilder = class {
|
|
|
23889
23972
|
}
|
|
23890
23973
|
const isAsk = stepType === "ask";
|
|
23891
23974
|
if (responseFormat) {
|
|
23892
|
-
const
|
|
23893
|
-
console.log(`[WF BUILDER] resolveAgent: cacheKey=${
|
|
23894
|
-
if (!agentCache.has(
|
|
23975
|
+
const key5 = (isAsk ? "ask:" : "agent:") + JSON.stringify(responseFormat);
|
|
23976
|
+
console.log(`[WF BUILDER] resolveAgent: cacheKey=${key5.slice(0, 80)}... | cached=${agentCache.has(key5)}`);
|
|
23977
|
+
if (!agentCache.has(key5)) {
|
|
23895
23978
|
console.log(`[WF BUILDER] creating ${isAsk ? "ask" : "agent"} with responseFormat`);
|
|
23896
23979
|
const agent = (0, import_langchain59.createAgent)({
|
|
23897
23980
|
model: params.model,
|
|
@@ -23901,13 +23984,13 @@ var WorkflowAgentGraphBuilder = class {
|
|
|
23901
23984
|
middleware: isAsk ? noWrapAskMiddlewares : noWrapMiddlewares,
|
|
23902
23985
|
responseFormat
|
|
23903
23986
|
});
|
|
23904
|
-
agentCache.set(
|
|
23987
|
+
agentCache.set(key5, agent);
|
|
23905
23988
|
}
|
|
23906
|
-
return agentCache.get(
|
|
23989
|
+
return agentCache.get(key5);
|
|
23907
23990
|
}
|
|
23908
23991
|
if (isAsk) {
|
|
23909
|
-
const
|
|
23910
|
-
if (!agentCache.has(
|
|
23992
|
+
const key5 = "ask:default";
|
|
23993
|
+
if (!agentCache.has(key5)) {
|
|
23911
23994
|
console.log(`[WF BUILDER] creating ask default agent`);
|
|
23912
23995
|
const agent = (0, import_langchain59.createAgent)({
|
|
23913
23996
|
model: params.model,
|
|
@@ -23916,9 +23999,9 @@ var WorkflowAgentGraphBuilder = class {
|
|
|
23916
23999
|
checkpointer,
|
|
23917
24000
|
middleware: askMiddlewares
|
|
23918
24001
|
});
|
|
23919
|
-
agentCache.set(
|
|
24002
|
+
agentCache.set(key5, agent);
|
|
23920
24003
|
}
|
|
23921
|
-
return agentCache.get(
|
|
24004
|
+
return agentCache.get(key5);
|
|
23922
24005
|
}
|
|
23923
24006
|
console.log(`[WF BUILDER] resolveAgent: using defaultAgent`);
|
|
23924
24007
|
return defaultAgent;
|
|
@@ -24067,12 +24150,12 @@ var NON_INHERITABLE_FIELDS = /* @__PURE__ */ new Set([
|
|
|
24067
24150
|
]);
|
|
24068
24151
|
function mergeAgentConfig(parent, child) {
|
|
24069
24152
|
const merged = { ...parent };
|
|
24070
|
-
for (const [
|
|
24071
|
-
if (NON_INHERITABLE_FIELDS.has(
|
|
24153
|
+
for (const [key5, value] of Object.entries(child)) {
|
|
24154
|
+
if (NON_INHERITABLE_FIELDS.has(key5)) {
|
|
24072
24155
|
continue;
|
|
24073
24156
|
}
|
|
24074
24157
|
if (value !== void 0) {
|
|
24075
|
-
merged[
|
|
24158
|
+
merged[key5] = value;
|
|
24076
24159
|
}
|
|
24077
24160
|
}
|
|
24078
24161
|
merged.key = child.key;
|
|
@@ -24201,14 +24284,14 @@ var EmbeddingsLatticeManager = class _EmbeddingsLatticeManager extends BaseLatti
|
|
|
24201
24284
|
* @param embeddings Embeddings instance
|
|
24202
24285
|
* @param label Optional display label (auto-derived if not provided)
|
|
24203
24286
|
*/
|
|
24204
|
-
registerLattice(
|
|
24205
|
-
const displayLabel = label || embeddings.modelName || embeddings.model || embeddings.name ||
|
|
24287
|
+
registerLattice(key5, embeddings, label) {
|
|
24288
|
+
const displayLabel = label || embeddings.modelName || embeddings.model || embeddings.name || key5;
|
|
24206
24289
|
const embeddingsLattice = {
|
|
24207
|
-
key:
|
|
24290
|
+
key: key5,
|
|
24208
24291
|
client: embeddings,
|
|
24209
24292
|
label: displayLabel
|
|
24210
24293
|
};
|
|
24211
|
-
this.register(
|
|
24294
|
+
this.register(key5, embeddingsLattice);
|
|
24212
24295
|
}
|
|
24213
24296
|
/**
|
|
24214
24297
|
* Get all registered embeddings as { key, label } info list
|
|
@@ -24220,10 +24303,10 @@ var EmbeddingsLatticeManager = class _EmbeddingsLatticeManager extends BaseLatti
|
|
|
24220
24303
|
* Get EmbeddingsLattice
|
|
24221
24304
|
* @param key Lattice key name
|
|
24222
24305
|
*/
|
|
24223
|
-
getEmbeddingsLattice(
|
|
24224
|
-
const embeddingsLattice = this.get(
|
|
24306
|
+
getEmbeddingsLattice(key5) {
|
|
24307
|
+
const embeddingsLattice = this.get(key5);
|
|
24225
24308
|
if (!embeddingsLattice) {
|
|
24226
|
-
throw new Error(`EmbeddingsLattice ${
|
|
24309
|
+
throw new Error(`EmbeddingsLattice ${key5} not found`);
|
|
24227
24310
|
}
|
|
24228
24311
|
return embeddingsLattice;
|
|
24229
24312
|
}
|
|
@@ -24237,15 +24320,15 @@ var EmbeddingsLatticeManager = class _EmbeddingsLatticeManager extends BaseLatti
|
|
|
24237
24320
|
* Check if Lattice exists
|
|
24238
24321
|
* @param key Lattice key name
|
|
24239
24322
|
*/
|
|
24240
|
-
hasLattice(
|
|
24241
|
-
return this.has(
|
|
24323
|
+
hasLattice(key5) {
|
|
24324
|
+
return this.has(key5);
|
|
24242
24325
|
}
|
|
24243
24326
|
/**
|
|
24244
24327
|
* Remove Lattice
|
|
24245
24328
|
* @param key Lattice key name
|
|
24246
24329
|
*/
|
|
24247
|
-
removeLattice(
|
|
24248
|
-
return this.remove(
|
|
24330
|
+
removeLattice(key5) {
|
|
24331
|
+
return this.remove(key5);
|
|
24249
24332
|
}
|
|
24250
24333
|
/**
|
|
24251
24334
|
* Clear all Lattices
|
|
@@ -24269,15 +24352,15 @@ var EmbeddingsLatticeManager = class _EmbeddingsLatticeManager extends BaseLatti
|
|
|
24269
24352
|
* Get embeddings client
|
|
24270
24353
|
* @param key Lattice key name
|
|
24271
24354
|
*/
|
|
24272
|
-
getEmbeddingsClient(
|
|
24273
|
-
const embeddingsLattice = this.getEmbeddingsLattice(
|
|
24355
|
+
getEmbeddingsClient(key5) {
|
|
24356
|
+
const embeddingsLattice = this.getEmbeddingsLattice(key5);
|
|
24274
24357
|
return embeddingsLattice.client;
|
|
24275
24358
|
}
|
|
24276
24359
|
};
|
|
24277
24360
|
var embeddingsLatticeManager = EmbeddingsLatticeManager.getInstance();
|
|
24278
|
-
var registerEmbeddingsLattice = (
|
|
24279
|
-
var getEmbeddingsLattice = (
|
|
24280
|
-
var getEmbeddingsClient = (
|
|
24361
|
+
var registerEmbeddingsLattice = (key5, embeddings, label) => embeddingsLatticeManager.registerLattice(key5, embeddings, label);
|
|
24362
|
+
var getEmbeddingsLattice = (key5) => embeddingsLatticeManager.getEmbeddingsLattice(key5);
|
|
24363
|
+
var getEmbeddingsClient = (key5) => embeddingsLatticeManager.getEmbeddingsClient(key5);
|
|
24281
24364
|
|
|
24282
24365
|
// src/vectorstore_lattice/VectorStoreProviderManager.ts
|
|
24283
24366
|
var MemoryVectorStoreProvider = class {
|
|
@@ -24323,19 +24406,19 @@ var VectorStoreProviderManager = class _VectorStoreProviderManager extends BaseL
|
|
|
24323
24406
|
* @param key Provider key name
|
|
24324
24407
|
* @param provider VectorStoreProvider implementation
|
|
24325
24408
|
*/
|
|
24326
|
-
registerProvider(
|
|
24327
|
-
const lattice = { key:
|
|
24328
|
-
this.registerWithTenant("default",
|
|
24409
|
+
registerProvider(key5, provider) {
|
|
24410
|
+
const lattice = { key: key5, provider };
|
|
24411
|
+
this.registerWithTenant("default", key5, lattice);
|
|
24329
24412
|
}
|
|
24330
24413
|
/**
|
|
24331
24414
|
* Get a VectorStore provider by key
|
|
24332
24415
|
* @param key Provider key name
|
|
24333
24416
|
* @returns VectorStoreProvider instance
|
|
24334
24417
|
*/
|
|
24335
|
-
getProvider(
|
|
24336
|
-
const lattice = this.getWithTenant("default",
|
|
24418
|
+
getProvider(key5) {
|
|
24419
|
+
const lattice = this.getWithTenant("default", key5);
|
|
24337
24420
|
if (!lattice) {
|
|
24338
|
-
throw new Error(`VectorStoreProvider "${
|
|
24421
|
+
throw new Error(`VectorStoreProvider "${key5}" not found. Register one first.`);
|
|
24339
24422
|
}
|
|
24340
24423
|
return lattice.provider;
|
|
24341
24424
|
}
|
|
@@ -24348,20 +24431,20 @@ var VectorStoreProviderManager = class _VectorStoreProviderManager extends BaseL
|
|
|
24348
24431
|
/**
|
|
24349
24432
|
* Check if provider exists
|
|
24350
24433
|
*/
|
|
24351
|
-
hasProvider(
|
|
24352
|
-
return this.hasWithTenant("default",
|
|
24434
|
+
hasProvider(key5) {
|
|
24435
|
+
return this.hasWithTenant("default", key5);
|
|
24353
24436
|
}
|
|
24354
24437
|
/**
|
|
24355
24438
|
* Remove a provider
|
|
24356
24439
|
*/
|
|
24357
|
-
removeProvider(
|
|
24358
|
-
return this.removeWithTenant("default",
|
|
24440
|
+
removeProvider(key5) {
|
|
24441
|
+
return this.removeWithTenant("default", key5);
|
|
24359
24442
|
}
|
|
24360
24443
|
};
|
|
24361
24444
|
var vectorStoreProviderManager = VectorStoreProviderManager.getInstance();
|
|
24362
24445
|
vectorStoreProviderManager.registerProvider("default", new MemoryVectorStoreProvider());
|
|
24363
|
-
var registerVectorStoreProvider = (
|
|
24364
|
-
var getVectorStoreProvider = (
|
|
24446
|
+
var registerVectorStoreProvider = (key5, provider) => vectorStoreProviderManager.registerProvider(key5, provider);
|
|
24447
|
+
var getVectorStoreProvider = (key5) => vectorStoreProviderManager.getProvider(key5);
|
|
24365
24448
|
|
|
24366
24449
|
// src/store_lattice/configureStores.ts
|
|
24367
24450
|
var _disposables = [];
|
|
@@ -26953,7 +27036,7 @@ function parseFrontmatter2(content) {
|
|
|
26953
27036
|
if (currentKey === "metadata" && indent > metadataIndent) {
|
|
26954
27037
|
const colonIndex2 = trimmed.indexOf(":");
|
|
26955
27038
|
if (colonIndex2 !== -1) {
|
|
26956
|
-
const
|
|
27039
|
+
const key6 = trimmed.substring(0, colonIndex2).trim();
|
|
26957
27040
|
let value2 = trimmed.substring(colonIndex2 + 1).trim();
|
|
26958
27041
|
if (value2.startsWith('"') && value2.endsWith('"') || value2.startsWith("'") && value2.endsWith("'")) {
|
|
26959
27042
|
value2 = value2.slice(1, -1);
|
|
@@ -26961,7 +27044,7 @@ function parseFrontmatter2(content) {
|
|
|
26961
27044
|
if (!frontmatter.metadata) {
|
|
26962
27045
|
frontmatter.metadata = {};
|
|
26963
27046
|
}
|
|
26964
|
-
frontmatter.metadata[
|
|
27047
|
+
frontmatter.metadata[key6] = value2;
|
|
26965
27048
|
}
|
|
26966
27049
|
continue;
|
|
26967
27050
|
}
|
|
@@ -26986,12 +27069,12 @@ function parseFrontmatter2(content) {
|
|
|
26986
27069
|
if (colonIndex === -1) {
|
|
26987
27070
|
continue;
|
|
26988
27071
|
}
|
|
26989
|
-
const
|
|
27072
|
+
const key5 = trimmed.substring(0, colonIndex).trim();
|
|
26990
27073
|
let value = trimmed.substring(colonIndex + 1).trim();
|
|
26991
27074
|
if (value.startsWith('"') && value.endsWith('"') || value.startsWith("'") && value.endsWith("'")) {
|
|
26992
27075
|
value = value.slice(1, -1);
|
|
26993
27076
|
}
|
|
26994
|
-
if (
|
|
27077
|
+
if (key5 === "metadata") {
|
|
26995
27078
|
if (value === "" || value === "{}") {
|
|
26996
27079
|
if (i + 1 < lines.length) {
|
|
26997
27080
|
const nextLine = lines[i + 1];
|
|
@@ -27003,17 +27086,17 @@ function parseFrontmatter2(content) {
|
|
|
27003
27086
|
continue;
|
|
27004
27087
|
}
|
|
27005
27088
|
}
|
|
27006
|
-
frontmatter[
|
|
27089
|
+
frontmatter[key5] = {};
|
|
27007
27090
|
} else if (value.startsWith("{")) {
|
|
27008
27091
|
try {
|
|
27009
|
-
frontmatter[
|
|
27092
|
+
frontmatter[key5] = JSON.parse(value);
|
|
27010
27093
|
} catch {
|
|
27011
|
-
frontmatter[
|
|
27094
|
+
frontmatter[key5] = {};
|
|
27012
27095
|
}
|
|
27013
27096
|
} else {
|
|
27014
|
-
frontmatter[
|
|
27097
|
+
frontmatter[key5] = {};
|
|
27015
27098
|
}
|
|
27016
|
-
} else if (
|
|
27099
|
+
} else if (key5 === "subSkills") {
|
|
27017
27100
|
if (value === "" || value === "[]") {
|
|
27018
27101
|
if (i + 1 < lines.length) {
|
|
27019
27102
|
const nextLine = lines[i + 1];
|
|
@@ -27025,18 +27108,18 @@ function parseFrontmatter2(content) {
|
|
|
27025
27108
|
continue;
|
|
27026
27109
|
}
|
|
27027
27110
|
}
|
|
27028
|
-
frontmatter[
|
|
27111
|
+
frontmatter[key5] = [];
|
|
27029
27112
|
} else if (value.startsWith("[")) {
|
|
27030
27113
|
try {
|
|
27031
|
-
frontmatter[
|
|
27114
|
+
frontmatter[key5] = JSON.parse(value);
|
|
27032
27115
|
} catch {
|
|
27033
|
-
frontmatter[
|
|
27116
|
+
frontmatter[key5] = [];
|
|
27034
27117
|
}
|
|
27035
27118
|
} else {
|
|
27036
|
-
frontmatter[
|
|
27119
|
+
frontmatter[key5] = [];
|
|
27037
27120
|
}
|
|
27038
27121
|
} else {
|
|
27039
|
-
frontmatter[
|
|
27122
|
+
frontmatter[key5] = value;
|
|
27040
27123
|
}
|
|
27041
27124
|
}
|
|
27042
27125
|
return { frontmatter, body };
|
|
@@ -27053,8 +27136,8 @@ function generateFrontmatter2(data) {
|
|
|
27053
27136
|
}
|
|
27054
27137
|
if (data.metadata && Object.keys(data.metadata).length > 0) {
|
|
27055
27138
|
lines.push("metadata:");
|
|
27056
|
-
for (const [
|
|
27057
|
-
lines.push(` ${
|
|
27139
|
+
for (const [key5, value] of Object.entries(data.metadata)) {
|
|
27140
|
+
lines.push(` ${key5}: ${value}`);
|
|
27058
27141
|
}
|
|
27059
27142
|
}
|
|
27060
27143
|
if (data.subSkills && data.subSkills.length > 0) {
|
|
@@ -27618,12 +27701,12 @@ async function validateAgentReferences(input, tenantId2) {
|
|
|
27618
27701
|
const availableTools = getAvailableTools().map((tool69) => tool69.key);
|
|
27619
27702
|
const availableMiddlewareTypes = getAvailableMiddlewareTypes();
|
|
27620
27703
|
const availableCustomMiddlewareKeys = CustomMiddlewareRegistry.list().filter(
|
|
27621
|
-
(
|
|
27704
|
+
(key5) => CustomMiddlewareRegistry.get(key5) !== void 0
|
|
27622
27705
|
);
|
|
27623
27706
|
const availableModels = getAvailableModels().map((model) => model.key);
|
|
27624
|
-
const invalidTools = input.tools?.filter((
|
|
27707
|
+
const invalidTools = input.tools?.filter((key5) => !availableTools.includes(key5)) ?? [];
|
|
27625
27708
|
const invalidMiddlewareTypes = input.middleware?.map((middleware) => middleware.type).filter((type) => type !== "custom" && !availableMiddlewareTypes.includes(type)) ?? [];
|
|
27626
|
-
const invalidCustomMiddlewareKeys = input.middleware?.filter((middleware) => middleware.type === "custom").map((middleware) => typeof middleware.config?.key === "string" ? middleware.config.key.trim() : "").filter((
|
|
27709
|
+
const invalidCustomMiddlewareKeys = input.middleware?.filter((middleware) => middleware.type === "custom").map((middleware) => typeof middleware.config?.key === "string" ? middleware.config.key.trim() : "").filter((key5) => key5.length === 0 || !availableCustomMiddlewareKeys.includes(key5)) ?? [];
|
|
27627
27710
|
const availableSubAgents = input.subAgents !== void 0 ? (await getAssistStore().getAllAssistants(tenantId2)).map((assistant) => assistant.id) : void 0;
|
|
27628
27711
|
const invalidSubAgents = input.subAgents?.filter((id) => !availableSubAgents?.includes(id)) ?? [];
|
|
27629
27712
|
const invalidModelKey = input.modelKey !== void 0 && !availableModels.includes(input.modelKey) ? input.modelKey : void 0;
|
|
@@ -28161,7 +28244,7 @@ registerToolLattice(
|
|
|
28161
28244
|
changedKeys,
|
|
28162
28245
|
markdown: `## Agent Configuration Update
|
|
28163
28246
|
|
|
28164
|
-
Updated \`${input.id}\`: ${changedKeys.map((
|
|
28247
|
+
Updated \`${input.id}\`: ${changedKeys.map((key5) => `\`${key5}\``).join(", ")}.`
|
|
28165
28248
|
},
|
|
28166
28249
|
workspaceId: task.workspaceId,
|
|
28167
28250
|
projectId: task.projectId
|
|
@@ -28614,8 +28697,8 @@ function ensurePluginAgentsForTenant(tenantId2) {
|
|
|
28614
28697
|
for (const pluginType of pluginTypes) {
|
|
28615
28698
|
const plugin = PluginRegistry.get(pluginType);
|
|
28616
28699
|
if (!plugin?.agents) continue;
|
|
28617
|
-
for (const [
|
|
28618
|
-
if (!agentLatticeManager.hasWithTenant(tenantId2,
|
|
28700
|
+
for (const [key5, config] of Object.entries(plugin.agents)) {
|
|
28701
|
+
if (!agentLatticeManager.hasWithTenant(tenantId2, key5)) {
|
|
28619
28702
|
agentLatticeManager.registerLatticeWithTenant(tenantId2, config);
|
|
28620
28703
|
}
|
|
28621
28704
|
}
|
|
@@ -28662,10 +28745,10 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28662
28745
|
* @param key Agent键名
|
|
28663
28746
|
* @returns AgentLattice或undefined
|
|
28664
28747
|
*/
|
|
28665
|
-
async loadItemFromStore(tenantId2,
|
|
28748
|
+
async loadItemFromStore(tenantId2, key5) {
|
|
28666
28749
|
try {
|
|
28667
28750
|
const storeLattice = getStoreLattice("default", "assistant");
|
|
28668
|
-
const assistant = await storeLattice.store.getAssistantById(tenantId2,
|
|
28751
|
+
const assistant = await storeLattice.store.getAssistantById(tenantId2, key5);
|
|
28669
28752
|
if (!assistant) {
|
|
28670
28753
|
return void 0;
|
|
28671
28754
|
}
|
|
@@ -28676,7 +28759,7 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28676
28759
|
};
|
|
28677
28760
|
return agentLattice;
|
|
28678
28761
|
} catch (error) {
|
|
28679
|
-
console.error(`Failed to load agent from store [tenant: ${tenantId2}, key: ${
|
|
28762
|
+
console.error(`Failed to load agent from store [tenant: ${tenantId2}, key: ${key5}]:`, error);
|
|
28680
28763
|
return void 0;
|
|
28681
28764
|
}
|
|
28682
28765
|
}
|
|
@@ -28750,12 +28833,12 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28750
28833
|
* `null` when the key is not a suffixed GP key (including the bare
|
|
28751
28834
|
* `general-purpose` key itself).
|
|
28752
28835
|
*/
|
|
28753
|
-
generalPurposeParentKey(
|
|
28836
|
+
generalPurposeParentKey(key5) {
|
|
28754
28837
|
const suffix = _AgentLatticeManager.GENERAL_PURPOSE_SUFFIX;
|
|
28755
|
-
if (!
|
|
28838
|
+
if (!key5.endsWith(suffix) || key5.length <= suffix.length) {
|
|
28756
28839
|
return null;
|
|
28757
28840
|
}
|
|
28758
|
-
return
|
|
28841
|
+
return key5.slice(0, -suffix.length);
|
|
28759
28842
|
}
|
|
28760
28843
|
/**
|
|
28761
28844
|
* 带租户注册Agent Lattice
|
|
@@ -28783,12 +28866,12 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28783
28866
|
* @param tenantId 租户ID
|
|
28784
28867
|
* @param key Lattice键名
|
|
28785
28868
|
*/
|
|
28786
|
-
getAgentLatticeWithTenant(tenantId2,
|
|
28787
|
-
const exact = this.getWithTenant(tenantId2,
|
|
28869
|
+
getAgentLatticeWithTenant(tenantId2, key5) {
|
|
28870
|
+
const exact = this.getWithTenant(tenantId2, key5);
|
|
28788
28871
|
if (exact) {
|
|
28789
28872
|
return exact;
|
|
28790
28873
|
}
|
|
28791
|
-
const parentKey = this.generalPurposeParentKey(
|
|
28874
|
+
const parentKey = this.generalPurposeParentKey(key5);
|
|
28792
28875
|
if (!parentKey) {
|
|
28793
28876
|
return void 0;
|
|
28794
28877
|
}
|
|
@@ -28806,8 +28889,8 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28806
28889
|
* @param tenantId 租户ID
|
|
28807
28890
|
* @param key Lattice键名
|
|
28808
28891
|
*/
|
|
28809
|
-
hasAgentLatticeWithTenant(tenantId2,
|
|
28810
|
-
return this.hasWithTenant(tenantId2,
|
|
28892
|
+
hasAgentLatticeWithTenant(tenantId2, key5) {
|
|
28893
|
+
return this.hasWithTenant(tenantId2, key5);
|
|
28811
28894
|
}
|
|
28812
28895
|
/**
|
|
28813
28896
|
* 异步获取AgentLattice(内存未命中时尝试从store加载)
|
|
@@ -28821,12 +28904,12 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28821
28904
|
* @param tenantId 租户ID
|
|
28822
28905
|
* @param key Lattice键名
|
|
28823
28906
|
*/
|
|
28824
|
-
async getOrLoadWithTenant(tenantId2,
|
|
28825
|
-
const exact = await super.getOrLoadWithTenant(tenantId2,
|
|
28907
|
+
async getOrLoadWithTenant(tenantId2, key5) {
|
|
28908
|
+
const exact = await super.getOrLoadWithTenant(tenantId2, key5);
|
|
28826
28909
|
if (exact) {
|
|
28827
28910
|
return exact;
|
|
28828
28911
|
}
|
|
28829
|
-
const parentKey = this.generalPurposeParentKey(
|
|
28912
|
+
const parentKey = this.generalPurposeParentKey(key5);
|
|
28830
28913
|
if (!parentKey) {
|
|
28831
28914
|
return void 0;
|
|
28832
28915
|
}
|
|
@@ -28837,8 +28920,8 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28837
28920
|
* @param tenantId 租户ID
|
|
28838
28921
|
* @param key Lattice键名
|
|
28839
28922
|
*/
|
|
28840
|
-
removeAgentLatticeWithTenant(tenantId2,
|
|
28841
|
-
return this.removeWithTenant(tenantId2,
|
|
28923
|
+
removeAgentLatticeWithTenant(tenantId2, key5) {
|
|
28924
|
+
return this.removeWithTenant(tenantId2, key5);
|
|
28842
28925
|
}
|
|
28843
28926
|
/**
|
|
28844
28927
|
* 获取指定租户的所有Agent Lattice
|
|
@@ -28859,8 +28942,8 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28859
28942
|
* @param tenantId 租户ID
|
|
28860
28943
|
* @param key Lattice键名
|
|
28861
28944
|
*/
|
|
28862
|
-
getAgentConfigWithTenant(tenantId2,
|
|
28863
|
-
return this.getAgentLatticeWithTenant(tenantId2,
|
|
28945
|
+
getAgentConfigWithTenant(tenantId2, key5) {
|
|
28946
|
+
return this.getAgentLatticeWithTenant(tenantId2, key5)?.config;
|
|
28864
28947
|
}
|
|
28865
28948
|
/**
|
|
28866
28949
|
* 获取指定租户的所有Agent配置
|
|
@@ -28913,31 +28996,31 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28913
28996
|
* @param client Pre-built AgentClient (ReactAgent or CompiledGraph)
|
|
28914
28997
|
* @param tenantId Tenant ID (required)
|
|
28915
28998
|
*/
|
|
28916
|
-
registerTeammateAgent(
|
|
28999
|
+
registerTeammateAgent(key5, client, tenantId2) {
|
|
28917
29000
|
const agentLattice = {
|
|
28918
29001
|
config: {
|
|
28919
|
-
key:
|
|
28920
|
-
name:
|
|
28921
|
-
description: `Teammate agent: ${
|
|
29002
|
+
key: key5,
|
|
29003
|
+
name: key5,
|
|
29004
|
+
description: `Teammate agent: ${key5}`,
|
|
28922
29005
|
type: import_protocols5.AgentType.REACT
|
|
28923
29006
|
},
|
|
28924
29007
|
client
|
|
28925
29008
|
};
|
|
28926
|
-
this.registerWithTenant(tenantId2,
|
|
29009
|
+
this.registerWithTenant(tenantId2, key5, agentLattice);
|
|
28927
29010
|
}
|
|
28928
29011
|
/**
|
|
28929
29012
|
* Unregister a teammate agent. Call when a team is done to clean up.
|
|
28930
29013
|
*/
|
|
28931
|
-
unregisterTeammateAgent(
|
|
28932
|
-
return this.remove(
|
|
29014
|
+
unregisterTeammateAgent(key5) {
|
|
29015
|
+
return this.remove(key5);
|
|
28933
29016
|
}
|
|
28934
29017
|
/**
|
|
28935
29018
|
* 获取AgentLattice(向后兼容,使用 "default" 租户)
|
|
28936
29019
|
* @deprecated Use getAgentLatticeWithTenant(tenantId, key) instead
|
|
28937
29020
|
* @param key Lattice键名
|
|
28938
29021
|
*/
|
|
28939
|
-
getAgentLattice(
|
|
28940
|
-
return this.get(
|
|
29022
|
+
getAgentLattice(key5) {
|
|
29023
|
+
return this.get(key5);
|
|
28941
29024
|
}
|
|
28942
29025
|
/**
|
|
28943
29026
|
* 获取所有Lattice
|
|
@@ -28950,24 +29033,24 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28950
29033
|
* @deprecated Use hasAgentLatticeWithTenant(tenantId, key) instead
|
|
28951
29034
|
* @param key Lattice键名
|
|
28952
29035
|
*/
|
|
28953
|
-
hasLattice(
|
|
28954
|
-
return this.has(
|
|
29036
|
+
hasLattice(key5) {
|
|
29037
|
+
return this.has(key5);
|
|
28955
29038
|
}
|
|
28956
29039
|
/**
|
|
28957
29040
|
* 移除Lattice(向后兼容,使用 "default" 租户)
|
|
28958
29041
|
* @deprecated Use removeAgentLatticeWithTenant(tenantId, key) instead
|
|
28959
29042
|
* @param key Lattice键名
|
|
28960
29043
|
*/
|
|
28961
|
-
removeLattice(
|
|
28962
|
-
return this.remove(
|
|
29044
|
+
removeLattice(key5) {
|
|
29045
|
+
return this.remove(key5);
|
|
28963
29046
|
}
|
|
28964
29047
|
/**
|
|
28965
29048
|
* 获取Agent配置(向后兼容,使用 "default" 租户)
|
|
28966
29049
|
* @deprecated Use getAgentConfigWithTenant(tenantId, key) instead
|
|
28967
29050
|
* @param key Lattice键名
|
|
28968
29051
|
*/
|
|
28969
|
-
getAgentConfig(
|
|
28970
|
-
return this.getAgentLatticeWithTenant("default",
|
|
29052
|
+
getAgentConfig(key5) {
|
|
29053
|
+
return this.getAgentLatticeWithTenant("default", key5)?.config;
|
|
28971
29054
|
}
|
|
28972
29055
|
/**
|
|
28973
29056
|
* 获取所有Agent配置
|
|
@@ -28982,8 +29065,8 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
28982
29065
|
* @param key Lattice键名
|
|
28983
29066
|
* @param input 输入参数
|
|
28984
29067
|
*/
|
|
28985
|
-
validateAgentInput(
|
|
28986
|
-
const agentLattice = this.getAgentLattice(
|
|
29068
|
+
validateAgentInput(key5, input) {
|
|
29069
|
+
const agentLattice = this.getAgentLattice(key5);
|
|
28987
29070
|
if (!agentLattice) {
|
|
28988
29071
|
return false;
|
|
28989
29072
|
}
|
|
@@ -29039,9 +29122,9 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
29039
29122
|
*/
|
|
29040
29123
|
async buildAgentParams(agentLattice, options) {
|
|
29041
29124
|
const tenantId2 = agentLattice.config.tenantId || "default";
|
|
29042
|
-
const paramsBuilder = new AgentParamsBuilder(async (
|
|
29043
|
-
await this.initializeClientAsync(tenantId2,
|
|
29044
|
-
return this.getAgentLatticeWithTenant(tenantId2,
|
|
29125
|
+
const paramsBuilder = new AgentParamsBuilder(async (key5) => {
|
|
29126
|
+
await this.initializeClientAsync(tenantId2, key5);
|
|
29127
|
+
return this.getAgentLatticeWithTenant(tenantId2, key5);
|
|
29045
29128
|
});
|
|
29046
29129
|
const params = await paramsBuilder.buildParams(agentLattice, options);
|
|
29047
29130
|
return {
|
|
@@ -29077,12 +29160,12 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
29077
29160
|
* @param options 构建选项
|
|
29078
29161
|
* @returns 返回CompiledGraph对象
|
|
29079
29162
|
*/
|
|
29080
|
-
async initializeClient(tenantId2,
|
|
29081
|
-
const buildKey3 = `${tenantId2}:${
|
|
29163
|
+
async initializeClient(tenantId2, key5, options) {
|
|
29164
|
+
const buildKey3 = `${tenantId2}:${key5}`;
|
|
29082
29165
|
const stack = this.buildContext.getStore() ?? [];
|
|
29083
29166
|
if (stack.includes(buildKey3)) {
|
|
29084
29167
|
throw new Error(
|
|
29085
|
-
`Circular agent reference detected: agent "${
|
|
29168
|
+
`Circular agent reference detected: agent "${key5}" (tenant: ${tenantId2}) is already being built. A workflow cannot reference itself directly or transitively.`
|
|
29086
29169
|
);
|
|
29087
29170
|
}
|
|
29088
29171
|
const inFlight2 = this.buildingKeys.get(buildKey3);
|
|
@@ -29090,9 +29173,9 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
29090
29173
|
return inFlight2;
|
|
29091
29174
|
}
|
|
29092
29175
|
const buildPromise = this.buildContext.run([...stack, buildKey3], async () => {
|
|
29093
|
-
const agentLattice = this.getAgentLatticeWithTenant(tenantId2,
|
|
29176
|
+
const agentLattice = this.getAgentLatticeWithTenant(tenantId2, key5);
|
|
29094
29177
|
if (!agentLattice) {
|
|
29095
|
-
throw new Error(`Agent Lattice "${
|
|
29178
|
+
throw new Error(`Agent Lattice "${key5}" \u4E0D\u5B58\u5728 (tenant: ${tenantId2})`);
|
|
29096
29179
|
}
|
|
29097
29180
|
if (agentLattice.client) {
|
|
29098
29181
|
return agentLattice.client;
|
|
@@ -29121,12 +29204,12 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
29121
29204
|
* @param options 构建选项
|
|
29122
29205
|
* @returns 返回CompiledGraph对象
|
|
29123
29206
|
*/
|
|
29124
|
-
async initializeClientAsync(tenantId2,
|
|
29125
|
-
const buildKey3 = `${tenantId2}:${
|
|
29207
|
+
async initializeClientAsync(tenantId2, key5, options) {
|
|
29208
|
+
const buildKey3 = `${tenantId2}:${key5}`;
|
|
29126
29209
|
const stack = this.buildContext.getStore() ?? [];
|
|
29127
29210
|
if (stack.includes(buildKey3)) {
|
|
29128
29211
|
throw new Error(
|
|
29129
|
-
`Circular agent reference detected: agent "${
|
|
29212
|
+
`Circular agent reference detected: agent "${key5}" (tenant: ${tenantId2}) is already being built. A workflow cannot reference itself directly or transitively.`
|
|
29130
29213
|
);
|
|
29131
29214
|
}
|
|
29132
29215
|
const inFlight2 = this.buildingKeys.get(buildKey3);
|
|
@@ -29134,9 +29217,9 @@ var _AgentLatticeManager = class _AgentLatticeManager extends BaseLatticeManager
|
|
|
29134
29217
|
return inFlight2;
|
|
29135
29218
|
}
|
|
29136
29219
|
const buildPromise = this.buildContext.run([...stack, buildKey3], async () => {
|
|
29137
|
-
const agentLattice = await this.getOrLoadWithTenant(tenantId2,
|
|
29220
|
+
const agentLattice = await this.getOrLoadWithTenant(tenantId2, key5);
|
|
29138
29221
|
if (!agentLattice) {
|
|
29139
|
-
throw new Error(`Agent Lattice "${
|
|
29222
|
+
throw new Error(`Agent Lattice "${key5}" \u4E0D\u5B58\u5728 (tenant: ${tenantId2})`);
|
|
29140
29223
|
}
|
|
29141
29224
|
if (agentLattice.client) {
|
|
29142
29225
|
return agentLattice.client;
|
|
@@ -29182,13 +29265,13 @@ var registerAgentLattices = (tenantId2, configs) => {
|
|
|
29182
29265
|
agentLatticeManager.registerLatticeWithTenant(tenantId2, config);
|
|
29183
29266
|
});
|
|
29184
29267
|
};
|
|
29185
|
-
var getAgentConfig = (
|
|
29268
|
+
var getAgentConfig = (key5) => agentLatticeManager.getAgentConfig(key5);
|
|
29186
29269
|
var getAllAgentConfigs = () => agentLatticeManager.getAllAgentConfigs();
|
|
29187
|
-
var validateAgentInput = (
|
|
29188
|
-
var registerTeammateAgent = (
|
|
29189
|
-
var unregisterTeammateAgent = (
|
|
29190
|
-
var getAgentClient = (tenantId2,
|
|
29191
|
-
var getAgentClientAsync = async (tenantId2,
|
|
29270
|
+
var validateAgentInput = (key5, input) => agentLatticeManager.validateAgentInput(key5, input);
|
|
29271
|
+
var registerTeammateAgent = (key5, client, tenantId2) => agentLatticeManager.registerTeammateAgent(key5, client, tenantId2);
|
|
29272
|
+
var unregisterTeammateAgent = (key5) => agentLatticeManager.unregisterTeammateAgent(key5);
|
|
29273
|
+
var getAgentClient = (tenantId2, key5, options) => agentLatticeManager.initializeClient(tenantId2, key5, options);
|
|
29274
|
+
var getAgentClientAsync = async (tenantId2, key5, options) => agentLatticeManager.initializeClientAsync(tenantId2, key5, options);
|
|
29192
29275
|
var createAgentClientFromAgentLattice = async (agentLattice, options) => await agentLatticeManager.createAgentClientFromConfig(agentLattice, options);
|
|
29193
29276
|
|
|
29194
29277
|
// src/index.ts
|
|
@@ -29217,21 +29300,21 @@ var VectorStoreLatticeManager = class _VectorStoreLatticeManager extends BaseLat
|
|
|
29217
29300
|
* @param key Lattice key name
|
|
29218
29301
|
* @param vectorStore VectorStore instance
|
|
29219
29302
|
*/
|
|
29220
|
-
registerLattice(
|
|
29303
|
+
registerLattice(key5, vectorStore) {
|
|
29221
29304
|
const vectorStoreLattice = {
|
|
29222
|
-
key:
|
|
29305
|
+
key: key5,
|
|
29223
29306
|
client: vectorStore
|
|
29224
29307
|
};
|
|
29225
|
-
this.register(
|
|
29308
|
+
this.register(key5, vectorStoreLattice);
|
|
29226
29309
|
}
|
|
29227
29310
|
/**
|
|
29228
29311
|
* Get VectorStoreLattice
|
|
29229
29312
|
* @param key Lattice key name
|
|
29230
29313
|
*/
|
|
29231
|
-
getVectorStoreLattice(
|
|
29232
|
-
const vectorStoreLattice = this.get(
|
|
29314
|
+
getVectorStoreLattice(key5) {
|
|
29315
|
+
const vectorStoreLattice = this.get(key5);
|
|
29233
29316
|
if (!vectorStoreLattice) {
|
|
29234
|
-
throw new Error(`VectorStoreLattice ${
|
|
29317
|
+
throw new Error(`VectorStoreLattice ${key5} not found`);
|
|
29235
29318
|
}
|
|
29236
29319
|
return vectorStoreLattice;
|
|
29237
29320
|
}
|
|
@@ -29245,15 +29328,15 @@ var VectorStoreLatticeManager = class _VectorStoreLatticeManager extends BaseLat
|
|
|
29245
29328
|
* Check if Lattice exists
|
|
29246
29329
|
* @param key Lattice key name
|
|
29247
29330
|
*/
|
|
29248
|
-
hasLattice(
|
|
29249
|
-
return this.has(
|
|
29331
|
+
hasLattice(key5) {
|
|
29332
|
+
return this.has(key5);
|
|
29250
29333
|
}
|
|
29251
29334
|
/**
|
|
29252
29335
|
* Remove Lattice
|
|
29253
29336
|
* @param key Lattice key name
|
|
29254
29337
|
*/
|
|
29255
|
-
removeLattice(
|
|
29256
|
-
return this.remove(
|
|
29338
|
+
removeLattice(key5) {
|
|
29339
|
+
return this.remove(key5);
|
|
29257
29340
|
}
|
|
29258
29341
|
/**
|
|
29259
29342
|
* Clear all Lattices
|
|
@@ -29277,15 +29360,15 @@ var VectorStoreLatticeManager = class _VectorStoreLatticeManager extends BaseLat
|
|
|
29277
29360
|
* Get vector store client
|
|
29278
29361
|
* @param key Lattice key name
|
|
29279
29362
|
*/
|
|
29280
|
-
getVectorStoreClient(
|
|
29281
|
-
const vectorStoreLattice = this.getVectorStoreLattice(
|
|
29363
|
+
getVectorStoreClient(key5) {
|
|
29364
|
+
const vectorStoreLattice = this.getVectorStoreLattice(key5);
|
|
29282
29365
|
return vectorStoreLattice.client;
|
|
29283
29366
|
}
|
|
29284
29367
|
};
|
|
29285
29368
|
var vectorStoreLatticeManager = VectorStoreLatticeManager.getInstance();
|
|
29286
|
-
var registerVectorStoreLattice = (
|
|
29287
|
-
var getVectorStoreLattice = (
|
|
29288
|
-
var getVectorStoreClient = (
|
|
29369
|
+
var registerVectorStoreLattice = (key5, vectorStore) => vectorStoreLatticeManager.registerLattice(key5, vectorStore);
|
|
29370
|
+
var getVectorStoreLattice = (key5) => vectorStoreLatticeManager.getVectorStoreLattice(key5);
|
|
29371
|
+
var getVectorStoreClient = (key5) => vectorStoreLatticeManager.getVectorStoreClient(key5);
|
|
29289
29372
|
|
|
29290
29373
|
// src/logger_lattice/LoggerLatticeManager.ts
|
|
29291
29374
|
init_BaseLatticeManager();
|
|
@@ -29506,7 +29589,7 @@ var LoggerLatticeManager = class _LoggerLatticeManager extends BaseLatticeManage
|
|
|
29506
29589
|
* @param config Logger configuration
|
|
29507
29590
|
* @param client Optional logger client. If not provided, will create based on config type.
|
|
29508
29591
|
*/
|
|
29509
|
-
registerLattice(
|
|
29592
|
+
registerLattice(key5, config, client) {
|
|
29510
29593
|
let loggerClient;
|
|
29511
29594
|
if (client) {
|
|
29512
29595
|
loggerClient = client;
|
|
@@ -29524,7 +29607,7 @@ var LoggerLatticeManager = class _LoggerLatticeManager extends BaseLatticeManage
|
|
|
29524
29607
|
}
|
|
29525
29608
|
}
|
|
29526
29609
|
const loggerLattice = {
|
|
29527
|
-
key:
|
|
29610
|
+
key: key5,
|
|
29528
29611
|
config,
|
|
29529
29612
|
client: loggerClient,
|
|
29530
29613
|
// Logger operations
|
|
@@ -29547,16 +29630,16 @@ var LoggerLatticeManager = class _LoggerLatticeManager extends BaseLatticeManage
|
|
|
29547
29630
|
return loggerClient.child(options);
|
|
29548
29631
|
} : void 0
|
|
29549
29632
|
};
|
|
29550
|
-
this.register(
|
|
29633
|
+
this.register(key5, loggerLattice);
|
|
29551
29634
|
}
|
|
29552
29635
|
/**
|
|
29553
29636
|
* Get LoggerLattice
|
|
29554
29637
|
* @param key Lattice key name
|
|
29555
29638
|
*/
|
|
29556
|
-
getLoggerLattice(
|
|
29557
|
-
const loggerLattice = this.get(
|
|
29639
|
+
getLoggerLattice(key5) {
|
|
29640
|
+
const loggerLattice = this.get(key5);
|
|
29558
29641
|
if (!loggerLattice) {
|
|
29559
|
-
throw new Error(`LoggerLattice ${
|
|
29642
|
+
throw new Error(`LoggerLattice ${key5} not found`);
|
|
29560
29643
|
}
|
|
29561
29644
|
return loggerLattice;
|
|
29562
29645
|
}
|
|
@@ -29570,15 +29653,15 @@ var LoggerLatticeManager = class _LoggerLatticeManager extends BaseLatticeManage
|
|
|
29570
29653
|
* Check if Lattice exists
|
|
29571
29654
|
* @param key Lattice key name
|
|
29572
29655
|
*/
|
|
29573
|
-
hasLattice(
|
|
29574
|
-
return this.has(
|
|
29656
|
+
hasLattice(key5) {
|
|
29657
|
+
return this.has(key5);
|
|
29575
29658
|
}
|
|
29576
29659
|
/**
|
|
29577
29660
|
* Remove Lattice
|
|
29578
29661
|
* @param key Lattice key name
|
|
29579
29662
|
*/
|
|
29580
|
-
removeLattice(
|
|
29581
|
-
return this.remove(
|
|
29663
|
+
removeLattice(key5) {
|
|
29664
|
+
return this.remove(key5);
|
|
29582
29665
|
}
|
|
29583
29666
|
/**
|
|
29584
29667
|
* Clear all Lattices
|
|
@@ -29600,8 +29683,8 @@ var LoggerLatticeManager = class _LoggerLatticeManager extends BaseLatticeManage
|
|
|
29600
29683
|
}
|
|
29601
29684
|
};
|
|
29602
29685
|
var loggerLatticeManager = LoggerLatticeManager.getInstance();
|
|
29603
|
-
var registerLoggerLattice = (
|
|
29604
|
-
var getLoggerLattice = (
|
|
29686
|
+
var registerLoggerLattice = (key5, config, client) => loggerLatticeManager.registerLattice(key5, config, client);
|
|
29687
|
+
var getLoggerLattice = (key5) => loggerLatticeManager.getLoggerLattice(key5);
|
|
29605
29688
|
|
|
29606
29689
|
// src/skill_lattice/SkillLatticeManager.ts
|
|
29607
29690
|
init_BaseLatticeManager();
|
|
@@ -29675,7 +29758,7 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29675
29758
|
* @param config Skill configuration
|
|
29676
29759
|
* @param client Optional skill client implementation
|
|
29677
29760
|
*/
|
|
29678
|
-
async registerLatticeWithTenant(tenantId2,
|
|
29761
|
+
async registerLatticeWithTenant(tenantId2, key5, config, client) {
|
|
29679
29762
|
if (!config.name) {
|
|
29680
29763
|
throw new Error("Skill name is required");
|
|
29681
29764
|
}
|
|
@@ -29683,9 +29766,9 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29683
29766
|
throw new Error("Skill description is required");
|
|
29684
29767
|
}
|
|
29685
29768
|
validateSkillName(config.name);
|
|
29686
|
-
if (
|
|
29769
|
+
if (key5 !== config.name) {
|
|
29687
29770
|
throw new Error(
|
|
29688
|
-
`Skill key "${
|
|
29771
|
+
`Skill key "${key5}" must equal name "${config.name}" (name is used for path addressing)`
|
|
29689
29772
|
);
|
|
29690
29773
|
}
|
|
29691
29774
|
const store = this.getStore();
|
|
@@ -29693,14 +29776,14 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29693
29776
|
this.injectStoreIntoClient(client, store);
|
|
29694
29777
|
}
|
|
29695
29778
|
const skillLattice = {
|
|
29696
|
-
key:
|
|
29779
|
+
key: key5,
|
|
29697
29780
|
config,
|
|
29698
29781
|
client: client ?? null
|
|
29699
29782
|
};
|
|
29700
|
-
this.registerWithTenant(tenantId2,
|
|
29783
|
+
this.registerWithTenant(tenantId2, key5, skillLattice);
|
|
29701
29784
|
if (store) {
|
|
29702
29785
|
try {
|
|
29703
|
-
await store.createSkill(tenantId2,
|
|
29786
|
+
await store.createSkill(tenantId2, key5, {
|
|
29704
29787
|
name: config.name,
|
|
29705
29788
|
description: config.description,
|
|
29706
29789
|
license: config.license,
|
|
@@ -29711,7 +29794,7 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29711
29794
|
});
|
|
29712
29795
|
} catch (error) {
|
|
29713
29796
|
console.warn(
|
|
29714
|
-
`Failed to persist skill ${
|
|
29797
|
+
`Failed to persist skill ${key5} to store:`,
|
|
29715
29798
|
error instanceof Error ? error.message : String(error)
|
|
29716
29799
|
);
|
|
29717
29800
|
}
|
|
@@ -29724,24 +29807,24 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29724
29807
|
* @param config Skill configuration
|
|
29725
29808
|
* @param client Optional skill client implementation
|
|
29726
29809
|
*/
|
|
29727
|
-
async registerLattice(
|
|
29728
|
-
return this.registerLatticeWithTenant(this.getDefaultTenantId(),
|
|
29810
|
+
async registerLattice(key5, config, client) {
|
|
29811
|
+
return this.registerLatticeWithTenant(this.getDefaultTenantId(), key5, config, client);
|
|
29729
29812
|
}
|
|
29730
29813
|
/**
|
|
29731
29814
|
* Get skill Lattice by key with tenant
|
|
29732
29815
|
* @param tenantId Tenant ID
|
|
29733
29816
|
* @param key Lattice key name
|
|
29734
29817
|
*/
|
|
29735
|
-
getSkillLatticeWithTenant(tenantId2,
|
|
29736
|
-
return this.getWithTenant(tenantId2,
|
|
29818
|
+
getSkillLatticeWithTenant(tenantId2, key5) {
|
|
29819
|
+
return this.getWithTenant(tenantId2, key5);
|
|
29737
29820
|
}
|
|
29738
29821
|
/**
|
|
29739
29822
|
* Get skill Lattice by key (backward compatible, uses "default" tenant)
|
|
29740
29823
|
* @deprecated Use getSkillLatticeWithTenant(tenantId, key) instead
|
|
29741
29824
|
* @param key Lattice key name
|
|
29742
29825
|
*/
|
|
29743
|
-
getSkillLattice(
|
|
29744
|
-
return this.getWithTenant(this.getDefaultTenantId(),
|
|
29826
|
+
getSkillLattice(key5) {
|
|
29827
|
+
return this.getWithTenant(this.getDefaultTenantId(), key5);
|
|
29745
29828
|
}
|
|
29746
29829
|
/**
|
|
29747
29830
|
* Get all skill Lattices from store with tenant
|
|
@@ -29786,32 +29869,32 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29786
29869
|
* @param tenantId Tenant ID
|
|
29787
29870
|
* @param key Lattice key name
|
|
29788
29871
|
*/
|
|
29789
|
-
hasLatticeWithTenant(tenantId2,
|
|
29790
|
-
return this.hasWithTenant(tenantId2,
|
|
29872
|
+
hasLatticeWithTenant(tenantId2, key5) {
|
|
29873
|
+
return this.hasWithTenant(tenantId2, key5);
|
|
29791
29874
|
}
|
|
29792
29875
|
/**
|
|
29793
29876
|
* Check if Lattice exists (backward compatible, uses "default" tenant)
|
|
29794
29877
|
* @deprecated Use hasLatticeWithTenant(tenantId, key) instead
|
|
29795
29878
|
* @param key Lattice key name
|
|
29796
29879
|
*/
|
|
29797
|
-
hasLattice(
|
|
29798
|
-
return this.hasWithTenant(this.getDefaultTenantId(),
|
|
29880
|
+
hasLattice(key5) {
|
|
29881
|
+
return this.hasWithTenant(this.getDefaultTenantId(), key5);
|
|
29799
29882
|
}
|
|
29800
29883
|
/**
|
|
29801
29884
|
* Remove Lattice with tenant
|
|
29802
29885
|
* @param tenantId Tenant ID
|
|
29803
29886
|
* @param key Lattice key name
|
|
29804
29887
|
*/
|
|
29805
|
-
async removeLatticeWithTenant(tenantId2,
|
|
29806
|
-
const removed = this.removeWithTenant(tenantId2,
|
|
29888
|
+
async removeLatticeWithTenant(tenantId2, key5) {
|
|
29889
|
+
const removed = this.removeWithTenant(tenantId2, key5);
|
|
29807
29890
|
if (removed) {
|
|
29808
29891
|
const store = this.getStore();
|
|
29809
29892
|
if (store) {
|
|
29810
29893
|
try {
|
|
29811
|
-
await store.deleteSkill(tenantId2,
|
|
29894
|
+
await store.deleteSkill(tenantId2, key5);
|
|
29812
29895
|
} catch (error) {
|
|
29813
29896
|
console.warn(
|
|
29814
|
-
`Failed to remove skill ${
|
|
29897
|
+
`Failed to remove skill ${key5} from store:`,
|
|
29815
29898
|
error instanceof Error ? error.message : String(error)
|
|
29816
29899
|
);
|
|
29817
29900
|
}
|
|
@@ -29824,8 +29907,8 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29824
29907
|
* @deprecated Use removeLatticeWithTenant(tenantId, key) instead
|
|
29825
29908
|
* @param key Lattice key name
|
|
29826
29909
|
*/
|
|
29827
|
-
async removeLattice(
|
|
29828
|
-
return this.removeLatticeWithTenant(this.getDefaultTenantId(),
|
|
29910
|
+
async removeLattice(key5) {
|
|
29911
|
+
return this.removeLatticeWithTenant(this.getDefaultTenantId(), key5);
|
|
29829
29912
|
}
|
|
29830
29913
|
/**
|
|
29831
29914
|
* Clear all Lattices
|
|
@@ -29849,10 +29932,10 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29849
29932
|
* Get skill configuration
|
|
29850
29933
|
* @param key Lattice key name
|
|
29851
29934
|
*/
|
|
29852
|
-
getSkillConfig(
|
|
29853
|
-
const skillLattice = this.getSkillLattice(
|
|
29935
|
+
getSkillConfig(key5) {
|
|
29936
|
+
const skillLattice = this.getSkillLattice(key5);
|
|
29854
29937
|
if (!skillLattice) {
|
|
29855
|
-
throw new Error(`SkillLattice ${
|
|
29938
|
+
throw new Error(`SkillLattice ${key5} not found`);
|
|
29856
29939
|
}
|
|
29857
29940
|
return skillLattice.config;
|
|
29858
29941
|
}
|
|
@@ -29861,10 +29944,10 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29861
29944
|
* Ensures client has store access if store is configured
|
|
29862
29945
|
* @param key Lattice key name
|
|
29863
29946
|
*/
|
|
29864
|
-
getSkillClient(
|
|
29865
|
-
const skillLattice = this.getSkillLattice(
|
|
29947
|
+
getSkillClient(key5) {
|
|
29948
|
+
const skillLattice = this.getSkillLattice(key5);
|
|
29866
29949
|
if (!skillLattice) {
|
|
29867
|
-
throw new Error(`SkillLattice ${
|
|
29950
|
+
throw new Error(`SkillLattice ${key5} not found`);
|
|
29868
29951
|
}
|
|
29869
29952
|
const client = skillLattice.client;
|
|
29870
29953
|
if (!client) {
|
|
@@ -29947,21 +30030,21 @@ var SkillLatticeManager = class _SkillLatticeManager extends BaseLatticeManager
|
|
|
29947
30030
|
* @param key Skill key
|
|
29948
30031
|
* @param updates Partial skill data to update
|
|
29949
30032
|
*/
|
|
29950
|
-
async updateSkillInStore(
|
|
30033
|
+
async updateSkillInStore(key5, updates) {
|
|
29951
30034
|
const store = this.getStore();
|
|
29952
30035
|
if (!store) {
|
|
29953
30036
|
throw new Error("No store configured. Call configureStore() first.");
|
|
29954
30037
|
}
|
|
29955
|
-
const skillLattice = this.getSkillLattice(
|
|
30038
|
+
const skillLattice = this.getSkillLattice(key5);
|
|
29956
30039
|
if (!skillLattice) {
|
|
29957
|
-
throw new Error(`SkillLattice ${
|
|
30040
|
+
throw new Error(`SkillLattice ${key5} not found`);
|
|
29958
30041
|
}
|
|
29959
30042
|
const updatedConfig = {
|
|
29960
30043
|
...skillLattice.config,
|
|
29961
30044
|
...updates
|
|
29962
30045
|
};
|
|
29963
30046
|
skillLattice.config = updatedConfig;
|
|
29964
|
-
await store.updateSkill(this.getDefaultTenantId(),
|
|
30047
|
+
await store.updateSkill(this.getDefaultTenantId(), key5, {
|
|
29965
30048
|
name: updatedConfig.name,
|
|
29966
30049
|
description: updatedConfig.description,
|
|
29967
30050
|
license: updatedConfig.license,
|
|
@@ -30277,9 +30360,9 @@ var McpLatticeManager = class _McpLatticeManager extends BaseLatticeManager {
|
|
|
30277
30360
|
unregisterServerTools(serverName) {
|
|
30278
30361
|
const keys = this.registeredToolKeys.get(serverName);
|
|
30279
30362
|
if (!keys || keys.length === 0) return;
|
|
30280
|
-
for (const
|
|
30363
|
+
for (const key5 of keys) {
|
|
30281
30364
|
try {
|
|
30282
|
-
toolLatticeManager.removeWithTenant("default",
|
|
30365
|
+
toolLatticeManager.removeWithTenant("default", key5);
|
|
30283
30366
|
} catch {
|
|
30284
30367
|
}
|
|
30285
30368
|
}
|
|
@@ -32728,8 +32811,8 @@ var _LatticeEval = class _LatticeEval {
|
|
|
32728
32811
|
return parts.length > 0 ? `(${parts.join(" ")})` : "";
|
|
32729
32812
|
}
|
|
32730
32813
|
buildFileEntries(files) {
|
|
32731
|
-
return Object.keys(files).reduce((acc,
|
|
32732
|
-
acc[
|
|
32814
|
+
return Object.keys(files).reduce((acc, key5) => {
|
|
32815
|
+
acc[key5] = { content: files[key5].split("\n"), created_at: (/* @__PURE__ */ new Date()).toISOString(), modified_at: (/* @__PURE__ */ new Date()).toISOString() };
|
|
32733
32816
|
return acc;
|
|
32734
32817
|
}, {});
|
|
32735
32818
|
}
|
|
@@ -32971,8 +33054,8 @@ ${toolCallStr}` : toolCallStr;
|
|
|
32971
33054
|
});
|
|
32972
33055
|
const files = evalCase.input.files;
|
|
32973
33056
|
const testCaseFilesContent = files ? Object.keys(files).map(
|
|
32974
|
-
(
|
|
32975
|
-
File content: ${files[
|
|
33057
|
+
(key5) => `File name: ${key5}
|
|
33058
|
+
File content: ${files[key5]}`
|
|
32976
33059
|
).join("\n\n") : "";
|
|
32977
33060
|
const defaultRubrics = [
|
|
32978
33061
|
{
|
|
@@ -33761,7 +33844,7 @@ function snapshotInput(input) {
|
|
|
33761
33844
|
"targetAssistantId",
|
|
33762
33845
|
"newThreadId"
|
|
33763
33846
|
];
|
|
33764
|
-
if (!row || required.some((
|
|
33847
|
+
if (!row || required.some((key5) => typeof row[key5] !== "string" || row[key5].length === 0) || row.expectedThreadId !== void 0 && (typeof row.expectedThreadId !== "string" || row.expectedThreadId.length === 0)) {
|
|
33765
33848
|
throw new Error("Invalid Project task reassignment authorization input");
|
|
33766
33849
|
}
|
|
33767
33850
|
return {
|
|
@@ -33807,14 +33890,14 @@ var TaskLifecycleNotifier = class {
|
|
|
33807
33890
|
*/
|
|
33808
33891
|
async publish(event) {
|
|
33809
33892
|
const snapshot = snapshotNotification(event);
|
|
33810
|
-
const
|
|
33811
|
-
const previous = this.tails.get(
|
|
33893
|
+
const key5 = `${snapshot.tenantId}:${snapshot.taskId}`;
|
|
33894
|
+
const previous = this.tails.get(key5) ?? Promise.resolve();
|
|
33812
33895
|
const delivery = previous.catch(() => void 0).then(() => this.deliver(snapshot));
|
|
33813
|
-
this.tails.set(
|
|
33896
|
+
this.tails.set(key5, delivery);
|
|
33814
33897
|
try {
|
|
33815
33898
|
await delivery;
|
|
33816
33899
|
} finally {
|
|
33817
|
-
if (this.tails.get(
|
|
33900
|
+
if (this.tails.get(key5) === delivery) this.tails.delete(key5);
|
|
33818
33901
|
}
|
|
33819
33902
|
}
|
|
33820
33903
|
async deliver(snapshot) {
|
|
@@ -33891,14 +33974,14 @@ var ProjectTaskAdmissionNotifier = class {
|
|
|
33891
33974
|
async publish(event) {
|
|
33892
33975
|
const snapshot = snapshotNotification2(event);
|
|
33893
33976
|
const listeners = [...this.listeners];
|
|
33894
|
-
const
|
|
33895
|
-
const previous = this.tails.get(
|
|
33977
|
+
const key5 = `${snapshot.tenantId}\0${snapshot.taskId}`;
|
|
33978
|
+
const previous = this.tails.get(key5) ?? Promise.resolve();
|
|
33896
33979
|
const delivery = previous.catch(() => void 0).then(() => this.deliver(snapshot, listeners));
|
|
33897
|
-
this.tails.set(
|
|
33980
|
+
this.tails.set(key5, delivery);
|
|
33898
33981
|
try {
|
|
33899
33982
|
await delivery;
|
|
33900
33983
|
} finally {
|
|
33901
|
-
if (this.tails.get(
|
|
33984
|
+
if (this.tails.get(key5) === delivery) this.tails.delete(key5);
|
|
33902
33985
|
}
|
|
33903
33986
|
}
|
|
33904
33987
|
async deliver(snapshot, listeners) {
|
|
@@ -33974,22 +34057,22 @@ var ProjectMutationMutex = class {
|
|
|
33974
34057
|
}
|
|
33975
34058
|
/** Runs one mutation after all earlier mutations for the same Tenant and Project. */
|
|
33976
34059
|
async runExclusive(scope, operation, signal) {
|
|
33977
|
-
const
|
|
33978
|
-
await this.acquire(
|
|
34060
|
+
const key5 = projectKey(scope);
|
|
34061
|
+
await this.acquire(key5, signal);
|
|
33979
34062
|
try {
|
|
33980
34063
|
return await operation();
|
|
33981
34064
|
} finally {
|
|
33982
|
-
this.release(
|
|
34065
|
+
this.release(key5);
|
|
33983
34066
|
}
|
|
33984
34067
|
}
|
|
33985
34068
|
/** Returns the number of operations queued behind the current holder. */
|
|
33986
34069
|
pending(scope) {
|
|
33987
34070
|
return this.queues.get(projectKey(scope))?.length ?? 0;
|
|
33988
34071
|
}
|
|
33989
|
-
acquire(
|
|
34072
|
+
acquire(key5, signal) {
|
|
33990
34073
|
if (signal?.aborted) return Promise.reject(new Error("Project mutation wait aborted"));
|
|
33991
|
-
if (!this.active.has(
|
|
33992
|
-
this.active.add(
|
|
34074
|
+
if (!this.active.has(key5)) {
|
|
34075
|
+
this.active.add(key5);
|
|
33993
34076
|
return Promise.resolve();
|
|
33994
34077
|
}
|
|
33995
34078
|
return new Promise((resolve4, reject) => {
|
|
@@ -34001,28 +34084,28 @@ var ProjectMutationMutex = class {
|
|
|
34001
34084
|
reject
|
|
34002
34085
|
};
|
|
34003
34086
|
waiter.onAbort = () => {
|
|
34004
|
-
const queue2 = this.queues.get(
|
|
34087
|
+
const queue2 = this.queues.get(key5);
|
|
34005
34088
|
const index = queue2?.indexOf(waiter) ?? -1;
|
|
34006
34089
|
if (!queue2 || index < 0) return;
|
|
34007
34090
|
queue2.splice(index, 1);
|
|
34008
|
-
if (queue2.length === 0) this.queues.delete(
|
|
34091
|
+
if (queue2.length === 0) this.queues.delete(key5);
|
|
34009
34092
|
reject(new Error("Project mutation wait aborted"));
|
|
34010
34093
|
};
|
|
34011
34094
|
signal?.addEventListener("abort", waiter.onAbort, { once: true });
|
|
34012
|
-
const queue = this.queues.get(
|
|
34095
|
+
const queue = this.queues.get(key5) ?? [];
|
|
34013
34096
|
queue.push(waiter);
|
|
34014
|
-
this.queues.set(
|
|
34097
|
+
this.queues.set(key5, queue);
|
|
34015
34098
|
});
|
|
34016
34099
|
}
|
|
34017
|
-
release(
|
|
34018
|
-
const queue = this.queues.get(
|
|
34100
|
+
release(key5) {
|
|
34101
|
+
const queue = this.queues.get(key5);
|
|
34019
34102
|
const next = queue?.shift();
|
|
34020
|
-
if (queue?.length === 0) this.queues.delete(
|
|
34103
|
+
if (queue?.length === 0) this.queues.delete(key5);
|
|
34021
34104
|
if (next) {
|
|
34022
34105
|
next.start();
|
|
34023
34106
|
return;
|
|
34024
34107
|
}
|
|
34025
|
-
this.active.delete(
|
|
34108
|
+
this.active.delete(key5);
|
|
34026
34109
|
}
|
|
34027
34110
|
};
|
|
34028
34111
|
var projectMutationMutex = new ProjectMutationMutex();
|
|
@@ -34147,7 +34230,7 @@ function exactValues(value, required, optional = []) {
|
|
|
34147
34230
|
}
|
|
34148
34231
|
function exactStringRecord(value, keys, message) {
|
|
34149
34232
|
const values = exactValues(value, keys);
|
|
34150
|
-
if (!values || keys.some((
|
|
34233
|
+
if (!values || keys.some((key5) => typeof values[key5] !== "string" || values[key5].length === 0)) throw new Error(message);
|
|
34151
34234
|
return values;
|
|
34152
34235
|
}
|
|
34153
34236
|
function date(value) {
|
|
@@ -34164,7 +34247,7 @@ function snapshotSource(value) {
|
|
|
34164
34247
|
const content = exactValues(values?.content, ["type", "text"]);
|
|
34165
34248
|
const createdAt = date(values?.createdAt);
|
|
34166
34249
|
const mentions = snapshotMentions(values?.mentions);
|
|
34167
|
-
if (!values || values.source !== "user" || author?.type !== "human" || typeof author.userId !== "string" || !author.userId || content?.type !== "text" || typeof content.text !== "string" || !mentions || !createdAt || ["id", "tenantId", "workspaceId", "projectId", "roomId"].some((
|
|
34250
|
+
if (!values || values.source !== "user" || author?.type !== "human" || typeof author.userId !== "string" || !author.userId || content?.type !== "text" || typeof content.text !== "string" || !mentions || !createdAt || ["id", "tenantId", "workspaceId", "projectId", "roomId"].some((key5) => typeof values[key5] !== "string" || !values[key5])) return void 0;
|
|
34168
34251
|
return {
|
|
34169
34252
|
id: values.id,
|
|
34170
34253
|
tenantId: values.tenantId,
|
|
@@ -34199,7 +34282,7 @@ function snapshotMembership(value) {
|
|
|
34199
34282
|
const values = exactValues(value, required, ["responsibility"]);
|
|
34200
34283
|
const joinedAt = date(values?.joinedAt);
|
|
34201
34284
|
const updatedAt = date(values?.updatedAt);
|
|
34202
|
-
if (!values || required.slice(0, 7).some((
|
|
34285
|
+
if (!values || required.slice(0, 7).some((key5) => typeof values[key5] !== "string" || !values[key5]) || values.role !== "coordinator" && values.role !== "specialist" || typeof values.title !== "string" || !values.title || typeof values.mentionName !== "string" || !values.mentionName || !["active", "paused", "removed"].includes(values.status) || typeof values.roomThreadId !== "string" || !values.roomThreadId || values.responsibility !== void 0 && typeof values.responsibility !== "string" || !joinedAt || !updatedAt) return void 0;
|
|
34203
34286
|
return { ...values, joinedAt, updatedAt };
|
|
34204
34287
|
}
|
|
34205
34288
|
function snapshotCanonical(value, expected) {
|
|
@@ -34336,12 +34419,12 @@ function sameRosterScope(membership, scope) {
|
|
|
34336
34419
|
}
|
|
34337
34420
|
function snapshotScope(value, keys) {
|
|
34338
34421
|
const values = (0, import_protocols28.snapshotExactRecord)(value, keys);
|
|
34339
|
-
if (!values || keys.some((
|
|
34422
|
+
if (!values || keys.some((key5) => !isNonemptyString(values[key5]))) return void 0;
|
|
34340
34423
|
return values;
|
|
34341
34424
|
}
|
|
34342
34425
|
function projectScope(scope, keys) {
|
|
34343
34426
|
const projected = {};
|
|
34344
|
-
for (const
|
|
34427
|
+
for (const key5 of keys) projected[key5] = scope[key5];
|
|
34345
34428
|
return projected;
|
|
34346
34429
|
}
|
|
34347
34430
|
function snapshotMembership2(value) {
|
|
@@ -34583,7 +34666,7 @@ function detailOf(item) {
|
|
|
34583
34666
|
return null;
|
|
34584
34667
|
}
|
|
34585
34668
|
const parsed = { key: impact.key, after: impact.after, basis: impact.basis };
|
|
34586
|
-
if (Object.keys(impact).some((
|
|
34669
|
+
if (Object.keys(impact).some((key5) => !(key5 in parsed))) return null;
|
|
34587
34670
|
beliefImpact.push(parsed);
|
|
34588
34671
|
}
|
|
34589
34672
|
let beliefOwner;
|
|
@@ -34749,17 +34832,17 @@ function clearInterruptionContext(current) {
|
|
|
34749
34832
|
delete remaining.interruption;
|
|
34750
34833
|
return Object.keys(remaining).length > 0 ? remaining : null;
|
|
34751
34834
|
}
|
|
34752
|
-
function withLifecycleAudit(current,
|
|
34835
|
+
function withLifecycleAudit(current, key5, value) {
|
|
34753
34836
|
const context = clearInterruptionContext(current) ?? {};
|
|
34754
|
-
return { ...context, [
|
|
34837
|
+
return { ...context, [key5]: value };
|
|
34755
34838
|
}
|
|
34756
34839
|
function withCompletionAudit(current, evidenceId, eventKey) {
|
|
34757
34840
|
return { ...current ?? {}, lifecycle_completion_audit: { evidenceId, eventKey } };
|
|
34758
34841
|
}
|
|
34759
|
-
function withoutContextKey(current,
|
|
34842
|
+
function withoutContextKey(current, key5) {
|
|
34760
34843
|
if (!current) return null;
|
|
34761
34844
|
const remaining = { ...current };
|
|
34762
|
-
delete remaining[
|
|
34845
|
+
delete remaining[key5];
|
|
34763
34846
|
return Object.keys(remaining).length > 0 ? remaining : null;
|
|
34764
34847
|
}
|
|
34765
34848
|
function preserveTargetContract(current, proposed) {
|
|
@@ -34783,9 +34866,9 @@ function changedBeliefKeys(left, right) {
|
|
|
34783
34866
|
const leftByKey = new Map(left.map((entry) => [entry.key, entry]));
|
|
34784
34867
|
const rightByKey = new Map(right.map((entry) => [entry.key, entry]));
|
|
34785
34868
|
const keys = /* @__PURE__ */ new Set([...leftByKey.keys(), ...rightByKey.keys()]);
|
|
34786
|
-
return [...keys].filter((
|
|
34787
|
-
const oldEntry = leftByKey.get(
|
|
34788
|
-
const newEntry = rightByKey.get(
|
|
34869
|
+
return [...keys].filter((key5) => {
|
|
34870
|
+
const oldEntry = leftByKey.get(key5);
|
|
34871
|
+
const newEntry = rightByKey.get(key5);
|
|
34789
34872
|
return !oldEntry || !newEntry || !(0, import_protocols30.taskBeliefStatesEqual)(
|
|
34790
34873
|
{ entries: [oldEntry] },
|
|
34791
34874
|
{ entries: [newEntry] }
|
|
@@ -35803,7 +35886,7 @@ var TaskLifecycleService = class {
|
|
|
35803
35886
|
const markdown = [
|
|
35804
35887
|
"## Belief Reconciliation",
|
|
35805
35888
|
"",
|
|
35806
|
-
`Changed beliefs: ${changedKeys.map((
|
|
35889
|
+
`Changed beliefs: ${changedKeys.map((key5) => `\`${key5}\``).join(", ")}.`
|
|
35807
35890
|
].join("\n");
|
|
35808
35891
|
try {
|
|
35809
35892
|
await this.deps.workItemStore.createIfAbsentByEventKey({
|
|
@@ -36280,9 +36363,9 @@ var TaskLifecycleService = class {
|
|
|
36280
36363
|
]);
|
|
36281
36364
|
let maxAttempt = 0;
|
|
36282
36365
|
for (const item of [...decisions, ...evidence]) {
|
|
36283
|
-
const
|
|
36284
|
-
if (!
|
|
36285
|
-
const match =
|
|
36366
|
+
const key5 = typeof item.detail?.eventKey === "string" ? item.detail.eventKey : item.eventKey;
|
|
36367
|
+
if (!key5 || baseAttemptEventKey(key5) !== baseEventKey) continue;
|
|
36368
|
+
const match = key5.match(/:attempt:(\d+)$/);
|
|
36286
36369
|
maxAttempt = Math.max(maxAttempt, match ? Number(match[1]) : 1);
|
|
36287
36370
|
}
|
|
36288
36371
|
return maxAttempt === 0 ? baseEventKey : `${baseEventKey}:attempt:${maxAttempt + 1}`;
|
|
@@ -36582,8 +36665,8 @@ var TaskLifecycleService = class {
|
|
|
36582
36665
|
}
|
|
36583
36666
|
return resumed;
|
|
36584
36667
|
}
|
|
36585
|
-
async clearAuditMarker(task,
|
|
36586
|
-
const context = withoutContextKey(task.context,
|
|
36668
|
+
async clearAuditMarker(task, key5) {
|
|
36669
|
+
const context = withoutContextKey(task.context, key5);
|
|
36587
36670
|
try {
|
|
36588
36671
|
return await this.deps.taskStore.updateIfStatusAndUpdatedAt(
|
|
36589
36672
|
task.tenantId,
|
|
@@ -36735,16 +36818,16 @@ function serializedStringBytes(value) {
|
|
|
36735
36818
|
}
|
|
36736
36819
|
return typedArrayByteLength(encodeUtf8(stringifyJson(value)));
|
|
36737
36820
|
}
|
|
36738
|
-
function validatePropertyKey(
|
|
36739
|
-
if (
|
|
36821
|
+
function validatePropertyKey(key5) {
|
|
36822
|
+
if (key5.length > JSON_SAFE_MAX_PROPERTY_KEY_LENGTH) {
|
|
36740
36823
|
fail(
|
|
36741
36824
|
"MAX_STRING_LENGTH",
|
|
36742
36825
|
`JSON-safe property key exceeds ${JSON_SAFE_MAX_PROPERTY_KEY_LENGTH} characters`
|
|
36743
36826
|
);
|
|
36744
36827
|
}
|
|
36745
36828
|
}
|
|
36746
|
-
function chargePropertyKey(state,
|
|
36747
|
-
state.propertyKeyBytes += typedArrayByteLength(encodeUtf8(
|
|
36829
|
+
function chargePropertyKey(state, key5) {
|
|
36830
|
+
state.propertyKeyBytes += typedArrayByteLength(encodeUtf8(key5));
|
|
36748
36831
|
if (state.propertyKeyBytes > JSON_SAFE_MAX_PROPERTY_KEY_BYTES) {
|
|
36749
36832
|
fail(
|
|
36750
36833
|
"MAX_PROPERTY_KEY_BYTES",
|
|
@@ -36764,8 +36847,8 @@ function chargeBytes(state, bytes) {
|
|
|
36764
36847
|
function chargeString(state, value) {
|
|
36765
36848
|
chargeBytes(state, serializedStringBytes(value));
|
|
36766
36849
|
}
|
|
36767
|
-
function objectPropertyPath(path8,
|
|
36768
|
-
const boundedKey =
|
|
36850
|
+
function objectPropertyPath(path8, key5) {
|
|
36851
|
+
const boundedKey = key5.length > 128 ? `${stringSlice(key5, 0, 128)}...` : key5;
|
|
36769
36852
|
return `${path8}[${stringifyJson(boundedKey)}]`;
|
|
36770
36853
|
}
|
|
36771
36854
|
function convertJsonValue(value, state, depth, inArray, path8) {
|
|
@@ -36868,27 +36951,27 @@ function convertJsonValue(value, state, depth, inArray, path8) {
|
|
|
36868
36951
|
);
|
|
36869
36952
|
}
|
|
36870
36953
|
for (let index = 0; index < keys.length; index += 1) {
|
|
36871
|
-
const
|
|
36872
|
-
if (typeof
|
|
36873
|
-
validatePropertyKey(
|
|
36874
|
-
chargePropertyKey(state,
|
|
36954
|
+
const key5 = keys[index];
|
|
36955
|
+
if (typeof key5 !== "string") continue;
|
|
36956
|
+
validatePropertyKey(key5);
|
|
36957
|
+
chargePropertyKey(state, key5);
|
|
36875
36958
|
}
|
|
36876
36959
|
chargeBytes(state, 2);
|
|
36877
36960
|
const result = objectCreate(null);
|
|
36878
36961
|
let emittedProperties = 0;
|
|
36879
36962
|
for (let index = 0; index < keys.length; index += 1) {
|
|
36880
|
-
const
|
|
36881
|
-
const entryPath = typeof
|
|
36963
|
+
const key5 = keys[index];
|
|
36964
|
+
const entryPath = typeof key5 === "string" ? objectPropertyPath(path8, key5) : path8;
|
|
36882
36965
|
const descriptor = propertyAccess(
|
|
36883
|
-
() => reflectGetOwnPropertyDescriptor(value,
|
|
36966
|
+
() => reflectGetOwnPropertyDescriptor(value, key5),
|
|
36884
36967
|
entryPath
|
|
36885
36968
|
);
|
|
36886
|
-
if (typeof
|
|
36887
|
-
const entry = propertyAccess(() => reflectGet(value,
|
|
36969
|
+
if (typeof key5 !== "string" || !descriptor?.enumerable) continue;
|
|
36970
|
+
const entry = propertyAccess(() => reflectGet(value, key5), entryPath);
|
|
36888
36971
|
const converted = convertJsonValue(entry, state, depth + 1, false, entryPath);
|
|
36889
36972
|
if (converted !== void 0) {
|
|
36890
|
-
chargeBytes(state, serializedStringBytes(
|
|
36891
|
-
propertyAccess(() => objectDefineProperty(result,
|
|
36973
|
+
chargeBytes(state, serializedStringBytes(key5) + 1 + (emittedProperties === 0 ? 0 : 1));
|
|
36974
|
+
propertyAccess(() => objectDefineProperty(result, key5, {
|
|
36892
36975
|
value: converted,
|
|
36893
36976
|
enumerable: true,
|
|
36894
36977
|
configurable: true,
|
|
@@ -37334,16 +37417,16 @@ function getEncryptionKey() {
|
|
|
37334
37417
|
if (cachedKey) {
|
|
37335
37418
|
return cachedKey;
|
|
37336
37419
|
}
|
|
37337
|
-
const
|
|
37338
|
-
cachedKey = (0, import_crypto8.pbkdf2Sync)(
|
|
37420
|
+
const key5 = process.env.LATTICE_ENCRYPTION_KEY || DEFAULT_ENCRYPTION_KEY;
|
|
37421
|
+
cachedKey = (0, import_crypto8.pbkdf2Sync)(key5, "lattice-encryption-salt", ITERATIONS, 32, "sha256");
|
|
37339
37422
|
if (!keyValidated) {
|
|
37340
37423
|
keyValidated = true;
|
|
37341
37424
|
validateEncryptionKey();
|
|
37342
37425
|
}
|
|
37343
37426
|
return cachedKey;
|
|
37344
37427
|
}
|
|
37345
|
-
function encrypt(plaintext,
|
|
37346
|
-
const actualKey =
|
|
37428
|
+
function encrypt(plaintext, key5) {
|
|
37429
|
+
const actualKey = key5 || getEncryptionKey();
|
|
37347
37430
|
const salt = (0, import_crypto8.randomBytes)(SALT_LENGTH);
|
|
37348
37431
|
const iv = (0, import_crypto8.randomBytes)(IV_LENGTH);
|
|
37349
37432
|
const derivedKey = (0, import_crypto8.pbkdf2Sync)(actualKey, salt, ITERATIONS, 32, "sha256");
|
|
@@ -37352,8 +37435,8 @@ function encrypt(plaintext, key4) {
|
|
|
37352
37435
|
const authTag = cipher.getAuthTag();
|
|
37353
37436
|
return Buffer.concat([salt, iv, encrypted, authTag]).toString("base64");
|
|
37354
37437
|
}
|
|
37355
|
-
function decrypt(encrypted,
|
|
37356
|
-
const actualKey =
|
|
37438
|
+
function decrypt(encrypted, key5) {
|
|
37439
|
+
const actualKey = key5 || getEncryptionKey();
|
|
37357
37440
|
const data = Buffer.from(encrypted, "base64");
|
|
37358
37441
|
const salt = data.subarray(0, SALT_LENGTH);
|
|
37359
37442
|
const iv = data.subarray(SALT_LENGTH, SALT_LENGTH + IV_LENGTH);
|
|
@@ -37997,15 +38080,15 @@ async function resolveClientFromConnections(connectionKey, buildResolved, runCon
|
|
|
37997
38080
|
"No semantic-metrics connection is configured for this tenant. Add a connection of type 'semantic-metrics' for the tenant, then select it (connections) or enable connectAll in the agent's middleware config."
|
|
37998
38081
|
);
|
|
37999
38082
|
}
|
|
38000
|
-
const
|
|
38001
|
-
if (!
|
|
38083
|
+
const key5 = connectionKey?.trim() || (resolved.length === 1 ? resolved[0].key : "");
|
|
38084
|
+
if (!key5) {
|
|
38002
38085
|
throw new Error(
|
|
38003
38086
|
`connectionKey is required. Available connections: ${available}`
|
|
38004
38087
|
);
|
|
38005
38088
|
}
|
|
38006
|
-
const entry = resolved.find((c) => c.key ===
|
|
38089
|
+
const entry = resolved.find((c) => c.key === key5);
|
|
38007
38090
|
if (!entry) {
|
|
38008
|
-
throw new Error(`Connection "${
|
|
38091
|
+
throw new Error(`Connection "${key5}" not found. Available connections: ${available}`);
|
|
38009
38092
|
}
|
|
38010
38093
|
const config = entry.config;
|
|
38011
38094
|
return new SemanticMetricsV2Client(config);
|
|
@@ -39270,7 +39353,7 @@ function getEffectiveCollectionScope(exeConfig, staticScope) {
|
|
|
39270
39353
|
const runtimeConfig = getRuntimeCapabilityConfig(exeConfig, "collection");
|
|
39271
39354
|
const hasRuntimeKeys = runtimeConfig !== void 0 && Object.prototype.hasOwnProperty.call(runtimeConfig, "collectionKeys");
|
|
39272
39355
|
const runtimeKeys = hasRuntimeKeys ? runtimeConfig.collectionKeys : void 0;
|
|
39273
|
-
const collectionKeys = Array.isArray(runtimeKeys) && runtimeKeys.every((
|
|
39356
|
+
const collectionKeys = Array.isArray(runtimeKeys) && runtimeKeys.every((key5) => typeof key5 === "string") ? runtimeKeys : hasRuntimeKeys ? [] : staticScope.collectionKeys;
|
|
39274
39357
|
const hasRuntimeConnectAll = runtimeConfig !== void 0 && Object.prototype.hasOwnProperty.call(runtimeConfig, "connectAll");
|
|
39275
39358
|
const connectAll = !hasRuntimeKeys && (hasRuntimeConnectAll ? runtimeConfig.connectAll === true && staticScope.connectAll !== false : staticScope.connectAll === true);
|
|
39276
39359
|
return { collectionKeys, connectAll };
|
|
@@ -39572,7 +39655,7 @@ var schema3 = import_zod62.default.object({
|
|
|
39572
39655
|
content: import_zod62.default.string().describe("Entry content text"),
|
|
39573
39656
|
metadata: import_zod62.default.record(import_zod62.default.unknown()).optional().describe("Metadata fields matching the collection schema")
|
|
39574
39657
|
});
|
|
39575
|
-
function
|
|
39658
|
+
function key2(t, n) {
|
|
39576
39659
|
return `${t}:${n}`;
|
|
39577
39660
|
}
|
|
39578
39661
|
var createAddEntryTool = (scope = { collectionKeys: [], connectAll: true }) => (0, import_langchain76.tool)(
|
|
@@ -39583,7 +39666,7 @@ var createAddEntryTool = (scope = { collectionKeys: [], connectAll: true }) => (
|
|
|
39583
39666
|
const tenantId2 = _exeConfig?.configurable?.runConfig?.tenantId || "default";
|
|
39584
39667
|
let vs;
|
|
39585
39668
|
try {
|
|
39586
|
-
vs = vectorStoreLatticeManager.getVectorStoreClient(
|
|
39669
|
+
vs = vectorStoreLatticeManager.getVectorStoreClient(key2(tenantId2, input.collection));
|
|
39587
39670
|
} catch {
|
|
39588
39671
|
const collection = await collectionLatticeManager.getCollection(tenantId2, input.collection);
|
|
39589
39672
|
if (!collection) return `Collection "${input.collection}" not found.`;
|
|
@@ -39615,7 +39698,7 @@ var schema4 = import_zod63.default.object({
|
|
|
39615
39698
|
content: import_zod63.default.string().optional().describe("New content"),
|
|
39616
39699
|
metadata: import_zod63.default.record(import_zod63.default.unknown()).optional().describe("New metadata")
|
|
39617
39700
|
});
|
|
39618
|
-
function
|
|
39701
|
+
function key3(t, n) {
|
|
39619
39702
|
return `${t}:${n}`;
|
|
39620
39703
|
}
|
|
39621
39704
|
var createUpdateEntryTool = (scope = { collectionKeys: [], connectAll: true }) => (0, import_langchain77.tool)(
|
|
@@ -39624,7 +39707,7 @@ var createUpdateEntryTool = (scope = { collectionKeys: [], connectAll: true }) =
|
|
|
39624
39707
|
const scopeError = validateCollectionScope(input.collection, _exeConfig, scope);
|
|
39625
39708
|
if (scopeError) return scopeError;
|
|
39626
39709
|
const tenantId2 = _exeConfig?.configurable?.runConfig?.tenantId || "default";
|
|
39627
|
-
const vs = vectorStoreLatticeManager.getVectorStoreClient(
|
|
39710
|
+
const vs = vectorStoreLatticeManager.getVectorStoreClient(key3(tenantId2, input.collection));
|
|
39628
39711
|
try {
|
|
39629
39712
|
await vs.delete({ filter: { _id: input.entryId } });
|
|
39630
39713
|
} catch {
|
|
@@ -39645,7 +39728,7 @@ var schema5 = import_zod64.default.object({
|
|
|
39645
39728
|
collection: import_zod64.default.string().describe("Collection name"),
|
|
39646
39729
|
entryId: import_zod64.default.string().describe("Entry ID to delete")
|
|
39647
39730
|
});
|
|
39648
|
-
function
|
|
39731
|
+
function key4(t, n) {
|
|
39649
39732
|
return `${t}:${n}`;
|
|
39650
39733
|
}
|
|
39651
39734
|
var createDeleteEntryTool = (scope = { collectionKeys: [], connectAll: true }) => (0, import_langchain78.tool)(
|
|
@@ -39654,7 +39737,7 @@ var createDeleteEntryTool = (scope = { collectionKeys: [], connectAll: true }) =
|
|
|
39654
39737
|
const scopeError = validateCollectionScope(input.collection, _exeConfig, scope);
|
|
39655
39738
|
if (scopeError) return scopeError;
|
|
39656
39739
|
const tenantId2 = _exeConfig?.configurable?.runConfig?.tenantId || "default";
|
|
39657
|
-
const vs = vectorStoreLatticeManager.getVectorStoreClient(
|
|
39740
|
+
const vs = vectorStoreLatticeManager.getVectorStoreClient(key4(tenantId2, input.collection));
|
|
39658
39741
|
await vs.delete({ filter: { _id: input.entryId } });
|
|
39659
39742
|
return `Entry ${input.entryId} deleted from "${input.collection}".`;
|
|
39660
39743
|
} catch {
|
|
@@ -40941,7 +41024,7 @@ function serializeTaskMutationSuccess(taskId, task, mutationCommitted, metadata
|
|
|
40941
41024
|
try {
|
|
40942
41025
|
const normal = objectCreate2(null);
|
|
40943
41026
|
normal.success = true;
|
|
40944
|
-
for (const
|
|
41027
|
+
for (const key5 of objectKeys(metadata)) normal[key5] = metadata[key5];
|
|
40945
41028
|
normal.data = task;
|
|
40946
41029
|
return stringifyJson2(normal);
|
|
40947
41030
|
} catch {
|
|
@@ -41202,9 +41285,9 @@ function notifyProjectTaskAdmission(task) {
|
|
|
41202
41285
|
function trustedSharedContext(context) {
|
|
41203
41286
|
const snapshot = context === void 0 ? {} : safeDataValue(context);
|
|
41204
41287
|
const safe = {};
|
|
41205
|
-
for (const [
|
|
41206
|
-
if (
|
|
41207
|
-
safe[
|
|
41288
|
+
for (const [key5, value] of Object.entries(snapshot)) {
|
|
41289
|
+
if (key5 === "thread_id" || key5 === "interruption" || key5.endsWith("_audit")) continue;
|
|
41290
|
+
safe[key5] = value;
|
|
41208
41291
|
}
|
|
41209
41292
|
return safe;
|
|
41210
41293
|
}
|
|
@@ -41214,11 +41297,11 @@ function safeDataValue(value, seen = /* @__PURE__ */ new Set()) {
|
|
|
41214
41297
|
if (!value || typeof value !== "object" || seen.has(value)) throw new Error("Invalid trusted task row");
|
|
41215
41298
|
seen.add(value);
|
|
41216
41299
|
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
41217
|
-
const entries = Object.entries(descriptors).filter(([
|
|
41300
|
+
const entries = Object.entries(descriptors).filter(([key5]) => !(Array.isArray(value) && key5 === "length"));
|
|
41218
41301
|
if (Object.getOwnPropertySymbols(value).length > 0 || entries.some(([, descriptor]) => !descriptor.enumerable || !("value" in descriptor))) {
|
|
41219
41302
|
throw new Error("Invalid trusted task row");
|
|
41220
41303
|
}
|
|
41221
|
-
const clone3 = Array.isArray(value) ? entries.sort(([a], [b]) => Number(a) - Number(b)).map(([, descriptor]) => safeDataValue(descriptor.value, seen)) : Object.fromEntries(entries.map(([
|
|
41304
|
+
const clone3 = Array.isArray(value) ? entries.sort(([a], [b]) => Number(a) - Number(b)).map(([, descriptor]) => safeDataValue(descriptor.value, seen)) : Object.fromEntries(entries.map(([key5, descriptor]) => [key5, safeDataValue(descriptor.value, seen)]));
|
|
41222
41305
|
seen.delete(value);
|
|
41223
41306
|
return clone3;
|
|
41224
41307
|
}
|
|
@@ -41226,7 +41309,7 @@ function safeTrustedListTask(value, scope) {
|
|
|
41226
41309
|
if (!value || typeof value !== "object" || Array.isArray(value)) return void 0;
|
|
41227
41310
|
const descriptors = Object.getOwnPropertyDescriptors(value);
|
|
41228
41311
|
const required = ["id", "tenantId", "workspaceId", "projectId", "ownerType", "ownerId", "title", "status", "priority", "createdAt", "updatedAt"];
|
|
41229
|
-
if (required.some((
|
|
41312
|
+
if (required.some((key5) => !descriptors[key5]?.enumerable || !("value" in descriptors[key5]))) return void 0;
|
|
41230
41313
|
let row;
|
|
41231
41314
|
try {
|
|
41232
41315
|
row = safeDataValue(value);
|
|
@@ -41627,7 +41710,7 @@ function canonicalValue(value) {
|
|
|
41627
41710
|
if (value instanceof Date) return value.toISOString();
|
|
41628
41711
|
if (Array.isArray(value)) return value.map(canonicalValue);
|
|
41629
41712
|
if (!value || typeof value !== "object") return value;
|
|
41630
|
-
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([
|
|
41713
|
+
return Object.fromEntries(Object.entries(value).sort(([left], [right]) => left.localeCompare(right)).map(([key5, entry]) => [key5, canonicalValue(entry)]));
|
|
41631
41714
|
}
|
|
41632
41715
|
function valuesEqual(left, right) {
|
|
41633
41716
|
return JSON.stringify(canonicalValue(left)) === JSON.stringify(canonicalValue(right));
|
|
@@ -44326,7 +44409,7 @@ function createParseDocumentTool({
|
|
|
44326
44409
|
const runtimeConnections = runtimeConfig && Object.prototype.hasOwnProperty.call(runtimeConfig, "connections") ? runtimeConfig.connections : void 0;
|
|
44327
44410
|
const hasRuntimeConnections = runtimeConfig !== void 0 && Object.prototype.hasOwnProperty.call(runtimeConfig, "connections");
|
|
44328
44411
|
const runtimeConnectAll = !hasRuntimeConnections && runtimeConfig?.connectAll === true && connectAll !== false;
|
|
44329
|
-
const effectiveConnections = Array.isArray(runtimeConnections) && runtimeConnections.every((
|
|
44412
|
+
const effectiveConnections = Array.isArray(runtimeConnections) && runtimeConnections.every((key5) => typeof key5 === "string") ? runtimeConnections : runtimeConnectAll ? [] : connections;
|
|
44330
44413
|
const effectiveConnectAll = !hasRuntimeConnections && runtimeConfig && typeof runtimeConfig.connectAll === "boolean" ? runtimeConfig.connectAll && connectAll !== false : !hasRuntimeConnections && connectAll === true;
|
|
44331
44414
|
if (hasRuntimeConnections || effectiveConnections.length > 0 || runtimeConfig?.connectAll === true) {
|
|
44332
44415
|
resolvedBaseUrl = "";
|
|
@@ -44852,7 +44935,7 @@ function createDocumentParserMiddleware(config) {
|
|
|
44852
44935
|
const connectAll = config.connectAll === true;
|
|
44853
44936
|
const baseUrl = config.baseUrl || "";
|
|
44854
44937
|
const apiKey = config.apiKey || "";
|
|
44855
|
-
const connections = Array.isArray(config.connections) ? config.connections.filter((
|
|
44938
|
+
const connections = Array.isArray(config.connections) ? config.connections.filter((key5) => typeof key5 === "string") : [];
|
|
44856
44939
|
return (0, import_langchain89.createMiddleware)({
|
|
44857
44940
|
name: "DocumentParser",
|
|
44858
44941
|
contextSchema,
|
|
@@ -44993,10 +45076,10 @@ var postSchema = import_zod71.z.object({
|
|
|
44993
45076
|
text: import_zod71.z.string().trim().min(1).max(2e4)
|
|
44994
45077
|
}).strict();
|
|
44995
45078
|
var listSchema = import_zod71.z.object({}).strict();
|
|
44996
|
-
function ownDataValue2(record,
|
|
45079
|
+
function ownDataValue2(record, key5) {
|
|
44997
45080
|
if (typeof record !== "object" || record === null || Array.isArray(record)) return void 0;
|
|
44998
45081
|
try {
|
|
44999
|
-
const descriptor = Object.getOwnPropertyDescriptor(record,
|
|
45082
|
+
const descriptor = Object.getOwnPropertyDescriptor(record, key5);
|
|
45000
45083
|
return (0, import_protocols36.descriptorDataValue)(descriptor)?.value;
|
|
45001
45084
|
} catch {
|
|
45002
45085
|
return void 0;
|
|
@@ -45046,7 +45129,7 @@ function snapshotMembership3(value) {
|
|
|
45046
45129
|
const values = exactValues2(value, required, ["responsibility"]);
|
|
45047
45130
|
const joinedAt = safeDate(values?.joinedAt);
|
|
45048
45131
|
const updatedAt = safeDate(values?.updatedAt);
|
|
45049
|
-
if (!values || !joinedAt || !updatedAt || required.slice(0, 6).some((
|
|
45132
|
+
if (!values || !joinedAt || !updatedAt || required.slice(0, 6).some((key5) => typeof values[key5] !== "string" || values[key5] === "") || values.role !== "coordinator" && values.role !== "specialist" || typeof values.title !== "string" || values.title === "" || typeof values.mentionName !== "string" || values.mentionName === "" || !["active", "paused", "removed"].includes(values.status) || typeof values.roomThreadId !== "string" || values.roomThreadId === "" || values.responsibility !== void 0 && typeof values.responsibility !== "string") return void 0;
|
|
45050
45133
|
return { ...values, joinedAt, updatedAt };
|
|
45051
45134
|
}
|
|
45052
45135
|
function snapshotRows(value) {
|
|
@@ -45530,8 +45613,8 @@ var IdRemapper = class {
|
|
|
45530
45613
|
}
|
|
45531
45614
|
if (typeof value === "object") {
|
|
45532
45615
|
const result = {};
|
|
45533
|
-
for (const [
|
|
45534
|
-
result[
|
|
45616
|
+
for (const [key5, val] of Object.entries(value)) {
|
|
45617
|
+
result[key5] = this.remapReferences(val);
|
|
45535
45618
|
}
|
|
45536
45619
|
return result;
|
|
45537
45620
|
}
|
|
@@ -45630,6 +45713,7 @@ registerBuiltinPlugins();
|
|
|
45630
45713
|
InMemoryProjectMembershipStore,
|
|
45631
45714
|
InMemoryProjectRoomCoordinator,
|
|
45632
45715
|
InMemoryProjectRoomMessageStore,
|
|
45716
|
+
InMemoryProjectRoomReadStateStore,
|
|
45633
45717
|
InMemoryProjectRoomStore,
|
|
45634
45718
|
InMemoryTaskListStore,
|
|
45635
45719
|
InMemoryTaskStore,
|