@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/cli/index.js CHANGED
@@ -65,7 +65,7 @@ var init_defaults = __esm({
65
65
  copilot: ".github/prompts",
66
66
  codex: ".codex/agents"
67
67
  };
68
- WAIRON_VERSION = "5.1.1-dev.8";
68
+ WAIRON_VERSION = "5.1.1-dev.9";
69
69
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
70
70
  ARCHITECT_AGENT_ID = "agent-architect";
71
71
  ARCHITECT_TEMPLATE_ID = "architect";
@@ -340,6 +340,85 @@ var init_yaml = __esm({
340
340
  }
341
341
  });
342
342
 
343
+ // src/models/execution.ts
344
+ var import_zod, WorkBreadthSchema, ReasoningDepthSchema, ExecutionProfileSchema, ModelTierSchema, EffortTierSchema, ToolClassSchema, McpAccessSchema, ExecutionBudgetSchema, BudgetTierSchema, BUDGET_TIER_DESCRIPTIONS, ExecutionConfigSchema;
345
+ var init_execution = __esm({
346
+ "src/models/execution.ts"() {
347
+ "use strict";
348
+ import_zod = require("zod");
349
+ WorkBreadthSchema = import_zod.z.enum(["narrow", "moderate", "wide"]);
350
+ ReasoningDepthSchema = import_zod.z.enum(["mechanical", "standard", "deep"]);
351
+ ExecutionProfileSchema = import_zod.z.object({
352
+ /** How much of the tree the agent must read. */
353
+ breadth: WorkBreadthSchema,
354
+ /** Whether the agent modifies files at all. Read-only agents are cheap and safe. */
355
+ writes: import_zod.z.boolean(),
356
+ /** How much judgment the work carries. */
357
+ reasoningDepth: ReasoningDepthSchema,
358
+ /**
359
+ * Whether this agent is a MANAGER — its job is to route work to others
360
+ * rather than perform it. Managers must stay thin: a manager that reads
361
+ * files accumulates context exactly like a main session and stops being
362
+ * cheaper than doing the work inline.
363
+ */
364
+ delegates: import_zod.z.boolean(),
365
+ /** Why the profile came out this way — surfaced in briefs and `wairon analyze`. */
366
+ rationale: import_zod.z.string()
367
+ });
368
+ ModelTierSchema = import_zod.z.enum(["small", "standard", "large", "frontier"]);
369
+ EffortTierSchema = import_zod.z.enum(["low", "medium", "high", "xhigh"]);
370
+ ToolClassSchema = import_zod.z.enum(["read-only", "implement", "orchestrate", "full"]);
371
+ McpAccessSchema = import_zod.z.enum(["none", "project", "all"]);
372
+ ExecutionBudgetSchema = import_zod.z.object({
373
+ /**
374
+ * Absent means "express no model choice" — the `free` tier is defined as
375
+ * having no quality tradeoff, and picking a model is a quality decision.
376
+ * Exporters must omit the field entirely rather than substituting a default.
377
+ */
378
+ modelTier: ModelTierSchema.optional(),
379
+ effort: EffortTierSchema.optional(),
380
+ /**
381
+ * Turn ceiling — a circuit breaker, not a target. Its purpose is to stop the
382
+ * runaway case: a subagent that runs hundreds of turns while accumulating
383
+ * context is no longer preserving the parent's context, it is a second
384
+ * expensive session. Hitting the ceiling returns partial output, which is
385
+ * the intended failure mode.
386
+ */
387
+ maxTurns: import_zod.z.number().int().positive().optional(),
388
+ toolClass: ToolClassSchema,
389
+ /**
390
+ * Whether this agent may spawn its own subagents. False withholds the
391
+ * delegation tool entirely — structural enforcement, so no instruction text
392
+ * has to be carried (and re-read) to achieve it.
393
+ */
394
+ allowNestedDelegation: import_zod.z.boolean(),
395
+ mcp: McpAccessSchema
396
+ });
397
+ BudgetTierSchema = import_zod.z.enum(["off", "free", "default", "trade", "aggressive"]);
398
+ BUDGET_TIER_DESCRIPTIONS = {
399
+ off: "No budget emitted. Generated agent files carry name and description only, as before this feature existed.",
400
+ free: "Structural constraints only \u2014 tool classes, MCP scoping, nested-delegation control. No model or effort selection, so no quality tradeoff of any kind.",
401
+ default: "Adds capability-tier selection per role and turn ceilings. Mechanical work runs on smaller models; deep reasoning keeps the large tier.",
402
+ trade: "Adds effort reduction on mechanical work and pushes standard work down a tier. Real but bounded quality cost; measure before adopting.",
403
+ aggressive: "Small tier for everything but deep reasoning, tight turn ceilings. Expect partial results and worse judgment. Opt in deliberately."
404
+ };
405
+ ExecutionConfigSchema = import_zod.z.object({
406
+ /**
407
+ * How hard to optimize. `off` preserves pre-feature output exactly, so
408
+ * enabling this feature can never silently change an existing project's
409
+ * generated files.
410
+ */
411
+ tier: BudgetTierSchema.default("off"),
412
+ /**
413
+ * Per-agent overrides, keyed by agent id. An explicit budget always wins
414
+ * over derivation — the tree is a good default, not an authority on how
415
+ * you want to spend.
416
+ */
417
+ overrides: import_zod.z.record(ExecutionBudgetSchema.partial()).default({})
418
+ });
419
+ }
420
+ });
421
+
343
422
  // src/models/agent.ts
344
423
  function createAgentRecord(partial) {
345
424
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -357,83 +436,99 @@ function createAgentRecord(partial) {
357
436
  ...partial
358
437
  });
359
438
  }
