@wairon/cli 5.1.1-dev.16 → 5.1.1-dev.17

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1092,7 +1092,7 @@ var init_defaults = __esm({
1092
1092
  copilot: ".github/prompts",
1093
1093
  codex: ".codex/agents"
1094
1094
  };
1095
- WAIRON_VERSION = "5.1.1-dev.16";
1095
+ WAIRON_VERSION = "5.1.1-dev.17";
1096
1096
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
1097
1097
  ARCHITECT_AGENT_ID = "agent-architect";
1098
1098
  ARCHITECT_TEMPLATE_ID = "architect";
@@ -1406,7 +1406,7 @@ function defaultNarrativeDetail(component) {
1406
1406
  if (componentType === "Portal" || componentType === "Observer" || componentType === "Adapter") {
1407
1407
  return "calls-only";
1408
1408
  }
1409
- if (componentType === "Store" || componentType === "Index" || componentType === "Registry") {
1409
+ if (componentType === "Store" || componentType === "Index" || componentType === "Query" || componentType === "Registry") {
1410
1410
  return "intent";
1411
1411
  }
1412
1412
  return "full";
@@ -1414,6 +1414,17 @@ function defaultNarrativeDetail(component) {
1414
1414
  function isPattern(component) {
1415
1415
  return PATTERN_TYPES.has(component.componentType);
1416
1416
  }
1417
+ function isLogic(component) {
1418
+ const componentType = component.componentType;
1419
+ return componentType === "Orchestrator" || componentType === "Supervisor" || componentType === "Actor" || componentType === "Specialist";
1420
+ }
1421
+ function holdsState(component) {
1422
+ const componentType = component.componentType;
1423
+ return componentType === "Store" || componentType === "Index" || componentType === "Supervisor" || componentType === "Actor";
1424
+ }
1425
+ function isRetired(component) {
1426
+ return RETIRED_STEREOTYPES.has(component.componentType);
1427
+ }
1417
1428
  function passesIntentFloor(text, methodName) {
1418
1429
  if (!text) return false;
1419
1430
  const t = text.trim();
@@ -1439,7 +1450,7 @@ function implementationSourceFiles(impl) {
1439
1450
  for (const method of impl.methods ?? []) add(method.sourcePath);
1440
1451
  return files;
1441
1452
  }
1442
- var import_zod8, 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, FindingDeclarationSchema, MethodSignatureSchema, INTENT_FLOOR_MIN_CHARS, InterfaceSpecSchema, NarrativeStepTypeSchema, LoopKindSchema, SwitchCaseSchema, CatchClauseSchema, ParallelBranchSchema, NarrativeStepSchema, NarrativeDetailSchema, ConformanceTierSchema, MethodImplementationSchema, ImplementationSpecSchema, TypeKindSchema, TypeFieldSchema, TypeMethodSchema, InvariantSchema, TypeSpecSchema, SurfaceOriginSchema, SurfaceTypeDefSchema, SurfaceContractEntrySchema, SurfaceSnapshotSchema, NamedOpenApiSpecSchema, GroupSpecSchema;
1453
+ var import_zod8, SpecIdSchema, SpecStatusSchema, BoundaryItemSchema, RequirementItemSchema, DatabaseSpecSchema, DiagramConfigSchema, SURFACE_AUDIENCES, SurfaceAudienceSchema, SystemPublicInterfaceSchema, SystemSpecSchema, PublicInterfaceTypeSchema, PublicInterfaceSchema, TrustedLinkSchema, LintAllowSchema, LintConfigSchema, ExtDataSchema, LifecycleEntrypointSchema, SubsystemSpecSchema, ComponentTypeSchema, PATTERN_TYPES, RETIRED_STEREOTYPES, PortalTypeSchema, DispatchBindingSchema, DurabilitySchema, DependencyClassSchema, PatternRefSchema, EventBindingSchema, ExternalLinkTypeSchema, ExternalLinkSchema, PortalAuthSchemeSchema, PortalAuthSchema, ComponentSpecSchema, HttpMethodSchema, TransportSchema, EndpointSchema, SEMANTIC_GUARANTEES, GuaranteeSchema, MethodParamSchema, FindingDeclarationSchema, MethodSignatureSchema, INTENT_FLOOR_MIN_CHARS, InterfaceSpecSchema, NarrativeStepTypeSchema, LoopKindSchema, SwitchCaseSchema, CatchClauseSchema, ParallelBranchSchema, NarrativeStepSchema, NarrativeDetailSchema, ConformanceTierSchema, MethodImplementationSchema, ImplementationSpecSchema, TypeKindSchema, TypeFieldSchema, TypeMethodSchema, InvariantSchema, TypeSpecSchema, SurfaceOriginSchema, SurfaceTypeDefSchema, SurfaceContractEntrySchema, SurfaceSnapshotSchema, NamedOpenApiSpecSchema, GroupSpecSchema;
1443
1454
  var init_specs = __esm({
1444
1455
  "src/models/specs.ts"() {
1445
1456
  "use strict";
@@ -1605,21 +1616,28 @@ var init_specs = __esm({
1605
1616
  "Actor",
1606
1617
  "Store",
1607
1618
  "Index",
1619
+ "Query",
1620
+ // Repository member for computed reads over its Store
1608
1621
  "Registry",
1609
1622
  "Adapter",
1610
1623
  "Observer",
1611
- "Specialist",
1612
1624
  "View",
1613
1625
  // Pure presenter/UI component
1614
1626
  // Patterns (compositions of blocks)
1615
1627
  "Repository",
1616
- "Gateway",
1617
1628
  "FeatureComponent",
1618
1629
  // Logic Hook + View Presenter pattern
1619
- "RouterComponent"
1630
+ "RouterComponent",
1620
1631
  // Switch/routing component pattern
1632
+ // Retired stereotypes: still parsed so a tree using them loads and the
1633
+ // rules can report them (STEREOTYPE_RETIRED), never authored new
1634
+ "Specialist",
1635
+ // logic is an Orchestrator with a dependencyClass
1636
+ "Gateway"
1637
+ // a gateway is a Portal with the gateway variant
1621
1638
  ]);
1622
- PATTERN_TYPES = /* @__PURE__ */ new Set(["Repository", "Gateway", "FeatureComponent", "RouterComponent"]);
1639
+ PATTERN_TYPES = /* @__PURE__ */ new Set(["Repository", "FeatureComponent", "RouterComponent"]);
1640
+ RETIRED_STEREOTYPES = /* @__PURE__ */ new Set(["Specialist", "Gateway"]);
1623
1641
  PortalTypeSchema = import_zod8.z.enum(["HTTP_API", "gRPC", "GraphQL", "MessageBus", "CLI", "NamedPipe", "IPC", "Custom"]);
1624
1642
  DispatchBindingSchema = import_zod8.z.object({
1625
1643
  /** Capability name exactly as dispatched at runtime (e.g. "shadow_module.get"). */
@@ -1632,6 +1650,7 @@ var init_specs = __esm({
1632
1650
  description: import_zod8.z.string().optional()
1633
1651
  });
1634
1652
  DurabilitySchema = import_zod8.z.enum(["ram-projection", "durable", "read-through", "cache"]);
1653
+ DependencyClassSchema = import_zod8.z.enum(["pure", "read"]);
1635
1654
  PatternRefSchema = import_zod8.z.object({
1636
1655
  id: import_zod8.z.string(),
1637
1656
  version: import_zod8.z.string().optional()
@@ -1686,6 +1705,8 @@ var init_specs = __esm({
1686
1705
  dispatch: import_zod8.z.array(DispatchBindingSchema).optional(),
1687
1706
  /** Store-only: whether held state survives restart (see DurabilitySchema). */
1688
1707
  durability: DurabilitySchema.optional(),
1708
+ /** Orchestrator-only: what the logic may depend on; unset means a workflow (see DependencyClassSchema). */
1709
+ dependencyClass: DependencyClassSchema.optional(),
1689
1710
  /** Topics this component publishes to (see EventBindingSchema). */
1690
1711
  emits: import_zod8.z.array(EventBindingSchema).optional(),
1691
1712
  /** Topics this component consumes (see EventBindingSchema) — typical on Observers. */
@@ -1776,9 +1797,10 @@ var init_specs = __esm({
1776
1797
  }).optional(),
1777
1798
  /**
1778
1799
  * The finding codes this method can report, each with its default severity
1779
- * and summary (see FindingDeclarationSchema). Each declared code must appear
1780
- * as a string literal in the method's source file (UNREALIZED_FINDING). A
1781
- * code is declared once per method.
1800
+ * and summary (see FindingDeclarationSchema). Each declared code must be
1801
+ * anchored in the method's source file as a string literal or a
1802
+ * property-access name (UNREALIZED_FINDING). A code is declared once per
1803
+ * method.
1782
1804
  */
1783
1805
  findings: import_zod8.z.array(FindingDeclarationSchema).superRefine((findings, ctx) => {
1784
1806
  const seen = /* @__PURE__ */ new Set();
@@ -14259,28 +14281,52 @@ var init_candidate = __esm({
14259
14281
  function globalVariantsDir() {
14260
14282
  return process.env.WAIRON_VARIANTS_DIR ?? path12.join(os3.homedir(), ".wairon", "variants");
14261
14283
  }
14262
- function readVariantsDir(dir) {
14284
+ function builtinVariantsDir() {
14285
+ const candidates = [
14286
+ path12.resolve(__dirname, "..", "templates", "variants"),
14287
+ // src/core & dist/cli
14288
+ path12.resolve(__dirname, "templates", "variants")
14289
+ // dist (library entry)
14290
+ ];
14291
+ return candidates.find((dir) => fs9.existsSync(dir)) ?? candidates[0];
14292
+ }
14293
+ function projectVariantsDir() {
14294
+ return path12.join(getProjectRoot(), ".wai", "variants");
14295
+ }
14296
+ function variantFiles(dir) {
14263
14297
  let entries;
14264
14298
  try {
14265
14299
  entries = fs9.readdirSync(dir, { withFileTypes: true });
14266
14300
  } catch {
14267
14301
  return [];
14268
14302
  }
14303
+ return entries.filter((e) => e.isFile() && /\.ya?ml$/i.test(e.name)).sort((a, b) => a.name.localeCompare(b.name)).map((e) => path12.join(dir, e.name));
14304
+ }
14305
+ function parseVariants(raw) {
14306
+ if (raw == null) return [];
14307
+ return (Array.isArray(raw) ? raw : [raw]).map((item) => VariantDefSchema.parse(item));
14308
+ }
14309
+ function reportSkippedFile(file, err) {
14310
+ console.error(`[variants] skipped "${file}": ${err instanceof Error ? err.message : String(err)}`);
14311
+ }
14312
+ function readVariantsDir(dir) {
14269
14313
  const out = [];
14270
- for (const e of entries.sort((a, b) => a.name.localeCompare(b.name))) {
14271
- if (!e.isFile() || !/\.ya?ml$/i.test(e.name)) continue;
14272
- const full = path12.join(dir, e.name);
14314
+ for (const file of variantFiles(dir)) {
14273
14315
  try {
14274
- const raw = readYamlFile(full);
14275
- if (raw == null) continue;
14276
- const items = Array.isArray(raw) ? raw : [raw];
14277
- for (const item of items) out.push(VariantDefSchema.parse(item));
14316
+ out.push(...parseVariants(readYamlFile(file)));
14278
14317
  } catch (err) {
14279
- console.error(`[variants] skipped "${full}": ${err instanceof Error ? err.message : String(err)}`);
14318
+ reportSkippedFile(file, err);
14280
14319
  }
14281
14320
  }
14282
14321
  return out;
14283
14322
  }
14323
+ function mergeById(...layers) {
14324
+ const byId = /* @__PURE__ */ new Map();
14325
+ for (const layer of layers) {
14326
+ for (const v of layer) byId.set(v.id, v);
14327
+ }
14328
+ return [...byId.values()];
14329
+ }
14284
14330
  function resolveVariantGuidance(component, allComponents, variantsById) {
14285
14331
  if (!component.variant) return null;
14286
14332
  const def = variantsById.get(component.variant);
@@ -14314,14 +14360,55 @@ function composeVariantGuidance(comps, allComponents, variantsById) {
14314
14360
  }
14315
14361
  function loadProjectVariants() {
14316
14362
  try {
14317
- const byId = /* @__PURE__ */ new Map();
14318
- for (const v of readVariantsDir(globalVariantsDir())) byId.set(v.id, v);
14319
- for (const v of readVariantsDir(path12.join(getProjectRoot(), ".wai", "variants"))) byId.set(v.id, v);
14320
- return [...byId.values()];
14363
+ return mergeById(
14364
+ readVariantsDir(builtinVariantsDir()),
14365
+ readVariantsDir(globalVariantsDir()),
14366
+ readVariantsDir(projectVariantsDir())
14367
+ );
14321
14368
  } catch {
14322
14369
  return [];
14323
14370
  }
14324
14371
  }
14372
+ function listProjectVariants() {
14373
+ return mergeById(readVariantsDir(projectVariantsDir()));
14374
+ }
14375
+ function rebaseProjectVariants(fromBase, toBase) {
14376
+ const rebased = [];
14377
+ for (const file of variantFiles(projectVariantsDir())) {
14378
+ const content = readFileOrNull(file);
14379
+ if (content === null) continue;
14380
+ let raw;
14381
+ let variants;
14382
+ try {
14383
+ raw = parseYaml(content, file);
14384
+ variants = parseVariants(raw);
14385
+ } catch (err) {
14386
+ reportSkippedFile(file, err);
14387
+ continue;
14388
+ }
14389
+ const matching = variants.filter((v) => v.base === fromBase);
14390
+ if (matching.length === 0) continue;
14391
+ writeFile(file, rebasedText(content, fromBase, toBase, withRebasedEntries(raw, fromBase, toBase)));
14392
+ for (const v of matching) {
14393
+ if (!rebased.includes(v.id)) rebased.push(v.id);
14394
+ }
14395
+ }
14396
+ return rebased;
14397
+ }
14398
+ function withRebasedEntries(raw, fromBase, toBase) {
14399
+ const rebase = (entry) => entry.base === fromBase ? { ...entry, base: toBase } : entry;
14400
+ return Array.isArray(raw) ? raw.map(rebase) : rebase(raw);
14401
+ }
14402
+ function rebasedText(content, fromBase, toBase, rebasedContent) {
14403
+ const escaped = fromBase.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
14404
+ const baseLine = new RegExp(`^([ \\t]*(?:-[ \\t]+)?base:[ \\t]*)(["']?)${escaped}\\2(?=[ \\t]*(?:#.*)?$)`, "gm");
14405
+ const edited = content.replace(baseLine, (_line, key, quote) => `${key}${quote}${toBase}${quote}`);
14406
+ try {
14407
+ if (JSON.stringify(parseYaml(edited)) === JSON.stringify(rebasedContent)) return edited;
14408
+ } catch {
14409
+ }
14410
+ return serializeYaml(rebasedContent);
14411
+ }
14325
14412
  var fs9, os3, path12, import_zod10, VariantDefSchema;
14326
14413
  var init_variants = __esm({
14327
14414
  "src/core/variants.ts"() {
@@ -14335,7 +14422,7 @@ var init_variants = __esm({
14335
14422
  VariantDefSchema = import_zod10.z.object({
14336
14423
  /** Variant id referenced by a component's `variant` (e.g. "publisher", "org/external-config-adapter"). */
14337
14424
  id: import_zod10.z.string().min(1),
14338
- /** The core stereotype this variant specializes — authoritative for generic semantics (Adapter, Specialist, …). */
14425
+ /** The core stereotype this variant specializes — authoritative for generic semantics (Adapter, Orchestrator, …). */
14339
14426
  base: import_zod10.z.string().min(1),
14340
14427
  /** How to implement a component of this variant — the recipe the implementer follows and reuses across same-variant components. */
14341
14428
  guidance: import_zod10.z.string().min(1),
@@ -23565,6 +23652,7 @@ __export(src_exports, {
23565
23652
  DEFAULT_TARGET_DIRS: () => DEFAULT_TARGET_DIRS,
23566
23653
  DatabaseSpecSchema: () => DatabaseSpecSchema,
23567
23654
  DeclarativePackSchema: () => DeclarativePackSchema,
23655
+ DependencyClassSchema: () => DependencyClassSchema,
23568
23656
  DesignDepthSchema: () => DesignDepthSchema,
23569
23657
  DiagramConfigSchema: () => DiagramConfigSchema,
23570
23658
  DispatchBindingSchema: () => DispatchBindingSchema,
@@ -23622,6 +23710,7 @@ __export(src_exports, {
23622
23710
  ProjectProfileSelectionSchema: () => ProjectProfileSelectionSchema,
23623
23711
  PublicInterfaceSchema: () => PublicInterfaceSchema,
23624
23712
  PublicInterfaceTypeSchema: () => PublicInterfaceTypeSchema,
23713
+ RETIRED_STEREOTYPES: () => RETIRED_STEREOTYPES,
23625
23714
  RegistrySchema: () => RegistrySchema,
23626
23715
  RequirementItemSchema: () => RequirementItemSchema,
23627
23716
  RulesConfigSchema: () => RulesConfigSchema,
@@ -23772,6 +23861,7 @@ __export(src_exports, {
23772
23861
  hasContext: () => hasContext,
23773
23862
  hasSpecTree: () => hasSpecTree,
23774
23863
  hashGateState: () => hashGateState,
23864
+ holdsState: () => holdsState,
23775
23865
  implementationSourceFiles: () => implementationSourceFiles,
23776
23866
  importSpecTree: () => importSpecTree,
23777
23867
  importSurface: () => importSurface,
@@ -23782,10 +23872,12 @@ __export(src_exports, {
23782
23872
  internalizeSubsystem: () => internalizeSubsystem,
23783
23873
  invalidateSpecCache: () => invalidateSpecCache,
23784
23874
  isDraftSubsystem: () => isDraftSubsystem,
23875
+ isLogic: () => isLogic,
23785
23876
  isOpenApiDocument: () => isOpenApiDocument,
23786
23877
  isPattern: () => isPattern,
23787
23878
  isProjectInitialized: () => isProjectInitialized,
23788
23879
  isProvidedBy: () => isProvidedBy,
23880
+ isRetired: () => isRetired,
23789
23881
  listChainedRoots: () => listChainedRoots,
23790
23882
  listDirectChainedSubprojects: () => listDirectChainedSubprojects,
23791
23883
  listExternalInterfaces: () => listExternalInterfaces,
@@ -23794,6 +23886,7 @@ __export(src_exports, {
23794
23886
  listFreeStandingDomains: () => listFreeStandingDomains,
23795
23887
  listInstalledPacks: () => listInstalledPacks,
23796
23888
  listMountSnapshots: () => listMountSnapshots,
23889
+ listProjectVariants: () => listProjectVariants,
23797
23890
  listResources: () => listResources,
23798
23891
  listRules: () => listRules2,
23799
23892
  listSkillNames: () => listSkillNames,
@@ -23864,6 +23957,7 @@ __export(src_exports, {
23864
23957
  readResource: () => readResource,
23865
23958
  readSkillResource: () => readSkillResource,
23866
23959
  readYamlFile: () => readYamlFile,
23960
+ rebaseProjectVariants: () => rebaseProjectVariants,
23867
23961
  rebaseReference: () => rebaseReference,
23868
23962
  recordProfileSelection: () => recordProfileSelection,
23869
23963
  registerExporter: () => registerExporter,
@@ -24271,6 +24365,7 @@ function loadProjectConfig4() {
24271
24365
  DEFAULT_TARGET_DIRS,
24272
24366
  DatabaseSpecSchema,
24273
24367
  DeclarativePackSchema,
24368
+ DependencyClassSchema,
24274
24369
  DesignDepthSchema,
24275
24370
  DiagramConfigSchema,
24276
24371
  DispatchBindingSchema,
@@ -24328,6 +24423,7 @@ function loadProjectConfig4() {
24328
24423
  ProjectProfileSelectionSchema,
24329
24424
  PublicInterfaceSchema,
24330
24425
  PublicInterfaceTypeSchema,
24426
+ RETIRED_STEREOTYPES,
24331
24427
  RegistrySchema,
24332
24428
  RequirementItemSchema,
24333
24429
  RulesConfigSchema,
@@ -24478,6 +24574,7 @@ function loadProjectConfig4() {
24478
24574
  hasContext,
24479
24575
  hasSpecTree,
24480
24576
  hashGateState,
24577
+ holdsState,
24481
24578
  implementationSourceFiles,
24482
24579
  importSpecTree,
24483
24580
  importSurface,
@@ -24488,10 +24585,12 @@ function loadProjectConfig4() {
24488
24585
  internalizeSubsystem,
24489
24586
  invalidateSpecCache,
24490
24587
  isDraftSubsystem,
24588
+ isLogic,
24491
24589
  isOpenApiDocument,
24492
24590
  isPattern,
24493
24591
  isProjectInitialized,
24494
24592
  isProvidedBy,
24593
+ isRetired,
24495
24594
  listChainedRoots,
24496
24595
  listDirectChainedSubprojects,
24497
24596
  listExternalInterfaces,
@@ -24500,6 +24599,7 @@ function loadProjectConfig4() {
24500
24599
  listFreeStandingDomains,
24501
24600
  listInstalledPacks,
24502
24601
  listMountSnapshots,
24602
+ listProjectVariants,
24503
24603
  listResources,
24504
24604
  listRules,
24505
24605
  listSkillNames,
@@ -24570,6 +24670,7 @@ function loadProjectConfig4() {
24570
24670
  readResource,
24571
24671
  readSkillResource,
24572
24672
  readYamlFile,
24673
+ rebaseProjectVariants,
24573
24674
  rebaseReference,
24574
24675
  recordProfileSelection,
24575
24676
  registerExporter,