@standardagents/builder 0.12.9 → 0.13.0-next.c55f029
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/built-in-routes.js +6327 -2398
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/assets/index.css +1 -1
- package/dist/client/index.js +29 -29
- package/dist/client/vendor.js +1 -1
- package/dist/client/vue.js +1 -1
- package/dist/{discovery-CpMs68Yx.d.ts → discovery-DVviz3By.d.ts} +3 -1
- package/dist/{index-DkbUJ4MM.d.ts → index-T0gR5l-G.d.ts} +228 -4
- package/dist/index.d.ts +338 -17
- package/dist/index.js +7999 -2305
- package/dist/index.js.map +1 -1
- package/dist/packing.d.ts +35 -3
- package/dist/packing.js +245 -12
- package/dist/packing.js.map +1 -1
- package/dist/plugin.js +1047 -227
- package/dist/plugin.js.map +1 -1
- package/dist/test.d.ts +2 -2
- package/dist/{types-pLkJx8vg.d.ts → types-DH3Egc5l.d.ts} +27 -5
- package/package.json +4 -4
package/dist/packing.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { P as PackingAnalysis, a as PackingOptions, b as PackingResult, d as UnpackAnalysis, U as UnpackOptions, c as UnpackResult } from './types-
|
|
2
|
-
export { D as DiscoveredPackage } from './types-
|
|
3
|
-
export { P as PackageDiscoveryService, d as discoverPackages } from './discovery-
|
|
1
|
+
import { P as PackingAnalysis, a as PackingOptions, b as PackingResult, d as UnpackAnalysis, U as UnpackOptions, c as UnpackResult } from './types-DH3Egc5l.js';
|
|
2
|
+
export { D as DiscoveredPackage } from './types-DH3Egc5l.js';
|
|
3
|
+
export { P as PackageDiscoveryService, d as discoverPackages } from './discovery-DVviz3By.js';
|
|
4
4
|
import '@standardagents/spec';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -57,6 +57,36 @@ declare class PackingService {
|
|
|
57
57
|
generatedReadme: string;
|
|
58
58
|
agentDescription?: string;
|
|
59
59
|
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Analyze thread endpoints from agents/api and include them as packed constituents.
|
|
62
|
+
*
|
|
63
|
+
* Thread endpoints are not directly referenced by agent/prompt definitions, so we
|
|
64
|
+
* include all endpoint modules discovered under agents/api.
|
|
65
|
+
*/
|
|
66
|
+
private analyzeThreadEndpoints;
|
|
67
|
+
/**
|
|
68
|
+
* Recursively scan agents/api for endpoint source files.
|
|
69
|
+
*
|
|
70
|
+
* Returns endpoint keys like:
|
|
71
|
+
* - `status.get`
|
|
72
|
+
* - `admin/users/[userId]/sync.post`
|
|
73
|
+
*/
|
|
74
|
+
private scanThreadEndpointFiles;
|
|
75
|
+
/**
|
|
76
|
+
* Analyze effects from agents/effects and include them as packed constituents.
|
|
77
|
+
*
|
|
78
|
+
* Effects are referenced by string names at runtime via scheduleEffect(), so we
|
|
79
|
+
* include all effect modules discovered under agents/effects.
|
|
80
|
+
*/
|
|
81
|
+
private analyzeEffects;
|
|
82
|
+
/**
|
|
83
|
+
* Recursively scan agents/effects for effect source files.
|
|
84
|
+
*
|
|
85
|
+
* Returns effect keys like:
|
|
86
|
+
* - `send_email`
|
|
87
|
+
* - `notifications/digest`
|
|
88
|
+
*/
|
|
89
|
+
private scanEffectFiles;
|
|
60
90
|
/**
|
|
61
91
|
* Recursively analyze a prompt and its dependencies.
|
|
62
92
|
*/
|
|
@@ -87,6 +117,8 @@ declare class PackingService {
|
|
|
87
117
|
*
|
|
88
118
|
* The packing format creates:
|
|
89
119
|
* - dist/{type}/{name}.js - Individual bundled files per constituent
|
|
120
|
+
* - dist/effects/** - Packed effect modules
|
|
121
|
+
* - dist/thread-endpoints/** - Packed thread endpoint modules
|
|
90
122
|
* - dist/index.js - Re-exports and lazy loaders
|
|
91
123
|
* - dist/index.d.ts - TypeScript type definitions
|
|
92
124
|
* - package.json - With standardagent field and dependencies
|
package/dist/packing.js
CHANGED
|
@@ -533,13 +533,17 @@ var PackingService = class {
|
|
|
533
533
|
tools: [],
|
|
534
534
|
models: [],
|
|
535
535
|
hooks: [],
|
|
536
|
-
|
|
536
|
+
effects: [],
|
|
537
|
+
agents: [],
|
|
538
|
+
threadEndpoints: []
|
|
537
539
|
},
|
|
538
540
|
shared: {
|
|
539
541
|
prompts: [],
|
|
540
542
|
tools: [],
|
|
541
543
|
models: [],
|
|
542
|
-
hooks: []
|
|
544
|
+
hooks: [],
|
|
545
|
+
effects: [],
|
|
546
|
+
threadEndpoints: []
|
|
543
547
|
},
|
|
544
548
|
warnings: [],
|
|
545
549
|
errors: []
|
|
@@ -564,6 +568,8 @@ var PackingService = class {
|
|
|
564
568
|
if (agentPrompts.sideB) {
|
|
565
569
|
await this.analyzePrompt(agentPrompts.sideB, agentsDir, analysis, /* @__PURE__ */ new Set(), `agent:${agentName}`);
|
|
566
570
|
}
|
|
571
|
+
await this.analyzeThreadEndpoints(agentsDir, analysis);
|
|
572
|
+
await this.analyzeEffects(agentsDir, analysis);
|
|
567
573
|
await this.checkSharedItems(agentsDir, analysis);
|
|
568
574
|
return analysis;
|
|
569
575
|
}
|
|
@@ -601,6 +607,138 @@ var PackingService = class {
|
|
|
601
607
|
);
|
|
602
608
|
return { generatedReadme, agentDescription };
|
|
603
609
|
}
|
|
610
|
+
/**
|
|
611
|
+
* Analyze thread endpoints from agents/api and include them as packed constituents.
|
|
612
|
+
*
|
|
613
|
+
* Thread endpoints are not directly referenced by agent/prompt definitions, so we
|
|
614
|
+
* include all endpoint modules discovered under agents/api.
|
|
615
|
+
*/
|
|
616
|
+
async analyzeThreadEndpoints(agentsDir, analysis) {
|
|
617
|
+
const apiDir = path2.join(agentsDir, "api");
|
|
618
|
+
const endpoints = this.scanThreadEndpointFiles(apiDir);
|
|
619
|
+
for (const endpoint of endpoints) {
|
|
620
|
+
if (analysis.constituents.threadEndpoints.some((item) => item.name === endpoint.name)) {
|
|
621
|
+
continue;
|
|
622
|
+
}
|
|
623
|
+
analysis.constituents.threadEndpoints.push({
|
|
624
|
+
name: endpoint.name,
|
|
625
|
+
filePath: endpoint.filePath,
|
|
626
|
+
discoveredVia: "thread-endpoint",
|
|
627
|
+
sharedWith: []
|
|
628
|
+
});
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
/**
|
|
632
|
+
* Recursively scan agents/api for endpoint source files.
|
|
633
|
+
*
|
|
634
|
+
* Returns endpoint keys like:
|
|
635
|
+
* - `status.get`
|
|
636
|
+
* - `admin/users/[userId]/sync.post`
|
|
637
|
+
*/
|
|
638
|
+
scanThreadEndpointFiles(apiDir, relativeDir = "") {
|
|
639
|
+
if (!fs2.existsSync(apiDir)) {
|
|
640
|
+
return [];
|
|
641
|
+
}
|
|
642
|
+
const endpoints = [];
|
|
643
|
+
const currentDir = relativeDir ? path2.join(apiDir, relativeDir) : apiDir;
|
|
644
|
+
if (!fs2.existsSync(currentDir)) {
|
|
645
|
+
return endpoints;
|
|
646
|
+
}
|
|
647
|
+
const entries = fs2.readdirSync(currentDir, { withFileTypes: true });
|
|
648
|
+
if (entries.length > 0 && typeof entries[0] === "string") {
|
|
649
|
+
return endpoints;
|
|
650
|
+
}
|
|
651
|
+
for (const entry of entries) {
|
|
652
|
+
const entryName = typeof entry === "string" ? entry : entry.name;
|
|
653
|
+
const isDirectory = typeof entry === "string" ? false : entry.isDirectory();
|
|
654
|
+
const isFile = typeof entry === "string" ? true : entry.isFile();
|
|
655
|
+
const entryRelative = relativeDir ? path2.posix.join(relativeDir.replace(/\\/g, "/"), entryName) : entryName;
|
|
656
|
+
const absolutePath = path2.join(apiDir, entryRelative);
|
|
657
|
+
if (isDirectory) {
|
|
658
|
+
endpoints.push(...this.scanThreadEndpointFiles(apiDir, entryRelative));
|
|
659
|
+
continue;
|
|
660
|
+
}
|
|
661
|
+
if (!isFile) {
|
|
662
|
+
continue;
|
|
663
|
+
}
|
|
664
|
+
if (!entryName.endsWith(".ts")) {
|
|
665
|
+
continue;
|
|
666
|
+
}
|
|
667
|
+
const endpointKey = entryRelative.replace(/\.ts$/, "").replace(/\\/g, "/");
|
|
668
|
+
endpoints.push({
|
|
669
|
+
name: endpointKey,
|
|
670
|
+
filePath: absolutePath
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
endpoints.sort((a, b) => a.name.localeCompare(b.name));
|
|
674
|
+
return endpoints;
|
|
675
|
+
}
|
|
676
|
+
/**
|
|
677
|
+
* Analyze effects from agents/effects and include them as packed constituents.
|
|
678
|
+
*
|
|
679
|
+
* Effects are referenced by string names at runtime via scheduleEffect(), so we
|
|
680
|
+
* include all effect modules discovered under agents/effects.
|
|
681
|
+
*/
|
|
682
|
+
async analyzeEffects(agentsDir, analysis) {
|
|
683
|
+
const effectsDir = path2.join(agentsDir, "effects");
|
|
684
|
+
const effects = this.scanEffectFiles(effectsDir);
|
|
685
|
+
for (const effect of effects) {
|
|
686
|
+
if (analysis.constituents.effects.some((item) => item.name === effect.name)) {
|
|
687
|
+
continue;
|
|
688
|
+
}
|
|
689
|
+
analysis.constituents.effects.push({
|
|
690
|
+
name: effect.name,
|
|
691
|
+
filePath: effect.filePath,
|
|
692
|
+
discoveredVia: "effect",
|
|
693
|
+
sharedWith: []
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
/**
|
|
698
|
+
* Recursively scan agents/effects for effect source files.
|
|
699
|
+
*
|
|
700
|
+
* Returns effect keys like:
|
|
701
|
+
* - `send_email`
|
|
702
|
+
* - `notifications/digest`
|
|
703
|
+
*/
|
|
704
|
+
scanEffectFiles(effectsDir, relativeDir = "") {
|
|
705
|
+
if (!fs2.existsSync(effectsDir)) {
|
|
706
|
+
return [];
|
|
707
|
+
}
|
|
708
|
+
const effects = [];
|
|
709
|
+
const currentDir = relativeDir ? path2.join(effectsDir, relativeDir) : effectsDir;
|
|
710
|
+
if (!fs2.existsSync(currentDir)) {
|
|
711
|
+
return effects;
|
|
712
|
+
}
|
|
713
|
+
const entries = fs2.readdirSync(currentDir, { withFileTypes: true });
|
|
714
|
+
if (entries.length > 0 && typeof entries[0] === "string") {
|
|
715
|
+
return effects;
|
|
716
|
+
}
|
|
717
|
+
for (const entry of entries) {
|
|
718
|
+
const entryName = typeof entry === "string" ? entry : entry.name;
|
|
719
|
+
const isDirectory = typeof entry === "string" ? false : entry.isDirectory();
|
|
720
|
+
const isFile = typeof entry === "string" ? true : entry.isFile();
|
|
721
|
+
const entryRelative = relativeDir ? path2.posix.join(relativeDir.replace(/\\/g, "/"), entryName) : entryName;
|
|
722
|
+
const absolutePath = path2.join(effectsDir, entryRelative);
|
|
723
|
+
if (isDirectory) {
|
|
724
|
+
effects.push(...this.scanEffectFiles(effectsDir, entryRelative));
|
|
725
|
+
continue;
|
|
726
|
+
}
|
|
727
|
+
if (!isFile || !entryName.endsWith(".ts")) {
|
|
728
|
+
continue;
|
|
729
|
+
}
|
|
730
|
+
if (entryName === "CLAUDE.md" || entryName === "AGENTS.md" || entryName.startsWith("_")) {
|
|
731
|
+
continue;
|
|
732
|
+
}
|
|
733
|
+
const effectKey = entryRelative.replace(/\.ts$/, "").replace(/\\/g, "/");
|
|
734
|
+
effects.push({
|
|
735
|
+
name: effectKey,
|
|
736
|
+
filePath: absolutePath
|
|
737
|
+
});
|
|
738
|
+
}
|
|
739
|
+
effects.sort((a, b) => a.name.localeCompare(b.name));
|
|
740
|
+
return effects;
|
|
741
|
+
}
|
|
604
742
|
/**
|
|
605
743
|
* Recursively analyze a prompt and its dependencies.
|
|
606
744
|
*/
|
|
@@ -824,6 +962,8 @@ var PackingService = class {
|
|
|
824
962
|
*
|
|
825
963
|
* The packing format creates:
|
|
826
964
|
* - dist/{type}/{name}.js - Individual bundled files per constituent
|
|
965
|
+
* - dist/effects/** - Packed effect modules
|
|
966
|
+
* - dist/thread-endpoints/** - Packed thread endpoint modules
|
|
827
967
|
* - dist/index.js - Re-exports and lazy loaders
|
|
828
968
|
* - dist/index.d.ts - TypeScript type definitions
|
|
829
969
|
* - package.json - With standardagent field and dependencies
|
|
@@ -876,6 +1016,8 @@ var PackingService = class {
|
|
|
876
1016
|
fs2.mkdirSync(path2.join(pkgOutputDir, "dist", "tools"), { recursive: true });
|
|
877
1017
|
fs2.mkdirSync(path2.join(pkgOutputDir, "dist", "models"), { recursive: true });
|
|
878
1018
|
fs2.mkdirSync(path2.join(pkgOutputDir, "dist", "hooks"), { recursive: true });
|
|
1019
|
+
fs2.mkdirSync(path2.join(pkgOutputDir, "dist", "effects"), { recursive: true });
|
|
1020
|
+
fs2.mkdirSync(path2.join(pkgOutputDir, "dist", "thread-endpoints"), { recursive: true });
|
|
879
1021
|
const seenItems = /* @__PURE__ */ new Set();
|
|
880
1022
|
const allItems = [];
|
|
881
1023
|
for (const a of analysis.constituents.agents) {
|
|
@@ -913,6 +1055,20 @@ var PackingService = class {
|
|
|
913
1055
|
allItems.push({ ...h, type: "hook" });
|
|
914
1056
|
}
|
|
915
1057
|
}
|
|
1058
|
+
for (const effect of analysis.constituents.effects) {
|
|
1059
|
+
const key = `effect:${effect.name}`;
|
|
1060
|
+
if (!seenItems.has(key)) {
|
|
1061
|
+
seenItems.add(key);
|
|
1062
|
+
allItems.push({ ...effect, type: "effect" });
|
|
1063
|
+
}
|
|
1064
|
+
}
|
|
1065
|
+
for (const endpoint of analysis.constituents.threadEndpoints) {
|
|
1066
|
+
const key = `thread-endpoint:${endpoint.name}`;
|
|
1067
|
+
if (!seenItems.has(key)) {
|
|
1068
|
+
seenItems.add(key);
|
|
1069
|
+
allItems.push({ ...endpoint, type: "thread-endpoint" });
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
916
1072
|
const externalDeps = /* @__PURE__ */ new Map();
|
|
917
1073
|
for (const item of allItems) {
|
|
918
1074
|
const outputPath = path2.join(
|
|
@@ -921,6 +1077,7 @@ var PackingService = class {
|
|
|
921
1077
|
this.getTypeDir(item.type),
|
|
922
1078
|
`${item.name}.js`
|
|
923
1079
|
);
|
|
1080
|
+
fs2.mkdirSync(path2.dirname(outputPath), { recursive: true });
|
|
924
1081
|
const deps = await this.bundleFile(item.filePath, outputPath, rootDir);
|
|
925
1082
|
for (const [depName, depVersion] of deps) {
|
|
926
1083
|
if (!externalDeps.has(depName)) {
|
|
@@ -941,6 +1098,8 @@ var PackingService = class {
|
|
|
941
1098
|
finalPackageName,
|
|
942
1099
|
version,
|
|
943
1100
|
agentName,
|
|
1101
|
+
this.deduplicateConstituents(analysis).effects.map((effect) => effect.name),
|
|
1102
|
+
this.deduplicateConstituents(analysis).threadEndpoints.map((endpoint) => endpoint.name),
|
|
944
1103
|
externalDeps,
|
|
945
1104
|
rootDir,
|
|
946
1105
|
license,
|
|
@@ -978,7 +1137,7 @@ var PackingService = class {
|
|
|
978
1137
|
result.filesRemoved = [];
|
|
979
1138
|
for (const item of allItems) {
|
|
980
1139
|
const selection = itemSelections?.find((s) => s.name === item.name && s.type === item.type);
|
|
981
|
-
const shouldRemove = selection ? selection.mode === "extract" : removeOriginals && item.sharedWith.length === 0;
|
|
1140
|
+
const shouldRemove = selection ? selection.mode === "extract" : removeOriginals && item.sharedWith.length === 0 && item.type !== "thread-endpoint" && item.type !== "effect";
|
|
982
1141
|
if (shouldRemove && fs2.existsSync(item.filePath)) {
|
|
983
1142
|
fs2.unlinkSync(item.filePath);
|
|
984
1143
|
result.filesRemoved.push(item.filePath);
|
|
@@ -1111,6 +1270,10 @@ var PackingService = class {
|
|
|
1111
1270
|
return "models";
|
|
1112
1271
|
case "hook":
|
|
1113
1272
|
return "hooks";
|
|
1273
|
+
case "effect":
|
|
1274
|
+
return "effects";
|
|
1275
|
+
case "thread-endpoint":
|
|
1276
|
+
return "thread-endpoints";
|
|
1114
1277
|
}
|
|
1115
1278
|
}
|
|
1116
1279
|
/**
|
|
@@ -1130,7 +1293,9 @@ var PackingService = class {
|
|
|
1130
1293
|
prompts: dedupe(analysis.constituents.prompts),
|
|
1131
1294
|
tools: dedupe(analysis.constituents.tools),
|
|
1132
1295
|
models: dedupe(analysis.constituents.models),
|
|
1133
|
-
hooks: dedupe(analysis.constituents.hooks)
|
|
1296
|
+
hooks: dedupe(analysis.constituents.hooks),
|
|
1297
|
+
effects: dedupe(analysis.constituents.effects),
|
|
1298
|
+
threadEndpoints: dedupe(analysis.constituents.threadEndpoints)
|
|
1134
1299
|
};
|
|
1135
1300
|
}
|
|
1136
1301
|
/**
|
|
@@ -1175,6 +1340,9 @@ var PackingService = class {
|
|
|
1175
1340
|
for (const hook of constituents.hooks) {
|
|
1176
1341
|
lines.push(`export { default as ${this.quoteName(hook.name)} } from './hooks/${hook.name}.js';`);
|
|
1177
1342
|
}
|
|
1343
|
+
for (const effect of constituents.effects) {
|
|
1344
|
+
lines.push(`export { default as ${this.quoteName(effect.name)} } from './effects/${effect.name}.js';`);
|
|
1345
|
+
}
|
|
1178
1346
|
lines.push("");
|
|
1179
1347
|
lines.push("// Registry exports for lazy loading");
|
|
1180
1348
|
lines.push("export const agents = {");
|
|
@@ -1207,6 +1375,18 @@ var PackingService = class {
|
|
|
1207
1375
|
}
|
|
1208
1376
|
lines.push("};");
|
|
1209
1377
|
lines.push("");
|
|
1378
|
+
lines.push("export const effects = {");
|
|
1379
|
+
for (const effect of constituents.effects) {
|
|
1380
|
+
lines.push(` ${this.quoteName(effect.name)}: async () => (await import('./effects/${effect.name}.js')).default,`);
|
|
1381
|
+
}
|
|
1382
|
+
lines.push("};");
|
|
1383
|
+
lines.push("");
|
|
1384
|
+
lines.push("export const threadEndpoints = {");
|
|
1385
|
+
for (const endpoint of constituents.threadEndpoints) {
|
|
1386
|
+
lines.push(` ${this.quoteName(endpoint.name)}: async () => (await import('./thread-endpoints/${endpoint.name}.js')).default,`);
|
|
1387
|
+
}
|
|
1388
|
+
lines.push("};");
|
|
1389
|
+
lines.push("");
|
|
1210
1390
|
lines.push("export const __meta = " + JSON.stringify(meta, null, 2) + ";");
|
|
1211
1391
|
lines.push("");
|
|
1212
1392
|
return lines.join("\n");
|
|
@@ -1222,6 +1402,9 @@ var PackingService = class {
|
|
|
1222
1402
|
" PromptDefinition,",
|
|
1223
1403
|
" ToolDefinition,",
|
|
1224
1404
|
" ModelDefinition,",
|
|
1405
|
+
" EffectDefinition,",
|
|
1406
|
+
" Controller,",
|
|
1407
|
+
" MarkedThreadEndpoint,",
|
|
1225
1408
|
" PackedMeta,",
|
|
1226
1409
|
"} from '@standardagents/spec';",
|
|
1227
1410
|
"",
|
|
@@ -1253,6 +1436,11 @@ var PackingService = class {
|
|
|
1253
1436
|
lines.push(`export declare const ${hook.name}: unknown;`);
|
|
1254
1437
|
}
|
|
1255
1438
|
}
|
|
1439
|
+
for (const effect of constituents.effects) {
|
|
1440
|
+
if (this.isValidIdentifier(effect.name)) {
|
|
1441
|
+
lines.push(`export declare const ${effect.name}: EffectDefinition<any, any>;`);
|
|
1442
|
+
}
|
|
1443
|
+
}
|
|
1256
1444
|
lines.push("");
|
|
1257
1445
|
lines.push("export declare const agents: {");
|
|
1258
1446
|
for (const agent of constituents.agents) {
|
|
@@ -1284,6 +1472,18 @@ var PackingService = class {
|
|
|
1284
1472
|
}
|
|
1285
1473
|
lines.push("};");
|
|
1286
1474
|
lines.push("");
|
|
1475
|
+
lines.push("export declare const effects: {");
|
|
1476
|
+
for (const effect of constituents.effects) {
|
|
1477
|
+
lines.push(` readonly ${this.quoteName(effect.name)}: DefinitionLoader<EffectDefinition<any, any>>;`);
|
|
1478
|
+
}
|
|
1479
|
+
lines.push("};");
|
|
1480
|
+
lines.push("");
|
|
1481
|
+
lines.push("export declare const threadEndpoints: {");
|
|
1482
|
+
for (const endpoint of constituents.threadEndpoints) {
|
|
1483
|
+
lines.push(` readonly ${this.quoteName(endpoint.name)}: DefinitionLoader<MarkedThreadEndpoint | Controller>;`);
|
|
1484
|
+
}
|
|
1485
|
+
lines.push("};");
|
|
1486
|
+
lines.push("");
|
|
1287
1487
|
lines.push("export declare const __meta: PackedMeta;");
|
|
1288
1488
|
lines.push("");
|
|
1289
1489
|
return lines.join("\n");
|
|
@@ -1291,7 +1491,7 @@ var PackingService = class {
|
|
|
1291
1491
|
/**
|
|
1292
1492
|
* Generate the package.json file with dependencies.
|
|
1293
1493
|
*/
|
|
1294
|
-
generatePackageJson(packageName, version, agentName, externalDeps, rootDir, license, licenseOwner) {
|
|
1494
|
+
generatePackageJson(packageName, version, agentName, effects, threadEndpoints, externalDeps, rootDir, license, licenseOwner) {
|
|
1295
1495
|
const dependencies = {
|
|
1296
1496
|
"@standardagents/spec": this.resolvePackageVersion("@standardagents/spec", rootDir)
|
|
1297
1497
|
};
|
|
@@ -1312,7 +1512,9 @@ var PackingService = class {
|
|
|
1312
1512
|
},
|
|
1313
1513
|
keywords: ["standardagent"],
|
|
1314
1514
|
standardagent: {
|
|
1315
|
-
entryAgents: [agentName]
|
|
1515
|
+
entryAgents: [agentName],
|
|
1516
|
+
...effects.length > 0 ? { effects } : {},
|
|
1517
|
+
...threadEndpoints.length > 0 ? { threadEndpoints } : {}
|
|
1316
1518
|
},
|
|
1317
1519
|
files: license ? ["dist", "LICENSE", "README.md"] : ["dist", "README.md"],
|
|
1318
1520
|
dependencies
|
|
@@ -1696,12 +1898,16 @@ var PackageDiscoveryService = class {
|
|
|
1696
1898
|
if (!pkgJson.standardagent?.entryAgents) {
|
|
1697
1899
|
return null;
|
|
1698
1900
|
}
|
|
1901
|
+
const effects = Array.isArray(pkgJson.standardagent.effects) && pkgJson.standardagent.effects.every((effectName) => typeof effectName === "string") ? pkgJson.standardagent.effects : void 0;
|
|
1902
|
+
const threadEndpoints = Array.isArray(pkgJson.standardagent.threadEndpoints) && pkgJson.standardagent.threadEndpoints.every((endpoint) => typeof endpoint === "string") ? pkgJson.standardagent.threadEndpoints : void 0;
|
|
1699
1903
|
return {
|
|
1700
1904
|
packageId: pkgJson.name || pkgName,
|
|
1701
1905
|
version: pkgJson.version || "0.0.0",
|
|
1702
1906
|
source: "npm",
|
|
1703
1907
|
path: pkgDir,
|
|
1704
1908
|
entryAgents: pkgJson.standardagent.entryAgents,
|
|
1909
|
+
...effects ? { effects } : {},
|
|
1910
|
+
...threadEndpoints ? { threadEndpoints } : {},
|
|
1705
1911
|
description: pkgJson.description
|
|
1706
1912
|
};
|
|
1707
1913
|
} catch (error) {
|
|
@@ -1761,12 +1967,16 @@ var PackageDiscoveryService = class {
|
|
|
1761
1967
|
if (!pkgJson.standardagent?.entryAgents) {
|
|
1762
1968
|
return null;
|
|
1763
1969
|
}
|
|
1970
|
+
const effects = Array.isArray(pkgJson.standardagent.effects) && pkgJson.standardagent.effects.every((effectName) => typeof effectName === "string") ? pkgJson.standardagent.effects : void 0;
|
|
1971
|
+
const threadEndpoints = Array.isArray(pkgJson.standardagent.threadEndpoints) && pkgJson.standardagent.threadEndpoints.every((endpoint) => typeof endpoint === "string") ? pkgJson.standardagent.threadEndpoints : void 0;
|
|
1764
1972
|
return {
|
|
1765
1973
|
packageId: pkgJson.name || dirName,
|
|
1766
1974
|
version: pkgJson.version || "0.0.0",
|
|
1767
1975
|
source: "local",
|
|
1768
1976
|
path: pkgDir,
|
|
1769
1977
|
entryAgents: pkgJson.standardagent.entryAgents,
|
|
1978
|
+
...effects ? { effects } : {},
|
|
1979
|
+
...threadEndpoints ? { threadEndpoints } : {},
|
|
1770
1980
|
description: pkgJson.description
|
|
1771
1981
|
};
|
|
1772
1982
|
} catch (error) {
|
|
@@ -1792,7 +2002,10 @@ var PackageDiscoveryService = class {
|
|
|
1792
2002
|
return false;
|
|
1793
2003
|
}
|
|
1794
2004
|
const f = field;
|
|
1795
|
-
|
|
2005
|
+
const hasValidEntryAgents = Array.isArray(f.entryAgents) && f.entryAgents.length > 0 && f.entryAgents.every((e) => typeof e === "string");
|
|
2006
|
+
const hasValidEffects = f.effects === void 0 || Array.isArray(f.effects) && f.effects.every((effectName) => typeof effectName === "string");
|
|
2007
|
+
const hasValidThreadEndpoints = f.threadEndpoints === void 0 || Array.isArray(f.threadEndpoints) && f.threadEndpoints.every((endpoint) => typeof endpoint === "string");
|
|
2008
|
+
return hasValidEntryAgents && hasValidEffects && hasValidThreadEndpoints;
|
|
1796
2009
|
}
|
|
1797
2010
|
/**
|
|
1798
2011
|
* Get a package by ID.
|
|
@@ -1827,7 +2040,27 @@ var TYPE_TO_DIR = {
|
|
|
1827
2040
|
prompt: "prompts",
|
|
1828
2041
|
tool: "tools",
|
|
1829
2042
|
model: "models",
|
|
1830
|
-
hook: "hooks"
|
|
2043
|
+
hook: "hooks",
|
|
2044
|
+
effect: "effects",
|
|
2045
|
+
"thread-endpoint": "thread-endpoints"
|
|
2046
|
+
};
|
|
2047
|
+
var TYPE_TO_TARGET_DIR = {
|
|
2048
|
+
agent: "agents",
|
|
2049
|
+
prompt: "prompts",
|
|
2050
|
+
tool: "tools",
|
|
2051
|
+
model: "models",
|
|
2052
|
+
hook: "hooks",
|
|
2053
|
+
effect: "effects",
|
|
2054
|
+
"thread-endpoint": "api"
|
|
2055
|
+
};
|
|
2056
|
+
var TYPE_TO_REGISTRY_NAME = {
|
|
2057
|
+
agent: "agents",
|
|
2058
|
+
prompt: "prompts",
|
|
2059
|
+
tool: "tools",
|
|
2060
|
+
model: "models",
|
|
2061
|
+
hook: "hooks",
|
|
2062
|
+
effect: "effects",
|
|
2063
|
+
"thread-endpoint": "threadEndpoints"
|
|
1831
2064
|
};
|
|
1832
2065
|
var UnpackingService = class {
|
|
1833
2066
|
/**
|
|
@@ -1869,7 +2102,7 @@ var UnpackingService = class {
|
|
|
1869
2102
|
const agentsDir = path2.join(rootDir, "agents");
|
|
1870
2103
|
const itemsWithRelations = [];
|
|
1871
2104
|
for (const item of registryItems) {
|
|
1872
|
-
const targetPath = path2.join(agentsDir,
|
|
2105
|
+
const targetPath = path2.join(agentsDir, TYPE_TO_TARGET_DIR[item.type], `${item.name}.ts`);
|
|
1873
2106
|
const sourcePath = path2.join(pkg.path, "dist", TYPE_TO_DIR[item.type], `${item.name}.js`);
|
|
1874
2107
|
const existsGlobally = this.fileExists(targetPath);
|
|
1875
2108
|
const sourceExists = fs2.existsSync(sourcePath);
|
|
@@ -1887,7 +2120,7 @@ var UnpackingService = class {
|
|
|
1887
2120
|
action: existsGlobally ? "skip" : "generate"
|
|
1888
2121
|
});
|
|
1889
2122
|
for (const child of children) {
|
|
1890
|
-
const childTargetPath = path2.join(agentsDir,
|
|
2123
|
+
const childTargetPath = path2.join(agentsDir, TYPE_TO_TARGET_DIR[child.type], `${child.name}.ts`);
|
|
1891
2124
|
const childSourcePath = path2.join(pkg.path, "dist", TYPE_TO_DIR[child.type], `${child.name}.js`);
|
|
1892
2125
|
const childExists = this.fileExists(childTargetPath);
|
|
1893
2126
|
const childSourceExists = fs2.existsSync(childSourcePath);
|
|
@@ -2074,7 +2307,7 @@ var UnpackingService = class {
|
|
|
2074
2307
|
true
|
|
2075
2308
|
);
|
|
2076
2309
|
const items = [];
|
|
2077
|
-
const registryTypes = ["agent", "prompt", "tool", "model", "hook"];
|
|
2310
|
+
const registryTypes = ["agent", "prompt", "tool", "model", "hook", "effect", "thread-endpoint"];
|
|
2078
2311
|
function visit(node) {
|
|
2079
2312
|
if (ts.isVariableStatement(node) && node.modifiers?.some((m) => m.kind === ts.SyntaxKind.ExportKeyword)) {
|
|
2080
2313
|
for (const decl of node.declarationList.declarations) {
|
|
@@ -2082,7 +2315,7 @@ var UnpackingService = class {
|
|
|
2082
2315
|
const varName = decl.name.text;
|
|
2083
2316
|
let itemType = null;
|
|
2084
2317
|
for (const type of registryTypes) {
|
|
2085
|
-
if (varName ===
|
|
2318
|
+
if (varName === TYPE_TO_REGISTRY_NAME[type]) {
|
|
2086
2319
|
itemType = type;
|
|
2087
2320
|
break;
|
|
2088
2321
|
}
|