360
- var import_zod, BuiltinTargetSchema, CustomTargetSchema, OutputTargetSchema, AgentStatusSchema, AgentRecordSchema, AgentTemplateSchema, AgentBriefSchema;
439
+ var import_zod2, BuiltinTargetSchema, CustomTargetSchema, OutputTargetSchema, AgentStatusSchema, AgentRecordSchema, AgentTemplateSchema, AgentBriefSchema;
361
440
  var init_agent = __esm({
362
441
  "src/models/agent.ts"() {
363
442
  "use strict";
364
- import_zod = require("zod");
365
- BuiltinTargetSchema = import_zod.z.enum(["claude", "gemini", "agy", "cursor", "copilot", "codex"]);
366
- CustomTargetSchema = import_zod.z.object({
367
- type: import_zod.z.literal("custom"),
443
+ import_zod2 = require("zod");
444
+ init_execution();
445
+ BuiltinTargetSchema = import_zod2.z.enum(["claude", "gemini", "agy", "cursor", "copilot", "codex"]);
446
+ CustomTargetSchema = import_zod2.z.object({
447
+ type: import_zod2.z.literal("custom"),
368
448
  /** Human-readable label for this target, e.g. "Cursor" */
369
- label: import_zod.z.string(),
449
+ label: import_zod2.z.string(),
370
450
  /** Root output directory relative to the project root, e.g. ".cursor/agents" */
371
- outputDir: import_zod.z.string()
451
+ outputDir: import_zod2.z.string()
372
452
  });
373
- OutputTargetSchema = import_zod.z.union([BuiltinTargetSchema, CustomTargetSchema]);
374
- AgentStatusSchema = import_zod.z.enum(["active", "draft", "deprecated"]);
375
- AgentRecordSchema = import_zod.z.object({
453
+ OutputTargetSchema = import_zod2.z.union([BuiltinTargetSchema, CustomTargetSchema]);
454
+ AgentStatusSchema = import_zod2.z.enum(["active", "draft", "deprecated"]);
455
+ AgentRecordSchema = import_zod2.z.object({
376
456
  /** Unique identifier within this project, e.g. "core-service-owner" */
377
- id: import_zod.z.string().regex(/^[a-z0-9-_]+$/, "Agent id must be lowercase alphanumeric with dashes or underscores"),
457
+ id: import_zod2.z.string().regex(/^[a-z0-9-_]+$/, "Agent id must be lowercase alphanumeric with dashes or underscores"),
378
458
  /** Human-readable display name */
379
- name: import_zod.z.string(),
459
+ name: import_zod2.z.string(),
380
460
  /** Short description of what this agent is responsible for */
381
- description: import_zod.z.string(),
461
+ description: import_zod2.z.string(),
382
462
  /** Template id this agent was created from, e.g. "domain-owner" */
383
- template: import_zod.z.string(),
463
+ template: import_zod2.z.string(),
384
464
  /** Bundle id this agent was created as part of, if applicable */
385
- bundleOrigin: import_zod.z.string().optional(),
465
+ bundleOrigin: import_zod2.z.string().optional(),
386
466
  /**
387
467
  * The domain id this agent is responsible for (a subsystem id or a
388
468
  * free-standing domain id). Undefined = root-level agent.
389
469
  */
390
- domainRoot: import_zod.z.string().optional(),
470
+ domainRoot: import_zod2.z.string().optional(),
391
471
  /**
392
472
  * Paths this agent owns, expressed relative to the project root.
393
473
  * e.g. ["services/core/**"]
394
474
  */
395
- ownedPaths: import_zod.z.array(import_zod.z.string()).default([]),
475
+ ownedPaths: import_zod2.z.array(import_zod2.z.string()).default([]),
396
476
  /** Paths this agent may read but does not own */
397
- readPaths: import_zod.z.array(import_zod.z.string()).default([]),
477
+ readPaths: import_zod2.z.array(import_zod2.z.string()).default([]),
398
478
  /** Paths this agent may write to but does not own */
399
- writePaths: import_zod.z.array(import_zod.z.string()).default([]),
479
+ writePaths: import_zod2.z.array(import_zod2.z.string()).default([]),
400
480
  /** Classification tags, e.g. ["service", "backend", "critical"] */
401
- tags: import_zod.z.array(import_zod.z.string()).default([]),
481
+ tags: import_zod2.z.array(import_zod2.z.string()).default([]),
402
482
  /** Ids of related agents this agent should be aware of */
403
- dependencies: import_zod.z.array(import_zod.z.string()).default([]),
483
+ dependencies: import_zod2.z.array(import_zod2.z.string()).default([]),
404
484
  /** Rendered implementation guidance for this agent's variant-tagged components (deep variant integration); empty when none. */
405
- variantGuidance: import_zod.z.string().optional(),
485
+ variantGuidance: import_zod2.z.string().optional(),
406
486
  /** Why this agent was created — the architectural reason for its existence */
407
- creationReason: import_zod.z.string(),
487
+ creationReason: import_zod2.z.string(),
408
488
  status: AgentStatusSchema.default("active"),
409
489
  /** Which output targets should receive this agent's generated file */
410
- targets: import_zod.z.array(OutputTargetSchema).default(["claude"]),
411
- createdAt: import_zod.z.string().datetime(),
412
- updatedAt: import_zod.z.string().datetime()
490
+ targets: import_zod2.z.array(OutputTargetSchema).default(["claude"]),
491
+ createdAt: import_zod2.z.string().datetime(),
492
+ updatedAt: import_zod2.z.string().datetime()
413
493
  });
414
- AgentTemplateSchema = import_zod.z.object({
494
+ AgentTemplateSchema = import_zod2.z.object({
415
495
  /** Template identifier (architect, domain-owner, implementer, …) */
416
- templateName: import_zod.z.string(),
496
+ templateName: import_zod2.z.string(),
417
497
  /** The raw instruction body with {{variable}} placeholders, before rendering */
418
- instructions: import_zod.z.string()
498
+ instructions: import_zod2.z.string()
419
499
  });
420
- AgentBriefSchema = import_zod.z.object({
500
+ AgentBriefSchema = import_zod2.z.object({
421
501
  /** The resolved agent's stable id (e.g. sdd_core-owner, system-architect) */
422
- agentId: import_zod.z.string(),
502
+ agentId: import_zod2.z.string(),
423
503
  /** Human-readable display name of the agent */
424
- name: import_zod.z.string(),
504
+ name: import_zod2.z.string(),
425
505
  /** The instruction template the brief was rendered from */
426
- template: import_zod.z.string(),
506
+ template: import_zod2.z.string(),
427
507
  /** Domain the agent belongs to (absent = global root) */
428
- domainRoot: import_zod.z.string().optional(),
508
+ domainRoot: import_zod2.z.string().optional(),
429
509
  /** Glob patterns of the files this agent owns — the write-scope fence */
430
- ownedPaths: import_zod.z.array(import_zod.z.string()),
510
+ ownedPaths: import_zod2.z.array(import_zod2.z.string()),
431
511
  /** Spec paths the subagent should read first */
432
- readPaths: import_zod.z.array(import_zod.z.string()).optional(),
512
+ readPaths: import_zod2.z.array(import_zod2.z.string()).optional(),
433
513
  /** The fully rendered instruction body — paste-ready as a subagent prompt */
434
- instructions: import_zod.z.string(),
514
+ instructions: import_zod2.z.string(),
435
515
  /** Rendered variant guidance, also folded into instructions */
436
- variantGuidance: import_zod.z.string().optional()
516
+ variantGuidance: import_zod2.z.string().optional(),
517
+ /**
518
+ * The resource shape of this agent's work, and the allowance it earns.
519
+ *
520
+ * Both are ABSENT unless the project has opted in with `execution.tier`,
521
+ * which is what keeps the brief useful to consumers that cannot act on it:
522
+ * an MCP client with no subagents — or a host tool that cannot express a
523
+ * model choice — simply never sees these fields.
524
+ *
525
+ * Where generated agent files can ENFORCE a budget through front-matter,
526
+ * a brief can only ADVISE: the caller spawning from this brief is the one
527
+ * that picks the model and tool grant. That asymmetry is deliberate, not a
528
+ * gap — a brief is consumed by tools wairon does not control.
529
+ */
530
+ profile: ExecutionProfileSchema.optional(),
531
+ budget: ExecutionBudgetSchema.optional()
437
532
  });
438
533
  }
439
534
  });
@@ -442,33 +537,33 @@ var init_agent = __esm({
442
537
  function createEmptyTopologyConfig() {
443
538
  return { schemaVersion: "1.0.0", domains: [] };
444
539
  }
445
- var import_zod2, DomainSchema, TopologyConfigSchema, DomainTypeSchema;
540
+ var import_zod3, DomainSchema, TopologyConfigSchema, DomainTypeSchema;
446
541
  var init_domain = __esm({
447
542
  "src/models/domain.ts"() {
448
543
  "use strict";
449
- import_zod2 = require("zod");
450
- DomainSchema = import_zod2.z.object({
544
+ import_zod3 = require("zod");
545
+ DomainSchema = import_zod3.z.object({
451
546
  /** Unique identifier within the project, e.g. "billing" or "docs". */
452
- id: import_zod2.z.string().regex(/^[a-z0-9-_]+$/, "Domain id must be lowercase alphanumeric with dashes or underscores"),
547
+ id: import_zod3.z.string().regex(/^[a-z0-9-_]+$/, "Domain id must be lowercase alphanumeric with dashes or underscores"),
453
548
  /** Optional display name. */
454
- name: import_zod2.z.string().optional(),
549
+ name: import_zod3.z.string().optional(),
455
550
  /** Optional description of the domain's responsibility. */
456
- description: import_zod2.z.string().optional(),
551
+ description: import_zod3.z.string().optional(),
457
552
  /**
458
553
  * The spec node this domain binds to: a subsystem id (the common case) or a
459
554
  * component id. Omitted means the domain is free-standing.
460
555
  */
461
- boundTo: import_zod2.z.string().optional(),
556
+ boundTo: import_zod3.z.string().optional(),
462
557
  /** Glob patterns this domain owns. Derived for spec-backed, authored for free-standing. */
463
- ownedPaths: import_zod2.z.array(import_zod2.z.string()).default([]),
558
+ ownedPaths: import_zod3.z.array(import_zod3.z.string()).default([]),
464
559
  /** Optional physical directory (e.g. a monorepo package or submodule root). */
465
- path: import_zod2.z.string().optional()
560
+ path: import_zod3.z.string().optional()
466
561
  });
467
- TopologyConfigSchema = import_zod2.z.object({
468
- schemaVersion: import_zod2.z.string().default("1.0.0"),
469
- domains: import_zod2.z.array(DomainSchema).default([])
562
+ TopologyConfigSchema = import_zod3.z.object({
563
+ schemaVersion: import_zod3.z.string().default("1.0.0"),
564
+ domains: import_zod3.z.array(DomainSchema).default([])
470
565
  });
471
- DomainTypeSchema = import_zod2.z.enum([
566
+ DomainTypeSchema = import_zod3.z.enum([
472
567
  "git-submodule",
473
568
  // declared in .gitmodules
474
569
  "git-repo",
@@ -482,102 +577,103 @@ var init_domain = __esm({
482
577
  });
483
578
 
484
579
  // src/models/project.ts
485
- var import_zod3, BuiltinTargetConfigSchema, CustomTargetConfigSchema, TargetConfigSchema, NamingRuleConfigSchema, DocumentationRuleConfigSchema, ComplexityRuleConfigSchema, DesignDepthSchema, RulesConfigSchema, PathsConfigSchema, PackSelectionSchema, ProfileSelectionSubjectSchema, ProjectProfileSelectionSchema, ProjectConfigSchema;
580
+ var import_zod4, BuiltinTargetConfigSchema, CustomTargetConfigSchema, TargetConfigSchema, NamingRuleConfigSchema, DocumentationRuleConfigSchema, ComplexityRuleConfigSchema, DesignDepthSchema, RulesConfigSchema, PathsConfigSchema, PackSelectionSchema, ProfileSelectionSubjectSchema, ProjectProfileSelectionSchema, ProjectConfigSchema;
486
581
  var init_project = __esm({
487
582
  "src/models/project.ts"() {
488
583
  "use strict";
489
- import_zod3 = require("zod");
584
+ import_zod4 = require("zod");
490
585
  init_agent();
491
- BuiltinTargetConfigSchema = import_zod3.z.object({
492
- type: import_zod3.z.enum(["claude", "gemini", "agy", "cursor", "copilot", "codex"]),
586
+ init_execution();
587
+ BuiltinTargetConfigSchema = import_zod4.z.object({
588
+ type: import_zod4.z.enum(["claude", "gemini", "agy", "cursor", "copilot", "codex"]),
493
589
  /** Output directory for generated agent files, relative to project root */
494
- outputDir: import_zod3.z.string(),
590
+ outputDir: import_zod4.z.string(),
495
591
  /** Whether this target is active */
496
- enabled: import_zod3.z.boolean().default(true)
592
+ enabled: import_zod4.z.boolean().default(true)
497
593
  });
498
594
  CustomTargetConfigSchema = CustomTargetSchema.extend({
499
- enabled: import_zod3.z.boolean().default(true)
595
+ enabled: import_zod4.z.boolean().default(true)
500
596
  });
501
- TargetConfigSchema = import_zod3.z.union([BuiltinTargetConfigSchema, CustomTargetConfigSchema]);
502
- NamingRuleConfigSchema = import_zod3.z.object({
597
+ TargetConfigSchema = import_zod4.z.union([BuiltinTargetConfigSchema, CustomTargetConfigSchema]);
598
+ NamingRuleConfigSchema = import_zod4.z.object({
503
599
  /** Casing style or regular expression for subsystem names/IDs */
504
- subsystems: import_zod3.z.string().optional(),
600
+ subsystems: import_zod4.z.string().optional(),
505
601
  /** Casing style or regular expression for component names/IDs */
506
- components: import_zod3.z.string().optional(),
602
+ components: import_zod4.z.string().optional(),
507
603
  /** Casing style or regular expression for interface names/IDs */
508
- interfaces: import_zod3.z.string().optional(),
604
+ interfaces: import_zod4.z.string().optional(),
509
605
  /** Casing style or regular expression for general type names/IDs */
510
- types: import_zod3.z.string().optional(),
606
+ types: import_zod4.z.string().optional(),
511
607
  /** Casing style or regular expression for entity type names/IDs */
512
- entities: import_zod3.z.string().optional(),
608
+ entities: import_zod4.z.string().optional(),
513
609
  /** Casing style or regular expression for value-object type names/IDs */
514
- valueObjects: import_zod3.z.string().optional(),
610
+ valueObjects: import_zod4.z.string().optional(),
515
611
  /** Casing style or regular expression for interface/implementation/type method names */
516
- methods: import_zod3.z.string().optional(),
612
+ methods: import_zod4.z.string().optional(),
517
613
  /** Casing style or regular expression for general type fields */
518
- fields: import_zod3.z.string().optional(),
614
+ fields: import_zod4.z.string().optional(),
519
615
  /** Casing style or regular expression for constants/enum variants */
520
- constants: import_zod3.z.string().optional(),
616
+ constants: import_zod4.z.string().optional(),
521
617
  /** Casing style or regular expression for parameters/variables */
522
- variables: import_zod3.z.string().optional(),
618
+ variables: import_zod4.z.string().optional(),
523
619
  /** Stereotype-specific naming rules (prefixes, suffixes, regexes) */
524
- stereotypes: import_zod3.z.record(import_zod3.z.object({
525
- match: import_zod3.z.enum(["id", "name", "both"]).default("both"),
526
- prefix: import_zod3.z.string().optional(),
527
- suffix: import_zod3.z.string().optional(),
528
- regex: import_zod3.z.string().optional()
620
+ stereotypes: import_zod4.z.record(import_zod4.z.object({
621
+ match: import_zod4.z.enum(["id", "name", "both"]).default("both"),
622
+ prefix: import_zod4.z.string().optional(),
623
+ suffix: import_zod4.z.string().optional(),
624
+ regex: import_zod4.z.string().optional()
529
625
  })).optional()
530
626
  });
531
- DocumentationRuleConfigSchema = import_zod3.z.object({
627
+ DocumentationRuleConfigSchema = import_zod4.z.object({
532
628
  /** Minimum character length for description fields */
533
- minDescriptionLength: import_zod3.z.number().int().nonnegative().optional(),
629
+ minDescriptionLength: import_zod4.z.number().int().nonnegative().optional(),
534
630
  /** Force subsystem, component, interface, and type specs to have non-empty descriptions */
535
- requireDescriptions: import_zod3.z.boolean().optional(),
631
+ requireDescriptions: import_zod4.z.boolean().optional(),
536
632
  /** Force interface and type methods to have non-empty descriptions */
537
- requireMethodDescriptions: import_zod3.z.boolean().optional(),
633
+ requireMethodDescriptions: import_zod4.z.boolean().optional(),
538
634
  /** Force type fields to have non-empty descriptions */
539
- requireFieldDescriptions: import_zod3.z.boolean().optional()
635
+ requireFieldDescriptions: import_zod4.z.boolean().optional()
540
636
  });
541
- ComplexityRuleConfigSchema = import_zod3.z.object({
637
+ ComplexityRuleConfigSchema = import_zod4.z.object({
542
638
  /** Maximum number of parameters allowed on a single interface method */
543
- maxMethodParams: import_zod3.z.number().int().nonnegative().optional(),
639
+ maxMethodParams: import_zod4.z.number().int().nonnegative().optional(),
544
640
  /** Maximum number of methods allowed on a single interface contract */
545
- maxInterfaceMethods: import_zod3.z.number().int().nonnegative().optional(),
641
+ maxInterfaceMethods: import_zod4.z.number().int().nonnegative().optional(),
546
642
  /** Maximum number of dependencies allowed on a single component */
547
- maxComponentDependencies: import_zod3.z.number().int().nonnegative().optional(),
643
+ maxComponentDependencies: import_zod4.z.number().int().nonnegative().optional(),
548
644
  /** Maximum number of narrative steps allowed in a single method implementation */
549
- maxNarrativeSteps: import_zod3.z.number().int().nonnegative().optional(),
645
+ maxNarrativeSteps: import_zod4.z.number().int().nonnegative().optional(),
550
646
  /** Maximum number of direct components allowed in a single subsystem */
551
- maxSubsystemComponents: import_zod3.z.number().int().nonnegative().optional(),
647
+ maxSubsystemComponents: import_zod4.z.number().int().nonnegative().optional(),
552
648
  /**
553
649
  * Maximum cyclomatic complexity a realized function may measure (exact AST
554
650
  * grade) while its method's narrative detail sits below `full` with no
555
651
  * narrative — above it the detail-sufficiency lint fires
556
652
  * (UNNARRATED_COMPLEXITY). Default 8 when unset.
557
653
  */
558
- maxUnnarratedComplexity: import_zod3.z.number().int().nonnegative().optional()
654
+ maxUnnarratedComplexity: import_zod4.z.number().int().nonnegative().optional()
559
655
  });
560
- DesignDepthSchema = import_zod3.z.enum(["components", "interfaces", "implementations", "narratives"]);
561
- RulesConfigSchema = import_zod3.z.object({
656
+ DesignDepthSchema = import_zod4.z.enum(["components", "interfaces", "implementations", "narratives"]);
657
+ RulesConfigSchema = import_zod4.z.object({
562
658
  /**
563
659
  * Prevent two agents from declaring overlapping ownedPaths.
564
660
  * Strongly recommended: true.
565
661
  */
566
- noOverlappingOwnership: import_zod3.z.boolean().default(true),
662
+ noOverlappingOwnership: import_zod4.z.boolean().default(true),
567
663
  /**
568
664
  * Require every non-meta agent to have at least one ownedPath.
569
665
  */
570
- requireOwnedPaths: import_zod3.z.boolean().default(true),
666
+ requireOwnedPaths: import_zod4.z.boolean().default(true),
571
667
  /**
572
668
  * Tags that mark an agent as a meta/guardian agent — exempt from
573
669
  * requireOwnedPaths.
574
670
  */
575
- metaAgentTags: import_zod3.z.array(import_zod3.z.string()).default(["meta", "guardian", "architect"]),
671
+ metaAgentTags: import_zod4.z.array(import_zod4.z.string()).default(["meta", "guardian", "architect"]),
576
672
  /**
577
673
  * Generated outputs should exactly reproduce from the registry.
578
674
  * Warn if generated files differ from what the registry would produce.
579
675
  */
580
- enforceReproducibility: import_zod3.z.boolean().default(true),
676
+ enforceReproducibility: import_zod4.z.boolean().default(true),
581
677
  /**
582
678
  * Whether to generate an individual implementer agent PER COMPONENT. Off by
583
679
  * default: one subsystem-owner agent per subsystem owns its components'
@@ -587,7 +683,7 @@ var init_project = __esm({
587
683
  * emit thousands of agents — reserve it for small trees that genuinely want
588
684
  * per-component isolation.
589
685
  */
590
- generateComponentImplementers: import_zod3.z.boolean().default(false),
686
+ generateComponentImplementers: import_zod4.z.boolean().default(false),
591
687
  /**
592
688
  * Whether `wairon generate` writes per-subsystem owner/architect agent FILES.
593
689
  * Off by default: agents are served as LIVE briefs (sdd_get_agent_brief /
@@ -595,12 +691,12 @@ var init_project = __esm({
595
691
  * same briefs. When off, generate reconciles to zero agent files — leftover
596
692
  * wairon-managed files are removed (hand-authored files never are).
597
693
  */
598
- materializeAgentFiles: import_zod3.z.boolean().default(false),
694
+ materializeAgentFiles: import_zod4.z.boolean().default(false),
599
695
  /**
600
696
  * Severity overrides for SDD validation rules.
601
697
  * Key: rule code (e.g. CIRCULAR_DEPENDENCY), Value: error | warning | off
602
698
  */
603
- sddRuleSeverity: import_zod3.z.record(import_zod3.z.enum(["error", "warning", "off"])).default({}),
699
+ sddRuleSeverity: import_zod4.z.record(import_zod4.z.enum(["error", "warning", "off"])).default({}),
604
700
  /** Dynamic naming conventions and stereotype suffix rules */
605
701
  naming: NamingRuleConfigSchema.optional(),
606
702
  /** Dynamic metadata documentation constraints */
@@ -610,57 +706,57 @@ var init_project = __esm({
610
706
  /** Project-default design depth (see DesignDepthSchema); subsystems may override. */
611
707
  designDepth: DesignDepthSchema.optional()
612
708
  });
613
- PathsConfigSchema = import_zod3.z.object({
709
+ PathsConfigSchema = import_zod4.z.object({
614
710
  /** Base directory containing SDD specification files, relative to project root */
615
- specsDir: import_zod3.z.string().default(".wai/specs")
711
+ specsDir: import_zod4.z.string().default(".wai/specs")
616
712
  });
617
- PackSelectionSchema = import_zod3.z.object({
713
+ PackSelectionSchema = import_zod4.z.object({
618
714
  /** The pack name — the only required field. */
619
- name: import_zod3.z.string().min(1),
715
+ name: import_zod4.z.string().min(1),
620
716
  /** Exact version pin. Omitted = the latest version installed in the store. */
621
- version: import_zod3.z.string().min(1).optional(),
717
+ version: import_zod4.z.string().min(1).optional(),
622
718
  /** Content digest pin (`sha256-…`), verified on resolution. */
623
- integrity: import_zod3.z.string().min(1).optional(),
719
+ integrity: import_zod4.z.string().min(1).optional(),
624
720
  /**
625
721
  * Where to obtain this pack — recorded automatically from the store's install
626
722
  * record at selection time, so a fresh machine or CI runner can fetch it
627
723
  * (`wairon pack sync`). Supports a `{version}` placeholder and `${VAR}` env
628
724
  * expansion for private URLs.
629
725
  */
630
- source: import_zod3.z.string().min(1).optional(),
726
+ source: import_zod4.z.string().min(1).optional(),
631
727
  /**
632
728
  * Commit a copy under `.wai/packs/<name>/<version>/` and resolve from there
633
729
  * first, so the project needs no machine setup at all — the answer for private
634
730
  * packs, air-gapped CI, and repos that must be self-sufficient.
635
731
  */
636
- bundle: import_zod3.z.boolean().optional()
732
+ bundle: import_zod4.z.boolean().optional()
637
733
  });
638
- ProfileSelectionSubjectSchema = import_zod3.z.object({
639
- userId: import_zod3.z.string(),
640
- kind: import_zod3.z.string(),
641
- issuer: import_zod3.z.string(),
642
- externalSubject: import_zod3.z.string().optional(),
643
- displayName: import_zod3.z.string().optional(),
644
- email: import_zod3.z.string().optional()
734
+ ProfileSelectionSubjectSchema = import_zod4.z.object({
735
+ userId: import_zod4.z.string(),
736
+ kind: import_zod4.z.string(),
737
+ issuer: import_zod4.z.string(),
738
+ externalSubject: import_zod4.z.string().optional(),
739
+ displayName: import_zod4.z.string().optional(),
740
+ email: import_zod4.z.string().optional()
645
741
  });
646
- ProjectProfileSelectionSchema = import_zod3.z.object({
742
+ ProjectProfileSelectionSchema = import_zod4.z.object({
647
743
  /** Selected architectural profile ids. The first resolvable one is applied as projectType. */
648
- profileIds: import_zod3.z.array(import_zod3.z.string()).default([]),
744
+ profileIds: import_zod4.z.array(import_zod4.z.string()).default([]),
649
745
  /** Pack names the governing policy requires for this project. */
650
- requiredPackNames: import_zod3.z.array(import_zod3.z.string()).default([]),
746
+ requiredPackNames: import_zod4.z.array(import_zod4.z.string()).default([]),
651
747
  /** Pack names applied by default unless explicitly overridden. */
652
- defaultPackNames: import_zod3.z.array(import_zod3.z.string()).optional(),
748
+ defaultPackNames: import_zod4.z.array(import_zod4.z.string()).optional(),
653
749
  selectedBy: ProfileSelectionSubjectSchema.optional(),
654
- selectedAt: import_zod3.z.string()
750
+ selectedAt: import_zod4.z.string()
655
751
  });
656
- ProjectConfigSchema = import_zod3.z.object({
752
+ ProjectConfigSchema = import_zod4.z.object({
657
753
  /**
658
754
  * Schema version — used to detect incompatible config formats in future
659
755
  * CLI versions.
660
756
  */
661
- schemaVersion: import_zod3.z.string().default("1.0.0"),
757
+ schemaVersion: import_zod4.z.string().default("1.0.0"),
662
758
  /** Human-readable project name */
663
- name: import_zod3.z.string(),
759
+ name: import_zod4.z.string(),
664
760
  /**
665
761
  * The type/profile of the project, which configures targeted guidelines, rules,
666
762
  * templates, and validation constraints. Open string: built-ins are backend,
@@ -668,22 +764,31 @@ var init_project = __esm({
668
764
  * realtime-embedded, plc-cyclic, fullstack, system-of-systems, monorepo;
669
765
  * extension packs may register more (unknown names get UNKNOWN_PROFILE).
670
766
  */
671
- projectType: import_zod3.z.string().default("backend"),
767
+ projectType: import_zod4.z.string().default("backend"),
672
768
  /** Optional short description of this project */
673
- description: import_zod3.z.string().optional(),
769
+ description: import_zod4.z.string().optional(),
674
770
  /**
675
771
  * Active output targets. At least one must be enabled.
676
772
  * Configured during `wairon init` and editable afterward.
677
773
  */
678
- targets: import_zod3.z.array(TargetConfigSchema).default([]),
774
+ targets: import_zod4.z.array(TargetConfigSchema).default([]),
679
775
  rules: RulesConfigSchema.default({}),
776
+ /**
777
+ * Execution budgets — the RESOURCE axis of the derived topology. Controls
778
+ * whether generated agent files carry model/effort/turn/tool constraints in
779
+ * addition to their authority scope.
780
+ *
781
+ * Defaults to tier `off`, so adding this feature changes no existing
782
+ * project's generated output until it is deliberately turned on.
783
+ */
784
+ execution: ExecutionConfigSchema.default({ tier: "off", overrides: {} }),
680
785
  /**
681
786
  * Extension packs — wairon's plugin surface. Each entry is a relative path
682
787
  * to a declarative YAML pack (custom profiles + language/platform tables)
683
788
  * or a requireable JS module id (which may also inject SddRule[] `rules`).
684
789
  * Loaded identically by CLI and MCP at validation time.
685
790
  */
686
- extensions: import_zod3.z.object({
791
+ extensions: import_zod4.z.object({
687
792
  /**
688
793
  * The packs this project APPLIES. Two forms:
689
794
  *
@@ -697,7 +802,7 @@ var init_project = __esm({
697
802
  * A declared pack that cannot be resolved is an error, never a silent skip:
698
803
  * a project whose doctrine is absent is misconfigured, and the gate says so.
699
804
  */
700
- packs: import_zod3.z.array(import_zod3.z.union([import_zod3.z.string(), PackSelectionSchema])).default([]),
805
+ packs: import_zod4.z.array(import_zod4.z.union([import_zod4.z.string(), PackSelectionSchema])).default([]),
701
806
  /**
702
807
  * Whether to ALSO apply every pack installed machine-wide (WAIRON_PACKS_DIR
703
808
  * or ~/.wairon/packs) to this project, without the project naming them.
@@ -711,7 +816,7 @@ var init_project = __esm({
711
816
  * packs that are installed but applied by no route, and `--fix` records them
712
817
  * as explicit selections.
713
818
  */
714
- useGlobalPacks: import_zod3.z.boolean().default(false)
819
+ useGlobalPacks: import_zod4.z.boolean().default(false)
715
820
  }).optional(),
716
821
  paths: PathsConfigSchema.default({}),
717
822
  /**
@@ -728,20 +833,20 @@ var init_project = __esm({
728
833
  * Default: ~/.wairon/templates
729
834
  * Can also be set via WAIRON_TEMPLATES_DIR environment variable.
730
835
  */
731
- globalTemplatesDir: import_zod3.z.string().optional(),
836
+ globalTemplatesDir: import_zod4.z.string().optional(),
732
837
  /**
733
838
  * Tracks whether the wairon usage guide has been injected into each target's
734
839
  * AI tool configuration files so the tool knows how to use wairon.
735
840
  */
736
- aiGuide: import_zod3.z.object({
737
- claudeGlobal: import_zod3.z.boolean().default(false),
738
- claudeLocal: import_zod3.z.boolean().default(false),
739
- geminiGlobal: import_zod3.z.boolean().default(false),
740
- geminiLocal: import_zod3.z.boolean().default(false)
841
+ aiGuide: import_zod4.z.object({
842
+ claudeGlobal: import_zod4.z.boolean().default(false),
843
+ claudeLocal: import_zod4.z.boolean().default(false),
844
+ geminiGlobal: import_zod4.z.boolean().default(false),
845
+ geminiLocal: import_zod4.z.boolean().default(false)
741
846
  }).optional(),
742
847
  /** Created by wairon at init time */
743
- createdAt: import_zod3.z.string().datetime(),
744
- updatedAt: import_zod3.z.string().datetime()
848
+ createdAt: import_zod4.z.string().datetime(),
849
+ updatedAt: import_zod4.z.string().datetime()
745
850
  });
746
851
  }
747
852
  });
@@ -754,125 +859,125 @@ function createEmptyRegistry() {
754
859
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
755
860
  };
756
861
  }
757
- var import_zod4, RegistrySchema;
862
+ var import_zod5, RegistrySchema;
758
863
  var init_registry = __esm({
759
864
  "src/models/registry.ts"() {
760
865
  "use strict";
761
- import_zod4 = require("zod");
866
+ import_zod5 = require("zod");
762
867
  init_agent();
763
- RegistrySchema = import_zod4.z.object({
764
- schemaVersion: import_zod4.z.string().default("1.0.0"),
765
- agents: import_zod4.z.array(AgentRecordSchema).default([]),
766
- updatedAt: import_zod4.z.string().datetime()
868
+ RegistrySchema = import_zod5.z.object({
869
+ schemaVersion: import_zod5.z.string().default("1.0.0"),
870
+ agents: import_zod5.z.array(AgentRecordSchema).default([]),
871
+ updatedAt: import_zod5.z.string().datetime()
767
872
  });
768
873
  }
769
874
  });
770
875
 
771
876
  // src/models/template.ts
772
- var import_zod5, TemplateSchema;
877
+ var import_zod6, TemplateSchema;
773
878
  var init_template = __esm({
774
879
  "src/models/template.ts"() {
775
880
  "use strict";
776
- import_zod5 = require("zod");
777
- TemplateSchema = import_zod5.z.object({
881
+ import_zod6 = require("zod");
882
+ TemplateSchema = import_zod6.z.object({
778
883
  /** Unique template identifier, e.g. "domain-owner" */
779
- id: import_zod5.z.string(),
884
+ id: import_zod6.z.string(),
780
885
  /** Display name */
781
- name: import_zod5.z.string(),
886
+ name: import_zod6.z.string(),
782
887
  /** Short description of this template's purpose */
783
- description: import_zod5.z.string(),
888
+ description: import_zod6.z.string(),
784
889
  /**
785
890
  * Markdown instruction body for the agent.
786
891
  * Supports simple variable interpolation: {{agentName}}, {{ownedPaths}}, etc.
787
892
  */
788
- instructions: import_zod5.z.string(),
893
+ instructions: import_zod6.z.string(),
789
894
  /** Default tags applied to agents created from this template */
790
- defaultTags: import_zod5.z.array(import_zod5.z.string()).default([]),
895
+ defaultTags: import_zod6.z.array(import_zod6.z.string()).default([]),
791
896
  /** Whether agents from this template must have ownedPaths defined */
792
- requiresOwnedPaths: import_zod5.z.boolean().default(true),
897
+ requiresOwnedPaths: import_zod6.z.boolean().default(true),
793
898
  /**
794
899
  * Optional YAML front-matter fields to include in generated output.
795
900
  * These are passed through to the exporter as-is.
796
901
  */
797
- frontmatter: import_zod5.z.record(import_zod5.z.unknown()).optional(),
902
+ frontmatter: import_zod6.z.record(import_zod6.z.unknown()).optional(),
798
903
  /** Version of this template definition */
799
- version: import_zod5.z.string().default("1.0.0")
904
+ version: import_zod6.z.string().default("1.0.0")
800
905
  });
801
906
  }
802
907
  });
803
908
 
804
909
  // src/models/specs.ts
805
- 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;
910
+ 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;
806
911
  var init_specs = __esm({
807
912
  "src/models/specs.ts"() {
808
913
  "use strict";
809
- import_zod6 = require("zod");
810
- SpecIdSchema = import_zod6.z.string().regex(/^[a-z0-9-_]+$/, "Identifier must be lowercase alphanumeric with dashes or underscores");
811
- SpecStatusSchema = import_zod6.z.enum(["draft", "design", "complete"]).default("complete");
812
- BoundaryItemSchema = import_zod6.z.union([
813
- import_zod6.z.string(),
814
- import_zod6.z.object({
815
- name: import_zod6.z.string(),
816
- description: import_zod6.z.string().optional()
914
+ import_zod7 = require("zod");
915
+ SpecIdSchema = import_zod7.z.string().regex(/^[a-z0-9-_]+$/, "Identifier must be lowercase alphanumeric with dashes or underscores");
916
+ SpecStatusSchema = import_zod7.z.enum(["draft", "design", "complete"]).default("complete");
917
+ BoundaryItemSchema = import_zod7.z.union([
918
+ import_zod7.z.string(),
919
+ import_zod7.z.object({
920
+ name: import_zod7.z.string(),
921
+ description: import_zod7.z.string().optional()
817
922
  })
818
923
  ]);
819
- RequirementItemSchema = import_zod6.z.union([
820
- import_zod6.z.string(),
821
- import_zod6.z.object({
822
- description: import_zod6.z.string()
924
+ RequirementItemSchema = import_zod7.z.union([
925
+ import_zod7.z.string(),
926
+ import_zod7.z.object({
927
+ description: import_zod7.z.string()
823
928
  })
824
929
  ]);
825
- DatabaseSpecSchema = import_zod6.z.object({
930
+ DatabaseSpecSchema = import_zod7.z.object({
826
931
  id: SpecIdSchema,
827
- name: import_zod6.z.string(),
828
- engine: import_zod6.z.string(),
932
+ name: import_zod7.z.string(),
933
+ engine: import_zod7.z.string(),
829
934
  // e.g. "postgresql", "mysql", "sqlite", "redis"
830
- description: import_zod6.z.string().optional(),
831
- tables: import_zod6.z.array(SpecIdSchema).optional()
935
+ description: import_zod7.z.string().optional(),
936
+ tables: import_zod7.z.array(SpecIdSchema).optional()
832
937
  });
833
- DiagramConfigSchema = import_zod6.z.object({
834
- lineStyle: import_zod6.z.enum(["bezier", "straight", "taxi"]).optional(),
835
- defaultView: import_zod6.z.enum(["architecture", "types", "databases"]).optional(),
836
- showDatabases: import_zod6.z.boolean().optional()
938
+ DiagramConfigSchema = import_zod7.z.object({
939
+ lineStyle: import_zod7.z.enum(["bezier", "straight", "taxi"]).optional(),
940
+ defaultView: import_zod7.z.enum(["architecture", "types", "databases"]).optional(),
941
+ showDatabases: import_zod7.z.boolean().optional()
837
942
  });
838
943
  SURFACE_AUDIENCES = ["project", "department", "instance", "partner", "external"];
839
- SurfaceAudienceSchema = import_zod6.z.enum(SURFACE_AUDIENCES);
840
- SystemPublicInterfaceSchema = import_zod6.z.object({
944
+ SurfaceAudienceSchema = import_zod7.z.enum(SURFACE_AUDIENCES);
945
+ SystemPublicInterfaceSchema = import_zod7.z.object({
841
946
  /** Stable public interface id within the system. */
842
- id: import_zod6.z.string().optional(),
843
- name: import_zod6.z.string().optional(),
947
+ id: import_zod7.z.string().optional(),
948
+ name: import_zod7.z.string().optional(),
844
949
  /** Subsystem publishing the backing L1 public interface. */
845
- subsystem: import_zod6.z.string().optional(),
950
+ subsystem: import_zod7.z.string().optional(),
846
951
  /** Portal (or compatible published component) backing this entry. */
847
- component: import_zod6.z.string().optional(),
952
+ component: import_zod7.z.string().optional(),
848
953
  /** Optional L3 interface id backing the surface. */
849
- interface: import_zod6.z.string().optional(),
954
+ interface: import_zod7.z.string().optional(),
850
955
  /** Surface kind: REST, GraphQL, MessageBus, RPC, or Custom. */
851
- type: import_zod6.z.string().optional(),
852
- details: import_zod6.z.string().optional(),
956
+ type: import_zod7.z.string().optional(),
957
+ details: import_zod7.z.string().optional(),
853
958
  /** Exposure ceiling (see SurfaceAudienceSchema). Defaults to 'instance' at projection time. */
854
- audience: import_zod6.z.string().optional(),
855
- authPolicy: import_zod6.z.string().optional(),
856
- version: import_zod6.z.string().optional(),
857
- stability: import_zod6.z.string().optional()
959
+ audience: import_zod7.z.string().optional(),
960
+ authPolicy: import_zod7.z.string().optional(),
961
+ version: import_zod7.z.string().optional(),
962
+ stability: import_zod7.z.string().optional()
858
963
  });
859
- SystemSpecSchema = import_zod6.z.object({
860
- schemaVersion: import_zod6.z.string().default("1.0.0"),
861
- name: import_zod6.z.string(),
862
- vision: import_zod6.z.string(),
863
- boundaries: import_zod6.z.array(BoundaryItemSchema).default([]),
864
- globalRequirements: import_zod6.z.array(RequirementItemSchema).default([]),
964
+ SystemSpecSchema = import_zod7.z.object({
965
+ schemaVersion: import_zod7.z.string().default("1.0.0"),
966
+ name: import_zod7.z.string(),
967
+ vision: import_zod7.z.string(),
968
+ boundaries: import_zod7.z.array(BoundaryItemSchema).default([]),
969
+ globalRequirements: import_zod7.z.array(RequirementItemSchema).default([]),
865
970
  /**
866
971
  * The project's gateway surface: entries intentionally exported beyond the
867
972
  * project, each backed by a subsystem-published Portal and carrying an
868
973
  * audience ceiling. Cross-PROJECT consumption may only target these.
869
974
  */
870
- publicInterfaces: import_zod6.z.array(SystemPublicInterfaceSchema).optional(),
975
+ publicInterfaces: import_zod7.z.array(SystemPublicInterfaceSchema).optional(),
871
976
  /**
872
977
  * System-level databases. Enables database table mapping, PK/FK views,
873
978
  * and isolated ERD schemas.
874
979
  */
875
- databases: import_zod6.z.array(DatabaseSpecSchema).default([]),
980
+ databases: import_zod7.z.array(DatabaseSpecSchema).default([]),
876
981
  /** Optional defaults for the interactive diagram canvas. */
877
982
  diagram: DiagramConfigSchema.optional(),
878
983
  /**
@@ -881,67 +986,67 @@ var init_specs = __esm({
881
986
  * validation (builtin-type vocabulary, language rule packs); free-form but
882
987
  * normalized to lowercase by the validator.
883
988
  */
884
- targetLanguage: import_zod6.z.string().optional(),
885
- createdAt: import_zod6.z.string().datetime(),
886
- updatedAt: import_zod6.z.string().datetime()
989
+ targetLanguage: import_zod7.z.string().optional(),
990
+ createdAt: import_zod7.z.string().datetime(),
991
+ updatedAt: import_zod7.z.string().datetime()
887
992
  });
888
- PublicInterfaceTypeSchema = import_zod6.z.enum(["REST", "GraphQL", "MessageBus", "RPC", "Custom"]);
889
- PublicInterfaceSchema = import_zod6.z.object({
993
+ PublicInterfaceTypeSchema = import_zod7.z.enum(["REST", "GraphQL", "MessageBus", "RPC", "Custom"]);
994
+ PublicInterfaceSchema = import_zod7.z.object({
890
995
  type: PublicInterfaceTypeSchema,
891
- details: import_zod6.z.string(),
996
+ details: import_zod7.z.string(),
892
997
  /** The L2 component that realizes this public interface (the subsystem's published surface). */
893
998
  component: SpecIdSchema.optional(),
894
999
  /** Optional L3 interface on that component backing this entry. */
895
1000
  interface: SpecIdSchema.optional()
896
1001
  });
897
- TrustedLinkSchema = import_zod6.z.object({
1002
+ TrustedLinkSchema = import_zod7.z.object({
898
1003
  /** The peer subsystem id this link sanctions tight coupling with. */
899
1004
  subsystem: SpecIdSchema,
900
1005
  /** Why this coupling is sanctioned (e.g. "runtime dispatch latency — bus round-trip too slow"). */
901
- reason: import_zod6.z.string()
1006
+ reason: import_zod7.z.string()
902
1007
  });
903
- LintAllowSchema = import_zod6.z.object({
1008
+ LintAllowSchema = import_zod7.z.object({
904
1009
  /** The issue code being allowed (see `wairon rules list`). */
905
- code: import_zod6.z.string(),
1010
+ code: import_zod7.z.string(),
906
1011
  /** Why this finding is acceptable here (e.g. "dispatcher — fan-out is the point"). */
907
- reason: import_zod6.z.string().min(1)
1012
+ reason: import_zod7.z.string().min(1)
908
1013
  });
909
- LintConfigSchema = import_zod6.z.object({
910
- allow: import_zod6.z.array(LintAllowSchema).default([])
1014
+ LintConfigSchema = import_zod7.z.object({
1015
+ allow: import_zod7.z.array(LintAllowSchema).default([])
911
1016
  });
912
- ExtDataSchema = import_zod6.z.record(import_zod6.z.unknown());
913
- LifecycleEntrypointSchema = import_zod6.z.object({
1017
+ ExtDataSchema = import_zod7.z.record(import_zod7.z.unknown());
1018
+ LifecycleEntrypointSchema = import_zod7.z.object({
914
1019
  /** Which lifecycle/execution flow this roots. */
915
- phase: import_zod6.z.enum(["init", "shutdown", "cyclic", "interrupt", "scheduled"]),
1020
+ phase: import_zod7.z.enum(["init", "shutdown", "cyclic", "interrupt", "scheduled"]),
916
1021
  /** Component id whose method the runtime invokes at this phase. */
917
- component: import_zod6.z.string(),
1022
+ component: import_zod7.z.string(),
918
1023
  /** Method name on that component's interface. */
919
- method: import_zod6.z.string(),
1024
+ method: import_zod7.z.string(),
920
1025
  /** What this lifecycle flow establishes or tears down. */
921
- description: import_zod6.z.string().optional()
1026
+ description: import_zod7.z.string().optional()
922
1027
  });
923
- SubsystemSpecSchema = import_zod6.z.object({
1028
+ SubsystemSpecSchema = import_zod7.z.object({
924
1029
  id: SpecIdSchema,
925
- name: import_zod6.z.string(),
926
- description: import_zod6.z.string(),
927
- parentSystem: import_zod6.z.string(),
1030
+ name: import_zod7.z.string(),
1031
+ description: import_zod7.z.string(),
1032
+ parentSystem: import_zod7.z.string(),
928
1033
  // References L0 System Name or file
929
- publicInterfaces: import_zod6.z.array(PublicInterfaceSchema).default([]),
1034
+ publicInterfaces: import_zod7.z.array(PublicInterfaceSchema).default([]),
930
1035
  /** Declared init/shutdown flow roots (see LifecycleEntrypointSchema). */
931
- lifecycle: import_zod6.z.array(LifecycleEntrypointSchema).optional(),
1036
+ lifecycle: import_zod7.z.array(LifecycleEntrypointSchema).optional(),
932
1037
  /**
933
1038
  * Optional subsystem profile override (e.g. for fullstack systems). Open
934
1039
  * string: built-ins are backend, frontend-reactive, frontend-controller,
935
1040
  * lowlevel-os, game-ecs, realtime-embedded, plc-cyclic; extension packs
936
1041
  * may register more. Unknown names get UNKNOWN_PROFILE.
937
1042
  */
938
- profile: import_zod6.z.string().optional(),
939
- projectPath: import_zod6.z.string().optional(),
1043
+ profile: import_zod7.z.string().optional(),
1044
+ projectPath: import_zod7.z.string().optional(),
940
1045
  // Relative path to external project root for subsystem chaining
941
1046
  /** Optional override of the system-level targetLanguage for this subsystem. */
942
- targetLanguage: import_zod6.z.string().optional(),
1047
+ targetLanguage: import_zod7.z.string().optional(),
943
1048
  /** Explicitly sanctioned tight couplings with peer subsystems (see TrustedLinkSchema). */
944
- trustedLinks: import_zod6.z.array(TrustedLinkSchema).default([]),
1049
+ trustedLinks: import_zod7.z.array(TrustedLinkSchema).default([]),
945
1050
  /**
946
1051
  * Per-subsystem design-depth override (components | interfaces |
947
1052
  * implementations | narratives): how deep THIS subsystem commits to
@@ -951,16 +1056,16 @@ var init_specs = __esm({
951
1056
  * Expectation checks below the depth are gated; soundness of authored
952
1057
  * content never is.
953
1058
  */
954
- designDepth: import_zod6.z.enum(["components", "interfaces", "implementations", "narratives"]).optional(),
1059
+ designDepth: import_zod7.z.enum(["components", "interfaces", "implementations", "narratives"]).optional(),
955
1060
  /** Per-spec lint suppressions (see LintConfigSchema). */
956
1061
  lint: LintConfigSchema.optional(),
957
1062
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
958
1063
  ext: ExtDataSchema.optional(),
959
1064
  status: SpecStatusSchema.optional().default("complete"),
960
- createdAt: import_zod6.z.string().datetime(),
961
- updatedAt: import_zod6.z.string().datetime()
1065
+ createdAt: import_zod7.z.string().datetime(),
1066
+ updatedAt: import_zod7.z.string().datetime()
962
1067
  });
963
- ComponentTypeSchema = import_zod6.z.enum([
1068
+ ComponentTypeSchema = import_zod7.z.enum([
964
1069
  // Building blocks
965
1070
  "Portal",
966
1071
  "Orchestrator",
@@ -983,123 +1088,123 @@ var init_specs = __esm({
983
1088
  // Switch/routing component pattern
984
1089
  ]);
985
1090
  PATTERN_TYPES = /* @__PURE__ */ new Set(["Repository", "Gateway", "FeatureComponent", "RouterComponent"]);
986
- PortalTypeSchema = import_zod6.z.enum(["HTTP_API", "gRPC", "GraphQL", "MessageBus", "CLI", "NamedPipe", "IPC", "Custom"]);
987
- DispatchBindingSchema = import_zod6.z.object({
1091
+ PortalTypeSchema = import_zod7.z.enum(["HTTP_API", "gRPC", "GraphQL", "MessageBus", "CLI", "NamedPipe", "IPC", "Custom"]);
1092
+ DispatchBindingSchema = import_zod7.z.object({
988
1093
  /** Capability name exactly as dispatched at runtime (e.g. "shadow_module.get"). */
989
- capability: import_zod6.z.string().min(1),
1094
+ capability: import_zod7.z.string().min(1),
990
1095
  /** Component id serving this capability (local, super::-relative, or ::-absolute). */
991
- component: import_zod6.z.string(),
1096
+ component: import_zod7.z.string(),
992
1097
  /** Method name on the serving component's interface. */
993
- method: import_zod6.z.string(),
1098
+ method: import_zod7.z.string(),
994
1099
  /** What this capability does. */
995
- description: import_zod6.z.string().optional()
1100
+ description: import_zod7.z.string().optional()
996
1101
  });
997
- DurabilitySchema = import_zod6.z.enum(["ram-projection", "durable", "read-through", "cache"]);
998
- PatternRefSchema = import_zod6.z.object({
999
- id: import_zod6.z.string(),
1000
- version: import_zod6.z.string().optional()
1102
+ DurabilitySchema = import_zod7.z.enum(["ram-projection", "durable", "read-through", "cache"]);
1103
+ PatternRefSchema = import_zod7.z.object({
1104
+ id: import_zod7.z.string(),
1105
+ version: import_zod7.z.string().optional()
1001
1106
  });
1002
- EventBindingSchema = import_zod6.z.object({
1107
+ EventBindingSchema = import_zod7.z.object({
1003
1108
  /** Topic/channel name exactly as used on the bus. */
1004
- topic: import_zod6.z.string().min(1),
1109
+ topic: import_zod7.z.string().min(1),
1005
1110
  /** Optional event name within the topic (informational in v1 — pairing is by topic). */
1006
- event: import_zod6.z.string().optional(),
1007
- description: import_zod6.z.string().optional()
1111
+ event: import_zod7.z.string().optional(),
1112
+ description: import_zod7.z.string().optional()
1008
1113
  });
1009
- ExternalLinkTypeSchema = import_zod6.z.enum(["implementation", "informative"]);
1010
- ExternalLinkSchema = import_zod6.z.object({
1011
- url: import_zod6.z.string(),
1114
+ ExternalLinkTypeSchema = import_zod7.z.enum(["implementation", "informative"]);
1115
+ ExternalLinkSchema = import_zod7.z.object({
1116
+ url: import_zod7.z.string(),
1012
1117
  /** Defaults to 'informative' so an untyped link never silently satisfies the source requirement. */
1013
1118
  type: ExternalLinkTypeSchema.default("informative"),
1014
- label: import_zod6.z.string().optional()
1119
+ label: import_zod7.z.string().optional()
1015
1120
  });
1016
- PortalAuthSchemeSchema = import_zod6.z.enum(["none", "apiKey", "bearer", "basic", "oauth2", "openIdConnect", "custom"]);
1017
- PortalAuthSchema = import_zod6.z.object({
1121
+ PortalAuthSchemeSchema = import_zod7.z.enum(["none", "apiKey", "bearer", "basic", "oauth2", "openIdConnect", "custom"]);
1122
+ PortalAuthSchema = import_zod7.z.object({
1018
1123
  scheme: PortalAuthSchemeSchema,
1019
- in: import_zod6.z.enum(["header", "query", "cookie"]).optional(),
1020
- name: import_zod6.z.string().optional(),
1021
- bearerFormat: import_zod6.z.string().optional(),
1022
- authorizationUrl: import_zod6.z.string().optional(),
1023
- tokenUrl: import_zod6.z.string().optional(),
1024
- refreshUrl: import_zod6.z.string().optional(),
1025
- scopes: import_zod6.z.array(import_zod6.z.object({ name: import_zod6.z.string(), description: import_zod6.z.string() })).optional(),
1026
- flow: import_zod6.z.enum(["authorizationCode", "clientCredentials", "implicit", "password"]).optional(),
1027
- openIdConnectUrl: import_zod6.z.string().optional(),
1028
- description: import_zod6.z.string().optional(),
1029
- example: import_zod6.z.string().optional()
1124
+ in: import_zod7.z.enum(["header", "query", "cookie"]).optional(),
1125
+ name: import_zod7.z.string().optional(),
1126
+ bearerFormat: import_zod7.z.string().optional(),
1127
+ authorizationUrl: import_zod7.z.string().optional(),
1128
+ tokenUrl: import_zod7.z.string().optional(),
1129
+ refreshUrl: import_zod7.z.string().optional(),
1130
+ scopes: import_zod7.z.array(import_zod7.z.object({ name: import_zod7.z.string(), description: import_zod7.z.string() })).optional(),
1131
+ flow: import_zod7.z.enum(["authorizationCode", "clientCredentials", "implicit", "password"]).optional(),
1132
+ openIdConnectUrl: import_zod7.z.string().optional(),
1133
+ description: import_zod7.z.string().optional(),
1134
+ example: import_zod7.z.string().optional()
1030
1135
  });
1031
- ComponentSpecSchema = import_zod6.z.object({
1136
+ ComponentSpecSchema = import_zod7.z.object({
1032
1137
  id: SpecIdSchema,
1033
- name: import_zod6.z.string(),
1034
- description: import_zod6.z.string(),
1035
- subsystem: import_zod6.z.string(),
1138
+ name: import_zod7.z.string(),
1139
+ description: import_zod7.z.string(),
1140
+ subsystem: import_zod7.z.string(),
1036
1141
  // References L1 Subsystem id
1037
1142
  componentType: ComponentTypeSchema,
1038
1143
  /** Member block ids privately owned by this component (patterns only; one hop). */
1039
- owns: import_zod6.z.array(import_zod6.z.string()).default([]),
1144
+ owns: import_zod7.z.array(import_zod7.z.string()).default([]),
1040
1145
  /** Other L2 component ids this component collaborates with (facades / standalone blocks). */
1041
- dependsOn: import_zod6.z.array(import_zod6.z.string()).default([]),
1146
+ dependsOn: import_zod7.z.array(import_zod7.z.string()).default([]),
1042
1147
  portalType: PortalTypeSchema.optional(),
1043
- basePath: import_zod6.z.string().optional(),
1148
+ basePath: import_zod7.z.string().optional(),
1044
1149
  /** Portal-only: the API's authentication scheme (see PortalAuthSchema) — projected
1045
1150
  * into the generated OpenAPI's securitySchemes/security. Portals with different auth
1046
1151
  * must be separate components (one auth per portal ⇒ one OpenAPI spec per portal). */
1047
1152
  auth: PortalAuthSchema.optional(),
1048
1153
  /** Portal-only: capability → component.method dispatch table (see DispatchBindingSchema). */
1049
- dispatch: import_zod6.z.array(DispatchBindingSchema).optional(),
1154
+ dispatch: import_zod7.z.array(DispatchBindingSchema).optional(),
1050
1155
  /** Store-only: whether held state survives restart (see DurabilitySchema). */
1051
1156
  durability: DurabilitySchema.optional(),
1052
1157
  /** Topics this component publishes to (see EventBindingSchema). */
1053
- emits: import_zod6.z.array(EventBindingSchema).optional(),
1158
+ emits: import_zod7.z.array(EventBindingSchema).optional(),
1054
1159
  /** Topics this component consumes (see EventBindingSchema) — typical on Observers. */
1055
- subscribesTo: import_zod6.z.array(EventBindingSchema).optional(),
1160
+ subscribesTo: import_zod7.z.array(EventBindingSchema).optional(),
1056
1161
  /** Pack-declared reusable patterns this component realizes (resolved against loaded packs; UNKNOWN_PATTERN_REF). */
1057
- patterns: import_zod6.z.array(PatternRefSchema).optional(),
1162
+ patterns: import_zod7.z.array(PatternRefSchema).optional(),
1058
1163
  /** Optional component variant — a declared, base-anchored specialization of this component's stereotype (resolved against the variant registry; UNKNOWN_VARIANT / VARIANT_BASE_MISMATCH). */
1059
- variant: import_zod6.z.string().optional(),
1164
+ variant: import_zod7.z.string().optional(),
1060
1165
  /** Opaque external references (see ExternalLinkSchema) — documented URLs wairon does
1061
1166
  * not fetch or validate. An `implementation` link is the external source-of-record and
1062
1167
  * satisfies the source requirement for a source-less implementation (suppresses
1063
1168
  * MISSING_SOURCE_PATH); `informative` links are context only. */
1064
- externalLinks: import_zod6.z.array(ExternalLinkSchema).optional(),
1169
+ externalLinks: import_zod7.z.array(ExternalLinkSchema).optional(),
1065
1170
  /** Per-spec lint suppressions (see LintConfigSchema). */
1066
1171
  lint: LintConfigSchema.optional(),
1067
1172
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
1068
1173
  ext: ExtDataSchema.optional(),
1069
1174
  status: SpecStatusSchema.optional().default("complete"),
1070
- createdAt: import_zod6.z.string().datetime(),
1071
- updatedAt: import_zod6.z.string().datetime()
1175
+ createdAt: import_zod7.z.string().datetime(),
1176
+ updatedAt: import_zod7.z.string().datetime()
1072
1177
  });
1073
- HttpMethodSchema = import_zod6.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]);
1074
- TransportSchema = import_zod6.z.enum(["HTTP", "gRPC", "GraphQL", "MessageBus", "NamedPipe", "IPC", "CLI", "Custom"]);
1075
- EndpointSchema = import_zod6.z.discriminatedUnion("transport", [
1076
- import_zod6.z.object({ transport: import_zod6.z.literal("HTTP"), method: HttpMethodSchema, path: import_zod6.z.string() }),
1077
- import_zod6.z.object({ transport: import_zod6.z.literal("gRPC"), service: import_zod6.z.string(), method: import_zod6.z.string() }),
1078
- import_zod6.z.object({ transport: import_zod6.z.literal("GraphQL"), operation: import_zod6.z.enum(["query", "mutation", "subscription"]), field: import_zod6.z.string() }),
1079
- 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") }),
1080
- import_zod6.z.object({ transport: import_zod6.z.literal("NamedPipe"), pipe: import_zod6.z.string() }),
1081
- import_zod6.z.object({ transport: import_zod6.z.literal("IPC"), channel: import_zod6.z.string() }),
1082
- import_zod6.z.object({ transport: import_zod6.z.literal("CLI"), command: import_zod6.z.string() }),
1083
- import_zod6.z.object({ transport: import_zod6.z.literal("Custom"), address: import_zod6.z.string() })
1178
+ HttpMethodSchema = import_zod7.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]);
1179
+ TransportSchema = import_zod7.z.enum(["HTTP", "gRPC", "GraphQL", "MessageBus", "NamedPipe", "IPC", "CLI", "Custom"]);
1180
+ EndpointSchema = import_zod7.z.discriminatedUnion("transport", [
1181
+ import_zod7.z.object({ transport: import_zod7.z.literal("HTTP"), method: HttpMethodSchema, path: import_zod7.z.string() }),
1182
+ import_zod7.z.object({ transport: import_zod7.z.literal("gRPC"), service: import_zod7.z.string(), method: import_zod7.z.string() }),
1183
+ import_zod7.z.object({ transport: import_zod7.z.literal("GraphQL"), operation: import_zod7.z.enum(["query", "mutation", "subscription"]), field: import_zod7.z.string() }),
1184
+ 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") }),
1185
+ import_zod7.z.object({ transport: import_zod7.z.literal("NamedPipe"), pipe: import_zod7.z.string() }),
1186
+ import_zod7.z.object({ transport: import_zod7.z.literal("IPC"), channel: import_zod7.z.string() }),
1187
+ import_zod7.z.object({ transport: import_zod7.z.literal("CLI"), command: import_zod7.z.string() }),
1188
+ import_zod7.z.object({ transport: import_zod7.z.literal("Custom"), address: import_zod7.z.string() })
1084
1189
  ]);
1085
1190
  SEMANTIC_GUARANTEES = ["idempotent", "atomic", "transactional", "exactly-once"];
1086
- GuaranteeSchema = import_zod6.z.string().min(1);
1087
- MethodParamSchema = import_zod6.z.object({
1088
- name: import_zod6.z.string(),
1191
+ GuaranteeSchema = import_zod7.z.string().min(1);
1192
+ MethodParamSchema = import_zod7.z.object({
1193
+ name: import_zod7.z.string(),
1089
1194
  /** A primitive/builtin or a defined type id (qualified across subsystems, e.g. "billing.Invoice"). */
1090
- type: import_zod6.z.string(),
1091
- description: import_zod6.z.string().optional(),
1092
- optional: import_zod6.z.boolean().optional()
1195
+ type: import_zod7.z.string(),
1196
+ description: import_zod7.z.string().optional(),
1197
+ optional: import_zod7.z.boolean().optional()
1093
1198
  });
1094
- MethodSignatureSchema = import_zod6.z.object({
1095
- name: import_zod6.z.string().regex(/^[a-zA-Z0-9_]+$/, "Method name must be alphanumeric"),
1096
- description: import_zod6.z.string(),
1097
- signature: import_zod6.z.string(),
1199
+ MethodSignatureSchema = import_zod7.z.object({
1200
+ name: import_zod7.z.string().regex(/^[a-zA-Z0-9_]+$/, "Method name must be alphanumeric"),
1201
+ description: import_zod7.z.string(),
1202
+ signature: import_zod7.z.string(),
1098
1203
  // e.g. "save(key: string, data: Buffer): Promise<void>"
1099
- returns: import_zod6.z.string(),
1204
+ returns: import_zod7.z.string(),
1100
1205
  // e.g. "Promise<void>"
1101
1206
  /** Structured parameters (authoritative for type checking when present). */
1102
- params: import_zod6.z.array(MethodParamSchema).optional(),
1207
+ params: import_zod7.z.array(MethodParamSchema).optional(),
1103
1208
  /** Concrete wire binding for this method when its component is a Portal (set via sdd_set_endpoints). */
1104
1209
  endpoint: EndpointSchema.optional(),
1105
1210
  /**
@@ -1108,13 +1213,13 @@ var init_specs = __esm({
1108
1213
  * asserts a guarantee must call a method that declares it here. Whether the guarantee is
1109
1214
  * actually delivered is implementation correctness (implementer tests), not a static check.
1110
1215
  */
1111
- guarantees: import_zod6.z.array(GuaranteeSchema).optional(),
1216
+ guarantees: import_zod7.z.array(GuaranteeSchema).optional(),
1112
1217
  /**
1113
1218
  * State-effect direction of this method on its component's held state. Required on a
1114
1219
  * durable Store's contract methods so the durability round-trip rule can pair external
1115
1220
  * writes with hydration read-backs (MISSING_HYDRATION); optional elsewhere.
1116
1221
  */
1117
- effect: import_zod6.z.enum(["read", "write"]).optional(),
1222
+ effect: import_zod7.z.enum(["read", "write"]).optional(),
1118
1223
  /**
1119
1224
  * Typed acknowledgment of a real caller OUTSIDE the modeled narrative graph
1120
1225
  * (runtime timer/hook, external system, sibling subsystem). Unused-detection
@@ -1125,29 +1230,29 @@ var init_specs = __esm({
1125
1230
  * Prefer a `register` narrative step when the wiring is internal — the
1126
1231
  * registration itself is then a modeled, checkable edge.
1127
1232
  */
1128
- invokedBy: import_zod6.z.object({
1129
- kind: import_zod6.z.enum(["runtime", "external", "sibling-subsystem"]),
1130
- caller: import_zod6.z.string().optional()
1233
+ invokedBy: import_zod7.z.object({
1234
+ kind: import_zod7.z.enum(["runtime", "external", "sibling-subsystem"]),
1235
+ caller: import_zod7.z.string().optional()
1131
1236
  }).optional(),
1132
1237
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
1133
1238
  ext: ExtDataSchema.optional()
1134
1239
  });
1135
- InterfaceSpecSchema = import_zod6.z.object({
1240
+ InterfaceSpecSchema = import_zod7.z.object({
1136
1241
  id: SpecIdSchema.regex(/^i[a-z0-9-_]+$/, 'Interface id must be prefixed with a lowercase "i"'),
1137
- name: import_zod6.z.string(),
1138
- description: import_zod6.z.string(),
1139
- component: import_zod6.z.string(),
1242
+ name: import_zod7.z.string(),
1243
+ description: import_zod7.z.string(),
1244
+ component: import_zod7.z.string(),
1140
1245
  // References L2 Component id
1141
- methods: import_zod6.z.array(MethodSignatureSchema).default([]),
1246
+ methods: import_zod7.z.array(MethodSignatureSchema).default([]),
1142
1247
  /** Per-spec lint suppressions (see LintConfigSchema). */
1143
1248
  lint: LintConfigSchema.optional(),
1144
1249
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
1145
1250
  ext: ExtDataSchema.optional(),
1146
1251
  status: SpecStatusSchema.optional().default("complete"),
1147
- createdAt: import_zod6.z.string().datetime(),
1148
- updatedAt: import_zod6.z.string().datetime()
1252
+ createdAt: import_zod7.z.string().datetime(),
1253
+ updatedAt: import_zod7.z.string().datetime()
1149
1254
  });
1150
- NarrativeStepTypeSchema = import_zod6.z.enum([
1255
+ NarrativeStepTypeSchema = import_zod7.z.enum([
1151
1256
  "local",
1152
1257
  // in-component work
1153
1258
  "call",
@@ -1173,27 +1278,27 @@ var init_specs = __esm({
1173
1278
  "throw"
1174
1279
  // error terminator: this path raises/propagates
1175
1280
  ]);
1176
- LoopKindSchema = import_zod6.z.enum(["forEach", "for", "while", "doWhile"]);
1177
- SwitchCaseSchema = import_zod6.z.object({
1178
- value: import_zod6.z.string(),
1281
+ LoopKindSchema = import_zod7.z.enum(["forEach", "for", "while", "doWhile"]);
1282
+ SwitchCaseSchema = import_zod7.z.object({
1283
+ value: import_zod7.z.string(),
1179
1284
  // the matched value/case label
1180
- step: import_zod6.z.number().int().positive()
1285
+ step: import_zod7.z.number().int().positive()
1181
1286
  // first step of this case's region
1182
1287
  });
1183
- CatchClauseSchema = import_zod6.z.object({
1184
- error: import_zod6.z.string(),
1288
+ CatchClauseSchema = import_zod7.z.object({
1289
+ error: import_zod7.z.string(),
1185
1290
  // error/condition caught (free text; 'any' for catch-all)
1186
- step: import_zod6.z.number().int().positive()
1291
+ step: import_zod7.z.number().int().positive()
1187
1292
  // first step of the handler region
1188
1293
  });
1189
- ParallelBranchSchema = import_zod6.z.object({
1190
- step: import_zod6.z.number().int().positive(),
1294
+ ParallelBranchSchema = import_zod7.z.object({
1295
+ step: import_zod7.z.number().int().positive(),
1191
1296
  // first step of this arm's region
1192
- name: import_zod6.z.string().optional()
1297
+ name: import_zod7.z.string().optional()
1193
1298
  // optional arm label for renderers/readers
1194
1299
  });
1195
- NarrativeStepSchema = import_zod6.z.object({
1196
- stepNumber: import_zod6.z.number().int().positive(),
1300
+ NarrativeStepSchema = import_zod7.z.object({
1301
+ stepNumber: import_zod7.z.number().int().positive(),
1197
1302
  /**
1198
1303
  * Optional symbolic anchor for this step. Authoring surfaces accept *Label
1199
1304
  * twins of every jump-by-number field (toLabel, onTrueLabel, …) resolved
@@ -1201,14 +1306,14 @@ var init_specs = __esm({
1201
1306
  * the stored numeric fields stay the single flow representation. Labels
1202
1307
  * persist so later deltas can reference existing steps symbolically.
1203
1308
  */
1204
- label: import_zod6.z.string().min(1).optional(),
1205
- description: import_zod6.z.string(),
1309
+ label: import_zod7.z.string().min(1).optional(),
1310
+ description: import_zod7.z.string(),
1206
1311
  type: NarrativeStepTypeSchema,
1207
- targetComponent: import_zod6.z.string().optional(),
1312
+ targetComponent: import_zod7.z.string().optional(),
1208
1313
  // Required if type is 'call', 'register' or 'dispatch', references L2 Component id
1209
- targetMethod: import_zod6.z.string().optional(),
1314
+ targetMethod: import_zod7.z.string().optional(),
1210
1315
  // Required if type is 'call' or 'register', references Method name on target interface
1211
- capability: import_zod6.z.string().optional(),
1316
+ capability: import_zod7.z.string().optional(),
1212
1317
  // Required if type is 'dispatch': the capability routed through the target Portal's dispatch table
1213
1318
  /**
1214
1319
  * call/dispatch only: the credential this step presents to an authed callee
@@ -1221,8 +1326,8 @@ var init_specs = __esm({
1221
1326
  * `auth ≠ none` warns (PORTAL_AUTH_UNMET), so credential loading is never
1222
1327
  * overlooked.
1223
1328
  */
1224
- auth: import_zod6.z.object({ from: import_zod6.z.string(), note: import_zod6.z.string().optional() }).optional(),
1225
- assertsGuarantees: import_zod6.z.array(GuaranteeSchema).optional(),
1329
+ auth: import_zod7.z.object({ from: import_zod7.z.string(), note: import_zod7.z.string().optional() }).optional(),
1330
+ assertsGuarantees: import_zod7.z.array(GuaranteeSchema).optional(),
1226
1331
  /**
1227
1332
  * Declared entity invariants this step upholds, as "<type-id>.<invariant-id>"
1228
1333
  * references (type id optionally subsystem-qualified). The invariant-backing
@@ -1230,51 +1335,51 @@ var init_specs = __esm({
1230
1335
  * (UNKNOWN_INVARIANT_REF) and counts the step as the write-path assertion the
1231
1336
  * entity's write methods must carry (UNASSERTED_INVARIANT otherwise).
1232
1337
  */
1233
- assertsInvariants: import_zod6.z.array(import_zod6.z.string()).optional(),
1338
+ assertsInvariants: import_zod7.z.array(import_zod7.z.string()).optional(),
1234
1339
  // --- flow config (per type; validated by the narrative-flow rule) ---------
1235
- condition: import_zod6.z.string().optional(),
1340
+ condition: import_zod7.z.string().optional(),
1236
1341
  // branch; loop (while/doWhile)
1237
- onTrueStep: import_zod6.z.number().int().positive().optional(),
1342
+ onTrueStep: import_zod7.z.number().int().positive().optional(),
1238
1343
  // branch (default: next step)
1239
- onFalseStep: import_zod6.z.number().int().positive().optional(),
1344
+ onFalseStep: import_zod7.z.number().int().positive().optional(),
1240
1345
  // branch (required)
1241
- on: import_zod6.z.string().optional(),
1346
+ on: import_zod7.z.string().optional(),
1242
1347
  // switch: the dispatched value
1243
- cases: import_zod6.z.array(SwitchCaseSchema).optional(),
1348
+ cases: import_zod7.z.array(SwitchCaseSchema).optional(),
1244
1349
  // switch (required)
1245
- defaultStep: import_zod6.z.number().int().positive().optional(),
1350
+ defaultStep: import_zod7.z.number().int().positive().optional(),
1246
1351
  // switch (default: next step)
1247
1352
  loopKind: LoopKindSchema.optional(),
1248
1353
  // loop (default: forEach when `over`, else while)
1249
- over: import_zod6.z.string().optional(),
1354
+ over: import_zod7.z.string().optional(),
1250
1355
  // loop (forEach/for): iteration source
1251
- endStep: import_zod6.z.number().int().positive().optional(),
1356
+ endStep: import_zod7.z.number().int().positive().optional(),
1252
1357
  // loop/try/parallel: last step of the body region
1253
- catches: import_zod6.z.array(CatchClauseSchema).optional(),
1358
+ catches: import_zod7.z.array(CatchClauseSchema).optional(),
1254
1359
  // try
1255
- finallyStep: import_zod6.z.number().int().positive().optional(),
1360
+ finallyStep: import_zod7.z.number().int().positive().optional(),
1256
1361
  // try: first step of the always-runs region
1257
- branches: import_zod6.z.array(ParallelBranchSchema).optional(),
1362
+ branches: import_zod7.z.array(ParallelBranchSchema).optional(),
1258
1363
  // parallel (required, >= 2 arms)
1259
- toStep: import_zod6.z.number().int().positive().optional(),
1364
+ toStep: import_zod7.z.number().int().positive().optional(),
1260
1365
  // jump (required)
1261
1366
  /**
1262
1367
  * call/dispatch only: fire-and-forget — the call is issued and this
1263
1368
  * narrative CONTINUES without awaiting the result (no result is consumed
1264
1369
  * by later steps). Language/platform packs may gate it via unsupportedFlow.
1265
1370
  */
1266
- detach: import_zod6.z.boolean().optional(),
1267
- outcome: import_zod6.z.string().optional(),
1371
+ detach: import_zod7.z.boolean().optional(),
1372
+ outcome: import_zod7.z.string().optional(),
1268
1373
  // return: 'success' / 'not found' / …
1269
- error: import_zod6.z.string().optional()
1374
+ error: import_zod7.z.string().optional()
1270
1375
  // throw: the raised error
1271
1376
  });
1272
- NarrativeDetailSchema = import_zod6.z.enum(["full", "calls-only", "intent"]);
1273
- ConformanceTierSchema = import_zod6.z.enum(["declared", "anchored", "off"]);
1274
- MethodImplementationSchema = import_zod6.z.object({
1275
- name: import_zod6.z.string(),
1377
+ NarrativeDetailSchema = import_zod7.z.enum(["full", "calls-only", "intent"]);
1378
+ ConformanceTierSchema = import_zod7.z.enum(["declared", "anchored", "off"]);
1379
+ MethodImplementationSchema = import_zod7.z.object({
1380
+ name: import_zod7.z.string(),
1276
1381
  // Must match a method name in the L3 interface contract
1277
- narrative: import_zod6.z.array(NarrativeStepSchema).default([]),
1382
+ narrative: import_zod7.z.array(NarrativeStepSchema).default([]),
1278
1383
  // Level 5 Narrative
1279
1384
  /** Detail level for THIS method (overrides the spec-level default). */
1280
1385
  detail: NarrativeDetailSchema.optional(),
@@ -1283,7 +1388,7 @@ var init_specs = __esm({
1283
1388
  * detail: intent. Subject to the INTENT_FLOOR check: non-trivial, and
1284
1389
  * failure behavior stated here or in the contract's guarantees.
1285
1390
  */
1286
- intent: import_zod6.z.string().optional(),
1391
+ intent: import_zod7.z.string().optional(),
1287
1392
  /** Conformance tier for THIS method (overrides the spec-level default). */
1288
1393
  conformance: ConformanceTierSchema.optional(),
1289
1394
  /**
@@ -1291,17 +1396,17 @@ var init_specs = __esm({
1291
1396
  * file, when it legitimately differs from the intent-language contract
1292
1397
  * name — e.g. a store's `put` realized by `saveSnapshot`.
1293
1398
  */
1294
- symbol: import_zod6.z.string().optional(),
1399
+ symbol: import_zod7.z.string().optional(),
1295
1400
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
1296
1401
  ext: ExtDataSchema.optional()
1297
1402
  });
1298
- ImplementationSpecSchema = import_zod6.z.object({
1403
+ ImplementationSpecSchema = import_zod7.z.object({
1299
1404
  id: SpecIdSchema,
1300
- name: import_zod6.z.string(),
1301
- description: import_zod6.z.string(),
1302
- contract: import_zod6.z.string(),
1405
+ name: import_zod7.z.string(),
1406
+ description: import_zod7.z.string(),
1407
+ contract: import_zod7.z.string(),
1303
1408
  // References L3 Interface id
1304
- sourcePath: import_zod6.z.string().optional(),
1409
+ sourcePath: import_zod7.z.string().optional(),
1305
1410
  // Path to the concrete source code file (e.g. "src/storage/vfs.ts")
1306
1411
  /**
1307
1412
  * The committed integration-sim harness for this implementation (N:1
@@ -1312,7 +1417,7 @@ var init_specs = __esm({
1312
1417
  * simPath in a subsystem activates MISSING_INTEGRATION_SIM for that
1313
1418
  * subsystem's other complete non-leaf implementations.
1314
1419
  */
1315
- simPath: import_zod6.z.string().optional(),
1420
+ simPath: import_zod7.z.string().optional(),
1316
1421
  /**
1317
1422
  * External technologies (vendor, engine, SDK, service) this implementation
1318
1423
  * binds to — e.g. ["mysql"], ["sendgrid"]. Declaring one makes this
@@ -1321,8 +1426,8 @@ var init_specs = __esm({
1321
1426
  * intent-language (VENDOR_NAME_IN_CONTRACT), and only data-layer
1322
1427
  * stereotypes should bind tech directly (TECH_ON_LOGIC_COMPONENT).
1323
1428
  */
1324
- technologies: import_zod6.z.array(import_zod6.z.string()).optional(),
1325
- methods: import_zod6.z.array(MethodImplementationSchema).default([]),
1429
+ technologies: import_zod7.z.array(import_zod7.z.string()).optional(),
1430
+ methods: import_zod7.z.array(MethodImplementationSchema).default([]),
1326
1431
  /** Spec-level narrative detail default for all methods (each may override). */
1327
1432
  detail: NarrativeDetailSchema.optional(),
1328
1433
  /** Spec-level structural-conformance tier default (each method may override). */
@@ -1332,144 +1437,144 @@ var init_specs = __esm({
1332
1437
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
1333
1438
  ext: ExtDataSchema.optional(),
1334
1439
  status: SpecStatusSchema.optional().default("complete"),
1335
- createdAt: import_zod6.z.string().datetime(),
1336
- updatedAt: import_zod6.z.string().datetime()
1440
+ createdAt: import_zod7.z.string().datetime(),
1441
+ updatedAt: import_zod7.z.string().datetime()
1337
1442
  });
1338
- TypeKindSchema = import_zod6.z.enum(["entity", "value-object"]);
1339
- TypeFieldSchema = import_zod6.z.object({
1340
- name: import_zod6.z.string(),
1341
- type: import_zod6.z.string(),
1443
+ TypeKindSchema = import_zod7.z.enum(["entity", "value-object"]);
1444
+ TypeFieldSchema = import_zod7.z.object({
1445
+ name: import_zod7.z.string(),
1446
+ type: import_zod7.z.string(),
1342
1447
  // a primitive, or another type id (qualified across subsystems, e.g. "billing.Invoice")
1343
- description: import_zod6.z.string().optional(),
1344
- optional: import_zod6.z.boolean().default(false),
1448
+ description: import_zod7.z.string().optional(),
1449
+ optional: import_zod7.z.boolean().default(false),
1345
1450
  /**
1346
1451
  * Identity marker for ERD / database schema derivation:
1347
1452
  * - 'primary' (PK)
1348
1453
  * - 'unique' (UK)
1349
1454
  * - 'foreign' (FK)
1350
1455
  */
1351
- key: import_zod6.z.enum(["primary", "unique", "foreign"]).optional(),
1456
+ key: import_zod7.z.enum(["primary", "unique", "foreign"]).optional(),
1352
1457
  /**
1353
1458
  * For foreign keys, the referenced type/table ID (e.g. "billing.Invoice")
1354
1459
  * and optionally field (e.g. "billing.Invoice.id").
1355
1460
  */
1356
- references: import_zod6.z.string().optional()
1461
+ references: import_zod7.z.string().optional()
1357
1462
  });
1358
- TypeMethodSchema = import_zod6.z.object({
1359
- name: import_zod6.z.string(),
1360
- signature: import_zod6.z.string(),
1361
- returns: import_zod6.z.string(),
1362
- description: import_zod6.z.string().optional()
1463
+ TypeMethodSchema = import_zod7.z.object({
1464
+ name: import_zod7.z.string(),
1465
+ signature: import_zod7.z.string(),
1466
+ returns: import_zod7.z.string(),
1467
+ description: import_zod7.z.string().optional()
1363
1468
  });
1364
- InvariantSchema = import_zod6.z.object({
1469
+ InvariantSchema = import_zod7.z.object({
1365
1470
  /** Stable invariant id, unique within the entity (referenced as "<type-id>.<invariant-id>"). */
1366
1471
  id: SpecIdSchema,
1367
1472
  /** The property that must hold, stated precisely enough to test against. */
1368
- description: import_zod6.z.string().min(1)
1473
+ description: import_zod7.z.string().min(1)
1369
1474
  });
1370
- TypeSpecSchema = import_zod6.z.object({
1475
+ TypeSpecSchema = import_zod7.z.object({
1371
1476
  kind: TypeKindSchema,
1372
1477
  // discriminator — entity | value-object
1373
1478
  id: SpecIdSchema,
1374
- name: import_zod6.z.string(),
1375
- description: import_zod6.z.string().optional(),
1479
+ name: import_zod7.z.string(),
1480
+ description: import_zod7.z.string().optional(),
1376
1481
  /** Owning subsystem id (entities). Omit for system-level shared value objects. */
1377
- subsystem: import_zod6.z.string().optional(),
1482
+ subsystem: import_zod7.z.string().optional(),
1378
1483
  /** Optional logical group ID to organize this type in subfolders. */
1379
- group: import_zod6.z.string().optional(),
1380
- fields: import_zod6.z.array(TypeFieldSchema).default([]),
1484
+ group: import_zod7.z.string().optional(),
1485
+ fields: import_zod7.z.array(TypeFieldSchema).default([]),
1381
1486
  /** Pure intrinsic behaviour only — anything needing a collaborator belongs on a component. */
1382
- methods: import_zod6.z.array(TypeMethodSchema).default([]),
1487
+ methods: import_zod7.z.array(TypeMethodSchema).default([]),
1383
1488
  /**
1384
1489
  * Linked Component ID if this system entity is implemented as a class Component
1385
1490
  * (e.g., a Store or Registry that owns this entity's lifecycle and methods).
1386
1491
  */
1387
- componentClass: import_zod6.z.string().optional(),
1492
+ componentClass: import_zod7.z.string().optional(),
1388
1493
  /**
1389
1494
  * Declared domain invariants on this entity (see InvariantSchema). Anchored
1390
1495
  * through componentClass: its write-effect contract methods must each carry
1391
1496
  * a narrative step asserting every declared invariant.
1392
1497
  */
1393
- invariants: import_zod6.z.array(InvariantSchema).optional(),
1498
+ invariants: import_zod7.z.array(InvariantSchema).optional(),
1394
1499
  /**
1395
1500
  * The database ID this schema belongs to (marks it as a database table schema).
1396
1501
  */
1397
- database: import_zod6.z.string().optional(),
1502
+ database: import_zod7.z.string().optional(),
1398
1503
  /**
1399
1504
  * The database table name for this schema (e.g., "users").
1400
1505
  */
1401
- table: import_zod6.z.string().optional(),
1506
+ table: import_zod7.z.string().optional(),
1402
1507
  /**
1403
1508
  * If this type is a database table schema, the ID of the corresponding
1404
1509
  * logical system entity type it maps to.
1405
1510
  */
1406
- linkedEntity: import_zod6.z.string().optional(),
1511
+ linkedEntity: import_zod7.z.string().optional(),
1407
1512
  /** Per-spec lint suppressions (see LintConfigSchema). */
1408
1513
  lint: LintConfigSchema.optional(),
1409
1514
  /** Opaque pack/tool extension data (see ExtDataSchema) — preserved verbatim. */
1410
1515
  ext: ExtDataSchema.optional(),
1411
- createdAt: import_zod6.z.string().datetime(),
1412
- updatedAt: import_zod6.z.string().datetime()
1516
+ createdAt: import_zod7.z.string().datetime(),
1517
+ updatedAt: import_zod7.z.string().datetime()
1413
1518
  });
1414
- SurfaceOriginSchema = import_zod6.z.enum(["generated", "exchanged", "authored"]);
1415
- SurfaceTypeDefSchema = import_zod6.z.object({
1416
- id: import_zod6.z.string(),
1417
- name: import_zod6.z.string(),
1418
- kind: import_zod6.z.string().default("value-object"),
1419
- fields: import_zod6.z.array(import_zod6.z.object({
1420
- name: import_zod6.z.string(),
1421
- type: import_zod6.z.string(),
1422
- description: import_zod6.z.string().optional(),
1423
- optional: import_zod6.z.boolean().optional()
1519
+ SurfaceOriginSchema = import_zod7.z.enum(["generated", "exchanged", "authored"]);
1520
+ SurfaceTypeDefSchema = import_zod7.z.object({
1521
+ id: import_zod7.z.string(),
1522
+ name: import_zod7.z.string(),
1523
+ kind: import_zod7.z.string().default("value-object"),
1524
+ fields: import_zod7.z.array(import_zod7.z.object({
1525
+ name: import_zod7.z.string(),
1526
+ type: import_zod7.z.string(),
1527
+ description: import_zod7.z.string().optional(),
1528
+ optional: import_zod7.z.boolean().optional()
1424
1529
  })).default([])
1425
1530
  });
1426
- SurfaceContractEntrySchema = import_zod6.z.object({
1427
- id: import_zod6.z.string(),
1428
- name: import_zod6.z.string(),
1531
+ SurfaceContractEntrySchema = import_zod7.z.object({
1532
+ id: import_zod7.z.string(),
1533
+ name: import_zod7.z.string(),
1429
1534
  /** Exposure level of the L0 entry (see SurfaceAudienceSchema). */
1430
- audience: import_zod6.z.string().default("instance"),
1535
+ audience: import_zod7.z.string().default("instance"),
1431
1536
  /** Transport kind: REST, GraphQL, MessageBus, RPC, or Custom. */
1432
- type: import_zod6.z.string().default("Custom"),
1537
+ type: import_zod7.z.string().default("Custom"),
1433
1538
  /** Local name of the backing Portal in the producing project. */
1434
- component: import_zod6.z.string(),
1539
+ component: import_zod7.z.string(),
1435
1540
  /** Full contract methods (params, returns, guarantees, effect, endpoint). */
1436
- methods: import_zod6.z.array(MethodSignatureSchema).default([]),
1541
+ methods: import_zod7.z.array(MethodSignatureSchema).default([]),
1437
1542
  /** The backing portal's capability dispatch table, when generic-dispatch. */
1438
- dispatch: import_zod6.z.array(DispatchBindingSchema).optional(),
1439
- details: import_zod6.z.string().default(""),
1440
- version: import_zod6.z.string().optional(),
1441
- stability: import_zod6.z.string().optional(),
1543
+ dispatch: import_zod7.z.array(DispatchBindingSchema).optional(),
1544
+ details: import_zod7.z.string().default(""),
1545
+ version: import_zod7.z.string().optional(),
1546
+ stability: import_zod7.z.string().optional(),
1442
1547
  /** Projected copy of the backing Portal's auth (see PortalAuthSchema) — the codec
1443
1548
  * emits it as OpenAPI securitySchemes/security. */
1444
1549
  auth: PortalAuthSchema.optional(),
1445
1550
  /** The backing Portal's basePath — becomes the per-portal OpenAPI `servers` url. */
1446
- basePath: import_zod6.z.string().optional()
1551
+ basePath: import_zod7.z.string().optional()
1447
1552
  });
1448
- SurfaceSnapshotSchema = import_zod6.z.object({
1553
+ SurfaceSnapshotSchema = import_zod7.z.object({
1449
1554
  /** Producing project/system name — the snapshot's resolution identity. */
1450
- projectName: import_zod6.z.string(),
1555
+ projectName: import_zod7.z.string(),
1451
1556
  origin: SurfaceOriginSchema,
1452
1557
  /** Producing spec tree's StateId at generation time (wairon-produced snapshots). */
1453
- stateId: import_zod6.z.string().optional(),
1558
+ stateId: import_zod7.z.string().optional(),
1454
1559
  /** Contract version for authored/3rd-party surfaces without a StateId. */
1455
- version: import_zod6.z.string().optional(),
1456
- generatedAt: import_zod6.z.string(),
1457
- interfaces: import_zod6.z.array(SurfaceContractEntrySchema).default([]),
1560
+ version: import_zod7.z.string().optional(),
1561
+ generatedAt: import_zod7.z.string(),
1562
+ interfaces: import_zod7.z.array(SurfaceContractEntrySchema).default([]),
1458
1563
  /** Transitive type closure of every exported signature — self-contained. */
1459
- types: import_zod6.z.array(SurfaceTypeDefSchema).default([])
1564
+ types: import_zod7.z.array(SurfaceTypeDefSchema).default([])
1460
1565
  });
1461
- NamedOpenApiSpecSchema = import_zod6.z.object({
1462
- portalId: import_zod6.z.string(),
1463
- name: import_zod6.z.string(),
1464
- document: import_zod6.z.string()
1566
+ NamedOpenApiSpecSchema = import_zod7.z.object({
1567
+ portalId: import_zod7.z.string(),
1568
+ name: import_zod7.z.string(),
1569
+ document: import_zod7.z.string()
1465
1570
  });
1466
- GroupSpecSchema = import_zod6.z.object({
1467
- kind: import_zod6.z.literal("group"),
1571
+ GroupSpecSchema = import_zod7.z.object({
1572
+ kind: import_zod7.z.literal("group"),
1468
1573
  id: SpecIdSchema,
1469
- name: import_zod6.z.string(),
1470
- description: import_zod6.z.string().optional(),
1471
- createdAt: import_zod6.z.string().datetime(),
1472
- updatedAt: import_zod6.z.string().datetime()
1574
+ name: import_zod7.z.string(),
1575
+ description: import_zod7.z.string().optional(),
1576
+ createdAt: import_zod7.z.string().datetime(),
1577
+ updatedAt: import_zod7.z.string().datetime()
1473
1578
  });
1474
1579
  }
1475
1580
  });
@@ -1535,6 +1640,162 @@ var init_templates = __esm({
1535
1640
  }
1536
1641
  });
1537
1642
 
1643
+ // src/core/execution_profile.ts
1644
+ function isSweeping(p) {
1645
+ return p === "**" || p === "**/*" || p.startsWith("**/");
1646
+ }
1647
+ function deriveBreadth(agent) {
1648
+ if (agent.readPaths.some(isSweeping)) {
1649
+ return MANAGER_TEMPLATES.has(agent.template) || READ_ONLY_TEMPLATES.has(agent.template) ? "wide" : "moderate";
1650
+ }
1651
+ const owned = agent.ownedPaths.length;
1652
+ if (owned >= WIDE_PATH_COUNT) return "wide";
1653
+ if (owned >= MODERATE_PATH_COUNT) return "moderate";
1654
+ return "narrow";
1655
+ }
1656
+ function deriveReasoningDepth(agent) {
1657
+ for (const tag of agent.tags) {
1658
+ if (DEEP_STEREOTYPES.has(tag)) return "deep";
1659
+ if (MECHANICAL_STEREOTYPES.has(tag)) return "mechanical";
1660
+ }
1661
+ if (MANAGER_TEMPLATES.has(agent.template)) return "deep";
1662
+ if (agent.template === "reviewer") return "deep";
1663
+ if (agent.template === "tester") return "standard";
1664
+ return "standard";
1665
+ }
1666
+ function deriveWrites(agent) {
1667
+ return !READ_ONLY_TEMPLATES.has(agent.template);
1668
+ }
1669
+ function deriveExecutionProfile(agent) {
1670
+ const breadth = deriveBreadth(agent);
1671
+ const reasoningDepth = deriveReasoningDepth(agent);
1672
+ const writes = deriveWrites(agent);
1673
+ const delegates = MANAGER_TEMPLATES.has(agent.template);
1674
+ const because = [];
1675
+ if (delegates) {
1676
+ because.push(`${agent.template} routes work rather than performing it`);
1677
+ }
1678
+ const stereotype = agent.tags.find(
1679
+ (t) => MECHANICAL_STEREOTYPES.has(t) || DEEP_STEREOTYPES.has(t)
1680
+ );
1681
+ if (stereotype) {
1682
+ because.push(
1683
+ MECHANICAL_STEREOTYPES.has(stereotype) ? `${stereotype} work is specified by its contract and narrative` : `${stereotype} carries decision logic`
1684
+ );
1685
+ }
1686
+ because.push(
1687
+ breadth === "wide" ? "reads broadly across the tree" : breadth === "moderate" ? `spans ${agent.ownedPaths.length} owned path(s)` : "scoped to a small owned set"
1688
+ );
1689
+ if (!writes) because.push("read-only");
1690
+ return {
1691
+ breadth,
1692
+ writes,
1693
+ reasoningDepth,
1694
+ delegates,
1695
+ rationale: because.join("; ")
1696
+ };
1697
+ }
1698
+ var MECHANICAL_STEREOTYPES, DEEP_STEREOTYPES, MANAGER_TEMPLATES, READ_ONLY_TEMPLATES, WIDE_PATH_COUNT, MODERATE_PATH_COUNT;
1699
+ var init_execution_profile = __esm({
1700
+ "src/core/execution_profile.ts"() {
1701
+ "use strict";
1702
+ MECHANICAL_STEREOTYPES = /* @__PURE__ */ new Set(["store", "index", "registry", "adapter"]);
1703
+ DEEP_STEREOTYPES = /* @__PURE__ */ new Set(["orchestrator", "supervisor", "specialist"]);
1704
+ MANAGER_TEMPLATES = /* @__PURE__ */ new Set(["architect", "domain-owner"]);
1705
+ READ_ONLY_TEMPLATES = /* @__PURE__ */ new Set(["reviewer", "guardian"]);
1706
+ WIDE_PATH_COUNT = 12;
1707
+ MODERATE_PATH_COUNT = 4;
1708
+ }
1709
+ });
1710
+
1711
+ // src/core/budget_policy.ts
1712
+ function atLeast(tier, floor) {
1713
+ return TIER_ORDER.indexOf(tier) >= TIER_ORDER.indexOf(floor);
1714
+ }
1715
+ function baseModelTier(profile) {
1716
+ switch (profile.reasoningDepth) {
1717
+ case "mechanical":
1718
+ return "small";
1719
+ case "standard":
1720
+ return "standard";
1721
+ case "deep":
1722
+ return "large";
1723
+ }
1724
+ }
1725
+ function stepDown(tier, steps) {
1726
+ const i = TIER_STEPS.indexOf(tier);
1727
+ return TIER_STEPS[Math.max(0, i - steps)];
1728
+ }
1729
+ function maxTurnsFor(profile, tier) {
1730
+ if (!atLeast(tier, "default")) return void 0;
1731
+ const ceiling = profile.breadth === "wide" ? 60 : profile.breadth === "moderate" ? 40 : 25;
1732
+ return atLeast(tier, "aggressive") ? Math.round(ceiling / 2) : ceiling;
1733
+ }
1734
+ function effortFor(profile, tier) {
1735
+ if (!atLeast(tier, "trade")) return void 0;
1736
+ if (profile.reasoningDepth === "mechanical") {
1737
+ return atLeast(tier, "aggressive") ? "low" : "medium";
1738
+ }
1739
+ return void 0;
1740
+ }
1741
+ function toolClassFor(profile) {
1742
+ return profile.writes ? "implement" : "read-only";
1743
+ }
1744
+ function mcpFor(profile, tier) {
1745
+ if (!atLeast(tier, "free")) return "all";
1746
+ if (profile.delegates) return "project";
1747
+ return profile.breadth === "wide" ? "project" : "none";
1748
+ }
1749
+ function resolveBudget(profile, config, agentId) {
1750
+ const tier = config.tier;
1751
+ if (tier === "off") return void 0;
1752
+ let modelTier = baseModelTier(profile);
1753
+ if (atLeast(tier, "trade") && profile.reasoningDepth === "standard") {
1754
+ modelTier = stepDown(modelTier, 1);
1755
+ }
1756
+ if (atLeast(tier, "aggressive") && profile.reasoningDepth !== "deep") {
1757
+ modelTier = "small";
1758
+ }
1759
+ const budget = {
1760
+ // At `free` no model selection is expressed at all — that tier is defined
1761
+ // as having no quality tradeoff, and choosing a model is a quality
1762
+ // decision. Leaving it absent is not the same as choosing a default.
1763
+ modelTier: atLeast(tier, "default") ? modelTier : void 0,
1764
+ effort: effortFor(profile, tier),
1765
+ maxTurns: maxTurnsFor(profile, tier),
1766
+ toolClass: toolClassFor(profile),
1767
+ // Only managers may spawn. Withholding the tool from workers is what stops
1768
+ // a worker quietly becoming a second orchestrator three levels down.
1769
+ allowNestedDelegation: profile.delegates,
1770
+ mcp: mcpFor(profile, tier)
1771
+ };
1772
+ const override = config.overrides[agentId];
1773
+ return override ? { ...budget, ...override } : budget;
1774
+ }
1775
+ function describeBudget(profile, budget) {
1776
+ const lines = [
1777
+ `- **Work shape**: ${profile.breadth} breadth, ${profile.reasoningDepth} reasoning${profile.writes ? "" : ", read-only"}${profile.delegates ? ", delegating" : ""}`,
1778
+ `- **Why**: ${profile.rationale}`
1779
+ ];
1780
+ if (budget.modelTier) lines.push(`- **Capability tier**: ${budget.modelTier}`);
1781
+ if (budget.effort) lines.push(`- **Effort**: ${budget.effort}`);
1782
+ if (budget.maxTurns !== void 0) {
1783
+ lines.push(`- **Turn ceiling**: ${budget.maxTurns} (a circuit breaker \u2014 hitting it should read as a scoping error, not a limit to work up to)`);
1784
+ }
1785
+ lines.push(`- **Tool grant**: ${budget.toolClass}`);
1786
+ lines.push(`- **May delegate further**: ${budget.allowNestedDelegation ? "yes" : "no"}`);
1787
+ lines.push(`- **MCP access**: ${budget.mcp}`);
1788
+ return lines;
1789
+ }
1790
+ var TIER_ORDER, TIER_STEPS;
1791
+ var init_budget_policy = __esm({
1792
+ "src/core/budget_policy.ts"() {
1793
+ "use strict";
1794
+ TIER_ORDER = ["off", "free", "default", "trade", "aggressive"];
1795
+ TIER_STEPS = ["small", "standard", "large", "frontier"];
1796
+ }
1797
+ });
1798
+
1538
1799
  // src/core/variants.ts
1539
1800
  function globalVariantsDir() {
1540
1801
  return process.env.WAIRON_VARIANTS_DIR ?? path6.join(os3.homedir(), ".wairon", "variants");
@@ -1602,27 +1863,27 @@ function loadProjectVariants() {
1602
1863
  return [];
1603
1864
  }
1604
1865
  }
1605
- var fs4, os3, path6, import_zod7, VariantDefSchema;
1866
+ var fs4, os3, path6, import_zod8, VariantDefSchema;
1606
1867
  var init_variants = __esm({
1607
1868
  "src/core/variants.ts"() {
1608
1869
  "use strict";
1609
1870
  fs4 = __toESM(require("fs"));
1610
1871
  os3 = __toESM(require("os"));
1611
1872
  path6 = __toESM(require("path"));
1612
- import_zod7 = require("zod");
1873
+ import_zod8 = require("zod");
1613
1874
  init_yaml();
1614
1875
  init_fs();
1615
- VariantDefSchema = import_zod7.z.object({
1876
+ VariantDefSchema = import_zod8.z.object({
1616
1877
  /** Variant id referenced by a component's `variant` (e.g. "publisher", "org/external-config-adapter"). */
1617
- id: import_zod7.z.string().min(1),
1878
+ id: import_zod8.z.string().min(1),
1618
1879
  /** The core stereotype this variant specializes — authoritative for generic semantics (Adapter, Specialist, …). */
1619
- base: import_zod7.z.string().min(1),
1880
+ base: import_zod8.z.string().min(1),
1620
1881
  /** How to implement a component of this variant — the recipe the implementer follows and reuses across same-variant components. */
1621
- guidance: import_zod7.z.string().min(1),
1882
+ guidance: import_zod8.z.string().min(1),
1622
1883
  /** Optional: this variant only applies for the given target language (else it applies everywhere). */
1623
- target: import_zod7.z.string().optional(),
1884
+ target: import_zod8.z.string().optional(),
1624
1885
  /** Optional: this variant only applies under the given architectural profile. */
1625
- profile: import_zod7.z.string().optional()
1886
+ profile: import_zod8.z.string().optional()
1626
1887
  });
1627
1888
  }
1628
1889
  });
@@ -1977,6 +2238,9 @@ function composeAgentBrief(agentId) {
1977
2238
  ${guidance.trim()}
1978
2239
  `;
1979
2240
  }
2241
+ const config = loadProjectConfig();
2242
+ const profile = deriveExecutionProfile(record2);
2243
+ const budget = resolveBudget(profile, config.execution, record2.id);
1980
2244
  return {
1981
2245
  agentId: record2.id,
1982
2246
  name: record2.name,
@@ -1985,7 +2249,9 @@ ${guidance.trim()}
1985
2249
  ownedPaths: record2.ownedPaths,
1986
2250
  readPaths: record2.readPaths,
1987
2251
  instructions,
1988
- variantGuidance: record2.variantGuidance || void 0
2252
+ variantGuidance: record2.variantGuidance || void 0,
2253
+ profile: budget ? profile : void 0,
2254
+ budget
1989
2255
  };
1990
2256
  }
1991
2257
  var path7, fs5, projectFilesCache, UnknownAgentError;
@@ -1998,6 +2264,8 @@ var init_agent_resolver = __esm({
1998
2264
  init_fs();
1999
2265
  init_errors();
2000
2266
  init_templates();
2267
+ init_execution_profile();
2268
+ init_budget_policy();
2001
2269
  init_specs2();
2002
2270
  init_variants();
2003
2271
  projectFilesCache = /* @__PURE__ */ new Map();
@@ -2681,7 +2949,7 @@ function findBundledPack(projectRoot2, selection) {
2681
2949
  }
2682
2950
  return best?.dir ?? null;
2683
2951
  }
2684
- var fs8, os4, path10, import_module, import_zod8, ProfileDefSchema, LanguagePackDefSchema, PackSkillSchema, PackInstructionBlockSchema, PackInstructionsSchema, PatternDefSchema, AssertionSelectorSchema, assertionBase, PackAssertionSchema, DeclarativePackSchema, EXTENDABLE_BUILTIN_SKILLS, GLOBAL_PACKS_DEFAULT, PACK_DIR_ENTRIES, isYamlPath;
2952
+ var fs8, os4, path10, import_module, import_zod9, ProfileDefSchema, LanguagePackDefSchema, PackSkillSchema, PackInstructionBlockSchema, PackInstructionsSchema, PatternDefSchema, AssertionSelectorSchema, assertionBase, PackAssertionSchema, DeclarativePackSchema, EXTENDABLE_BUILTIN_SKILLS, GLOBAL_PACKS_DEFAULT, PACK_DIR_ENTRIES, isYamlPath;
2685
2953
  var init_extensions = __esm({
2686
2954
  "src/core/extensions.ts"() {
2687
2955
  "use strict";
@@ -2689,17 +2957,17 @@ var init_extensions = __esm({
2689
2957
  os4 = __toESM(require("os"));
2690
2958
  path10 = __toESM(require("path"));
2691
2959
  import_module = require("module");
2692
- import_zod8 = require("zod");
2960
+ import_zod9 = require("zod");
2693
2961
  init_yaml();
2694
2962
  init_fs();
2695
2963
  init_loader();
2696
2964
  init_version();
2697
2965
  init_project();
2698
2966
  init_packstore();
2699
- ProfileDefSchema = import_zod8.z.object({
2700
- family: import_zod8.z.enum(["backend-like", "frontend-like", "neutral"]).default("neutral"),
2701
- 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([]),
2702
- 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([]),
2967
+ ProfileDefSchema = import_zod9.z.object({
2968
+ family: import_zod9.z.enum(["backend-like", "frontend-like", "neutral"]).default("neutral"),
2969
+ forbiddenStereotypes: import_zod9.z.array(import_zod9.z.object({ types: import_zod9.z.array(import_zod9.z.string()).min(1), reason: import_zod9.z.string().min(1) })).default([]),
2970
+ discouragedStereotypes: import_zod9.z.array(import_zod9.z.object({ types: import_zod9.z.array(import_zod9.z.string()).min(1), reason: import_zod9.z.string().min(1) })).default([]),
2703
2971
  /**
2704
2972
  * Edge deltas — the ALLOW half of the profile-scoped dependency matrix. An
2705
2973
  * entry LICENSES intra-subsystem dependsOn edges the builtin stereotype
@@ -2709,20 +2977,20 @@ var init_extensions = __esm({
2709
2977
  * boundary rules and pattern containment are never relaxable. The DENY
2710
2978
  * half is a `forbid-edge` declarative assertion.
2711
2979
  */
2712
- allowedEdges: import_zod8.z.array(import_zod8.z.object({
2713
- from: import_zod8.z.array(import_zod8.z.string().min(1)).min(1),
2714
- to: import_zod8.z.array(import_zod8.z.string().min(1)).min(1),
2715
- reason: import_zod8.z.string().min(1)
2980
+ allowedEdges: import_zod9.z.array(import_zod9.z.object({
2981
+ from: import_zod9.z.array(import_zod9.z.string().min(1)).min(1),
2982
+ to: import_zod9.z.array(import_zod9.z.string().min(1)).min(1),
2983
+ reason: import_zod9.z.string().min(1)
2716
2984
  })).default([]),
2717
2985
  rules: RulesConfigSchema.partial().optional()
2718
2986
  });
2719
- LanguagePackDefSchema = import_zod8.z.object({
2720
- unsupportedFlow: import_zod8.z.record(import_zod8.z.string()).default({}),
2721
- foreignBuiltins: import_zod8.z.array(import_zod8.z.string()).default([])
2987
+ LanguagePackDefSchema = import_zod9.z.object({
2988
+ unsupportedFlow: import_zod9.z.record(import_zod9.z.string()).default({}),
2989
+ foreignBuiltins: import_zod9.z.array(import_zod9.z.string()).default([])
2722
2990
  });
2723
- PackSkillSchema = import_zod8.z.object({
2991
+ PackSkillSchema = import_zod9.z.object({
2724
2992
  /** A NEW skill, installed namespaced as `<pack-id>-<id>`. Mutually exclusive with `extends`. */
2725
- id: import_zod8.z.string().min(1).optional(),
2993
+ id: import_zod9.z.string().min(1).optional(),
2726
2994
  /**
2727
2995
  * EXTEND a builtin skill (`sdd-architect` | `sdd-narrative` | `sdd-auditor` |
2728
2996
  * `sdd-implement`) instead of standing beside it.
@@ -2734,86 +3002,86 @@ var init_extensions = __esm({
2734
3002
  * appended under `## Platform: <pack>`; the builtin stays wairon's, so an
2735
3003
  * upgrade still updates it.
2736
3004
  */
2737
- extends: import_zod8.z.string().min(1).optional(),
2738
- source: import_zod8.z.string().min(1),
2739
- targets: import_zod8.z.array(import_zod8.z.string()).default([])
3005
+ extends: import_zod9.z.string().min(1).optional(),
3006
+ source: import_zod9.z.string().min(1),
3007
+ targets: import_zod9.z.array(import_zod9.z.string()).default([])
2740
3008
  }).refine((s) => s.id === void 0 !== (s.extends === void 0), {
2741
3009
  message: "a pack skill declares either `id` (a new skill) or `extends` (a section appended to a builtin), not both and not neither"
2742
3010
  });
2743
- PackInstructionBlockSchema = import_zod8.z.union([
3011
+ PackInstructionBlockSchema = import_zod9.z.union([
2744
3012
  // Scalar shorthand: `instructions: >- …` — the common case, unscoped.
2745
- import_zod8.z.string().min(1).transform((text2) => ({ text: text2 })),
2746
- import_zod8.z.object({
2747
- text: import_zod8.z.string().min(1),
2748
- profile: import_zod8.z.array(import_zod8.z.string().min(1)).min(1).optional()
3013
+ import_zod9.z.string().min(1).transform((text2) => ({ text: text2 })),
3014
+ import_zod9.z.object({
3015
+ text: import_zod9.z.string().min(1),
3016
+ profile: import_zod9.z.array(import_zod9.z.string().min(1)).min(1).optional()
2749
3017
  })
2750
3018
  ]);
2751
- PackInstructionsSchema = import_zod8.z.preprocess(
3019
+ PackInstructionsSchema = import_zod9.z.preprocess(
2752
3020
  (raw) => raw === void 0 || raw === null ? [] : Array.isArray(raw) ? raw : [raw],
2753
- import_zod8.z.array(PackInstructionBlockSchema)
3021
+ import_zod9.z.array(PackInstructionBlockSchema)
2754
3022
  );
2755
- PatternDefSchema = import_zod8.z.object({
2756
- id: import_zod8.z.string().min(1),
2757
- version: import_zod8.z.string().min(1),
2758
- description: import_zod8.z.string().optional(),
2759
- metadata: import_zod8.z.record(import_zod8.z.unknown()).optional()
3023
+ PatternDefSchema = import_zod9.z.object({
3024
+ id: import_zod9.z.string().min(1),
3025
+ version: import_zod9.z.string().min(1),
3026
+ description: import_zod9.z.string().optional(),
3027
+ metadata: import_zod9.z.record(import_zod9.z.unknown()).optional()
2760
3028
  });
2761
- AssertionSelectorSchema = import_zod8.z.object({
2762
- componentType: import_zod8.z.array(import_zod8.z.string().min(1)).optional(),
2763
- profile: import_zod8.z.array(import_zod8.z.string().min(1)).optional(),
2764
- id: import_zod8.z.string().min(1).optional()
3029
+ AssertionSelectorSchema = import_zod9.z.object({
3030
+ componentType: import_zod9.z.array(import_zod9.z.string().min(1)).optional(),
3031
+ profile: import_zod9.z.array(import_zod9.z.string().min(1)).optional(),
3032
+ id: import_zod9.z.string().min(1).optional()
2765
3033
  });
2766
3034
  assertionBase = {
2767
3035
  /** Pack-local code; surfaced namespaced as <PACK_NAME>_<CODE>. */
2768
- code: import_zod8.z.string().min(1),
2769
- severity: import_zod8.z.enum(["warning", "error"]).default("warning"),
3036
+ code: import_zod9.z.string().min(1),
3037
+ severity: import_zod9.z.enum(["warning", "error"]).default("warning"),
2770
3038
  /** The doctrine, stated for the finding message. */
2771
- reason: import_zod8.z.string().min(1)
3039
+ reason: import_zod9.z.string().min(1)
2772
3040
  };
2773
- PackAssertionSchema = import_zod8.z.discriminatedUnion("kind", [
2774
- import_zod8.z.object({
2775
- kind: import_zod8.z.literal("forbid-edge"),
3041
+ PackAssertionSchema = import_zod9.z.discriminatedUnion("kind", [
3042
+ import_zod9.z.object({
3043
+ kind: import_zod9.z.literal("forbid-edge"),
2776
3044
  ...assertionBase,
2777
3045
  from: AssertionSelectorSchema,
2778
3046
  to: AssertionSelectorSchema,
2779
- relation: import_zod8.z.array(import_zod8.z.enum(["dependsOn", "owns"])).default(["dependsOn", "owns"])
3047
+ relation: import_zod9.z.array(import_zod9.z.enum(["dependsOn", "owns"])).default(["dependsOn", "owns"])
2780
3048
  }),
2781
- import_zod8.z.object({
2782
- kind: import_zod8.z.literal("require-field"),
3049
+ import_zod9.z.object({
3050
+ kind: import_zod9.z.literal("require-field"),
2783
3051
  ...assertionBase,
2784
3052
  on: AssertionSelectorSchema,
2785
- level: import_zod8.z.enum(["component", "interface", "implementation"]).default("component"),
3053
+ level: import_zod9.z.enum(["component", "interface", "implementation"]).default("component"),
2786
3054
  /** A top-level spec field name, or one `ext.*` path — nothing else is addressable. */
2787
- field: import_zod8.z.string().min(1),
3055
+ field: import_zod9.z.string().min(1),
2788
3056
  /** Optional closed value set (string equality). */
2789
- values: import_zod8.z.array(import_zod8.z.string()).optional()
3057
+ values: import_zod9.z.array(import_zod9.z.string()).optional()
2790
3058
  }),
2791
- import_zod8.z.object({
2792
- kind: import_zod8.z.literal("endpoint-shape"),
3059
+ import_zod9.z.object({
3060
+ kind: import_zod9.z.literal("endpoint-shape"),
2793
3061
  ...assertionBase,
2794
3062
  on: AssertionSelectorSchema,
2795
3063
  /** Optional transport allowlist. */
2796
- transport: import_zod8.z.array(import_zod8.z.string().min(1)).optional(),
3064
+ transport: import_zod9.z.array(import_zod9.z.string().min(1)).optional(),
2797
3065
  /** Optional anchored regex over the transport's address field (path/topic/command/…). */
2798
- pathPattern: import_zod8.z.string().min(1).optional()
3066
+ pathPattern: import_zod9.z.string().min(1).optional()
2799
3067
  })
2800
3068
  ]);
2801
- DeclarativePackSchema = import_zod8.z.object({
2802
- name: import_zod8.z.string().min(1),
2803
- version: import_zod8.z.string().optional(),
2804
- profiles: import_zod8.z.record(ProfileDefSchema).default({}),
2805
- languages: import_zod8.z.record(LanguagePackDefSchema).default({}),
2806
- skills: import_zod8.z.array(PackSkillSchema).default([]),
2807
- patterns: import_zod8.z.array(PatternDefSchema).default([]),
3069
+ DeclarativePackSchema = import_zod9.z.object({
3070
+ name: import_zod9.z.string().min(1),
3071
+ version: import_zod9.z.string().optional(),
3072
+ profiles: import_zod9.z.record(ProfileDefSchema).default({}),
3073
+ languages: import_zod9.z.record(LanguagePackDefSchema).default({}),
3074
+ skills: import_zod9.z.array(PackSkillSchema).default([]),
3075
+ patterns: import_zod9.z.array(PatternDefSchema).default([]),
2808
3076
  /** Declarative rule assertions — instances of closed kinds, hosted-safe. */
2809
- assertions: import_zod8.z.array(PackAssertionSchema).default([]),
3077
+ assertions: import_zod9.z.array(PackAssertionSchema).default([]),
2810
3078
  /**
2811
3079
  * Semantic guarantee tokens this pack adds to the builtin vocabulary
2812
3080
  * (SEMANTIC_GUARANTEES). Declaring a token makes it legal on L3 method
2813
3081
  * `guarantees` and narrative `assertsGuarantees`; referenced tokens outside
2814
3082
  * builtin + declared are flagged UNKNOWN_GUARANTEE by the validator.
2815
3083
  */
2816
- guarantees: import_zod8.z.array(import_zod8.z.string().min(1)).default([]),
3084
+ guarantees: import_zod9.z.array(import_zod9.z.string().min(1)).default([]),
2817
3085
  /**
2818
3086
  * Connecting-agent guidance appended to wairon's own MCP `initialize`
2819
3087
  * instructions, attributed to this pack, in pack load order.
@@ -2828,7 +3096,7 @@ var init_extensions = __esm({
2828
3096
  * explicit in the new project's `project.yaml` where it is visible in review
2829
3097
  * and removable — never silent authority over projects that never mentioned it.
2830
3098
  */
2831
- applyByDefault: import_zod8.z.boolean().default(false)
3099
+ applyByDefault: import_zod9.z.boolean().default(false)
2832
3100
  });
2833
3101
  EXTENDABLE_BUILTIN_SKILLS = ["sdd-architect", "sdd-narrative", "sdd-auditor", "sdd-implement", "sdd-delegate"];
2834
3102
  GLOBAL_PACKS_DEFAULT = false;
@@ -3804,12 +4072,25 @@ function getSnapshot(projectName, rootDir = getProjectRoot()) {
3804
4072
  function snapshotFilename(projectName) {
3805
4073
  return `${safeFilenamePart(projectName)}.yaml`;
3806
4074
  }
3807
- function saveSnapshot(snapshot, rootDir = getProjectRoot()) {
4075
+ function writeSnapshotIfChanged(snapshot, rootDir) {
3808
4076
  const dir = surfacesDir(rootDir);
3809
4077
  fs9.mkdirSync(dir, { recursive: true });
3810
4078
  const p = path11.join(dir, snapshotFilename(snapshot.projectName));
3811
- writeYamlFile(p, SurfaceSnapshotSchema.parse(snapshot));
3812
- return p;
4079
+ const next = SurfaceSnapshotSchema.parse(snapshot);
4080
+ if (fs9.existsSync(p)) {
4081
+ try {
4082
+ const existing = SurfaceSnapshotSchema.parse(readYamlFile(p));
4083
+ if (surfaceContentKey(existing) === surfaceContentKey(next)) {
4084
+ return { path: p, changed: false };
4085
+ }
4086
+ } catch {
4087
+ }
4088
+ }
4089
+ writeYamlFile(p, next);
4090
+ return { path: p, changed: true };
4091
+ }
4092
+ function saveSnapshot(snapshot, rootDir = getProjectRoot()) {
4093
+ return writeSnapshotIfChanged(snapshot, rootDir).path;
3813
4094
  }
3814
4095
  function loadSurfaceSnapshots() {
3815
4096
  return listSnapshots();
@@ -3894,13 +4175,16 @@ function generateChildSnapshots(rootDir = getProjectRoot()) {
3894
4175
  return snap;
3895
4176
  };
3896
4177
  const written = [];
4178
+ const record2 = (r) => {
4179
+ if (r.changed) written.push(r.path);
4180
+ };
3897
4181
  for (const child of children) {
3898
4182
  const childDir = path11.resolve(rootDir, child.projectPath);
3899
4183
  if (!fs9.existsSync(childDir)) continue;
3900
- written.push(saveSnapshot(familySnapshot, childDir));
4184
+ record2(writeSnapshotIfChanged(familySnapshot, childDir));
3901
4185
  for (const sibling of topLevel) {
3902
4186
  if (sibling.id === child.id) continue;
3903
- written.push(saveSnapshot(siblingSurface(sibling.id), childDir));
4187
+ record2(writeSnapshotIfChanged(siblingSurface(sibling.id), childDir));
3904
4188
  }
3905
4189
  }
3906
4190
  return written;
@@ -17217,6 +17501,27 @@ var init_specs2 = __esm({
17217
17501
  `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".`
17218
17502
  );
17219
17503
  }
17504
+ const deltaSchema = {
17505
+ system: SystemSpecSchema,
17506
+ subsystem: SubsystemSpecSchema,
17507
+ component: ComponentSpecSchema,
17508
+ interface: InterfaceSpecSchema,
17509
+ implementation: ImplementationSpecSchema,
17510
+ type: TypeSpecSchema
17511
+ }[kind];
17512
+ const knownKeys = new Set(Object.keys(deltaSchema.shape));
17513
+ knownKeys.add("unset");
17514
+ const unknownKeys = Object.keys(delta ?? {}).filter((k) => !knownKeys.has(k));
17515
+ if (unknownKeys.length > 0) {
17516
+ const near = (k) => {
17517
+ const norm = k.toLowerCase().replace(/[_\-\s]/g, "");
17518
+ const hit = [...knownKeys].find((v) => v.toLowerCase().replace(/[_\-\s]/g, "") === norm);
17519
+ return hit ? ` (did you mean "${hit}"?)` : "";
17520
+ };
17521
+ throw new Error(
17522
+ `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(", ")}.`
17523
+ );
17524
+ }
17220
17525
  const JUMP_FIELDS = ["onTrueStep", "onFalseStep", "defaultStep", "endStep", "finallyStep", "toStep"];
17221
17526
  const JUMP_LIST_FIELDS = ["cases", "catches", "branches"];
17222
17527
  const relocateJumps = (step, shiftFrom, deltaN, captureInsertTarget = false) => {
@@ -17636,6 +17941,7 @@ function defaultProjectConfig(name, now) {
17636
17941
  name,
17637
17942
  projectType: "backend",
17638
17943
  targets: [{ type: "claude", outputDir: ".claude/agents", enabled: true }],
17944
+ execution: { tier: "off", overrides: {} },
17639
17945
  rules: {
17640
17946
  noOverlappingOwnership: true,
17641
17947
  requireOwnedPaths: true,
@@ -20269,15 +20575,15 @@ var require_node = __commonJS({
20269
20575
  var slzh = function(d, b) {
20270
20576
  return b + 30 + b2(d, b + 26) + b2(d, b + 28);
20271
20577
  };
20272
- var zh = function(d, b, z10) {
20578
+ var zh = function(d, b, z11) {
20273
20579
  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;
20274
- 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];
20580
+ var _a2 = z64hs(d, es, efl, z11, b4(d, b + 20), b4(d, b + 24), b4(d, b + 42)), sc = _a2[0], su = _a2[1], off = _a2[2];
20275
20581
  return [b2(d, b + 10), sc, su, fn, es + efl + b2(d, b + 32), off];
20276
20582
  };
20277
- var z64hs = function(d, b, l, z10, sc, su, off) {
20583
+ var z64hs = function(d, b, l, z11, sc, su, off) {
20278
20584
  var nsc = sc == 4294967295, nsu = su == 4294967295, noff = off == 4294967295, e = b + l;
20279
20585
  var nf = nsc + nsu + noff;
20280
- if (z10 && nf) {
20586
+ if (z11 && nf) {
20281
20587
  for (; b + 4 < e; b += 4 + b2(d, b + 2)) {
20282
20588
  if (b2(d, b) == 1) {
20283
20589
  return [
@@ -20288,7 +20594,7 @@ var require_node = __commonJS({
20288
20594
  ];
20289
20595
  }
20290
20596
  }
20291
- if (z10 < 2)
20597
+ if (z11 < 2)
20292
20598
  err(13);
20293
20599
  }
20294
20600
  return [sc, su, off, 0];
@@ -20897,18 +21203,18 @@ var require_node = __commonJS({
20897
21203
  if (lft) {
20898
21204
  var c = lft;
20899
21205
  var o = b4(data, e + 16);
20900
- var z10 = b4(data, e - 20) == 117853008;
20901
- if (z10) {
21206
+ var z11 = b4(data, e - 20) == 117853008;
21207
+ if (z11) {
20902
21208
  var ze = b4(data, e - 12);
20903
- z10 = b4(data, ze) == 101075792;
20904
- if (z10) {
21209
+ z11 = b4(data, ze) == 101075792;
21210
+ if (z11) {
20905
21211
  c = lft = b4(data, ze + 32);
20906
21212
  o = b4(data, ze + 48);
20907
21213
  }
20908
21214
  }
20909
21215
  var fltr = opts && opts.filter;
20910
21216
  var _loop_3 = function(i3) {
20911
- 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);
21217
+ var _a2 = zh(data, o, z11), c_1 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
20912
21218
  o = no;
20913
21219
  var cbl = function(e2, d) {
20914
21220
  if (e2) {
@@ -20963,18 +21269,18 @@ var require_node = __commonJS({
20963
21269
  if (!c)
20964
21270
  return {};
20965
21271
  var o = b4(data, e + 16);
20966
- var z10 = b4(data, e - 20) == 117853008;
20967
- if (z10) {
21272
+ var z11 = b4(data, e - 20) == 117853008;
21273
+ if (z11) {
20968
21274
  var ze = b4(data, e - 12);
20969
- z10 = b4(data, ze) == 101075792;
20970
- if (z10) {
21275
+ z11 = b4(data, ze) == 101075792;
21276
+ if (z11) {
20971
21277
  c = b4(data, ze + 32);
20972
21278
  o = b4(data, ze + 48);
20973
21279
  }
20974
21280
  }
20975
21281
  var fltr = opts && opts.filter;
20976
21282
  for (var i2 = 0; i2 < c; ++i2) {
20977
- 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);
21283
+ var _a2 = zh(data, o, z11), c_2 = _a2[0], sc = _a2[1], su = _a2[2], fn = _a2[3], no = _a2[4], off = _a2[5], b = slzh(data, off);
20978
21284
  o = no;
20979
21285
  if (!fltr || fltr({
20980
21286
  name: fn,
@@ -22419,7 +22725,8 @@ function reg(server, name, config, cb) {
22419
22725
  if (result.isError !== true && SPEC_WRITE_TOOLS.has(name)) listChangedEmitters.get(server)?.();
22420
22726
  return result;
22421
22727
  };
22422
- server.registerTool(name, config, guarded);
22728
+ const strictConfig = config.inputSchema ? { ...config, inputSchema: import_zod10.z.object(config.inputSchema).strict() } : config;
22729
+ server.registerTool(name, strictConfig, guarded);
22423
22730
  }
22424
22731
  function isEmptyValue(value) {
22425
22732
  if (value === void 0 || value === null) return true;
@@ -22522,6 +22829,16 @@ function renderAgentBriefMarkdown(brief) {
22522
22829
  if (brief.variantGuidance && !brief.instructions.includes(brief.variantGuidance)) {
22523
22830
  lines.push("", "## Variant guidance", "", brief.variantGuidance);
22524
22831
  }
22832
+ if (brief.budget && brief.profile) {
22833
+ lines.push(
22834
+ "",
22835
+ "## Execution budget",
22836
+ "",
22837
+ ...describeBudget(brief.profile, brief.budget),
22838
+ "",
22839
+ "Advisory \u2014 apply these when spawning. Map the capability tier onto your host tool's models; a tool that cannot express a field should ignore it rather than approximate it."
22840
+ );
22841
+ }
22525
22842
  return `${lines.join("\n")}
22526
22843
  `;
22527
22844
  }
@@ -22602,7 +22919,7 @@ function createMcpServer(options = {}) {
22602
22919
  "listAgents",
22603
22920
  {
22604
22921
  description: "List all AI agents registered in this project. Returns id, name, description, domainRoot, template, tags, and status for each agent. Filter by domainId to scope to one domain.",
22605
- inputSchema: { domainId: import_zod9.z.string().optional() }
22922
+ inputSchema: { domainId: import_zod10.z.string().optional() }
22606
22923
  },
22607
22924
  ({ domainId }) => {
22608
22925
  try {
@@ -22628,7 +22945,7 @@ function createMcpServer(options = {}) {
22628
22945
  "getAgent",
22629
22946
  {
22630
22947
  description: "Get full details of a specific agent by id, including ownership rules, context, and output targets.",
22631
- inputSchema: { id: import_zod9.z.string() }
22948
+ inputSchema: { id: import_zod10.z.string() }
22632
22949
  },
22633
22950
  ({ id }) => {
22634
22951
  try {
@@ -22662,7 +22979,7 @@ function createMcpServer(options = {}) {
22662
22979
  {
22663
22980
  description: "Validate the project's agent topology. Returns errors and warnings (duplicate ids, overlapping ownership, missing paths, etc.). Supports optional subsystem scoping.",
22664
22981
  inputSchema: {
22665
- subsystem: import_zod9.z.string().optional().describe("Only validate topology for agents under the specified subsystem")
22982
+ subsystem: import_zod10.z.string().optional().describe("Only validate topology for agents under the specified subsystem")
22666
22983
  }
22667
22984
  },
22668
22985
  ({ subsystem }) => {
@@ -22704,11 +23021,11 @@ function createMcpServer(options = {}) {
22704
23021
  }
22705
23022
  );
22706
23023
  const systemInput = {
22707
- name: import_zod9.z.string().describe("Overarching name of the project/system"),
22708
- vision: import_zod9.z.string().describe("Vision, mission, and core goals of the system"),
22709
- boundaries: import_zod9.z.array(import_zod9.z.union([import_zod9.z.string(), import_zod9.z.object({ name: import_zod9.z.string(), description: import_zod9.z.string().optional() })])).optional().describe("System boundary rules or scope statements (strings or name/description objects)"),
22710
- globalRequirements: import_zod9.z.array(import_zod9.z.union([import_zod9.z.string(), import_zod9.z.object({ description: import_zod9.z.string() })])).optional().describe("Global functional and non-functional requirements (strings or description objects)"),
22711
- targetLanguage: import_zod9.z.string().optional().describe('Default implementation language for the system (e.g. "typescript", "rust", "python"). Subsystems may override. Enables language-aware validation.')
23024
+ name: import_zod10.z.string().describe("Overarching name of the project/system"),
23025
+ vision: import_zod10.z.string().describe("Vision, mission, and core goals of the system"),
23026
+ boundaries: import_zod10.z.array(import_zod10.z.union([import_zod10.z.string(), import_zod10.z.object({ name: import_zod10.z.string(), description: import_zod10.z.string().optional() })])).optional().describe("System boundary rules or scope statements (strings or name/description objects)"),
23027
+ globalRequirements: import_zod10.z.array(import_zod10.z.union([import_zod10.z.string(), import_zod10.z.object({ description: import_zod10.z.string() })])).optional().describe("Global functional and non-functional requirements (strings or description objects)"),
23028
+ targetLanguage: import_zod10.z.string().optional().describe('Default implementation language for the system (e.g. "typescript", "rust", "python"). Subsystems may override. Enables language-aware validation.')
22712
23029
  };
22713
23030
  const systemInputFields = Object.keys(systemInput);
22714
23031
  reg(
@@ -22749,28 +23066,28 @@ NOTICE:
22749
23066
  }
22750
23067
  );
22751
23068
  const subsystemInput = {
22752
- id: import_zod9.z.string().describe("Lowercase identifier for the subsystem"),
22753
- name: import_zod9.z.string().describe("Human-readable display name"),
22754
- description: import_zod9.z.string().describe("Purpose and details of the subsystem"),
22755
- publicInterfaces: import_zod9.z.array(import_zod9.z.object({
22756
- type: import_zod9.z.enum(["REST", "GraphQL", "MessageBus", "RPC", "Custom"]),
22757
- details: import_zod9.z.string(),
22758
- component: import_zod9.z.string().optional().describe("The L2 component id that realizes this interface (this subsystem's published surface)"),
22759
- interface: import_zod9.z.string().optional().describe("Optional L3 interface id on that component backing this entry")
23069
+ id: import_zod10.z.string().describe("Lowercase identifier for the subsystem"),
23070
+ name: import_zod10.z.string().describe("Human-readable display name"),
23071
+ description: import_zod10.z.string().describe("Purpose and details of the subsystem"),
23072
+ publicInterfaces: import_zod10.z.array(import_zod10.z.object({
23073
+ type: import_zod10.z.enum(["REST", "GraphQL", "MessageBus", "RPC", "Custom"]),
23074
+ details: import_zod10.z.string(),
23075
+ component: import_zod10.z.string().optional().describe("The L2 component id that realizes this interface (this subsystem's published surface)"),
23076
+ interface: import_zod10.z.string().optional().describe("Optional L3 interface id on that component backing this entry")
22760
23077
  })).optional().describe("Public entrypoints exposed by this subsystem, each bound to a realizing component"),
22761
- projectPath: import_zod9.z.string().optional().describe("Relative path to external project root for subsystem chaining"),
22762
- targetLanguage: import_zod9.z.string().optional().describe("Override of the system-level targetLanguage for this subsystem"),
22763
- profile: import_zod9.z.string().optional().describe("Architectural profile override for this subsystem (built-ins: backend, frontend-reactive, frontend-controller, lowlevel-os, game-ecs, realtime-embedded, plc-cyclic; extension packs may add more \u2014 unknown names get UNKNOWN_PROFILE)"),
22764
- designDepth: import_zod9.z.enum(["components", "interfaces", "implementations", "narratives"]).optional().describe("How deep THIS subsystem commits to designing (overrides project rules.designDepth; default narratives = full depth). Expectation checks below the depth are gated \u2014 soundness of authored content always applies."),
22765
- trustedLinks: import_zod9.z.array(import_zod9.z.object({
22766
- subsystem: import_zod9.z.string().describe("Peer subsystem id"),
22767
- reason: import_zod9.z.string().describe('Why the coupling is sanctioned (e.g. "dispatch latency fast lane")')
23078
+ projectPath: import_zod10.z.string().optional().describe("Relative path to external project root for subsystem chaining"),
23079
+ targetLanguage: import_zod10.z.string().optional().describe("Override of the system-level targetLanguage for this subsystem"),
23080
+ profile: import_zod10.z.string().optional().describe("Architectural profile override for this subsystem (built-ins: backend, frontend-reactive, frontend-controller, lowlevel-os, game-ecs, realtime-embedded, plc-cyclic; extension packs may add more \u2014 unknown names get UNKNOWN_PROFILE)"),
23081
+ designDepth: import_zod10.z.enum(["components", "interfaces", "implementations", "narratives"]).optional().describe("How deep THIS subsystem commits to designing (overrides project rules.designDepth; default narratives = full depth). Expectation checks below the depth are gated \u2014 soundness of authored content always applies."),
23082
+ trustedLinks: import_zod10.z.array(import_zod10.z.object({
23083
+ subsystem: import_zod10.z.string().describe("Peer subsystem id"),
23084
+ reason: import_zod10.z.string().describe('Why the coupling is sanctioned (e.g. "dispatch latency fast lane")')
22768
23085
  })).optional().describe("Sanctioned tight couplings with peers \u2014 required to acknowledge a mutual subsystem dependency; the Adapter \u2192 published Portal shape still applies."),
22769
- lifecycle: import_zod9.z.array(import_zod9.z.object({
22770
- phase: import_zod9.z.enum(["init", "shutdown", "cyclic", "interrupt", "scheduled"]).describe("Which lifecycle/execution flow this roots (cyclic = every scan/tick, interrupt = hardware/OS interrupt, scheduled = timer/cron)"),
22771
- component: import_zod9.z.string().describe("Component id whose method the runtime invokes at this phase"),
22772
- method: import_zod9.z.string().describe("Method name on that component's interface"),
22773
- description: import_zod9.z.string().optional()
23086
+ lifecycle: import_zod10.z.array(import_zod10.z.object({
23087
+ phase: import_zod10.z.enum(["init", "shutdown", "cyclic", "interrupt", "scheduled"]).describe("Which lifecycle/execution flow this roots (cyclic = every scan/tick, interrupt = hardware/OS interrupt, scheduled = timer/cron)"),
23088
+ component: import_zod10.z.string().describe("Component id whose method the runtime invokes at this phase"),
23089
+ method: import_zod10.z.string().describe("Method name on that component's interface"),
23090
+ description: import_zod10.z.string().optional()
22774
23091
  })).optional().describe("Declared execution-flow roots \u2014 reachability entrypoints alongside Portals/Observers. Only init flows feed the durable-Store hydration check (MISSING_HYDRATION); cyclic/interrupt/scheduled root non-request/response execution models (PLC scan, ISR, cron).")
22775
23092
  };
22776
23093
  const subsystemInputFields = [...Object.keys(subsystemInput), "parentSystem"];
@@ -22830,12 +23147,12 @@ NOTICE:
22830
23147
  {
22831
23148
  description: "Set (replace) an existing subsystem's publicInterfaces, binding each to the component (and optional interface) that realizes it. Use this to backfill bindings once the subsystem's components exist \u2014 cross-subsystem dependencies may only target a published public component.",
22832
23149
  inputSchema: {
22833
- subsystem: import_zod9.z.string().describe("The L1 subsystem id to update"),
22834
- publicInterfaces: import_zod9.z.array(import_zod9.z.object({
22835
- type: import_zod9.z.enum(["REST", "GraphQL", "MessageBus", "RPC", "Custom"]),
22836
- details: import_zod9.z.string(),
22837
- component: import_zod9.z.string().optional().describe("The L2 component id that realizes this interface"),
22838
- interface: import_zod9.z.string().optional().describe("Optional L3 interface id on that component")
23150
+ subsystem: import_zod10.z.string().describe("The L1 subsystem id to update"),
23151
+ publicInterfaces: import_zod10.z.array(import_zod10.z.object({
23152
+ type: import_zod10.z.enum(["REST", "GraphQL", "MessageBus", "RPC", "Custom"]),
23153
+ details: import_zod10.z.string(),
23154
+ component: import_zod10.z.string().optional().describe("The L2 component id that realizes this interface"),
23155
+ interface: import_zod10.z.string().optional().describe("Optional L3 interface id on that component")
22839
23156
  })).describe("The full replacement list of public interfaces for this subsystem")
22840
23157
  }
22841
23158
  },
@@ -22861,8 +23178,8 @@ NOTICE:
22861
23178
  {
22862
23179
  description: "Set (or clear) the projectPath of an L1 Subsystem for subsystem chaining. projectPath should be a relative path to the external project root directory.",
22863
23180
  inputSchema: {
22864
- subsystem: import_zod9.z.string().describe("The L1 subsystem id to update"),
22865
- projectPath: import_zod9.z.string().optional().describe("Relative path to external project root (or omit to clear)")
23181
+ subsystem: import_zod10.z.string().describe("The L1 subsystem id to update"),
23182
+ projectPath: import_zod10.z.string().optional().describe("Relative path to external project root (or omit to clear)")
22866
23183
  }
22867
23184
  },
22868
23185
  ({ subsystem, projectPath }) => {
@@ -22887,8 +23204,8 @@ NOTICE:
22887
23204
  {
22888
23205
  description: "Relocate an external subsystem: move its subproject directory on disk to newProjectPath and update its projectPath link in one step. Errors if the subsystem has no projectPath (not an external subproject).",
22889
23206
  inputSchema: {
22890
- subsystem: import_zod9.z.string().describe("The external L1 subsystem id to relocate"),
22891
- newProjectPath: import_zod9.z.string().describe("The new relative path for the subproject directory")
23207
+ subsystem: import_zod10.z.string().describe("The external L1 subsystem id to relocate"),
23208
+ newProjectPath: import_zod10.z.string().describe("The new relative path for the subproject directory")
22892
23209
  }
22893
23210
  },
22894
23211
  ({ subsystem, newProjectPath }) => {
@@ -22907,8 +23224,8 @@ NOTICE:
22907
23224
  {
22908
23225
  description: "Migrate an internal subsystem into a standalone subproject at projectPath: move its spec subtree out, mount it via projectPath, and rewrite cross-subsystem references to the new namespaced ids. Source code is not moved. Errors if the subsystem is missing or already external.",
22909
23226
  inputSchema: {
22910
- subsystem: import_zod9.z.string().describe("The internal L1 subsystem id to externalize"),
22911
- projectPath: import_zod9.z.string().describe("Relative destination directory for the new subproject")
23227
+ subsystem: import_zod10.z.string().describe("The internal L1 subsystem id to externalize"),
23228
+ projectPath: import_zod10.z.string().describe("Relative destination directory for the new subproject")
22912
23229
  }
22913
23230
  },
22914
23231
  ({ subsystem, projectPath }) => {
@@ -22927,7 +23244,7 @@ NOTICE:
22927
23244
  {
22928
23245
  description: "Migrate an external subsystem back into the parent tree: move its subproject spec subtree back under the parent, drop projectPath, delete the child .wai project, and rewrite references back to bare ids. Errors if the subsystem is not external or its subproject is not a single flat subsystem.",
22929
23246
  inputSchema: {
22930
- subsystem: import_zod9.z.string().describe("The external L1 subsystem id to internalize")
23247
+ subsystem: import_zod10.z.string().describe("The external L1 subsystem id to internalize")
22931
23248
  }
22932
23249
  },
22933
23250
  ({ subsystem }) => {
@@ -22941,33 +23258,33 @@ NOTICE:
22941
23258
  }
22942
23259
  );
22943
23260
  const componentInput = {
22944
- id: import_zod9.z.string().describe("Lowercase identifier for the component"),
22945
- name: import_zod9.z.string().describe("Human-readable display name"),
22946
- description: import_zod9.z.string().describe("Responsibility / internal architecture details"),
22947
- subsystem: import_zod9.z.string().describe("The L1 subsystem ID this component belongs to"),
22948
- componentType: import_zod9.z.enum(["Portal", "Orchestrator", "Supervisor", "Actor", "Store", "Index", "Registry", "Adapter", "Observer", "Specialist", "Repository", "Gateway"]).describe("The building block, or pattern (Repository/Gateway)"),
22949
- owns: import_zod9.z.array(import_zod9.z.string()).optional().describe("Member block ids privately owned by this component (patterns only)"),
22950
- dependsOn: import_zod9.z.array(import_zod9.z.string()).optional().describe("IDs of other components this collaborates with (facades or standalone blocks)"),
22951
- portalType: import_zod9.z.enum(["HTTP_API", "gRPC", "GraphQL", "MessageBus", "CLI", "NamedPipe", "IPC", "Custom"]).optional().describe("Portal-only, and expected on every Portal. OMIT IT on any other componentType \u2014 passing it there is refused at the write (UNEXPECTED_PORTAL_FIELD), nothing is saved."),
22952
- basePath: import_zod9.z.string().optional().describe("Portal-only: base path/prefix all the portal's endpoints mount under. OMIT IT on any other componentType \u2014 passing it there is refused at the write (UNEXPECTED_PORTAL_FIELD), nothing is saved."),
22953
- dispatch: import_zod9.z.array(import_zod9.z.object({
22954
- capability: import_zod9.z.string().describe('Capability name exactly as dispatched at runtime (e.g. "shadow_module.get")'),
22955
- component: import_zod9.z.string().describe("Component id serving this capability (must also appear under dependsOn/owns)"),
22956
- method: import_zod9.z.string().describe("Method name on the serving component's interface"),
22957
- description: import_zod9.z.string().optional()
23261
+ id: import_zod10.z.string().describe("Lowercase identifier for the component"),
23262
+ name: import_zod10.z.string().describe("Human-readable display name"),
23263
+ description: import_zod10.z.string().describe("Responsibility / internal architecture details"),
23264
+ subsystem: import_zod10.z.string().describe("The L1 subsystem ID this component belongs to"),
23265
+ componentType: import_zod10.z.enum(["Portal", "Orchestrator", "Supervisor", "Actor", "Store", "Index", "Registry", "Adapter", "Observer", "Specialist", "Repository", "Gateway"]).describe("The building block, or pattern (Repository/Gateway)"),
23266
+ owns: import_zod10.z.array(import_zod10.z.string()).optional().describe("Member block ids privately owned by this component (patterns only)"),
23267
+ dependsOn: import_zod10.z.array(import_zod10.z.string()).optional().describe("IDs of other components this collaborates with (facades or standalone blocks)"),
23268
+ portalType: import_zod10.z.enum(["HTTP_API", "gRPC", "GraphQL", "MessageBus", "CLI", "NamedPipe", "IPC", "Custom"]).optional().describe("Portal-only, and expected on every Portal. OMIT IT on any other componentType \u2014 passing it there is refused at the write (UNEXPECTED_PORTAL_FIELD), nothing is saved."),
23269
+ basePath: import_zod10.z.string().optional().describe("Portal-only: base path/prefix all the portal's endpoints mount under. OMIT IT on any other componentType \u2014 passing it there is refused at the write (UNEXPECTED_PORTAL_FIELD), nothing is saved."),
23270
+ dispatch: import_zod10.z.array(import_zod10.z.object({
23271
+ capability: import_zod10.z.string().describe('Capability name exactly as dispatched at runtime (e.g. "shadow_module.get")'),
23272
+ component: import_zod10.z.string().describe("Component id serving this capability (must also appear under dependsOn/owns)"),
23273
+ method: import_zod10.z.string().describe("Method name on the serving component's interface"),
23274
+ description: import_zod10.z.string().optional()
22958
23275
  })).optional().describe("Portal-only: capability \u2192 component.method dispatch table for generic-handle portals. Gives the reachability walker real edges and is validated against target interfaces (UNSERVED_CAPABILITY)."),
22959
- durability: import_zod9.z.enum(["ram-projection", "durable", "read-through", "cache"]).optional().describe("Store-only \u2014 OMIT IT on any other componentType, where it is refused at the write (DURABILITY_ON_NON_STORE) and nothing is saved. Every Store should declare one (MISSING_DURABILITY): durable = persisted RAM projection (hydration read-back from a lifecycle init entrypoint required \u2014 MISSING_HYDRATION); read-through = persisted with no RAM copy (every read is the read-back, hydration exempt); ram-projection = rebuilt not restored; cache = evictable loss-safe memo state."),
22960
- emits: import_zod9.z.array(import_zod9.z.object({
22961
- topic: import_zod9.z.string().describe("Topic/channel name exactly as used on the bus"),
22962
- event: import_zod9.z.string().optional().describe("Optional event name within the topic (informational; pairing is by topic)"),
22963
- description: import_zod9.z.string().optional()
23276
+ durability: import_zod10.z.enum(["ram-projection", "durable", "read-through", "cache"]).optional().describe("Store-only \u2014 OMIT IT on any other componentType, where it is refused at the write (DURABILITY_ON_NON_STORE) and nothing is saved. Every Store should declare one (MISSING_DURABILITY): durable = persisted RAM projection (hydration read-back from a lifecycle init entrypoint required \u2014 MISSING_HYDRATION); read-through = persisted with no RAM copy (every read is the read-back, hydration exempt); ram-projection = rebuilt not restored; cache = evictable loss-safe memo state."),
23277
+ emits: import_zod10.z.array(import_zod10.z.object({
23278
+ topic: import_zod10.z.string().describe("Topic/channel name exactly as used on the bus"),
23279
+ event: import_zod10.z.string().optional().describe("Optional event name within the topic (informational; pairing is by topic)"),
23280
+ description: import_zod10.z.string().optional()
22964
23281
  })).optional().describe("Topics this component publishes \u2014 every emitted topic needs a subscriber somewhere in the tree (UNCONSUMED_TOPIC)."),
22965
- subscribesTo: import_zod9.z.array(import_zod9.z.object({
22966
- topic: import_zod9.z.string().describe("Topic/channel name exactly as used on the bus"),
22967
- event: import_zod9.z.string().optional(),
22968
- description: import_zod9.z.string().optional()
23282
+ subscribesTo: import_zod10.z.array(import_zod10.z.object({
23283
+ topic: import_zod10.z.string().describe("Topic/channel name exactly as used on the bus"),
23284
+ event: import_zod10.z.string().optional(),
23285
+ description: import_zod10.z.string().optional()
22969
23286
  })).optional().describe("Topics this component consumes (typical on Observers) \u2014 every subscription needs an emitter somewhere in the tree (UNSOURCED_SUBSCRIPTION)."),
22970
- ext: import_zod9.z.record(import_zod9.z.unknown()).optional().describe('Opaque pack/tool extension data (namespaced keys, e.g. "mypack:priority") \u2014 preserved verbatim, never validated or interpreted by the core')
23287
+ ext: import_zod10.z.record(import_zod10.z.unknown()).optional().describe('Opaque pack/tool extension data (namespaced keys, e.g. "mypack:priority") \u2014 preserved verbatim, never validated or interpreted by the core')
22971
23288
  };
22972
23289
  const componentInputFields = Object.keys(componentInput);
22973
23290
  reg(
@@ -23026,31 +23343,31 @@ NOTICE:
23026
23343
  }
23027
23344
  );
23028
23345
  const interfaceMethodShape = {
23029
- name: import_zod9.z.string(),
23030
- description: import_zod9.z.string(),
23031
- signature: import_zod9.z.string(),
23032
- returns: import_zod9.z.string(),
23033
- params: import_zod9.z.array(import_zod9.z.object({
23034
- name: import_zod9.z.string(),
23035
- type: import_zod9.z.string().describe('A primitive/builtin or a defined type id (e.g. "billing.Invoice")'),
23036
- description: import_zod9.z.string().optional(),
23037
- optional: import_zod9.z.boolean().optional()
23346
+ name: import_zod10.z.string(),
23347
+ description: import_zod10.z.string(),
23348
+ signature: import_zod10.z.string(),
23349
+ returns: import_zod10.z.string(),
23350
+ params: import_zod10.z.array(import_zod10.z.object({
23351
+ name: import_zod10.z.string(),
23352
+ type: import_zod10.z.string().describe('A primitive/builtin or a defined type id (e.g. "billing.Invoice")'),
23353
+ description: import_zod10.z.string().optional(),
23354
+ optional: import_zod10.z.boolean().optional()
23038
23355
  })).optional().describe("Structured parameters \u2014 authoritative for type checking (the prose signature becomes display-only). Strongly preferred."),
23039
- guarantees: import_zod9.z.array(import_zod9.z.string().min(1)).optional().describe("Semantic guarantees the method promises (combinable); any guarantee a narrative step asserts must be declared here. Builtin tokens: idempotent | atomic | transactional | exactly-once; extension packs may declare more (any other token is UNKNOWN_GUARANTEE)"),
23040
- effect: import_zod9.z.enum(["read", "write"]).optional().describe("State-effect direction on the component's held state \u2014 required on a durable Store's contract methods so the durability round-trip rule can pair writes with hydration read-backs"),
23041
- invokedBy: import_zod9.z.object({
23042
- kind: import_zod9.z.enum(["runtime", "external", "sibling-subsystem"]).describe("Who owns the out-of-graph invocation: runtime (timer/signal/shutdown hook), external (a system outside this project), sibling-subsystem (a modeled sibling whose edge is not narrated here)"),
23043
- caller: import_zod9.z.string().optional().describe("WHO invokes it and when, as reviewable prose \u2014 missing or placeholder-thin prose is INVOKED_BY_UNDESCRIBED")
23356
+ guarantees: import_zod10.z.array(import_zod10.z.string().min(1)).optional().describe("Semantic guarantees the method promises (combinable); any guarantee a narrative step asserts must be declared here. Builtin tokens: idempotent | atomic | transactional | exactly-once; extension packs may declare more (any other token is UNKNOWN_GUARANTEE)"),
23357
+ effect: import_zod10.z.enum(["read", "write"]).optional().describe("State-effect direction on the component's held state \u2014 required on a durable Store's contract methods so the durability round-trip rule can pair writes with hydration read-backs"),
23358
+ invokedBy: import_zod10.z.object({
23359
+ kind: import_zod10.z.enum(["runtime", "external", "sibling-subsystem"]).describe("Who owns the out-of-graph invocation: runtime (timer/signal/shutdown hook), external (a system outside this project), sibling-subsystem (a modeled sibling whose edge is not narrated here)"),
23360
+ caller: import_zod10.z.string().optional().describe("WHO invokes it and when, as reviewable prose \u2014 missing or placeholder-thin prose is INVOKED_BY_UNDESCRIBED")
23044
23361
  }).optional().describe("Typed acknowledgment of a real caller OUTSIDE the modeled narrative graph. Unused-detection seeds the method as an entrypoint so reachability propagates through its narrative (unlike lint.allow); a method the internal walk already reaches is flagged stale (INVOKED_BY_REDUNDANT). Prefer a `register` narrative step when the wiring is internal."),
23045
- ext: import_zod9.z.record(import_zod9.z.unknown()).optional().describe("Opaque pack/tool extension data for this method (namespaced keys) \u2014 preserved verbatim")
23362
+ ext: import_zod10.z.record(import_zod10.z.unknown()).optional().describe("Opaque pack/tool extension data for this method (namespaced keys) \u2014 preserved verbatim")
23046
23363
  };
23047
23364
  const interfaceMethodInputFields = Object.keys(interfaceMethodShape);
23048
23365
  const interfaceInput = {
23049
- id: import_zod9.z.string().describe('Lowercase identifier prefixed with "i", e.g. "istorage"'),
23050
- name: import_zod9.z.string().describe("Human-readable contract name"),
23051
- description: import_zod9.z.string().describe("Contract description and obligations"),
23052
- component: import_zod9.z.string().describe("The L2 component ID this interface belongs to"),
23053
- methods: import_zod9.z.array(import_zod9.z.object(interfaceMethodShape)).optional().describe("List of method signature contracts")
23366
+ id: import_zod10.z.string().describe('Lowercase identifier prefixed with "i", e.g. "istorage"'),
23367
+ name: import_zod10.z.string().describe("Human-readable contract name"),
23368
+ description: import_zod10.z.string().describe("Contract description and obligations"),
23369
+ component: import_zod10.z.string().describe("The L2 component ID this interface belongs to"),
23370
+ methods: import_zod10.z.array(import_zod10.z.object(interfaceMethodShape)).optional().describe("List of method signature contracts")
23054
23371
  };
23055
23372
  const interfaceInputFields = Object.keys(interfaceInput);
23056
23373
  reg(
@@ -23115,24 +23432,24 @@ NOTICE:
23115
23432
  {
23116
23433
  description: "Bind concrete wire endpoints to existing L3 interface methods (required for every Portal). Pick `transport` and fill that transport's address fields. Run after sdd_define_interface.",
23117
23434
  inputSchema: {
23118
- interface: import_zod9.z.string().describe('The L3 interface ID (e.g. "ibilling-gateway")'),
23119
- endpoints: import_zod9.z.array(import_zod9.z.object({
23120
- method: import_zod9.z.string().describe("The NAME of the interface method to bind (not the HTTP verb)"),
23121
- transport: import_zod9.z.enum(["HTTP", "gRPC", "GraphQL", "MessageBus", "NamedPipe", "IPC", "CLI", "Custom"]).describe("Wire protocol; must match the Portal's portalType"),
23122
- httpMethod: import_zod9.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]).optional().describe("HTTP: verb"),
23123
- path: import_zod9.z.string().optional().describe('HTTP: route path, e.g. "/v1/checkout"'),
23124
- service: import_zod9.z.string().optional().describe("gRPC: service name"),
23125
- rpcMethod: import_zod9.z.string().optional().describe("gRPC: rpc method name"),
23126
- operation: import_zod9.z.enum(["query", "mutation", "subscription"]).optional().describe("GraphQL: operation kind"),
23127
- field: import_zod9.z.string().optional().describe("GraphQL: root field name"),
23128
- topic: import_zod9.z.string().optional().describe("MessageBus: topic"),
23129
- event: import_zod9.z.string().optional().describe("MessageBus: event name"),
23130
- queue: import_zod9.z.string().optional().describe("MessageBus: optional queue/consumer group"),
23131
- direction: import_zod9.z.enum(["subscribe", "publish"]).optional().describe("MessageBus: subscribe (default) or publish"),
23132
- pipe: import_zod9.z.string().optional().describe('NamedPipe: pipe name, e.g. "\\\\.\\pipe\\gk-events"'),
23133
- channel: import_zod9.z.string().optional().describe("IPC: channel name"),
23134
- command: import_zod9.z.string().optional().describe("CLI: command/subcommand"),
23135
- address: import_zod9.z.string().optional().describe("Custom: free-form address")
23435
+ interface: import_zod10.z.string().describe('The L3 interface ID (e.g. "ibilling-gateway")'),
23436
+ endpoints: import_zod10.z.array(import_zod10.z.object({
23437
+ method: import_zod10.z.string().describe("The NAME of the interface method to bind (not the HTTP verb)"),
23438
+ transport: import_zod10.z.enum(["HTTP", "gRPC", "GraphQL", "MessageBus", "NamedPipe", "IPC", "CLI", "Custom"]).describe("Wire protocol; must match the Portal's portalType"),
23439
+ httpMethod: import_zod10.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH", "OPTIONS", "HEAD"]).optional().describe("HTTP: verb"),
23440
+ path: import_zod10.z.string().optional().describe('HTTP: route path, e.g. "/v1/checkout"'),
23441
+ service: import_zod10.z.string().optional().describe("gRPC: service name"),
23442
+ rpcMethod: import_zod10.z.string().optional().describe("gRPC: rpc method name"),
23443
+ operation: import_zod10.z.enum(["query", "mutation", "subscription"]).optional().describe("GraphQL: operation kind"),
23444
+ field: import_zod10.z.string().optional().describe("GraphQL: root field name"),
23445
+ topic: import_zod10.z.string().optional().describe("MessageBus: topic"),
23446
+ event: import_zod10.z.string().optional().describe("MessageBus: event name"),
23447
+ queue: import_zod10.z.string().optional().describe("MessageBus: optional queue/consumer group"),
23448
+ direction: import_zod10.z.enum(["subscribe", "publish"]).optional().describe("MessageBus: subscribe (default) or publish"),
23449
+ pipe: import_zod10.z.string().optional().describe('NamedPipe: pipe name, e.g. "\\\\.\\pipe\\gk-events"'),
23450
+ channel: import_zod10.z.string().optional().describe("IPC: channel name"),
23451
+ command: import_zod10.z.string().optional().describe("CLI: command/subcommand"),
23452
+ address: import_zod10.z.string().optional().describe("Custom: free-form address")
23136
23453
  })).describe("One binding per method")
23137
23454
  }
23138
23455
  },
@@ -23181,65 +23498,65 @@ NOTICE:
23181
23498
  }
23182
23499
  }
23183
23500
  );
23184
- const stepNo = () => import_zod9.z.number().int().positive();
23185
- const labelRef = () => import_zod9.z.string().min(1);
23186
- const narrativeStepInput = import_zod9.z.object({
23501
+ const stepNo = () => import_zod10.z.number().int().positive();
23502
+ const labelRef = () => import_zod10.z.string().min(1);
23503
+ const narrativeStepInput = import_zod10.z.object({
23187
23504
  stepNumber: stepNo().optional().describe("Defaults to the 1-based array position \u2014 jump fields reference these numbers"),
23188
23505
  label: labelRef().optional().describe("Optional symbolic anchor for this step (unique per narrative). Every jump-by-number field has a *Label twin resolved against these anchors at write time \u2014 prefer labels over hand-counted step numbers"),
23189
- description: import_zod9.z.string(),
23190
- type: import_zod9.z.enum(["local", "call", "dispatch", "register", "branch", "switch", "loop", "try", "parallel", "jump", "return", "throw"]),
23191
- targetComponent: import_zod9.z.string().optional().describe("call/register/dispatch: L2 component id (for dispatch, the Portal routed through)"),
23192
- targetMethod: import_zod9.z.string().optional().describe("call/register: method name on the target. A register step hands the target method to the runtime as a callback (timer, event listener, shutdown hook): reachability follows the edge, but it is never an invocation \u2014 exempt from call-graph conformance, call-cycle detection, and the durability boot walk"),
23193
- auth: import_zod9.z.object({ from: import_zod9.z.string(), note: import_zod9.z.string().optional() }).optional().describe("call/dispatch: the credential this step presents to an AUTHED callee Portal and WHERE it loads from (`from`). Opaque form (env:API_KEY, a config key, vault:path) = a design note wairon never resolves; modeled form `component:<id>` references the Adapter/Store that provides the secret and is validated (must resolve, be an Adapter/Store, and be wired to the presenter). Absence on a call into a Portal whose auth \u2260 none warns (PORTAL_AUTH_UNMET). The authenticated call itself should be made by an Adapter (AUTH_PRESENTER_NOT_ADAPTER)."),
23194
- detach: import_zod9.z.boolean().optional().describe("call/dispatch: fire-and-forget \u2014 issue the call and continue without awaiting the result (no later step consumes it)"),
23195
- capability: import_zod9.z.string().optional().describe("dispatch: the capability routed through the target Portal's dispatch table (validated against it \u2014 UNSERVED_CAPABILITY)"),
23196
- assertsGuarantees: import_zod9.z.array(import_zod9.z.string().min(1)).optional().describe("Semantic guarantees this step relies on \u2014 each must be declared in the called method's L3 guarantees (NARRATIVE_SEMANTIC_UNBACKED otherwise). Builtin tokens: idempotent | atomic | transactional | exactly-once; extension packs may declare more (any other token is UNKNOWN_GUARANTEE)"),
23197
- assertsInvariants: import_zod9.z.array(import_zod9.z.string()).optional().describe(`Declared entity invariants this step upholds, as "<type-id>.<invariant-id>" refs (UNKNOWN_INVARIANT_REF when unresolved); write-effect methods of the entity's componentClass must carry one per declared invariant (UNASSERTED_INVARIANT)`),
23198
- condition: import_zod9.z.string().optional().describe("branch / while / doWhile"),
23506
+ description: import_zod10.z.string(),
23507
+ type: import_zod10.z.enum(["local", "call", "dispatch", "register", "branch", "switch", "loop", "try", "parallel", "jump", "return", "throw"]),
23508
+ targetComponent: import_zod10.z.string().optional().describe("call/register/dispatch: L2 component id (for dispatch, the Portal routed through)"),
23509
+ targetMethod: import_zod10.z.string().optional().describe("call/register: method name on the target. A register step hands the target method to the runtime as a callback (timer, event listener, shutdown hook): reachability follows the edge, but it is never an invocation \u2014 exempt from call-graph conformance, call-cycle detection, and the durability boot walk"),
23510
+ auth: import_zod10.z.object({ from: import_zod10.z.string(), note: import_zod10.z.string().optional() }).optional().describe("call/dispatch: the credential this step presents to an AUTHED callee Portal and WHERE it loads from (`from`). Opaque form (env:API_KEY, a config key, vault:path) = a design note wairon never resolves; modeled form `component:<id>` references the Adapter/Store that provides the secret and is validated (must resolve, be an Adapter/Store, and be wired to the presenter). Absence on a call into a Portal whose auth \u2260 none warns (PORTAL_AUTH_UNMET). The authenticated call itself should be made by an Adapter (AUTH_PRESENTER_NOT_ADAPTER)."),
23511
+ detach: import_zod10.z.boolean().optional().describe("call/dispatch: fire-and-forget \u2014 issue the call and continue without awaiting the result (no later step consumes it)"),
23512
+ capability: import_zod10.z.string().optional().describe("dispatch: the capability routed through the target Portal's dispatch table (validated against it \u2014 UNSERVED_CAPABILITY)"),
23513
+ assertsGuarantees: import_zod10.z.array(import_zod10.z.string().min(1)).optional().describe("Semantic guarantees this step relies on \u2014 each must be declared in the called method's L3 guarantees (NARRATIVE_SEMANTIC_UNBACKED otherwise). Builtin tokens: idempotent | atomic | transactional | exactly-once; extension packs may declare more (any other token is UNKNOWN_GUARANTEE)"),
23514
+ assertsInvariants: import_zod10.z.array(import_zod10.z.string()).optional().describe(`Declared entity invariants this step upholds, as "<type-id>.<invariant-id>" refs (UNKNOWN_INVARIANT_REF when unresolved); write-effect methods of the entity's componentClass must carry one per declared invariant (UNASSERTED_INVARIANT)`),
23515
+ condition: import_zod10.z.string().optional().describe("branch / while / doWhile"),
23199
23516
  onTrueStep: stepNo().optional().describe("branch: default = next step"),
23200
23517
  onTrueLabel: labelRef().optional().describe("branch: symbolic alternative to onTrueStep"),
23201
23518
  onFalseStep: stepNo().optional().describe("branch: required (or onFalseLabel)"),
23202
23519
  onFalseLabel: labelRef().optional().describe("branch: symbolic alternative to onFalseStep"),
23203
- on: import_zod9.z.string().optional().describe("switch: the dispatched value"),
23204
- cases: import_zod9.z.array(import_zod9.z.object({ value: import_zod9.z.string(), step: stepNo().optional(), label: labelRef().optional() })).optional().describe("switch: required; each case targets its region by step number or label"),
23520
+ on: import_zod10.z.string().optional().describe("switch: the dispatched value"),
23521
+ cases: import_zod10.z.array(import_zod10.z.object({ value: import_zod10.z.string(), step: stepNo().optional(), label: labelRef().optional() })).optional().describe("switch: required; each case targets its region by step number or label"),
23205
23522
  defaultStep: stepNo().optional().describe("switch: default = next step"),
23206
23523
  defaultLabel: labelRef().optional().describe("switch: symbolic alternative to defaultStep"),
23207
- loopKind: import_zod9.z.enum(["forEach", "for", "while", "doWhile"]).optional().describe('loop: default forEach when "over" is set, else while'),
23208
- over: import_zod9.z.string().optional().describe("loop forEach/for: iteration source"),
23524
+ loopKind: import_zod10.z.enum(["forEach", "for", "while", "doWhile"]).optional().describe('loop: default forEach when "over" is set, else while'),
23525
+ over: import_zod10.z.string().optional().describe("loop forEach/for: iteration source"),
23209
23526
  endStep: stepNo().optional().describe("loop/try: last step of the body region (required, or endLabel)"),
23210
23527
  endLabel: labelRef().optional().describe("loop/try: symbolic alternative to endStep"),
23211
- catches: import_zod9.z.array(import_zod9.z.object({ error: import_zod9.z.string(), step: stepNo().optional(), label: labelRef().optional() })).optional().describe("try: handler regions, each targeted by step number or label"),
23528
+ catches: import_zod10.z.array(import_zod10.z.object({ error: import_zod10.z.string(), step: stepNo().optional(), label: labelRef().optional() })).optional().describe("try: handler regions, each targeted by step number or label"),
23212
23529
  finallyStep: stepNo().optional().describe("try: first step of the always-runs region"),
23213
23530
  finallyLabel: labelRef().optional().describe("try: symbolic alternative to finallyStep"),
23214
- branches: import_zod9.z.array(import_zod9.z.object({ step: stepNo().optional(), label: labelRef().optional(), name: import_zod9.z.string().optional() })).optional().describe("parallel: >= 2 arm entries (step number or label), ascending, first = the step after the header; arms are contiguous sub-regions of body next..endStep, joining after endStep once ALL complete"),
23531
+ branches: import_zod10.z.array(import_zod10.z.object({ step: stepNo().optional(), label: labelRef().optional(), name: import_zod10.z.string().optional() })).optional().describe("parallel: >= 2 arm entries (step number or label), ascending, first = the step after the header; arms are contiguous sub-regions of body next..endStep, joining after endStep once ALL complete"),
23215
23532
  toStep: stepNo().optional().describe("jump: required (break/continue/rejoin), or toLabel"),
23216
23533
  toLabel: labelRef().optional().describe("jump: symbolic alternative to toStep \u2014 resolves to the labeled step at write time"),
23217
- outcome: import_zod9.z.string().optional().describe('return: e.g. "success", "not found"'),
23218
- error: import_zod9.z.string().optional().describe("throw: the raised error")
23534
+ outcome: import_zod10.z.string().optional().describe('return: e.g. "success", "not found"'),
23535
+ error: import_zod10.z.string().optional().describe("throw: the raised error")
23219
23536
  });
23220
- const detailEnum = import_zod9.z.enum(["full", "calls-only", "intent"]);
23221
- const conformanceEnum = import_zod9.z.enum(["declared", "anchored", "off"]);
23537
+ const detailEnum = import_zod10.z.enum(["full", "calls-only", "intent"]);
23538
+ const conformanceEnum = import_zod10.z.enum(["declared", "anchored", "off"]);
23222
23539
  const implMethodShape = {
23223
- name: import_zod9.z.string(),
23540
+ name: import_zod10.z.string(),
23224
23541
  detail: detailEnum.optional().describe("Detail level for this method (overrides the spec default)"),
23225
- intent: import_zod9.z.string().optional().describe("detail: intent \u2014 behavioral prose (what it does and how it fails); substitute for a narrative"),
23542
+ intent: import_zod10.z.string().optional().describe("detail: intent \u2014 behavioral prose (what it does and how it fails); substitute for a narrative"),
23226
23543
  conformance: conformanceEnum.optional().describe("Conformance tier for this method (overrides the spec default)"),
23227
- symbol: import_zod9.z.string().optional().describe("Code-level name realizing this contract method in the sourcePath file, when it legitimately differs from the intent-language contract name (e.g. put realized by saveSnapshot)"),
23228
- ext: import_zod9.z.record(import_zod9.z.unknown()).optional().describe("Opaque pack/tool extension data for this method (namespaced keys) \u2014 preserved verbatim"),
23229
- narrative: import_zod9.z.array(narrativeStepInput).optional()
23544
+ symbol: import_zod10.z.string().optional().describe("Code-level name realizing this contract method in the sourcePath file, when it legitimately differs from the intent-language contract name (e.g. put realized by saveSnapshot)"),
23545
+ ext: import_zod10.z.record(import_zod10.z.unknown()).optional().describe("Opaque pack/tool extension data for this method (namespaced keys) \u2014 preserved verbatim"),
23546
+ narrative: import_zod10.z.array(narrativeStepInput).optional()
23230
23547
  };
23231
23548
  const implMethodInputFields = Object.keys(implMethodShape);
23232
23549
  const implInput = {
23233
- id: import_zod9.z.string().describe('Lowercase identifier, e.g. "vfs_storage"'),
23234
- name: import_zod9.z.string().describe("Human-readable implementation name"),
23235
- description: import_zod9.z.string().describe("Implementation details"),
23236
- contract: import_zod9.z.string().describe("The L3 Interface contract ID this implements"),
23237
- sourcePath: import_zod9.z.string().optional().describe("Optional: target source code file path relative to project root"),
23238
- simPath: import_zod9.z.string().optional().describe("Optional: the committed integration-sim harness file (project-relative; N:1 sharing allowed). The validator proves it exists and its import graph wires the REAL modules (this component + each direct dependency; technology adapters may stay faked) \u2014 running it is CI's job. Declaring the first simPath in a subsystem activates MISSING_INTEGRATION_SIM for its other complete non-leaf implementations"),
23239
- technologies: import_zod9.z.array(import_zod9.z.string()).optional().describe(`External technologies this implementation binds to (e.g. ["mysql"]) \u2014 declares this component's ownership tree as the technology's home; references outside it are flagged (TECH_LEAKAGE) and contract identifiers must stay intent-language. Only for Adapter/Store/Registry/Index components.`),
23550
+ id: import_zod10.z.string().describe('Lowercase identifier, e.g. "vfs_storage"'),
23551
+ name: import_zod10.z.string().describe("Human-readable implementation name"),
23552
+ description: import_zod10.z.string().describe("Implementation details"),
23553
+ contract: import_zod10.z.string().describe("The L3 Interface contract ID this implements"),
23554
+ sourcePath: import_zod10.z.string().optional().describe("Optional: target source code file path relative to project root"),
23555
+ simPath: import_zod10.z.string().optional().describe("Optional: the committed integration-sim harness file (project-relative; N:1 sharing allowed). The validator proves it exists and its import graph wires the REAL modules (this component + each direct dependency; technology adapters may stay faked) \u2014 running it is CI's job. Declaring the first simPath in a subsystem activates MISSING_INTEGRATION_SIM for its other complete non-leaf implementations"),
23556
+ technologies: import_zod10.z.array(import_zod10.z.string()).optional().describe(`External technologies this implementation binds to (e.g. ["mysql"]) \u2014 declares this component's ownership tree as the technology's home; references outside it are flagged (TECH_LEAKAGE) and contract identifiers must stay intent-language. Only for Adapter/Store/Registry/Index components.`),
23240
23557
  detail: detailEnum.optional().describe("Spec-level narrative detail default for all methods"),
23241
23558
  conformance: conformanceEnum.optional().describe("Spec-level structural-conformance tier default: declared | anchored | off (omitted = stereotype default: Portal \u2192 anchored, else declared)"),
23242
- methods: import_zod9.z.array(import_zod9.z.object(implMethodShape)).optional().describe("Method implementations containing L5 narratives")
23559
+ methods: import_zod10.z.array(import_zod10.z.object(implMethodShape)).optional().describe("Method implementations containing L5 narratives")
23243
23560
  };
23244
23561
  const implInputFields = Object.keys(implInput);
23245
23562
  reg(
@@ -23312,29 +23629,29 @@ NOTICE:
23312
23629
  }
23313
23630
  );
23314
23631
  const typeInput = {
23315
- kind: import_zod9.z.enum(["entity", "value-object"]).describe("entity (owned by a subsystem) or value-object (often system-level shared)"),
23316
- id: import_zod9.z.string().describe("Lowercase identifier"),
23317
- name: import_zod9.z.string().describe("Human-readable name"),
23318
- description: import_zod9.z.string().optional(),
23319
- subsystem: import_zod9.z.string().optional().describe("Owning subsystem id; omit for a system-level shared value object"),
23320
- group: import_zod9.z.string().optional().describe("Optional logical group ID to organize this type in subfolders"),
23321
- fields: import_zod9.z.array(import_zod9.z.object({
23322
- name: import_zod9.z.string(),
23323
- type: import_zod9.z.string(),
23324
- description: import_zod9.z.string().optional(),
23325
- optional: import_zod9.z.boolean().optional(),
23326
- key: import_zod9.z.enum(["primary", "unique", "foreign"]).optional().describe("Identity marker (PK/unique/FK) for ERD and database schema derivation"),
23327
- references: import_zod9.z.string().optional().describe('For foreign keys, the referenced type/table id and optional field, e.g. "invoice.id"')
23632
+ kind: import_zod10.z.enum(["entity", "value-object"]).describe("entity (owned by a subsystem) or value-object (often system-level shared)"),
23633
+ id: import_zod10.z.string().describe("Lowercase identifier"),
23634
+ name: import_zod10.z.string().describe("Human-readable name"),
23635
+ description: import_zod10.z.string().optional(),
23636
+ subsystem: import_zod10.z.string().optional().describe("Owning subsystem id; omit for a system-level shared value object"),
23637
+ group: import_zod10.z.string().optional().describe("Optional logical group ID to organize this type in subfolders"),
23638
+ fields: import_zod10.z.array(import_zod10.z.object({
23639
+ name: import_zod10.z.string(),
23640
+ type: import_zod10.z.string(),
23641
+ description: import_zod10.z.string().optional(),
23642
+ optional: import_zod10.z.boolean().optional(),
23643
+ key: import_zod10.z.enum(["primary", "unique", "foreign"]).optional().describe("Identity marker (PK/unique/FK) for ERD and database schema derivation"),
23644
+ references: import_zod10.z.string().optional().describe('For foreign keys, the referenced type/table id and optional field, e.g. "invoice.id"')
23328
23645
  })).optional().describe('Data fields (type is a primitive or a qualified type id, e.g. "billing.Invoice")'),
23329
- methods: import_zod9.z.array(import_zod9.z.object({ name: import_zod9.z.string(), signature: import_zod9.z.string(), returns: import_zod9.z.string(), description: import_zod9.z.string().optional() })).optional().describe("Pure intrinsic methods only"),
23330
- componentClass: import_zod9.z.string().optional().describe("Optional component id that implements or owns this logical entity"),
23331
- invariants: import_zod9.z.array(import_zod9.z.object({
23332
- id: import_zod9.z.string().describe("Stable invariant id, unique within the entity"),
23333
- description: import_zod9.z.string().describe("The property that must hold, stated precisely")
23646
+ methods: import_zod10.z.array(import_zod10.z.object({ name: import_zod10.z.string(), signature: import_zod10.z.string(), returns: import_zod10.z.string(), description: import_zod10.z.string().optional() })).optional().describe("Pure intrinsic methods only"),
23647
+ componentClass: import_zod10.z.string().optional().describe("Optional component id that implements or owns this logical entity"),
23648
+ invariants: import_zod10.z.array(import_zod10.z.object({
23649
+ id: import_zod10.z.string().describe("Stable invariant id, unique within the entity"),
23650
+ description: import_zod10.z.string().describe("The property that must hold, stated precisely")
23334
23651
  })).optional().describe("Declared domain invariants (entities): every write-effect method of the componentClass must carry a narrative step asserting each (assertsInvariants) \u2014 declarations checked, enforcement never proven"),
23335
- database: import_zod9.z.string().optional().describe("Optional database id for table-schema types"),
23336
- table: import_zod9.z.string().optional().describe("Optional database table name for table-schema types"),
23337
- linkedEntity: import_zod9.z.string().optional().describe("Optional logical entity id represented by this table-schema type")
23652
+ database: import_zod10.z.string().optional().describe("Optional database id for table-schema types"),
23653
+ table: import_zod10.z.string().optional().describe("Optional database table name for table-schema types"),
23654
+ linkedEntity: import_zod10.z.string().optional().describe("Optional logical entity id represented by this table-schema type")
23338
23655
  };
23339
23656
  const typeInputFields = Object.keys(typeInput);
23340
23657
  reg(
@@ -23405,8 +23722,8 @@ NOTICE:
23405
23722
  {
23406
23723
  description: "Validate the SDD spec tree, checking parent references, contract compatibility, narratives, and component type boundaries. Supports scoping and recursion controls.",
23407
23724
  inputSchema: {
23408
- subsystem: import_zod9.z.string().optional().describe("Only validate the specified subsystem (granular)"),
23409
- recursive: import_zod9.z.boolean().optional().describe("Whether to recursively validate subprojects (default: true)")
23725
+ subsystem: import_zod10.z.string().optional().describe("Only validate the specified subsystem (granular)"),
23726
+ recursive: import_zod10.z.boolean().optional().describe("Whether to recursively validate subprojects (default: true)")
23410
23727
  }
23411
23728
  },
23412
23729
  ({ subsystem, recursive }) => {
@@ -23436,8 +23753,8 @@ NOTICE:
23436
23753
  {
23437
23754
  description: `Get/read the parsed JSON contents of a specific spec from the spec tree. Returns structural contents without file system path searching. For a variant-tagged COMPONENT the result also carries a derived, read-only "variantGuidance" (the variant's base, its implementation guidance, and the same-variant sibling components to implement alike) \u2014 it is resolved from the variant registry, not part of the spec, so never write it back.`,
23438
23755
  inputSchema: {
23439
- kind: import_zod9.z.enum(["system", "subsystem", "component", "interface", "implementation", "type"]).describe("The kind of specification"),
23440
- id: import_zod9.z.string().describe('The identifier of the spec to fetch (the L0 system spec is a singleton \u2014 pass the system name or "system")')
23756
+ kind: import_zod10.z.enum(["system", "subsystem", "component", "interface", "implementation", "type"]).describe("The kind of specification"),
23757
+ id: import_zod10.z.string().describe('The identifier of the spec to fetch (the L0 system spec is a singleton \u2014 pass the system name or "system")')
23441
23758
  }
23442
23759
  },
23443
23760
  ({ kind, id }) => {
@@ -23481,8 +23798,8 @@ NOTICE:
23481
23798
  {
23482
23799
  description: "Delete a specification file from the spec tree and clean up any empty parent directories.",
23483
23800
  inputSchema: {
23484
- kind: import_zod9.z.enum(["subsystem", "component", "interface", "implementation", "type"]).describe("The kind of spec to delete"),
23485
- id: import_zod9.z.string().describe("The ID of the spec to delete")
23801
+ kind: import_zod10.z.enum(["subsystem", "component", "interface", "implementation", "type"]).describe("The kind of spec to delete"),
23802
+ id: import_zod10.z.string().describe("The ID of the spec to delete")
23486
23803
  }
23487
23804
  },
23488
23805
  ({ kind, id }) => {
@@ -23519,9 +23836,9 @@ NOTICE:
23519
23836
  {
23520
23837
  description: "Update/patch an existing SDD specification (subsystem, component, interface, implementation, or type) using a granular delta. Updates fields, appends/merges array elements, or inserts/deletes narrative steps.",
23521
23838
  inputSchema: {
23522
- kind: import_zod9.z.enum(["system", "subsystem", "component", "interface", "implementation", "type"]).describe("The spec kind to update (system = the singleton L0 \u2014 vision, boundaries, globalRequirements, databases, and publicInterfaces: the project gateway surface, each entry {id, name, subsystem, component, type, details, audience: project|department|instance|partner|external}; id is informational)"),
23523
- id: import_zod9.z.string().describe("The ID of the spec to update (namespaced if needed)"),
23524
- delta: import_zod9.z.record(import_zod9.z.any()).describe(`The partial fields to merge into the spec. ARRAYS UPSERT, they do not replace: an array whose elements carry an identity is merged element-by-element, so a delta naming ONE element leaves the others intact. Identity is "name" or "id" by default, and per field: dispatch by "capability", lifecycle by phase+component+method, emits/subscribesTo by topic+event, trustedLinks by "subsystem", invariants and patterns by "id", lint.allow by "code", boundaries by "name", globalRequirements by "description". Add "action: 'delete'" (or "remove: true") alongside that identity to REMOVE an element \u2014 including a stale lint allow. Arrays of plain STRINGS (owns, dependsOn, guarantees) carry no per-element identity and are replaced wholesale; pass [] to clear any array outright. To REMOVE an optional field entirely, list it in "unset": e.g. {"unset": ["basePath", "variant"]} \u2014 passing null/undefined means "no change" (they are skipped), and writing "" would leave the field present but empty, which is a different and usually wrong spec. Unsetting a required field is refused by schema validation, which names it. For narrative steps, match by "stepNumber" and use "action: 'insert'" (shifts subsequent steps up) or "action: 'delete'" (shifts subsequent steps down and removes it). Renumbering RELOCATES every flow jump field (onTrueStep/onFalseStep/cases.step/defaultStep/endStep/catches.step/finallyStep/toStep) in the same narrative; deleting a step that is a jump target is rejected until the referrers are retargeted. Inserting AT a jump target relocates those jumps past the inserted step by default (a NOTICE is returned) \u2014 add "captureJumps": true on the inserted step to retarget entry jumps onto it (loop/try endStep region tails always relocate with the body and are never captured). Reference ids in deltas may use LOCAL names \u2014 they are qualified against the spec's namespace exactly as the loader would. Per-spec lint suppression: set "lint: { allow: [{ code, reason }] }" to silence a WARNING code on this spec only (errors always surface; stale allows are flagged).`)
23839
+ kind: import_zod10.z.enum(["system", "subsystem", "component", "interface", "implementation", "type"]).describe("The spec kind to update (system = the singleton L0 \u2014 vision, boundaries, globalRequirements, databases, and publicInterfaces: the project gateway surface, each entry {id, name, subsystem, component, type, details, audience: project|department|instance|partner|external}; id is informational)"),
23840
+ id: import_zod10.z.string().describe("The ID of the spec to update (namespaced if needed)"),
23841
+ delta: import_zod10.z.record(import_zod10.z.any()).describe(`The partial fields to merge into the spec. ARRAYS UPSERT, they do not replace: an array whose elements carry an identity is merged element-by-element, so a delta naming ONE element leaves the others intact. Identity is "name" or "id" by default, and per field: dispatch by "capability", lifecycle by phase+component+method, emits/subscribesTo by topic+event, trustedLinks by "subsystem", invariants and patterns by "id", lint.allow by "code", boundaries by "name", globalRequirements by "description". Add "action: 'delete'" (or "remove: true") alongside that identity to REMOVE an element \u2014 including a stale lint allow. Arrays of plain STRINGS (owns, dependsOn, guarantees) carry no per-element identity and are replaced wholesale; pass [] to clear any array outright. To REMOVE an optional field entirely, list it in "unset": e.g. {"unset": ["basePath", "variant"]} \u2014 passing null/undefined means "no change" (they are skipped), and writing "" would leave the field present but empty, which is a different and usually wrong spec. Unsetting a required field is refused by schema validation, which names it. For narrative steps, match by "stepNumber" and use "action: 'insert'" (shifts subsequent steps up) or "action: 'delete'" (shifts subsequent steps down and removes it). Renumbering RELOCATES every flow jump field (onTrueStep/onFalseStep/cases.step/defaultStep/endStep/catches.step/finallyStep/toStep) in the same narrative; deleting a step that is a jump target is rejected until the referrers are retargeted. Inserting AT a jump target relocates those jumps past the inserted step by default (a NOTICE is returned) \u2014 add "captureJumps": true on the inserted step to retarget entry jumps onto it (loop/try endStep region tails always relocate with the body and are never captured). Reference ids in deltas may use LOCAL names \u2014 they are qualified against the spec's namespace exactly as the loader would. Per-spec lint suppression: set "lint: { allow: [{ code, reason }] }" to silence a WARNING code on this spec only (errors always surface; stale allows are flagged).`)
23525
23842
  }
23526
23843
  },
23527
23844
  ({ kind, id, delta }) => {
@@ -23543,8 +23860,8 @@ NOTICE:
23543
23860
  {
23544
23861
  description: "Get the completeness status dashboard of the SDD spec tree. Supports scoping and recursion controls.",
23545
23862
  inputSchema: {
23546
- subsystem: import_zod9.z.string().optional().describe("Only show status for the specified subsystem"),
23547
- recursive: import_zod9.z.boolean().optional().describe("Whether to recursively load subprojects (default: true)")
23863
+ subsystem: import_zod10.z.string().optional().describe("Only show status for the specified subsystem"),
23864
+ recursive: import_zod10.z.boolean().optional().describe("Whether to recursively load subprojects (default: true)")
23548
23865
  }
23549
23866
  },
23550
23867
  ({ subsystem, recursive }) => {
@@ -23578,7 +23895,7 @@ NOTICE:
23578
23895
  {
23579
23896
  description: "Compose the LIVE delegation brief for one resolved agent: the fully rendered instruction body plus the ownedPaths/readPaths scope fence \u2014 the dynamic replacement for generated per-component agent files. Fetch a brief and spawn a generic subagent with it: always fresh after a re-lock, no session restart needed. List agent ids via listAgents or resources/list (the wairon-agent:// entries).",
23580
23897
  inputSchema: {
23581
- agentId: import_zod9.z.string().describe("The resolved agent id (list via listAgents or resources/list)")
23898
+ agentId: import_zod10.z.string().describe("The resolved agent id (list via listAgents or resources/list)")
23582
23899
  }
23583
23900
  },
23584
23901
  ({ agentId }) => {
@@ -23615,22 +23932,22 @@ NOTICE:
23615
23932
  reg(server, "sdd_host_initialize_project", {
23616
23933
  description: "Hosted project lifecycle (execute-primary): initialize a new hosted project into its REQUIRED owner organization unit (with an optional profile selection). Executes directly when your resolved permission is yes; when it is approval, a pending approval request is created instead.",
23617
23934
  inputSchema: {
23618
- id: import_zod9.z.string().describe("Requested project id"),
23619
- displayName: import_zod9.z.string().optional(),
23620
- description: import_zod9.z.string().optional(),
23621
- ownerUnitId: import_zod9.z.string().describe("REQUIRED organization unit that owns the new project (every project is placed at creation)"),
23622
- environment: import_zod9.z.string().optional()
23935
+ id: import_zod10.z.string().describe("Requested project id"),
23936
+ displayName: import_zod10.z.string().optional(),
23937
+ description: import_zod10.z.string().optional(),
23938
+ ownerUnitId: import_zod10.z.string().describe("REQUIRED organization unit that owns the new project (every project is placed at creation)"),
23939
+ environment: import_zod10.z.string().optional()
23623
23940
  }
23624
23941
  }, hostedStub);
23625
23942
  reg(server, "sdd_host_get_approval_status", {
23626
23943
  description: "Hosted project lifecycle: read the status of one of your approval requests.",
23627
- inputSchema: { requestId: import_zod9.z.string() }
23944
+ inputSchema: { requestId: import_zod10.z.string() }
23628
23945
  }, hostedStub);
23629
23946
  reg(server, "sdd_host_await_approval", {
23630
23947
  description: "Hosted project lifecycle: long-poll one of YOUR approval requests until it is decided (approved requests auto-execute, so an approval resolves as completed) or the timeout elapses. Returns the request in its current state.",
23631
23948
  inputSchema: {
23632
- requestId: import_zod9.z.string(),
23633
- timeoutSeconds: import_zod9.z.number().optional().describe("How long to wait server-side (clamped; 0 returns the current state immediately)")
23949
+ requestId: import_zod10.z.string(),
23950
+ timeoutSeconds: import_zod10.z.number().optional().describe("How long to wait server-side (clamped; 0 returns the current state immediately)")
23634
23951
  }
23635
23952
  }, hostedStub);
23636
23953
  reg(server, "sdd_landscape_list_reachable_projects", {
@@ -23639,7 +23956,7 @@ NOTICE:
23639
23956
  }, hostedStub);
23640
23957
  reg(server, "sdd_landscape_list_reachable_project_interfaces", {
23641
23958
  description: "Hosted landscape: redacted, audience-filtered public interface summaries of one reachable target project (Forbidden outside the reachable set; private by default).",
23642
- inputSchema: { projectId: import_zod9.z.string().describe("The reachable target project id") }
23959
+ inputSchema: { projectId: import_zod10.z.string().describe("The reachable target project id") }
23643
23960
  }, hostedStub);
23644
23961
  reg(server, "sdd_landscape_list_visible_surfaces", {
23645
23962
  description: "Hosted landscape: the visibility-resolved discovery catalog for the BOUND project \u2014 every target the organization unit graph exposes to it (open-within-tenant, closed groups hidden, exposeTo grants honored), with audience distance and audience-filtered summaries. No relation required.",
@@ -23647,7 +23964,7 @@ NOTICE:
23647
23964
  }, hostedStub);
23648
23965
  reg(server, "sdd_landscape_get_project_surface", {
23649
23966
  description: `Hosted landscape: fetch a visible target project's CONTRACT-GRADE surface snapshot (full method contracts, dispatch tables, type closure) at your audience-distance ceiling, origin "exchanged" \u2014 save it under .wai/surfaces/ (wairon surface import) so your adapters validate against the declared contract.`,
23650
- inputSchema: { projectId: import_zod9.z.string().describe("The visible target project id") }
23967
+ inputSchema: { projectId: import_zod10.z.string().describe("The visible target project id") }
23651
23968
  }, hostedStub);
23652
23969
  reg(server, "sdd_host_pack_list", {
23653
23970
  description: "Hosted project ops: list the BOUND project's registered extension packs (requires project:read over it).",
@@ -23656,8 +23973,8 @@ NOTICE:
23656
23973
  reg(server, "sdd_host_pack_install", {
23657
23974
  description: "Hosted project ops: install a DECLARATIVE extension pack (profiles + language/platform tables \u2014 never rule/code packs) into the BOUND project (requires project:admin over it).",
23658
23975
  inputSchema: {
23659
- name: import_zod9.z.string().describe("Pack name (letters, digits, dot, underscore, hyphen)"),
23660
- content: import_zod9.z.string().describe("The declarative pack YAML content")
23976
+ name: import_zod10.z.string().describe("Pack name (letters, digits, dot, underscore, hyphen)"),
23977
+ content: import_zod10.z.string().describe("The declarative pack YAML content")
23661
23978
  }
23662
23979
  }, hostedStub);
23663
23980
  reg(server, "sdd_host_policy_evaluate", {
@@ -23670,13 +23987,13 @@ NOTICE:
23670
23987
  }, hostedStub);
23671
23988
  reg(server, "sdd_host_produce", {
23672
23989
  description: "Hosted project ops: run a configured producer projection (Notion/Miro) of the BOUND project to the named target (requires project:admin over it).",
23673
- inputSchema: { target: import_zod9.z.string().describe("The configured producer target (e.g. notion, miro)") }
23990
+ inputSchema: { target: import_zod10.z.string().describe("The configured producer target (e.g. notion, miro)") }
23674
23991
  }, hostedStub);
23675
23992
  reg(server, "sdd_host_commit_project", {
23676
23993
  description: "Hosted project ops: publish a DELIBERATE, .wai/-scoped commit+push of the BOUND project's specs to its bound repository (commit = local save, push = the actual backup; a clean scope publishes nothing). The data plane binds ONE project, so there is no project argument. Requires project:write over it.",
23677
23994
  inputSchema: {
23678
- subsystem: import_zod9.z.string().optional().describe("Narrow staging to .wai/specs/<subsystem>/ (a convenience \u2014 git history stays per-repo)"),
23679
- message: import_zod9.z.string().optional().describe("Commit message; defaults to a timestamped wairon message")
23995
+ subsystem: import_zod10.z.string().optional().describe("Narrow staging to .wai/specs/<subsystem>/ (a convenience \u2014 git history stays per-repo)"),
23996
+ message: import_zod10.z.string().optional().describe("Commit message; defaults to a timestamped wairon message")
23680
23997
  }
23681
23998
  }, hostedStub);
23682
23999
  reg(server, "sdd_host_export_tree", {
@@ -23686,8 +24003,8 @@ NOTICE:
23686
24003
  reg(server, "sdd_host_import_tree", {
23687
24004
  description: "Hosted spec-tree transfer: REPLACE the BOUND project's spec tree from a base64 .waitree archive. Requires project:admin over the project (strictly above project:write \u2014 this replaces the whole design, not one spec). Refuses an occupied destination unless replaceExisting is set, always refuses executable entries (rule/code packs install only through the trusted filesystem), and moves the previous tree aside to a backup whose path is returned.",
23688
24005
  inputSchema: {
23689
- archiveBase64: import_zod9.z.string().describe("The .waitree archive bytes, base64-encoded"),
23690
- replaceExisting: import_zod9.z.boolean().optional().describe("Replace a tree already present (backed up first); without it an occupied destination is refused")
24006
+ archiveBase64: import_zod10.z.string().describe("The .waitree archive bytes, base64-encoded"),
24007
+ replaceExisting: import_zod10.z.boolean().optional().describe("Replace a tree already present (backed up first); without it an occupied destination is refused")
23691
24008
  }
23692
24009
  }, hostedStub);
23693
24010
  }
@@ -23732,13 +24049,13 @@ async function startMcpServer() {
23732
24049
  } catch {
23733
24050
  }
23734
24051
  }
23735
- var import_mcp, import_stdio, import_zod9, import_types3, fs20, path30, import_url, SERVER_BUILD_STAMP, STALE_SERVER_WARNING, SPEC_WRITE_TOOLS, listChangedEmitters, STORE_MANAGED_FIELDS, ALWAYS_CARRIED_FIELDS, SKILL_RESOURCE_MIME, AGENT_BRIEF_SCHEME;
24052
+ var import_mcp, import_stdio, import_zod10, import_types3, fs20, path30, import_url, SERVER_BUILD_STAMP, STALE_SERVER_WARNING, SPEC_WRITE_TOOLS, listChangedEmitters, STORE_MANAGED_FIELDS, ALWAYS_CARRIED_FIELDS, SKILL_RESOURCE_MIME, AGENT_BRIEF_SCHEME;
23736
24053
  var init_server = __esm({
23737
24054
  "src/mcp/server.ts"() {
23738
24055
  "use strict";
23739
24056
  import_mcp = require("@modelcontextprotocol/sdk/server/mcp.js");
23740
24057
  import_stdio = require("@modelcontextprotocol/sdk/server/stdio.js");
23741
- import_zod9 = require("zod");
24058
+ import_zod10 = require("zod");
23742
24059
  import_types3 = require("@modelcontextprotocol/sdk/types.js");
23743
24060
  fs20 = __toESM(require("fs"));
23744
24061
  path30 = __toESM(require("path"));
@@ -23758,6 +24075,7 @@ var init_server = __esm({
23758
24075
  init_authoring();
23759
24076
  init_variants();
23760
24077
  init_agent_resolver();
24078
+ init_budget_policy();
23761
24079
  init_surfaces();
23762
24080
  SERVER_BUILD_STAMP = captureBuildStamp(__filename);
23763
24081
  STALE_SERVER_WARNING = "\n\n\u26A0 STALE SERVER: the wairon build on disk changed after this MCP server started. Restart the MCP session (e.g. /mcp reconnect) before further spec edits \u2014 writes through a stale server can silently drop fields introduced by newer schemas.";
@@ -24348,8 +24666,39 @@ var WAIRON_MANAGED_BANNER = `<!-- ${WAIRON_MANAGED_MARKER} \u2014 generated by \
24348
24666
  // src/exporters/claude.ts
24349
24667
  var path22 = __toESM(require("path"));
24350
24668
  init_fs();
24669
+ var MODEL_BY_TIER = {
24670
+ small: "haiku",
24671
+ standard: "sonnet",
24672
+ large: "opus",
24673
+ frontier: "fable"
24674
+ };
24675
+ var TOOLS_BY_CLASS = {
24676
+ "read-only": ["Read", "Grep", "Glob"],
24677
+ implement: ["Read", "Grep", "Glob", "Edit", "Write", "Bash"],
24678
+ orchestrate: ["Agent", "SendMessage", "TodoWrite"],
24679
+ // `full` means "inherit everything" — expressed by omitting the field.
24680
+ full: void 0
24681
+ };
24682
+ function toolsFor(budget) {
24683
+ const base = TOOLS_BY_CLASS[budget.toolClass];
24684
+ if (!base) return void 0;
24685
+ if (budget.allowNestedDelegation && !base.includes("Agent")) {
24686
+ return [...base, "Agent"];
24687
+ }
24688
+ if (!budget.allowNestedDelegation) {
24689
+ return base.filter((t) => t !== "Agent");
24690
+ }
24691
+ return base;
24692
+ }
24693
+ function mcpServersFor(access) {
24694
+ return access === "none" ? "[]" : void 0;
24695
+ }
24696
+ function yamlScalar(value) {
24697
+ return /[:#\n]/.test(value) ? `"${value.replace(/"/g, '\\"')}"` : value;
24698
+ }
24351
24699
  var ClaudeExporter = class {
24352
- constructor() {
24700
+ constructor(options = {}) {
24701
+ this.options = options;
24353
24702
  this.targetType = "claude";
24354
24703
  }
24355
24704
  outputPath(ctx) {
@@ -24358,18 +24707,22 @@ var ClaudeExporter = class {
24358
24707
  return path22.resolve(projectRoot2, outputDir, `${agent.id.replace(/::/g, "--")}.md`);
24359
24708
  }
24360
24709
  export(ctx) {
24361
- const { agent, renderedInstructions } = ctx;
24710
+ const { agent, renderedInstructions, budget } = ctx;
24362
24711
  const filePath = this.outputPath(ctx);
24363
- const safeDescription = agent.description.includes(":") || agent.description.includes("#") ? `"${agent.description.replace(/"/g, '\\"')}"` : agent.description;
24364
- const content = [
24365
- "---",
24712
+ const frontmatter = [
24366
24713
  `name: ${agent.name}`,
24367
- `description: ${safeDescription}`,
24368
- "---",
24369
- "",
24370
- renderedInstructions,
24371
- ""
24372
- ].join("\n");
24714
+ `description: ${yamlScalar(agent.description)}`
24715
+ ];
24716
+ if (budget && this.options.emitBudget) {
24717
+ if (budget.modelTier) frontmatter.push(`model: ${MODEL_BY_TIER[budget.modelTier]}`);
24718
+ if (budget.effort) frontmatter.push(`effort: ${budget.effort}`);
24719
+ if (budget.maxTurns !== void 0) frontmatter.push(`maxTurns: ${budget.maxTurns}`);
24720
+ const tools = toolsFor(budget);
24721
+ if (tools) frontmatter.push(`tools: ${tools.join(", ")}`);
24722
+ const servers = mcpServersFor(budget.mcp);
24723
+ if (servers) frontmatter.push(`mcpServers: ${servers}`);
24724
+ }
24725
+ const content = ["---", ...frontmatter, "---", "", renderedInstructions, ""].join("\n");
24373
24726
  const changed = writeFileIfChanged(filePath, content);
24374
24727
  return { outputPath: filePath, content, unchanged: !changed };
24375
24728
  }
@@ -24912,12 +25265,14 @@ init_extensions();
24912
25265
  init_agent_resolver();
24913
25266
 
24914
25267
  // src/exporters/generate.ts
25268
+ init_execution_profile();
25269
+ init_budget_policy();
24915
25270
  init_fs();
24916
25271
 
24917
25272
  // src/exporters/registry.ts
24918
25273
  init_errors();
24919
25274
  var EXPORTERS = /* @__PURE__ */ new Map([
24920
- ["claude", new ClaudeExporter()],
25275
+ ["claude", new ClaudeExporter({ emitBudget: true })],
24921
25276
  ["gemini", new GeminiExporter()],
24922
25277
  ["agy", new GeminiExporter()],
24923
25278
  ["cursor", new ClaudeExporter()],
@@ -24941,6 +25296,11 @@ function generateAgent(agent, projectConfig, options = {}) {
24941
25296
  const rendered = `${WAIRON_MANAGED_BANNER}
24942
25297
  ${composeAgentBrief(agent.id).instructions}`;
24943
25298
  const results = [];
25299
+ const budget = resolveBudget(
25300
+ deriveExecutionProfile(agent),
25301
+ projectConfig.execution,
25302
+ agent.id
25303
+ );
24944
25304
  for (const agentTarget of agent.targets) {
24945
25305
  const targetConfig = resolveTargetConfig(agentTarget, projectConfig);
24946
25306
  if (!targetConfig) continue;
@@ -24954,7 +25314,8 @@ ${composeAgentBrief(agent.id).instructions}`;
24954
25314
  template,
24955
25315
  renderedInstructions: rendered,
24956
25316
  projectRoot: projectRoot2,
24957
- target: targetConfig
25317
+ target: targetConfig,
25318
+ budget
24958
25319
  }));
24959
25320
  }
24960
25321
  }
@@ -25354,6 +25715,9 @@ function buildProjectConfig(name, targets, now, projectType) {
25354
25715
  name,
25355
25716
  projectType,
25356
25717
  targets,
25718
+ // New projects start with budgets off — the same output a project got
25719
+ // before execution budgets existed. Opt in with `execution.tier`.
25720
+ execution: { tier: "off", overrides: {} },
25357
25721
  rules: {
25358
25722
  noOverlappingOwnership: true,
25359
25723
  requireOwnedPaths: true,
@@ -41509,10 +41873,10 @@ async function runSurface(action, options = {}) {
41509
41873
  case "generate-children": {
41510
41874
  const written = generateChildSnapshots();
41511
41875
  if (!written.length) {
41512
- logger.info("No chained child projects found \u2014 nothing to generate.");
41876
+ logger.info("Delivered surfaces are already up to date \u2014 nothing rewritten.");
41513
41877
  return;
41514
41878
  }
41515
- logger.success(`Wrote the family surface into ${written.length} chained child project(s):`);
41879
+ logger.success(`Updated ${written.length} delivered surface(s):`);
41516
41880
  for (const p of written) logger.info(` ${p}`);
41517
41881
  return;
41518
41882
  }
@@ -42097,6 +42461,113 @@ function report(outcome) {
42097
42461
  }
42098
42462
  }
42099
42463
 
42464
+ // src/cli/index.ts
42465
+ init_budget_policy();
42466
+
42467
+ // src/commands/execution.ts
42468
+ var import_chalk21 = __toESM(require("chalk"));
42469
+ init_logger();
42470
+ init_errors();
42471
+ init_loader();
42472
+ init_agent_resolver();
42473
+ init_execution_profile();
42474
+ init_budget_policy();
42475
+ init_execution();
42476
+ function assertInitialized() {
42477
+ if (!isProjectInitialized()) {
42478
+ throw new WaironError("Not a wairon project \u2014 run `wairon init` first.");
42479
+ }
42480
+ }
42481
+ var TIER_COLOR = {
42482
+ small: import_chalk21.default.green,
42483
+ standard: import_chalk21.default.cyan,
42484
+ large: import_chalk21.default.yellow,
42485
+ frontier: import_chalk21.default.red
42486
+ };
42487
+ async function showExecution() {
42488
+ assertInitialized();
42489
+ const config = loadProjectConfig();
42490
+ const tier = config.execution.tier;
42491
+ logger.header("Execution budgets");
42492
+ logger.info(`Tier: ${tier === "off" ? import_chalk21.default.gray(tier) : import_chalk21.default.bold(tier)}`);
42493
+ logger.info(import_chalk21.default.gray(BUDGET_TIER_DESCRIPTIONS[tier]));
42494
+ if (tier === "off") {
42495
+ logger.blank();
42496
+ logger.info("No budgets are derived. Generated agent files and briefs carry");
42497
+ logger.info("what they carried before this feature existed.");
42498
+ logger.info(`Enable with ${import_chalk21.default.bold("wairon execution set-tier default")}.`);
42499
+ return;
42500
+ }
42501
+ const agents = resolveAgentTopology();
42502
+ if (agents.length === 0) {
42503
+ logger.blank();
42504
+ logger.warn("No agents in the topology yet \u2014 nothing to budget.");
42505
+ return;
42506
+ }
42507
+ logger.blank();
42508
+ const rows = agents.map((agent) => {
42509
+ const profile = deriveExecutionProfile(agent);
42510
+ const budget = resolveBudget(profile, config.execution, agent.id);
42511
+ return { agent, profile, budget };
42512
+ });
42513
+ const idWidth = Math.max(...rows.map((r) => r.agent.id.length));
42514
+ for (const { agent, profile, budget } of rows) {
42515
+ if (!budget) continue;
42516
+ const model = budget.modelTier ? TIER_COLOR[budget.modelTier](budget.modelTier.padEnd(9)) : import_chalk21.default.gray("(inherit)");
42517
+ const overridden = config.execution.overrides[agent.id] ? import_chalk21.default.magenta(" *override") : "";
42518
+ logger.info(
42519
+ ` ${agent.id.padEnd(idWidth)} ${model} ${import_chalk21.default.gray(
42520
+ `${budget.toolClass}, ${budget.maxTurns ?? "-"} turns, mcp:${budget.mcp}${budget.effort ? `, effort:${budget.effort}` : ""}`
42521
+ )}${overridden}`
42522
+ );
42523
+ logger.info(` ${" ".repeat(idWidth)} ${import_chalk21.default.gray(profile.rationale)}`);
42524
+ }
42525
+ const overrideCount = Object.keys(config.execution.overrides).length;
42526
+ if (overrideCount > 0) {
42527
+ logger.blank();
42528
+ logger.info(import_chalk21.default.magenta(`${overrideCount} per-agent override(s) in .wai/project.yaml.`));
42529
+ }
42530
+ const frontier = rows.filter((r) => r.budget?.modelTier === "frontier");
42531
+ if (frontier.length > 0) {
42532
+ logger.blank();
42533
+ logger.warn(
42534
+ `${frontier.length} agent(s) are pinned to the frontier tier by override: ${frontier.map((r) => r.agent.id).join(", ")}.`
42535
+ );
42536
+ logger.warn(
42537
+ "Frontier is a sparring partner for questions the specs do not settle, not an owner tier. An owner that genuinely needs it usually points at a component doing too much \u2014 consider splitting it."
42538
+ );
42539
+ }
42540
+ }
42541
+ async function setExecutionTier(raw) {
42542
+ assertInitialized();
42543
+ const parsed = BudgetTierSchema.safeParse(raw);
42544
+ if (!parsed.success) {
42545
+ throw new WaironError(
42546
+ `Unknown tier "${raw}" \u2014 expected one of: ${BudgetTierSchema.options.join(", ")}.`
42547
+ );
42548
+ }
42549
+ const tier = parsed.data;
42550
+ const config = loadProjectConfig();
42551
+ const previous = config.execution.tier;
42552
+ if (previous === tier) {
42553
+ logger.info(`Execution tier is already ${import_chalk21.default.bold(tier)}.`);
42554
+ return;
42555
+ }
42556
+ config.execution = { ...config.execution, tier };
42557
+ saveProjectConfig(config);
42558
+ logger.success(`Execution tier: ${import_chalk21.default.gray(previous)} \u2192 ${import_chalk21.default.bold(tier)}`);
42559
+ logger.info(BUDGET_TIER_DESCRIPTIONS[tier]);
42560
+ logger.blank();
42561
+ logger.info(`Run ${import_chalk21.default.bold("wairon execution show")} to see what each agent now gets,`);
42562
+ logger.info(`then ${import_chalk21.default.bold("wairon generate")} to write it into agent files (if materialized).`);
42563
+ if (tier === "trade" || tier === "aggressive") {
42564
+ logger.blank();
42565
+ logger.warn(
42566
+ "This tier trades quality for cost. Measure on real work before keeping it \u2014 a cheaper delegation that needs a second round trip is not cheaper."
42567
+ );
42568
+ }
42569
+ }
42570
+
42100
42571
  // src/cli/index.ts
42101
42572
  cleanStaleBinary();
42102
42573
  var program = new import_commander.Command();
@@ -42167,7 +42638,7 @@ async function runLock2(options) {
42167
42638
  const childPaths = generateChildSnapshots();
42168
42639
  if (childPaths.length > 0) {
42169
42640
  logger.blank();
42170
- logger.success(`Regenerated the family/sibling surfaces into ${childPaths.length} chained child snapshot(s):`);
42641
+ logger.success(`Updated ${childPaths.length} delivered surface(s) in the chained children:`);
42171
42642
  for (const p of childPaths) logger.info(` ${p}`);
42172
42643
  }
42173
42644
  logger.blank();
@@ -42253,6 +42724,13 @@ async function runPack(action, arg, opts = {}) {
42253
42724
  else if (action === "sync") await syncPacks();
42254
42725
  else throw new WaironError("unknown pack action (expected init | build | install | uninstall | which | use | unuse | bundle | sync | add | list | remove)");
42255
42726
  }
42727
+ var executionCmd = program.command("execution").description("Execution budgets: what each agent's work is like and the model/turn/tool allowance it earns");
42728
+ executionCmd.command("show").alias("ls").description("Show the current budget tier and the derived allowance for every agent").action(async () => {
42729
+ await showExecution();
42730
+ });
42731
+ executionCmd.command("set-tier <tier>").description("Set the aggressiveness dial: off | free | default | trade | aggressive").action(async (tier) => {
42732
+ await setExecutionTier(tier);
42733
+ });
42256
42734
  var rulesCmd = program.command("rules").description("The SDD conformance rule registry (the architecture linter)");
42257
42735
  rulesCmd.command("list").alias("ls").description("List every conformance rule, its issue codes, default severities, and project overrides").action(async () => {
42258
42736
  await runRules();
@@ -42355,6 +42833,13 @@ async function runAgent(action, id) {
42355
42833
  logger.info("Read paths:");
42356
42834
  for (const p of brief.readPaths) logger.info(` ${p}`);
42357
42835
  }
42836
+ if (brief.budget && brief.profile) {
42837
+ logger.blank();
42838
+ logger.info("Execution budget (advisory \u2014 apply when spawning):");
42839
+ for (const line2 of describeBudget(brief.profile, brief.budget)) {
42840
+ logger.info(` ${line2.replace(/^- \*\*(.+?)\*\*: /, "$1: ")}`);
42841
+ }
42842
+ }
42358
42843
  logger.blank();
42359
42844
  console.log(brief.instructions);
42360
42845
  return;