@wairon/cli 5.1.1-dev.8 → 5.1.1-dev.9

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/index.js CHANGED
@@ -33,6 +33,78 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
33
33
  ));
34
34
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
35
 
36
+ // src/models/execution.ts
37
+ var import_zod, WorkBreadthSchema, ReasoningDepthSchema, ExecutionProfileSchema, ModelTierSchema, EffortTierSchema, ToolClassSchema, McpAccessSchema, ExecutionBudgetSchema, BudgetTierSchema, ExecutionConfigSchema;
38
+ var init_execution = __esm({
39
+ "src/models/execution.ts"() {
40
+ "use strict";
41
+ import_zod = require("zod");
42
+ WorkBreadthSchema = import_zod.z.enum(["narrow", "moderate", "wide"]);
43
+ ReasoningDepthSchema = import_zod.z.enum(["mechanical", "standard", "deep"]);
44
+ ExecutionProfileSchema = import_zod.z.object({
45
+ /** How much of the tree the agent must read. */
46
+ breadth: WorkBreadthSchema,
47
+ /** Whether the agent modifies files at all. Read-only agents are cheap and safe. */
48
+ writes: import_zod.z.boolean(),
49
+ /** How much judgment the work carries. */
50
+ reasoningDepth: ReasoningDepthSchema,
51
+ /**
52
+ * Whether this agent is a MANAGER — its job is to route work to others
53
+ * rather than perform it. Managers must stay thin: a manager that reads
54
+ * files accumulates context exactly like a main session and stops being
55
+ * cheaper than doing the work inline.
56
+ */
57
+ delegates: import_zod.z.boolean(),
58
+ /** Why the profile came out this way — surfaced in briefs and `wairon analyze`. */
59
+ rationale: import_zod.z.string()
60
+ });
61
+ ModelTierSchema = import_zod.z.enum(["small", "standard", "large", "frontier"]);
62
+ EffortTierSchema = import_zod.z.enum(["low", "medium", "high", "xhigh"]);
63
+ ToolClassSchema = import_zod.z.enum(["read-only", "implement", "orchestrate", "full"]);
64
+ McpAccessSchema = import_zod.z.enum(["none", "project", "all"]);
65
+ ExecutionBudgetSchema = import_zod.z.object({
66
+ /**
67
+ * Absent means "express no model choice" — the `free` tier is defined as
68
+ * having no quality tradeoff, and picking a model is a quality decision.
69
+ * Exporters must omit the field entirely rather than substituting a default.
70
+ */
71
+ modelTier: ModelTierSchema.optional(),
72
+ effort: EffortTierSchema.optional(),
73
+ /**
74
+ * Turn ceiling — a circuit breaker, not a target. Its purpose is to stop the
75
+ * runaway case: a subagent that runs hundreds of turns while accumulating
76
+ * context is no longer preserving the parent's context, it is a second
77
+ * expensive session. Hitting the ceiling returns partial output, which is
78
+ * the intended failure mode.
79
+ */
80
+ maxTurns: import_zod.z.number().int().positive().optional(),
81
+ toolClass: ToolClassSchema,
82
+ /**
83
+ * Whether this agent may spawn its own subagents. False withholds the
84
+ * delegation tool entirely — structural enforcement, so no instruction text
85
+ * has to be carried (and re-read) to achieve it.
86
+ */
87
+ allowNestedDelegation: import_zod.z.boolean(),
88
+ mcp: McpAccessSchema
89
+ });
90
+ BudgetTierSchema = import_zod.z.enum(["off", "free", "default", "trade", "aggressive"]);
91
+ ExecutionConfigSchema = import_zod.z.object({
92
+ /**
93
+ * How hard to optimize. `off` preserves pre-feature output exactly, so
94
+ * enabling this feature can never silently change an existing project's
95
+ * generated files.
96
+ */
97
+ tier: BudgetTierSchema.default("off"),
98
+ /**
99
+ * Per-agent overrides, keyed by agent id. An explicit budget always wins
100
+ * over derivation — the tree is a good default, not an authority on how
101
+ * you want to spend.
102
+ */
103
+ overrides: import_zod.z.record(ExecutionBudgetSchema.partial()).default({})
104
+ });
105
+ }
106
+ });
107
+
36
108
  // src/models/agent.ts
37
109
  function createAgentRecord(partial) {
38
110
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -50,83 +122,99 @@ function createAgentRecord(partial) {
50
122
  ...partial
51
123
  });
52
124
  }
