@wildo-ai/saas-specifications 1.1.16 → 1.1.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.
Files changed (99) hide show
  1. package/dist/esm/_core/application-maturity/application-maturity-open-items.d.ts +2 -1
  2. package/dist/esm/_core/application-maturity/application-maturity-open-items.d.ts.map +1 -1
  3. package/dist/esm/_core/application-maturity/application-maturity-open-items.js +2 -1
  4. package/dist/esm/_core/application-maturity/application-maturity-open-items.js.map +1 -1
  5. package/dist/esm/_core/application-maturity/application-maturity-validation.js +1 -1
  6. package/dist/esm/_core/application-maturity/application-maturity-validation.js.map +1 -1
  7. package/dist/esm/_core/build-plan/build-plan-relationship-grouping.d.ts.map +1 -1
  8. package/dist/esm/_core/build-plan/build-plan-relationship-grouping.js +5 -2
  9. package/dist/esm/_core/build-plan/build-plan-relationship-grouping.js.map +1 -1
  10. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts +251 -0
  11. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts.map +1 -1
  12. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js +43 -0
  13. package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.js.map +1 -1
  14. package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts +43 -0
  15. package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts.map +1 -1
  16. package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js +58 -0
  17. package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js.map +1 -1
  18. package/dist/esm/_core/domain-plan/domain-plan-output-set-generation.schemas.d.ts +1 -0
  19. package/dist/esm/_core/domain-plan/domain-plan-output-set-generation.schemas.d.ts.map +1 -1
  20. package/dist/esm/_core/domain-plan/domain-plan-output-set-generation.schemas.js +5 -1
  21. package/dist/esm/_core/domain-plan/domain-plan-output-set-generation.schemas.js.map +1 -1
  22. package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.js +2 -0
  23. package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.js.map +1 -1
  24. package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.d.ts +3 -0
  25. package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.d.ts.map +1 -1
  26. package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.js +12 -1
  27. package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.js.map +1 -1
  28. package/dist/esm/_core/execution-view-specification.schemas.d.ts +19 -3
  29. package/dist/esm/_core/execution-view-specification.schemas.d.ts.map +1 -1
  30. package/dist/esm/_core/execution-view-specification.schemas.js +11 -1
  31. package/dist/esm/_core/execution-view-specification.schemas.js.map +1 -1
  32. package/dist/esm/_core/market/market-snapshot-generation.schemas.d.ts +15 -0
  33. package/dist/esm/_core/market/market-snapshot-generation.schemas.d.ts.map +1 -1
  34. package/dist/esm/_core/market/market-snapshot-generation.schemas.js +43 -0
  35. package/dist/esm/_core/market/market-snapshot-generation.schemas.js.map +1 -1
  36. package/dist/esm/_core/service-method/service-method-derivation.d.ts +17 -1
  37. package/dist/esm/_core/service-method/service-method-derivation.d.ts.map +1 -1
  38. package/dist/esm/_core/service-method/service-method-derivation.js +46 -0
  39. package/dist/esm/_core/service-method/service-method-derivation.js.map +1 -1
  40. package/dist/esm/_core/service-method/service-method-generation.schemas.d.ts +5 -0
  41. package/dist/esm/_core/service-method/service-method-generation.schemas.d.ts.map +1 -1
  42. package/dist/esm/_core/service-method/service-method.family-aspects.d.ts.map +1 -1
  43. package/dist/esm/_core/service-method/service-method.family-aspects.js +1 -0
  44. package/dist/esm/_core/service-method/service-method.family-aspects.js.map +1 -1
  45. package/dist/esm/_core/service-method/service-method.schemas.d.ts +36 -1
  46. package/dist/esm/_core/service-method/service-method.schemas.d.ts.map +1 -1
  47. package/dist/esm/_core/service-method/service-method.schemas.js +49 -1
  48. package/dist/esm/_core/service-method/service-method.schemas.js.map +1 -1
  49. package/dist/esm/_core/utils/extract-field-specs.d.ts +4 -3
  50. package/dist/esm/_core/utils/extract-field-specs.d.ts.map +1 -1
  51. package/dist/esm/_core/utils/extract-field-specs.js +4 -3
  52. package/dist/esm/_core/utils/extract-field-specs.js.map +1 -1
  53. package/dist/esm/engine/frontend-components/ai-elements/chat/ai-conversation-thread.frontend-component.specification.js +1 -1
  54. package/dist/esm/engine/frontend-components/ai-elements/chat/ai-conversation-thread.frontend-component.specification.js.map +1 -1
  55. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.d.ts.map +1 -1
  56. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js +1 -0
  57. package/dist/esm/engine/frontend-components/app/app-layout-connected-accounts-settings.frontend-component.specification.js.map +1 -1
  58. package/dist/esm/engine/frontend-components/data-display/approval-seal.frontend-component.specification.js +3 -3
  59. package/dist/esm/engine/frontend-components/data-display/approval-seal.frontend-component.specification.js.map +1 -1
  60. package/dist/esm/engine/frontend-components/data-display/signature-requests.frontend-component.specification.d.ts +4 -0
  61. package/dist/esm/engine/frontend-components/data-display/signature-requests.frontend-component.specification.d.ts.map +1 -0
  62. package/dist/esm/engine/frontend-components/data-display/signature-requests.frontend-component.specification.js +29 -0
  63. package/dist/esm/engine/frontend-components/data-display/signature-requests.frontend-component.specification.js.map +1 -0
  64. package/dist/esm/engine/frontend-components/flows-actors/low-level-ai-approval.frontend-component.specification.js +1 -1
  65. package/dist/esm/engine/frontend-components/flows-actors/low-level-ai-approval.frontend-component.specification.js.map +1 -1
  66. package/dist/esm/engine/frontend-components/index.d.ts +1 -0
  67. package/dist/esm/engine/frontend-components/index.d.ts.map +1 -1
  68. package/dist/esm/engine/frontend-components/index.js +3 -0
  69. package/dist/esm/engine/frontend-components/index.js.map +1 -1
  70. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.d.ts +9 -0
  71. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.d.ts.map +1 -1
  72. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js +50 -0
  73. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js.map +1 -1
  74. package/dist/esm/engine/organizations/resources/organization-relationships.resource.specification.d.ts.map +1 -1
  75. package/dist/esm/engine/organizations/resources/organization-relationships.resource.specification.js +25 -0
  76. package/dist/esm/engine/organizations/resources/organization-relationships.resource.specification.js.map +1 -1
  77. package/dist/esm/engine/providers/antigravity.provider.specification.d.ts +7 -0
  78. package/dist/esm/engine/providers/antigravity.provider.specification.d.ts.map +1 -0
  79. package/dist/esm/engine/providers/antigravity.provider.specification.js +54 -0
  80. package/dist/esm/engine/providers/antigravity.provider.specification.js.map +1 -0
  81. package/dist/esm/engine/providers/google-drive.provider.specification.d.ts.map +1 -1
  82. package/dist/esm/engine/providers/google-drive.provider.specification.js +8 -0
  83. package/dist/esm/engine/providers/google-drive.provider.specification.js.map +1 -1
  84. package/dist/esm/engine/providers/index.d.ts +2 -0
  85. package/dist/esm/engine/providers/index.d.ts.map +1 -1
  86. package/dist/esm/engine/providers/index.js +5 -1
  87. package/dist/esm/engine/providers/index.js.map +1 -1
  88. package/dist/esm/engine/providers/microsoft-onedrive.provider.specification.d.ts.map +1 -1
  89. package/dist/esm/engine/providers/microsoft-onedrive.provider.specification.js +17 -0
  90. package/dist/esm/engine/providers/microsoft-onedrive.provider.specification.js.map +1 -1
  91. package/dist/esm/engine/providers/outbound-bearer-token.provider.specification.d.ts +7 -0
  92. package/dist/esm/engine/providers/outbound-bearer-token.provider.specification.d.ts.map +1 -0
  93. package/dist/esm/engine/providers/outbound-bearer-token.provider.specification.js +41 -0
  94. package/dist/esm/engine/providers/outbound-bearer-token.provider.specification.js.map +1 -0
  95. package/dist/esm/engine/providers/twilio.provider.specification.d.ts.map +1 -1
  96. package/dist/esm/engine/providers/twilio.provider.specification.js +3 -0
  97. package/dist/esm/engine/providers/twilio.provider.specification.js.map +1 -1
  98. package/dist/tsconfig.build.tsbuildinfo +1 -1
  99. package/package.json +8 -8
