kakt-agent-pack 0.0.0-stage → 0.2.4

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.
Files changed (46) hide show
  1. package/README.md +166 -2
  2. package/dist/cli.d.ts +3 -0
  3. package/dist/cli.d.ts.map +1 -0
  4. package/dist/cli.js +206 -0
  5. package/dist/cli.js.map +1 -0
  6. package/dist/contract.d.ts +121 -0
  7. package/dist/contract.d.ts.map +1 -0
  8. package/dist/contract.js +93 -0
  9. package/dist/contract.js.map +1 -0
  10. package/dist/evals.d.ts +72 -0
  11. package/dist/evals.d.ts.map +1 -0
  12. package/dist/evals.js +184 -0
  13. package/dist/evals.js.map +1 -0
  14. package/dist/index.d.ts +10 -0
  15. package/dist/index.d.ts.map +1 -0
  16. package/dist/index.js +10 -0
  17. package/dist/index.js.map +1 -0
  18. package/dist/init.d.ts +43 -0
  19. package/dist/init.d.ts.map +1 -0
  20. package/dist/init.js +420 -0
  21. package/dist/init.js.map +1 -0
  22. package/dist/inventory-types.d.ts +120 -0
  23. package/dist/inventory-types.d.ts.map +1 -0
  24. package/dist/inventory-types.js +159 -0
  25. package/dist/inventory-types.js.map +1 -0
  26. package/dist/inventory.d.ts +27 -0
  27. package/dist/inventory.d.ts.map +1 -0
  28. package/dist/inventory.js +427 -0
  29. package/dist/inventory.js.map +1 -0
  30. package/dist/resolve.d.ts +30 -0
  31. package/dist/resolve.d.ts.map +1 -0
  32. package/dist/resolve.js +44 -0
  33. package/dist/resolve.js.map +1 -0
  34. package/dist/stage.d.ts +33 -0
  35. package/dist/stage.d.ts.map +1 -0
  36. package/dist/stage.js +68 -0
  37. package/dist/stage.js.map +1 -0
  38. package/dist/topologies.d.ts +25 -0
  39. package/dist/topologies.d.ts.map +1 -0
  40. package/dist/topologies.js +29 -0
  41. package/dist/topologies.js.map +1 -0
  42. package/dist/validate.d.ts +19 -0
  43. package/dist/validate.d.ts.map +1 -0
  44. package/dist/validate.js +517 -0
  45. package/dist/validate.js.map +1 -0
  46. package/package.json +41 -3