53
- var import_zod, BuiltinTargetSchema, CustomTargetSchema, OutputTargetSchema, AgentStatusSchema, AgentRecordSchema, AgentTemplateSchema, AgentBriefSchema;
125
+ var import_zod2, BuiltinTargetSchema, CustomTargetSchema, OutputTargetSchema, AgentStatusSchema, AgentRecordSchema, AgentTemplateSchema, AgentBriefSchema;
54
126
  var init_agent = __esm({
55
127
  "src/models/agent.ts"() {
56
128
  "use strict";
57
- import_zod = require("zod");
58
- BuiltinTargetSchema = import_zod.z.enum(["claude", "gemini", "agy", "cursor", "copilot", "codex"]);
59
- CustomTargetSchema = import_zod.z.object({
60
- type: import_zod.z.literal("custom"),
129
+ import_zod2 = require("zod");
130
+ init_execution();
131
+ BuiltinTargetSchema = import_zod2.z.enum(["claude", "gemini", "agy", "cursor", "copilot", "codex"]);
132
+ CustomTargetSchema = import_zod2.z.object({
133
+ type: import_zod2.z.literal("custom"),
61
134
  /** Human-readable label for this target, e.g. "Cursor" */
62
- label: import_zod.z.string(),
135
+ label: import_zod2.z.string(),
63
136
  /** Root output directory relative to the project root, e.g. ".cursor/agents" */
64
- outputDir: import_zod.z.string()
137
+ outputDir: import_zod2.z.string()
65
138
  });
66
- OutputTargetSchema = import_zod.z.union([BuiltinTargetSchema, CustomTargetSchema]);
67
- AgentStatusSchema = import_zod.z.enum(["active", "draft", "deprecated"]);
68
- AgentRecordSchema = import_zod.z.object({
139
+ OutputTargetSchema = import_zod2.z.union([BuiltinTargetSchema, CustomTargetSchema]);
140
+ AgentStatusSchema = import_zod2.z.enum(["active", "draft", "deprecated"]);
141
+ AgentRecordSchema = import_zod2.z.object({
69
142
  /** Unique identifier within this project, e.g. "core-service-owner" */
70
- id: import_zod.z.string().regex(/^[a-z0-9-_]+$/, "Agent id must be lowercase alphanumeric with dashes or underscores"),
143
+ id: import_zod2.z.string().regex(/^[a-z0-9-_]+$/, "Agent id must be lowercase alphanumeric with dashes or underscores"),
71
144
  /** Human-readable display name */
72
- name: import_zod.z.string(),
145
+ name: import_zod2.z.string(),
73
146
  /** Short description of what this agent is responsible for */
74
- description: import_zod.z.string(),
147
+ description: import_zod2.z.string(),
75
148
  /** Template id this agent was created from, e.g. "domain-owner" */
76
- template: import_zod.z.string(),
149
+ template: import_zod2.z.string(),
77
150
  /** Bundle id this agent was created as part of, if applicable */
78
- bundleOrigin: import_zod.z.string().optional(),
151
+ bundleOrigin: import_zod2.z.string().optional(),
79
152
  /**
80
153
  * The domain id this agent is responsible for (a subsystem id or a
81
154
  * free-standing domain id). Undefined = root-level agent.
82
155
  */
83
- domainRoot: import_zod.z.string().optional(),
156
+ domainRoot: import_zod2.z.string().optional(),
84
157
  /**
85
158
  * Paths this agent owns, expressed relative to the project root.
86
159
  * e.g. ["services/core/**"]
87
160
  */
88
- ownedPaths: import_zod.z.array(import_zod.z.string()).default([]),
161
+ ownedPaths: import_zod2.z.array(import_zod2.z.string()).default([]),
89
162
  /** Paths this agent may read but does not own */
90
- readPaths: import_zod.z.array(import_zod.z.string()).default([]),
163
+ readPaths: import_zod2.z.array(import_zod2.z.string()).default([]),
91
164
  /** Paths this agent may write to but does not own */
92
- writePaths: import_zod.z.array(import_zod.z.string()).default([]),
165
+ writePaths: import_zod2.z.array(import_zod2.z.string()).default([]),
93
166
  /** Classification tags, e.g. ["service", "backend", "critical"] */
94
- tags: import_zod.z.array(import_zod.z.string()).default([]),
167
+ tags: import_zod2.z.array(import_zod2.z.string()).default([]),
95
168
  /** Ids of related agents this agent should be aware of */
96
- dependencies: import_zod.z.array(import_zod.z.string()).default([]),
169
+ dependencies: import_zod2.z.array(import_zod2.z.string()).default([]),
97
170
  /** Rendered implementation guidance for this agent's variant-tagged components (deep variant integration); empty when none. */
98
- variantGuidance: import_zod.z.string().optional(),
171
+ variantGuidance: import_zod2.z.string().optional(),
99
172
  /** Why this agent was created — the architectural reason for its existence */
100
- creationReason: import_zod.z.string(),
173
+ creationReason: import_zod2.z.string(),
101
174
  status: AgentStatusSchema.default("active"),
102
175
  /** Which output targets should receive this agent's generated file */
103
- targets: import_zod.z.array(OutputTargetSchema).default(["claude"]),
104
- createdAt: import_zod.z.string().datetime(),
105
- updatedAt: import_zod.z.string().datetime()
176
+ targets: import_zod2.z.array(OutputTargetSchema).default(["claude"]),
177
+ createdAt: import_zod2.z.string().datetime(),
178
+ updatedAt: import_zod2.z.string().datetime()
106
179
  });
107
- AgentTemplateSchema = import_zod.z.object({
180
+ AgentTemplateSchema = import_zod2.z.object({
108
181
  /** Template identifier (architect, domain-owner, implementer, …) */
109
- templateName: import_zod.z.string(),
182
+ templateName: import_zod2.z.string(),
110
183
  /** The raw instruction body with {{variable}} placeholders, before rendering */
111
- instructions: import_zod.z.string()
184
+ instructions: import_zod2.z.string()
112
185
  });
113
- AgentBriefSchema = import_zod.z.object({
186
+ AgentBriefSchema = import_zod2.z.object({
114
187
  /** The resolved agent's stable id (e.g. sdd_core-owner, system-architect) */
115
- agentId: import_zod.z.string(),
188
+ agentId: import_zod2.z.string(),
116
189
  /** Human-readable display name of the agent */
117
- name: import_zod.z.string(),
190
+ name: import_zod2.z.string(),
118
191
  /** The instruction template the brief was rendered from */
119
- template: import_zod.z.string(),
192
+ template: import_zod2.z.string(),
120
193
  /** Domain the agent belongs to (absent = global root) */
121
- domainRoot: import_zod.z.string().optional(),
194
+ domainRoot: import_zod2.z.string().optional(),
122
195
  /** Glob patterns of the files this agent owns — the write-scope fence */
123
- ownedPaths: import_zod.z.array(import_zod.z.string()),
196
+ ownedPaths: import_zod2.z.array(import_zod2.z.string()),
124
197
  /** Spec paths the subagent should read first */
125
- readPaths: import_zod.z.array(import_zod.z.string()).optional(),
198
+ readPaths: import_zod2.z.array(import_zod2.z.string()).optional(),
126
199
  /** The fully rendered instruction body — paste-ready as a subagent prompt */
127
- instructions: import_zod.z.string(),
200
+ instructions: import_zod2.z.string(),
128
201
  /** Rendered variant guidance, also folded into instructions */
129
- variantGuidance: import_zod.z.string().optional()
202
+ variantGuidance: import_zod2.z.string().optional(),
203
+ /**
204
+ * The resource shape of this agent's work, and the allowance it earns.
205
+ *
206
+ * Both are ABSENT unless the project has opted in with `execution.tier`,
207
+ * which is what keeps the brief useful to consumers that cannot act on it:
208
+ * an MCP client with no subagents — or a host tool that cannot express a
209
+ * model choice — simply never sees these fields.
210
+ *
211
+ * Where generated agent files can ENFORCE a budget through front-matter,
212
+ * a brief can only ADVISE: the caller spawning from this brief is the one
213
+ * that picks the model and tool grant. That asymmetry is deliberate, not a
214
+ * gap — a brief is consumed by tools wairon does not control.
215
+ */
216
+ profile: ExecutionProfileSchema.optional(),
217
+ budget: ExecutionBudgetSchema.optional()
130
218
  });
131
219
  }
132
220
  });
@@ -135,33 +223,33 @@ var init_agent = __esm({
135
223
  function createEmptyTopologyConfig() {
136
224
  return { schemaVersion: "1.0.0", domains: [] };
137
225
  }
138
- var import_zod2, DomainSchema, TopologyConfigSchema, DomainTypeSchema;
226
+ var import_zod3, DomainSchema, TopologyConfigSchema, DomainTypeSchema;
139
227
  var init_domain = __esm({
140
228
  "src/models/domain.ts"() {
141
229
  "use strict";
142
- import_zod2 = require("zod");
143
- DomainSchema = import_zod2.z.object({
230
+ import_zod3 = require("zod");
231
+ DomainSchema = import_zod3.z.object({
144
232
  /** Unique identifier within the project, e.g. "billing" or "docs". */
145
- id: import_zod2.z.string().regex(/^[a-z0-9-_]+$/, "Domain id must be lowercase alphanumeric with dashes or underscores"),
233
+ id: import_zod3.z.string().regex(/^[a-z0-9-_]+$/, "Domain id must be lowercase alphanumeric with dashes or underscores"),
146
234
  /** Optional display name. */
147
- name: import_zod2.z.string().optional(),
235
+ name: import_zod3.z.string().optional(),
148
236
  /** Optional description of the domain's responsibility. */
149
- description: import_zod2.z.string().optional(),
237
+ description: import_zod3.z.string().optional(),
150
238
  /**
151
239
  * The spec node this domain binds to: a subsystem id (the common case) or a
152
240
  * component id. Omitted means the domain is free-standing.
153
241
  */
154
- boundTo: import_zod2.z.string().optional(),
242
+ boundTo: import_zod3.z.string().optional(),
155
243
  /** Glob patterns this domain owns. Derived for spec-backed, authored for free-standing. */
156
- ownedPaths: import_zod2.z.array(import_zod2.z.string()).default([]),
244
+ ownedPaths: import_zod3.z.array(import_zod3.z.string()).default([]),
157
245
  /** Optional physical directory (e.g. a monorepo package or submodule root). */
158
- path: import_zod2.z.string().optional()
246
+ path: import_zod3.z.string().optional()
159
247
  });
160
- TopologyConfigSchema = import_zod2.z.object({
161
- schemaVersion: import_zod2.z.string().default("1.0.0"),
162
- domains: import_zod2.z.array(DomainSchema).default([])
248
+ TopologyConfigSchema = import_zod3.z.object({
249
+ schemaVersion: import_zod3.z.string().default("1.0.0"),
250
+ domains: import_zod3.z.array(DomainSchema).default([])
163
251
  });
164
- DomainTypeSchema = import_zod2.z.enum([
252
+ DomainTypeSchema = import_zod3.z.enum([
165
253
  "git-submodule",
166
254
  // declared in .gitmodules
167
255
  "git-repo",
@@ -175,102 +263,103 @@ var init_domain = __esm({
175
263
  });
176
264
 
177
265
  // src/models/project.ts
178
- var import_zod3, BuiltinTargetConfigSchema, CustomTargetConfigSchema, TargetConfigSchema, NamingRuleConfigSchema, DocumentationRuleConfigSchema, ComplexityRuleConfigSchema, DesignDepthSchema, RulesConfigSchema, PathsConfigSchema, PackSelectionSchema, ProfileSelectionSubjectSchema, ProjectProfileSelectionSchema, ProjectConfigSchema;
266
+ var import_zod4, BuiltinTargetConfigSchema, CustomTargetConfigSchema, TargetConfigSchema, NamingRuleConfigSchema, DocumentationRuleConfigSchema, ComplexityRuleConfigSchema, DesignDepthSchema, RulesConfigSchema, PathsConfigSchema, PackSelectionSchema, ProfileSelectionSubjectSchema, ProjectProfileSelectionSchema, ProjectConfigSchema;
179
267
  var init_project = __esm({
180
268
  "src/models/project.ts"() {
181
269
  "use strict";
182
- import_zod3 = require("zod");
270
+ import_zod4 = require("zod");
183
271
  init_agent();
184
- BuiltinTargetConfigSchema = import_zod3.z.object({
185
- type: import_zod3.z.enum(["claude", "gemini", "agy", "cursor", "copilot", "codex"]),
272
+ init_execution();
273
+ BuiltinTargetConfigSchema = import_zod4.z.object({
274
+ type: import_zod4.z.enum(["claude", "gemini", "agy", "cursor", "copilot", "codex"]),
186
275
  /** Output directory for generated agent files, relative to project root */
187
- outputDir: import_zod3.z.string(),
276
+ outputDir: import_zod4.z.string(),
188
277
  /** Whether this target is active */
189
- enabled: import_zod3.z.boolean().default(true)
278
+ enabled: import_zod4.z.boolean().default(true)
190
279
  });
191
280
  CustomTargetConfigSchema = CustomTargetSchema.extend({
192
- enabled: import_zod3.z.boolean().default(true)
281
+ enabled: import_zod4.z.boolean().default(true)
193
282
  });
194
- TargetConfigSchema = import_zod3.z.union([BuiltinTargetConfigSchema, CustomTargetConfigSchema]);
195
- NamingRuleConfigSchema = import_zod3.z.object({
283
+ TargetConfigSchema = import_zod4.z.union([BuiltinTargetConfigSchema, CustomTargetConfigSchema]);
284
+ NamingRuleConfigSchema = import_zod4.z.object({
196
285
  /** Casing style or regular expression for subsystem names/IDs */
197
- subsystems: import_zod3.z.string().optional(),
286
+ subsystems: import_zod4.z.string().optional(),
198
287
  /** Casing style or regular expression for component names/IDs */
199
- components: import_zod3.z.string().optional(),
288
+ components: import_zod4.z.string().optional(),
200
289
  /** Casing style or regular expression for interface names/IDs */
201
- interfaces: import_zod3.z.string().optional(),
290
+ interfaces: import_zod4.z.string().optional(),
202
291
  /** Casing style or regular expression for general type names/IDs */
203
- types: import_zod3.z.string().optional(),
292
+ types: import_zod4.z.string().optional(),
204
293
  /** Casing style or regular expression for entity type names/IDs */
205
- entities: import_zod3.z.string().optional(),
294
+ entities: import_zod4.z.string().optional(),
206
295
  /** Casing style or regular expression for value-object type names/IDs */
207
- valueObjects: import_zod3.z.string().optional(),
296
+ valueObjects: import_zod4.z.string().optional(),
208
297
  /** Casing style or regular expression for interface/implementation/type method names */
209
- methods: import_zod3.z.string().optional(),
298
+ methods: import_zod4.z.string().optional(),
210
299
  /** Casing style or regular expression for general type fields */
211
- fields: import_zod3.z.string().optional(),
300
+ fields: import_zod4.z.string().optional(),
212
301
  /** Casing style or regular expression for constants/enum variants */
213
- constants: import_zod3.z.string().optional(),
302
+ constants: import_zod4.z.string().optional(),
214
303
  /** Casing style or regular expression for parameters/variables */
215
- variables: import_zod3.z.string().optional(),
304
+ variables: import_zod4.z.string().optional(),
216
305
  /** Stereotype-specific naming rules (prefixes, suffixes, regexes) */
217
- stereotypes: import_zod3.z.record(import_zod3.z.object({
218
- match: import_zod3.z.enum(["id", "name", "both"]).default("both"),
219
- prefix: import_zod3.z.string().optional(),
220
- suffix: import_zod3.z.string().optional(),
221
- regex: import_zod3.z.string().optional()
306
+ stereotypes: import_zod4.z.record(import_zod4.z.object({
307
+ match: import_zod4.z.enum(["id", "name", "both"]).default("both"),
308
+ prefix: import_zod4.z.string().optional(),
309
+ suffix: import_zod4.z.string().optional(),
310
+ regex: import_zod4.z.string().optional()
222
311
  })).optional()
223
312
  });
224
- DocumentationRuleConfigSchema = import_zod3.z.object({
313
+ DocumentationRuleConfigSchema = import_zod4.z.object({
225
314
  /** Minimum character length for description fields */
226
- minDescriptionLength: import_zod3.z.number().int().nonnegative().optional(),
315
+ minDescriptionLength: import_zod4.z.number().int().nonnegative().optional(),
227
316
  /** Force subsystem, component, interface, and type specs to have non-empty descriptions */
228
- requireDescriptions: import_zod3.z.boolean().optional(),
317
+ requireDescriptions: import_zod4.z.boolean().optional(),
229
318
  /** Force interface and type methods to have non-empty descriptions */
230
- requireMethodDescriptions: import_zod3.z.boolean().optional(),
319
+ requireMethodDescriptions: import_zod4.z.boolean().optional(),
231
320
  /** Force type fields to have non-empty descriptions */
232
- requireFieldDescriptions: import_zod3.z.boolean().optional()
321
+ requireFieldDescriptions: import_zod4.z.boolean().optional()
233
322
  });
234
- ComplexityRuleConfigSchema = import_zod3.z.object({
323
+ ComplexityRuleConfigSchema = import_zod4.z.object({
235
324
  /** Maximum number of parameters allowed on a single interface method */
236
- maxMethodParams: import_zod3.z.number().int().nonnegative().optional(),
325
+ maxMethodParams: import_zod4.z.number().int().nonnegative().optional(),
237
326
  /** Maximum number of methods allowed on a single interface contract */
238
- maxInterfaceMethods: import_zod3.z.number().int().nonnegative().optional(),
327
+ maxInterfaceMethods: import_zod4.z.number().int().nonnegative().optional(),
239
328
  /** Maximum number of dependencies allowed on a single component */
240
- maxComponentDependencies: import_zod3.z.number().int().nonnegative().optional(),
329
+ maxComponentDependencies: import_zod4.z.number().int().nonnegative().optional(),
241
330
  /** Maximum number of narrative steps allowed in a single method implementation */
242
- maxNarrativeSteps: import_zod3.z.number().int().nonnegative().optional(),
331
+ maxNarrativeSteps: import_zod4.z.number().int().nonnegative().optional(),
243
332
  /** Maximum number of direct components allowed in a single subsystem */
244
- maxSubsystemComponents: import_zod3.z.number().int().nonnegative().optional(),
333
+ maxSubsystemComponents: import_zod4.z.number().int().nonnegative().optional(),
245
334
  /**
246
335
  * Maximum cyclomatic complexity a realized function may measure (exact AST
247
336
  * grade) while its method's narrative detail sits below `full` with no
248
337
  * narrative — above it the detail-sufficiency lint fires
249
338
  * (UNNARRATED_COMPLEXITY). Default 8 when unset.
250
339
  */
251
- maxUnnarratedComplexity: import_zod3.z.number().int().nonnegative().optional()
340
+ maxUnnarratedComplexity: import_zod4.z.number().int().nonnegative().optional()
252
341
  });
253
- DesignDepthSchema = import_zod3.z.enum(["components", "interfaces", "implementations", "narratives"]);
254
- RulesConfigSchema = import_zod3.z.object({
342
+ DesignDepthSchema = import_zod4.z.enum(["components", "interfaces", "implementations", "narratives"]);
343
+ RulesConfigSchema = import_zod4.z.object({
255
344
  /**
256
345
  * Prevent two agents from declaring overlapping ownedPaths.
257
346
  * Strongly recommended: true.
258
347
  */
259
- noOverlappingOwnership: import_zod3.z.boolean().default(true),
348
+ noOverlappingOwnership: import_zod4.z.boolean().default(true),
260
349
  /**
261
350
  * Require every non-meta agent to have at least one ownedPath.
262
351
  */
263
- requireOwnedPaths: import_zod3.z.boolean().default(true),
352
+ requireOwnedPaths: import_zod4.z.boolean().default(true),
264
353
  /**
265
354
  * Tags that mark an agent as a meta/guardian agent — exempt from
266
355
  * requireOwnedPaths.
267
356
  */
268
- metaAgentTags: import_zod3.z.array(import_zod3.z.string()).default(["meta", "guardian", "architect"]),
357
+ metaAgentTags: import_zod4.z.array(import_zod4.z.string()).default(["meta", "guardian", "architect"]),
269
358
  /**
270
359
  * Generated outputs should exactly reproduce from the registry.
271
360
  * Warn if generated files differ from what the registry would produce.
272
361
  */
273
- enforceReproducibility: import_zod3.z.boolean().default(true),
362
+ enforceReproducibility: import_zod4.z.boolean().default(true),
274
363
  /**
275
364
  * Whether to generate an individual implementer agent PER COMPONENT. Off by
276
365
  * default: one subsystem-owner agent per subsystem owns its components'
@@ -280,7 +369,7 @@ var init_project = __esm({
280
369
  * emit thousands of agents — reserve it for small trees that genuinely want
281
370
  * per-component isolation.
282
371
  */
283
- generateComponentImplementers: import_zod3.z.boolean().default(false),
372
+ generateComponentImplementers: import_zod4.z.boolean().default(false),
284
373
  /**
285
374
  * Whether `wairon generate` writes per-subsystem owner/architect agent FILES.
286
375
  * Off by default: agents are served as LIVE briefs (sdd_get_agent_brief /
@@ -288,12 +377,12 @@ var init_project = __esm({
288
377
  * same briefs. When off, generate reconciles to zero agent files — leftover
289
378
  * wairon-managed files are removed (hand-authored files never are).
290
379
  */
291
- materializeAgentFiles: import_zod3.z.boolean().default(false),
380
+ materializeAgentFiles: import_zod4.z.boolean().default(false),
292
381
  /**
293
382
  * Severity overrides for SDD validation rules.
294
383
  * Key: rule code (e.g. CIRCULAR_DEPENDENCY), Value: error | warning | off
295
384
  */
296
- sddRuleSeverity: import_zod3.z.record(import_zod3.z.enum(["error", "warning", "off"])).default({}),
385
+ sddRuleSeverity: import_zod4.z.record(import_zod4.z.enum(["error", "warning", "off"])).default({}),
297
386
  /** Dynamic naming conventions and stereotype suffix rules */
298
387
  naming: NamingRuleConfigSchema.optional(),
299
388
  /** Dynamic metadata documentation constraints */
@@ -303,57 +392,57 @@ var init_project = __esm({
303
392
  /** Project-default design depth (see DesignDepthSchema); subsystems may override. */
304
393
  designDepth: DesignDepthSchema.optional()
305
394
  });
306
- PathsConfigSchema = import_zod3.z.object({
395
+ PathsConfigSchema = import_zod4.z.object({
307
396
  /** Base directory containing SDD specification files, relative to project root */
308
- specsDir: import_zod3.z.string().default(".wai/specs")
397
+ specsDir: import_zod4.z.string().default(".wai/specs")
309
398
  });
310
- PackSelectionSchema = import_zod3.z.object({
399
+ PackSelectionSchema = import_zod4.z.object({
311
400
  /** The pack name — the only required field. */
312
- name: import_zod3.z.string().min(1),
401
+ name: import_zod4.z.string().min(1),
313
402
  /** Exact version pin. Omitted = the latest version installed in the store. */
314
- version: import_zod3.z.string().min(1).optional(),
403
+ version: import_zod4.z.string().min(1).optional(),
315
404
  /** Content digest pin (`sha256-…`), verified on resolution. */
316
- integrity: import_zod3.z.string().min(1).optional(),
405
+ integrity: import_zod4.z.string().min(1).optional(),
317
406
  /**
318
407
  * Where to obtain this pack — recorded automatically from the store's install
319
408
  * record at selection time, so a fresh machine or CI runner can fetch it
320
409
  * (`wairon pack sync`). Supports a `{version}` placeholder and `${VAR}` env
321
410
  * expansion for private URLs.
322
411
  */
323
- source: import_zod3.z.string().min(1).optional(),
412
+ source: import_zod4.z.string().min(1).optional(),
324
413
  /**
325
414
  * Commit a copy under `.wai/packs/<name>/<version>/` and resolve from there
326
415
  * first, so the project needs no machine setup at all — the answer for private
327
416
  * packs, air-gapped CI, and repos that must be self-sufficient.
328
417
  */
329
- bundle: import_zod3.z.boolean().optional()
418
+ bundle: import_zod4.z.boolean().optional()
330
419
  });
331
- ProfileSelectionSubjectSchema = import_zod3.z.object({
332
- userId: import_zod3.z.string(),
333
- kind: import_zod3.z.string(),
334
- issuer: import_zod3.z.string(),
335
- externalSubject: import_zod3.z.string().optional(),
336
- displayName: import_zod3.z.string().optional(),
337
- email: import_zod3.z.string().optional()
420
+ ProfileSelectionSubjectSchema = import_zod4.z.object({
421
+ userId: import_zod4.z.string(),
422
+ kind: import_zod4.z.string(),
423
+ issuer: import_zod4.z.string(),
424
+ externalSubject: import_zod4.z.string().optional(),
425
+ displayName: import_zod4.z.string().optional(),
426
+ email: import_zod4.z.string().optional()
338
427
  });
339
- ProjectProfileSelectionSchema = import_zod3.z.object({
428
+ ProjectProfileSelectionSchema = import_zod4.z.object({
340
429
  /** Selected architectural profile ids. The first resolvable one is applied as projectType. */
341
- profileIds: import_zod3.z.array(import_zod3.z.string()).default([]),
430
+ profileIds: import_zod4.z.array(import_zod4.z.string()).default([]),
342
431
  /** Pack names the governing policy requires for this project. */
343
- requiredPackNames: import_zod3.z.array(import_zod3.z.string()).default([]),
432
+ requiredPackNames: import_zod4.z.array(import_zod4.z.string()).default([]),
344
433
  /** Pack names applied by default unless explicitly overridden. */
345
- defaultPackNames: import_zod3.z.array(import_zod3.z.string()).optional(),
434
+ defaultPackNames: import_zod4.z.array(import_zod4.z.string()).optional(),
346
435
  selectedBy: ProfileSelectionSubjectSchema.optional(),
347
- selectedAt: import_zod3.z.string()
436
+ selectedAt: import_zod4.z.string()
348
437
  });
349
- ProjectConfigSchema = import_zod3.z.object({
438
+ ProjectConfigSchema = import_zod4.z.object({
350
439
  /**
351
440
  * Schema version — used to detect incompatible config formats in future
352
441
  * CLI versions.
353
442
  */
354
- schemaVersion: import_zod3.z.string().default("1.0.0"),
443
+ schemaVersion: import_zod4.z.string().default("1.0.0"),
355
444
  /** Human-readable project name */
356
- name: import_zod3.z.string(),
445
+ name: import_zod4.z.string(),
357
446
  /**
358
447
  * The type/profile of the project, which configures targeted guidelines, rules,
359
448
  * templates, and validation constraints. Open string: built-ins are backend,
@@ -361,22 +450,31 @@ var init_project = __esm({
361
450
  * realtime-embedded, plc-cyclic, fullstack, system-of-systems, monorepo;
362
451
  * extension packs may register more (unknown names get UNKNOWN_PROFILE).
363
452
  */
364
- projectType: import_zod3.z.string().default("backend"),
453
+ projectType: import_zod4.z.string().default("backend"),
365
454
  /** Optional short description of this project */
366
- description: import_zod3.z.string().optional(),
455
+ description: import_zod4.z.string().optional(),
367
456
  /**
368
457
  * Active output targets. At least one must be enabled.
369
458
  * Configured during `wairon init` and editable afterward.
370
459
  */
371
- targets: import_zod3.z.array(TargetConfigSchema).default([]),
460
+ targets: import_zod4.z.array(TargetConfigSchema).default([]),
372
461
  rules: RulesConfigSchema.default({}),
462
+ /**
463
+ * Execution budgets — the RESOURCE axis of the derived topology. Controls
464
+ * whether generated agent files carry model/effort/turn/tool constraints in
465
+ * addition to their authority scope.
466
+ *
467
+ * Defaults to tier `off`, so adding this feature changes no existing
468
+ * project's generated output until it is deliberately turned on.
469
+ */
470
+ execution: ExecutionConfigSchema.default({ tier: "off", overrides: {} }),
373
471
  /**
374
472
  * Extension packs — wairon's plugin surface. Each entry is a relative path
375
473
  * to a declarative YAML pack (custom profiles + language/platform tables)
376
474
  * or a requireable JS module id (which may also inject SddRule[] `rules`).
377
475
  * Loaded identically by CLI and MCP at validation time.
378
476
  */
379
- extensions: import_zod3.z.object({
477
+ extensions: import_zod4.z.object({
380
478
  /**
381
479
  * The packs this project APPLIES. Two forms:
382
480
  *
@@ -390,7 +488,7 @@ var init_project = __esm({
390
488
  * A declared pack that cannot be resolved is an error, never a silent skip:
391
489
  * a project whose doctrine is absent is misconfigured, and the gate says so.
392
490
  */
393
- packs: import_zod3.z.array(import_zod3.z.union([import_zod3.z.string(), PackSelectionSchema])).default([]),
491
+ packs: import_zod4.z.array(import_zod4.z.union([import_zod4.z.string(), PackSelectionSchema])).default([]),
394
492
  /**
395
493
  * Whether to ALSO apply every pack installed machine-wide (WAIRON_PACKS_DIR
396
494
  * or ~/.wairon/packs) to this project, without the project naming them.
@@ -404,7 +502,7 @@ var init_project = __esm({
404
502
  * packs that are installed but applied by no route, and `--fix` records them
405
503
  * as explicit selections.
406
504
  */
407
- useGlobalPacks: import_zod3.z.boolean().default(false)
505
+ useGlobalPacks: import_zod4.z.boolean().default(false)
408
506
  }).optional(),
409
507
  paths: PathsConfigSchema.default({}),
410
508
  /**
@@ -421,20 +519,20 @@ var init_project = __esm({
421
519
  * Default: ~/.wairon/templates
422
520
  * Can also be set via WAIRON_TEMPLATES_DIR environment variable.
423
521
  */
424
- globalTemplatesDir: import_zod3.z.string().optional(),
522
+ globalTemplatesDir: import_zod4.z.string().optional(),
425
523
  /**
426
524
  * Tracks whether the wairon usage guide has been injected into each target's
427
525
  * AI tool configuration files so the tool knows how to use wairon.
428
526
  */
429
- aiGuide: import_zod3.z.object({
430
- claudeGlobal: import_zod3.z.boolean().default(false),
431
- claudeLocal: import_zod3.z.boolean().default(false),
432
- geminiGlobal: import_zod3.z.boolean().default(false),
433
- geminiLocal: import_zod3.z.boolean().default(false)
527
+ aiGuide: import_zod4.z.object({
528
+ claudeGlobal: import_zod4.z.boolean().default(false),
529
+ claudeLocal: import_zod4.z.boolean().default(false),
530
+ geminiGlobal: import_zod4.z.boolean().default(false),
531
+ geminiLocal: import_zod4.z.boolean().default(false)
434
532
  }).optional(),
435
533
  /** Created by wairon at init time */
436
- createdAt: import_zod3.z.string().datetime(),
437
- updatedAt: import_zod3.z.string().datetime()
534
+ createdAt: import_zod4.z.string().datetime(),
535
+ updatedAt: import_zod4.z.string().datetime()
438
536
  });
439
537
  }
440
538
  });
@@ -447,125 +545,125 @@ function createEmptyRegistry() {
447
545
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
448
546
  };
449
547
  }
450
- var import_zod4, RegistrySchema;
548
+ var import_zod5, RegistrySchema;
451
549
  var init_registry = __esm({
452
550
  "src/models/registry.ts"() {
453
551
  "use strict";
454
- import_zod4 = require("zod");
552
+ import_zod5 = require("zod");
455
553
  init_agent();
456
- RegistrySchema = import_zod4.z.object({
457
- schemaVersion: import_zod4.z.string().default("1.0.0"),
458
- agents: import_zod4.z.array(AgentRecordSchema).default([]),
459
- updatedAt: import_zod4.z.string().datetime()
554
+ RegistrySchema = import_zod5.z.object({
555
+ schemaVersion: import_zod5.z.string().default("1.0.0"),
556
+ agents: import_zod5.z.array(AgentRecordSchema).default([]),
557
+ updatedAt: import_zod5.z.string().datetime()
460
558
  });
461
559
  }
462
560
  });
463
561
 
464
562
  // src/models/template.ts
465
- var import_zod5, TemplateSchema;
563
+ var import_zod6, TemplateSchema;
466
564
  var init_template = __esm({
467
565
  "src/models/template.ts"() {
468
566
  "use strict";
469
- import_zod5 = require("zod");
470
- TemplateSchema = import_zod5.z.object({
567
+ import_zod6 = require("zod");
568
+ TemplateSchema = import_zod6.z.object({
471
569
  /** Unique template identifier, e.g. "domain-owner" */
472
- id: import_zod5.z.string(),
570
+ id: import_zod6.z.string(),
473
571
  /** Display name */
474
- name: import_zod5.z.string(),
572
+ name: import_zod6.z.string(),
475
573
  /** Short description of this template's purpose */
476
- description: import_zod5.z.string(),
574
+ description: import_zod6.z.string(),
477
575
  /**
478
576
  * Markdown instruction body for the agent.
479
577
  * Supports simple variable interpolation: {{agentName}}, {{ownedPaths}}, etc.
480
578
  */
481
- instructions: import_zod5.z.string(),
579
+ instructions: import_zod6.z.string(),
482
580
  /** Default tags applied to agents created from this template */
483
- defaultTags: import_zod5.z.array(import_zod5.z.string()).default([]),
581
+ defaultTags: import_zod6.z.array(import_zod6.z.string()).default([]),
484
582
  /** Whether agents from this template must have ownedPaths defined */
485
- requiresOwnedPaths: import_zod5.z.boolean().default(true),
583
+ requiresOwnedPaths: import_zod6.z.boolean().default(true),
486
584
  /**
487
585
  * Optional YAML front-matter fields to include in generated output.
488
586
  * These are passed through to the exporter as-is.
489
587
  */
490
- frontmatter: import_zod5.z.record(import_zod5.z.unknown()).optional(),
588
+ frontmatter: import_zod6.z.record(import_zod6.z.unknown()).optional(),
491
589
  /** Version of this template definition */
492
- version: import_zod5.z.string().default("1.0.0")
590
+ version: import_zod6.z.string().default("1.0.0")
493
591
  });
494
592
  }
495
593
  });
496
594
 
497
595
  // src/models/specs.ts
498
- var import_zod6, SpecIdSchema, SpecStatusSchema, BoundaryItemSchema, RequirementItemSchema, DatabaseSpecSchema, DiagramConfigSchema, SURFACE_AUDIENCES, SurfaceAudienceSchema, SystemPublicInterfaceSchema, SystemSpecSchema, PublicInterfaceTypeSchema, PublicInterfaceSchema, TrustedLinkSchema, LintAllowSchema, LintConfigSchema, ExtDataSchema, LifecycleEntrypointSchema, SubsystemSpecSchema, ComponentTypeSchema, PATTERN_TYPES, PortalTypeSchema, DispatchBindingSchema, DurabilitySchema, PatternRefSchema, EventBindingSchema, ExternalLinkTypeSchema, ExternalLinkSchema, PortalAuthSchemeSchema, PortalAuthSchema, ComponentSpecSchema, HttpMethodSchema, TransportSchema, EndpointSchema, SEMANTIC_GUARANTEES, GuaranteeSchema, MethodParamSchema, MethodSignatureSchema, InterfaceSpecSchema, NarrativeStepTypeSchema, LoopKindSchema, SwitchCaseSchema, CatchClauseSchema, ParallelBranchSchema, NarrativeStepSchema, NarrativeDetailSchema, ConformanceTierSchema, MethodImplementationSchema, ImplementationSpecSchema, TypeKindSchema, TypeFieldSchema, TypeMethodSchema, InvariantSchema, TypeSpecSchema, SurfaceOriginSchema, SurfaceTypeDefSchema, SurfaceContractEntrySchema, SurfaceSnapshotSchema, NamedOpenApiSpecSchema, GroupSpecSchema;
596
+ var import_zod7, SpecIdSchema, SpecStatusSchema, BoundaryItemSchema, RequirementItemSchema, DatabaseSpecSchema, DiagramConfigSchema, SURFACE_AUDIENCES, SurfaceAudienceSchema, SystemPublicInterfaceSchema, SystemSpecSchema, PublicInterfaceTypeSchema, PublicInterfaceSchema, TrustedLinkSchema, LintAllowSchema, LintConfigSchema, ExtDataSchema, LifecycleEntrypointSchema, SubsystemSpecSchema, ComponentTypeSchema, PATTERN_TYPES, PortalTypeSchema, DispatchBindingSchema, DurabilitySchema, PatternRefSchema, EventBindingSchema, ExternalLinkTypeSchema, ExternalLinkSchema, PortalAuthSchemeSchema, PortalAuthSchema, ComponentSpecSchema, HttpMethodSchema, TransportSchema, EndpointSchema, SEMANTIC_GUARANTEES, GuaranteeSchema, MethodParamSchema, MethodSignatureSchema, InterfaceSpecSchema, NarrativeStepTypeSchema, LoopKindSchema, SwitchCaseSchema, CatchClauseSchema, ParallelBranchSchema, NarrativeStepSchema, NarrativeDetailSchema, ConformanceTierSchema, MethodImplementationSchema, ImplementationSpecSchema, TypeKindSchema, TypeFieldSchema, TypeMethodSchema, InvariantSchema, TypeSpecSchema, SurfaceOriginSchema, SurfaceTypeDefSchema, SurfaceContractEntrySchema, SurfaceSnapshotSchema, NamedOpenApiSpecSchema, GroupSpecSchema;
499
597
  var init_specs = __esm({
500
598
  "src/models/specs.ts"() {
501
599
  "use strict";
502
- import_zod6 = require("zod");
503
- SpecIdSchema = import_zod6.z.string().regex(/^[a-z0-9-_]+$/, "Identifier must be lowercase alphanumeric with dashes or underscores");
504
- SpecStatusSchema = import_zod6.z.enum(["draft", "design", "complete"]).default("complete");
505
- BoundaryItemSchema = import_zod6.z.union([
506
- import_zod6.z.string(),
507
- import_zod6.z.object({
508
- name: import_zod6.z.string(),
509
- description: import_zod6.z.string().optional()
600
+ import_zod7 = require("zod");
601
+ SpecIdSchema = import_zod7.z.string().regex(/^[a-z0-9-_]+$/, "Identifier must be lowercase alphanumeric with dashes or underscores");
602
+ SpecStatusSchema = import_zod7.z.enum(["draft", "design", "complete"]).default("complete");
603
+ BoundaryItemSchema = import_zod7.z.union([
604
+ import_zod7.z.string(),
605
+ import_zod7.z.object({
606
+ name: import_zod7.z.string(),
607
+ description: import_zod7.z.string().optional()
510
608
  })
511
609
  ]);
512
- RequirementItemSchema = import_zod6.z.union([
513
- import_zod6.z.string(),
514
- import_zod6.z.object({
515
- description: import_zod6.z.string()
610
+ RequirementItemSchema = import_zod7.z.union([
611
+ import_zod7.z.string(),
612
+ import_zod7.z.object({
613
+ description: import_zod7.z.string()
516
614
  })
517
615
  ]);
518
- DatabaseSpecSchema = import_zod6.z.object({
616
+ DatabaseSpecSchema = import_zod7.z.object({
519
617
  id: SpecIdSchema,
520
- name: import_zod6.z.string(),
521
- engine: import_zod6.z.string(),
618
+ name: import_zod7.z.string(),
619
+ engine: import_zod7.z.string(),
522
620
  // e.g. "postgresql", "mysql", "sqlite", "redis"
523
- description: import_zod6.z.string().optional(),
524
- tables: import_zod6.z.array(SpecIdSchema).optional()
621
+ description: import_zod7.z.string().optional(),
622
+ tables: import_zod7.z.array(SpecIdSchema).optional()
525
623
  });
526
- DiagramConfigSchema = import_zod6.z.object({
527
- lineStyle: import_zod6.z.enum(["bezier", "straight", "taxi"]).optional(),
528
- defaultView: import_zod6.z.enum(["architecture", "types", "databases"]).optional(),
529
- showDatabases: import_zod6.z.boolean().optional()
624
+ DiagramConfigSchema = import_zod7.z.object({
625
+ lineStyle: import_zod7.z.enum(["bezier", "straight", "taxi"]).optional(),
626
+ defaultView: import_zod7.z.enum(["architecture", "types", "databases"]).optional(),
627
+ showDatabases: import_zod7.z.boolean().optional()
530
628
  });
531
629
  SURFACE_AUDIENCES = ["project", "department", "instance", "partner", "external"];
532
- SurfaceAudienceSchema = import_zod6.z.enum(SURFACE_AUDIENCES);
533
- SystemPublicInterfaceSchema = import_zod6.z.object({
630
+ SurfaceAudienceSchema = import_zod7.z.enum(SURFACE_AUDIENCES);
631
+ SystemPublicInterfaceSchema = import_zod7.z.object({
534
632
  /** Stable public interface id within the system. */
535
- id: import_zod6.z.string().optional(),
536
- name: import_zod6.z.string().optional(),
633
+ id: import_zod7.z.string().optional(),
634
+ name: import_zod7.z.string().optional(),
537
635
  /** Subsystem publishing the backing L1 public interface. */
538
- subsystem: import_zod6.z.string().optional(),
636
+ subsystem: import_zod7.z.string().optional(),
539
637
  /** Portal (or compatible published component) backing this entry. */
540
- component: import_zod6.z.string().optional(),
638
+ component: import_zod7.z.string().optional(),
541
639
  /** Optional L3 interface id backing the surface. */
542
- interface: import_zod6.z.string().optional(),
640
+ interface: import_zod7.z.string().optional(),
543
641
  /** Surface kind: REST, GraphQL, MessageBus, RPC, or Custom. */
544
- type: import_zod6.z.string().optional(),
545
- details: import_zod6.z.string().optional(),
642
+ type: import_zod7.z.string().optional(),
643
+ details: import_zod7.z.string().optional(),
546
644
  /** Exposure ceiling (see SurfaceAudienceSchema). Defaults to 'instance' at projection time. */
547
- audience: import_zod6.z.string().optional(),
548
- authPolicy: import_zod6.z.string().optional(),
549
- version: import_zod6.z.string().optional(),
550
- stability: import_zod6.z.string().optional()
645
+ audience: import_zod7.z.string().optional(),
646
+ authPolicy: import_zod7.z.string().optional(),
647
+ version: import_zod7.z.string().optional(),
648
+ stability: import_zod7.z.string().optional()
551
649
  });
552
- SystemSpecSchema = import_zod6.z.object({
553
- schemaVersion: import_zod6.z.string().default("1.0.0"),
554
- name: import_zod6.z.string(),
555
- vision: import_zod6.z.string(),
556
- boundaries: import_zod6.z.array(BoundaryItemSchema).default([]),
557
- globalRequirements: import_zod6.z.array(RequirementItemSchema).default([]),
650
+ SystemSpecSchema = import_zod7.z.object({
651
+ schemaVersion: import_zod7.z.string().default("1.0.0"),
652
+ name: import_zod7.z.string(),
653
+ vision: import_zod7.z.string(),
654
+ boundaries: import_zod7.z.array(BoundaryItemSchema).default([]),
655
+ globalRequirements: import_zod7.z.array(RequirementItemSchema).default([]),
558
656
  /**
559
657
  * The project's gateway surface: entries intentionally exported beyond the
560
658
  * project, each backed by a subsystem-published Portal and carrying an
561
659
  * audience ceiling. Cross-PROJECT consumption may only target these.
562
660
  */
563
- publicInterfaces: import_zod6.z.array(SystemPublicInterfaceSchema).optional(),
661
+ publicInterfaces: import_zod7.z.array(SystemPublicInterfaceSchema).optional(),
564
662
  /**
565
663
  * System-level databases. Enables database table mapping, PK/FK views,
566
664
  * and isolated ERD schemas.
567
665
  */
568
- databases: import_zod6.z.array(DatabaseSpecSchema).default([]),
666
+ databases: import_zod7.z.array(DatabaseSpecSchema).default([]),
569
667
  /** Optional defaults for the interactive diagram canvas. */
570
668
  diagram: DiagramConfigSchema.optional(),
571
669
  /**
@@ -574,67 +672,67 @@ var init_specs = __esm({
574
672
  * validation (builtin-type vocabulary, language rule packs); free-form but
575
673
  * normalized to lowercase by the validator.
576
674
  */
577
- targetLanguage: import_zod6.z.string().optional(),
578
- createdAt: import_zod6.z.string().datetime(),
579
- updatedAt: import_zod6.z.string().datetime()
675
+ targetLanguage: import_zod7.z.string().optional(),
676
+ createdAt: import_zod7.z.string().datetime(),
677
+ updatedAt: import_zod7.z.string().datetime()
580
678
  });
581
- PublicInterfaceTypeSchema = import_zod6.z.enum(["REST", "GraphQL", "MessageBus", "RPC", "Custom"]);
582
- PublicInterfaceSchema = import_zod6.z.object({
679
+ PublicInterfaceTypeSchema = import_zod7.z.enum(["REST", "GraphQL", "MessageBus", "RPC", "Custom"]);
680
+ PublicInterfaceSchema = import_zod7.z.object({
583
681
  type: PublicInterfaceTypeSchema,
584
- details: import_zod6.z.string(),
682
+ details: import_zod7.z.string(),
585
683
  /** The L2 component that realizes this public interface (the subsystem's published surface). */
586
684
  component: SpecIdSchema.optional(),
587
685
  /** Optional L3 interface on that component backing this entry. */
588
686
  interface: SpecIdSchema.optional()
589
687
  });
590
- TrustedLinkSchema = import_zod6.z.object({
688
+ TrustedLinkSchema = import_zod7.z.object({
591
689
  /** The peer subsystem id this link sanctions tight coupling with. */
592
690
  subsystem: SpecIdSchema,
593
691
  /** Why this coupling is sanctioned (e.g. "runtime dispatch latency — bus round-trip too slow"). */
594
- reason: import_zod6.z.string()
692
+ reason: import_zod7.z.string()
595
693
  });
596
- LintAllowSchema = import_zod6.z.object({
694
+ LintAllowSchema = import_zod7.z.object({
597
695
  /** The issue code being allowed (see `wairon rules list`). */
598
- code: import_zod6.z.string(),
696
+ code: import_zod7.z.string(),
599
697
  /** Why this finding is acceptable here (e.g. "dispatcher — fan-out is the point"). */
600
- reason: import_zod6.z.string().min(1)
698
+ reason: import_zod7.z.string().min(1)
601
699
  });
602
- LintConfigSchema = import_zod6.z.object({
603
- allow: import_zod6.z.array(LintAllowSchema).default([])
700
+ LintConfigSchema = import_zod7.z.object({
701
+ allow: import_zod7.z.array(LintAllowSchema).default([])
604
702
  });
605
- ExtDataSchema = import_zod6.z.record(import_zod6.z.unknown());
606
- LifecycleEntrypointSchema = import_zod6.z.object({
703
+ ExtDataSchema = import_zod7.z.record(import_zod7.z.unknown());
704
+ LifecycleEntrypointSchema = import_zod7.z.object({
607
705
  /** Which lifecycle/execution flow this roots. */
608
- phase: import_zod6.z.enum(["init", "shutdown", "cyclic", "interrupt", "scheduled"]),
706
+ phase: import_zod7.z.enum(["init", "shutdown", "cyclic", "interrupt", "scheduled"]),
609
707
  /** Component id whose method the runtime invokes at this phase. */
610
- component: import_zod6.z.string(),
708
+ component: import_zod7.z.string(),
611
709
  /** Method name on that component's interface. */
612
- method: import_zod6.z.string(),
710
+ method: import_zod7.z.string(),
613
711
  /** What this lifecycle flow establishes or tears down. */
614
- description: import_zod6.z.string().optional()
712
+ description: import_zod7.z.string().optional()
615
713
  });
616
- SubsystemSpecSchema = import_zod6.z.object({
714
+ SubsystemSpecSchema = import_zod7.z.object({
617
715
  id: SpecIdSchema,
618
- name: import_zod6.z.string(),
619
- description: import_zod6.z.string(),
620
- parentSystem: import_zod6.z.string(),
716
+ name: import_zod7.z.string(),
717
+ description: import_zod7.z.string(),
718
+ parentSystem: import_zod7.z.string(),
621
719
  // References L0 System Name or file
622
- publicInterfaces: import_zod6.z.array(PublicInterfaceSchema).default([]),
720
+ publicInterfaces: import_zod7.z.array(PublicInterfaceSchema).default([]),
623
721
  /** Declared init/shutdown flow roots (see LifecycleEntrypointSchema). */
624
- lifecycle: import_zod6.z.array(LifecycleEntrypointSchema).optional(),
722
+ lifecycle: import_zod7.z.array(LifecycleEntrypointSchema).optional(),
625
723
  /**
626
724
  * Optional subsystem profile override (e.g. for fullstack systems). Open
627
725
  * string: built-ins are backend, frontend-reactive, frontend-controller,
628
726
  * lowlevel-os, game-ecs, realtime-embedded, plc-cyclic; extension packs
629
727
  * may register more. Unknown names get UNKNOWN_PROFILE.
630
728
  */
631
- profile: import_zod6.z.string().optional(),
632
- projectPath: import_zod6.z.string().optional(),
729
+ profile: import_zod7.z.string().optional(),
730
+ projectPath: import_zod7.z.string().optional(),
633
731
  // Relative path to external project root for subsystem chaining
634
732
  /** Optional override of the system-level targetLanguage for this subsystem. */
635
- targetLanguage: import_zod6.z.string().optional(),
733
+ targetLanguage: import_zod7.z.string().optional(),
636
734
  /** Explicitly sanctioned tight couplings with peer subsystems (see TrustedLinkSchema). */
637
- trustedLinks: import_zod6.z.array(TrustedLinkSchema).default([]),
735
+ trustedLinks: import_zod7.z.array(TrustedLinkSchema).default([]),
638
736
  /**
639
737
  * Per-subsystem design-depth override (components | interfaces |
640
738
  * implementations | narratives): how deep THIS subsystem commits to
@@ -644,16 +742,16 @@ var init_specs = __esm({
644
742
  * Expectation checks below the depth are gated; soundness of authored
645
743
  * content never is.
646
744
  */
647
- designDepth: import_zod6.z.enum(["components", "interfaces", "implementations", "narratives"]).optional(),
745
+ designDepth: import_zod7.z.enum(["components", "interfaces", "implementations", "narratives"]).optional(),
648
746
  /** Per-spec lint suppressions (see LintConfigSchema). */
649
747
  lint: LintConfigSchema.optional(),
650
748
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
651
749
  ext: ExtDataSchema.optional(),
652
750
  status: SpecStatusSchema.optional().default("complete"),
653
- createdAt: import_zod6.z.string().datetime(),
654
- updatedAt: import_zod6.z.string().datetime()
751
+ createdAt: import_zod7.z.string().datetime(),
752
+ updatedAt: import_zod7.z.string().datetime()
655
753
  });
656
- ComponentTypeSchema = import_zod6.z.enum([
754
+ ComponentTypeSchema = import_zod7.z.enum([
657
755
  // Building blocks
658
756
  "Portal",
659
757
  "Orchestrator",
@@ -676,123 +774,123 @@ var init_specs = __esm({
676
774
  // Switch/routing component pattern
677
775
  ]);
678
776
  PATTERN_TYPES = /* @__PURE__ */ new Set(["Repository", "Gateway", "FeatureComponent", "RouterComponent"]);
679
- PortalTypeSchema = import_zod6.z.enum(["HTTP_API", "gRPC", "GraphQL", "MessageBus", "CLI", "NamedPipe", "IPC", "Custom"]);
680
- DispatchBindingSchema = import_zod6.z.object({
777
+ PortalTypeSchema = import_zod7.z.enum(["HTTP_API", "gRPC", "GraphQL", "MessageBus", "CLI", "NamedPipe", "IPC", "Custom"]);
778
+ DispatchBindingSchema = import_zod7.z.object({
681
779
  /** Capability name exactly as dispatched at runtime (e.g. "shadow_module.get"). */
682
- capability: import_zod6.z.string().min(1),
780
+ capability: import_zod7.z.string().min(1),
683
781
  /** Component id serving this capability (local, super::-relative, or ::-absolute). */
684
- component: import_zod6.z.string(),
782
+ component: import_zod7.z.string(),
685
783
  /** Method name on the serving component's interface. */
686
- method: import_zod6.z.string(),
784
+ method: import_zod7.z.string(),
687
785
  /** What this capability does. */
688
- description: import_zod6.z.string().optional()
786
+ description: import_zod7.z.string().optional()
689
787
  });
690
- DurabilitySchema = import_zod6.z.enum(["ram-projection", "durable", "read-through", "cache"]);
691
- PatternRefSchema = import_zod6.z.object({
692
- id: import_zod6.z.string(),
693
- version: import_zod6.z.string().optional()
788
+ DurabilitySchema = import_zod7.z.enum(["ram-projection", "durable", "read-through", "cache"]);
789
+ PatternRefSchema = import_zod7.z.object({
790
+ id: import_zod7.z.string(),
791
+ version: import_zod7.z.string().optional()
694
792
  });
695
- EventBindingSchema = import_zod6.z.object({
793
+ EventBindingSchema = import_zod7.z.object({
696
794
  /** Topic/channel name exactly as used on the bus. */
697
- topic: import_zod6.z.string().min(1),
795
+ topic: import_zod7.z.string().min(1),
698
796
  /** Optional event name within the topic (informational in v1 — pairing is by topic). */
699
- event: import_zod6.z.string().optional(),
700
- description: import_zod6.z.string().optional()
797
+ event: import_zod7.z.string().optional(),
798
+ description: import_zod7.z.string().optional()
701
799
  });
702
- ExternalLinkTypeSchema = import_zod6.z.enum(["implementation", "informative"]);
703
- ExternalLinkSchema = import_zod6.z.object({
704
- url: import_zod6.z.string(),
800
+ ExternalLinkTypeSchema = import_zod7.z.enum(["implementation", "informative"]);
801
+ ExternalLinkSchema = import_zod7.z.object({
802
+ url: import_zod7.z.string(),
705
803
  /** Defaults to 'informative' so an untyped link never silently satisfies the source requirement. */
706
804
  type: ExternalLinkTypeSchema.default("informative"),
707
- label: import_zod6.z.string().optional()
805
+ label: import_zod7.z.string().optional()
708
806
  });
709
- PortalAuthSchemeSchema = import_zod6.z.enum(["none", "apiKey", "bearer", "basic", "oauth2", "openIdConnect", "custom"]);
710
- PortalAuthSchema = import_zod6.z.object({
807
+ PortalAuthSchemeSchema = import_zod7.z.enum(["none", "apiKey", "bearer", "basic", "oauth2", "openIdConnect", "custom"]);
808
+ PortalAuthSchema = import_zod7.z.object({
711
809
  scheme: PortalAuthSchemeSchema,
712
- in: import_zod6.z.enum(["header", "query", "cookie"]).optional(),
713
- name: import_zod6.z.string().optional(),
714
- bearerFormat: import_zod6.z.string().optional(),
715
- authorizationUrl: import_zod6.z.string().optional(),
716
- tokenUrl: import_zod6.z.string().optional(),
717
- refreshUrl: import_zod6.z.string().optional(),
718
- scopes: import_zod6.z.array(import_zod6.z.object({ name: import_zod6.z.string(), description: import_zod6.z.string() })).optional(),
719
- flow: import_zod6.z.enum(["authorizationCode", "clientCredentials", "implicit", "password"]).optional(),
720
- openIdConnectUrl: import_zod6.z.string().optional(),
721
- description: import_zod6.z.string().optional(),
722
- example: import_zod6.z.string().optional()
810
+ in: import_zod7.z.enum(["header", "query", "cookie"]).optional(),
811
+ name: import_zod7.z.string().optional(),
812
+ bearerFormat: import_zod7.z.string().optional(),
813
+ authorizationUrl: import_zod7.z.string().optional(),
814
+ tokenUrl: import_zod7.z.string().optional(),
815
+ refreshUrl: import_zod7.z.string().optional(),
816
+ scopes: import_zod7.z.array(import_zod7.z.object({ name: import_zod7.z.string(), description: import_zod7.z.string() })).optional(),
817
+ flow: import_zod7.z.enum(["authorizationCode", "clientCredentials", "implicit", "password"]).optional(),
818
+ openIdConnectUrl: import_zod7.z.string().optional(),
819
+ description: import_zod7.z.string().optional(),
820
+ example: import_zod7.z.string().optional()
723
821
  });
724
- ComponentSpecSchema = import_zod6.z.object({
822
+ ComponentSpecSchema = import_zod7.z.object({
725
823
  id: SpecIdSchema,
726
- name: import_zod6.z.string(),
727
- description: import_zod6.z.string(),
728
- subsystem: import_zod6.z.string(),
824
+ name: import_zod7.z.string(),
825
+ description: import_zod7.z.string(),
826
+ subsystem: import_zod7.z.string(),
729
827
  // References L1 Subsystem id
730
828
  componentType: ComponentTypeSchema,
731
829
  /** Member block ids privately owned by this component (patterns only; one hop). */
732
- owns: import_zod6.z.array(import_zod6.z.string()).default([]),
830
+ owns: import_zod7.z.array(import_zod7.z.string()).default([]),
733
831
  /** Other L2 component ids this component collaborates with (facades / standalone blocks). */
734
- dependsOn: import_zod6.z.array(import_zod6.z.string()).default([]),
832
+ dependsOn: import_zod7.z.array(import_zod7.z.string()).default([]),
735
833
  portalType: PortalTypeSchema.optional(),
736
- basePath: import_zod6.z.string().optional(),
834
+ basePath: import_zod7.z.string().optional(),
737
835
  /** Portal-only: the API's authentication scheme (see PortalAuthSchema) — projected
738
836
  * into the generated OpenAPI's securitySchemes/security. Portals with different auth
739
837
  * must be separate components (one auth per portal ⇒ one OpenAPI spec per portal). */
740
838
  auth: PortalAuthSchema.optional(),
741
839
  /** Portal-only: capability → component.method dispatch table (see DispatchBindingSchema). */
742
- dispatch: import_zod6.z.array(DispatchBindingSchema).optional(),
840
+ dispatch: import_zod7.z.array(DispatchBindingSchema).optional(),
743
841
  /** Store-only: whether held state survives restart (see DurabilitySchema). */
744
842
  durability: DurabilitySchema.optional(),
745
843
  /** Topics this component publishes to (see EventBindingSchema). */
746
- emits: import_zod6.z.array(EventBindingSchema).optional(),
844
+ emits: import_zod7.z.array(EventBindingSchema).optional(),
747
845
  /** Topics this component consumes (see EventBindingSchema) — typical on Observers. */
748
- subscribesTo: import_zod6.z.array(EventBindingSchema).optional(),
846
+ subscribesTo: import_zod7.z.array(EventBindingSchema).optional(),
749
847
  /** Pack-declared reusable patterns this component realizes (resolved against loaded packs; UNKNOWN_PATTERN_REF). */
750
- patterns: import_zod6.z.array(PatternRefSchema).optional(),
848
+ patterns: import_zod7.z.array(PatternRefSchema).optional(),
751
849
  /** Optional component variant — a declared, base-anchored specialization of this component's stereotype (resolved against the variant registry; UNKNOWN_VARIANT / VARIANT_BASE_MISMATCH). */
752
- variant: import_zod6.z.string().optional(),
850
+ variant: import_zod7.z.string().optional(),
753
851
  /** Opaque external references (see ExternalLinkSchema) — documented URLs wairon does
754
852
  * not fetch or validate. An `implementation` link is the external source-of-record and
755
853
  * satisfies the source requirement for a source-less implementation (suppresses
756
854
  * MISSING_SOURCE_PATH); `informative` links are context only. */
757
- externalLinks: import_zod6.z.array(ExternalLinkSchema).optional(),
855
+ externalLinks: import_zod7.z.array(ExternalLinkSchema).optional(),
758
856
  /** Per-spec lint suppressions (see LintConfigSchema). */
759
857
  lint: LintConfigSchema.optional(),
760
858
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
761
859
  ext: ExtDataSchema.optional(),
762
860
  status: SpecStatusSchema.optional().default("complete"),
763
- createdAt: import_zod6.z.string().datetime(),
764
- updatedAt: import_zod6.z.string().datetime()
861
+ createdAt: import_zod7.z.string().datetime(),
862
+ updatedAt: import_zod7.z.string().datetime()
765
863
  });
766
- HttpMethodSchema = import_zod6.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]);
767
- TransportSchema = import_zod6.z.enum(["HTTP", "gRPC", "GraphQL", "MessageBus", "NamedPipe", "IPC", "CLI", "Custom"]);
768
- EndpointSchema = import_zod6.z.discriminatedUnion("transport", [
769
- import_zod6.z.object({ transport: import_zod6.z.literal("HTTP"), method: HttpMethodSchema, path: import_zod6.z.string() }),
770
- import_zod6.z.object({ transport: import_zod6.z.literal("gRPC"), service: import_zod6.z.string(), method: import_zod6.z.string() }),
771
- import_zod6.z.object({ transport: import_zod6.z.literal("GraphQL"), operation: import_zod6.z.enum(["query", "mutation", "subscription"]), field: import_zod6.z.string() }),
772
- import_zod6.z.object({ transport: import_zod6.z.literal("MessageBus"), topic: import_zod6.z.string(), event: import_zod6.z.string(), queue: import_zod6.z.string().optional(), direction: import_zod6.z.enum(["subscribe", "publish"]).default("subscribe") }),
773
- import_zod6.z.object({ transport: import_zod6.z.literal("NamedPipe"), pipe: import_zod6.z.string() }),
774
- import_zod6.z.object({ transport: import_zod6.z.literal("IPC"), channel: import_zod6.z.string() }),
775
- import_zod6.z.object({ transport: import_zod6.z.literal("CLI"), command: import_zod6.z.string() }),
776
- import_zod6.z.object({ transport: import_zod6.z.literal("Custom"), address: import_zod6.z.string() })
864
+ HttpMethodSchema = import_zod7.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]);
865
+ TransportSchema = import_zod7.z.enum(["HTTP", "gRPC", "GraphQL", "MessageBus", "NamedPipe", "IPC", "CLI", "Custom"]);
866
+ EndpointSchema = import_zod7.z.discriminatedUnion("transport", [
867
+ import_zod7.z.object({ transport: import_zod7.z.literal("HTTP"), method: HttpMethodSchema, path: import_zod7.z.string() }),
868
+ import_zod7.z.object({ transport: import_zod7.z.literal("gRPC"), service: import_zod7.z.string(), method: import_zod7.z.string() }),
869
+ import_zod7.z.object({ transport: import_zod7.z.literal("GraphQL"), operation: import_zod7.z.enum(["query", "mutation", "subscription"]), field: import_zod7.z.string() }),
870
+ import_zod7.z.object({ transport: import_zod7.z.literal("MessageBus"), topic: import_zod7.z.string(), event: import_zod7.z.string(), queue: import_zod7.z.string().optional(), direction: import_zod7.z.enum(["subscribe", "publish"]).default("subscribe") }),
871
+ import_zod7.z.object({ transport: import_zod7.z.literal("NamedPipe"), pipe: import_zod7.z.string() }),
872
+ import_zod7.z.object({ transport: import_zod7.z.literal("IPC"), channel: import_zod7.z.string() }),
873
+ import_zod7.z.object({ transport: import_zod7.z.literal("CLI"), command: import_zod7.z.string() }),
874
+ import_zod7.z.object({ transport: import_zod7.z.literal("Custom"), address: import_zod7.z.string() })
777
875
  ]);
778
876
  SEMANTIC_GUARANTEES = ["idempotent", "atomic", "transactional", "exactly-once"];
779
- GuaranteeSchema = import_zod6.z.string().min(1);
780
- MethodParamSchema = import_zod6.z.object({
781
- name: import_zod6.z.string(),
877
+ GuaranteeSchema = import_zod7.z.string().min(1);
878
+ MethodParamSchema = import_zod7.z.object({
879
+ name: import_zod7.z.string(),
782
880
  /** A primitive/builtin or a defined type id (qualified across subsystems, e.g. "billing.Invoice"). */
783
- type: import_zod6.z.string(),
784
- description: import_zod6.z.string().optional(),
785
- optional: import_zod6.z.boolean().optional()
881
+ type: import_zod7.z.string(),
882
+ description: import_zod7.z.string().optional(),
883
+ optional: import_zod7.z.boolean().optional()
786
884
  });
787
- MethodSignatureSchema = import_zod6.z.object({
788
- name: import_zod6.z.string().regex(/^[a-zA-Z0-9_]+$/, "Method name must be alphanumeric"),
789
- description: import_zod6.z.string(),
790
- signature: import_zod6.z.string(),
885
+ MethodSignatureSchema = import_zod7.z.object({
886
+ name: import_zod7.z.string().regex(/^[a-zA-Z0-9_]+$/, "Method name must be alphanumeric"),
887
+ description: import_zod7.z.string(),
888
+ signature: import_zod7.z.string(),
791
889
  // e.g. "save(key: string, data: Buffer): Promise<void>"
792
- returns: import_zod6.z.string(),
890
+ returns: import_zod7.z.string(),
793
891
  // e.g. "Promise<void>"
794
892
  /** Structured parameters (authoritative for type checking when present). */
795
- params: import_zod6.z.array(MethodParamSchema).optional(),
893
+ params: import_zod7.z.array(MethodParamSchema).optional(),
796
894
  /** Concrete wire binding for this method when its component is a Portal (set via sdd_set_endpoints). */
797
895
  endpoint: EndpointSchema.optional(),
798
896
  /**
@@ -801,13 +899,13 @@ var init_specs = __esm({
801
899
  * asserts a guarantee must call a method that declares it here. Whether the guarantee is
802
900
  * actually delivered is implementation correctness (implementer tests), not a static check.
803
901
  */
804
- guarantees: import_zod6.z.array(GuaranteeSchema).optional(),
902
+ guarantees: import_zod7.z.array(GuaranteeSchema).optional(),
805
903
  /**
806
904
  * State-effect direction of this method on its component's held state. Required on a
807
905
  * durable Store's contract methods so the durability round-trip rule can pair external
808
906
  * writes with hydration read-backs (MISSING_HYDRATION); optional elsewhere.
809
907
  */
810
- effect: import_zod6.z.enum(["read", "write"]).optional(),
908
+ effect: import_zod7.z.enum(["read", "write"]).optional(),
811
909
  /**
812
910
  * Typed acknowledgment of a real caller OUTSIDE the modeled narrative graph
813
911
  * (runtime timer/hook, external system, sibling subsystem). Unused-detection
@@ -818,29 +916,29 @@ var init_specs = __esm({
818
916
  * Prefer a `register` narrative step when the wiring is internal — the
819
917
  * registration itself is then a modeled, checkable edge.
820
918
  */
821
- invokedBy: import_zod6.z.object({
822
- kind: import_zod6.z.enum(["runtime", "external", "sibling-subsystem"]),
823
- caller: import_zod6.z.string().optional()
919
+ invokedBy: import_zod7.z.object({
920
+ kind: import_zod7.z.enum(["runtime", "external", "sibling-subsystem"]),
921
+ caller: import_zod7.z.string().optional()
824
922
  }).optional(),
825
923
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
826
924
  ext: ExtDataSchema.optional()
827
925
  });
828
- InterfaceSpecSchema = import_zod6.z.object({
926
+ InterfaceSpecSchema = import_zod7.z.object({
829
927
  id: SpecIdSchema.regex(/^i[a-z0-9-_]+$/, 'Interface id must be prefixed with a lowercase "i"'),
830
- name: import_zod6.z.string(),
831
- description: import_zod6.z.string(),
832
- component: import_zod6.z.string(),
928
+ name: import_zod7.z.string(),
929
+ description: import_zod7.z.string(),
930
+ component: import_zod7.z.string(),
833
931
  // References L2 Component id
834
- methods: import_zod6.z.array(MethodSignatureSchema).default([]),
932
+ methods: import_zod7.z.array(MethodSignatureSchema).default([]),
835
933
  /** Per-spec lint suppressions (see LintConfigSchema). */
836
934
  lint: LintConfigSchema.optional(),
837
935
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
838
936
  ext: ExtDataSchema.optional(),
839
937
  status: SpecStatusSchema.optional().default("complete"),
840
- createdAt: import_zod6.z.string().datetime(),
841
- updatedAt: import_zod6.z.string().datetime()
938
+ createdAt: import_zod7.z.string().datetime(),
939
+ updatedAt: import_zod7.z.string().datetime()
842
940
  });
843
- NarrativeStepTypeSchema = import_zod6.z.enum([
941
+ NarrativeStepTypeSchema = import_zod7.z.enum([
844
942
  "local",
845
943
  // in-component work
846
944
  "call",
@@ -866,27 +964,27 @@ var init_specs = __esm({
866
964
  "throw"
867
965
  // error terminator: this path raises/propagates
868
966
  ]);
869
- LoopKindSchema = import_zod6.z.enum(["forEach", "for", "while", "doWhile"]);
870
- SwitchCaseSchema = import_zod6.z.object({
871
- value: import_zod6.z.string(),
967
+ LoopKindSchema = import_zod7.z.enum(["forEach", "for", "while", "doWhile"]);
968
+ SwitchCaseSchema = import_zod7.z.object({
969
+ value: import_zod7.z.string(),
872
970
  // the matched value/case label
873
- step: import_zod6.z.number().int().positive()
971
+ step: import_zod7.z.number().int().positive()
874
972
  // first step of this case's region
875
973
  });
876
- CatchClauseSchema = import_zod6.z.object({
877
- error: import_zod6.z.string(),
974
+ CatchClauseSchema = import_zod7.z.object({
975
+ error: import_zod7.z.string(),
878
976
  // error/condition caught (free text; 'any' for catch-all)
879
- step: import_zod6.z.number().int().positive()
977
+ step: import_zod7.z.number().int().positive()
880
978
  // first step of the handler region
881
979
  });
882
- ParallelBranchSchema = import_zod6.z.object({
883
- step: import_zod6.z.number().int().positive(),
980
+ ParallelBranchSchema = import_zod7.z.object({
981
+ step: import_zod7.z.number().int().positive(),
884
982
  // first step of this arm's region
885
- name: import_zod6.z.string().optional()
983
+ name: import_zod7.z.string().optional()
886
984
  // optional arm label for renderers/readers
887
985
  });
888
- NarrativeStepSchema = import_zod6.z.object({
889
- stepNumber: import_zod6.z.number().int().positive(),
986
+ NarrativeStepSchema = import_zod7.z.object({
987
+ stepNumber: import_zod7.z.number().int().positive(),
890
988
  /**
891
989
  * Optional symbolic anchor for this step. Authoring surfaces accept *Label
892
990
  * twins of every jump-by-number field (toLabel, onTrueLabel, …) resolved
@@ -894,14 +992,14 @@ var init_specs = __esm({
894
992
  * the stored numeric fields stay the single flow representation. Labels
895
993
  * persist so later deltas can reference existing steps symbolically.
896
994
  */
897
- label: import_zod6.z.string().min(1).optional(),
898
- description: import_zod6.z.string(),
995
+ label: import_zod7.z.string().min(1).optional(),
996
+ description: import_zod7.z.string(),
899
997
  type: NarrativeStepTypeSchema,
900
- targetComponent: import_zod6.z.string().optional(),
998
+ targetComponent: import_zod7.z.string().optional(),
901
999
  // Required if type is 'call', 'register' or 'dispatch', references L2 Component id
902
- targetMethod: import_zod6.z.string().optional(),
1000
+ targetMethod: import_zod7.z.string().optional(),
903
1001
  // Required if type is 'call' or 'register', references Method name on target interface
904
- capability: import_zod6.z.string().optional(),
1002
+ capability: import_zod7.z.string().optional(),
905
1003
  // Required if type is 'dispatch': the capability routed through the target Portal's dispatch table
906
1004
  /**
907
1005
  * call/dispatch only: the credential this step presents to an authed callee
@@ -914,8 +1012,8 @@ var init_specs = __esm({
914
1012
  * `auth ≠ none` warns (PORTAL_AUTH_UNMET), so credential loading is never
915
1013
  * overlooked.
916
1014
  */
917
- auth: import_zod6.z.object({ from: import_zod6.z.string(), note: import_zod6.z.string().optional() }).optional(),
918
- assertsGuarantees: import_zod6.z.array(GuaranteeSchema).optional(),
1015
+ auth: import_zod7.z.object({ from: import_zod7.z.string(), note: import_zod7.z.string().optional() }).optional(),
1016
+ assertsGuarantees: import_zod7.z.array(GuaranteeSchema).optional(),
919
1017
  /**
920
1018
  * Declared entity invariants this step upholds, as "<type-id>.<invariant-id>"
921
1019
  * references (type id optionally subsystem-qualified). The invariant-backing
@@ -923,51 +1021,51 @@ var init_specs = __esm({
923
1021
  * (UNKNOWN_INVARIANT_REF) and counts the step as the write-path assertion the
924
1022
  * entity's write methods must carry (UNASSERTED_INVARIANT otherwise).
925
1023
  */
926
- assertsInvariants: import_zod6.z.array(import_zod6.z.string()).optional(),
1024
+ assertsInvariants: import_zod7.z.array(import_zod7.z.string()).optional(),
927
1025
  // --- flow config (per type; validated by the narrative-flow rule) ---------
928
- condition: import_zod6.z.string().optional(),
1026
+ condition: import_zod7.z.string().optional(),
929
1027
  // branch; loop (while/doWhile)
930
- onTrueStep: import_zod6.z.number().int().positive().optional(),
1028
+ onTrueStep: import_zod7.z.number().int().positive().optional(),
931
1029
  // branch (default: next step)
932
- onFalseStep: import_zod6.z.number().int().positive().optional(),
1030
+ onFalseStep: import_zod7.z.number().int().positive().optional(),
933
1031
  // branch (required)
934
- on: import_zod6.z.string().optional(),
1032
+ on: import_zod7.z.string().optional(),
935
1033
  // switch: the dispatched value
936
- cases: import_zod6.z.array(SwitchCaseSchema).optional(),
1034
+ cases: import_zod7.z.array(SwitchCaseSchema).optional(),
937
1035
  // switch (required)
938
- defaultStep: import_zod6.z.number().int().positive().optional(),
1036
+ defaultStep: import_zod7.z.number().int().positive().optional(),
939
1037
  // switch (default: next step)
940
1038
  loopKind: LoopKindSchema.optional(),
941
1039
  // loop (default: forEach when `over`, else while)
942
- over: import_zod6.z.string().optional(),
1040
+ over: import_zod7.z.string().optional(),
943
1041
  // loop (forEach/for): iteration source
944
- endStep: import_zod6.z.number().int().positive().optional(),
1042
+ endStep: import_zod7.z.number().int().positive().optional(),
945
1043
  // loop/try/parallel: last step of the body region
946
- catches: import_zod6.z.array(CatchClauseSchema).optional(),
1044
+ catches: import_zod7.z.array(CatchClauseSchema).optional(),
947
1045
  // try
948
- finallyStep: import_zod6.z.number().int().positive().optional(),
1046
+ finallyStep: import_zod7.z.number().int().positive().optional(),
949
1047
  // try: first step of the always-runs region
950
- branches: import_zod6.z.array(ParallelBranchSchema).optional(),
1048
+ branches: import_zod7.z.array(ParallelBranchSchema).optional(),
951
1049
  // parallel (required, >= 2 arms)
952
- toStep: import_zod6.z.number().int().positive().optional(),
1050
+ toStep: import_zod7.z.number().int().positive().optional(),
953
1051
  // jump (required)
954
1052
  /**
955
1053
  * call/dispatch only: fire-and-forget — the call is issued and this
956
1054
  * narrative CONTINUES without awaiting the result (no result is consumed
957
1055
  * by later steps). Language/platform packs may gate it via unsupportedFlow.
958
1056
  */
959
- detach: import_zod6.z.boolean().optional(),
960
- outcome: import_zod6.z.string().optional(),
1057
+ detach: import_zod7.z.boolean().optional(),
1058
+ outcome: import_zod7.z.string().optional(),
961
1059
  // return: 'success' / 'not found' / …
962
- error: import_zod6.z.string().optional()
1060
+ error: import_zod7.z.string().optional()
963
1061
  // throw: the raised error
964
1062
  });
965
- NarrativeDetailSchema = import_zod6.z.enum(["full", "calls-only", "intent"]);
966
- ConformanceTierSchema = import_zod6.z.enum(["declared", "anchored", "off"]);
967
- MethodImplementationSchema = import_zod6.z.object({
968
- name: import_zod6.z.string(),
1063
+ NarrativeDetailSchema = import_zod7.z.enum(["full", "calls-only", "intent"]);
1064
+ ConformanceTierSchema = import_zod7.z.enum(["declared", "anchored", "off"]);
1065
+ MethodImplementationSchema = import_zod7.z.object({
1066
+ name: import_zod7.z.string(),
969
1067
  // Must match a method name in the L3 interface contract
970
- narrative: import_zod6.z.array(NarrativeStepSchema).default([]),
1068
+ narrative: import_zod7.z.array(NarrativeStepSchema).default([]),
971
1069
  // Level 5 Narrative
972
1070
  /** Detail level for THIS method (overrides the spec-level default). */
973
1071
  detail: NarrativeDetailSchema.optional(),
@@ -976,7 +1074,7 @@ var init_specs = __esm({
976
1074
  * detail: intent. Subject to the INTENT_FLOOR check: non-trivial, and
977
1075
  * failure behavior stated here or in the contract's guarantees.
978
1076
  */
979
- intent: import_zod6.z.string().optional(),
1077
+ intent: import_zod7.z.string().optional(),
980
1078
  /** Conformance tier for THIS method (overrides the spec-level default). */
981
1079
  conformance: ConformanceTierSchema.optional(),
982
1080
  /**
@@ -984,17 +1082,17 @@ var init_specs = __esm({
984
1082
  * file, when it legitimately differs from the intent-language contract
985
1083
  * name — e.g. a store's `put` realized by `saveSnapshot`.
986
1084
  */
987
- symbol: import_zod6.z.string().optional(),
1085
+ symbol: import_zod7.z.string().optional(),
988
1086
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
989
1087
  ext: ExtDataSchema.optional()
990
1088
  });
991
- ImplementationSpecSchema = import_zod6.z.object({
1089
+ ImplementationSpecSchema = import_zod7.z.object({
992
1090
  id: SpecIdSchema,
993
- name: import_zod6.z.string(),
994
- description: import_zod6.z.string(),
995
- contract: import_zod6.z.string(),
1091
+ name: import_zod7.z.string(),
1092
+ description: import_zod7.z.string(),
1093
+ contract: import_zod7.z.string(),
996
1094
  // References L3 Interface id
997
- sourcePath: import_zod6.z.string().optional(),
1095
+ sourcePath: import_zod7.z.string().optional(),
998
1096
  // Path to the concrete source code file (e.g. "src/storage/vfs.ts")
999
1097
  /**
1000
1098
  * The committed integration-sim harness for this implementation (N:1
@@ -1005,7 +1103,7 @@ var init_specs = __esm({
1005
1103
  * simPath in a subsystem activates MISSING_INTEGRATION_SIM for that
1006
1104
  * subsystem's other complete non-leaf implementations.
1007
1105
  */
1008
- simPath: import_zod6.z.string().optional(),
1106
+ simPath: import_zod7.z.string().optional(),
1009
1107
  /**
1010
1108
  * External technologies (vendor, engine, SDK, service) this implementation
1011
1109
  * binds to — e.g. ["mysql"], ["sendgrid"]. Declaring one makes this
@@ -1014,8 +1112,8 @@ var init_specs = __esm({
1014
1112
  * intent-language (VENDOR_NAME_IN_CONTRACT), and only data-layer
1015
1113
  * stereotypes should bind tech directly (TECH_ON_LOGIC_COMPONENT).
1016
1114
  */
1017
- technologies: import_zod6.z.array(import_zod6.z.string()).optional(),
1018
- methods: import_zod6.z.array(MethodImplementationSchema).default([]),
1115
+ technologies: import_zod7.z.array(import_zod7.z.string()).optional(),
1116
+ methods: import_zod7.z.array(MethodImplementationSchema).default([]),
1019
1117
  /** Spec-level narrative detail default for all methods (each may override). */
1020
1118
  detail: NarrativeDetailSchema.optional(),
1021
1119
  /** Spec-level structural-conformance tier default (each method may override). */
@@ -1025,144 +1123,144 @@ var init_specs = __esm({
1025
1123
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
1026
1124
  ext: ExtDataSchema.optional(),
1027
1125
  status: SpecStatusSchema.optional().default("complete"),
1028
- createdAt: import_zod6.z.string().datetime(),
1029
- updatedAt: import_zod6.z.string().datetime()
1126
+ createdAt: import_zod7.z.string().datetime(),
1127
+ updatedAt: import_zod7.z.string().datetime()
1030
1128
  });
1031
- TypeKindSchema = import_zod6.z.enum(["entity", "value-object"]);
1032
- TypeFieldSchema = import_zod6.z.object({
1033
- name: import_zod6.z.string(),
1034
- type: import_zod6.z.string(),
1129
+ TypeKindSchema = import_zod7.z.enum(["entity", "value-object"]);
1130
+ TypeFieldSchema = import_zod7.z.object({
1131
+ name: import_zod7.z.string(),
1132
+ type: import_zod7.z.string(),
1035
1133
  // a primitive, or another type id (qualified across subsystems, e.g. "billing.Invoice")
1036
- description: import_zod6.z.string().optional(),
1037
- optional: import_zod6.z.boolean().default(false),
1134
+ description: import_zod7.z.string().optional(),
1135
+ optional: import_zod7.z.boolean().default(false),
1038
1136
  /**
1039
1137
  * Identity marker for ERD / database schema derivation:
1040
1138
  * - 'primary' (PK)
1041
1139
  * - 'unique' (UK)
1042
1140
  * - 'foreign' (FK)
1043
1141
  */
1044
- key: import_zod6.z.enum(["primary", "unique", "foreign"]).optional(),
1142
+ key: import_zod7.z.enum(["primary", "unique", "foreign"]).optional(),
1045
1143
  /**
1046
1144
  * For foreign keys, the referenced type/table ID (e.g. "billing.Invoice")
1047
1145
  * and optionally field (e.g. "billing.Invoice.id").
1048
1146
  */
1049
- references: import_zod6.z.string().optional()
1147
+ references: import_zod7.z.string().optional()
1050
1148
  });
1051
- TypeMethodSchema = import_zod6.z.object({
1052
- name: import_zod6.z.string(),
1053
- signature: import_zod6.z.string(),
1054
- returns: import_zod6.z.string(),
1055
- description: import_zod6.z.string().optional()
1149
+ TypeMethodSchema = import_zod7.z.object({
1150
+ name: import_zod7.z.string(),
1151
+ signature: import_zod7.z.string(),
1152
+ returns: import_zod7.z.string(),
1153
+ description: import_zod7.z.string().optional()
1056
1154
  });
1057
- InvariantSchema = import_zod6.z.object({
1155
+ InvariantSchema = import_zod7.z.object({
1058
1156
  /** Stable invariant id, unique within the entity (referenced as "<type-id>.<invariant-id>"). */
1059
1157
  id: SpecIdSchema,
1060
1158
  /** The property that must hold, stated precisely enough to test against. */
1061
- description: import_zod6.z.string().min(1)
1159
+ description: import_zod7.z.string().min(1)
1062
1160
  });
1063
- TypeSpecSchema = import_zod6.z.object({
1161
+ TypeSpecSchema = import_zod7.z.object({
1064
1162
  kind: TypeKindSchema,
1065
1163
  // discriminator — entity | value-object
1066
1164
  id: SpecIdSchema,
1067
- name: import_zod6.z.string(),
1068
- description: import_zod6.z.string().optional(),
1165
+ name: import_zod7.z.string(),
1166
+ description: import_zod7.z.string().optional(),
1069
1167
  /** Owning subsystem id (entities). Omit for system-level shared value objects. */
1070
- subsystem: import_zod6.z.string().optional(),
1168
+ subsystem: import_zod7.z.string().optional(),
1071
1169
  /** Optional logical group ID to organize this type in subfolders. */
1072
- group: import_zod6.z.string().optional(),
1073
- fields: import_zod6.z.array(TypeFieldSchema).default([]),
1170
+ group: import_zod7.z.string().optional(),
1171
+ fields: import_zod7.z.array(TypeFieldSchema).default([]),
1074
1172
  /** Pure intrinsic behaviour only — anything needing a collaborator belongs on a component. */
1075
- methods: import_zod6.z.array(TypeMethodSchema).default([]),
1173
+ methods: import_zod7.z.array(TypeMethodSchema).default([]),
1076
1174
  /**
1077
1175
  * Linked Component ID if this system entity is implemented as a class Component
1078
1176
  * (e.g., a Store or Registry that owns this entity's lifecycle and methods).
1079
1177
  */
1080
- componentClass: import_zod6.z.string().optional(),
1178
+ componentClass: import_zod7.z.string().optional(),
1081
1179
  /**
1082
1180
  * Declared domain invariants on this entity (see InvariantSchema). Anchored
1083
1181
  * through componentClass: its write-effect contract methods must each carry
1084
1182
  * a narrative step asserting every declared invariant.
1085
1183
  */
1086
- invariants: import_zod6.z.array(InvariantSchema).optional(),
1184
+ invariants: import_zod7.z.array(InvariantSchema).optional(),
1087
1185
  /**
1088
1186
  * The database ID this schema belongs to (marks it as a database table schema).
1089
1187
  */
1090
- database: import_zod6.z.string().optional(),
1188
+ database: import_zod7.z.string().optional(),
1091
1189
  /**
1092
1190
  * The database table name for this schema (e.g., "users").
1093
1191
  */
1094
- table: import_zod6.z.string().optional(),
1192
+ table: import_zod7.z.string().optional(),
1095
1193
  /**
1096
1194
  * If this type is a database table schema, the ID of the corresponding
1097
1195
  * logical system entity type it maps to.
1098
1196
  */
1099
- linkedEntity: import_zod6.z.string().optional(),
1197
+ linkedEntity: import_zod7.z.string().optional(),
1100
1198
  /** Per-spec lint suppressions (see LintConfigSchema). */
1101
1199
  lint: LintConfigSchema.optional(),
1102
1200
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
1103
1201
  ext: ExtDataSchema.optional(),
1104
- createdAt: import_zod6.z.string().datetime(),
1105
- updatedAt: import_zod6.z.string().datetime()
1202
+ createdAt: import_zod7.z.string().datetime(),
1203
+ updatedAt: import_zod7.z.string().datetime()
1106
1204
  });
1107
- SurfaceOriginSchema = import_zod6.z.enum(["generated", "exchanged", "authored"]);
1108
- SurfaceTypeDefSchema = import_zod6.z.object({
1109
- id: import_zod6.z.string(),
1110
- name: import_zod6.z.string(),
1111
- kind: import_zod6.z.string().default("value-object"),
1112
- fields: import_zod6.z.array(import_zod6.z.object({
1113
- name: import_zod6.z.string(),
1114
- type: import_zod6.z.string(),
1115
- description: import_zod6.z.string().optional(),
1116
- optional: import_zod6.z.boolean().optional()
1205
+ SurfaceOriginSchema = import_zod7.z.enum(["generated", "exchanged", "authored"]);
1206
+ SurfaceTypeDefSchema = import_zod7.z.object({
1207
+ id: import_zod7.z.string(),
1208
+ name: import_zod7.z.string(),
1209
+ kind: import_zod7.z.string().default("value-object"),
1210
+ fields: import_zod7.z.array(import_zod7.z.object({
1211
+ name: import_zod7.z.string(),
1212
+ type: import_zod7.z.string(),
1213
+ description: import_zod7.z.string().optional(),
1214
+ optional: import_zod7.z.boolean().optional()
1117
1215
  })).default([])
1118
1216
  });
1119
- SurfaceContractEntrySchema = import_zod6.z.object({
1120
- id: import_zod6.z.string(),
1121
- name: import_zod6.z.string(),
1217
+ SurfaceContractEntrySchema = import_zod7.z.object({
1218
+ id: import_zod7.z.string(),
1219
+ name: import_zod7.z.string(),
1122
1220
  /** Exposure level of the L0 entry (see SurfaceAudienceSchema). */
1123
- audience: import_zod6.z.string().default("instance"),
1221
+ audience: import_zod7.z.string().default("instance"),
1124
1222
  /** Transport kind: REST, GraphQL, MessageBus, RPC, or Custom. */
1125
- type: import_zod6.z.string().default("Custom"),
1223
+ type: import_zod7.z.string().default("Custom"),
1126
1224
  /** Local name of the backing Portal in the producing project. */
1127
- component: import_zod6.z.string(),
1225
+ component: import_zod7.z.string(),
1128
1226
  /** Full contract methods (params, returns, guarantees, effect, endpoint). */
1129
- methods: import_zod6.z.array(MethodSignatureSchema).default([]),
1227
+ methods: import_zod7.z.array(MethodSignatureSchema).default([]),
1130
1228
  /** The backing portal's capability dispatch table, when generic-dispatch. */
1131
- dispatch: import_zod6.z.array(DispatchBindingSchema).optional(),
1132
- details: import_zod6.z.string().default(""),
1133
- version: import_zod6.z.string().optional(),
1134
- stability: import_zod6.z.string().optional(),
1229
+ dispatch: import_zod7.z.array(DispatchBindingSchema).optional(),
1230
+ details: import_zod7.z.string().default(""),
1231
+ version: import_zod7.z.string().optional(),
1232
+ stability: import_zod7.z.string().optional(),
1135
1233
  /** Projected copy of the backing Portal's auth (see PortalAuthSchema) — the codec
1136
1234
  * emits it as OpenAPI securitySchemes/security. */
1137
1235
  auth: PortalAuthSchema.optional(),
1138
1236
  /** The backing Portal's basePath — becomes the per-portal OpenAPI `servers` url. */
1139
- basePath: import_zod6.z.string().optional()
1237
+ basePath: import_zod7.z.string().optional()
1140
1238
  });
1141
- SurfaceSnapshotSchema = import_zod6.z.object({
1239
+ SurfaceSnapshotSchema = import_zod7.z.object({
1142
1240
  /** Producing project/system name — the snapshot's resolution identity. */
1143
- projectName: import_zod6.z.string(),
1241
+ projectName: import_zod7.z.string(),
1144
1242
  origin: SurfaceOriginSchema,
1145
1243
  /** Producing spec tree's StateId at generation time (wairon-produced snapshots). */
1146
- stateId: import_zod6.z.string().optional(),
1244
+ stateId: import_zod7.z.string().optional(),
1147
1245
  /** Contract version for authored/3rd-party surfaces without a StateId. */
1148
- version: import_zod6.z.string().optional(),
1149
- generatedAt: import_zod6.z.string(),
1150
- interfaces: import_zod6.z.array(SurfaceContractEntrySchema).default([]),
1246
+ version: import_zod7.z.string().optional(),
1247
+ generatedAt: import_zod7.z.string(),
1248
+ interfaces: import_zod7.z.array(SurfaceContractEntrySchema).default([]),
1151
1249
  /** Transitive type closure of every exported signature — self-contained. */
1152
- types: import_zod6.z.array(SurfaceTypeDefSchema).default([])
1250
+ types: import_zod7.z.array(SurfaceTypeDefSchema).default([])
1153
1251
  });
1154
- NamedOpenApiSpecSchema = import_zod6.z.object({
1155
- portalId: import_zod6.z.string(),
1156
- name: import_zod6.z.string(),
1157
- document: import_zod6.z.string()
1252
+ NamedOpenApiSpecSchema = import_zod7.z.object({
1253
+ portalId: import_zod7.z.string(),
1254
+ name: import_zod7.z.string(),
1255
+ document: import_zod7.z.string()
1158
1256
  });
1159
- GroupSpecSchema = import_zod6.z.object({
1160
- kind: import_zod6.z.literal("group"),
1257
+ GroupSpecSchema = import_zod7.z.object({
1258
+ kind: import_zod7.z.literal("group"),
1161
1259
  id: SpecIdSchema,
1162
- name: import_zod6.z.string(),
1163
- description: import_zod6.z.string().optional(),
1164
- createdAt: import_zod6.z.string().datetime(),
1165
- updatedAt: import_zod6.z.string().datetime()
1260
+ name: import_zod7.z.string(),
1261
+ description: import_zod7.z.string().optional(),
1262
+ createdAt: import_zod7.z.string().datetime(),
1263
+ updatedAt: import_zod7.z.string().datetime()
1166
1264
  });
1167
1265
  }
1168
1266
  });
@@ -1214,7 +1312,7 @@ var init_defaults = __esm({
1214
1312
  copilot: ".github/prompts",
1215
1313
  codex: ".codex/agents"
1216
1314
  };
1217
- WAIRON_VERSION = "5.1.1-dev.8";
1315
+ WAIRON_VERSION = "5.1.1-dev.9";
1218
1316
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
1219
1317
  ARCHITECT_AGENT_ID = "agent-architect";
1220
1318
  ARCHITECT_TEMPLATE_ID = "architect";
@@ -1499,6 +1597,147 @@ var init_templates = __esm({
1499
1597
  }
1500
1598
  });
1501
1599
 
1600
+ // src/core/execution_profile.ts
1601
+ function isSweeping(p) {
1602
+ return p === "**" || p === "**/*" || p.startsWith("**/");
1603
+ }
1604
+ function deriveBreadth(agent) {
1605
+ if (agent.readPaths.some(isSweeping)) {
1606
+ return MANAGER_TEMPLATES.has(agent.template) || READ_ONLY_TEMPLATES.has(agent.template) ? "wide" : "moderate";
1607
+ }
1608
+ const owned = agent.ownedPaths.length;
1609
+ if (owned >= WIDE_PATH_COUNT) return "wide";
1610
+ if (owned >= MODERATE_PATH_COUNT) return "moderate";
1611
+ return "narrow";
1612
+ }
1613
+ function deriveReasoningDepth(agent) {
1614
+ for (const tag of agent.tags) {
1615
+ if (DEEP_STEREOTYPES.has(tag)) return "deep";
1616
+ if (MECHANICAL_STEREOTYPES.has(tag)) return "mechanical";
1617
+ }
1618
+ if (MANAGER_TEMPLATES.has(agent.template)) return "deep";
1619
+ if (agent.template === "reviewer") return "deep";
1620
+ if (agent.template === "tester") return "standard";
1621
+ return "standard";
1622
+ }
1623
+ function deriveWrites(agent) {
1624
+ return !READ_ONLY_TEMPLATES.has(agent.template);
1625
+ }
1626
+ function deriveExecutionProfile(agent) {
1627
+ const breadth = deriveBreadth(agent);
1628
+ const reasoningDepth = deriveReasoningDepth(agent);
1629
+ const writes = deriveWrites(agent);
1630
+ const delegates = MANAGER_TEMPLATES.has(agent.template);
1631
+ const because = [];
1632
+ if (delegates) {
1633
+ because.push(`${agent.template} routes work rather than performing it`);
1634
+ }
1635
+ const stereotype = agent.tags.find(
1636
+ (t) => MECHANICAL_STEREOTYPES.has(t) || DEEP_STEREOTYPES.has(t)
1637
+ );
1638
+ if (stereotype) {
1639
+ because.push(
1640
+ MECHANICAL_STEREOTYPES.has(stereotype) ? `${stereotype} work is specified by its contract and narrative` : `${stereotype} carries decision logic`
1641
+ );
1642
+ }
1643
+ because.push(
1644
+ breadth === "wide" ? "reads broadly across the tree" : breadth === "moderate" ? `spans ${agent.ownedPaths.length} owned path(s)` : "scoped to a small owned set"
1645
+ );
1646
+ if (!writes) because.push("read-only");
1647
+ return {
1648
+ breadth,
1649
+ writes,
1650
+ reasoningDepth,
1651
+ delegates,
1652
+ rationale: because.join("; ")
1653
+ };
1654
+ }
1655
+ var MECHANICAL_STEREOTYPES, DEEP_STEREOTYPES, MANAGER_TEMPLATES, READ_ONLY_TEMPLATES, WIDE_PATH_COUNT, MODERATE_PATH_COUNT;
1656
+ var init_execution_profile = __esm({
1657
+ "src/core/execution_profile.ts"() {
1658
+ "use strict";
1659
+ MECHANICAL_STEREOTYPES = /* @__PURE__ */ new Set(["store", "index", "registry", "adapter"]);
1660
+ DEEP_STEREOTYPES = /* @__PURE__ */ new Set(["orchestrator", "supervisor", "specialist"]);
1661
+ MANAGER_TEMPLATES = /* @__PURE__ */ new Set(["architect", "domain-owner"]);
1662
+ READ_ONLY_TEMPLATES = /* @__PURE__ */ new Set(["reviewer", "guardian"]);
1663
+ WIDE_PATH_COUNT = 12;
1664
+ MODERATE_PATH_COUNT = 4;
1665
+ }
1666
+ });
1667
+
1668
+ // src/core/budget_policy.ts
1669
+ function atLeast(tier, floor) {
1670
+ return TIER_ORDER.indexOf(tier) >= TIER_ORDER.indexOf(floor);
1671
+ }
1672
+ function baseModelTier(profile) {
1673
+ switch (profile.reasoningDepth) {
1674
+ case "mechanical":
1675
+ return "small";
1676
+ case "standard":
1677
+ return "standard";
1678
+ case "deep":
1679
+ return "large";
1680
+ }
1681
+ }
1682
+ function stepDown(tier, steps) {
1683
+ const i = TIER_STEPS.indexOf(tier);
1684
+ return TIER_STEPS[Math.max(0, i - steps)];
1685
+ }
1686
+ function maxTurnsFor(profile, tier) {
1687
+ if (!atLeast(tier, "default")) return void 0;
1688
+ const ceiling = profile.breadth === "wide" ? 60 : profile.breadth === "moderate" ? 40 : 25;
1689
+ return atLeast(tier, "aggressive") ? Math.round(ceiling / 2) : ceiling;
1690
+ }
1691
+ function effortFor(profile, tier) {
1692
+ if (!atLeast(tier, "trade")) return void 0;
1693
+ if (profile.reasoningDepth === "mechanical") {
1694
+ return atLeast(tier, "aggressive") ? "low" : "medium";
1695
+ }
1696
+ return void 0;
1697
+ }
1698
+ function toolClassFor(profile) {
1699
+ return profile.writes ? "implement" : "read-only";
1700
+ }
1701
+ function mcpFor(profile, tier) {
1702
+ if (!atLeast(tier, "free")) return "all";
1703
+ if (profile.delegates) return "project";
1704
+ return profile.breadth === "wide" ? "project" : "none";
1705
+ }
1706
+ function resolveBudget(profile, config, agentId) {
1707
+ const tier = config.tier;
1708
+ if (tier === "off") return void 0;
1709
+ let modelTier = baseModelTier(profile);
1710
+ if (atLeast(tier, "trade") && profile.reasoningDepth === "standard") {
1711
+ modelTier = stepDown(modelTier, 1);
1712
+ }
1713
+ if (atLeast(tier, "aggressive") && profile.reasoningDepth !== "deep") {
1714
+ modelTier = "small";
1715
+ }
1716
+ const budget = {
1717
+ // At `free` no model selection is expressed at all — that tier is defined
1718
+ // as having no quality tradeoff, and choosing a model is a quality
1719
+ // decision. Leaving it absent is not the same as choosing a default.
1720
+ modelTier: atLeast(tier, "default") ? modelTier : void 0,
1721
+ effort: effortFor(profile, tier),
1722
+ maxTurns: maxTurnsFor(profile, tier),
1723
+ toolClass: toolClassFor(profile),
1724
+ // Only managers may spawn. Withholding the tool from workers is what stops
1725
+ // a worker quietly becoming a second orchestrator three levels down.
1726
+ allowNestedDelegation: profile.delegates,
1727
+ mcp: mcpFor(profile, tier)
1728
+ };
1729
+ const override = config.overrides[agentId];
1730
+ return override ? { ...budget, ...override } : budget;
1731
+ }
1732
+ var TIER_ORDER, TIER_STEPS;
1733
+ var init_budget_policy = __esm({
1734
+ "src/core/budget_policy.ts"() {
1735
+ "use strict";
1736
+ TIER_ORDER = ["off", "free", "default", "trade", "aggressive"];
1737
+ TIER_STEPS = ["small", "standard", "large", "frontier"];
1738
+ }
1739
+ });
1740
+
1502
1741
  // src/utils/version.ts
1503
1742
  function isNewerVersion(current2, candidate) {
1504
1743
  const baseVersion = (v) => v.replace(/-.*$/, "");
@@ -2043,7 +2282,7 @@ function findBundledPack(projectRoot, selection) {
2043
2282
  }
2044
2283
  return best?.dir ?? null;
2045
2284
  }
2046
- var fs3, os2, path5, import_module, import_zod7, ProfileDefSchema, LanguagePackDefSchema, PackSkillSchema, PackInstructionBlockSchema, PackInstructionsSchema, PatternDefSchema, AssertionSelectorSchema, assertionBase, PackAssertionSchema, DeclarativePackSchema, EXTENDABLE_BUILTIN_SKILLS, GLOBAL_PACKS_DEFAULT, PACK_DIR_ENTRIES, isYamlPath;
2285
+ var fs3, os2, path5, import_module, import_zod8, ProfileDefSchema, LanguagePackDefSchema, PackSkillSchema, PackInstructionBlockSchema, PackInstructionsSchema, PatternDefSchema, AssertionSelectorSchema, assertionBase, PackAssertionSchema, DeclarativePackSchema, EXTENDABLE_BUILTIN_SKILLS, GLOBAL_PACKS_DEFAULT, PACK_DIR_ENTRIES, isYamlPath;
2047
2286
  var init_extensions = __esm({
2048
2287
  "src/core/extensions.ts"() {
2049
2288
  "use strict";
@@ -2051,17 +2290,17 @@ var init_extensions = __esm({
2051
2290
  os2 = __toESM(require("os"));
2052
2291
  path5 = __toESM(require("path"));
2053
2292
  import_module = require("module");
2054
- import_zod7 = require("zod");
2293
+ import_zod8 = require("zod");
2055
2294
  init_yaml();
2056
2295
  init_fs();
2057
2296
  init_loader();
2058
2297
  init_version();
2059
2298
  init_project();
2060
2299
  init_packstore();
2061
- ProfileDefSchema = import_zod7.z.object({
2062
- family: import_zod7.z.enum(["backend-like", "frontend-like", "neutral"]).default("neutral"),
2063
- forbiddenStereotypes: import_zod7.z.array(import_zod7.z.object({ types: import_zod7.z.array(import_zod7.z.string()).min(1), reason: import_zod7.z.string().min(1) })).default([]),
2064
- discouragedStereotypes: import_zod7.z.array(import_zod7.z.object({ types: import_zod7.z.array(import_zod7.z.string()).min(1), reason: import_zod7.z.string().min(1) })).default([]),
2300
+ ProfileDefSchema = import_zod8.z.object({
2301
+ family: import_zod8.z.enum(["backend-like", "frontend-like", "neutral"]).default("neutral"),
2302
+ forbiddenStereotypes: import_zod8.z.array(import_zod8.z.object({ types: import_zod8.z.array(import_zod8.z.string()).min(1), reason: import_zod8.z.string().min(1) })).default([]),
2303
+ discouragedStereotypes: import_zod8.z.array(import_zod8.z.object({ types: import_zod8.z.array(import_zod8.z.string()).min(1), reason: import_zod8.z.string().min(1) })).default([]),
2065
2304
  /**
2066
2305
  * Edge deltas — the ALLOW half of the profile-scoped dependency matrix. An
2067
2306
  * entry LICENSES intra-subsystem dependsOn edges the builtin stereotype
@@ -2071,20 +2310,20 @@ var init_extensions = __esm({
2071
2310
  * boundary rules and pattern containment are never relaxable. The DENY
2072
2311
  * half is a `forbid-edge` declarative assertion.
2073
2312
  */
2074
- allowedEdges: import_zod7.z.array(import_zod7.z.object({
2075
- from: import_zod7.z.array(import_zod7.z.string().min(1)).min(1),
2076
- to: import_zod7.z.array(import_zod7.z.string().min(1)).min(1),
2077
- reason: import_zod7.z.string().min(1)
2313
+ allowedEdges: import_zod8.z.array(import_zod8.z.object({
2314
+ from: import_zod8.z.array(import_zod8.z.string().min(1)).min(1),
2315
+ to: import_zod8.z.array(import_zod8.z.string().min(1)).min(1),
2316
+ reason: import_zod8.z.string().min(1)
2078
2317
  })).default([]),
2079
2318
  rules: RulesConfigSchema.partial().optional()
2080
2319
  });
2081
- LanguagePackDefSchema = import_zod7.z.object({
2082
- unsupportedFlow: import_zod7.z.record(import_zod7.z.string()).default({}),
2083
- foreignBuiltins: import_zod7.z.array(import_zod7.z.string()).default([])
2320
+ LanguagePackDefSchema = import_zod8.z.object({
2321
+ unsupportedFlow: import_zod8.z.record(import_zod8.z.string()).default({}),
2322
+ foreignBuiltins: import_zod8.z.array(import_zod8.z.string()).default([])
2084
2323
  });
2085
- PackSkillSchema = import_zod7.z.object({
2324
+ PackSkillSchema = import_zod8.z.object({
2086
2325
  /** A NEW skill, installed namespaced as `<pack-id>-<id>`. Mutually exclusive with `extends`. */
2087
- id: import_zod7.z.string().min(1).optional(),
2326
+ id: import_zod8.z.string().min(1).optional(),
2088
2327
  /**
2089
2328
  * EXTEND a builtin skill (`sdd-architect` | `sdd-narrative` | `sdd-auditor` |
2090
2329
  * `sdd-implement`) instead of standing beside it.
@@ -2096,86 +2335,86 @@ var init_extensions = __esm({
2096
2335
  * appended under `## Platform: <pack>`; the builtin stays wairon's, so an
2097
2336
  * upgrade still updates it.
2098
2337
  */
2099
- extends: import_zod7.z.string().min(1).optional(),
2100
- source: import_zod7.z.string().min(1),
2101
- targets: import_zod7.z.array(import_zod7.z.string()).default([])
2338
+ extends: import_zod8.z.string().min(1).optional(),
2339
+ source: import_zod8.z.string().min(1),
2340
+ targets: import_zod8.z.array(import_zod8.z.string()).default([])
2102
2341
  }).refine((s) => s.id === void 0 !== (s.extends === void 0), {
2103
2342
  message: "a pack skill declares either `id` (a new skill) or `extends` (a section appended to a builtin), not both and not neither"
2104
2343
  });
2105
- PackInstructionBlockSchema = import_zod7.z.union([
2344
+ PackInstructionBlockSchema = import_zod8.z.union([
2106
2345
  // Scalar shorthand: `instructions: >- …` — the common case, unscoped.
2107
- import_zod7.z.string().min(1).transform((text) => ({ text })),
2108
- import_zod7.z.object({
2109
- text: import_zod7.z.string().min(1),
2110
- profile: import_zod7.z.array(import_zod7.z.string().min(1)).min(1).optional()
2346
+ import_zod8.z.string().min(1).transform((text) => ({ text })),
2347
+ import_zod8.z.object({
2348
+ text: import_zod8.z.string().min(1),
2349
+ profile: import_zod8.z.array(import_zod8.z.string().min(1)).min(1).optional()
2111
2350
  })
2112
2351
  ]);
2113
- PackInstructionsSchema = import_zod7.z.preprocess(
2352
+ PackInstructionsSchema = import_zod8.z.preprocess(
2114
2353
  (raw) => raw === void 0 || raw === null ? [] : Array.isArray(raw) ? raw : [raw],
2115
- import_zod7.z.array(PackInstructionBlockSchema)
2354
+ import_zod8.z.array(PackInstructionBlockSchema)
2116
2355
  );
2117
- PatternDefSchema = import_zod7.z.object({
2118
- id: import_zod7.z.string().min(1),
2119
- version: import_zod7.z.string().min(1),
2120
- description: import_zod7.z.string().optional(),
2121
- metadata: import_zod7.z.record(import_zod7.z.unknown()).optional()
2356
+ PatternDefSchema = import_zod8.z.object({
2357
+ id: import_zod8.z.string().min(1),
2358
+ version: import_zod8.z.string().min(1),
2359
+ description: import_zod8.z.string().optional(),
2360
+ metadata: import_zod8.z.record(import_zod8.z.unknown()).optional()
2122
2361
  });
2123
- AssertionSelectorSchema = import_zod7.z.object({
2124
- componentType: import_zod7.z.array(import_zod7.z.string().min(1)).optional(),
2125
- profile: import_zod7.z.array(import_zod7.z.string().min(1)).optional(),
2126
- id: import_zod7.z.string().min(1).optional()
2362
+ AssertionSelectorSchema = import_zod8.z.object({
2363
+ componentType: import_zod8.z.array(import_zod8.z.string().min(1)).optional(),
2364
+ profile: import_zod8.z.array(import_zod8.z.string().min(1)).optional(),
2365
+ id: import_zod8.z.string().min(1).optional()
2127
2366
  });
2128
2367
  assertionBase = {
2129
2368
  /** Pack-local code; surfaced namespaced as <PACK_NAME>_<CODE>. */
2130
- code: import_zod7.z.string().min(1),
2131
- severity: import_zod7.z.enum(["warning", "error"]).default("warning"),
2369
+ code: import_zod8.z.string().min(1),
2370
+ severity: import_zod8.z.enum(["warning", "error"]).default("warning"),
2132
2371
  /** The doctrine, stated for the finding message. */
2133
- reason: import_zod7.z.string().min(1)
2372
+ reason: import_zod8.z.string().min(1)
2134
2373
  };
2135
- PackAssertionSchema = import_zod7.z.discriminatedUnion("kind", [
2136
- import_zod7.z.object({
2137
- kind: import_zod7.z.literal("forbid-edge"),
2374
+ PackAssertionSchema = import_zod8.z.discriminatedUnion("kind", [
2375
+ import_zod8.z.object({
2376
+ kind: import_zod8.z.literal("forbid-edge"),
2138
2377
  ...assertionBase,
2139
2378
  from: AssertionSelectorSchema,
2140
2379
  to: AssertionSelectorSchema,
2141
- relation: import_zod7.z.array(import_zod7.z.enum(["dependsOn", "owns"])).default(["dependsOn", "owns"])
2380
+ relation: import_zod8.z.array(import_zod8.z.enum(["dependsOn", "owns"])).default(["dependsOn", "owns"])
2142
2381
  }),
2143
- import_zod7.z.object({
2144
- kind: import_zod7.z.literal("require-field"),
2382
+ import_zod8.z.object({
2383
+ kind: import_zod8.z.literal("require-field"),
2145
2384
  ...assertionBase,
2146
2385
  on: AssertionSelectorSchema,
2147
- level: import_zod7.z.enum(["component", "interface", "implementation"]).default("component"),
2386
+ level: import_zod8.z.enum(["component", "interface", "implementation"]).default("component"),
2148
2387
  /** A top-level spec field name, or one `ext.*` path — nothing else is addressable. */
2149
- field: import_zod7.z.string().min(1),
2388
+ field: import_zod8.z.string().min(1),
2150
2389
  /** Optional closed value set (string equality). */
2151
- values: import_zod7.z.array(import_zod7.z.string()).optional()
2390
+ values: import_zod8.z.array(import_zod8.z.string()).optional()
2152
2391
  }),
2153
- import_zod7.z.object({
2154
- kind: import_zod7.z.literal("endpoint-shape"),
2392
+ import_zod8.z.object({
2393
+ kind: import_zod8.z.literal("endpoint-shape"),
2155
2394
  ...assertionBase,
2156
2395
  on: AssertionSelectorSchema,
2157
2396
  /** Optional transport allowlist. */
2158
- transport: import_zod7.z.array(import_zod7.z.string().min(1)).optional(),
2397
+ transport: import_zod8.z.array(import_zod8.z.string().min(1)).optional(),
2159
2398
  /** Optional anchored regex over the transport's address field (path/topic/command/…). */
2160
- pathPattern: import_zod7.z.string().min(1).optional()
2399
+ pathPattern: import_zod8.z.string().min(1).optional()
2161
2400
  })
2162
2401
  ]);
2163
- DeclarativePackSchema = import_zod7.z.object({
2164
- name: import_zod7.z.string().min(1),
2165
- version: import_zod7.z.string().optional(),
2166
- profiles: import_zod7.z.record(ProfileDefSchema).default({}),
2167
- languages: import_zod7.z.record(LanguagePackDefSchema).default({}),
2168
- skills: import_zod7.z.array(PackSkillSchema).default([]),
2169
- patterns: import_zod7.z.array(PatternDefSchema).default([]),
2402
+ DeclarativePackSchema = import_zod8.z.object({
2403
+ name: import_zod8.z.string().min(1),
2404
+ version: import_zod8.z.string().optional(),
2405
+ profiles: import_zod8.z.record(ProfileDefSchema).default({}),
2406
+ languages: import_zod8.z.record(LanguagePackDefSchema).default({}),
2407
+ skills: import_zod8.z.array(PackSkillSchema).default([]),
2408
+ patterns: import_zod8.z.array(PatternDefSchema).default([]),
2170
2409
  /** Declarative rule assertions — instances of closed kinds, hosted-safe. */
2171
- assertions: import_zod7.z.array(PackAssertionSchema).default([]),
2410
+ assertions: import_zod8.z.array(PackAssertionSchema).default([]),
2172
2411
  /**
2173
2412
  * Semantic guarantee tokens this pack adds to the builtin vocabulary
2174
2413
  * (SEMANTIC_GUARANTEES). Declaring a token makes it legal on L3 method
2175
2414
  * `guarantees` and narrative `assertsGuarantees`; referenced tokens outside
2176
2415
  * builtin + declared are flagged UNKNOWN_GUARANTEE by the validator.
2177
2416
  */
2178
- guarantees: import_zod7.z.array(import_zod7.z.string().min(1)).default([]),
2417
+ guarantees: import_zod8.z.array(import_zod8.z.string().min(1)).default([]),
2179
2418
  /**
2180
2419
  * Connecting-agent guidance appended to wairon's own MCP `initialize`
2181
2420
  * instructions, attributed to this pack, in pack load order.
@@ -2190,7 +2429,7 @@ var init_extensions = __esm({
2190
2429
  * explicit in the new project's `project.yaml` where it is visible in review
2191
2430
  * and removable — never silent authority over projects that never mentioned it.
2192
2431
  */
2193
- applyByDefault: import_zod7.z.boolean().default(false)
2432
+ applyByDefault: import_zod8.z.boolean().default(false)
2194
2433
  });
2195
2434
  EXTENDABLE_BUILTIN_SKILLS = ["sdd-architect", "sdd-narrative", "sdd-auditor", "sdd-implement", "sdd-delegate"];
2196
2435
  GLOBAL_PACKS_DEFAULT = false;
@@ -3170,12 +3409,25 @@ function getSnapshot(projectName, rootDir = getProjectRoot()) {
3170
3409
  function snapshotFilename(projectName) {
3171
3410
  return `${safeFilenamePart(projectName)}.yaml`;
3172
3411
  }
3173
- function saveSnapshot(snapshot, rootDir = getProjectRoot()) {
3412
+ function writeSnapshotIfChanged(snapshot, rootDir) {
3174
3413
  const dir = surfacesDir(rootDir);
3175
3414
  fs4.mkdirSync(dir, { recursive: true });
3176
3415
  const p = path6.join(dir, snapshotFilename(snapshot.projectName));
3177
- writeYamlFile(p, SurfaceSnapshotSchema.parse(snapshot));
3178
- return p;
3416
+ const next = SurfaceSnapshotSchema.parse(snapshot);
3417
+ if (fs4.existsSync(p)) {
3418
+ try {
3419
+ const existing = SurfaceSnapshotSchema.parse(readYamlFile(p));
3420
+ if (surfaceContentKey(existing) === surfaceContentKey(next)) {
3421
+ return { path: p, changed: false };
3422
+ }
3423
+ } catch {
3424
+ }
3425
+ }
3426
+ writeYamlFile(p, next);
3427
+ return { path: p, changed: true };
3428
+ }
3429
+ function saveSnapshot(snapshot, rootDir = getProjectRoot()) {
3430
+ return writeSnapshotIfChanged(snapshot, rootDir).path;
3179
3431
  }
3180
3432
  function removeSnapshot(projectName, rootDir = getProjectRoot()) {
3181
3433
  const dir = surfacesDir(rootDir);
@@ -3282,13 +3534,16 @@ function generateChildSnapshots(rootDir = getProjectRoot()) {
3282
3534
  return snap;
3283
3535
  };
3284
3536
  const written = [];
3537
+ const record = (r) => {
3538
+ if (r.changed) written.push(r.path);
3539
+ };
3285
3540
  for (const child of children) {
3286
3541
  const childDir = path6.resolve(rootDir, child.projectPath);
3287
3542
  if (!fs4.existsSync(childDir)) continue;
3288
- written.push(saveSnapshot(familySnapshot, childDir));
3543
+ record(writeSnapshotIfChanged(familySnapshot, childDir));
3289
3544
  for (const sibling of topLevel) {
3290
3545
  if (sibling.id === child.id) continue;
3291
- written.push(saveSnapshot(siblingSurface(sibling.id), childDir));
3546
+ record(writeSnapshotIfChanged(siblingSurface(sibling.id), childDir));
3292
3547
  }
3293
3548
  }
3294
3549
  return written;
@@ -13877,27 +14132,27 @@ function loadProjectVariants() {
13877
14132
  return [];
13878
14133
  }
13879
14134
  }
13880
- var fs8, os3, path12, import_zod8, VariantDefSchema;
14135
+ var fs8, os3, path12, import_zod9, VariantDefSchema;
13881
14136
  var init_variants = __esm({
13882
14137
  "src/core/variants.ts"() {
13883
14138
  "use strict";
13884
14139
  fs8 = __toESM(require("fs"));
13885
14140
  os3 = __toESM(require("os"));
13886
14141
  path12 = __toESM(require("path"));
13887
- import_zod8 = require("zod");
14142
+ import_zod9 = require("zod");
13888
14143
  init_yaml();
13889
14144
  init_fs();
13890
- VariantDefSchema = import_zod8.z.object({
14145
+ VariantDefSchema = import_zod9.z.object({
13891
14146
  /** Variant id referenced by a component's `variant` (e.g. "publisher", "org/external-config-adapter"). */
13892
- id: import_zod8.z.string().min(1),
14147
+ id: import_zod9.z.string().min(1),
13893
14148
  /** The core stereotype this variant specializes — authoritative for generic semantics (Adapter, Specialist, …). */
13894
- base: import_zod8.z.string().min(1),
14149
+ base: import_zod9.z.string().min(1),
13895
14150
  /** How to implement a component of this variant — the recipe the implementer follows and reuses across same-variant components. */
13896
- guidance: import_zod8.z.string().min(1),
14151
+ guidance: import_zod9.z.string().min(1),
13897
14152
  /** Optional: this variant only applies for the given target language (else it applies everywhere). */
13898
- target: import_zod8.z.string().optional(),
14153
+ target: import_zod9.z.string().optional(),
13899
14154
  /** Optional: this variant only applies under the given architectural profile. */
13900
- profile: import_zod8.z.string().optional()
14155
+ profile: import_zod9.z.string().optional()
13901
14156
  });
13902
14157
  }
13903
14158
  });
@@ -16569,6 +16824,27 @@ var init_specs2 = __esm({
16569
16824
  `kind "system" targets the singleton L0 spec (system name "${result.name}") \u2014 pass id "system" or the system name, got "${id}". For a subsystem, use kind "subsystem".`
16570
16825
  );
16571
16826
  }
16827
+ const deltaSchema = {
16828
+ system: SystemSpecSchema,
16829
+ subsystem: SubsystemSpecSchema,
16830
+ component: ComponentSpecSchema,
16831
+ interface: InterfaceSpecSchema,
16832
+ implementation: ImplementationSpecSchema,
16833
+ type: TypeSpecSchema
16834
+ }[kind];
16835
+ const knownKeys = new Set(Object.keys(deltaSchema.shape));
16836
+ knownKeys.add("unset");
16837
+ const unknownKeys = Object.keys(delta ?? {}).filter((k) => !knownKeys.has(k));
16838
+ if (unknownKeys.length > 0) {
16839
+ const near = (k) => {
16840
+ const norm = k.toLowerCase().replace(/[_\-\s]/g, "");
16841
+ const hit = [...knownKeys].find((v) => v.toLowerCase().replace(/[_\-\s]/g, "") === norm);
16842
+ return hit ? ` (did you mean "${hit}"?)` : "";
16843
+ };
16844
+ throw new Error(
16845
+ `Refusing to update ${kind} "${id}": unknown field(s) ${unknownKeys.map((k) => `"${k}"${near(k)}`).join(", ")}. An unknown key is dropped on write, so the edit would report success and change nothing. Known fields: ${[...knownKeys].sort().join(", ")}.`
16846
+ );
16847
+ }
16572
16848
  const JUMP_FIELDS = ["onTrueStep", "onFalseStep", "defaultStep", "endStep", "finallyStep", "toStep"];
16573
16849
  const JUMP_LIST_FIELDS = ["cases", "catches", "branches"];
16574
16850
  const relocateJumps = (step, shiftFrom, deltaN, captureInsertTarget = false) => {
@@ -17318,6 +17594,9 @@ function composeAgentBrief(agentId) {
17318
17594
  ${guidance.trim()}
17319
17595
  `;
17320
17596
  }
17597
+ const config = loadProjectConfig();
17598
+ const profile = deriveExecutionProfile(record);
17599
+ const budget = resolveBudget(profile, config.execution, record.id);
17321
17600
  return {
17322
17601
  agentId: record.id,
17323
17602
  name: record.name,
@@ -17326,7 +17605,9 @@ ${guidance.trim()}
17326
17605
  ownedPaths: record.ownedPaths,
17327
17606
  readPaths: record.readPaths,
17328
17607
  instructions,
17329
- variantGuidance: record.variantGuidance || void 0
17608
+ variantGuidance: record.variantGuidance || void 0,
17609
+ profile: budget ? profile : void 0,
17610
+ budget
17330
17611
  };
17331
17612
  }
17332
17613
  var path16, fs11, projectFilesCache, UnknownAgentError;
@@ -17339,6 +17620,8 @@ var init_agent_resolver = __esm({
17339
17620
  init_fs();
17340
17621
  init_errors();
17341
17622
  init_templates();
17623
+ init_execution_profile();
17624
+ init_budget_policy();
17342
17625
  init_specs2();
17343
17626
  init_variants();
17344
17627
  projectFilesCache = /* @__PURE__ */ new Map();
@@ -19195,15 +19478,15 @@ var require_node = __commonJS({
19195
19478
  var slzh = function(d, b) {
19196
19479
  return b + 30 + b2(d, b + 26) + b2(d, b + 28);
19197
19480
  };
19198
- var zh = function(d, b, z9) {
19481
+ var zh = function(d, b, z10) {
19199
19482
  var fnl = b2(d, b + 28), efl = b2(d, b + 30), fn = strFromU8(d.subarray(b + 46, b + 46 + fnl), !(b2(d, b + 8) & 2048)), es = b + 46 + fnl;
19200
- var _a2 = z64hs(d, es, efl, z9, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a2[0], su = _a2[1], off = _a2[2];
19483
+ var _a2 = z64hs(d, es, efl, z10, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a2[0], su = _a2[1], off = _a2[2];
19201
19484
  return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];
19202
19485
  };
19203
- var z64hs = function(d, b, l, z9, sc, su, off) {
19486
+ var z64hs = function(d, b, l, z10, sc, su, off) {
19204
19487
  var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;
19205
19488
  var nf = nsc + nsu + noff;
19206
- if (z9 && nf) {
19489
+ if (z10 && nf) {
19207
19490
  for (; b + 4 < e; b += 4 + b2(d, b + 2)) {
19208
19491
  if (b2(d, b) == 1) {
19209
19492
  return [
@@ -19214,7 +19497,7 @@ var require_node = __commonJS({
19214
19497
  ];
19215
19498
  }
19216
19499
  }
19217
- if (z9 < 2)
19500
+ if (z10 < 2)
19218
19501
  err(13);
19219
19502
  }
19220
19503
  return [sc, su, off, 0];
@@ -19823,18 +20106,18 @@ var require_node = __commonJS({
19823
20106
  if (lft) {
19824
20107
  var c = lft;
19825
20108
  var o = b4(data, e + 16);
19826
- var z9 = b4(data, e - 20) == 117853008;
19827
- if (z9) {
20109
+ var z10 = b4(data, e - 20) == 117853008;
20110
+ if (z10) {
19828
20111
  var ze = b4(data, e - 12);
19829
- z9 = b4(data, ze) == 101075792;
19830
- if (z9) {
20112
+ z10 = b4(data, ze) == 101075792;
20113
+ if (z10) {
19831
20114
  c = lft = b4(data, ze + 32);
19832
20115
  o = b4(data, ze + 48);
19833
20116
  }
19834
20117
  }
19835
20118
  var fltr = opts && opts.filter;
19836
20119
  var _loop_3 = function(i3) {
19837
- var _a2 = zh(data, o, z9), c_1 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
20120
+ var _a2 = zh(data, o, z10), c_1 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
19838
20121
  o = no;
19839
20122
  var cbl = function(e2, d) {
19840
20123
  if (e2) {
@@ -19889,18 +20172,18 @@ var require_node = __commonJS({
19889
20172
  if (!c)
19890
20173
  return {};
19891
20174
  var o = b4(data, e + 16);
19892
- var z9 = b4(data, e - 20) == 117853008;
19893
- if (z9) {
20175
+ var z10 = b4(data, e - 20) == 117853008;
20176
+ if (z10) {
19894
20177
  var ze = b4(data, e - 12);
19895
- z9 = b4(data, ze) == 101075792;
19896
- if (z9) {
20178
+ z10 = b4(data, ze) == 101075792;
20179
+ if (z10) {
19897
20180
  c = b4(data, ze + 32);
19898
20181
  o = b4(data, ze + 48);
19899
20182
  }
19900
20183
  }
19901
20184
  var fltr = opts && opts.filter;
19902
20185
  for (var i2 = 0; i2 < c; ++i2) {
19903
- var _a2 = zh(data, o, z9), c_2 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
20186
+ var _a2 = zh(data, o, z10), c_2 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
19904
20187
  o = no;
19905
20188
  if (!fltr || fltr({
19906
20189
  name: fn,
@@ -21456,6 +21739,7 @@ function defaultProjectConfig(name, now) {
21456
21739
  name,
21457
21740
  projectType: "backend",
21458
21741
  targets: [{ type: "claude", outputDir: ".claude/agents", enabled: true }],
21742
+ execution: { tier: "off", overrides: {} },
21459
21743
  rules: {
21460
21744
  noOverlappingOwnership: true,
21461
21745
  requireOwnedPaths: true,
@@ -22479,8 +22763,39 @@ var WAIRON_MANAGED_BANNER = `<!-- ${WAIRON_MANAGED_MARKER} \u2014 generated by \
22479
22763
  // src/exporters/claude.ts
22480
22764
  var path23 = __toESM(require("path"));
22481
22765
  init_fs();
22766
+ var MODEL_BY_TIER = {
22767
+ small: "haiku",
22768
+ standard: "sonnet",
22769
+ large: "opus",
22770
+ frontier: "fable"
22771
+ };
22772
+ var TOOLS_BY_CLASS = {
22773
+ "read-only": ["Read", "Grep", "Glob"],
22774
+ implement: ["Read", "Grep", "Glob", "Edit", "Write", "Bash"],
22775
+ orchestrate: ["Agent", "SendMessage", "TodoWrite"],
22776
+ // `full` means "inherit everything" — expressed by omitting the field.
22777
+ full: void 0
22778
+ };
22779
+ function toolsFor(budget) {
22780
+ const base = TOOLS_BY_CLASS[budget.toolClass];
22781
+ if (!base) return void 0;
22782
+ if (budget.allowNestedDelegation && !base.includes("Agent")) {
22783
+ return [...base, "Agent"];
22784
+ }
22785
+ if (!budget.allowNestedDelegation) {
22786
+ return base.filter((t) => t !== "Agent");
22787
+ }
22788
+ return base;
22789
+ }
22790
+ function mcpServersFor(access) {
22791
+ return access === "none" ? "[]" : void 0;
22792
+ }
22793
+ function yamlScalar(value) {
22794
+ return /[:#\n]/.test(value) ? `"${value.replace(/"/g, '\\"')}"` : value;
22795
+ }
22482
22796
  var ClaudeExporter = class {
22483
- constructor() {
22797
+ constructor(options = {}) {
22798
+ this.options = options;
22484
22799
  this.targetType = "claude";
22485
22800
  }
22486
22801
  outputPath(ctx) {
@@ -22489,18 +22804,22 @@ var ClaudeExporter = class {
22489
22804
  return path23.resolve(projectRoot, outputDir, `${agent.id.replace(/::/g, "--")}.md`);
22490
22805
  }
22491
22806
  export(ctx) {
22492
- const { agent, renderedInstructions } = ctx;
22807
+ const { agent, renderedInstructions, budget } = ctx;
22493
22808
  const filePath = this.outputPath(ctx);
22494
- const safeDescription = agent.description.includes(":") || agent.description.includes("#") ? `"${agent.description.replace(/"/g, '\\"')}"` : agent.description;
22495
- const content = [
22496
- "---",
22809
+ const frontmatter = [
22497
22810
  `name: ${agent.name}`,
22498
- `description: ${safeDescription}`,
22499
- "---",
22500
- "",
22501
- renderedInstructions,
22502
- ""
22503
- ].join("\n");
22811
+ `description: ${yamlScalar(agent.description)}`
22812
+ ];
22813
+ if (budget && this.options.emitBudget) {
22814
+ if (budget.modelTier) frontmatter.push(`model: ${MODEL_BY_TIER[budget.modelTier]}`);
22815
+ if (budget.effort) frontmatter.push(`effort: ${budget.effort}`);
22816
+ if (budget.maxTurns !== void 0) frontmatter.push(`maxTurns: ${budget.maxTurns}`);
22817
+ const tools = toolsFor(budget);
22818
+ if (tools) frontmatter.push(`tools: ${tools.join(", ")}`);
22819
+ const servers = mcpServersFor(budget.mcp);
22820
+ if (servers) frontmatter.push(`mcpServers: ${servers}`);
22821
+ }
22822
+ const content = ["---", ...frontmatter, "---", "", renderedInstructions, ""].join("\n");
22504
22823
  const changed = writeFileIfChanged(filePath, content);
22505
22824
  return { outputPath: filePath, content, unchanged: !changed };
22506
22825
  }
@@ -22576,12 +22895,14 @@ function yamlString(value) {
22576
22895
 
22577
22896
  // src/exporters/generate.ts
22578
22897
  var path26 = __toESM(require("path"));
22898
+ init_execution_profile();
22899
+ init_budget_policy();
22579
22900
  init_fs();
22580
22901
 
22581
22902
  // src/exporters/registry.ts
22582
22903
  init_errors();
22583
22904
  var EXPORTERS = /* @__PURE__ */ new Map([
22584
- ["claude", new ClaudeExporter()],
22905
+ ["claude", new ClaudeExporter({ emitBudget: true })],
22585
22906
  ["gemini", new GeminiExporter()],
22586
22907
  ["agy", new GeminiExporter()],
22587
22908
  ["cursor", new ClaudeExporter()],
@@ -22608,6 +22929,11 @@ function generateAgent(agent, projectConfig, options = {}) {
22608
22929
  const rendered = `${WAIRON_MANAGED_BANNER}
22609
22930
  ${composeAgentBrief(agent.id).instructions}`;
22610
22931
  const results = [];
22932
+ const budget = resolveBudget(
22933
+ deriveExecutionProfile(agent),
22934
+ projectConfig.execution,
22935
+ agent.id
22936
+ );
22611
22937
  for (const agentTarget of agent.targets) {
22612
22938
  const targetConfig = resolveTargetConfig(agentTarget, projectConfig);
22613
22939
  if (!targetConfig) continue;
@@ -22621,7 +22947,8 @@ ${composeAgentBrief(agent.id).instructions}`;
22621
22947
  template,
22622
22948
  renderedInstructions: rendered,
22623
22949
  projectRoot,
22624
- target: targetConfig
22950
+ target: targetConfig,
22951
+ budget
22625
22952
  }));
22626
22953
  }
22627
22954
  }