kakt-agent-pack 0.0.0-stage → 0.2.3

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
@@ -0,0 +1,72 @@
1
+ /**
2
+ * One behaviour an agent's prompt requires, graded pass or fail on a run. The
3
+ * shape `init` scaffolds in `evals/eval-config.ts`.
4
+ */
5
+ export interface PackEvalCriterion {
6
+ id: number;
7
+ category: string;
8
+ metric: string;
9
+ successCriteria: string;
10
+ /**
11
+ * `guardrail`: must hold on every run; a failure blocks a release and is never
12
+ * traded against other criteria. `north-star` (the default): a target tracked
13
+ * on averages.
14
+ */
15
+ suite?: 'guardrail' | 'north-star';
16
+ /**
17
+ * A deterministic check on the run's tool calls, graded without a model call.
18
+ * A criterion with one is a code evaluator; one without is graded by the judge.
19
+ */
20
+ check?: EvalToolCheck;
21
+ }
22
+ /** Tool calls a criterion's agent must, or must not, make (by tool name). */
23
+ export interface EvalToolCheck {
24
+ toolsNotCalled?: string[];
25
+ toolsCalled?: string[];
26
+ }
27
+ /**
28
+ * A pack's eval criteria as data: what `stage` writes to `evals/evals.json` and
29
+ * what agent-serve answers on `/packs/:pack/evals`.
30
+ */
31
+ export interface CompiledEvals {
32
+ /** The definition's `name`. */
33
+ pack: string;
34
+ /**
35
+ * The node the session talks to (the Orchestrator, else the first node). Its
36
+ * messages carry no agent name in a transcript; every specialist's do.
37
+ */
38
+ rootAgent: string;
39
+ /**
40
+ * The name each agent runs under (its graph name, which a transcript records)
41
+ * mapped to the key its criteria are filed under. A node's `config.name` may
42
+ * differ from its id (`content-discovery-agent` for `content-discovery`).
43
+ */
44
+ names: Record<string, string>;
45
+ /** Criteria per agent: a top-level node id, or a nested subagent's name. */
46
+ agents: Record<string, PackEvalCriterion[]>;
47
+ }
48
+ /** Every gap in a pack's criteria, reported together. */
49
+ export declare class EvalsError extends Error {
50
+ readonly problems: string[];
51
+ constructor(problems: string[]);
52
+ }
53
+ /**
54
+ * Reads a pack's `evals/<agent>-evals.ts` files into data.
55
+ *
56
+ * Each file is transpiled and evaluated on its own, with no module loader: a
57
+ * criteria file is data, and `import type` is the only import it may carry. A
58
+ * file that needs a runtime import fails here, naming itself, rather than
59
+ * evaluating against whatever the build machine happens to have installed.
60
+ *
61
+ * Throws `EvalsError` when `evals/`, a criteria file, or any agent's criteria is missing or invalid.
62
+ */
63
+ export declare function compileEvals(root: string, definitionName: string, definition: Record<string, unknown>): CompiledEvals;
64
+ /**
65
+ * Every agent a session of this pack can run, by the name it runs under: each
66
+ * top-level node (its `config.name`, and its id) and each nested subagent (its
67
+ * name), mapped to the key its criteria are filed under.
68
+ */
69
+ export declare function agentNames(definition: Record<string, unknown>, problems?: string[]): Record<string, string>;
70
+ /** The definition's top-level node ids: the agents a criteria file may be named for. */
71
+ export declare function definitionNodeIds(definition: Record<string, unknown>): Set<string>;
72
+ //# sourceMappingURL=evals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evals.d.ts","sourceRoot":"","sources":["../src/evals.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,CAAC;IACxB;;;;OAIG;IACH,KAAK,CAAC,EAAE,WAAW,GAAG,YAAY,CAAC;IACnC;;;OAGG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,6EAA6E;AAC7E,MAAM,WAAW,aAAa;IAC5B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC5B,+BAA+B;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;CAC7C;AAED,yDAAyD;AACzD,qBAAa,UAAW,SAAQ,KAAK;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE;gBAAlB,QAAQ,EAAE,MAAM,EAAE;CAIxC;AAKD;;;;;;;;;GASG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,MAAM,EACtB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,aAAa,CAsCf;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,QAAQ,GAAE,MAAM,EAAO,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAuB/G;AA8ED,wFAAwF;AACxF,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,GAAG,CAAC,MAAM,CAAC,CAGlF"}
package/dist/evals.js ADDED
@@ -0,0 +1,184 @@
1
+ import { existsSync, readFileSync, readdirSync } from 'node:fs';
2
+ import { createRequire } from 'node:module';
3
+ import { join } from 'node:path';
4
+ import { runInNewContext } from 'node:vm';
5
+ import { PACK_LAYOUT } from './contract.js';
6
+ // typescript is CommonJS (`export =`); required rather than imported so its
7
+ // members resolve the same under tsc and under Node's ESM loader.
8
+ const ts = createRequire(import.meta.url)('typescript');
9
+ /** Every gap in a pack's criteria, reported together. */
10
+ export class EvalsError extends Error {
11
+ problems;
12
+ constructor(problems) {
13
+ super(problems.join('\n'));
14
+ this.problems = problems;
15
+ this.name = 'EvalsError';
16
+ }
17
+ }
18
+ /** `<agent>-evals.ts`: the file `init` writes for each agent. */
19
+ const AGENT_EVALS_FILE = /^(.+)-evals\.ts$/;
20
+ /**
21
+ * Reads a pack's `evals/<agent>-evals.ts` files into data.
22
+ *
23
+ * Each file is transpiled and evaluated on its own, with no module loader: a
24
+ * criteria file is data, and `import type` is the only import it may carry. A
25
+ * file that needs a runtime import fails here, naming itself, rather than
26
+ * evaluating against whatever the build machine happens to have installed.
27
+ *
28
+ * Throws `EvalsError` when `evals/`, a criteria file, or any agent's criteria is missing or invalid.
29
+ */
30
+ export function compileEvals(root, definitionName, definition) {
31
+ const problems = [];
32
+ const dir = join(root, PACK_LAYOUT.evals);
33
+ if (!existsSync(dir)) {
34
+ throw new EvalsError([`No ${PACK_LAYOUT.evals}/ directory: every agent needs criteria to be evaluated.`]);
35
+ }
36
+ const names = agentNames(definition, problems);
37
+ const keys = new Set(Object.values(names));
38
+ const agents = {};
39
+ for (const file of readdirSync(dir).sort()) {
40
+ const match = AGENT_EVALS_FILE.exec(file);
41
+ if (!match)
42
+ continue;
43
+ const where = `${PACK_LAYOUT.evals}/${file}`;
44
+ // Filed under a node id or a subagent's name; a node's runtime name also resolves.
45
+ const agent = keys.has(match[1]) ? match[1] : names[match[1]];
46
+ if (!agent) {
47
+ problems.push(`${where}: "${match[1]}" is no agent of ${PACK_LAYOUT.definition}.`);
48
+ continue;
49
+ }
50
+ if (agents[agent]) {
51
+ problems.push(`${where}: criteria for "${agent}" are already filed in another file.`);
52
+ continue;
53
+ }
54
+ try {
55
+ agents[agent] = checkCriteria(where, evaluateCriteriaFile(join(dir, file), where), problems);
56
+ }
57
+ catch (err) {
58
+ problems.push(err instanceof Error ? err.message : String(err));
59
+ }
60
+ }
61
+ for (const agent of keys) {
62
+ if (!agents[agent]?.length) {
63
+ problems.push(`"${agent}" has no criteria: add at least one to ${PACK_LAYOUT.evals}/${agent}-evals.ts.`);
64
+ }
65
+ }
66
+ const rootAgent = rootAgentOf(definition, problems);
67
+ if (problems.length > 0)
68
+ throw new EvalsError(problems);
69
+ return { pack: definitionName, rootAgent: rootAgent, names, agents };
70
+ }
71
+ /**
72
+ * Every agent a session of this pack can run, by the name it runs under: each
73
+ * top-level node (its `config.name`, and its id) and each nested subagent (its
74
+ * name), mapped to the key its criteria are filed under.
75
+ */
76
+ export function agentNames(definition, problems = []) {
77
+ const names = {};
78
+ const nodes = Array.isArray(definition.nodes) ? definition.nodes : [];
79
+ for (const node of nodes) {
80
+ if (typeof node?.id !== 'string')
81
+ continue;
82
+ names[node.id] = node.id;
83
+ const config = (node.config ?? {});
84
+ if (typeof config.name === 'string' && config.name)
85
+ names[config.name] = node.id;
86
+ const subagents = Array.isArray(config.subagents) ? config.subagents : [];
87
+ for (const [index, sub] of subagents.entries()) {
88
+ const name = typeof sub?.name === 'string' && sub.name ? sub.name : undefined;
89
+ if (!name) {
90
+ problems.push(`${PACK_LAYOUT.definition}: subagent ${index} of "${node.id}" has no name; it cannot be graded.`);
91
+ continue;
92
+ }
93
+ if (names[name] && names[name] !== name) {
94
+ problems.push(`${PACK_LAYOUT.definition}: subagent "${name}" shares its name with node "${names[name]}".`);
95
+ continue;
96
+ }
97
+ names[name] = name;
98
+ }
99
+ }
100
+ return names;
101
+ }
102
+ /** The one Orchestrator node: the agent a session talks to, whose rows carry no agent name. */
103
+ function rootAgentOf(definition, problems) {
104
+ const nodes = Array.isArray(definition.nodes) ? definition.nodes : [];
105
+ const roots = nodes.filter((n) => n?.type === 'Orchestrator' && typeof n.id === 'string');
106
+ if (roots.length !== 1) {
107
+ problems.push(`${PACK_LAYOUT.definition}: needs exactly one node of type "Orchestrator" to attribute its rows; found ${roots.length}.`);
108
+ return undefined;
109
+ }
110
+ return roots[0].id;
111
+ }
112
+ function evaluateCriteriaFile(path, where) {
113
+ const { outputText } = ts.transpileModule(readFileSync(path, 'utf-8'), {
114
+ compilerOptions: { module: ts.ModuleKind.CommonJS, target: ts.ScriptTarget.ES2022 },
115
+ fileName: path,
116
+ });
117
+ const module = { exports: {} };
118
+ const require = (specifier) => {
119
+ throw new Error(`${where} imports "${specifier}" at runtime; a criteria file may only use \`import type\`.`);
120
+ };
121
+ runInNewContext(outputText, { module, exports: module.exports, require }, { filename: path, timeout: 1000 });
122
+ const arrays = Object.values(module.exports).filter(Array.isArray);
123
+ if (arrays.length !== 1) {
124
+ throw new Error(`${where} must export exactly one array of criteria; it exports ${arrays.length}.`);
125
+ }
126
+ return arrays[0];
127
+ }
128
+ function checkCriteria(where, value, problems) {
129
+ const criteria = value;
130
+ const seen = new Set();
131
+ return criteria.map((raw, index) => {
132
+ const c = raw;
133
+ const at = `${where} [${index}]`;
134
+ if (!c || typeof c !== 'object')
135
+ throw new Error(`${at} is not an object.`);
136
+ if (typeof c.id !== 'number' || !Number.isInteger(c.id))
137
+ throw new Error(`${at}: "id" must be an integer.`);
138
+ if (seen.has(c.id))
139
+ problems.push(`${at}: id ${c.id} is used twice; a criterion must be citable by its id.`);
140
+ seen.add(c.id);
141
+ for (const field of ['category', 'metric', 'successCriteria']) {
142
+ if (typeof c[field] !== 'string' || !c[field].trim()) {
143
+ throw new Error(`${at}: "${field}" must be a non-empty string.`);
144
+ }
145
+ }
146
+ if (c.suite !== undefined && c.suite !== 'guardrail' && c.suite !== 'north-star') {
147
+ throw new Error(`${at}: "suite" must be "guardrail" or "north-star".`);
148
+ }
149
+ const check = c.check === undefined ? undefined : checkToolCheck(at, c.check);
150
+ return {
151
+ id: c.id,
152
+ category: c.category,
153
+ metric: c.metric,
154
+ successCriteria: c.successCriteria,
155
+ ...(c.suite ? { suite: c.suite } : {}),
156
+ ...(check ? { check } : {}),
157
+ };
158
+ });
159
+ }
160
+ function checkToolCheck(at, value) {
161
+ const v = value;
162
+ if (!v || typeof v !== 'object')
163
+ throw new Error(`${at}: "check" must be an object.`);
164
+ const names = (field) => {
165
+ const list = v[field];
166
+ if (list === undefined)
167
+ return undefined;
168
+ if (!Array.isArray(list) || list.some((t) => typeof t !== 'string' || !t)) {
169
+ throw new Error(`${at}: "check.${field}" must be a list of tool names.`);
170
+ }
171
+ return list;
172
+ };
173
+ const toolsNotCalled = names('toolsNotCalled');
174
+ const toolsCalled = names('toolsCalled');
175
+ if (!toolsNotCalled && !toolsCalled)
176
+ throw new Error(`${at}: "check" names no tools.`);
177
+ return { ...(toolsNotCalled ? { toolsNotCalled } : {}), ...(toolsCalled ? { toolsCalled } : {}) };
178
+ }
179
+ /** The definition's top-level node ids: the agents a criteria file may be named for. */
180
+ export function definitionNodeIds(definition) {
181
+ const nodes = Array.isArray(definition.nodes) ? definition.nodes : [];
182
+ return new Set(nodes.map((n) => n?.id).filter((id) => typeof id === 'string'));
183
+ }
184
+ //# sourceMappingURL=evals.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evals.js","sourceRoot":"","sources":["../src/evals.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAC1C,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,4EAA4E;AAC5E,kEAAkE;AAClE,MAAM,EAAE,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,YAAY,CAAgC,CAAC;AAoDvF,yDAAyD;AACzD,MAAM,OAAO,UAAW,SAAQ,KAAK;IACd;IAArB,YAAqB,QAAkB;QACrC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;QADR,aAAQ,GAAR,QAAQ,CAAU;QAErC,IAAI,CAAC,IAAI,GAAG,YAAY,CAAC;IAC3B,CAAC;CACF;AAED,iEAAiE;AACjE,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAE5C;;;;;;;;;GASG;AACH,MAAM,UAAU,YAAY,CAC1B,IAAY,EACZ,cAAsB,EACtB,UAAmC;IAEnC,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IAC1C,IAAI,CAA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_DIR, PACK_CONTENT_ROOT, PACK_EXCLUDED, PACK_LAYOUT, SOURCE_LAYOUT, packImageName, type ComputerManifest } from './contract.js';
2
+ export { agentNames, compileEvals, definitionNodeIds, EvalsError, type CompiledEvals, type EvalToolCheck, type PackEvalCriterion } from './evals.js';
3
+ export { initPack, type InitOptions, type InitResult } from './init.js';
4
+ export { buildPackInventory, computePackContentDigest } from './inventory.js';
5
+ export { PACK_INVENTORY_SCHEMA_VERSION, RUNTIME_BUILTIN_TOOLS, RUNTIME_BUILTIN_TOOL_SET, extractSkillLeafName, projectDraftPackInventory, type AgentCapabilityInventory, type AgentNodeKind, type AgentTypeKind, type AuthoredDraftSkillSpec, type AuthoredDraftToolSpec, type FunctionToolInventoryItem, type FunctionToolKind, type FunctionToolScope, type FunctionToolStatus, type PackCatalogEntry, type PackCatalogSource, type PackInventory, type RuntimeBuiltinTool, type SkillInventoryItem, type ValidatedDraftPackManifest, } from './inventory-types.js';
6
+ export { resolvePack, type PackSources, type ResolveOptions, type ResolvedPack } from './resolve.js';
7
+ export { PACK_DOCKERFILE, stagePack, type StagedPack } from './stage.js';
8
+ export { TOPOLOGIES, TOPOLOGY_NAMES, resolveTopology, type Topology } from './topologies.js';
9
+ export { hasErrors, validatePack, type Finding } from './validate.js';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,KAAK,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACvJ,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAE,KAAK,aAAa,EAAE,KAAK,aAAa,EAAE,KAAK,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACrJ,OAAO,EAAE,QAAQ,EAAE,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EACzB,KAAK,wBAAwB,EAC7B,KAAK,aAAa,EAClB,KAAK,aAAa,EAClB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,yBAAyB,EAC9B,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,kBAAkB,EACvB,KAAK,gBAAgB,EACrB,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,0BAA0B,GAChC,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,KAAK,cAAc,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAE,KAAK,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,eAAe,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ export { COMPUTER_IMAGE_DIR, PACK_CONTENT_ROOT, PACK_EXCLUDED, PACK_LAYOUT, SOURCE_LAYOUT, packImageName } from './contract.js';
2
+ export { agentNames, compileEvals, definitionNodeIds, EvalsError } from './evals.js';
3
+ export { initPack } from './init.js';
4
+ export { buildPackInventory, computePackContentDigest } from './inventory.js';
5
+ export { PACK_INVENTORY_SCHEMA_VERSION, RUNTIME_BUILTIN_TOOLS, RUNTIME_BUILTIN_TOOL_SET, extractSkillLeafName, projectDraftPackInventory, } from './inventory-types.js';
6
+ export { resolvePack } from './resolve.js';
7
+ export { PACK_DOCKERFILE, stagePack } from './stage.js';
8
+ export { TOPOLOGIES, TOPOLOGY_NAMES, resolveTopology } from './topologies.js';
9
+ export { hasErrors, validatePack } from './validate.js';
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,iBAAiB,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAyB,MAAM,eAAe,CAAC;AACvJ,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,iBAAiB,EAAE,UAAU,EAAkE,MAAM,YAAY,CAAC;AACrJ,OAAO,EAAE,QAAQ,EAAqC,MAAM,WAAW,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAC;AAC9E,OAAO,EACL,6BAA6B,EAC7B,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,GAgB1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,WAAW,EAA4D,MAAM,cAAc,CAAC;AACrG,OAAO,EAAE,eAAe,EAAE,SAAS,EAAmB,MAAM,YAAY,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,eAAe,EAAiB,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,YAAY,EAAgB,MAAM,eAAe,CAAC"}
package/dist/init.d.ts ADDED
@@ -0,0 +1,43 @@
1
+ import { type Topology } from './topologies.js';
2
+ export interface InitOptions {
3
+ /** Pack name. Becomes the definition's `name`, which the SDK resolves images by. */
4
+ name: string;
5
+ /** Where to write. Defaults to ./<name>. */
6
+ dir?: string;
7
+ /** A topology name, not a declared value — see topologies.ts. */
8
+ topology: string;
9
+ /** Specialists beside the orchestrator. Defaults to one, so the pack is runnable. */
10
+ agents?: string[];
11
+ /** Workspace backend. `db` unless the pack keeps real files. */
12
+ persistentWorkspace?: 'db' | 's3';
13
+ /**
14
+ * Generate `sandbox/Dockerfile`, for a pack with dependencies that cannot be
15
+ * fetched at startup.
16
+ *
17
+ * Off by default, and the default is the one that means something: with no
18
+ * recipe there is no sandbox image for this pack, and the SDK runs it on the
19
+ * default harness image (AGENT_SDK_DEFAULT_IMAGE). Generating an empty one for
20
+ * every pack would give each a product-specific image to maintain that is
21
+ * identical to the default.
22
+ */
23
+ sandbox?: boolean;
24
+ }
25
+ export interface InitResult {
26
+ root: string;
27
+ /** Every path written, relative to root, for the CLI to print. */
28
+ written: string[];
29
+ declaredTopology: Topology['declares'];
30
+ }
31
+ /**
32
+ * Writes a new pack: a definition, one instructions directory per agent, and bin/.
33
+ *
34
+ * Content only. A pack names no service, no chart and no image, so there is
35
+ * nothing here to deploy and nothing for a consumer to wire — which is what makes
36
+ * a new builder a directory rather than a project (ADR-041).
37
+ *
38
+ * The orchestrator is not optional and not named by the caller: every topology the
39
+ * runtime builds has one entry point, and a pack whose first node is a specialist
40
+ * has no one to delegate.
41
+ */
42
+ export declare function initPack(options: InitOptions): InitResult;
43
+ //# sourceMappingURL=init.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../src/init.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,QAAQ,EAAmB,MAAM,iBAAiB,CAAC;AAUjE,MAAM,WAAW,WAAW;IAC1B,oFAAoF;IACpF,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,QAAQ,EAAE,MAAM,CAAC;IACjB,qFAAqF;IACrF,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAClC;;;;;;;;;OASG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,kEAAkE;IAClE,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,gBAAgB,EAAE,QAAQ,CAAC,UAAU,CAAC,CAAC;CACxC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,GAAG,UAAU,CAiGzD"}