package/dist/init.js ADDED
@@ -0,0 +1,420 @@
1
+ import { existsSync, mkdirSync, readdirSync, writeFileSync } from 'node:fs';
2
+ import { isAbsolute, join, resolve } from 'node:path';
3
+ import { PACK_EXCLUDED, PACK_LAYOUT } from './contract.js';
4
+ import { resolveTopology } from './topologies.js';
5
+ const DEFINITION_SCHEMA_URL = 'https://waypoint.soloz.io/schemas/agent-dag.json';
6
+ /** The placeholder serve replaces with the deployment's model. */
7
+ const MODEL_PLACEHOLDER = '__INJECT_MODEL_NAME__';
8
+ /** The token that says "this prompt is on disk", resolved from the node's own id. */
9
+ const promptPlaceholder = (agent) => `__PROMPT_${agent.toUpperCase().replace(/[^A-Z0-9]+/g, '_')}__`;
10
+ /**
11
+ * Writes a new pack: a definition, one instructions directory per agent, and bin/.
12
+ *
13
+ * Content only. A pack names no service, no chart and no image, so there is
14
+ * nothing here to deploy and nothing for a consumer to wire — which is what makes
15
+ * a new builder a directory rather than a project (ADR-041).
16
+ *
17
+ * The orchestrator is not optional and not named by the caller: every topology the
18
+ * runtime builds has one entry point, and a pack whose first node is a specialist
19
+ * has no one to delegate.
20
+ */
21
+ export function initPack(options) {
22
+ const topology = resolveTopology(options.topology);
23
+ const root = isAbsolute(options.dir ?? options.name)
24
+ ? (options.dir ?? options.name)
25
+ : resolve(process.cwd(), options.dir ?? options.name);
26
+ if (existsSync(root) && readdirSync(root).length > 0) {
27
+ throw new Error(`${root} is not empty. A pack is generated into a new directory, never over an existing tree.`);
28
+ }
29
+ const specialists = (options.agents ?? ['specialist']).map((a) => a.trim()).filter(Boolean);
30
+ if (specialists.includes('orchestrator')) {
31
+ throw new Error('"orchestrator" is generated for every pack; list only the specialists beside it.');
32
+ }
33
+ const duplicates = specialists.filter((a, i) => specialists.indexOf(a) !== i);
34
+ if (duplicates.length > 0) {
35
+ throw new Error(`Repeated agent name(s): ${[...new Set(duplicates)].join(', ')}. Each names one directory.`);
36
+ }
37
+ const agents = ['orchestrator', ...specialists];
38
+ const written = [];
39
+ mkdirSync(root, { recursive: true });
40
+ writeFileSync(join(root, PACK_LAYOUT.definition), `${JSON.stringify(buildDefinition(options, topology, specialists), null, 2)}\n`);
41
+ written.push(PACK_LAYOUT.definition);
42
+ writeFileSync(join(root, 'README.md'), packNote(options.name, topology, agents));
43
+ written.push('README.md');
44
+ // The same list the stager excludes from the image. A cache committed here is
45
+ // one that reaches a sandbox, where agent-sdk has already been bitten by
46
+ // it — so what git ignores and what the build drops are one statement.
47
+ writeFileSync(join(root, '.gitignore'), gitignore());
48
+ written.push('.gitignore');
49
+ // No serve entrypoint and no package.json. Waypoint ships the serve runtime
50
+ // (the agent-serve image and chart, ADR-041); a pack is content, and a
51
+ // consumer that writes serve code has started reimplementing the golden path.
52
+ mkdirSync(join(root, PACK_LAYOUT.agents), { recursive: true });
53
+ writeFileSync(join(root, PACK_LAYOUT.agents, 'README.md'), AGENTS_NOTE);
54
+ written.push(`${PACK_LAYOUT.agents}/README.md`);
55
+ for (const agent of agents) {
56
+ const instructions = join(root, PACK_LAYOUT.agents, agent, 'instructions');
57
+ mkdirSync(instructions, { recursive: true });
58
+ writeFileSync(join(instructions, '00-identity.md'), identity(agent, options.name, specialists));
59
+ written.push(`${PACK_LAYOUT.agents}/${agent}/instructions/00-identity.md`);
60
+ // Every directory the harness reads, created so a dev never has to know
61
+ // which paths it scans. Each holds a README rather than nothing: git does not
62
+ // track an empty directory, so a bare one disappears on the first commit and
63
+ // the scaffold looks like it lied.
64
+ for (const [dir, note] of Object.entries(agentDirNotes(agent))) {
65
+ mkdirSync(join(root, PACK_LAYOUT.agents, agent, dir), { recursive: true });
66
+ writeFileSync(join(root, PACK_LAYOUT.agents, agent, dir, 'README.md'), note);
67
+ written.push(`${PACK_LAYOUT.agents}/${agent}/${dir}/README.md`);
68
+ }
69
+ }
70
+ // shared/ is two things at once, so it says so where a dev will read it.
71
+ mkdirSync(join(root, PACK_LAYOUT.agents, 'shared'), { recursive: true });
72
+ writeFileSync(join(root, PACK_LAYOUT.agents, 'shared', 'README.md'), SHARED_NOTE);
73
+ written.push(`${PACK_LAYOUT.agents}/shared/README.md`);
74
+ // Tools every node may call, merged into each node's run_tool by the harness.
75
+ mkdirSync(join(root, PACK_LAYOUT.agents, 'shared', 'tools'), { recursive: true });
76
+ writeFileSync(join(root, PACK_LAYOUT.agents, 'shared', 'tools', 'README.md'), SHARED_TOOLS_NOTE);
77
+ written.push(`${PACK_LAYOUT.agents}/shared/tools/README.md`);
78
+ mkdirSync(join(root, PACK_LAYOUT.bin), { recursive: true });
79
+ writeFileSync(join(root, PACK_LAYOUT.bin, 'README.md'), BIN_NOTE);
80
+ written.push(`${PACK_LAYOUT.bin}/README.md`);
81
+ // Eval criteria, one file per agent, beside the contract and never shipped:
82
+ // a prompt change is done when its agent's criteria agree with it.
83
+ mkdirSync(join(root, 'evals'), { recursive: true });
84
+ writeFileSync(join(root, 'evals', 'eval-config.ts'), EVAL_CONFIG);
85
+ written.push('evals/eval-config.ts');
86
+ for (const agent of agents) {
87
+ writeFileSync(join(root, 'evals', `${agent}-evals.ts`), agentEvals(agent));
88
+ written.push(`evals/${agent}-evals.ts`);
89
+ }
90
+ writeFileSync(join(root, 'evals', 'index.ts'), evalsIndex(agents));
91
+ written.push('evals/index.ts');
92
+ if (options.sandbox) {
93
+ const dir = join(root, PACK_LAYOUT.sandbox, '..');
94
+ mkdirSync(dir, { recursive: true });
95
+ writeFileSync(join(root, PACK_LAYOUT.sandbox), sandboxDockerfile(options.name));
96
+ written.push(PACK_LAYOUT.sandbox);
97
+ }
98
+ return { root, written, declaredTopology: topology.declares };
99
+ }
100
+ function buildDefinition(options, topology, specialists) {
101
+ const nodes = [
102
+ node('orchestrator', 'Orchestrator', 'Receives the request and delegates to the specialists.'),
103
+ ...specialists.map((a) => node(a, 'Specialist', `What ${a} is responsible for.`)),
104
+ ];
105
+ return {
106
+ $schema: DEFINITION_SCHEMA_URL,
107
+ name: options.name,
108
+ version: '1.0.0',
109
+ topology: topology.declares,
110
+ // Which filesystem backend a session gets. Stated rather than omitted: the
111
+ // runtime would default it, silently, three repositories away.
112
+ persistent_workspace: options.persistentWorkspace ?? 'db',
113
+ model: { model_name: MODEL_PLACEHOLDER },
114
+ tool_definitions: [],
115
+ nodes,
116
+ edges: topology.conditionalEdges ? conditionalEdges(specialists) : specialistEdges(specialists),
117
+ };
118
+ }
119
+ function node(id, type, description) {
120
+ return {
121
+ id,
122
+ type,
123
+ config: {
124
+ name: id,
125
+ description,
126
+ // Resolved from agents/<id>/instructions/ by the serve runtime. No map
127
+ // pairs the two: the node's id names the directory.
128
+ system_prompt: promptPlaceholder(id),
129
+ model: { model_name: MODEL_PLACEHOLDER },
130
+ tools: [],
131
+ },
132
+ };
133
+ }
134
+ /** Delegation, both ways: the orchestrator calls a specialist and gets an answer. */
135
+ function specialistEdges(specialists) {
136
+ return specialists.flatMap((a) => [
137
+ { source: 'orchestrator', target: a, type: 'specialists' },
138
+ { source: a, target: 'orchestrator', type: 'specialists' },
139
+ ]);
140
+ }
141
+ /**
142
+ * A conditional chain, because that is what the acrylic builder exists for.
143
+ *
144
+ * Generated with a real condition rather than plain edges: an acrylic pack whose
145
+ * edges carry none is a graph that would have been a star, and the topology it
146
+ * declares is then the only thing saying otherwise.
147
+ */
148
+ function conditionalEdges(specialists) {
149
+ const chain = ['orchestrator', ...specialists];
150
+ return chain.slice(0, -1).map((source, i) => ({
151
+ source,
152
+ type: 'condition',
153
+ // `condition` is an expression over the graph's state, and `target` the node
154
+ // taken when it holds; `default_target` is the fallback. Replace the
155
+ // expression — it is a placeholder that is shaped correctly, not a rule.
156
+ conditions: [{ condition: `state.get("next") == "${chain[i + 1]}"`, target: chain[i + 1] }],
157
+ default_target: 'orchestrator',
158
+ }));
159
+ }
160
+ function identity(agent, pack, specialists) {
161
+ if (agent === 'orchestrator') {
162
+ return [
163
+ `# Orchestrator — ${pack}`,
164
+ '',
165
+ 'You receive the request and decide which specialist handles it.',
166
+ '',
167
+ '## Your specialists',
168
+ '',
169
+ ...specialists.map((a) => `- \`${a}\` — ${a}'s responsibility, stated in its own instructions.`),
170
+ '',
171
+ '## Replace this',
172
+ '',
173
+ 'Everything above is a starting point. Files in this directory are read in',
174
+ 'name order and concatenated, so add `10-process.md`, `20-handoff.md` and so',
175
+ 'on rather than growing one file.',
176
+ '',
177
+ ].join('\n');
178
+ }
179
+ return [
180
+ `# ${agent} — ${pack}`,
181
+ '',
182
+ `State what ${agent} is responsible for, what it needs before it can start, and`,
183
+ 'what it hands back.',
184
+ '',
185
+ '## Replace this',
186
+ '',
187
+ 'Files in this directory are read in name order and concatenated, so add',
188
+ '`10-process.md` and `20-handoff.md` rather than growing one file.',
189
+ '',
190
+ ].join('\n');
191
+ }
192
+ /** What each directory under an agent is for, written where a dev will look. */
193
+ function agentDirNotes(agent) {
194
+ return {
195
+ tools: [
196
+ `# ${agent}/tools`,
197
+ '',
198
+ 'Executables this agent can call through `run_tool`. The harness scans this',
199
+ 'directory at startup, so a tool is available by being here — there is no',
200
+ 'registry to add it to.',
201
+ '',
202
+ 'Tools shared with every agent go in `agents/shared/tools/` instead.',
203
+ '',
204
+ ].join('\n'),
205
+ skills: [
206
+ `# ${agent}/skills`,
207
+ '',
208
+ 'Skills this agent loads. One directory per skill, each with the files the',
209
+ 'skill needs; the harness sources them from here rather than cloning them.',
210
+ '',
211
+ ].join('\n'),
212
+ };
213
+ }
214
+ const SHARED_TOOLS_NOTE = [
215
+ '# shared/tools',
216
+ '',
217
+ "Executables merged into every agent's `run_tool` — a downloader, a formatter,",
218
+ "whatever is not one agent's business.",
219
+ '',
220
+ 'The harness adds this directory to every node\'s tool search path, after the',
221
+ "node's own `tools/`. A tool is available by being here; there is no registry to",
222
+ 'add it to.',
223
+ '',
224
+ 'For prompt text shared between agents, see `../README.md`.',
225
+ '',
226
+ ].join('\n');
227
+ const BIN_NOTE = [
228
+ '# bin',
229
+ '',
230
+ 'Binaries and manifests the tools in this pack invoke — a vendored CLI, an',
231
+ 'action manifest. Mounted read-only in the sandbox and addressed by',
232
+ 'AGENT_SDK_TOOLS_BIN_DIR.',
233
+ '',
234
+ 'Most packs need none. Delete this directory if yours does not.',
235
+ '',
236
+ ].join('\n');
237
+ /**
238
+ * The recipe for a pack whose tools need what a startup fetch cannot deliver.
239
+ *
240
+ * Content is never copied in here. It arrives from the serve runtime at startup
241
+ * (ADR-041), so this image changes only when its libraries do — which is what
242
+ * keeps a prompt edit from re-pinning it and recycling every running session.
243
+ */
244
+ function sandboxDockerfile(name) {
245
+ return [
246
+ `# ─── ${name} sandbox image ───`,
247
+ '#',
248
+ '# Only for dependencies that cannot be fetched at startup: compiled Python or',
249
+ '# node extensions, system packages. Delete this file and the pack runs on the',
250
+ '# default harness image instead (AGENT_SDK_DEFAULT_IMAGE), which is what most',
251
+ '# packs should do.',
252
+ '#',
253
+ '# No agents, no ENV, no COPY of pack content — prompts, tools and skills come',
254
+ '# from the serve runtime at startup.',
255
+ '',
256
+ '# Defaults to the locally built base. Release builds override it with a digest.',
257
+ 'ARG AGENT_SDK_IMAGE=agent-sdk:dev',
258
+ 'FROM ${AGENT_SDK_IMAGE}',
259
+ '',
260
+ '# USER root',
261
+ '# RUN pip install --no-cache-dir "your-compiled-library"',
262
+ '# USER appuser',
263
+ '',
264
+ ].join('\n');
265
+ }
266
+ /** The pack root: what this directory is, and what to do with it. */
267
+ function packNote(name, topology, agents) {
268
+ return [
269
+ `# ${name}`,
270
+ '',
271
+ 'An agent pack: the content of one agent product, and nothing else. It names no',
272
+ 'service, no chart and no image — waypoint serves it (ADR-041).',
273
+ '',
274
+ '## What is here',
275
+ '',
276
+ '| path | purpose |',
277
+ '| --- | --- |',
278
+ '| `definition.json` | the graph: which agents exist, and how they reach each other |',
279
+ '| `agents/<node-id>/` | one directory per agent in the definition |',
280
+ '| `agents/shared/` | prompt sections and tools every agent can use |',
281
+ '| `bin/` | binaries the tools invoke |',
282
+ '| `evals/` | one criteria file per agent (not shipped) |',
283
+ '',
284
+ `## Topology: \`${topology.declares}\``,
285
+ '',
286
+ `${topology.summary}`,
287
+ '',
288
+ `Agents: ${agents.map((a) => `\`${a}\``).join(', ')}.`,
289
+ '',
290
+ '## Next',
291
+ '',
292
+ '```bash',
293
+ 'npx kakt-agent-pack validate .',
294
+ '```',
295
+ '',
296
+ 'Then write the instructions. Each agent\'s prompt is every `.md` file in its',
297
+ '`instructions/` directory, read in name order and concatenated — so add',
298
+ '`10-process.md` and `20-handoff.md` rather than growing one file.',
299
+ '',
300
+ ].join('\n');
301
+ }
302
+ const AGENTS_NOTE = [
303
+ '# agents',
304
+ '',
305
+ 'One directory per agent, named by its **node id in `definition.json`**. That name',
306
+ 'is the whole link between the two: the prompt for node `writer` is read from',
307
+ '`writer/instructions/`, and nothing maps one to the other. Renaming a node means',
308
+ 'renaming its directory.',
309
+ '',
310
+ '| path | purpose |',
311
+ '| --- | --- |',
312
+ '| `<node-id>/instructions/` | the prompt, every `.md` concatenated in name order |',
313
+ '| `<node-id>/tools/` | executables this agent calls through `run_tool` |',
314
+ '| `<node-id>/skills/` | skills this agent loads |',
315
+ '| `shared/` | prompt sections and tools available to every agent |',
316
+ '',
317
+ '`shared/` is not an agent: it has no node and no instructions of its own.',
318
+ '',
319
+ ].join('\n');
320
+ const SHARED_NOTE = [
321
+ '# shared',
322
+ '',
323
+ 'Content every agent can use. Not an agent itself — it has no node in',
324
+ '`definition.json`, no `instructions/`, and nothing routes to it.',
325
+ '',
326
+ 'It holds two different things.',
327
+ '',
328
+ '## Prompt sections (`*.md` here)',
329
+ '',
330
+ 'Paragraphs more than one agent needs, written once. An agent pulls them in from',
331
+ 'an instruction file whose name ends in `inputs.md`:',
332
+ '',
333
+ '```markdown',
334
+ '---',
335
+ 'type: prompt-section',
336
+ '---',
337
+ '<inputs>',
338
+ 'imports:',
339
+ 'shared/forbidden-behaviors.md',
340
+ 'shared/evaluation-protocol.md',
341
+ '</inputs>',
342
+ '```',
343
+ '',
344
+ 'Only the imports are read from such a file, never its own body — so a section',
345
+ 'lives in one place and every agent that needs it names it. An import that does',
346
+ 'not resolve is logged and skipped, not an error, so check the name.',
347
+ '',
348
+ '## Tools (`tools/`)',
349
+ '',
350
+ "Executables merged into every agent's `run_tool`, for the ones that are not one",
351
+ "agent's business.",
352
+ '',
353
+ ].join('\n');
354
+ const EVAL_CONFIG = [
355
+ '/**',
356
+ ' * One behaviour an agent\'s prompt requires, graded pass or fail on an agent run.',
357
+ ' * successCriteria states what passes and, with "Fails if", each observable way',
358
+ ' * it fails (a tool call, a file, the final report), so a grader can decide it',
359
+ ' * from the run alone.',
360
+ ' */',
361
+ 'export interface EvalCriterion {',
362
+ ' id: number;',
363
+ ' category: string;',
364
+ ' metric: string;',
365
+ ' successCriteria: string;',
366
+ " /** guardrail: must hold on every run. north-star (default): a target tracked on averages. */",
367
+ " suite?: 'guardrail' | 'north-star';",
368
+ ' /** A deterministic tool-call check, graded without a model call. */',
369
+ ' check?: { toolsNotCalled?: string[]; toolsCalled?: string[] };',
370
+ '}',
371
+ '',
372
+ ].join('\n');
373
+ const evalsConst = (agent) => `${agent.toUpperCase().replace(/[^A-Z0-9]+/g, '_')}_EVALS`;
374
+ const evalsModule = (agent) => `./${agent}-evals`;
375
+ function agentEvals(agent) {
376
+ return [
377
+ "import type { EvalCriterion } from './eval-config';",
378
+ '',
379
+ `// What ${agent} must do, one criterion per behaviour its instructions require.`,
380
+ `export const ${evalsConst(agent)}: EvalCriterion[] = [`,
381
+ ' {',
382
+ ' id: 1,',
383
+ " category: 'Identity',",
384
+ " metric: 'Stays within role',",
385
+ ` successCriteria: 'Replace this: ${agent} acts only within its instructions and verified state. Fails if it fabricates output or skips required checks.',`,
386
+ ' },',
387
+ '];',
388
+ '',
389
+ ].join('\n');
390
+ }
391
+ function evalsIndex(agents) {
392
+ return [
393
+ ...agents.map((a) => `import { ${evalsConst(a)} } from '${evalsModule(a)}';`),
394
+ '',
395
+ ...agents.map((a) => `export { ${evalsConst(a)} } from '${evalsModule(a)}';`),
396
+ '',
397
+ 'export const ALL_EVALS = [',
398
+ ...agents.map((a) => ` ...${evalsConst(a)},`),
399
+ '];',
400
+ '',
401
+ ].join('\n');
402
+ }
403
+ /** What never belongs in a pack, from the contract's own list. */
404
+ function gitignore() {
405
+ return [
406
+ '# Build and interpreter caches. Never committed, and never shipped: the',
407
+ '# stager drops the same list, because a cache inside a sandbox is at best',
408
+ '# dead weight and at worst unreadable — one file with owner-only permissions',
409
+ '# aborts the whole skill copy and takes every session on the pod with it.',
410
+ '',
411
+ // Bare names, with no trailing slash: the list mixes directories with files
412
+ // (`.DS_Store`), and a pattern written without one matches either — where
413
+ // `.DS_Store/` would match nothing at all.
414
+ //
415
+ // `.git` is excluded from a staged pack; inside a repository it means nothing.
416
+ ...PACK_EXCLUDED.filter((entry) => entry !== '.git'),
417
+ '',
418
+ ].join('\n');
419
+ }
420
+ //# sourceMappingURL=init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.js","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAiB,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEjE,MAAM,qBAAqB,GAAG,kDAAkD,CAAC;AAEjF,kEAAkE;AAClE,MAAM,iBAAiB,GAAG,uBAAuB,CAAC;AAElD,qFAAqF;AACrF,MAAM,iBAAiB,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,YAAY,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC;AAiC7G;;;;;;;;;;GAUG;AACH,MAAM,UAAU,QAAQ,CAAC,OAAoB;IAC3C,MAA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AC;QACpD,EAAE;KACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC"}
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Shared, browser-safe Pack Inventory & Catalog contract (ADR-041 / ADR-057).
3
+ *
4
+ * Zero Node.js imports so the exact same schema and pure draft projection helper
5
+ * are shared across `kakt-agent-pack`, `waypoint-sdk`, `waypoint-bff`,
6
+ * `waypoint-ui-flow-builder`, and `waypoint-builder-frontend`.
7
+ */
8
+ export declare const PACK_INVENTORY_SCHEMA_VERSION: "pack-inventory/v1";
9
+ export declare const RUNTIME_BUILTIN_TOOLS: readonly ["read_file", "write_file", "ask_user", "load_skill", "run_tool", "execute"];
10
+ export type RuntimeBuiltinTool = (typeof RUNTIME_BUILTIN_TOOLS)[number];
11
+ export declare const RUNTIME_BUILTIN_TOOL_SET: ReadonlySet<string>;
12
+ export type PackCatalogSource = 'draft' | 'published' | 'shipped' | 'deployed';
13
+ export type AgentNodeKind = 'Orchestrator' | 'Specialist' | 'SubAgent';
14
+ export type AgentTypeKind = 'router' | 'agent' | 'subagent' | 'subgraph';
15
+ export interface SkillInventoryItem {
16
+ /** Leaf skill identifier (from SKILL.md frontmatter `name` or skill directory name). */
17
+ name: string;
18
+ /** Declared skill path from definition.json or relative pack path. */
19
+ path: string;
20
+ /** Description parsed from SKILL.md YAML frontmatter, when present. */
21
+ description?: string;
22
+ /** Skill-bundled executable CLI script stems (`scripts/*_cli.py`) eligible on Specialist nodes. */
23
+ scripts?: string[];
24
+ }
25
+ export type FunctionToolKind = 'cli' | 'app-tool' | 'mcp' | 'designed';
26
+ export type FunctionToolScope = 'agent' | 'shared' | 'skill' | 'declared' | 'mcp';
27
+ export type FunctionToolStatus = 'executable' | 'designed';
28
+ export interface FunctionToolInventoryItem {
29
+ /** Tool identifier (script stem without `.py` for CLI tools, or registered tool name). */
30
+ name: string;
31
+ kind: FunctionToolKind;
32
+ scope: FunctionToolScope;
33
+ /**
34
+ * - `executable`: verified eligible under agent-sdk runtime rules (`CustomToolMiddleware`,
35
+ * registered `app-tool` binding in `tool_definitions`, or MCP binding).
36
+ * - `designed`: authored specification (`spec.md`) in a draft workspace without a verified
37
+ * runtime executable artifact yet.
38
+ */
39
+ status: FunctionToolStatus;
40
+ description?: string;
41
+ /** Relative path within the pack (e.g. `agents/audio-generator/tools/tts_cli.py`). */
42
+ path?: string;
43
+ /** Owning skill name when `scope === 'skill'`. */
44
+ skillName?: string;
45
+ }
46
+ export interface AgentCapabilityInventory {
47
+ /** Node key matching canvas node id (`node.id`, or `${parentId}::${subagent.name}` for nested subagents). */
48
+ agentId: string;
49
+ name: string;
50
+ nodeType: AgentNodeKind;
51
+ agentType?: AgentTypeKind;
52
+ parentAgentId?: string;
53
+ skills: SkillInventoryItem[];
54
+ functionTools: FunctionToolInventoryItem[];
55
+ builtinTools: string[];
56
+ mcpTools: FunctionToolInventoryItem[];
57
+ }
58
+ export interface PackInventory {
59
+ schemaVersion: typeof PACK_INVENTORY_SCHEMA_VERSION;
60
+ packName: string;
61
+ /** Deterministic SHA-256 content digest of the pack artifact, when known. */
62
+ contentDigest?: string;
63
+ /** Keyed by canonical agentId (`node.id` for top-level nodes, `${parentId}::${sub.name}` for subagents). */
64
+ agents: Record<string, AgentCapabilityInventory>;
65
+ }
66
+ export interface PackCatalogEntry {
67
+ /** Pack address (`pk-<ulid>` for published packs, pack slug/name for shipped/deployed/draft). */
68
+ pack: string;
69
+ slug: string;
70
+ source: PackCatalogSource;
71
+ /** Immutable revision identifier (archive SHA-256, content digest, or workspace revision id). */
72
+ version: string;
73
+ /** Content digest of the pack tree (matches deployed image/archive digest when available). */
74
+ contentDigest: string;
75
+ status: 'active' | 'retired' | 'draft';
76
+ definition: Record<string, unknown>;
77
+ inventory: PackInventory;
78
+ updatedAt?: string;
79
+ }
80
+ /**
81
+ * Validated workspace draft manifest produced by the authoring compiler / workspace
82
+ * revision contract. Used to project a revision-consistent Draft `PackInventory`
83
+ * without executing arbitrary scripts or scanning raw Python files in the frontend.
84
+ */
85
+ export interface AuthoredDraftToolSpec {
86
+ name: string;
87
+ agentId?: string;
88
+ scope?: 'agent' | 'shared';
89
+ description?: string;
90
+ specPath?: string;
91
+ }
92
+ export interface AuthoredDraftSkillSpec {
93
+ name: string;
94
+ path: string;
95
+ description?: string;
96
+ }
97
+ export interface ValidatedDraftPackManifest {
98
+ /** Monotonic or content-addressed workspace revision identifier. */
99
+ revision: string;
100
+ pack: string;
101
+ slug?: string;
102
+ definition: Record<string, unknown>;
103
+ /** Authored skill metadata from the same validated revision. */
104
+ skills?: Record<string, AuthoredDraftSkillSpec>;
105
+ /** Tools defined only by spec.md in the draft workspace — always projected as `designed`. */
106
+ designedTools?: AuthoredDraftToolSpec[];
107
+ }
108
+ export declare function extractSkillLeafName(skillPath: string): string;
109
+ /**
110
+ * Pure, browser-safe projection of a validated Draft workspace manifest into the
111
+ * shared `PackInventory` contract.
112
+ *
113
+ * - Built-in tools come strictly from `RUNTIME_BUILTIN_TOOL_SET` entries in `config.tools`.
114
+ * - Registered `app-tool` bindings in `tool_definitions` are classified as executable `app-tool`s.
115
+ * - Tools defined only by `spec.md` in `manifest.designedTools` are strictly marked
116
+ * `kind: 'designed', status: 'designed'` — never claimed executable.
117
+ * - A2A declarations are never projected as executable function tools.
118
+ */
119
+ export declare function projectDraftPackInventory(manifest: ValidatedDraftPackManifest | Record<string, unknown>): PackInventory;
120
+ //# sourceMappingURL=inventory-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inventory-types.d.ts","sourceRoot":"","sources":["../src/inventory-types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,eAAO,MAAM,6BAA6B,EAAG,mBAA4B,CAAC;AAE1E,eAAO,MAAM,qBAAqB,uFAOxB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAExE,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,MAAM,CA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