@standardagents/builder 0.11.12 → 0.12.1
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 +3498 -498
- package/dist/built-in-routes.js.map +1 -1
- package/dist/client/assets/index.css +1 -1
- package/dist/client/index.js +56 -25
- package/dist/client/vendor.js +78 -5
- package/dist/client/vue.js +1 -1
- package/dist/discovery-CpMs68Yx.d.ts +97 -0
- package/dist/index-DkbUJ4MM.d.ts +1043 -0
- package/dist/index.d.ts +205 -999
- package/dist/index.js +4563 -956
- package/dist/index.js.map +1 -1
- package/dist/packing.d.ts +266 -0
- package/dist/packing.js +2202 -0
- package/dist/packing.js.map +1 -0
- package/dist/plugin.js +3477 -608
- package/dist/plugin.js.map +1 -1
- package/dist/test.d.ts +256 -0
- package/dist/test.js +391 -0
- package/dist/test.js.map +1 -0
- package/dist/types-pLkJx8vg.d.ts +306 -0
- package/package.json +25 -4
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
import { P as PackingAnalysis, a as PackingOptions, b as PackingResult, d as UnpackAnalysis, U as UnpackOptions, c as UnpackResult } from './types-pLkJx8vg.js';
|
|
2
|
+
export { D as DiscoveredPackage } from './types-pLkJx8vg.js';
|
|
3
|
+
export { P as PackageDiscoveryService, d as discoverPackages } from './discovery-CpMs68Yx.js';
|
|
4
|
+
import '@standardagents/spec';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Packing service for Standard Agents.
|
|
8
|
+
*
|
|
9
|
+
* Provides functionality to:
|
|
10
|
+
* - Analyze agents and their dependencies
|
|
11
|
+
* - Pack agents with all constituents using Rollup bundling
|
|
12
|
+
* - Generate npm-ready package structures with TypeScript definitions
|
|
13
|
+
*
|
|
14
|
+
* The new Rollup-based approach:
|
|
15
|
+
* - Preserves imports, constants, and helper functions
|
|
16
|
+
* - Bundles local dependencies inline
|
|
17
|
+
* - Keeps npm packages as external dependencies
|
|
18
|
+
* - Creates separate files per constituent with re-exports in index.ts
|
|
19
|
+
*
|
|
20
|
+
* @module
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Service for packing agents with their dependencies.
|
|
25
|
+
*/
|
|
26
|
+
declare class PackingService {
|
|
27
|
+
/**
|
|
28
|
+
* Resolve the version of an npm package from node_modules.
|
|
29
|
+
*
|
|
30
|
+
* @param pkgName - Package name (e.g., '@standardagents/spec')
|
|
31
|
+
* @param rootDir - Root directory of the project
|
|
32
|
+
* @returns Version specifier (e.g., '^1.2.3') or '*' if not found
|
|
33
|
+
*/
|
|
34
|
+
protected resolvePackageVersion(pkgName: string, rootDir: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Analyze an agent to discover all its constituents.
|
|
37
|
+
*
|
|
38
|
+
* This performs static analysis on the agent definition and all
|
|
39
|
+
* referenced prompts, tools, models, and hooks.
|
|
40
|
+
*
|
|
41
|
+
* @param agentName - Name of the agent to analyze
|
|
42
|
+
* @param rootDir - Root directory of the agents workspace
|
|
43
|
+
* @returns Analysis result with all discovered constituents
|
|
44
|
+
*/
|
|
45
|
+
analyzeAgent(agentName: string, rootDir: string): Promise<PackingAnalysis>;
|
|
46
|
+
/**
|
|
47
|
+
* Generate a README for an analyzed agent.
|
|
48
|
+
*
|
|
49
|
+
* This is used during analysis to provide a pre-populated README
|
|
50
|
+
* that can be edited in the PackModal before packing.
|
|
51
|
+
*
|
|
52
|
+
* @param analysis - The packing analysis result
|
|
53
|
+
* @param rootDir - Root directory of the project
|
|
54
|
+
* @returns Object with generatedReadme and agentDescription
|
|
55
|
+
*/
|
|
56
|
+
generateReadmeForAnalysis(analysis: PackingAnalysis, rootDir: string): {
|
|
57
|
+
generatedReadme: string;
|
|
58
|
+
agentDescription?: string;
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Recursively analyze a prompt and its dependencies.
|
|
62
|
+
*/
|
|
63
|
+
private analyzePrompt;
|
|
64
|
+
/**
|
|
65
|
+
* Analyze a tool and its dependencies.
|
|
66
|
+
* This also handles prompts-as-tools and agents-as-tools (handoffs).
|
|
67
|
+
*/
|
|
68
|
+
private analyzeTool;
|
|
69
|
+
/**
|
|
70
|
+
* Analyze a nested agent (used as a handoff target).
|
|
71
|
+
*/
|
|
72
|
+
private analyzeNestedAgent;
|
|
73
|
+
/**
|
|
74
|
+
* Analyze a model and its fallbacks.
|
|
75
|
+
*/
|
|
76
|
+
private analyzeModel;
|
|
77
|
+
/**
|
|
78
|
+
* Check which items are shared with other agents.
|
|
79
|
+
*/
|
|
80
|
+
private checkSharedItems;
|
|
81
|
+
/**
|
|
82
|
+
* Light analysis of an agent - just get the names of used items.
|
|
83
|
+
*/
|
|
84
|
+
private analyzeAgentLight;
|
|
85
|
+
/**
|
|
86
|
+
* Pack an agent with all its dependencies using Rollup bundling.
|
|
87
|
+
*
|
|
88
|
+
* The packing format creates:
|
|
89
|
+
* - dist/{type}/{name}.js - Individual bundled files per constituent
|
|
90
|
+
* - dist/index.js - Re-exports and lazy loaders
|
|
91
|
+
* - dist/index.d.ts - TypeScript type definitions
|
|
92
|
+
* - package.json - With standardagent field and dependencies
|
|
93
|
+
* - tsconfig.json - For building
|
|
94
|
+
*
|
|
95
|
+
* @param options - Packing options
|
|
96
|
+
* @returns Packing result
|
|
97
|
+
*/
|
|
98
|
+
pack(options: PackingOptions): Promise<PackingResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Bundle a single source file with its local dependencies using Rollup.
|
|
101
|
+
*
|
|
102
|
+
* Local files (from the same agents/ directory) are inlined.
|
|
103
|
+
* npm packages are kept as external dependencies.
|
|
104
|
+
* Output is bundled JavaScript with all local deps inlined.
|
|
105
|
+
*
|
|
106
|
+
* @returns Map of external dependencies (name -> version specifier)
|
|
107
|
+
*/
|
|
108
|
+
protected bundleFile(inputPath: string, outputPath: string, rootDir: string): Promise<Map<string, string>>;
|
|
109
|
+
/**
|
|
110
|
+
* Get the directory name for a constituent type.
|
|
111
|
+
*/
|
|
112
|
+
private getTypeDir;
|
|
113
|
+
/**
|
|
114
|
+
* Deduplicate constituents by name (for packing, not for tree display).
|
|
115
|
+
*/
|
|
116
|
+
private deduplicateConstituents;
|
|
117
|
+
/**
|
|
118
|
+
* Check if a name is a valid JavaScript/TypeScript identifier.
|
|
119
|
+
*/
|
|
120
|
+
private isValidIdentifier;
|
|
121
|
+
/**
|
|
122
|
+
* Quote a property/export name if it contains non-identifier characters.
|
|
123
|
+
* JavaScript identifiers must start with a letter, underscore, or dollar sign,
|
|
124
|
+
* and contain only letters, digits, underscores, or dollar signs.
|
|
125
|
+
*/
|
|
126
|
+
private quoteName;
|
|
127
|
+
/**
|
|
128
|
+
* Generate the dist/index.js file with re-exports and lazy loaders.
|
|
129
|
+
*/
|
|
130
|
+
private generateReExportIndex;
|
|
131
|
+
/**
|
|
132
|
+
* Generate the dist/index.d.ts file with type definitions.
|
|
133
|
+
*/
|
|
134
|
+
private generateIndexDts;
|
|
135
|
+
/**
|
|
136
|
+
* Generate the package.json file with dependencies.
|
|
137
|
+
*/
|
|
138
|
+
private generatePackageJson;
|
|
139
|
+
/**
|
|
140
|
+
* Generate LICENSE file content for common licenses.
|
|
141
|
+
*/
|
|
142
|
+
private generateLicenseFile;
|
|
143
|
+
/**
|
|
144
|
+
* Get information about a packed package.
|
|
145
|
+
*
|
|
146
|
+
* Reads the package.json and README.md from a packed package directory.
|
|
147
|
+
* Used by the packed-info API endpoint to show package details before publishing.
|
|
148
|
+
*
|
|
149
|
+
* @param packageId - The package directory name (e.g., 'standardagent-my-agent')
|
|
150
|
+
* @param rootDir - Root directory of the project
|
|
151
|
+
* @returns Package info or null if not found
|
|
152
|
+
*/
|
|
153
|
+
getPackedInfo(packageId: string, rootDir: string): {
|
|
154
|
+
packageName: string;
|
|
155
|
+
version: string;
|
|
156
|
+
license?: string;
|
|
157
|
+
author?: string;
|
|
158
|
+
entryAgents: string[];
|
|
159
|
+
readme?: string;
|
|
160
|
+
} | null;
|
|
161
|
+
/**
|
|
162
|
+
* List all packed packages in the workspace.
|
|
163
|
+
*
|
|
164
|
+
* @param rootDir - Root directory of the project
|
|
165
|
+
* @returns Array of package directory names
|
|
166
|
+
*/
|
|
167
|
+
listPackedPackages(rootDir: string): string[];
|
|
168
|
+
/**
|
|
169
|
+
* Generate README.md content for a packed agent.
|
|
170
|
+
*
|
|
171
|
+
* @param packageName - The npm package name
|
|
172
|
+
* @param agentName - The agent name
|
|
173
|
+
* @param version - The package version
|
|
174
|
+
* @param license - The license type
|
|
175
|
+
* @param description - Optional description from the agent definition
|
|
176
|
+
* @returns README markdown content
|
|
177
|
+
*/
|
|
178
|
+
generateReadme(packageName: string, agentName: string, version: string, license?: string, description?: string): string;
|
|
179
|
+
/**
|
|
180
|
+
* Find a file by name in a directory.
|
|
181
|
+
*/
|
|
182
|
+
private findFile;
|
|
183
|
+
/**
|
|
184
|
+
* List all agents in the workspace.
|
|
185
|
+
*/
|
|
186
|
+
listAgents(rootDir: string): string[];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* Unpacking service for Standard Agents.
|
|
191
|
+
*
|
|
192
|
+
* Provides functionality to:
|
|
193
|
+
* - Analyze packed packages to discover exportable items
|
|
194
|
+
* - Transform bundled JavaScript back to TypeScript source files
|
|
195
|
+
* - Restore packed agents to editable source files
|
|
196
|
+
*
|
|
197
|
+
* Uses AST-based transformation (TypeScript Compiler API + magic-string)
|
|
198
|
+
* to accurately preserve all code including Zod schemas and execute functions.
|
|
199
|
+
*
|
|
200
|
+
* @module
|
|
201
|
+
*/
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Service for unpacking packed agent packages.
|
|
205
|
+
*/
|
|
206
|
+
declare class UnpackingService {
|
|
207
|
+
/**
|
|
208
|
+
* Analyze a package to discover what can be unpacked.
|
|
209
|
+
*
|
|
210
|
+
* @param packageId - Package ID to analyze
|
|
211
|
+
* @param rootDir - Root directory of the agents workspace
|
|
212
|
+
* @returns Analysis result with items that can be unpacked
|
|
213
|
+
*/
|
|
214
|
+
analyzeUnpack(packageId: string, rootDir: string): Promise<UnpackAnalysis>;
|
|
215
|
+
/**
|
|
216
|
+
* Discover relationships from a bundled file.
|
|
217
|
+
* Returns child items that this item references.
|
|
218
|
+
*/
|
|
219
|
+
private discoverRelationships;
|
|
220
|
+
/**
|
|
221
|
+
* Unpack a packed agent package by transforming bundled JS back to TypeScript.
|
|
222
|
+
*
|
|
223
|
+
* @param options - Unpacking options
|
|
224
|
+
* @returns Result of the unpacking operation
|
|
225
|
+
*/
|
|
226
|
+
unpack(options: UnpackOptions): Promise<UnpackResult>;
|
|
227
|
+
/**
|
|
228
|
+
* Parse the index.js file to extract registry items.
|
|
229
|
+
*
|
|
230
|
+
* Looks for patterns like:
|
|
231
|
+
* ```javascript
|
|
232
|
+
* export const agents = {
|
|
233
|
+
* support_agent: async () => (await import('./agents/support_agent.js')).default,
|
|
234
|
+
* };
|
|
235
|
+
* ```
|
|
236
|
+
*/
|
|
237
|
+
private parseIndexExports;
|
|
238
|
+
/**
|
|
239
|
+
* Resolve a package identifier to a discovered package.
|
|
240
|
+
*/
|
|
241
|
+
private resolvePackage;
|
|
242
|
+
/**
|
|
243
|
+
* Apply user selections to items.
|
|
244
|
+
*/
|
|
245
|
+
private applySelections;
|
|
246
|
+
/**
|
|
247
|
+
* Check if a file exists.
|
|
248
|
+
*/
|
|
249
|
+
private fileExists;
|
|
250
|
+
/**
|
|
251
|
+
* Recursively delete a directory.
|
|
252
|
+
*/
|
|
253
|
+
private deleteDirectory;
|
|
254
|
+
/**
|
|
255
|
+
* List available packed packages.
|
|
256
|
+
*/
|
|
257
|
+
listPackages(rootDir: string): Promise<Array<{
|
|
258
|
+
packageId: string;
|
|
259
|
+
version: string;
|
|
260
|
+
source: 'npm' | 'local';
|
|
261
|
+
entryAgents: string[];
|
|
262
|
+
path: string;
|
|
263
|
+
}>>;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export { PackingAnalysis, PackingOptions, PackingResult, PackingService, UnpackOptions, UnpackResult, UnpackingService };
|