@ai-matrx/agents 0.7.1 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +225 -0
- package/dist/catalog/index.cjs +119 -6
- package/dist/catalog/index.cjs.map +1 -1
- package/dist/catalog/index.d.cts +17 -521
- package/dist/catalog/index.d.ts +17 -521
- package/dist/catalog/index.js +119 -6
- package/dist/catalog/index.js.map +1 -1
- package/dist/catalog/native/index.cjs +2806 -0
- package/dist/catalog/native/index.cjs.map +1 -0
- package/dist/catalog/native/index.d.cts +655 -0
- package/dist/catalog/native/index.d.ts +655 -0
- package/dist/catalog/native/index.js +2802 -0
- package/dist/catalog/native/index.js.map +1 -0
- package/dist/catalog/react/index.cjs +527 -384
- package/dist/catalog/react/index.cjs.map +1 -1
- package/dist/catalog/react/index.d.cts +171 -32
- package/dist/catalog/react/index.d.ts +171 -32
- package/dist/catalog/react/index.js +414 -271
- package/dist/catalog/react/index.js.map +1 -1
- package/dist/orchestra-BWJM2MWP.d.cts +643 -0
- package/dist/orchestra-BWJM2MWP.d.ts +643 -0
- package/package.json +22 -2
package/dist/catalog/index.js
CHANGED
|
@@ -8,6 +8,13 @@ function mandateAgentId(mandateKey) {
|
|
|
8
8
|
function isMandateAgentId(id) {
|
|
9
9
|
return id.startsWith("mandate:");
|
|
10
10
|
}
|
|
11
|
+
var SORT_OPTIONS = [
|
|
12
|
+
{ value: "updated-desc", label: "Recent" },
|
|
13
|
+
{ value: "created-desc", label: "Created" },
|
|
14
|
+
{ value: "name-asc", label: "A \u2192 Z" },
|
|
15
|
+
{ value: "name-desc", label: "Z \u2192 A" },
|
|
16
|
+
{ value: "category-asc", label: "Category" }
|
|
17
|
+
];
|
|
11
18
|
var AGENT_NONE_SENTINEL = "__none__";
|
|
12
19
|
var DEFAULT_AGENT_CONSUMER_STATE = {
|
|
13
20
|
tab: "mine",
|
|
@@ -77,6 +84,18 @@ function stringArray(value) {
|
|
|
77
84
|
function agentType(value) {
|
|
78
85
|
return value === "builtin" ? "builtin" : "user";
|
|
79
86
|
}
|
|
87
|
+
function orchestraBadge(value) {
|
|
88
|
+
if (!isRecord(value)) return null;
|
|
89
|
+
const depth = value["depth_budget"];
|
|
90
|
+
const count = value["member_count"];
|
|
91
|
+
return {
|
|
92
|
+
mode: str(value["mode"]) ?? "supervisor",
|
|
93
|
+
tagline: str(value["tagline"]),
|
|
94
|
+
depthBudget: typeof depth === "number" && Number.isFinite(depth) && depth > 0 ? depth : null,
|
|
95
|
+
memberCount: typeof count === "number" && Number.isFinite(count) && count >= 0 ? count : 0,
|
|
96
|
+
memberTitles: stringArray(value["member_titles"])
|
|
97
|
+
};
|
|
98
|
+
}
|
|
80
99
|
function toAgentSummary(raw) {
|
|
81
100
|
if (!isRecord(raw)) return null;
|
|
82
101
|
const id = str(raw["id"]);
|
|
@@ -100,7 +119,8 @@ function toAgentSummary(raw) {
|
|
|
100
119
|
updatedAt: str(raw["updated_at"]),
|
|
101
120
|
isOwner: boolOrNull(raw["is_owner"]),
|
|
102
121
|
accessLevel: str(raw["access_level"]),
|
|
103
|
-
sharedByEmail: str(raw["shared_by_email"])
|
|
122
|
+
sharedByEmail: str(raw["shared_by_email"]),
|
|
123
|
+
orchestra: orchestraBadge(raw["orchestra"])
|
|
104
124
|
};
|
|
105
125
|
}
|
|
106
126
|
|
|
@@ -317,6 +337,51 @@ function writeCachedDefaultRow(storage, resolved) {
|
|
|
317
337
|
} catch {
|
|
318
338
|
}
|
|
319
339
|
}
|
|
340
|
+
function parseCachedDefaultRow(mandateKey, raw) {
|
|
341
|
+
try {
|
|
342
|
+
if (!raw) return null;
|
|
343
|
+
const parsed = JSON.parse(raw);
|
|
344
|
+
if (!isRecord2(parsed)) return null;
|
|
345
|
+
const holderId = parsed["holderId"];
|
|
346
|
+
const holderName = parsed["holderName"];
|
|
347
|
+
if (typeof holderId !== "string" || typeof holderName !== "string") {
|
|
348
|
+
return null;
|
|
349
|
+
}
|
|
350
|
+
const description = parsed["holderDescription"];
|
|
351
|
+
const provenance = parsed["provenance"];
|
|
352
|
+
const at = parsed["at"];
|
|
353
|
+
return {
|
|
354
|
+
mandateKey,
|
|
355
|
+
holderId,
|
|
356
|
+
holderName,
|
|
357
|
+
holderDescription: typeof description === "string" ? description : null,
|
|
358
|
+
provenance: typeof provenance === "string" ? provenance : "system",
|
|
359
|
+
at: typeof at === "number" ? at : 0
|
|
360
|
+
};
|
|
361
|
+
} catch {
|
|
362
|
+
return null;
|
|
363
|
+
}
|
|
364
|
+
}
|
|
365
|
+
async function readCachedDefaultRowAsync(storage, mandateKey) {
|
|
366
|
+
let raw;
|
|
367
|
+
try {
|
|
368
|
+
raw = await storage.getItem(
|
|
369
|
+
CACHE_PREFIX + mandateKey
|
|
370
|
+
);
|
|
371
|
+
} catch {
|
|
372
|
+
return null;
|
|
373
|
+
}
|
|
374
|
+
return parseCachedDefaultRow(mandateKey, raw);
|
|
375
|
+
}
|
|
376
|
+
async function writeCachedDefaultRowAsync(storage, resolved) {
|
|
377
|
+
try {
|
|
378
|
+
await storage.setItem(
|
|
379
|
+
CACHE_PREFIX + resolved.mandateKey,
|
|
380
|
+
JSON.stringify(resolved)
|
|
381
|
+
);
|
|
382
|
+
} catch {
|
|
383
|
+
}
|
|
384
|
+
}
|
|
320
385
|
function defaultRowFromResolution(resolved) {
|
|
321
386
|
return {
|
|
322
387
|
id: mandateAgentId(resolved.mandateKey),
|
|
@@ -338,6 +403,9 @@ function defaultRowFromResolution(resolved) {
|
|
|
338
403
|
isOwner: null,
|
|
339
404
|
accessLevel: null,
|
|
340
405
|
sharedByEmail: null,
|
|
406
|
+
// A mandate default row is a live reference to whichever agent the mandate
|
|
407
|
+
// resolves to; the badge belongs to the RESOLVED agent's own catalog row.
|
|
408
|
+
orchestra: null,
|
|
341
409
|
mandateKey: resolved.mandateKey
|
|
342
410
|
};
|
|
343
411
|
}
|
|
@@ -353,7 +421,7 @@ function detectDefaultRowDrift(cached, live) {
|
|
|
353
421
|
}
|
|
354
422
|
async function resolveDefaultRow(args) {
|
|
355
423
|
const { mandateKey, transport, client, storage, lookupRow } = args;
|
|
356
|
-
const cached =
|
|
424
|
+
const cached = await readCachedDefaultRowAsync(storage, mandateKey);
|
|
357
425
|
const verdict = await askTheServer(transport, mandateKey);
|
|
358
426
|
if (verdict.holderType !== "agent") {
|
|
359
427
|
throw new MandateDefaultRowError({
|
|
@@ -390,7 +458,7 @@ async function resolveDefaultRow(args) {
|
|
|
390
458
|
at: Date.now()
|
|
391
459
|
};
|
|
392
460
|
const drift = detectDefaultRowDrift(cached, resolved);
|
|
393
|
-
|
|
461
|
+
await writeCachedDefaultRowAsync(storage, resolved);
|
|
394
462
|
return { resolved, row: defaultRowFromResolution(resolved), drift };
|
|
395
463
|
}
|
|
396
464
|
|
|
@@ -442,10 +510,14 @@ async function assertAgentCatalogSchema(client, options = {}) {
|
|
|
442
510
|
const missing = [];
|
|
443
511
|
const unreachable = [];
|
|
444
512
|
const answered = [];
|
|
513
|
+
let orchestraColumn = null;
|
|
445
514
|
for (const fn of names) {
|
|
446
515
|
const args = DEMANDED_RPCS[fn] ?? {};
|
|
447
516
|
try {
|
|
448
|
-
const { error } = await client.rpc(fn, args);
|
|
517
|
+
const { data, error } = await client.rpc(fn, args);
|
|
518
|
+
if (fn === "agx_get_list_full" && error == null) {
|
|
519
|
+
orchestraColumn = readsOrchestraColumn(data);
|
|
520
|
+
}
|
|
449
521
|
if (error == null) answered.push(fn);
|
|
450
522
|
else if (isMissingFunctionError(error)) missing.push(fn);
|
|
451
523
|
else answered.push(fn);
|
|
@@ -485,7 +557,8 @@ async function assertAgentCatalogSchema(client, options = {}) {
|
|
|
485
557
|
missing,
|
|
486
558
|
unreachable,
|
|
487
559
|
answered,
|
|
488
|
-
favoriteWritable
|
|
560
|
+
favoriteWritable,
|
|
561
|
+
orchestraColumn
|
|
489
562
|
};
|
|
490
563
|
if (!ok && throwOnViolation) {
|
|
491
564
|
const parts = [];
|
|
@@ -503,6 +576,12 @@ async function assertAgentCatalogSchema(client, options = {}) {
|
|
|
503
576
|
}
|
|
504
577
|
return report;
|
|
505
578
|
}
|
|
579
|
+
function readsOrchestraColumn(data) {
|
|
580
|
+
if (!Array.isArray(data) || data.length === 0) return null;
|
|
581
|
+
return data.some(
|
|
582
|
+
(row) => typeof row === "object" && row !== null && Object.prototype.hasOwnProperty.call(row, "orchestra")
|
|
583
|
+
);
|
|
584
|
+
}
|
|
506
585
|
function isPermissionRefusal(error) {
|
|
507
586
|
if (!error) return false;
|
|
508
587
|
const code = error.code;
|
|
@@ -876,6 +955,33 @@ function getRegisteredAgentCatalog(catalogId = "default") {
|
|
|
876
955
|
return found;
|
|
877
956
|
}
|
|
878
957
|
|
|
958
|
+
// catalog/orchestra.ts
|
|
959
|
+
var ORCHESTRA_MODE_LABEL = {
|
|
960
|
+
supervisor: "supervisor",
|
|
961
|
+
sequential: "in order",
|
|
962
|
+
parallel: "together",
|
|
963
|
+
dag: "custom flow"
|
|
964
|
+
};
|
|
965
|
+
function orchestraModeLabel(mode) {
|
|
966
|
+
return ORCHESTRA_MODE_LABEL[mode] ?? mode;
|
|
967
|
+
}
|
|
968
|
+
function orchestraLabel(badge) {
|
|
969
|
+
const n = badge.memberCount;
|
|
970
|
+
return `Orchestra \xB7 ${orchestraModeLabel(badge.mode)} \xB7 ${n} ${n === 1 ? "member" : "members"}`;
|
|
971
|
+
}
|
|
972
|
+
function orchestraDepthLine(badge) {
|
|
973
|
+
const n = badge.depthBudget;
|
|
974
|
+
if (typeof n !== "number" || n <= 0) return null;
|
|
975
|
+
return `Team members can call helpers up to ${n} ${n === 1 ? "level" : "levels"} deep`;
|
|
976
|
+
}
|
|
977
|
+
function orchestraDelegatesLine(badge, limit = 3) {
|
|
978
|
+
const titles = badge.memberTitles;
|
|
979
|
+
if (titles.length === 0) return null;
|
|
980
|
+
const shown = titles.slice(0, limit);
|
|
981
|
+
const extra = titles.length - shown.length;
|
|
982
|
+
return `Delegates to: ${shown.join(", ")}${extra > 0 ? ` +${extra} more` : ""}`;
|
|
983
|
+
}
|
|
984
|
+
|
|
879
985
|
// catalog/labels.ts
|
|
880
986
|
function agentListEmptyLabel(tab, labels) {
|
|
881
987
|
switch (tab) {
|
|
@@ -1264,6 +1370,7 @@ export {
|
|
|
1264
1370
|
DEFAULT_AGENT_CATALOG_LABELS,
|
|
1265
1371
|
DEFAULT_AGENT_CONSUMER_STATE,
|
|
1266
1372
|
MandateDefaultRowError,
|
|
1373
|
+
SORT_OPTIONS,
|
|
1267
1374
|
_resetCatalogGlobalState,
|
|
1268
1375
|
agentConsumerHasActiveFilters,
|
|
1269
1376
|
agentListEmptyLabel,
|
|
@@ -1295,9 +1402,14 @@ export {
|
|
|
1295
1402
|
memoize1,
|
|
1296
1403
|
memoize2,
|
|
1297
1404
|
memoize3,
|
|
1405
|
+
orchestraDelegatesLine,
|
|
1406
|
+
orchestraDepthLine,
|
|
1407
|
+
orchestraLabel,
|
|
1408
|
+
orchestraModeLabel,
|
|
1298
1409
|
parseMandateResolution,
|
|
1299
1410
|
readAgentCatalogRows,
|
|
1300
1411
|
readCachedDefaultRow,
|
|
1412
|
+
readCachedDefaultRowAsync,
|
|
1301
1413
|
readSingleAgentRow,
|
|
1302
1414
|
resolveDefaultRow,
|
|
1303
1415
|
searchAgentsOnServer,
|
|
@@ -1316,6 +1428,7 @@ export {
|
|
|
1316
1428
|
sortFilteredAgents,
|
|
1317
1429
|
toAgentSummary,
|
|
1318
1430
|
writeAgentFavorite,
|
|
1319
|
-
writeCachedDefaultRow
|
|
1431
|
+
writeCachedDefaultRow,
|
|
1432
|
+
writeCachedDefaultRowAsync
|
|
1320
1433
|
};
|
|
1321
1434
|
//# sourceMappingURL=index.js.map
|