@@ -1 +1 @@
1
- {"version":3,"file":"market-snapshot-generation.schemas.js","sourceRoot":"","sources":["../../../../src/_core/market/market-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,+BAA+B,EAAE,MAAM,iCAAiC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,iCAAiC,EAAE,MAAM,mCAAmC,CAAC;AACtF,OAAO,EAAE,2BAA2B,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAC;AAC/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AACrE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AACjE,OAAO,EACL,oBAAoB,EACpB,qBAAqB,GAEtB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AACzE,OAAO,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAC;AAC1E,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAErE;;;GAGG;AACH,MAAM,wBAA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AAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,4BAA4B,KAAK,GAAG,EAAE,CAAC,CAAC;IACnH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { applyFamilyRefPrefix, assertDistinctFamilyRefs } from '../utils/family-ref-stamping';\nimport { FeatureBenefitConfigSchema } from './feature-benefit.schemas';\nimport { MarketAlternativeConfigSchema } from './market-alternative.schemas';\nimport { MarketBuyingJourneyConfigSchema } from './market-buying-journey.schemas';\nimport { MarketCategoryConfigSchema } from './market-category.schemas';\nimport { MarketChannelConfigSchema } from './market-channel.schemas';\nimport { MarketGainConfigSchema } from './market-gain.schemas';\nimport { MarketICPConfigSchema } from './market-icp.schemas';\nimport { MarketJobConfigSchema } from './market-job.schemas';\nimport { MarketMessageTemplateConfigSchema } from './market-message-template.schemas';\nimport { MarketObjectionConfigSchema } from './market-objection.schemas';\nimport { MarketPainConfigSchema } from './market-pain.schemas';\nimport { MarketPersonaConfigSchema } from './market-persona.schemas';\nimport { MarketPositioningConfigSchema } from './market-positioning.schemas';\nimport { MarketProofConfigSchema } from './market-proof.schemas';\nimport {\n MarketSnapshotSchema,\n MarketSnapshotVersion,\n type MarketSnapshot,\n} from './market-snapshot.schemas';\nimport { ToneOfVoiceConfigSchema } from './market-tone-of-voice.schemas';\nimport { MARKET_ENTRY_REF_MAX_LENGTH } from './market-references.schemas';\nimport { MarketTriggerConfigSchema } from './market-trigger.schemas';\n\n/**\n * The family prefix each generated collection's slug is stamped with, to become its `ref`. ONE record, read by the stamping\n * below and by the slug's length bound, so a new collection with a longer prefix moves the bound with it.\n */\nconst MARKET_ENTITY_REF_PREFIX = Object.freeze({\n category: 'category-',\n icps: 'icp-',\n personas: 'persona-',\n jobs: 'job-',\n pains: 'pain-',\n gains: 'gain-',\n tonesOfVoice: 'voice-',\n benefits: 'benefit-',\n positionings: 'positioning-',\n channels: 'channel-',\n alternatives: 'alternative-',\n triggers: 'trigger-',\n buyingJourneys: 'journey-',\n proofs: 'proof-',\n objections: 'objection-',\n messageTemplates: 'tmpl-',\n} as const);\n\n/**\n * The longest slug a provider may generate: the stamped `ref` must fit `MARKET_ENTRY_REF_MAX_LENGTH` whatever prefix its\n * collection adds (#2846 review N4). Bounded HERE, at the schema the provider is constrained by, so an over-long slug is a\n * generation finding the model is asked to repair rather than a snapshot that fails after normalization.\n */\nexport const MARKET_GENERATED_SLUG_MAX_LENGTH: number =\n MARKET_ENTRY_REF_MAX_LENGTH - Math.max(...Object.values(MARKET_ENTITY_REF_PREFIX).map((prefix) => prefix.length));\n\nconst SemanticSlugSchema = z.string().max(MARKET_GENERATED_SLUG_MAX_LENGTH).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);\n\nconst marketEntityGenerationSchema = <Shape extends z.ZodRawShape>(shape: Shape) => z.strictObject({\n slug: SemanticSlugSchema,\n ...shape,\n});\n\nexport const MarketCategoryGenerationSchema = marketEntityGenerationSchema(\n MarketCategoryConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nconst {\n ref: _persistedIcpRef,\n authored: _persistedIcpAuthored,\n ...MarketICPGenerationShape\n} = MarketICPConfigSchema.shape;\nexport const MarketICPGenerationSchema = marketEntityGenerationSchema(\n MarketICPGenerationShape,\n);\nexport const MarketPersonaGenerationSchema = marketEntityGenerationSchema(\n MarketPersonaConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketJobGenerationSchema = marketEntityGenerationSchema(\n MarketJobConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketPainGenerationSchema = marketEntityGenerationSchema(\n MarketPainConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketGainGenerationSchema = marketEntityGenerationSchema(\n MarketGainConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const ToneOfVoiceGenerationSchema = marketEntityGenerationSchema(\n ToneOfVoiceConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const FeatureBenefitGenerationSchema = marketEntityGenerationSchema(\n FeatureBenefitConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketPositioningGenerationSchema = marketEntityGenerationSchema(\n MarketPositioningConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketChannelGenerationSchema = marketEntityGenerationSchema(\n MarketChannelConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketAlternativeGenerationSchema = marketEntityGenerationSchema(\n MarketAlternativeConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketTriggerGenerationSchema = marketEntityGenerationSchema(\n MarketTriggerConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketBuyingJourneyGenerationSchema = marketEntityGenerationSchema(\n MarketBuyingJourneyConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketProofGenerationSchema = marketEntityGenerationSchema(\n MarketProofConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketObjectionGenerationSchema = marketEntityGenerationSchema(\n MarketObjectionConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketMessageTemplateGenerationSchema = marketEntityGenerationSchema(\n MarketMessageTemplateConfigSchema.omit({ ref: true, authored: true }).shape,\n);\n\n/**\n * Strict provider-facing market aggregate.\n *\n * All collections are explicit, entity objects reject unknown top-level\n * members, and the provider supplies semantic slugs instead of persisted refs.\n * Cross-entity edges remain exact canonical refs so the existing pure market\n * validator can reject dangling or contradictory graph structure after the\n * trusted normalizer stamps entity refs and the current snapshot version.\n */\nexport const MarketSnapshotGenerationSchema = z.strictObject({\n category: MarketCategoryGenerationSchema,\n icps: z.array(MarketICPGenerationSchema).min(1),\n personas: z.array(MarketPersonaGenerationSchema),\n jobs: z.array(MarketJobGenerationSchema),\n pains: z.array(MarketPainGenerationSchema),\n gains: z.array(MarketGainGenerationSchema),\n tonesOfVoice: z.array(ToneOfVoiceGenerationSchema),\n benefits: z.array(FeatureBenefitGenerationSchema),\n positionings: z.array(MarketPositioningGenerationSchema),\n channels: z.array(MarketChannelGenerationSchema),\n alternatives: z.array(MarketAlternativeGenerationSchema),\n triggers: z.array(MarketTriggerGenerationSchema),\n buyingJourneys: z.array(MarketBuyingJourneyGenerationSchema),\n proofs: z.array(MarketProofGenerationSchema),\n objections: z.array(MarketObjectionGenerationSchema),\n messageTemplates: z.array(MarketMessageTemplateGenerationSchema),\n}).superRefine((generated, context) => {\n const collections = [\n ['icps', generated.icps],\n ['personas', generated.personas],\n ['jobs', generated.jobs],\n ['pains', generated.pains],\n ['gains', generated.gains],\n ['tonesOfVoice', generated.tonesOfVoice],\n ['benefits', generated.benefits],\n ['positionings', generated.positionings],\n ['channels', generated.channels],\n ['alternatives', generated.alternatives],\n ['triggers', generated.triggers],\n ['buyingJourneys', generated.buyingJourneys],\n ['proofs', generated.proofs],\n ['objections', generated.objections],\n ['messageTemplates', generated.messageTemplates],\n ] as const;\n for (const [path, entries] of collections) {\n reportDuplicateSlugs(entries.map(entry => entry.slug), path, context);\n }\n});\nexport type MarketSnapshotGeneration = z.infer<typeof MarketSnapshotGenerationSchema>;\n\n/** Normalize strict provider output into canonical persisted application truth. */\nexport function parseMarketSnapshotGeneration(input: unknown): MarketSnapshot {\n const parsed = MarketSnapshotGenerationSchema.parse(input);\n // References first, identities second: both sides of every edge end up carrying the same family prefix.\n const generated = stampInternalReferences(parsed);\n const snapshot = MarketSnapshotSchema.parse({\n version: MarketSnapshotVersion.V2,\n category: stampRef(generated.category, MARKET_ENTITY_REF_PREFIX.category),\n icps: generated.icps.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.icps)),\n personas: generated.personas.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.personas)),\n jobs: generated.jobs.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.jobs)),\n pains: generated.pains.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.pains)),\n gains: generated.gains.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.gains)),\n tonesOfVoice: generated.tonesOfVoice.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.tonesOfVoice)),\n benefits: generated.benefits.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.benefits)),\n positionings: generated.positionings.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.positionings)),\n channels: generated.channels.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.channels)),\n alternatives: generated.alternatives.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.alternatives)),\n triggers: generated.triggers.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.triggers)),\n buyingJourneys: generated.buyingJourneys.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.buyingJourneys)),\n proofs: generated.proofs.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.proofs)),\n objections: generated.objections.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.objections)),\n messageTemplates: generated.messageTemplates.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.messageTemplates)),\n });\n for (const [family, collection] of Object.entries(snapshot)) {\n if (Array.isArray(collection)) assertDistinctFamilyRefs(collection as readonly { ref: string }[], family);\n }\n return snapshot;\n}\n\nfunction stampRef<Entry extends { slug: string }>(entry: Entry, prefix: string): Omit<Entry, 'slug'> & { ref: string } {\n const { slug, ...semanticContent } = entry;\n return { ...semanticContent, ref: applyFamilyRefPrefix(slug, prefix) };\n}\n\n/**\n * Which entity family each CROSS-REFERENCE field points at.\n *\n * The generation contract asks the model to identify entities by a bare `slug` and to cross-reference\n * them by that same slug. Normalization then stamps each entity's identity with its family prefix\n * (`stampRef`), so a reference left as the raw slug can no longer resolve to anything. That is not a\n * cosmetic mismatch: `validateMarketSnapshot` reported **156 ORPHAN_REF errors** on a complete,\n * well-formed market graph, which made the whole family unacceptable EVERY time the model answered\n * correctly. A reference must therefore be stamped exactly like the identity it names.\n *\n * Keyed by field NAME because the name is the contract here — `jobRef` names a job wherever it appears,\n * at any depth, and there are 37 such fields spread across nested shapes. The exhaustiveness of this\n * table (together with {@link MARKET_EXTERNAL_REFERENCE_FIELDS}) is enforced by a test that walks the\n * generation schema and fails on any `*Ref`/`*Refs` field that is in neither, so a field added later\n * cannot silently go unstamped.\n */\nconst MARKET_REFERENCE_TARGET_PREFIX: Readonly<Record<string, string>> = Object.freeze({\n personaRef: 'persona-',\n raisedByPersonaRefs: 'persona-',\n icpRef: 'icp-',\n belongsToIcpRefs: 'icp-',\n affectedIcpRefs: 'icp-',\n raisedByIcpRefs: 'icp-',\n supportsIcpRefs: 'icp-',\n jobRef: 'job-',\n painRef: 'pain-',\n gainRef: 'gain-',\n preferredVoiceRef: 'voice-',\n channelRefs: 'channel-',\n recommendedChannelRefs: 'channel-',\n triggerRefs: 'trigger-',\n alternativeRef: 'alternative-',\n alternativeRefs: 'alternative-',\n proofRefs: 'proof-',\n objectionRefs: 'objection-',\n addressesObjectionRefs: 'objection-',\n backedByBenefitRefs: 'benefit-',\n relatedBenefitRefs: 'benefit-',\n supportsBenefitRefs: 'benefit-',\n});\n\n/**\n * Cross-family references, which must NOT be stamped.\n *\n * These name identifiers owned by OTHER specification families — application features and products — so\n * a market prefix would corrupt them. `validateMarketSnapshot` treats them the same way: it resolves\n * them only when the caller passes that family's key set, and skips them otherwise.\n */\nconst MARKET_EXTERNAL_REFERENCE_FIELDS: ReadonlySet<string> = new Set([\n 'deliveredByFeatureRefs',\n 'recommendedProductRefs',\n 'upsellPathProductRefs',\n]);\n\n/**\n * Rewrite every internal cross-reference so it names its target's stamped identity.\n *\n * Applied to the generated payload BEFORE entity identities are stamped, and deliberately depth-first\n * over the whole structure: reference fields appear nested inside `buyingGroup[]`, `relieves[]`,\n * `importanceByICP[]` and similar, not only at collection level.\n *\n * Unstamped by design: anything in {@link MARKET_EXTERNAL_REFERENCE_FIELDS}, and any field this table\n * does not classify — a silent guess about which family a reference points at would be worse than the\n * orphan it replaces, and the schema-walking test makes the omission loud instead.\n */\nfunction stampInternalReferences<Value>(value: Value): Value {\n if (Array.isArray(value)) {\n return value.map((entry) => stampInternalReferences(entry)) as unknown as Value;\n }\n if (value === null || typeof value !== 'object') return value;\n const stamped: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value as Record<string, unknown>)) {\n const prefix = MARKET_EXTERNAL_REFERENCE_FIELDS.has(key) ? undefined : MARKET_REFERENCE_TARGET_PREFIX[key];\n if (prefix !== undefined && typeof entry === 'string') {\n stamped[key] = applyFamilyRefPrefix(entry, prefix);\n continue;\n }\n if (prefix !== undefined && Array.isArray(entry) && entry.every((item) => typeof item === 'string')) {\n stamped[key] = entry.map((item) => applyFamilyRefPrefix(item as string, prefix));\n continue;\n }\n stamped[key] = stampInternalReferences(entry);\n }\n return stamped as unknown as Value;\n}\n\nexport const MARKET_REFERENCE_TARGET_PREFIX_FOR_TESTS: Readonly<Record<string, string>> = MARKET_REFERENCE_TARGET_PREFIX;\nexport const MARKET_EXTERNAL_REFERENCE_FIELDS_FOR_TESTS: ReadonlySet<string> = MARKET_EXTERNAL_REFERENCE_FIELDS;\n\nfunction reportDuplicateSlugs(values: readonly string[], path: string, context: z.RefinementCtx): void {\n const seen = new Set<string>();\n values.forEach((value, index) => {\n if (!seen.has(value)) {\n seen.add(value);\n return;\n }\n context.addIssue({ code: 'custom', path: [path, index, 'slug'], message: `duplicate semantic slug \"${value}\"` });\n });\n}\n"]}
1
+ {"version":3,"file":"market-snapshot-generation.schemas.js","sourceRoot":"","sources":["../../../../src/_core/market/market-snapshot-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,6BAA6B,EAAE,MAAM,8BAA8B,CAAC;AAC7E,OAAO,EAAE,+BAA+B,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8BAA8B,CAAC;AACzH,MAAM,CAAC,MAAM,0CAA0C,GAAwB,gCAAgC,CAAC;AAEhH,SAAS,oBAAoB,CAAC,MAAyB,EAAE,IAAY,EAAE,OAAwB;IAC7F,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,KAAK,EAAE,EAAE;QAC9B,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC;YACrB,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAChB,OAAO;QACT,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,EAAE,OAAO,EAAE,4BAA4B,KAAK,GAAG,EAAE,CAAC,CAAC;IACnH,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { z } from 'zod';\n\nimport { applyFamilyRefPrefix, assertDistinctFamilyRefs } from '../utils/family-ref-stamping';\nimport { FeatureBenefitConfigSchema } from './feature-benefit.schemas';\nimport { MarketAlternativeConfigSchema } from './market-alternative.schemas';\nimport { MarketBuyingJourneyConfigSchema } from './market-buying-journey.schemas';\nimport { MarketCategoryConfigSchema } from './market-category.schemas';\nimport { MarketChannelConfigSchema } from './market-channel.schemas';\nimport { MarketGainConfigSchema } from './market-gain.schemas';\nimport { MarketICPConfigSchema } from './market-icp.schemas';\nimport { MarketJobConfigSchema } from './market-job.schemas';\nimport { MarketMessageTemplateConfigSchema } from './market-message-template.schemas';\nimport { MarketObjectionConfigSchema } from './market-objection.schemas';\nimport { MarketPainConfigSchema } from './market-pain.schemas';\nimport { MarketPersonaConfigSchema } from './market-persona.schemas';\nimport { MarketPositioningConfigSchema } from './market-positioning.schemas';\nimport { MarketProofConfigSchema } from './market-proof.schemas';\nimport {\n MarketSnapshotSchema,\n MarketSnapshotVersion,\n type MarketSnapshot,\n} from './market-snapshot.schemas';\nimport { ToneOfVoiceConfigSchema } from './market-tone-of-voice.schemas';\nimport { MARKET_ENTRY_REF_MAX_LENGTH } from './market-references.schemas';\nimport { MarketTriggerConfigSchema } from './market-trigger.schemas';\n\n/**\n * The family prefix each generated collection's slug is stamped with, to become its `ref`. ONE record, read by the stamping\n * below and by the slug's length bound, so a new collection with a longer prefix moves the bound with it.\n */\nconst MARKET_ENTITY_REF_PREFIX = Object.freeze({\n category: 'category-',\n icps: 'icp-',\n personas: 'persona-',\n jobs: 'job-',\n pains: 'pain-',\n gains: 'gain-',\n tonesOfVoice: 'voice-',\n benefits: 'benefit-',\n positionings: 'positioning-',\n channels: 'channel-',\n alternatives: 'alternative-',\n triggers: 'trigger-',\n buyingJourneys: 'journey-',\n proofs: 'proof-',\n objections: 'objection-',\n messageTemplates: 'tmpl-',\n} as const);\n\n/**\n * The longest slug a provider may generate: the stamped `ref` must fit `MARKET_ENTRY_REF_MAX_LENGTH` whatever prefix its\n * collection adds (#2846 review N4). Bounded HERE, at the schema the provider is constrained by, so an over-long slug is a\n * generation finding the model is asked to repair rather than a snapshot that fails after normalization.\n */\nexport const MARKET_GENERATED_SLUG_MAX_LENGTH: number =\n MARKET_ENTRY_REF_MAX_LENGTH - Math.max(...Object.values(MARKET_ENTITY_REF_PREFIX).map((prefix) => prefix.length));\n\nconst SemanticSlugSchema = z.string().max(MARKET_GENERATED_SLUG_MAX_LENGTH).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);\n\nconst marketEntityGenerationSchema = <Shape extends z.ZodRawShape>(shape: Shape) => z.strictObject({\n slug: SemanticSlugSchema,\n ...shape,\n});\n\nexport const MarketCategoryGenerationSchema = marketEntityGenerationSchema(\n MarketCategoryConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nconst {\n ref: _persistedIcpRef,\n authored: _persistedIcpAuthored,\n ...MarketICPGenerationShape\n} = MarketICPConfigSchema.shape;\nexport const MarketICPGenerationSchema = marketEntityGenerationSchema(\n MarketICPGenerationShape,\n);\nexport const MarketPersonaGenerationSchema = marketEntityGenerationSchema(\n MarketPersonaConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketJobGenerationSchema = marketEntityGenerationSchema(\n MarketJobConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketPainGenerationSchema = marketEntityGenerationSchema(\n MarketPainConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketGainGenerationSchema = marketEntityGenerationSchema(\n MarketGainConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const ToneOfVoiceGenerationSchema = marketEntityGenerationSchema(\n ToneOfVoiceConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const FeatureBenefitGenerationSchema = marketEntityGenerationSchema(\n FeatureBenefitConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketPositioningGenerationSchema = marketEntityGenerationSchema(\n MarketPositioningConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketChannelGenerationSchema = marketEntityGenerationSchema(\n MarketChannelConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketAlternativeGenerationSchema = marketEntityGenerationSchema(\n MarketAlternativeConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketTriggerGenerationSchema = marketEntityGenerationSchema(\n MarketTriggerConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketBuyingJourneyGenerationSchema = marketEntityGenerationSchema(\n MarketBuyingJourneyConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketProofGenerationSchema = marketEntityGenerationSchema(\n MarketProofConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketObjectionGenerationSchema = marketEntityGenerationSchema(\n MarketObjectionConfigSchema.omit({ ref: true, authored: true }).shape,\n);\nexport const MarketMessageTemplateGenerationSchema = marketEntityGenerationSchema(\n MarketMessageTemplateConfigSchema.omit({ ref: true, authored: true }).shape,\n);\n\n/**\n * Strict provider-facing market aggregate.\n *\n * All collections are explicit, entity objects reject unknown top-level\n * members, and the provider supplies semantic slugs instead of persisted refs.\n * Cross-entity edges remain exact canonical refs so the existing pure market\n * validator can reject dangling or contradictory graph structure after the\n * trusted normalizer stamps entity refs and the current snapshot version.\n */\nexport const MarketSnapshotGenerationSchema = z.strictObject({\n category: MarketCategoryGenerationSchema,\n icps: z.array(MarketICPGenerationSchema).min(1),\n personas: z.array(MarketPersonaGenerationSchema),\n jobs: z.array(MarketJobGenerationSchema),\n pains: z.array(MarketPainGenerationSchema),\n gains: z.array(MarketGainGenerationSchema),\n tonesOfVoice: z.array(ToneOfVoiceGenerationSchema),\n benefits: z.array(FeatureBenefitGenerationSchema),\n positionings: z.array(MarketPositioningGenerationSchema),\n channels: z.array(MarketChannelGenerationSchema),\n alternatives: z.array(MarketAlternativeGenerationSchema),\n triggers: z.array(MarketTriggerGenerationSchema),\n buyingJourneys: z.array(MarketBuyingJourneyGenerationSchema),\n proofs: z.array(MarketProofGenerationSchema),\n objections: z.array(MarketObjectionGenerationSchema),\n messageTemplates: z.array(MarketMessageTemplateGenerationSchema),\n}).superRefine((generated, context) => {\n const collections = [\n ['icps', generated.icps],\n ['personas', generated.personas],\n ['jobs', generated.jobs],\n ['pains', generated.pains],\n ['gains', generated.gains],\n ['tonesOfVoice', generated.tonesOfVoice],\n ['benefits', generated.benefits],\n ['positionings', generated.positionings],\n ['channels', generated.channels],\n ['alternatives', generated.alternatives],\n ['triggers', generated.triggers],\n ['buyingJourneys', generated.buyingJourneys],\n ['proofs', generated.proofs],\n ['objections', generated.objections],\n ['messageTemplates', generated.messageTemplates],\n ] as const;\n for (const [path, entries] of collections) {\n reportDuplicateSlugs(entries.map(entry => entry.slug), path, context);\n }\n});\nexport type MarketSnapshotGeneration = z.infer<typeof MarketSnapshotGenerationSchema>;\n\n/** Normalize strict provider output into canonical persisted application truth. */\nexport function parseMarketSnapshotGeneration(input: unknown): MarketSnapshot {\n const parsed = MarketSnapshotGenerationSchema.parse(input);\n // References first, identities second: both sides of every edge end up carrying the same family prefix.\n const generated = stampInternalReferences(parsed);\n const snapshot = MarketSnapshotSchema.parse({\n version: MarketSnapshotVersion.V2,\n category: stampRef(generated.category, MARKET_ENTITY_REF_PREFIX.category),\n icps: generated.icps.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.icps)),\n personas: generated.personas.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.personas)),\n jobs: generated.jobs.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.jobs)),\n pains: generated.pains.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.pains)),\n gains: generated.gains.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.gains)),\n tonesOfVoice: generated.tonesOfVoice.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.tonesOfVoice)),\n benefits: generated.benefits.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.benefits)),\n positionings: generated.positionings.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.positionings)),\n channels: generated.channels.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.channels)),\n alternatives: generated.alternatives.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.alternatives)),\n triggers: generated.triggers.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.triggers)),\n buyingJourneys: generated.buyingJourneys.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.buyingJourneys)),\n proofs: generated.proofs.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.proofs)),\n objections: generated.objections.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.objections)),\n messageTemplates: generated.messageTemplates.map(entry => stampRef(entry, MARKET_ENTITY_REF_PREFIX.messageTemplates)),\n });\n for (const [family, collection] of Object.entries(snapshot)) {\n if (Array.isArray(collection)) assertDistinctFamilyRefs(collection as readonly { ref: string }[], family);\n }\n return snapshot;\n}\n\n/**\n * A landed snapshot written back in the generation contract's shape (#3897): each entity's `ref` becomes its `slug`, and\n * the members the contract does not carry (`version`, each entity's `authored` metadata) are left out.\n *\n * Why it exists: a playbook that writes only some slices of the snapshot (`outputs[].aspects`) is asked for those slices\n * alone, and the rest of its answer is this snapshot's current value. {@link parseMarketSnapshotGeneration} reads a WHOLE\n * contract, so the slices are completed with this before they are normalized; the landing then keeps the current value\n * of every slice the playbook does not write, `authored` included.\n *\n * Exact over refs whenever no ref carries its family prefix twice: each entity's slug re-stamps to its ref, and a reference\n * field already carries its target's prefix, which stamping keeps (it is idempotent). So `parseMarketSnapshotGeneration` of\n * this value is the snapshot without `authored`. A doubled prefix (`job-job-x` beside `job-x`) collapses on the way back, so\n * a caller normalizes the result before relying on it (the generation run does, and generates whole when it fails).\n */\nexport function marketSnapshotAsGeneration(snapshot: MarketSnapshot): MarketSnapshotGeneration {\n /*\n * The slug is the ref WITHOUT its family prefix: re-stamping restores the ref exactly, and the slug stays inside the\n * bound a generated slug has (a ref may be longer than that bound by the prefix it carries).\n */\n const asGeneration = <Entry extends { ref: string; authored?: unknown }>(entry: Entry, prefix: string): Omit<Entry, 'ref' | 'authored'> & { slug: string } => {\n const { ref, authored: _authored, ...semanticContent } = entry;\n return { slug: ref.startsWith(prefix) ? ref.slice(prefix.length) : ref, ...semanticContent };\n };\n const each = <Entry extends { ref: string; authored?: unknown }>(entries: readonly Entry[], prefix: string) => entries.map((entry) => asGeneration(entry, prefix));\n return MarketSnapshotGenerationSchema.parse({\n category: asGeneration(snapshot.category, MARKET_ENTITY_REF_PREFIX.category),\n icps: each(snapshot.icps, MARKET_ENTITY_REF_PREFIX.icps),\n personas: each(snapshot.personas, MARKET_ENTITY_REF_PREFIX.personas),\n jobs: each(snapshot.jobs, MARKET_ENTITY_REF_PREFIX.jobs),\n pains: each(snapshot.pains, MARKET_ENTITY_REF_PREFIX.pains),\n gains: each(snapshot.gains, MARKET_ENTITY_REF_PREFIX.gains),\n tonesOfVoice: each(snapshot.tonesOfVoice, MARKET_ENTITY_REF_PREFIX.tonesOfVoice),\n benefits: each(snapshot.benefits, MARKET_ENTITY_REF_PREFIX.benefits),\n positionings: each(snapshot.positionings, MARKET_ENTITY_REF_PREFIX.positionings),\n channels: each(snapshot.channels, MARKET_ENTITY_REF_PREFIX.channels),\n alternatives: each(snapshot.alternatives, MARKET_ENTITY_REF_PREFIX.alternatives),\n triggers: each(snapshot.triggers, MARKET_ENTITY_REF_PREFIX.triggers),\n buyingJourneys: each(snapshot.buyingJourneys, MARKET_ENTITY_REF_PREFIX.buyingJourneys),\n proofs: each(snapshot.proofs, MARKET_ENTITY_REF_PREFIX.proofs),\n objections: each(snapshot.objections, MARKET_ENTITY_REF_PREFIX.objections),\n messageTemplates: each(snapshot.messageTemplates, MARKET_ENTITY_REF_PREFIX.messageTemplates),\n });\n}\n\nfunction stampRef<Entry extends { slug: string }>(entry: Entry, prefix: string): Omit<Entry, 'slug'> & { ref: string } {\n const { slug, ...semanticContent } = entry;\n return { ...semanticContent, ref: applyFamilyRefPrefix(slug, prefix) };\n}\n\n/**\n * Which entity family each CROSS-REFERENCE field points at.\n *\n * The generation contract asks the model to identify entities by a bare `slug` and to cross-reference\n * them by that same slug. Normalization then stamps each entity's identity with its family prefix\n * (`stampRef`), so a reference left as the raw slug can no longer resolve to anything. That is not a\n * cosmetic mismatch: `validateMarketSnapshot` reported **156 ORPHAN_REF errors** on a complete,\n * well-formed market graph, which made the whole family unacceptable EVERY time the model answered\n * correctly. A reference must therefore be stamped exactly like the identity it names.\n *\n * Keyed by field NAME because the name is the contract here — `jobRef` names a job wherever it appears,\n * at any depth, and there are 37 such fields spread across nested shapes. The exhaustiveness of this\n * table (together with {@link MARKET_EXTERNAL_REFERENCE_FIELDS}) is enforced by a test that walks the\n * generation schema and fails on any `*Ref`/`*Refs` field that is in neither, so a field added later\n * cannot silently go unstamped.\n */\nconst MARKET_REFERENCE_TARGET_PREFIX: Readonly<Record<string, string>> = Object.freeze({\n personaRef: 'persona-',\n raisedByPersonaRefs: 'persona-',\n icpRef: 'icp-',\n belongsToIcpRefs: 'icp-',\n affectedIcpRefs: 'icp-',\n raisedByIcpRefs: 'icp-',\n supportsIcpRefs: 'icp-',\n jobRef: 'job-',\n painRef: 'pain-',\n gainRef: 'gain-',\n preferredVoiceRef: 'voice-',\n channelRefs: 'channel-',\n recommendedChannelRefs: 'channel-',\n triggerRefs: 'trigger-',\n alternativeRef: 'alternative-',\n alternativeRefs: 'alternative-',\n proofRefs: 'proof-',\n objectionRefs: 'objection-',\n addressesObjectionRefs: 'objection-',\n backedByBenefitRefs: 'benefit-',\n relatedBenefitRefs: 'benefit-',\n supportsBenefitRefs: 'benefit-',\n});\n\n/**\n * Cross-family references, which must NOT be stamped.\n *\n * These name identifiers owned by OTHER specification families — application features and products — so\n * a market prefix would corrupt them. `validateMarketSnapshot` treats them the same way: it resolves\n * them only when the caller passes that family's key set, and skips them otherwise.\n */\nconst MARKET_EXTERNAL_REFERENCE_FIELDS: ReadonlySet<string> = new Set([\n 'deliveredByFeatureRefs',\n 'recommendedProductRefs',\n 'upsellPathProductRefs',\n]);\n\n/**\n * Rewrite every internal cross-reference so it names its target's stamped identity.\n *\n * Applied to the generated payload BEFORE entity identities are stamped, and deliberately depth-first\n * over the whole structure: reference fields appear nested inside `buyingGroup[]`, `relieves[]`,\n * `importanceByICP[]` and similar, not only at collection level.\n *\n * Unstamped by design: anything in {@link MARKET_EXTERNAL_REFERENCE_FIELDS}, and any field this table\n * does not classify — a silent guess about which family a reference points at would be worse than the\n * orphan it replaces, and the schema-walking test makes the omission loud instead.\n */\nfunction stampInternalReferences<Value>(value: Value): Value {\n if (Array.isArray(value)) {\n return value.map((entry) => stampInternalReferences(entry)) as unknown as Value;\n }\n if (value === null || typeof value !== 'object') return value;\n const stamped: Record<string, unknown> = {};\n for (const [key, entry] of Object.entries(value as Record<string, unknown>)) {\n const prefix = MARKET_EXTERNAL_REFERENCE_FIELDS.has(key) ? undefined : MARKET_REFERENCE_TARGET_PREFIX[key];\n if (prefix !== undefined && typeof entry === 'string') {\n stamped[key] = applyFamilyRefPrefix(entry, prefix);\n continue;\n }\n if (prefix !== undefined && Array.isArray(entry) && entry.every((item) => typeof item === 'string')) {\n stamped[key] = entry.map((item) => applyFamilyRefPrefix(item as string, prefix));\n continue;\n }\n stamped[key] = stampInternalReferences(entry);\n }\n return stamped as unknown as Value;\n}\n\nexport const MARKET_REFERENCE_TARGET_PREFIX_FOR_TESTS: Readonly<Record<string, string>> = MARKET_REFERENCE_TARGET_PREFIX;\nexport const MARKET_EXTERNAL_REFERENCE_FIELDS_FOR_TESTS: ReadonlySet<string> = MARKET_EXTERNAL_REFERENCE_FIELDS;\n\nfunction reportDuplicateSlugs(values: readonly string[], path: string, context: z.RefinementCtx): void {\n const seen = new Set<string>();\n values.forEach((value, index) => {\n if (!seen.has(value)) {\n seen.add(value);\n return;\n }\n context.addIssue({ code: 'custom', path: [path, index, 'slug'], message: `duplicate semantic slug \"${value}\"` });\n });\n}\n"]}
@@ -49,6 +49,17 @@ export declare enum ServiceMethodDerivationGapKind {
49
49
  DELIVERABLE_WITHOUT_DOCUMENT = "DELIVERABLE_WITHOUT_DOCUMENT",
50
50
  /** A document realizing a deliverable is generated from another resource than the deliverable's (#2305 S6). */
51
51
  DELIVERABLE_DIFFERS = "DELIVERABLE_DIFFERS",
52
+ /**
53
+ * A deliverable a decision approves (`approvedByDecisionRef`) whose approval would not bind its file (#2915): the
54
+ * decision is asked as an agent's review question, which carries no file, or a gate realizing it names no
55
+ * `deliverableFileArgument`. Its seal would then record an approval without the file that was approved.
56
+ */
57
+ DELIVERABLE_APPROVAL_NOT_BOUND = "DELIVERABLE_APPROVAL_NOT_BOUND",
58
+ /**
59
+ * A gate realizing a decision signs the approved file at another level than the method requires (#2915), signs one
60
+ * the method does not have signed, or does not sign one it does (`electronicSignatureLevel` against `signature.level`).
61
+ */
62
+ DELIVERABLE_SIGNATURE_DIFFERS = "DELIVERABLE_SIGNATURE_DIFFERS",
52
63
  /** A resource holding a case's evidence (the case, a deliverable's resource) with no retention binding (#2305 S6). */
53
64
  EVIDENCE_RETENTION_NOT_BOUND = "EVIDENCE_RETENTION_NOT_BOUND",
54
65
  /** A resource holding a case's evidence bound to another retention class than the service's (#2305 S6). */
@@ -88,7 +99,8 @@ export interface ServiceMethodDerivationGap {
88
99
  readonly ref: string;
89
100
  /**
90
101
  * What the gap's message needs beyond the ref: what differs, for the kinds that compare (`AGENT_SHAPE_DIFFERS`,
91
- * `GATE_DIFFERS`, `CASE_PRICE_RECORDING_DIFFERS`, `DELIVERABLE_DIFFERS`, `EVIDENCE_RETENTION_DIFFERS`), the role for
102
+ * `GATE_DIFFERS`, `CASE_PRICE_RECORDING_DIFFERS`, `DELIVERABLE_DIFFERS`, `EVIDENCE_RETENTION_DIFFERS`,
103
+ * `DELIVERABLE_APPROVAL_NOT_BOUND`, `DELIVERABLE_SIGNATURE_DIFFERS`), the role for
92
104
  * `QUALIFICATION_ROLE_UNDECLARED` and `QUALIFICATION_ROLE_NOT_CONFERRED`, why the ref names nothing for
93
105
  * `UNKNOWN_METHOD_ELEMENT`, the resource for `DELIVERABLE_RESOURCE_UNDECLARED`, the service and class expected for
94
106
  * `EVIDENCE_RETENTION_NOT_BOUND`, and the stage for `STAGE_NOT_A_STATE`. A kind whose message prints it must set it:
@@ -119,6 +131,10 @@ export interface ServiceMethodDerivationGap {
119
131
  * upper snake case (#2305 S6);
120
132
  * - every deliverable is produced from a resource the domain plan declares, and a `PDF_TEMPLATE` product naming it in
121
133
  * `serviceMethodDeliverableRef` generates it from that resource;
134
+ * - every deliverable a decision approves (`approvedByDecisionRef`, #2915) is approved through a gate that binds its
135
+ * file (`deliverableFileArgument`), never through a review question, which carries no file; and every gate realizing a
136
+ * decision signs the file at exactly the level the deliverable it approves requires (`electronicSignatureLevel`
137
+ * against `signature.level`), none when it requires none;
122
138
  * - every resource holding a case's evidence (the case resource and each deliverable's resource) has a
123
139
  * `RESOURCE_RETENTION_BINDING` product in the service's `evidenceRetention.retentionClass`;
124
140
  * - every qualification the firm's people hold for the client (`heldBy: FIRM`) has a `RELATIONSHIP_CONFERRED_ROLE`
@@ -1 +1 @@
1
- {"version":3,"file":"service-method-derivation.d.ts","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method-derivation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,gBAAgB,EAA2B,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,+CAA+C,CAAC;AAEpH,OAAO,EAAsF,KAAK,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAIlJ;;;;;;GAMG;AACH,oBAAY,8BAA8B;IACxC,gHAAgH;IAChH,qBAAqB,0BAA0B;IAC/C,kGAAkG;IAClG,sBAAsB,2BAA2B;IACjD,8CAA8C;IAC9C,wBAAwB,6BAA6B;IACrD,+FAA+F;IAC/F,mBAAmB,wBAAwB;IAC3C;;;;OAIG;IACH,sBAAsB,2BAA2B;IACjD,yFAAyF;IACzF,qBAAqB,0BAA0B;IAC/C,iJAAiJ;IACjJ,uBAAuB,4BAA4B;IACnD,+GAA+G;IAC/G,YAAY,iBAAiB;IAC7B,+FAA+F;IAC/F,6BAA6B,kCAAkC;IAC/D,8HAA8H;IAC9H,uBAAuB,4BAA4B;IACnD;;;OAGG;IACH,4BAA4B,iCAAiC;IAC7D,8HAA8H;IAC9H,sBAAsB,2BAA2B;IACjD,4HAA4H;IAC5H,iBAAiB,sBAAsB;IACvC,6GAA6G;IAC7G,+BAA+B,oCAAoC;IACnE,yFAAyF;IACzF,4BAA4B,iCAAiC;IAC7D,+GAA+G;IAC/G,mBAAmB,wBAAwB;IAC3C,sHAAsH;IACtH,4BAA4B,iCAAiC;IAC7D,2GAA2G;IAC3G,0BAA0B,+BAA+B;IACzD;;;OAGG;IACH,gCAAgC,qCAAqC;IACrE;;;OAGG;IACH,wBAAwB,6BAA6B;CACtD;AAED;;;;;GAKG;AACH,eAAO,MAAM,oCAAoC,EAAE,WAAW,CAAC,8BAA8B,CAK3F,CAAC;AAEH;;;GAGG;AACH,eAAO,MAAM,+BAA+B,EAAE,WAAW,CAAC,8BAA8B,CAEtF,CAAC;AAEH,6GAA6G;AAC7G,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAEhE;AAED,4FAA4F;AAC5F,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,IAAI,EAAE,8BAA8B,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;;;OAOG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,YAAY,CAAC,CAAC;IAC1E,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IACxC,wHAAwH;IACxH,QAAQ,CAAC,0BAA0B,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;CACrE,GAAG,SAAS,0BAA0B,EAAE,CAqNxC;AAED,kEAAkE;AAClE,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,0BAA0B,GAAG,MAAM,CA2C1F"}
1
+ {"version":3,"file":"service-method-derivation.d.ts","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method-derivation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,gBAAgB,EAA2B,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAA6B,KAAK,mBAAmB,EAAE,MAAM,+CAA+C,CAA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IACzC,QAAQ,CAAC,IAAI,EAAE,8BAA8B,CAAC;IAC9C;;;OAGG;IACH,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB;;;;;;;;OAQG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE;IACrD,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAC/B,QAAQ,CAAC,UAAU,CAAC,EAAE,IAAI,CAAC,mBAAmB,EAAE,SAAS,GAAG,YAAY,CAAC,CAAC;IAC1E,QAAQ,CAAC,SAAS,CAAC,EAAE,kBAAkB,CAAC;IACxC,wHAAwH;IACxH,QAAQ,CAAC,0BAA0B,CAAC,EAAE,WAAW,CAAC,gBAAgB,CAAC,CAAC;CACrE,GAAG,SAAS,0BAA0B,EAAE,CAgPxC;AAED,kEAAkE;AAClE,wBAAgB,kCAAkC,CAAC,GAAG,EAAE,0BAA0B,GAAG,MAAM,CA+C1F"}
@@ -52,6 +52,17 @@ export var ServiceMethodDerivationGapKind;
52
52
  ServiceMethodDerivationGapKind["DELIVERABLE_WITHOUT_DOCUMENT"] = "DELIVERABLE_WITHOUT_DOCUMENT";
53
53
  /** A document realizing a deliverable is generated from another resource than the deliverable's (#2305 S6). */
54
54
  ServiceMethodDerivationGapKind["DELIVERABLE_DIFFERS"] = "DELIVERABLE_DIFFERS";
55
+ /**
56
+ * A deliverable a decision approves (`approvedByDecisionRef`) whose approval would not bind its file (#2915): the
57
+ * decision is asked as an agent's review question, which carries no file, or a gate realizing it names no
58
+ * `deliverableFileArgument`. Its seal would then record an approval without the file that was approved.
59
+ */
60
+ ServiceMethodDerivationGapKind["DELIVERABLE_APPROVAL_NOT_BOUND"] = "DELIVERABLE_APPROVAL_NOT_BOUND";
61
+ /**
62
+ * A gate realizing a decision signs the approved file at another level than the method requires (#2915), signs one
63
+ * the method does not have signed, or does not sign one it does (`electronicSignatureLevel` against `signature.level`).
64
+ */
65
+ ServiceMethodDerivationGapKind["DELIVERABLE_SIGNATURE_DIFFERS"] = "DELIVERABLE_SIGNATURE_DIFFERS";
55
66
  /** A resource holding a case's evidence (the case, a deliverable's resource) with no retention binding (#2305 S6). */
56
67
  ServiceMethodDerivationGapKind["EVIDENCE_RETENTION_NOT_BOUND"] = "EVIDENCE_RETENTION_NOT_BOUND";
57
68
  /** A resource holding a case's evidence bound to another retention class than the service's (#2305 S6). */
@@ -113,6 +124,10 @@ export function serviceMethodStageState(stageRef) {
113
124
  * upper snake case (#2305 S6);
114
125
  * - every deliverable is produced from a resource the domain plan declares, and a `PDF_TEMPLATE` product naming it in
115
126
  * `serviceMethodDeliverableRef` generates it from that resource;
127
+ * - every deliverable a decision approves (`approvedByDecisionRef`, #2915) is approved through a gate that binds its
128
+ * file (`deliverableFileArgument`), never through a review question, which carries no file; and every gate realizing a
129
+ * decision signs the file at exactly the level the deliverable it approves requires (`electronicSignatureLevel`
130
+ * against `signature.level`), none when it requires none;
116
131
  * - every resource holding a case's evidence (the case resource and each deliverable's resource) has a
117
132
  * `RESOURCE_RETENTION_BINDING` product in the service's `evidenceRetention.retentionClass`;
118
133
  * - every qualification the firm's people hold for the client (`heldBy: FIRM`) has a `RELATIONSHIP_CONFERRED_ROLE`
@@ -283,6 +298,8 @@ export function findServiceMethodDerivationGaps(input) {
283
298
  gaps.push({ kind: ServiceMethodDerivationGapKind.AGENT_SHAPE_DIFFERS, ref, detail: `${agent.agentRef} runs ${agent.shape}, the step declares ${String(step.agentShape)}` });
284
299
  }
285
300
  }
301
+ // #2915: the deliverable each decision approves; the method's validation refuses one decision approving two.
302
+ const approvedBy = new Map(service.deliverables.flatMap((deliverable) => (deliverable.approvedByDecisionRef === undefined ? [] : [[deliverable.approvedByDecisionRef, deliverable]])));
286
303
  for (const decision of service.decisionPoints) {
287
304
  const ref = serviceMethodElementRef(service.serviceRef, decision.decisionRef);
288
305
  decisions.add(ref);
@@ -292,6 +309,31 @@ export function findServiceMethodDerivationGaps(input) {
292
309
  gaps.push({ kind: ServiceMethodDerivationGapKind.DECISION_WITHOUT_GATE, ref });
293
310
  if (gates.length > 0 && asked)
294
311
  gaps.push({ kind: ServiceMethodDerivationGapKind.DECISION_REALIZED_TWICE, ref });
312
+ /*
313
+ * #2915: an approval that releases a deliverable binds its file, and signs it as the method says. A deliverable
314
+ * produced from a resource the domain plan does not declare is the domain plan's to fix first (as for its document).
315
+ */
316
+ const approved = approvedBy.get(decision.decisionRef);
317
+ const approvedJudged = approved !== undefined && !undeclaredResources.has(approved.fromResourceRef);
318
+ const approvedRef = approved === undefined ? ref : serviceMethodElementRef(service.serviceRef, approved.deliverableRef);
319
+ if (approvedJudged) {
320
+ if (asked) {
321
+ gaps.push({ kind: ServiceMethodDerivationGapKind.DELIVERABLE_APPROVAL_NOT_BOUND, ref: approvedRef, detail: `${ref} is asked as a review question, which binds no file; realize it by a gate` });
322
+ }
323
+ for (const gate of gates.filter((candidate) => candidate.deliverableFileArgument === undefined)) {
324
+ gaps.push({ kind: ServiceMethodDerivationGapKind.DELIVERABLE_APPROVAL_NOT_BOUND, ref: approvedRef, detail: `${gate.functionRef} names no deliverableFileArgument` });
325
+ }
326
+ }
327
+ if (approved === undefined || approvedJudged) {
328
+ const requiredLevel = approved?.signature?.level;
329
+ for (const gate of gates.filter((candidate) => candidate.electronicSignatureLevel !== requiredLevel)) {
330
+ gaps.push({
331
+ kind: ServiceMethodDerivationGapKind.DELIVERABLE_SIGNATURE_DIFFERS,
332
+ ref: approvedRef,
333
+ detail: `${gate.functionRef} signs ${gate.electronicSignatureLevel === undefined ? 'nothing' : `at ${gate.electronicSignatureLevel}`}, the method ${requiredLevel === undefined ? 'has nothing signed' : `requires ${requiredLevel}`}`,
334
+ });
335
+ }
336
+ }
295
337
  const qualification = decision.qualificationRef === undefined ? undefined : qualifications.get(decision.qualificationRef);
296
338
  const expectedKinds = qualification?.professionalQualificationKind === undefined ? [] : [qualification.professionalQualificationKind];
297
339
  for (const gate of gates) {
@@ -402,6 +444,10 @@ export function describeServiceMethodDerivationGap(gap) {
402
444
  return `the deliverable \`${gap.ref}\` is generated by no PDF_TEMPLATE product (name it in \`serviceMethodDeliverableRef\`)`;
403
445
  case ServiceMethodDerivationGapKind.DELIVERABLE_DIFFERS:
404
446
  return `the deliverable \`${gap.ref}\`: ${gap.detail}`;
447
+ case ServiceMethodDerivationGapKind.DELIVERABLE_APPROVAL_NOT_BOUND:
448
+ return `the deliverable \`${gap.ref}\` is approved without its file being bound (${gap.detail}): the gate realizing its approving decision names the tool argument carrying the file in \`deliverableFileArgument\``;
449
+ case ServiceMethodDerivationGapKind.DELIVERABLE_SIGNATURE_DIFFERS:
450
+ return `the approval of \`${gap.ref}\`: ${gap.detail} (\`electronicSignatureLevel\` on the gate)`;
405
451
  case ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_NOT_BOUND:
406
452
  return `the resource \`${gap.ref}\` holds a case's evidence and has no RESOURCE_RETENTION_BINDING product (${gap.detail})`;
407
453
  case ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_DIFFERS:
@@ -1 +1 @@
1
- {"version":3,"file":"service-method-derivation.js","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method-derivation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAA4B,MAAM,+CAA+C,CAAC;AACpH,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,0BAA0B,EAAsB,MAAM,0BAA0B,CAAC;AAElJ,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,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AA8B,CAAC,4BAA4B;YAC9D,OAAO,qBAAqB,GAAG,CAAC,GAAG,yFAAyF,CAAC;QAC/H,KAAK,8BAA8B,CAAC,mBAAmB;YACrD,OAAO,qBAAqB,GAAG,CAAC,GAAG,OAAO,GAAG,CAAC,MAAM,EAAE,CAAC;QACzD,KAAK,8BAA8B,CAAC,4BAA4B;YAC9D,OAAO,kBAAkB,GAAG,CAAC,GAAG,6EAA6E,GAAG,CAAC,MAAM,GAAG,CAAC;QAC7H,KAAK,8BAA8B,CAAC,0BAA0B;YAC5D,OAAO,kBAAkB,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,MAAM,EAAE,CAAC;QACxD,KAAK,8BAA8B,CAAC,gCAAgC;YAClE,OAAO,uBAAuB,GAAG,CAAC,GAAG,uEAAuE,GAAG,CAAC,MAAM,0DAA0D,CAAC;QACnL,KAAK,8BAA8B,CAAC,wBAAwB;YAC1D,OAAO,iBAAiB,GAAG,CAAC,GAAG,8GAA8G,CAAC;IAClJ,CAAC;AACH,CAAC","sourcesContent":["import { CORE_ORG_ROLES, EngineCapability, HumanDecision_RouteKind } from '@wildo-ai/saas-models';\n\nimport {\n BuildPlanTaskProductKind,\n serviceMethodElementRef,\n type BuildPlanTaskGraph,\n} from '../build-plan/build-plan-task-graph.schemas';\nimport { domainPlanResourceSlugRef, type DomainPlanOutputSet } from '../domain-plan/domain-plan-output-set.schemas';\nimport { projectDomainPlanResources } from '../domain-plan/domain-plan.family-aspects';\nimport { ServiceMethodPricing, ServiceMethodQualificationHolder, ServiceMethodStepPerformer, type ServiceMethod } from './service-method.schemas';\n\nconst CORE_ORG_ROLE_NAMES: ReadonlySet<string> = new Set<string>(Object.values(CORE_ORG_ROLES));\n\n/**\n * What the families derived from a firm's method leave out of it (#2305 S4), one kind per element the method declares.\n *\n * The method is the one place the firm's work is written down; the domain plan and the build plan realize it. These are\n * the elements a realization can miss, each named by the method's own ref, so a gap says which part of the firm's work\n * the application would be built without.\n */\nexport enum ServiceMethodDerivationGapKind {\n /** A service's case names a resource the domain plan does not declare: the cases would have nowhere to live. */\n CASE_WITHOUT_RESOURCE = 'CASE_WITHOUT_RESOURCE',\n /** A case resource no build task marks as the work unit, so no model call is costed to a case. */\n CASE_WITHOUT_WORK_UNIT = 'CASE_WITHOUT_WORK_UNIT',\n /** An AGENT step no agent product carries. */\n AGENT_STEP_WITHOUT_AGENT = 'AGENT_STEP_WITHOUT_AGENT',\n /** An agent product carries an AGENT step but runs in another shape than the step declares. */\n AGENT_SHAPE_DIFFERS = 'AGENT_SHAPE_DIFFERS',\n /**\n * A product names a method element the method does not declare: a step or decision (or a step no agent performs), the\n * service a usage recording bills, or the deliverable a document generates. A DANGLING finding: the dangling-reference\n * refusal owns it.\n */\n UNKNOWN_METHOD_ELEMENT = 'UNKNOWN_METHOD_ELEMENT',\n /** A decision point neither an approval gate nor an agent's review question realizes. */\n DECISION_WITHOUT_GATE = 'DECISION_WITHOUT_GATE',\n /** A decision point realized BOTH by a gate and by an agent's review question: a review question is the review, and its tool carries no gate. */\n DECISION_REALIZED_TWICE = 'DECISION_REALIZED_TWICE',\n /** A gate realizes a decision point with another route, role or qualification set than the method declares. */\n GATE_DIFFERS = 'GATE_DIFFERS',\n /** A qualification names a role that is neither the engine's nor one a build task declares. */\n QUALIFICATION_ROLE_UNDECLARED = 'QUALIFICATION_ROLE_UNDECLARED',\n /** A service priced PER CASE whose case no operation records as metered usage (#2305 S5): its cases would never be billed. */\n CASE_PRICE_NOT_RECORDED = 'CASE_PRICE_NOT_RECORDED',\n /**\n * A usage recording billing a service's cases records on another resource than the case, counts every run rather than\n * once per case, records a product the plan does not sell, or bills a service not priced per case.\n */\n CASE_PRICE_RECORDING_DIFFERS = 'CASE_PRICE_RECORDING_DIFFERS',\n /** A case resource with more than one stage that has no lifecycle in the domain plan (#2305 S6). The domain plan's to fix. */\n CASE_WITHOUT_LIFECYCLE = 'CASE_WITHOUT_LIFECYCLE',\n /** A stage of a case that is not a state of its resource's lifecycle, in upper snake case (#2305 S6). The domain plan's. */\n STAGE_NOT_A_STATE = 'STAGE_NOT_A_STATE',\n /** A deliverable produced from a resource the domain plan does not declare (#2305 S6). The domain plan's. */\n DELIVERABLE_RESOURCE_UNDECLARED = 'DELIVERABLE_RESOURCE_UNDECLARED',\n /** A deliverable no document realizes: no `PDF_TEMPLATE` product names it (#2305 S6). */\n DELIVERABLE_WITHOUT_DOCUMENT = 'DELIVERABLE_WITHOUT_DOCUMENT',\n /** A document realizing a deliverable is generated from another resource than the deliverable's (#2305 S6). */\n DELIVERABLE_DIFFERS = 'DELIVERABLE_DIFFERS',\n /** A resource holding a case's evidence (the case, a deliverable's resource) with no retention binding (#2305 S6). */\n EVIDENCE_RETENTION_NOT_BOUND = 'EVIDENCE_RETENTION_NOT_BOUND',\n /** A resource holding a case's evidence bound to another retention class than the service's (#2305 S6). */\n EVIDENCE_RETENTION_DIFFERS = 'EVIDENCE_RETENTION_DIFFERS',\n /**\n * A qualification the firm's people hold for the client (`heldBy: FIRM`) whose role no relationship confers (#2305 S6):\n * they could never hold it for a client, so the decisions requiring it would reach nobody.\n */\n QUALIFICATION_ROLE_NOT_CONFERRED = 'QUALIFICATION_ROLE_NOT_CONFERRED',\n /**\n * A service priced PER CASE on an application whose line has no billing at all (an internal tool, #2305 review): its\n * cases can never be billed, and no usage recording can be built for them. The method's to fix (`BILLED_OUTSIDE`).\n */\n PER_CASE_WITHOUT_BILLING = 'PER_CASE_WITHOUT_BILLING',\n}\n\n/**\n * The gaps the DOMAIN PLAN must fix (#2305 S4, S6): each names an element no build task can realize while the domain plan\n * lacks it (a build product's `resourceRef` is an edge to the domain plan). They route back to the conception through the\n * coherence report and `conception-buildable`, and a candidate build plan is never refused for them: refusing would leave\n * no build plan that passes.\n */\nexport const DOMAIN_PLAN_SERVICE_METHOD_GAP_KINDS: ReadonlySet<ServiceMethodDerivationGapKind> = new Set([\n ServiceMethodDerivationGapKind.CASE_WITHOUT_RESOURCE,\n ServiceMethodDerivationGapKind.CASE_WITHOUT_LIFECYCLE,\n ServiceMethodDerivationGapKind.STAGE_NOT_A_STATE,\n ServiceMethodDerivationGapKind.DELIVERABLE_RESOURCE_UNDECLARED,\n]);\n\n/**\n * The gaps the METHOD itself must fix (#2305 review), for the same reason as {@link DOMAIN_PLAN_SERVICE_METHOD_GAP_KINDS}:\n * no build plan can realize them, so a candidate is never refused for them, and they route back to the method.\n */\nexport const METHOD_SERVICE_METHOD_GAP_KINDS: ReadonlySet<ServiceMethodDerivationGapKind> = new Set([\n ServiceMethodDerivationGapKind.PER_CASE_WITHOUT_BILLING,\n]);\n\n/** A stage ref as the domain plan's lifecycle state spells it: `in-reconciliation` → `IN_RECONCILIATION`. */\nexport function serviceMethodStageState(stageRef: string): string {\n return stageRef.toUpperCase().replaceAll('-', '_');\n}\n\n/** One element of the method a derived family leaves out, named by the method's own ref. */\nexport interface ServiceMethodDerivationGap {\n readonly kind: ServiceMethodDerivationGapKind;\n /**\n * `<serviceRef>/<stepRef, decisionRef, stageRef or deliverableRef>`, a case's or evidence resource's ref, a qualification\n * ref, or a service ref (pricing).\n */\n readonly ref: string;\n /**\n * What the gap's message needs beyond the ref: what differs, for the kinds that compare (`AGENT_SHAPE_DIFFERS`,\n * `GATE_DIFFERS`, `CASE_PRICE_RECORDING_DIFFERS`, `DELIVERABLE_DIFFERS`, `EVIDENCE_RETENTION_DIFFERS`), the role for\n * `QUALIFICATION_ROLE_UNDECLARED` and `QUALIFICATION_ROLE_NOT_CONFERRED`, why the ref names nothing for\n * `UNKNOWN_METHOD_ELEMENT`, the resource for `DELIVERABLE_RESOURCE_UNDECLARED`, the service and class expected for\n * `EVIDENCE_RETENTION_NOT_BOUND`, and the stage for `STAGE_NOT_A_STATE`. A kind whose message prints it must set it:\n * `describeServiceMethodDerivationGap` is the list.\n */\n readonly detail?: string;\n}\n\n/**\n * Every element of the firm's method the domain plan or the build plan does not realize (#2305 S4). Pure, and TOTAL\n * over the method, so a decision point added to it tomorrow is reported by every existing plan.\n *\n * ## What counts\n *\n * - a service's case is a resource the domain plan declares, and the build plan marks it as the work unit\n * (`WORK_UNIT_RESOURCE`);\n * - every AGENT step is carried by an `APPLICATION_AGENT` product naming it in `serviceMethodStepRefs`, in the step's\n * `agentShape`;\n * - every decision point is realized, ONE way: by an `AGENT_APPROVAL_GATE` naming it in `serviceMethodDecisionRef`, with\n * the decision's route, its qualification's role as `eligibleRole`, and exactly its qualification's professional\n * kind as `requiredQualificationKinds` (none when the qualification names none); or by an agent that asks it as a\n * review question (`serviceMethodAskedDecisionRefs`), whose route its code builds at suspension and is not compared;\n * - every qualification's role is an engine role or one an `APPLICATION_ROLE` product declares;\n * - every service priced `PER_CASE` is billed (#2305 S5): a `METERED_USAGE_RECORDING` product naming it in\n * `serviceMethodServiceRef` records, ONCE PER ROW, on the service's case resource, a product an\n * `APPLICATION_BILLING_PRODUCT` of the plan sells. A recording naming a service priced otherwise is reported too: a\n * case billed per case while the method says the plan includes it, or the firm bills it outside, charges twice;\n * - every case resource with more than one stage has a lifecycle in the domain plan whose states include each stage, in\n * upper snake case (#2305 S6);\n * - every deliverable is produced from a resource the domain plan declares, and a `PDF_TEMPLATE` product naming it in\n * `serviceMethodDeliverableRef` generates it from that resource;\n * - every resource holding a case's evidence (the case resource and each deliverable's resource) has a\n * `RESOURCE_RETENTION_BINDING` product in the service's `evidenceRetention.retentionClass`;\n * - every qualification the firm's people hold for the client (`heldBy: FIRM`) has a `RELATIONSHIP_CONFERRED_ROLE`\n * product for its role, unless the role is `ORG_REPRESENTATIVE`, which the service relationship confers by default.\n *\n * Either plan may be absent: the elements only it can realize are then not judged, and nothing is reported for them.\n * When the domain plan is given and does not declare a case's (or a deliverable's) resource, it is reported once\n * (`CASE_WITHOUT_RESOURCE`, `DELIVERABLE_RESOURCE_UNDECLARED`) and NOT also held to what the build plan does with it (a\n * work unit, a recording, a document, a retention binding): no build task could name a resource the domain plan does\n * not declare (its `resourceRef` is an edge to the domain plan), so the fix is the domain plan's, not the build plan's.\n * Those kinds are {@link DOMAIN_PLAN_SERVICE_METHOD_GAP_KINDS}.\n *\n * Every product claiming an element is compared, not only one, so the result does not depend on product order: a\n * second gate on the wrong role beside a correct one is still reported.\n * A plan that is the method's realization is COMPLETE, so a missing element is a gap even when a task for it was\n * built earlier: the build plan keeps every task it built.\n *\n * Known limits: a decision's deadline is not compared. The gate product carries no deadline, so the method's\n * `decisionDeadline` reaches the gate task through its objective and the coding agent's tool declaration. Which\n * operation closes a case is not compared either: the method says when a case closes in the creator's words\n * (`closesWhen`), so the recording's operation is the build plan's reading of it. And the billed product being METERED\n * is not visible in the plan (a billing product names only its key); a usage recording against a product that is not\n * metered records nothing at runtime, and warns.\n */\nexport function findServiceMethodDerivationGaps(input: {\n readonly method: ServiceMethod;\n readonly domainPlan?: Pick<DomainPlanOutputSet, 'modules' | 'lifecycles'>;\n readonly buildPlan?: BuildPlanTaskGraph;\n /** The engine capabilities the application's line excludes (`resolveExcludedEngineCapabilities`); none when unknown. */\n readonly excludedEngineCapabilities?: ReadonlySet<EngineCapability>;\n}): readonly ServiceMethodDerivationGap[] {\n const { method, domainPlan, buildPlan } = input;\n const billingExcluded = input.excludedEngineCapabilities?.has(EngineCapability.BILLING) === true;\n const gaps: ServiceMethodDerivationGap[] = [];\n\n const undeclaredResources = new Set<string>();\n if (domainPlan !== undefined) {\n /*\n * By REF form (#3204): a case and a deliverable cite a resource as a kebab slug, while the plan and its\n * lifecycles name it as the registry will (`siteVisit`). `domainPlanResourceSlugRef` is the one mapping.\n */\n const resources = new Set(projectDomainPlanResources(domainPlan.modules).map((resource) => resource.resourceSlugRef));\n const lifecycles = new Map((domainPlan.lifecycles ?? []).map((lifecycle) => [domainPlanResourceSlugRef(lifecycle.resourceRef), lifecycle]));\n for (const service of method.services) {\n const caseRef = service.case.caseRef;\n if (!resources.has(caseRef)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_WITHOUT_RESOURCE, ref: caseRef });\n undeclaredResources.add(caseRef);\n } else if (service.stages.length > 1) {\n // A one-stage case moves through no states, and a lifecycle needs two.\n const lifecycle = lifecycles.get(caseRef);\n if (lifecycle === undefined) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_WITHOUT_LIFECYCLE, ref: caseRef });\n } else {\n for (const stage of service.stages.filter((candidate) => !lifecycle.states.includes(serviceMethodStageState(candidate.stageRef)))) {\n gaps.push({\n kind: ServiceMethodDerivationGapKind.STAGE_NOT_A_STATE,\n ref: serviceMethodElementRef(service.serviceRef, stage.stageRef),\n detail: `${caseRef}'s lifecycle has no state ${serviceMethodStageState(stage.stageRef)}`,\n });\n }\n }\n }\n for (const deliverable of service.deliverables.filter((candidate) => !resources.has(candidate.fromResourceRef))) {\n gaps.push({\n kind: ServiceMethodDerivationGapKind.DELIVERABLE_RESOURCE_UNDECLARED,\n ref: serviceMethodElementRef(service.serviceRef, deliverable.deliverableRef),\n detail: deliverable.fromResourceRef,\n });\n undeclaredResources.add(deliverable.fromResourceRef);\n }\n }\n }\n // A price per case on a line with no billing is the method's own contradiction, whatever a build plan says (#2305 review).\n if (billingExcluded) {\n for (const service of method.services) {\n if (service.pricing === ServiceMethodPricing.PER_CASE) gaps.push({ kind: ServiceMethodDerivationGapKind.PER_CASE_WITHOUT_BILLING, ref: service.serviceRef });\n }\n }\n if (buildPlan === undefined) return gaps;\n const casesWithoutResource = undeclaredResources;\n\n const products = buildPlan.tasks.flatMap((task) => task.produces);\n const workUnits = new Set(products.flatMap((product) => (product.kind === BuildPlanTaskProductKind.WORK_UNIT_RESOURCE ? [product.resourceRef] : [])));\n type Gate = Extract<(typeof products)[number], { kind: BuildPlanTaskProductKind.AGENT_APPROVAL_GATE }>;\n const agentsByStep = new Map<string, { readonly agentRef: string; readonly shape: string }[]>();\n const gatesByDecision = new Map<string, Gate[]>();\n const askedDecisions = new Set<string>();\n const declaredRoles = new Set<string>();\n type UsageRecording = Extract<(typeof products)[number], { kind: BuildPlanTaskProductKind.METERED_USAGE_RECORDING }>;\n const recordingsByService = new Map<string, UsageRecording[]>();\n const soldProductKeys = new Set<string>();\n type Document = Extract<(typeof products)[number], { kind: BuildPlanTaskProductKind.PDF_TEMPLATE }>;\n const documentsByDeliverable = new Map<string, Document[]>();\n const retentionByResource = new Map<string, string[]>();\n const conferredRoles = new Set<string>();\n const claim = <T>(map: Map<string, T[]>, ref: string, value: T): void => { map.set(ref, [...(map.get(ref) ?? []), value]); };\n for (const product of products) {\n if (product.kind === BuildPlanTaskProductKind.APPLICATION_AGENT) {\n for (const stepRef of product.serviceMethodStepRefs ?? []) claim(agentsByStep, stepRef, { agentRef: product.agentRef, shape: product.shape });\n for (const decisionRef of product.serviceMethodAskedDecisionRefs ?? []) askedDecisions.add(decisionRef);\n } else if (product.kind === BuildPlanTaskProductKind.AGENT_APPROVAL_GATE && product.serviceMethodDecisionRef !== undefined) {\n claim(gatesByDecision, product.serviceMethodDecisionRef, product);\n } else if (product.kind === BuildPlanTaskProductKind.APPLICATION_ROLE) {\n declaredRoles.add(product.roleRef);\n } else if (product.kind === BuildPlanTaskProductKind.METERED_USAGE_RECORDING && product.serviceMethodServiceRef !== undefined) {\n claim(recordingsByService, product.serviceMethodServiceRef, product);\n } else if (product.kind === BuildPlanTaskProductKind.APPLICATION_BILLING_PRODUCT) {\n soldProductKeys.add(product.productKey);\n } else if (product.kind === BuildPlanTaskProductKind.PDF_TEMPLATE && product.serviceMethodDeliverableRef !== undefined) {\n claim(documentsByDeliverable, product.serviceMethodDeliverableRef, product);\n } else if (product.kind === BuildPlanTaskProductKind.RESOURCE_RETENTION_BINDING) {\n claim(retentionByResource, product.resourceRef, product.retentionClass);\n } else if (product.kind === BuildPlanTaskProductKind.RELATIONSHIP_CONFERRED_ROLE) {\n conferredRoles.add(product.roleRef);\n }\n }\n\n const qualifications = new Map((method.qualifications ?? []).map((qualification) => [qualification.qualificationRef, qualification]));\n const agentSteps = new Set<string>();\n const decisions = new Set<string>();\n const deliverables = new Set<string>();\n for (const service of method.services) {\n if (!casesWithoutResource.has(service.case.caseRef) && !workUnits.has(service.case.caseRef)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_WITHOUT_WORK_UNIT, ref: service.case.caseRef });\n }\n const recordings = recordingsByService.get(service.serviceRef) ?? [];\n const perCase = service.pricing === ServiceMethodPricing.PER_CASE;\n // On a line with no billing a price per case is the method's gap (reported above), and owing a recording no build\n // can make would refuse every build plan (#2305 review).\n if (perCase && !billingExcluded && recordings.length === 0 && !casesWithoutResource.has(service.case.caseRef)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_PRICE_NOT_RECORDED, ref: service.serviceRef });\n }\n for (const recording of recordings) {\n const differences = perCase\n ? [\n recording.resourceRef === service.case.caseRef ? undefined : `records on ${recording.resourceRef}, the case is ${service.case.caseRef}`,\n recording.oncePerRecord ? undefined : 'counts every run, a price per case counts each case once (`oncePerRecord`)',\n soldProductKeys.has(recording.productKey) ? undefined : `records the product ${recording.productKey}, which no APPLICATION_BILLING_PRODUCT of the plan sells`,\n ].filter((difference): difference is string => difference !== undefined)\n : [`the service is priced ${service.pricing}, not per case`];\n if (differences.length > 0) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_PRICE_RECORDING_DIFFERS, ref: service.serviceRef, detail: `${recording.resourceRef}.${recording.operationRef}: ${differences.join('; ')}` });\n }\n }\n for (const deliverable of service.deliverables) {\n const ref = serviceMethodElementRef(service.serviceRef, deliverable.deliverableRef);\n deliverables.add(ref);\n if (undeclaredResources.has(deliverable.fromResourceRef)) continue;\n const documents = documentsByDeliverable.get(ref) ?? [];\n if (documents.length === 0) gaps.push({ kind: ServiceMethodDerivationGapKind.DELIVERABLE_WITHOUT_DOCUMENT, ref });\n for (const document of documents.filter((candidate) => candidate.resourceRef !== deliverable.fromResourceRef)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.DELIVERABLE_DIFFERS, ref, detail: `${document.templateRef} is generated from ${document.resourceRef}, the deliverable from ${deliverable.fromResourceRef}` });\n }\n }\n for (const step of service.steps) {\n if (step.performedBy !== ServiceMethodStepPerformer.AGENT) continue;\n const ref = serviceMethodElementRef(service.serviceRef, step.stepRef);\n agentSteps.add(ref);\n const agents = agentsByStep.get(ref) ?? [];\n if (agents.length === 0) gaps.push({ kind: ServiceMethodDerivationGapKind.AGENT_STEP_WITHOUT_AGENT, ref });\n for (const agent of agents.filter((candidate) => candidate.shape !== step.agentShape)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.AGENT_SHAPE_DIFFERS, ref, detail: `${agent.agentRef} runs ${agent.shape}, the step declares ${String(step.agentShape)}` });\n }\n }\n for (const decision of service.decisionPoints) {\n const ref = serviceMethodElementRef(service.serviceRef, decision.decisionRef);\n decisions.add(ref);\n const gates = gatesByDecision.get(ref) ?? [];\n const asked = askedDecisions.has(ref);\n if (gates.length === 0 && !asked) gaps.push({ kind: ServiceMethodDerivationGapKind.DECISION_WITHOUT_GATE, ref });\n if (gates.length > 0 && asked) gaps.push({ kind: ServiceMethodDerivationGapKind.DECISION_REALIZED_TWICE, ref });\n const qualification = decision.qualificationRef === undefined ? undefined : qualifications.get(decision.qualificationRef);\n const expectedKinds = qualification?.professionalQualificationKind === undefined ? [] : [qualification.professionalQualificationKind];\n for (const gate of gates) {\n const gateKinds = [...(gate.requiredQualificationKinds ?? [])].sort();\n const differences = [\n gate.route === decision.route ? undefined : `route ${gate.route}, the method declares ${decision.route}`,\n decision.route === HumanDecision_RouteKind.OWNER || gate.eligibleRole === qualification?.role\n ? undefined\n : `role ${gate.eligibleRole ?? 'none'}, the qualification names ${qualification?.role ?? 'none'}`,\n JSON.stringify(gateKinds) === JSON.stringify(expectedKinds)\n ? undefined\n : `qualifications [${gateKinds.join(', ')}], the method requires [${expectedKinds.join(', ')}]`,\n ].filter((difference): difference is string => difference !== undefined);\n if (differences.length > 0) gaps.push({ kind: ServiceMethodDerivationGapKind.GATE_DIFFERS, ref, detail: `${gate.functionRef}: ${differences.join('; ')}` });\n }\n }\n }\n\n for (const stepRef of agentsByStep.keys()) {\n if (!agentSteps.has(stepRef)) gaps.push({ kind: ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT, ref: stepRef, detail: 'no AGENT step of the method has this ref' });\n }\n for (const decisionRef of new Set([...gatesByDecision.keys(), ...askedDecisions])) {\n if (!decisions.has(decisionRef)) gaps.push({ kind: ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT, ref: decisionRef, detail: 'no decision point of the method has this ref' });\n }\n /*\n * #2305 S6: each resource holding a case's evidence is judged ONCE, against the class its services keep it in (the\n * method's validation refuses two services keeping one resource in different classes, so the first one names it).\n */\n const evidence = new Map<string, { readonly serviceRef: string; readonly retentionClass: string }>();\n for (const service of method.services) {\n for (const resourceRef of [service.case.caseRef, ...service.deliverables.map((deliverable) => deliverable.fromResourceRef)]) {\n if (!undeclaredResources.has(resourceRef) && !evidence.has(resourceRef)) {\n evidence.set(resourceRef, { serviceRef: service.serviceRef, retentionClass: service.evidenceRetention.retentionClass });\n }\n }\n }\n for (const [resourceRef, expected] of evidence) {\n const classes = retentionByResource.get(resourceRef) ?? [];\n if (classes.length === 0) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_NOT_BOUND, ref: resourceRef, detail: `${expected.serviceRef} keeps its evidence as ${expected.retentionClass}` });\n }\n for (const retentionClass of classes.filter((candidate) => candidate !== expected.retentionClass)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_DIFFERS, ref: resourceRef, detail: `bound to ${retentionClass}, ${expected.serviceRef} keeps its evidence as ${expected.retentionClass}` });\n }\n }\n\n const services = new Set(method.services.map((service) => service.serviceRef));\n for (const serviceRef of recordingsByService.keys()) {\n if (!services.has(serviceRef)) gaps.push({ kind: ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT, ref: serviceRef, detail: 'no service of the method has this ref' });\n }\n for (const deliverableRef of documentsByDeliverable.keys()) {\n if (!deliverables.has(deliverableRef)) gaps.push({ kind: ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT, ref: deliverableRef, detail: 'no deliverable of the method has this ref' });\n }\n // Only the qualifications a decision routes to (#2305 review): an unused one is the method's mark\n // (`QUALIFICATION_UNUSED`), and holding it to a role declaration and a conferral would build a role nothing uses.\n const usedQualificationRefs = new Set(method.services.flatMap((service) => service.decisionPoints\n .map((decision) => decision.qualificationRef).filter((ref): ref is string => ref !== undefined)));\n for (const qualification of (method.qualifications ?? []).filter((candidate) => usedQualificationRefs.has(candidate.qualificationRef))) {\n // An organization role: a core one, or one the application declares. An application role is refused by the method's\n // own refinement, so it is not counted as declared here either (#2305 review C2).\n if (!CORE_ORG_ROLE_NAMES.has(qualification.role) && !declaredRoles.has(qualification.role)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.QUALIFICATION_ROLE_UNDECLARED, ref: qualification.qualificationRef, detail: qualification.role });\n }\n // A role the FIRM's people hold for the client reaches them only through a relationship that confers it, except\n // `ORG_REPRESENTATIVE`, which the service relationship confers by default. The client's own staff need nothing conferred.\n if (qualification.heldBy === ServiceMethodQualificationHolder.FIRM && qualification.role !== CORE_ORG_ROLES.ORG_REPRESENTATIVE\n && !conferredRoles.has(qualification.role)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.QUALIFICATION_ROLE_NOT_CONFERRED, ref: qualification.qualificationRef, detail: qualification.role });\n }\n }\n return gaps;\n}\n\n/** One line per gap, in the words a model or a person acts on. */\nexport function describeServiceMethodDerivationGap(gap: ServiceMethodDerivationGap): string {\n switch (gap.kind) {\n case ServiceMethodDerivationGapKind.CASE_WITHOUT_RESOURCE:\n return `the case resource \\`${gap.ref}\\` is not a resource of the domain plan`;\n case ServiceMethodDerivationGapKind.CASE_WITHOUT_WORK_UNIT:\n return `the case resource \\`${gap.ref}\\` has no WORK_UNIT_RESOURCE product`;\n case ServiceMethodDerivationGapKind.AGENT_STEP_WITHOUT_AGENT:\n return `the agent step \\`${gap.ref}\\` is carried by no APPLICATION_AGENT product (name it in \\`serviceMethodStepRefs\\`)`;\n case ServiceMethodDerivationGapKind.AGENT_SHAPE_DIFFERS:\n return `the agent step \\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT:\n return `\\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.DECISION_WITHOUT_GATE:\n return `the decision point \\`${gap.ref}\\` is realized neither by an AGENT_APPROVAL_GATE product (\\`serviceMethodDecisionRef\\`) nor by an agent that asks it as a review question (\\`serviceMethodAskedDecisionRefs\\`)`;\n case ServiceMethodDerivationGapKind.DECISION_REALIZED_TWICE:\n return `the decision point \\`${gap.ref}\\` is realized both by a gate and by an agent's review question; keep one`;\n case ServiceMethodDerivationGapKind.GATE_DIFFERS:\n return `the decision point \\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.QUALIFICATION_ROLE_UNDECLARED:\n return `the qualification \\`${gap.ref}\\` needs the role \\`${gap.detail}\\`, which is not an engine role and no APPLICATION_ROLE product declares it`;\n case ServiceMethodDerivationGapKind.CASE_PRICE_NOT_RECORDED:\n return `the service \\`${gap.ref}\\` is priced per case and no METERED_USAGE_RECORDING product records its case (name it in \\`serviceMethodServiceRef\\`, once per record, on the operation that closes the case)`;\n case ServiceMethodDerivationGapKind.CASE_PRICE_RECORDING_DIFFERS:\n return `the service \\`${gap.ref}\\`'s price per case: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.CASE_WITHOUT_LIFECYCLE:\n return `the case resource \\`${gap.ref}\\` has no lifecycle in the domain plan (its stages are its states)`;\n case ServiceMethodDerivationGapKind.STAGE_NOT_A_STATE:\n return `the stage \\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.DELIVERABLE_RESOURCE_UNDECLARED:\n return `the deliverable \\`${gap.ref}\\` is produced from \\`${gap.detail}\\`, which is not a resource of the domain plan`;\n case ServiceMethodDerivationGapKind.DELIVERABLE_WITHOUT_DOCUMENT:\n return `the deliverable \\`${gap.ref}\\` is generated by no PDF_TEMPLATE product (name it in \\`serviceMethodDeliverableRef\\`)`;\n case ServiceMethodDerivationGapKind.DELIVERABLE_DIFFERS:\n return `the deliverable \\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_NOT_BOUND:\n return `the resource \\`${gap.ref}\\` holds a case's evidence and has no RESOURCE_RETENTION_BINDING product (${gap.detail})`;\n case ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_DIFFERS:\n return `the resource \\`${gap.ref}\\` is ${gap.detail}`;\n case ServiceMethodDerivationGapKind.QUALIFICATION_ROLE_NOT_CONFERRED:\n return `the qualification \\`${gap.ref}\\` is held by the firm's people for the client and needs the role \\`${gap.detail}\\`, which no RELATIONSHIP_CONFERRED_ROLE product confers`;\n case ServiceMethodDerivationGapKind.PER_CASE_WITHOUT_BILLING:\n return `the service \\`${gap.ref}\\` is priced per case, and this application's line has no billing: price it \\`BILLED_OUTSIDE\\` in the method`;\n }\n}\n"]}
1
+ {"version":3,"file":"service-method-derivation.js","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method-derivation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EACL,wBAAwB,EACxB,uBAAuB,GAExB,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAAE,yBAAyB,EAA4B,MAAM,+CAA+C,CAAC;AACpH,OAAO,EAAE,0BAA0B,EAAE,MAAM,2CAA2C,CAAC;AACvF,OAAO,EAAE,oBAAoB,EAAE,gCAAgC,EAAE,0BAA0B,EAAsB,MAAM,0BAA0B,CAAC;AAElJ,MAAM,mBAAmB,GAAwB,IAAI,GAAG,CAAS,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC;AAEhG;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,8BAiEX;AAjED,WAAY,8BAA8B;IACxC,g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CAAC,gCAAgC;YAClE,OAAO,uBAAuB,GAAG,CAAC,GAAG,uEAAuE,GAAG,CAAC,MAAM,0DAA0D,CAAC;QACnL,KAAK,8BAA8B,CAAC,wBAAwB;YAC1D,OAAO,iBAAiB,GAAG,CAAC,GAAG,8GAA8G,CAAC;IAClJ,CAAC;AACH,CAAC","sourcesContent":["import { CORE_ORG_ROLES, EngineCapability, HumanDecision_RouteKind } from '@wildo-ai/saas-models';\n\nimport {\n BuildPlanTaskProductKind,\n serviceMethodElementRef,\n type BuildPlanTaskGraph,\n} from '../build-plan/build-plan-task-graph.schemas';\nimport { domainPlanResourceSlugRef, type DomainPlanOutputSet } from '../domain-plan/domain-plan-output-set.schemas';\nimport { projectDomainPlanResources } from '../domain-plan/domain-plan.family-aspects';\nimport { ServiceMethodPricing, ServiceMethodQualificationHolder, ServiceMethodStepPerformer, type ServiceMethod } from './service-method.schemas';\n\nconst CORE_ORG_ROLE_NAMES: ReadonlySet<string> = new Set<string>(Object.values(CORE_ORG_ROLES));\n\n/**\n * What the families derived from a firm's method leave out of it (#2305 S4), one kind per element the method declares.\n *\n * The method is the one place the firm's work is written down; the domain plan and the build plan realize it. These are\n * the elements a realization can miss, each named by the method's own ref, so a gap says which part of the firm's work\n * the application would be built without.\n */\nexport enum ServiceMethodDerivationGapKind {\n /** A service's case names a resource the domain plan does not declare: the cases would have nowhere to live. */\n CASE_WITHOUT_RESOURCE = 'CASE_WITHOUT_RESOURCE',\n /** A case resource no build task marks as the work unit, so no model call is costed to a case. */\n CASE_WITHOUT_WORK_UNIT = 'CASE_WITHOUT_WORK_UNIT',\n /** An AGENT step no agent product carries. */\n AGENT_STEP_WITHOUT_AGENT = 'AGENT_STEP_WITHOUT_AGENT',\n /** An agent product carries an AGENT step but runs in another shape than the step declares. */\n AGENT_SHAPE_DIFFERS = 'AGENT_SHAPE_DIFFERS',\n /**\n * A product names a method element the method does not declare: a step or decision (or a step no agent performs), the\n * service a usage recording bills, or the deliverable a document generates. A DANGLING finding: the dangling-reference\n * refusal owns it.\n */\n UNKNOWN_METHOD_ELEMENT = 'UNKNOWN_METHOD_ELEMENT',\n /** A decision point neither an approval gate nor an agent's review question realizes. */\n DECISION_WITHOUT_GATE = 'DECISION_WITHOUT_GATE',\n /** A decision point realized BOTH by a gate and by an agent's review question: a review question is the review, and its tool carries no gate. */\n DECISION_REALIZED_TWICE = 'DECISION_REALIZED_TWICE',\n /** A gate realizes a decision point with another route, role or qualification set than the method declares. */\n GATE_DIFFERS = 'GATE_DIFFERS',\n /** A qualification names a role that is neither the engine's nor one a build task declares. */\n QUALIFICATION_ROLE_UNDECLARED = 'QUALIFICATION_ROLE_UNDECLARED',\n /** A service priced PER CASE whose case no operation records as metered usage (#2305 S5): its cases would never be billed. */\n CASE_PRICE_NOT_RECORDED = 'CASE_PRICE_NOT_RECORDED',\n /**\n * A usage recording billing a service's cases records on another resource than the case, counts every run rather than\n * once per case, records a product the plan does not sell, or bills a service not priced per case.\n */\n CASE_PRICE_RECORDING_DIFFERS = 'CASE_PRICE_RECORDING_DIFFERS',\n /** A case resource with more than one stage that has no lifecycle in the domain plan (#2305 S6). The domain plan's to fix. */\n CASE_WITHOUT_LIFECYCLE = 'CASE_WITHOUT_LIFECYCLE',\n /** A stage of a case that is not a state of its resource's lifecycle, in upper snake case (#2305 S6). The domain plan's. */\n STAGE_NOT_A_STATE = 'STAGE_NOT_A_STATE',\n /** A deliverable produced from a resource the domain plan does not declare (#2305 S6). The domain plan's. */\n DELIVERABLE_RESOURCE_UNDECLARED = 'DELIVERABLE_RESOURCE_UNDECLARED',\n /** A deliverable no document realizes: no `PDF_TEMPLATE` product names it (#2305 S6). */\n DELIVERABLE_WITHOUT_DOCUMENT = 'DELIVERABLE_WITHOUT_DOCUMENT',\n /** A document realizing a deliverable is generated from another resource than the deliverable's (#2305 S6). */\n DELIVERABLE_DIFFERS = 'DELIVERABLE_DIFFERS',\n /**\n * A deliverable a decision approves (`approvedByDecisionRef`) whose approval would not bind its file (#2915): the\n * decision is asked as an agent's review question, which carries no file, or a gate realizing it names no\n * `deliverableFileArgument`. Its seal would then record an approval without the file that was approved.\n */\n DELIVERABLE_APPROVAL_NOT_BOUND = 'DELIVERABLE_APPROVAL_NOT_BOUND',\n /**\n * A gate realizing a decision signs the approved file at another level than the method requires (#2915), signs one\n * the method does not have signed, or does not sign one it does (`electronicSignatureLevel` against `signature.level`).\n */\n DELIVERABLE_SIGNATURE_DIFFERS = 'DELIVERABLE_SIGNATURE_DIFFERS',\n /** A resource holding a case's evidence (the case, a deliverable's resource) with no retention binding (#2305 S6). */\n EVIDENCE_RETENTION_NOT_BOUND = 'EVIDENCE_RETENTION_NOT_BOUND',\n /** A resource holding a case's evidence bound to another retention class than the service's (#2305 S6). */\n EVIDENCE_RETENTION_DIFFERS = 'EVIDENCE_RETENTION_DIFFERS',\n /**\n * A qualification the firm's people hold for the client (`heldBy: FIRM`) whose role no relationship confers (#2305 S6):\n * they could never hold it for a client, so the decisions requiring it would reach nobody.\n */\n QUALIFICATION_ROLE_NOT_CONFERRED = 'QUALIFICATION_ROLE_NOT_CONFERRED',\n /**\n * A service priced PER CASE on an application whose line has no billing at all (an internal tool, #2305 review): its\n * cases can never be billed, and no usage recording can be built for them. The method's to fix (`BILLED_OUTSIDE`).\n */\n PER_CASE_WITHOUT_BILLING = 'PER_CASE_WITHOUT_BILLING',\n}\n\n/**\n * The gaps the DOMAIN PLAN must fix (#2305 S4, S6): each names an element no build task can realize while the domain plan\n * lacks it (a build product's `resourceRef` is an edge to the domain plan). They route back to the conception through the\n * coherence report and `conception-buildable`, and a candidate build plan is never refused for them: refusing would leave\n * no build plan that passes.\n */\nexport const DOMAIN_PLAN_SERVICE_METHOD_GAP_KINDS: ReadonlySet<ServiceMethodDerivationGapKind> = new Set([\n ServiceMethodDerivationGapKind.CASE_WITHOUT_RESOURCE,\n ServiceMethodDerivationGapKind.CASE_WITHOUT_LIFECYCLE,\n ServiceMethodDerivationGapKind.STAGE_NOT_A_STATE,\n ServiceMethodDerivationGapKind.DELIVERABLE_RESOURCE_UNDECLARED,\n]);\n\n/**\n * The gaps the METHOD itself must fix (#2305 review), for the same reason as {@link DOMAIN_PLAN_SERVICE_METHOD_GAP_KINDS}:\n * no build plan can realize them, so a candidate is never refused for them, and they route back to the method.\n */\nexport const METHOD_SERVICE_METHOD_GAP_KINDS: ReadonlySet<ServiceMethodDerivationGapKind> = new Set([\n ServiceMethodDerivationGapKind.PER_CASE_WITHOUT_BILLING,\n]);\n\n/** A stage ref as the domain plan's lifecycle state spells it: `in-reconciliation` → `IN_RECONCILIATION`. */\nexport function serviceMethodStageState(stageRef: string): string {\n return stageRef.toUpperCase().replaceAll('-', '_');\n}\n\n/** One element of the method a derived family leaves out, named by the method's own ref. */\nexport interface ServiceMethodDerivationGap {\n readonly kind: ServiceMethodDerivationGapKind;\n /**\n * `<serviceRef>/<stepRef, decisionRef, stageRef or deliverableRef>`, a case's or evidence resource's ref, a qualification\n * ref, or a service ref (pricing).\n */\n readonly ref: string;\n /**\n * What the gap's message needs beyond the ref: what differs, for the kinds that compare (`AGENT_SHAPE_DIFFERS`,\n * `GATE_DIFFERS`, `CASE_PRICE_RECORDING_DIFFERS`, `DELIVERABLE_DIFFERS`, `EVIDENCE_RETENTION_DIFFERS`,\n * `DELIVERABLE_APPROVAL_NOT_BOUND`, `DELIVERABLE_SIGNATURE_DIFFERS`), the role for\n * `QUALIFICATION_ROLE_UNDECLARED` and `QUALIFICATION_ROLE_NOT_CONFERRED`, why the ref names nothing for\n * `UNKNOWN_METHOD_ELEMENT`, the resource for `DELIVERABLE_RESOURCE_UNDECLARED`, the service and class expected for\n * `EVIDENCE_RETENTION_NOT_BOUND`, and the stage for `STAGE_NOT_A_STATE`. A kind whose message prints it must set it:\n * `describeServiceMethodDerivationGap` is the list.\n */\n readonly detail?: string;\n}\n\n/**\n * Every element of the firm's method the domain plan or the build plan does not realize (#2305 S4). Pure, and TOTAL\n * over the method, so a decision point added to it tomorrow is reported by every existing plan.\n *\n * ## What counts\n *\n * - a service's case is a resource the domain plan declares, and the build plan marks it as the work unit\n * (`WORK_UNIT_RESOURCE`);\n * - every AGENT step is carried by an `APPLICATION_AGENT` product naming it in `serviceMethodStepRefs`, in the step's\n * `agentShape`;\n * - every decision point is realized, ONE way: by an `AGENT_APPROVAL_GATE` naming it in `serviceMethodDecisionRef`, with\n * the decision's route, its qualification's role as `eligibleRole`, and exactly its qualification's professional\n * kind as `requiredQualificationKinds` (none when the qualification names none); or by an agent that asks it as a\n * review question (`serviceMethodAskedDecisionRefs`), whose route its code builds at suspension and is not compared;\n * - every qualification's role is an engine role or one an `APPLICATION_ROLE` product declares;\n * - every service priced `PER_CASE` is billed (#2305 S5): a `METERED_USAGE_RECORDING` product naming it in\n * `serviceMethodServiceRef` records, ONCE PER ROW, on the service's case resource, a product an\n * `APPLICATION_BILLING_PRODUCT` of the plan sells. A recording naming a service priced otherwise is reported too: a\n * case billed per case while the method says the plan includes it, or the firm bills it outside, charges twice;\n * - every case resource with more than one stage has a lifecycle in the domain plan whose states include each stage, in\n * upper snake case (#2305 S6);\n * - every deliverable is produced from a resource the domain plan declares, and a `PDF_TEMPLATE` product naming it in\n * `serviceMethodDeliverableRef` generates it from that resource;\n * - every deliverable a decision approves (`approvedByDecisionRef`, #2915) is approved through a gate that binds its\n * file (`deliverableFileArgument`), never through a review question, which carries no file; and every gate realizing a\n * decision signs the file at exactly the level the deliverable it approves requires (`electronicSignatureLevel`\n * against `signature.level`), none when it requires none;\n * - every resource holding a case's evidence (the case resource and each deliverable's resource) has a\n * `RESOURCE_RETENTION_BINDING` product in the service's `evidenceRetention.retentionClass`;\n * - every qualification the firm's people hold for the client (`heldBy: FIRM`) has a `RELATIONSHIP_CONFERRED_ROLE`\n * product for its role, unless the role is `ORG_REPRESENTATIVE`, which the service relationship confers by default.\n *\n * Either plan may be absent: the elements only it can realize are then not judged, and nothing is reported for them.\n * When the domain plan is given and does not declare a case's (or a deliverable's) resource, it is reported once\n * (`CASE_WITHOUT_RESOURCE`, `DELIVERABLE_RESOURCE_UNDECLARED`) and NOT also held to what the build plan does with it (a\n * work unit, a recording, a document, a retention binding): no build task could name a resource the domain plan does\n * not declare (its `resourceRef` is an edge to the domain plan), so the fix is the domain plan's, not the build plan's.\n * Those kinds are {@link DOMAIN_PLAN_SERVICE_METHOD_GAP_KINDS}.\n *\n * Every product claiming an element is compared, not only one, so the result does not depend on product order: a\n * second gate on the wrong role beside a correct one is still reported.\n * A plan that is the method's realization is COMPLETE, so a missing element is a gap even when a task for it was\n * built earlier: the build plan keeps every task it built.\n *\n * Known limits: a decision's deadline is not compared. The gate product carries no deadline, so the method's\n * `decisionDeadline` reaches the gate task through its objective and the coding agent's tool declaration. Which\n * operation closes a case is not compared either: the method says when a case closes in the creator's words\n * (`closesWhen`), so the recording's operation is the build plan's reading of it. And the billed product being METERED\n * is not visible in the plan (a billing product names only its key); a usage recording against a product that is not\n * metered records nothing at runtime, and warns.\n */\nexport function findServiceMethodDerivationGaps(input: {\n readonly method: ServiceMethod;\n readonly domainPlan?: Pick<DomainPlanOutputSet, 'modules' | 'lifecycles'>;\n readonly buildPlan?: BuildPlanTaskGraph;\n /** The engine capabilities the application's line excludes (`resolveExcludedEngineCapabilities`); none when unknown. */\n readonly excludedEngineCapabilities?: ReadonlySet<EngineCapability>;\n}): readonly ServiceMethodDerivationGap[] {\n const { method, domainPlan, buildPlan } = input;\n const billingExcluded = input.excludedEngineCapabilities?.has(EngineCapability.BILLING) === true;\n const gaps: ServiceMethodDerivationGap[] = [];\n\n const undeclaredResources = new Set<string>();\n if (domainPlan !== undefined) {\n /*\n * By REF form (#3204): a case and a deliverable cite a resource as a kebab slug, while the plan and its\n * lifecycles name it as the registry will (`siteVisit`). `domainPlanResourceSlugRef` is the one mapping.\n */\n const resources = new Set(projectDomainPlanResources(domainPlan.modules).map((resource) => resource.resourceSlugRef));\n const lifecycles = new Map((domainPlan.lifecycles ?? []).map((lifecycle) => [domainPlanResourceSlugRef(lifecycle.resourceRef), lifecycle]));\n for (const service of method.services) {\n const caseRef = service.case.caseRef;\n if (!resources.has(caseRef)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_WITHOUT_RESOURCE, ref: caseRef });\n undeclaredResources.add(caseRef);\n } else if (service.stages.length > 1) {\n // A one-stage case moves through no states, and a lifecycle needs two.\n const lifecycle = lifecycles.get(caseRef);\n if (lifecycle === undefined) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_WITHOUT_LIFECYCLE, ref: caseRef });\n } else {\n for (const stage of service.stages.filter((candidate) => !lifecycle.states.includes(serviceMethodStageState(candidate.stageRef)))) {\n gaps.push({\n kind: ServiceMethodDerivationGapKind.STAGE_NOT_A_STATE,\n ref: serviceMethodElementRef(service.serviceRef, stage.stageRef),\n detail: `${caseRef}'s lifecycle has no state ${serviceMethodStageState(stage.stageRef)}`,\n });\n }\n }\n }\n for (const deliverable of service.deliverables.filter((candidate) => !resources.has(candidate.fromResourceRef))) {\n gaps.push({\n kind: ServiceMethodDerivationGapKind.DELIVERABLE_RESOURCE_UNDECLARED,\n ref: serviceMethodElementRef(service.serviceRef, deliverable.deliverableRef),\n detail: deliverable.fromResourceRef,\n });\n undeclaredResources.add(deliverable.fromResourceRef);\n }\n }\n }\n // A price per case on a line with no billing is the method's own contradiction, whatever a build plan says (#2305 review).\n if (billingExcluded) {\n for (const service of method.services) {\n if (service.pricing === ServiceMethodPricing.PER_CASE) gaps.push({ kind: ServiceMethodDerivationGapKind.PER_CASE_WITHOUT_BILLING, ref: service.serviceRef });\n }\n }\n if (buildPlan === undefined) return gaps;\n const casesWithoutResource = undeclaredResources;\n\n const products = buildPlan.tasks.flatMap((task) => task.produces);\n const workUnits = new Set(products.flatMap((product) => (product.kind === BuildPlanTaskProductKind.WORK_UNIT_RESOURCE ? [product.resourceRef] : [])));\n type Gate = Extract<(typeof products)[number], { kind: BuildPlanTaskProductKind.AGENT_APPROVAL_GATE }>;\n const agentsByStep = new Map<string, { readonly agentRef: string; readonly shape: string }[]>();\n const gatesByDecision = new Map<string, Gate[]>();\n const askedDecisions = new Set<string>();\n const declaredRoles = new Set<string>();\n type UsageRecording = Extract<(typeof products)[number], { kind: BuildPlanTaskProductKind.METERED_USAGE_RECORDING }>;\n const recordingsByService = new Map<string, UsageRecording[]>();\n const soldProductKeys = new Set<string>();\n type Document = Extract<(typeof products)[number], { kind: BuildPlanTaskProductKind.PDF_TEMPLATE }>;\n const documentsByDeliverable = new Map<string, Document[]>();\n const retentionByResource = new Map<string, string[]>();\n const conferredRoles = new Set<string>();\n const claim = <T>(map: Map<string, T[]>, ref: string, value: T): void => { map.set(ref, [...(map.get(ref) ?? []), value]); };\n for (const product of products) {\n if (product.kind === BuildPlanTaskProductKind.APPLICATION_AGENT) {\n for (const stepRef of product.serviceMethodStepRefs ?? []) claim(agentsByStep, stepRef, { agentRef: product.agentRef, shape: product.shape });\n for (const decisionRef of product.serviceMethodAskedDecisionRefs ?? []) askedDecisions.add(decisionRef);\n } else if (product.kind === BuildPlanTaskProductKind.AGENT_APPROVAL_GATE && product.serviceMethodDecisionRef !== undefined) {\n claim(gatesByDecision, product.serviceMethodDecisionRef, product);\n } else if (product.kind === BuildPlanTaskProductKind.APPLICATION_ROLE) {\n declaredRoles.add(product.roleRef);\n } else if (product.kind === BuildPlanTaskProductKind.METERED_USAGE_RECORDING && product.serviceMethodServiceRef !== undefined) {\n claim(recordingsByService, product.serviceMethodServiceRef, product);\n } else if (product.kind === BuildPlanTaskProductKind.APPLICATION_BILLING_PRODUCT) {\n soldProductKeys.add(product.productKey);\n } else if (product.kind === BuildPlanTaskProductKind.PDF_TEMPLATE && product.serviceMethodDeliverableRef !== undefined) {\n claim(documentsByDeliverable, product.serviceMethodDeliverableRef, product);\n } else if (product.kind === BuildPlanTaskProductKind.RESOURCE_RETENTION_BINDING) {\n claim(retentionByResource, product.resourceRef, product.retentionClass);\n } else if (product.kind === BuildPlanTaskProductKind.RELATIONSHIP_CONFERRED_ROLE) {\n conferredRoles.add(product.roleRef);\n }\n }\n\n const qualifications = new Map((method.qualifications ?? []).map((qualification) => [qualification.qualificationRef, qualification]));\n const agentSteps = new Set<string>();\n const decisions = new Set<string>();\n const deliverables = new Set<string>();\n for (const service of method.services) {\n if (!casesWithoutResource.has(service.case.caseRef) && !workUnits.has(service.case.caseRef)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_WITHOUT_WORK_UNIT, ref: service.case.caseRef });\n }\n const recordings = recordingsByService.get(service.serviceRef) ?? [];\n const perCase = service.pricing === ServiceMethodPricing.PER_CASE;\n // On a line with no billing a price per case is the method's gap (reported above), and owing a recording no build\n // can make would refuse every build plan (#2305 review).\n if (perCase && !billingExcluded && recordings.length === 0 && !casesWithoutResource.has(service.case.caseRef)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_PRICE_NOT_RECORDED, ref: service.serviceRef });\n }\n for (const recording of recordings) {\n const differences = perCase\n ? [\n recording.resourceRef === service.case.caseRef ? undefined : `records on ${recording.resourceRef}, the case is ${service.case.caseRef}`,\n recording.oncePerRecord ? undefined : 'counts every run, a price per case counts each case once (`oncePerRecord`)',\n soldProductKeys.has(recording.productKey) ? undefined : `records the product ${recording.productKey}, which no APPLICATION_BILLING_PRODUCT of the plan sells`,\n ].filter((difference): difference is string => difference !== undefined)\n : [`the service is priced ${service.pricing}, not per case`];\n if (differences.length > 0) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.CASE_PRICE_RECORDING_DIFFERS, ref: service.serviceRef, detail: `${recording.resourceRef}.${recording.operationRef}: ${differences.join('; ')}` });\n }\n }\n for (const deliverable of service.deliverables) {\n const ref = serviceMethodElementRef(service.serviceRef, deliverable.deliverableRef);\n deliverables.add(ref);\n if (undeclaredResources.has(deliverable.fromResourceRef)) continue;\n const documents = documentsByDeliverable.get(ref) ?? [];\n if (documents.length === 0) gaps.push({ kind: ServiceMethodDerivationGapKind.DELIVERABLE_WITHOUT_DOCUMENT, ref });\n for (const document of documents.filter((candidate) => candidate.resourceRef !== deliverable.fromResourceRef)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.DELIVERABLE_DIFFERS, ref, detail: `${document.templateRef} is generated from ${document.resourceRef}, the deliverable from ${deliverable.fromResourceRef}` });\n }\n }\n for (const step of service.steps) {\n if (step.performedBy !== ServiceMethodStepPerformer.AGENT) continue;\n const ref = serviceMethodElementRef(service.serviceRef, step.stepRef);\n agentSteps.add(ref);\n const agents = agentsByStep.get(ref) ?? [];\n if (agents.length === 0) gaps.push({ kind: ServiceMethodDerivationGapKind.AGENT_STEP_WITHOUT_AGENT, ref });\n for (const agent of agents.filter((candidate) => candidate.shape !== step.agentShape)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.AGENT_SHAPE_DIFFERS, ref, detail: `${agent.agentRef} runs ${agent.shape}, the step declares ${String(step.agentShape)}` });\n }\n }\n // #2915: the deliverable each decision approves; the method's validation refuses one decision approving two.\n const approvedBy = new Map(service.deliverables.flatMap((deliverable) => (deliverable.approvedByDecisionRef === undefined ? [] : [[deliverable.approvedByDecisionRef, deliverable] as const])));\n for (const decision of service.decisionPoints) {\n const ref = serviceMethodElementRef(service.serviceRef, decision.decisionRef);\n decisions.add(ref);\n const gates = gatesByDecision.get(ref) ?? [];\n const asked = askedDecisions.has(ref);\n if (gates.length === 0 && !asked) gaps.push({ kind: ServiceMethodDerivationGapKind.DECISION_WITHOUT_GATE, ref });\n if (gates.length > 0 && asked) gaps.push({ kind: ServiceMethodDerivationGapKind.DECISION_REALIZED_TWICE, ref });\n /*\n * #2915: an approval that releases a deliverable binds its file, and signs it as the method says. A deliverable\n * produced from a resource the domain plan does not declare is the domain plan's to fix first (as for its document).\n */\n const approved = approvedBy.get(decision.decisionRef);\n const approvedJudged = approved !== undefined && !undeclaredResources.has(approved.fromResourceRef);\n const approvedRef = approved === undefined ? ref : serviceMethodElementRef(service.serviceRef, approved.deliverableRef);\n if (approvedJudged) {\n if (asked) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.DELIVERABLE_APPROVAL_NOT_BOUND, ref: approvedRef, detail: `${ref} is asked as a review question, which binds no file; realize it by a gate` });\n }\n for (const gate of gates.filter((candidate) => candidate.deliverableFileArgument === undefined)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.DELIVERABLE_APPROVAL_NOT_BOUND, ref: approvedRef, detail: `${gate.functionRef} names no deliverableFileArgument` });\n }\n }\n if (approved === undefined || approvedJudged) {\n const requiredLevel = approved?.signature?.level;\n for (const gate of gates.filter((candidate) => candidate.electronicSignatureLevel !== requiredLevel)) {\n gaps.push({\n kind: ServiceMethodDerivationGapKind.DELIVERABLE_SIGNATURE_DIFFERS,\n ref: approvedRef,\n detail: `${gate.functionRef} signs ${gate.electronicSignatureLevel === undefined ? 'nothing' : `at ${gate.electronicSignatureLevel}`}, the method ${requiredLevel === undefined ? 'has nothing signed' : `requires ${requiredLevel}`}`,\n });\n }\n }\n const qualification = decision.qualificationRef === undefined ? undefined : qualifications.get(decision.qualificationRef);\n const expectedKinds = qualification?.professionalQualificationKind === undefined ? [] : [qualification.professionalQualificationKind];\n for (const gate of gates) {\n const gateKinds = [...(gate.requiredQualificationKinds ?? [])].sort();\n const differences = [\n gate.route === decision.route ? undefined : `route ${gate.route}, the method declares ${decision.route}`,\n decision.route === HumanDecision_RouteKind.OWNER || gate.eligibleRole === qualification?.role\n ? undefined\n : `role ${gate.eligibleRole ?? 'none'}, the qualification names ${qualification?.role ?? 'none'}`,\n JSON.stringify(gateKinds) === JSON.stringify(expectedKinds)\n ? undefined\n : `qualifications [${gateKinds.join(', ')}], the method requires [${expectedKinds.join(', ')}]`,\n ].filter((difference): difference is string => difference !== undefined);\n if (differences.length > 0) gaps.push({ kind: ServiceMethodDerivationGapKind.GATE_DIFFERS, ref, detail: `${gate.functionRef}: ${differences.join('; ')}` });\n }\n }\n }\n\n for (const stepRef of agentsByStep.keys()) {\n if (!agentSteps.has(stepRef)) gaps.push({ kind: ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT, ref: stepRef, detail: 'no AGENT step of the method has this ref' });\n }\n for (const decisionRef of new Set([...gatesByDecision.keys(), ...askedDecisions])) {\n if (!decisions.has(decisionRef)) gaps.push({ kind: ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT, ref: decisionRef, detail: 'no decision point of the method has this ref' });\n }\n /*\n * #2305 S6: each resource holding a case's evidence is judged ONCE, against the class its services keep it in (the\n * method's validation refuses two services keeping one resource in different classes, so the first one names it).\n */\n const evidence = new Map<string, { readonly serviceRef: string; readonly retentionClass: string }>();\n for (const service of method.services) {\n for (const resourceRef of [service.case.caseRef, ...service.deliverables.map((deliverable) => deliverable.fromResourceRef)]) {\n if (!undeclaredResources.has(resourceRef) && !evidence.has(resourceRef)) {\n evidence.set(resourceRef, { serviceRef: service.serviceRef, retentionClass: service.evidenceRetention.retentionClass });\n }\n }\n }\n for (const [resourceRef, expected] of evidence) {\n const classes = retentionByResource.get(resourceRef) ?? [];\n if (classes.length === 0) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_NOT_BOUND, ref: resourceRef, detail: `${expected.serviceRef} keeps its evidence as ${expected.retentionClass}` });\n }\n for (const retentionClass of classes.filter((candidate) => candidate !== expected.retentionClass)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_DIFFERS, ref: resourceRef, detail: `bound to ${retentionClass}, ${expected.serviceRef} keeps its evidence as ${expected.retentionClass}` });\n }\n }\n\n const services = new Set(method.services.map((service) => service.serviceRef));\n for (const serviceRef of recordingsByService.keys()) {\n if (!services.has(serviceRef)) gaps.push({ kind: ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT, ref: serviceRef, detail: 'no service of the method has this ref' });\n }\n for (const deliverableRef of documentsByDeliverable.keys()) {\n if (!deliverables.has(deliverableRef)) gaps.push({ kind: ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT, ref: deliverableRef, detail: 'no deliverable of the method has this ref' });\n }\n // Only the qualifications a decision routes to (#2305 review): an unused one is the method's mark\n // (`QUALIFICATION_UNUSED`), and holding it to a role declaration and a conferral would build a role nothing uses.\n const usedQualificationRefs = new Set(method.services.flatMap((service) => service.decisionPoints\n .map((decision) => decision.qualificationRef).filter((ref): ref is string => ref !== undefined)));\n for (const qualification of (method.qualifications ?? []).filter((candidate) => usedQualificationRefs.has(candidate.qualificationRef))) {\n // An organization role: a core one, or one the application declares. An application role is refused by the method's\n // own refinement, so it is not counted as declared here either (#2305 review C2).\n if (!CORE_ORG_ROLE_NAMES.has(qualification.role) && !declaredRoles.has(qualification.role)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.QUALIFICATION_ROLE_UNDECLARED, ref: qualification.qualificationRef, detail: qualification.role });\n }\n // A role the FIRM's people hold for the client reaches them only through a relationship that confers it, except\n // `ORG_REPRESENTATIVE`, which the service relationship confers by default. The client's own staff need nothing conferred.\n if (qualification.heldBy === ServiceMethodQualificationHolder.FIRM && qualification.role !== CORE_ORG_ROLES.ORG_REPRESENTATIVE\n && !conferredRoles.has(qualification.role)) {\n gaps.push({ kind: ServiceMethodDerivationGapKind.QUALIFICATION_ROLE_NOT_CONFERRED, ref: qualification.qualificationRef, detail: qualification.role });\n }\n }\n return gaps;\n}\n\n/** One line per gap, in the words a model or a person acts on. */\nexport function describeServiceMethodDerivationGap(gap: ServiceMethodDerivationGap): string {\n switch (gap.kind) {\n case ServiceMethodDerivationGapKind.CASE_WITHOUT_RESOURCE:\n return `the case resource \\`${gap.ref}\\` is not a resource of the domain plan`;\n case ServiceMethodDerivationGapKind.CASE_WITHOUT_WORK_UNIT:\n return `the case resource \\`${gap.ref}\\` has no WORK_UNIT_RESOURCE product`;\n case ServiceMethodDerivationGapKind.AGENT_STEP_WITHOUT_AGENT:\n return `the agent step \\`${gap.ref}\\` is carried by no APPLICATION_AGENT product (name it in \\`serviceMethodStepRefs\\`)`;\n case ServiceMethodDerivationGapKind.AGENT_SHAPE_DIFFERS:\n return `the agent step \\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.UNKNOWN_METHOD_ELEMENT:\n return `\\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.DECISION_WITHOUT_GATE:\n return `the decision point \\`${gap.ref}\\` is realized neither by an AGENT_APPROVAL_GATE product (\\`serviceMethodDecisionRef\\`) nor by an agent that asks it as a review question (\\`serviceMethodAskedDecisionRefs\\`)`;\n case ServiceMethodDerivationGapKind.DECISION_REALIZED_TWICE:\n return `the decision point \\`${gap.ref}\\` is realized both by a gate and by an agent's review question; keep one`;\n case ServiceMethodDerivationGapKind.GATE_DIFFERS:\n return `the decision point \\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.QUALIFICATION_ROLE_UNDECLARED:\n return `the qualification \\`${gap.ref}\\` needs the role \\`${gap.detail}\\`, which is not an engine role and no APPLICATION_ROLE product declares it`;\n case ServiceMethodDerivationGapKind.CASE_PRICE_NOT_RECORDED:\n return `the service \\`${gap.ref}\\` is priced per case and no METERED_USAGE_RECORDING product records its case (name it in \\`serviceMethodServiceRef\\`, once per record, on the operation that closes the case)`;\n case ServiceMethodDerivationGapKind.CASE_PRICE_RECORDING_DIFFERS:\n return `the service \\`${gap.ref}\\`'s price per case: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.CASE_WITHOUT_LIFECYCLE:\n return `the case resource \\`${gap.ref}\\` has no lifecycle in the domain plan (its stages are its states)`;\n case ServiceMethodDerivationGapKind.STAGE_NOT_A_STATE:\n return `the stage \\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.DELIVERABLE_RESOURCE_UNDECLARED:\n return `the deliverable \\`${gap.ref}\\` is produced from \\`${gap.detail}\\`, which is not a resource of the domain plan`;\n case ServiceMethodDerivationGapKind.DELIVERABLE_WITHOUT_DOCUMENT:\n return `the deliverable \\`${gap.ref}\\` is generated by no PDF_TEMPLATE product (name it in \\`serviceMethodDeliverableRef\\`)`;\n case ServiceMethodDerivationGapKind.DELIVERABLE_DIFFERS:\n return `the deliverable \\`${gap.ref}\\`: ${gap.detail}`;\n case ServiceMethodDerivationGapKind.DELIVERABLE_APPROVAL_NOT_BOUND:\n return `the deliverable \\`${gap.ref}\\` is approved without its file being bound (${gap.detail}): the gate realizing its approving decision names the tool argument carrying the file in \\`deliverableFileArgument\\``;\n case ServiceMethodDerivationGapKind.DELIVERABLE_SIGNATURE_DIFFERS:\n return `the approval of \\`${gap.ref}\\`: ${gap.detail} (\\`electronicSignatureLevel\\` on the gate)`;\n case ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_NOT_BOUND:\n return `the resource \\`${gap.ref}\\` holds a case's evidence and has no RESOURCE_RETENTION_BINDING product (${gap.detail})`;\n case ServiceMethodDerivationGapKind.EVIDENCE_RETENTION_DIFFERS:\n return `the resource \\`${gap.ref}\\` is ${gap.detail}`;\n case ServiceMethodDerivationGapKind.QUALIFICATION_ROLE_NOT_CONFERRED:\n return `the qualification \\`${gap.ref}\\` is held by the firm's people for the client and needs the role \\`${gap.detail}\\`, which no RELATIONSHIP_CONFERRED_ROLE product confers`;\n case ServiceMethodDerivationGapKind.PER_CASE_WITHOUT_BILLING:\n return `the service \\`${gap.ref}\\` is priced per case, and this application's line has no billing: price it \\`BILLED_OUTSIDE\\` in the method`;\n }\n}\n"]}
@@ -51,6 +51,11 @@ export declare const ServiceMethodGenerationSchema: z.ZodObject<{
51
51
  label: z.ZodString;
52
52
  stageRef: z.ZodString;
53
53
  fromResourceRef: z.ZodString;
54
+ approvedByDecisionRef: z.ZodOptional<z.ZodString>;
55
+ signature: z.ZodOptional<z.ZodObject<{
56
+ level: z.ZodEnum<typeof import("@wildo-ai/external-connectors-models").ElectronicSignature_Level>;
57
+ ground: z.ZodString;
58
+ }, z.core.$strict>>;
54
59
  }, z.core.$strict>>>;
55
60
  evidenceRetention: z.ZodObject<{
56
61
  retentionClass: z.ZodEnum<typeof import("@wildo-ai/saas-models").DataRetentionClass>;
@@ -1 +1 @@
1
- {"version":3,"file":"service-method-generation.schemas.d.ts","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAQL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAUxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,yFAAyF;AACzF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAG1E"}
1
+ {"version":3,"file":"service-method-generation.schemas.d.ts","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method-generation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAQL,KAAK,aAAa,EACnB,MAAM,0BAA0B,CAAC;AAElC;;;;;;;;GAQG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAUxC,CAAC;AACH,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAEpF,yFAAyF;AACzF,wBAAgB,4BAA4B,CAAC,KAAK,EAAE,OAAO,GAAG,aAAa,CAG1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"service-method.family-aspects.d.ts","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method.family-aspects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAY1E,eAAO,MAAM,6BAA6B,EAAE,wBA+C3C,CAAC"}
1
+ {"version":3,"file":"service-method.family-aspects.d.ts","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method.family-aspects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAY1E,eAAO,MAAM,6BAA6B,EAAE,wBAgD3C,CAAC"}
@@ -34,6 +34,7 @@ export const SERVICE_METHOD_FAMILY_ASPECTS = {
34
34
  'deliverables.deliverableRef': 'the deliverable\'s own key, addressed only inside its service',
35
35
  'deliverables.stageRef': 'a stage of the same service, checked by the schema rather than by the graph',
36
36
  'deliverables.fromResourceRef': PLANNED_RESOURCE,
37
+ 'deliverables.approvedByDecisionRef': 'a decision of the same service, checked by the schema rather than by the graph',
37
38
  },
38
39
  },
39
40
  {
@@ -1 +1 @@
1
- {"version":3,"file":"service-method.family-aspects.js","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method.family-aspects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+CAA+C,EAAE,MAAM,sDAAsD,CAAC;AAEvH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EAAE,mCAAmC,EAAE,gCAAgC,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAC;AAE7I;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,0HAA0H,CAAC;AAEpJ,MAAM,CAAC,MAAM,6BAA6B,GAA6B;IACrE,SAAS,EAAE,+CAA+C,CAAC,cAAc;IACzE,OAAO,EAAE;QACP;YACE,GAAG,EAAE,wBAAwB;YAC7B,YAAY,EAAE,UAAU;YACxB,IAAI,EAAE,gBAAgB,CAAC,UAAU;YACjC,UAAU,EAAE,0BAA0B;YACtC,WAAW,EAAE,YAAY;YACzB,aAAa,EAAE,OAAO;YACtB,KAAK,EAAE;gBACL,8EAA8E;gBAC9E,EAAE,KAAK,EAAE,gBAAgB,EAAE,YAAY,EAAE,kBAAkB,EAAE,aAAa,EAAE,CAAC,8BAA8B,CAAC,EAAE;aAC/G;YACD,gBAAgB,EAAE;gBAChB,cAAc,EAAE,gBAAgB;gBAChC,iBAAiB,EAAE,yDAAyD;gBAC5E,eAAe,EAAE,wDAAwD;gBACzE,gBAAgB,EAAE,6EAA6E;gBAC/F,iBAAiB,EAAE,gBAAgB;gBACnC,oBAAoB,EAAE,gBAAgB;gBACtC,4BAA4B,EAAE,4DAA4D;gBAC1F,wBAAwB,EAAE,4EAA4E;gBACtG,6BAA6B,EAAE,+DAA+D;gBAC9F,uBAAuB,EAAE,6EAA6E;gBACtG,8BAA8B,EAAE,gBAAgB;aACjD;SACF;QACD;YACE,GAAG,EAAE,8BAA8B;YACnC,YAAY,EAAE,gBAAgB;YAC9B,IAAI,EAAE,gBAAgB,CAAC,UAAU;YACjC,UAAU,EAAE,gCAAgC;YAC5C,WAAW,EAAE,kBAAkB;YAC/B,aAAa,EAAE,OAAO;YACtB,KAAK,EAAE,EAAE;SACV;QACD;YACE,GAAG,EAAE,kCAAkC;YACvC,YAAY,EAAE,mBAAmB;YACjC,IAAI,EAAE,gBAAgB,CAAC,UAAU;YACjC,UAAU,EAAE,mCAAmC;YAC/C,WAAW,EAAE,YAAY;YACzB,aAAa,EAAE,OAAO;YACtB,KAAK,EAAE,EAAE;SACV;KACF;CACF,CAAC","sourcesContent":["import { ApplicationSpecificationFamilySemanticSchemaRef } from '../application-specification-family-identity.schemas';\nimport type { FamilyAspectsDeclaration } from '../family-aspects.schemas';\nimport { FamilyAspectKind } from '../family-aspects.schemas';\nimport { ServiceMethodCorrectionReasonSchema, ServiceMethodQualificationSchema, ServiceMethodServiceSchema } from './service-method.schemas';\n\n/**\n * The domain-plan resources a service names are NOT edges: the domain plan is DERIVED from this family (each case\n * becomes a resource, which the build plan makes the work unit; each step's reads and products the resources it\n * touches), so when the method is written\n * none of them exists yet, and an edge would refuse every first method for refs its own derivation is about to create.\n */\nconst PLANNED_RESOURCE = 'a domain-plan resource the domain plan creates from this method (the method precedes the plan, so it does not exist yet)';\n\nexport const SERVICE_METHOD_FAMILY_ASPECTS: FamilyAspectsDeclaration = {\n schemaRef: ApplicationSpecificationFamilySemanticSchemaRef.SERVICE_METHOD,\n aspects: [\n {\n key: 'service-method.service',\n snapshotPath: 'services',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: ServiceMethodServiceSchema,\n businessKey: 'serviceRef',\n headlineField: 'label',\n edges: [\n // Who may be trusted with each decision: a qualification the method declares.\n { field: 'decisionPoints', throughField: 'qualificationRef', targetAspects: ['service-method.qualification'] },\n ],\n nonEdgeRefFields: {\n 'case.caseRef': PLANNED_RESOURCE,\n 'stages.stageRef': 'the stage\\'s own key, addressed only inside its service',\n 'steps.stepRef': 'the step\\'s own key, addressed only inside its service',\n 'steps.stageRef': 'a stage of the same service, checked by the schema rather than by the graph',\n 'steps.readsRefs': PLANNED_RESOURCE,\n 'steps.producesRefs': PLANNED_RESOURCE,\n 'decisionPoints.decisionRef': 'the decision\\'s own key, addressed only inside its service',\n 'decisionPoints.stepRef': 'a step of the same service, checked by the schema rather than by the graph',\n 'deliverables.deliverableRef': 'the deliverable\\'s own key, addressed only inside its service',\n 'deliverables.stageRef': 'a stage of the same service, checked by the schema rather than by the graph',\n 'deliverables.fromResourceRef': PLANNED_RESOURCE,\n },\n },\n {\n key: 'service-method.qualification',\n snapshotPath: 'qualifications',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: ServiceMethodQualificationSchema,\n businessKey: 'qualificationRef',\n headlineField: 'label',\n edges: [],\n },\n {\n key: 'service-method.correction-reason',\n snapshotPath: 'correctionReasons',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: ServiceMethodCorrectionReasonSchema,\n businessKey: 'reasonCode',\n headlineField: 'label',\n edges: [],\n },\n ],\n};\n"]}
1
+ {"version":3,"file":"service-method.family-aspects.js","sourceRoot":"","sources":["../../../../src/_core/service-method/service-method.family-aspects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+CAA+C,EAAE,MAAM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G,EAAE,kCAAkC;YACvC,YAAY,EAAE,mBAAmB;YACjC,IAAI,EAAE,gBAAgB,CAAC,UAAU;YACjC,UAAU,EAAE,mCAAmC;YAC/C,WAAW,EAAE,YAAY;YACzB,aAAa,EAAE,OAAO;YACtB,KAAK,EAAE,EAAE;SACV;KACF;CACF,CAAC","sourcesContent":["import { ApplicationSpecificationFamilySemanticSchemaRef } from '../application-specification-family-identity.schemas';\nimport type { FamilyAspectsDeclaration } from '../family-aspects.schemas';\nimport { FamilyAspectKind } from '../family-aspects.schemas';\nimport { ServiceMethodCorrectionReasonSchema, ServiceMethodQualificationSchema, ServiceMethodServiceSchema } from './service-method.schemas';\n\n/**\n * The domain-plan resources a service names are NOT edges: the domain plan is DERIVED from this family (each case\n * becomes a resource, which the build plan makes the work unit; each step's reads and products the resources it\n * touches), so when the method is written\n * none of them exists yet, and an edge would refuse every first method for refs its own derivation is about to create.\n */\nconst PLANNED_RESOURCE = 'a domain-plan resource the domain plan creates from this method (the method precedes the plan, so it does not exist yet)';\n\nexport const SERVICE_METHOD_FAMILY_ASPECTS: FamilyAspectsDeclaration = {\n schemaRef: ApplicationSpecificationFamilySemanticSchemaRef.SERVICE_METHOD,\n aspects: [\n {\n key: 'service-method.service',\n snapshotPath: 'services',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: ServiceMethodServiceSchema,\n businessKey: 'serviceRef',\n headlineField: 'label',\n edges: [\n // Who may be trusted with each decision: a qualification the method declares.\n { field: 'decisionPoints', throughField: 'qualificationRef', targetAspects: ['service-method.qualification'] },\n ],\n nonEdgeRefFields: {\n 'case.caseRef': PLANNED_RESOURCE,\n 'stages.stageRef': 'the stage\\'s own key, addressed only inside its service',\n 'steps.stepRef': 'the step\\'s own key, addressed only inside its service',\n 'steps.stageRef': 'a stage of the same service, checked by the schema rather than by the graph',\n 'steps.readsRefs': PLANNED_RESOURCE,\n 'steps.producesRefs': PLANNED_RESOURCE,\n 'decisionPoints.decisionRef': 'the decision\\'s own key, addressed only inside its service',\n 'decisionPoints.stepRef': 'a step of the same service, checked by the schema rather than by the graph',\n 'deliverables.deliverableRef': 'the deliverable\\'s own key, addressed only inside its service',\n 'deliverables.stageRef': 'a stage of the same service, checked by the schema rather than by the graph',\n 'deliverables.fromResourceRef': PLANNED_RESOURCE,\n 'deliverables.approvedByDecisionRef': 'a decision of the same service, checked by the schema rather than by the graph',\n },\n },\n {\n key: 'service-method.qualification',\n snapshotPath: 'qualifications',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: ServiceMethodQualificationSchema,\n businessKey: 'qualificationRef',\n headlineField: 'label',\n edges: [],\n },\n {\n key: 'service-method.correction-reason',\n snapshotPath: 'correctionReasons',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: ServiceMethodCorrectionReasonSchema,\n businessKey: 'reasonCode',\n headlineField: 'label',\n edges: [],\n },\n ],\n};\n"]}