@wildo-ai/dev-companion 1.1.14 → 1.1.16

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 (191) hide show
  1. package/dist/esm/.tsbuildinfo +1 -1
  2. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts +233 -6
  3. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.d.ts.map +1 -1
  4. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js +316 -13
  5. package/dist/esm/claude-cli/models/coding-agent-dispatch.models.js.map +1 -1
  6. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts +48 -2
  7. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.d.ts.map +1 -1
  8. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js +41 -3
  9. package/dist/esm/claude-cli/models/concurrent-coding-runs.models.js.map +1 -1
  10. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.d.ts +68 -0
  11. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.d.ts.map +1 -0
  12. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.js +198 -0
  13. package/dist/esm/claude-cli/models/isolated-recheck-interference.models.js.map +1 -0
  14. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts +6 -0
  15. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.d.ts.map +1 -1
  16. package/dist/esm/claude-cli/models/shared-tree-reconciliation.models.js.map +1 -1
  17. package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts +19 -5
  18. package/dist/esm/claude-cli/models/verification-tool-availability.models.d.ts.map +1 -1
  19. package/dist/esm/claude-cli/models/verification-tool-availability.models.js +17 -5
  20. package/dist/esm/claude-cli/models/verification-tool-availability.models.js.map +1 -1
  21. package/dist/esm/claude-cli/models/workspace-path-claims.models.d.ts +138 -0
  22. package/dist/esm/claude-cli/models/workspace-path-claims.models.d.ts.map +1 -0
  23. package/dist/esm/claude-cli/models/workspace-path-claims.models.js +204 -0
  24. package/dist/esm/claude-cli/models/workspace-path-claims.models.js.map +1 -0
  25. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts +36 -1
  26. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.d.ts.map +1 -1
  27. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js +71 -16
  28. package/dist/esm/claude-cli/services/accepted-change-commit.companion.service.js.map +1 -1
  29. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts +234 -9
  30. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.d.ts.map +1 -1
  31. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js +1073 -182
  32. package/dist/esm/claude-cli/services/coding-agent-dispatch.companion.service.js.map +1 -1
  33. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts +14 -0
  34. package/dist/esm/claude-cli/services/research-evidence-store.companion.d.ts.map +1 -1
  35. package/dist/esm/claude-cli/services/research-evidence-store.companion.js +35 -0
  36. package/dist/esm/claude-cli/services/research-evidence-store.companion.js.map +1 -1
  37. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts +36 -0
  38. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.d.ts.map +1 -0
  39. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js +134 -0
  40. package/dist/esm/claude-cli/services/unrecorded-provider-directories.companion.js.map +1 -0
  41. package/dist/esm/companion-api/controllers/companion.controller.d.ts.map +1 -1
  42. package/dist/esm/companion-api/controllers/companion.controller.js +7 -1
  43. package/dist/esm/companion-api/controllers/companion.controller.js.map +1 -1
  44. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js +1 -1
  45. package/dist/esm/core/introspection/resources/creation-home-projection.companion.js.map +1 -1
  46. package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts +3 -2
  47. package/dist/esm/core/introspection/services/translation-placement.companion.service.d.ts.map +1 -1
  48. package/dist/esm/core/introspection/services/translation-placement.companion.service.js.map +1 -1
  49. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.d.ts +13 -0
  50. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.d.ts.map +1 -1
  51. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.js +98 -16
  52. package/dist/esm/core/introspection/subprocess/app-shell-placement-content.behavior.js.map +1 -1
  53. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.d.ts.map +1 -1
  54. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js +24 -14
  55. package/dist/esm/core/introspection/subprocess/companion-introspection-behavior-handlers.js.map +1 -1
  56. package/dist/esm/core/introspection/workspace-element-index.companion.d.ts +42 -0
  57. package/dist/esm/core/introspection/workspace-element-index.companion.d.ts.map +1 -1
  58. package/dist/esm/core/introspection/workspace-element-index.companion.js +42 -0
  59. package/dist/esm/core/introspection/workspace-element-index.companion.js.map +1 -1
  60. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts +53 -0
  61. package/dist/esm/core/runtime/dev-compile-quiet.companion.d.ts.map +1 -1
  62. package/dist/esm/core/runtime/dev-compile-quiet.companion.js +119 -2
  63. package/dist/esm/core/runtime/dev-compile-quiet.companion.js.map +1 -1
  64. package/dist/esm/core/runtime/services/start-companion-application.service.d.ts.map +1 -1
  65. package/dist/esm/core/runtime/services/start-companion-application.service.js +13 -1
  66. package/dist/esm/core/runtime/services/start-companion-application.service.js.map +1 -1
  67. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts +2 -2
  68. package/dist/esm/core/runtime/utils/companion-platform-config.companion.d.ts.map +1 -1
  69. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js +6 -6
  70. package/dist/esm/core/runtime/utils/companion-platform-config.companion.js.map +1 -1
  71. package/dist/esm/email/services/email-template.companion.service.d.ts +5 -0
  72. package/dist/esm/email/services/email-template.companion.service.d.ts.map +1 -1
  73. package/dist/esm/email/services/email-template.companion.service.js +44 -11
  74. package/dist/esm/email/services/email-template.companion.service.js.map +1 -1
  75. package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts +26 -2
  76. package/dist/esm/email/utils/email-template-fs-discovery.utils.d.ts.map +1 -1
  77. package/dist/esm/email/utils/email-template-fs-discovery.utils.js +41 -2
  78. package/dist/esm/email/utils/email-template-fs-discovery.utils.js.map +1 -1
  79. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts +19 -0
  80. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.d.ts.map +1 -0
  81. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js +171 -0
  82. package/dist/esm/email/utils/email-template-scanner-calls.companion.utils.js.map +1 -0
  83. package/dist/esm/email/utils/module-email-root.companion.utils.d.ts +75 -0
  84. package/dist/esm/email/utils/module-email-root.companion.utils.d.ts.map +1 -0
  85. package/dist/esm/email/utils/module-email-root.companion.utils.js +162 -0
  86. package/dist/esm/email/utils/module-email-root.companion.utils.js.map +1 -0
  87. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts +21 -1
  88. package/dist/esm/expert-personas/services/expert-persona.companion.service.d.ts.map +1 -1
  89. package/dist/esm/expert-personas/services/expert-persona.companion.service.js +35 -3
  90. package/dist/esm/expert-personas/services/expert-persona.companion.service.js.map +1 -1
  91. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.d.ts +62 -0
  92. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.d.ts.map +1 -0
  93. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.js +62 -0
  94. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.en.js.map +1 -0
  95. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.d.ts +62 -0
  96. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.d.ts.map +1 -0
  97. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.js +62 -0
  98. package/dist/esm/i18n/components/APP_LAYOUTS_AGENT_ACTIVITY_SETTINGS.fr.js.map +1 -0
  99. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts +1 -0
  100. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.d.ts.map +1 -1
  101. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js +1 -0
  102. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.en.js.map +1 -1
  103. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts +1 -0
  104. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.d.ts.map +1 -1
  105. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js +1 -0
  106. package/dist/esm/i18n/components/LOW_LEVEL_AI_AGENT_CONFIG.fr.js.map +1 -1
  107. package/dist/esm/i18n/resources/workbenchAspects.en.d.ts.map +1 -1
  108. package/dist/esm/i18n/resources/workbenchAspects.en.js +4 -0
  109. package/dist/esm/i18n/resources/workbenchAspects.en.js.map +1 -1
  110. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts +35 -0
  111. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.d.ts.map +1 -1
  112. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js +12 -0
  113. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.en.js.map +1 -1
  114. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts +536 -531
  115. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.d.ts.map +1 -1
  116. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js +536 -531
  117. package/dist/esm/i18n/resources/workbenchSpecificationArtifacts.fr.js.map +1 -1
  118. package/dist/esm/i18n/system_enums/workbench-build.en.d.ts +3 -3
  119. package/dist/esm/i18n/system_enums/workbench-build.en.js +3 -3
  120. package/dist/esm/i18n/system_enums/workbench-build.en.js.map +1 -1
  121. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.d.ts.map +1 -1
  122. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js +7 -3
  123. package/dist/esm/i18n-labelling/services/email-template-labelling-units.companion.service.js.map +1 -1
  124. package/dist/esm/meta-workflows/models/carried-verification-failure.models.d.ts +23 -0
  125. package/dist/esm/meta-workflows/models/carried-verification-failure.models.d.ts.map +1 -1
  126. package/dist/esm/meta-workflows/models/carried-verification-failure.models.js +14 -0
  127. package/dist/esm/meta-workflows/models/carried-verification-failure.models.js.map +1 -1
  128. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts +21 -1
  129. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.d.ts.map +1 -1
  130. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js +117 -3
  131. package/dist/esm/meta-workflows/models/creation-journey-timeline.models.js.map +1 -1
  132. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts +5 -0
  133. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.d.ts.map +1 -1
  134. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js +22 -1
  135. package/dist/esm/meta-workflows/services/application-assembly-checks.companion.utils.js.map +1 -1
  136. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts +98 -24
  137. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.d.ts.map +1 -1
  138. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js +439 -93
  139. package/dist/esm/meta-workflows/services/application-build-dispatch.companion.service.js.map +1 -1
  140. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts +21 -8
  141. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.d.ts.map +1 -1
  142. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js +74 -12
  143. package/dist/esm/meta-workflows/services/application-build-follow-up-derivation.companion.js.map +1 -1
  144. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts +47 -1
  145. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.d.ts.map +1 -1
  146. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js +98 -9
  147. package/dist/esm/meta-workflows/services/application-build-generation-step.companion.service.js.map +1 -1
  148. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts +39 -3
  149. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.d.ts.map +1 -1
  150. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js +224 -48
  151. package/dist/esm/meta-workflows/services/application-build-task-coding-policy.companion.service.js.map +1 -1
  152. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts +45 -0
  153. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.d.ts.map +1 -1
  154. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js +74 -0
  155. package/dist/esm/meta-workflows/services/application-build-website-context.companion.service.js.map +1 -1
  156. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts +12 -0
  157. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.d.ts.map +1 -1
  158. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js +30 -1
  159. package/dist/esm/meta-workflows/services/build-task-brief-application-facts.companion.js.map +1 -1
  160. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.d.ts.map +1 -1
  161. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js +21 -2
  162. package/dist/esm/meta-workflows/services/creation-run-report.companion.service.js.map +1 -1
  163. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts +71 -5
  164. package/dist/esm/meta-workflows/services/playbook-run.companion.service.d.ts.map +1 -1
  165. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js +219 -17
  166. package/dist/esm/meta-workflows/services/playbook-run.companion.service.js.map +1 -1
  167. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts +55 -1
  168. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.d.ts.map +1 -1
  169. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js +157 -10
  170. package/dist/esm/meta-workflows/services/provider-registry-brief.companion.utils.js.map +1 -1
  171. package/dist/esm/meta-workflows/services/website-demo-facts.models.d.ts +19 -1
  172. package/dist/esm/meta-workflows/services/website-demo-facts.models.d.ts.map +1 -1
  173. package/dist/esm/meta-workflows/services/website-demo-facts.models.js +7 -5
  174. package/dist/esm/meta-workflows/services/website-demo-facts.models.js.map +1 -1
  175. package/dist/esm/module-layout/module-layout-convention.companion.d.ts +158 -0
  176. package/dist/esm/module-layout/module-layout-convention.companion.d.ts.map +1 -0
  177. package/dist/esm/module-layout/module-layout-convention.companion.js +272 -0
  178. package/dist/esm/module-layout/module-layout-convention.companion.js.map +1 -0
  179. package/dist/esm/module-layout/module-layout-inspection.companion.d.ts +42 -0
  180. package/dist/esm/module-layout/module-layout-inspection.companion.d.ts.map +1 -0
  181. package/dist/esm/module-layout/module-layout-inspection.companion.js +290 -0
  182. package/dist/esm/module-layout/module-layout-inspection.companion.js.map +1 -0
  183. package/dist/esm/module-layout/module-source-files.companion.d.ts +3 -0
  184. package/dist/esm/module-layout/module-source-files.companion.d.ts.map +1 -0
  185. package/dist/esm/module-layout/module-source-files.companion.js +45 -0
  186. package/dist/esm/module-layout/module-source-files.companion.js.map +1 -0
  187. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts +2 -0
  188. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.d.ts.map +1 -1
  189. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js +3 -1
  190. package/dist/esm/technical-doc/services/technical-documentation-pilot.companion.service.js.map +1 -1
  191. package/package.json +17 -17
@@ -1,5 +1,7 @@
1
1
  import { type ModuleSearchHit, type RegistryConfig } from '@wildo-ai/platform-config-lib';
2
2
  import { RegistryServerClient } from '@wildo-ai/wildo-module-client';
3
+ import type { ProviderSpecificationConfig } from '@wildo-ai/saas-specifications';
4
+ import { type IntegrationPlanKnownProviders } from '@wildo-ai/saas-specifications/application-creation';
3
5
  /** Where the offered providers were read from. */
4
6
  export declare enum ProviderRegistryListingSource {
5
7
  /** The framework checkout's `providers-registry/`, in framework development. */
@@ -34,6 +36,58 @@ export declare function listRegistryProviderModules(input: {
34
36
  * the tree rather than from a list. Keyed by the provider's REF, not the module id, which nothing requires to match it.
35
37
  */
36
38
  export declare function isRegistryProviderInstalled(applicationRoot: string, providerRef: string): boolean;
39
+ /**
40
+ * One provider the ENGINE ships (#3992): bound by declaring it, never installed. Listed beside the registry's offers so a
41
+ * planner sees everything the framework already has before it concludes a need is unprovided.
42
+ */
43
+ export interface EngineProviderOffer {
44
+ readonly ref: string;
45
+ /**
46
+ * The facets it ships a module for (`backend`, `frontend-app`, `frontend-website`, `frontend-techdoc`): which binding
47
+ * scopes it can serve. Shown so a planner does not bind a browser-only provider (the Dropbox Chooser) on the backend.
48
+ */
49
+ readonly facets: readonly string[];
50
+ readonly engineCapabilities: readonly string[];
51
+ /** The secrets an operator supplies before it serves; empty for a credential-free provider. */
52
+ readonly requiredSecretEnvVars: readonly string[];
53
+ readonly purpose: string;
54
+ }
55
+ /**
56
+ * The engine's own providers, from the registered provider specifications whose origin is the engine.
57
+ *
58
+ * The population is every MAIN backend module and every browser module, which the CLI's reconciliation test (#328,
59
+ * facet-aware since #3995) holds to one specification each; the frontend-only `dropbox` picker is in it since #3995 item 5.
60
+ * One engine-shipped ref is deliberately not: `immudb`, a non-MAIN audit sink the platform chooses and no planner binds
61
+ * (it is moving to the registry).
62
+ */
63
+ export declare function engineProviderOffers(specifications: readonly ProviderSpecificationConfig[]): EngineProviderOffer[];
37
64
  /** The section, as brief lines. `isInstalled` answers for a provider REF. */
38
- export declare function renderProviderRegistryBrief(listing: ProviderRegistryListing, isInstalled: (providerRef: string) => boolean): string;
65
+ export declare function renderProviderRegistryBrief(listing: ProviderRegistryListing, isInstalled: (providerRef: string) => boolean, engineProviders?: readonly EngineProviderOffer[]): string;
66
+ /**
67
+ * The providers an application's integration plan may reference (#3995), split as the check needs it:
68
+ *
69
+ * - `existing`, what the FRAMEWORK has: every registered provider specification (every MAIN engine module, backend or
70
+ * browser, #3995 item 5), every registry module, and every discovered contribution the engine ships (it loads from
71
+ * `@wildo-ai/external-connectors-*`). The last brings the engine provider that has no specification, the immudb sink;
72
+ * - `bindable`, also what the APPLICATION has: every discovered contribution (an installed or authored package), every
73
+ * `providers/<ref>/` on disk, and every ref its five typed scopes declare (`providers.scopes.backend`, `.companion`,
74
+ * `.frontendServices.<k>`, `.minions.<k>`, `.workers.<k>`).
75
+ *
76
+ * `facetsByProvider` carries the facets of every engine provider whose specification is its ref's only source, for the
77
+ * binding-scope check.
78
+ *
79
+ * `undefined` when any source could not be read (the registry, discovery) or no specification is registered: an unknown
80
+ * provider is then not a wrong one, and a false refusal would cost every attempt and the build behind the plan.
81
+ */
82
+ export declare function collectKnownProviderRefs(input: {
83
+ readonly listing: ProviderRegistryListing;
84
+ readonly applicationRoot: string;
85
+ readonly specifications: readonly ProviderSpecificationConfig[];
86
+ /** Discovery's contributions, or `undefined` when it could not be read. */
87
+ readonly discoveredContributions: ReadonlyArray<{
88
+ readonly ref: string;
89
+ readonly runtimeImportPath: string;
90
+ }> | undefined;
91
+ readonly saasConfig: unknown;
92
+ }): IntegrationPlanKnownProviders | undefined;
39
93
  //# sourceMappingURL=provider-registry-brief.companion.utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-registry-brief.companion.utils.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/provider-registry-brief.companion.utils.ts"],"names":[],"mappings":"AAqBA,OAAO,EAML,KAAK,eAAe,EACpB,KAAK,cAAc,EACpB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAMrE,kDAAkD;AAClD,oBAAY,6BAA6B;IACvC,gFAAgF;IAChF,kBAAkB,uBAAuB;IACzC,oDAAoD;IACpD,eAAe,oBAAoB;CACpC;AAED,sEAAsE;AACtE,MAAM,MAAM,uBAAuB,GAC/B;IAAE,QAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,SAAS,eAAe,EAAE,CAAA;CAAE,GACxH;IAAE,QAAQ,CAAC,MAAM,EAAE,6BAA6B,CAAC;IAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAA;CAAE,CAAC;AAQrH,yFAAyF;AACzF,MAAM,MAAM,sBAAsB,GAAG,OAAO,oBAAoB,CAAC,MAAM,CAAC;AAExE;;;GAGG;AACH,wBAAsB,2BAA2B,CAAC,KAAK,EAAE;IACvD,QAAQ,CAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,QAAQ,CAAC,gBAAgB,CAAC,EAAE,cAAc,CAAC;IAC3C,QAAQ,CAAC,MAAM,CAAC,EAAE,sBAAsB,CAAC;CAC1C,GAAG,OAAO,CAAC,uBAAuB,CAAC,CA6BnC;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAEjG;AAED,6EAA6E;AAC7E,wBAAgB,2BAA2B,CAAC,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,GAAG,MAAM,CAuCnI"}
1
+ {"version":3,"file":"provider-registry-brief.companion.utils.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/provider-registry-brief.companion.utils.ts"],"names":[],"mappings":"AAqBA,OAAO,EAML,K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OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,QAAQ,CAAC,kBAAkB,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/C,+FAA+F;IAC/F,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,SAAS,2BAA2B,EAAE,GAAG,mBAAmB,EAAE,CAWlH;AA0CD,6EAA6E;AAC7E,wBAAgB,2BAA2B,CACzC,OAAO,EAAE,uBAAuB,EAChC,WAAW,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,EAC7C,eAAe,GAAE,SAAS,mBAAmB,EAAO,GACnD,MAAM,CAgDR;AAKD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE;IAC9C,QAAQ,CAAC,OAAO,EAAE,uBAAuB,CAAC;IAC1C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,QAAQ,CAAC,cAAc,EAAE,SAAS,2BAA2B,EAAE,CAAC;IAChE,2EAA2E;IAC3E,QAAQ,CAAC,uBAAuB,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;KAAE,CAAC,GAAG,SAAS,CAAC;IAC1H,QAAQ,CAAC,UAAU,EAAE,OAAO,CAAC;CAC9B,GAAG,6BAA6B,GAAG,SAAS,CAiC5C"}
@@ -17,11 +17,12 @@
17
17
  * because a plan that binds no provider is still a plan (`application-creation-directive.md`), and a refusal here would
18
18
  * stop application creation over an unreachable server.
19
19
  */
20
- import { existsSync } from 'node:fs';
20
+ import { existsSync, readdirSync } from 'node:fs';
21
21
  import { join } from 'node:path';
22
22
  import { listLocalCheckoutModules, ModuleKind, moduleSearchHitFacts, resolveRegistryUrl, WILDO_REGISTRY_DOMAIN, } from '@wildo-ai/platform-config-lib';
23
23
  import { RegistryServerClient } from '@wildo-ai/wildo-module-client';
24
- import { describeCaughtError } from '@wildo-ai/saas-models';
24
+ import { ProviderOriginKind, describeCaughtError } from '@wildo-ai/saas-models';
25
+ import { PROVIDER_BINDING_SCOPE_FACET } from '@wildo-ai/saas-specifications/application-creation';
25
26
  /** How long the brief waits for a registry server before saying it could not be read. */
26
27
  const REGISTRY_SEARCH_TIMEOUT_MS = 10_000;
27
28
  /** Where the offered providers were read from. */
@@ -74,20 +75,82 @@ export async function listRegistryProviderModules(input) {
74
75
  export function isRegistryProviderInstalled(applicationRoot, providerRef) {
75
76
  return existsSync(join(applicationRoot, 'providers', providerRef));
76
77
  }
78
+ /**
79
+ * The engine's own providers, from the registered provider specifications whose origin is the engine.
80
+ *
81
+ * The population is every MAIN backend module and every browser module, which the CLI's reconciliation test (#328,
82
+ * facet-aware since #3995) holds to one specification each; the frontend-only `dropbox` picker is in it since #3995 item 5.
83
+ * One engine-shipped ref is deliberately not: `immudb`, a non-MAIN audit sink the platform chooses and no planner binds
84
+ * (it is moving to the registry).
85
+ */
86
+ export function engineProviderOffers(specifications) {
87
+ return specifications
88
+ .filter((specification) => specification.origin.kind === ProviderOriginKind.ENGINE)
89
+ .map((specification) => ({
90
+ ref: specification.ref,
91
+ facets: [...specification.facets],
92
+ engineCapabilities: [...specification.engineCapabilities],
93
+ requiredSecretEnvVars: specification.secretsContract.filter((secret) => secret.required).map((secret) => secret.envVarName),
94
+ purpose: specification.purpose,
95
+ }))
96
+ .sort((left, right) => left.ref.localeCompare(right.ref));
97
+ }
98
+ /**
99
+ * Which facet each binding scope loads, in the brief's words, from the one map the integration plan's scope check reads
100
+ * (`PROVIDER_BINDING_SCOPE_FACET`): "`backend` on BACKEND or COMPANION, `frontend-app` on FRONTEND_APP, …".
101
+ */
102
+ function describeScopeFacets() {
103
+ const scopesByFacet = new Map();
104
+ for (const [scope, facet] of Object.entries(PROVIDER_BINDING_SCOPE_FACET))
105
+ scopesByFacet.set(facet, [...(scopesByFacet.get(facet) ?? []), scope]);
106
+ return [...scopesByFacet.entries()].map(([facet, scopes]) => `\`${facet}\` on ${scopes.join(' or ')}`).join(', ');
107
+ }
108
+ /** The engine half of the section: what the framework ships, bound by declaration alone. */
109
+ function renderEngineProviderOffers(engineProviders) {
110
+ return [
111
+ '## Engine providers (shipped with the framework: declare one, nothing to install)',
112
+ `Each binds only on a scope its facets serve: ${describeScopeFacets()}.`,
113
+ ...(engineProviders.length > 0
114
+ ? engineProviders.map((offer) => {
115
+ const facets = ` · ${offer.facets.map((facet) => `\`${facet}\``).join(', ')}`;
116
+ const fills = offer.engineCapabilities.length > 0 ? ` · fills ${offer.engineCapabilities.map((capability) => `\`${capability}\``).join(', ')}` : '';
117
+ const secrets = offer.requiredSecretEnvVars.length > 0 ? ` · needs ${offer.requiredSecretEnvVars.map((name) => `\`${name}\``).join(', ')}` : ' · no credential';
118
+ return `- \`${offer.ref}\`${facets}${fills}${secrets}\n ${offer.purpose}`;
119
+ })
120
+ : ['(no engine provider specification is registered)']),
121
+ ];
122
+ }
123
+ /**
124
+ * The rule a planner applies before anything new is authored (#3992, Paul 2026-11-16): app creation USES the providers the
125
+ * framework already has; a new provider is authored only for a need neither list fills, and the reason is recorded.
126
+ */
127
+ const AUTHOR_ONLY_WHAT_NOTHING_FILLS = [
128
+ '## A need neither list fills',
129
+ 'Authoring a NEW provider is the last resort, not a third option beside these. Do it only when no engine provider and no',
130
+ 'registry module fills the need: a vendor or behaviour none of them offers, or a business obligation that names a',
131
+ 'vendor. Then record it in the plan\'s `unprovidedNeeds` (the ref the new provider will have, the need, the requirements it',
132
+ 'serves, and why nothing above fills it), never only in prose, AND bind that ref on the scope that needs it, or, when one of',
133
+ 'the plan\'s workers or minions alone uses it, name that surface in the entry\'s `wiredByRef`: only a recorded need that a',
134
+ 'binding or a named worker or minion wires becomes a task that writes the new provider.',
135
+ ];
77
136
  /** The section, as brief lines. `isInstalled` answers for a provider REF. */
78
- export function renderProviderRegistryBrief(listing, isInstalled) {
79
- const heading = '# Provider modules the registry offers';
137
+ export function renderProviderRegistryBrief(listing, isInstalled, engineProviders = []) {
138
+ const heading = '# Providers the framework already has';
80
139
  const where = listing.source === ProviderRegistryListingSource.FRAMEWORK_CHECKOUT
81
- ? `Read from the framework checkout (${listing.location}), which is what \`wildo registry add wildo/…\` installs from here.`
82
- : `Read from the module registry at ${listing.location}, domain \`${WILDO_REGISTRY_DOMAIN}\`.`;
140
+ ? `Registry modules read from the framework checkout (${listing.location}), which is what \`wildo registry add wildo/…\` installs from here.`
141
+ : `Registry modules read from the module registry at ${listing.location}, domain \`${WILDO_REGISTRY_DOMAIN}\`.`;
83
142
  if ('unreadableReason' in listing) {
84
143
  return [
85
144
  heading,
145
+ ...renderEngineProviderOffers(engineProviders),
146
+ '',
147
+ '## Provider modules the registry offers',
86
148
  where,
87
149
  `UNREADABLE: ${listing.unreadableReason}`,
88
150
  'So this brief does not know which providers could be installed. Do not bind a third-party provider this application has not',
89
151
  'installed on the strength of recollection: bind what the workspace already carries, and say in the plan\'s rationale that the',
90
- 'registry could not be read, so the missing provider is decided later.',
152
+ 'registry could not be read, so the missing provider is decided later. Do not record such a need as unprovided either: the',
153
+ 'registry may well fill it.',
91
154
  ].join('\n');
92
155
  }
93
156
  const offers = listing.hits.filter((hit) => hit.provider !== undefined);
@@ -102,17 +165,101 @@ export function renderProviderRegistryBrief(listing, isInstalled) {
102
165
  });
103
166
  return [
104
167
  heading,
168
+ ...renderEngineProviderOffers(engineProviders),
169
+ '',
170
+ '## Provider modules the registry offers',
105
171
  where,
106
- 'A third-party provider reaches this application ONLY by being installed from the registry. These are the ones on offer;',
107
- 'the framework\'s own engine providers (billing, email, storage, identity and the like) are not listed here.',
172
+ 'A third-party provider the engine does not ship reaches this application ONLY by being installed from the registry.',
108
173
  '- To bind one, write a provider binding whose `providerRef` is its "bind as" ref (and `augments` where shown), and whose',
109
174
  ' `rationale` names the need it serves and, when it is not installed, the install command shown. The binding\'s build',
110
175
  ' task installs it first. An augmentation is also opted in, under `providers.augmentations.<augments>`, and that opt-in',
111
176
  ' is what shows its task landed.',
112
177
  '- Maturity: `adopted` has not yet met the real vendor; `proven` has, with the proof on record. Prefer `proven` when two fit.',
113
- '- Never bind a third-party vendor that neither this list nor the workspace carries: no module would provide it.',
178
+ '- Never bind a third-party vendor that neither list nor the workspace carries, unless an `unprovidedNeeds` entry names it',
179
+ ' (below): otherwise no module would provide it.',
114
180
  '',
115
181
  ...(rows.length > 0 ? rows : ['(the registry offers no provider module)']),
182
+ '',
183
+ ...AUTHOR_ONLY_WHAT_NOTHING_FILLS,
116
184
  ].join('\n');
117
185
  }
186
+ /** The runtime import path every engine-shipped provider loads from: what tells it from an installed or authored one. */
187
+ const ENGINE_PROVIDER_IMPORT_PREFIX = '@wildo-ai/external-connectors-';
188
+ /**
189
+ * The providers an application's integration plan may reference (#3995), split as the check needs it:
190
+ *
191
+ * - `existing`, what the FRAMEWORK has: every registered provider specification (every MAIN engine module, backend or
192
+ * browser, #3995 item 5), every registry module, and every discovered contribution the engine ships (it loads from
193
+ * `@wildo-ai/external-connectors-*`). The last brings the engine provider that has no specification, the immudb sink;
194
+ * - `bindable`, also what the APPLICATION has: every discovered contribution (an installed or authored package), every
195
+ * `providers/<ref>/` on disk, and every ref its five typed scopes declare (`providers.scopes.backend`, `.companion`,
196
+ * `.frontendServices.<k>`, `.minions.<k>`, `.workers.<k>`).
197
+ *
198
+ * `facetsByProvider` carries the facets of every engine provider whose specification is its ref's only source, for the
199
+ * binding-scope check.
200
+ *
201
+ * `undefined` when any source could not be read (the registry, discovery) or no specification is registered: an unknown
202
+ * provider is then not a wrong one, and a false refusal would cost every attempt and the build behind the plan.
203
+ */
204
+ export function collectKnownProviderRefs(input) {
205
+ if ('unreadableReason' in input.listing || input.discoveredContributions === undefined || input.specifications.length === 0)
206
+ return undefined;
207
+ const existing = new Set(input.specifications.map((specification) => specification.ref));
208
+ for (const hit of input.listing.hits)
209
+ if (hit.provider !== undefined)
210
+ existing.add(hit.provider.ref);
211
+ for (const contribution of input.discoveredContributions) {
212
+ if (contribution.runtimeImportPath.startsWith(ENGINE_PROVIDER_IMPORT_PREFIX))
213
+ existing.add(contribution.ref);
214
+ }
215
+ const bindable = new Set(existing);
216
+ for (const contribution of input.discoveredContributions)
217
+ bindable.add(contribution.ref);
218
+ const installedRoot = join(input.applicationRoot, 'providers');
219
+ if (existsSync(installedRoot)) {
220
+ for (const entry of readdirSync(installedRoot, { withFileTypes: true }))
221
+ if (entry.isDirectory())
222
+ bindable.add(entry.name);
223
+ }
224
+ for (const ref of declaredScopeProviderRefs(input.saasConfig))
225
+ bindable.add(ref);
226
+ /*
227
+ * The facets each provider ships (#3995), from the SAME specifications the brief shows them from, and only where the
228
+ * specification is the ref's whole story. A registry module, a package under `providers/<ref>/`, or a contribution not
229
+ * shipped by the engine may carry the same ref with facets of its own (a backend Dropbox module beside the engine's
230
+ * browser-only Chooser), and those facets are not known here, so such a ref is left out and its scope is not checked.
231
+ */
232
+ const otherSources = new Set();
233
+ for (const hit of input.listing.hits)
234
+ if (hit.provider !== undefined)
235
+ otherSources.add(hit.provider.ref);
236
+ for (const contribution of input.discoveredContributions) {
237
+ if (!contribution.runtimeImportPath.startsWith(ENGINE_PROVIDER_IMPORT_PREFIX))
238
+ otherSources.add(contribution.ref);
239
+ }
240
+ if (existsSync(installedRoot)) {
241
+ for (const entry of readdirSync(installedRoot, { withFileTypes: true }))
242
+ if (entry.isDirectory())
243
+ otherSources.add(entry.name);
244
+ }
245
+ const facetsByProvider = new Map();
246
+ for (const specification of input.specifications) {
247
+ if (!otherSources.has(specification.ref))
248
+ facetsByProvider.set(specification.ref, new Set(specification.facets));
249
+ }
250
+ return { existing, bindable, facetsByProvider };
251
+ }
252
+ /** Every provider ref the configuration's five typed scopes declare. */
253
+ function declaredScopeProviderRefs(saasConfig) {
254
+ const record = (value) => (value !== null && typeof value === 'object' && !Array.isArray(value) ? value : {});
255
+ const scopes = record(record(record(saasConfig).providers).scopes);
256
+ const scopeObjects = [
257
+ record(scopes.backend),
258
+ record(scopes.companion),
259
+ ...Object.values(record(scopes.frontendServices)).map(record),
260
+ ...Object.values(record(scopes.minions)).map(record),
261
+ ...Object.values(record(scopes.workers)).map(record),
262
+ ];
263
+ return scopeObjects.flatMap((scope) => Object.keys(record(scope.providers)));
264
+ }
118
265
  //# sourceMappingURL=provider-registry-brief.companion.utils.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider-registry-brief.companion.utils.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/provider-registry-brief.companion.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAE5D,yFAAyF;AACzF,MAAM,0BAA0B,GAAG,MAAM,CAAC;AAE1C,kDAAkD;AAClD,MAAM,CAAN,IAAY,6BAKX;AALD,WAAY,6BAA6B;IACvC,gFAAgF;IAChF,0EAAyC,CAAA;IACzC,oDAAoD;IACpD,oEAAmC,CAAA;AACrC,CAAC,EALW,6BAA6B,KAA7B,6BAA6B,QAKxC;AAgBD;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAAC,KAIjD;IACC,IAAI,KAAK,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;QACjC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,aAAa,EAAE,oBAAoB,CAAC,CAAC;QACjE,IAAI,CA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A6G;QAC7G,0HAA0H;QAC1H,uHAAuH;QACvH,yHAAyH;QACzH,kCAAkC;QAClC,8HAA8H;QAC9H,iHAAiH;QACjH,EAAE;QACF,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,0CAA0C,CAAC,CAAC;KAC3E,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACf,CAAC","sourcesContent":["/**\n * The `provider_registry` brief section (#2025, epic #2012): the provider modules the registry offers, for a playbook that\n * decides which providers an application binds.\n *\n * Since the generated catalogue was archived (#2019), a third-party vendor reaches an application only by being\n * installed from the module registry. A planner that reads only the workspace therefore sees the providers already\n * installed and none it could add. This section is the registry's answer, read from the SAME source `wildo registry\n * search` reads, through the same shared functions, so the brief and the command cannot disagree:\n *\n * - inside a framework checkout, the checkout's own `providers-registry/` (`listLocalCheckoutModules`, #2015);\n * - anywhere else, the application's registry (`resolveRegistryUrl` over `moduleRegistries`, then a search).\n *\n * Only the `wildo` domain is read: it is where Wildo publishes its providers. An organization's private domain holds\n * what that organization authored, which a planner cannot know to ask for.\n *\n * BEST-EFFORT, never a gate: a registry that cannot be read renders a section that says so and why. The run goes on,\n * because a plan that binds no provider is still a plan (`application-creation-directive.md`), and a refusal here would\n * stop application creation over an unreachable server.\n */\nimport { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport {\n listLocalCheckoutModules,\n ModuleKind,\n moduleSearchHitFacts,\n resolveRegistryUrl,\n WILDO_REGISTRY_DOMAIN,\n type ModuleSearchHit,\n type RegistryConfig,\n} from '@wildo-ai/platform-config-lib';\nimport { RegistryServerClient } from '@wildo-ai/wildo-module-client';\nimport { describeCaughtError } from '@wildo-ai/saas-models';\n\n/** How long the brief waits for a registry server before saying it could not be read. */\nconst REGISTRY_SEARCH_TIMEOUT_MS = 10_000;\n\n/** Where the offered providers were read from. */\nexport enum ProviderRegistryListingSource {\n /** The framework checkout's `providers-registry/`, in framework development. */\n FRAMEWORK_CHECKOUT = 'framework-checkout',\n /** The application's module registry, over HTTP. */\n REGISTRY_SERVER = 'registry-server',\n}\n\n/** The registry's provider modules, or why they could not be read. */\nexport type ProviderRegistryListing =\n | { readonly source: ProviderRegistryListingSource; readonly location: string; readonly hits: readonly ModuleSearchHit[] }\n | { readonly source: ProviderRegistryListingSource; readonly location: string; readonly unreadableReason: string };\n\n/*\n * The registry lane searches anonymously: it reads the PUBLIC modules of the `wildo` domain, which is where Wildo\n * publishes its providers. A registry that requires authentication for that domain renders as unreadable here even\n * where an operator's own `wildo registry search` (which sends a stored key) succeeds (#2025 review F7).\n */\n\n/** The registry search, injectable so a test drives the server lane without a server. */\nexport type ProviderRegistrySearch = typeof RegistryServerClient.search;\n\n/**\n * Every provider module the registry offers. The checkout lane when the companion runs inside a framework checkout\n * (the same rule `wildo registry search` applies for the `wildo` domain), the registry lane otherwise.\n */\nexport async function listRegistryProviderModules(input: {\n readonly frameworkRoot: string | null;\n readonly moduleRegistries?: RegistryConfig;\n readonly search?: ProviderRegistrySearch;\n}): Promise<ProviderRegistryListing> {\n if (input.frameworkRoot !== null) {\n const location = join(input.frameworkRoot, 'providers-registry');\n try {\n const listings = await listLocalCheckoutModules(input.frameworkRoot, '');\n const hits = listings\n .filter((listing) => (listing.manifest.kind ?? ModuleKind.FEATURE) === ModuleKind.PROVIDER)\n .map((listing) => ({ moduleId: listing.moduleId, latestVersion: listing.version, description: listing.manifest.description, ...moduleSearchHitFacts(listing.manifest) }));\n return { source: ProviderRegistryListingSource.FRAMEWORK_CHECKOUT, location, hits };\n } catch (error) {\n return { source: ProviderRegistryListingSource.FRAMEWORK_CHECKOUT, location, unreadableReason: describeCaughtError(error) };\n }\n }\n let url: string;\n try {\n url = resolveRegistryUrl({ moduleRegistries: input.moduleRegistries }).url;\n } catch (error) {\n return { source: ProviderRegistryListingSource.REGISTRY_SERVER, location: '(unresolved)', unreadableReason: describeCaughtError(error) };\n }\n try {\n const search = input.search ?? RegistryServerClient.search.bind(RegistryServerClient);\n const hits = await search(\n { baseUrl: url, timeoutMs: REGISTRY_SEARCH_TIMEOUT_MS },\n { domain: WILDO_REGISTRY_DOMAIN, query: '', filter: { kind: ModuleKind.PROVIDER } },\n );\n return { source: ProviderRegistryListingSource.REGISTRY_SERVER, location: url, hits };\n } catch (error) {\n return { source: ProviderRegistryListingSource.REGISTRY_SERVER, location: url, unreadableReason: describeCaughtError(error) };\n }\n}\n\n/**\n * Whether the application has installed the provider module whose ref is `providerRef`: an install writes\n * `providers/<provider ref>/` (the manifest refuses a boundary anywhere else), so the directory is the answer, read from\n * the tree rather than from a list. Keyed by the provider's REF, not the module id, which nothing requires to match it.\n */\nexport function isRegistryProviderInstalled(applicationRoot: string, providerRef: string): boolean {\n return existsSync(join(applicationRoot, 'providers', providerRef));\n}\n\n/** The section, as brief lines. `isInstalled` answers for a provider REF. */\nexport function renderProviderRegistryBrief(listing: ProviderRegistryListing, isInstalled: (providerRef: string) => boolean): string {\n const heading = '# Provider modules the registry offers';\n const where = listing.source === ProviderRegistryListingSource.FRAMEWORK_CHECKOUT\n ? `Read from the framework checkout (${listing.location}), which is what \\`wildo registry add wildo/…\\` installs from here.`\n : `Read from the module registry at ${listing.location}, domain \\`${WILDO_REGISTRY_DOMAIN}\\`.`;\n if ('unreadableReason' in listing) {\n return [\n heading,\n where,\n `UNREADABLE: ${listing.unreadableReason}`,\n 'So this brief does not know which providers could be installed. Do not bind a third-party provider this application has not',\n 'installed on the strength of recollection: bind what the workspace already carries, and say in the plan\\'s rationale that the',\n 'registry could not be read, so the missing provider is decided later.',\n ].join('\\n');\n }\n const offers = listing.hits.filter((hit) => hit.provider !== undefined);\n const rows = offers.map((hit) => {\n const provider = hit.provider!;\n const bind = provider.augments !== undefined\n ? `bind as \\`${provider.ref}\\` with \\`augments: ${provider.augments}\\` (it adds operations to the \\`${provider.augments}\\` provider, which a scope must declare)`\n : `bind as \\`${provider.ref}\\``;\n const fills = provider.engineCapabilities.length > 0 ? ` · fills ${provider.engineCapabilities.map((capability) => `\\`${capability}\\``).join(', ')}` : '';\n const state = isInstalled(provider.ref) ? 'INSTALLED' : `not installed — \\`wildo registry add ${WILDO_REGISTRY_DOMAIN}/${hit.moduleId}\\``;\n return `- \\`${WILDO_REGISTRY_DOMAIN}/${hit.moduleId}\\` ${hit.latestVersion} · ${bind} · ${provider.maturity}${fills} · ${state}${hit.description ? `\\n ${hit.description}` : ''}`;\n });\n return [\n heading,\n where,\n 'A third-party provider reaches this application ONLY by being installed from the registry. These are the ones on offer;',\n 'the framework\\'s own engine providers (billing, email, storage, identity and the like) are not listed here.',\n '- To bind one, write a provider binding whose `providerRef` is its \"bind as\" ref (and `augments` where shown), and whose',\n ' `rationale` names the need it serves and, when it is not installed, the install command shown. The binding\\'s build',\n ' task installs it first. An augmentation is also opted in, under `providers.augmentations.<augments>`, and that opt-in',\n ' is what shows its task landed.',\n '- Maturity: `adopted` has not yet met the real vendor; `proven` has, with the proof on record. Prefer `proven` when two fit.',\n '- Never bind a third-party vendor that neither this list nor the workspace carries: no module would provide it.',\n '',\n ...(rows.length > 0 ? rows : ['(the registry offers no provider module)']),\n ].join('\\n');\n}\n"]}
1
+ {"version":3,"file":"provider-registry-brief.companion.utils.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/provider-registry-brief.companion.utils.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,wBAAwB,EACxB,UAAU,EACV,oBAAoB,EACpB,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AACrE,OAAO,EAAE,kBAAkB,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAEhF,OAAO,EAAE,4BAA4B,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KAAK,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAgC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC3K,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,SAAS,CAAC,CAAC,MAAM,CAAC,CAAC;IACnE,MAAM,YAAY,GAAG;QACnB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACtB,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC;QACxB,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;QAC7D,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;QACpD,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;KACrD,CAAC;IACF,OAAO,YAAY,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC","sourcesContent":["/**\n * The `provider_registry` brief section (#2025, epic #2012): the provider modules the registry offers, for a playbook that\n * decides which providers an application binds.\n *\n * Since the generated catalogue was archived (#2019), a third-party vendor reaches an application only by being\n * installed from the module registry. A planner that reads only the workspace therefore sees the providers already\n * installed and none it could add. This section is the registry's answer, read from the SAME source `wildo registry\n * search` reads, through the same shared functions, so the brief and the command cannot disagree:\n *\n * - inside a framework checkout, the checkout's own `providers-registry/` (`listLocalCheckoutModules`, #2015);\n * - anywhere else, the application's registry (`resolveRegistryUrl` over `moduleRegistries`, then a search).\n *\n * Only the `wildo` domain is read: it is where Wildo publishes its providers. An organization's private domain holds\n * what that organization authored, which a planner cannot know to ask for.\n *\n * BEST-EFFORT, never a gate: a registry that cannot be read renders a section that says so and why. The run goes on,\n * because a plan that binds no provider is still a plan (`application-creation-directive.md`), and a refusal here would\n * stop application creation over an unreachable server.\n */\nimport { existsSync, readdirSync } from 'node:fs';\nimport { join } from 'node:path';\nimport {\n listLocalCheckoutModules,\n ModuleKind,\n moduleSearchHitFacts,\n resolveRegistryUrl,\n WILDO_REGISTRY_DOMAIN,\n type ModuleSearchHit,\n type RegistryConfig,\n} from '@wildo-ai/platform-config-lib';\nimport { RegistryServerClient } from '@wildo-ai/wildo-module-client';\nimport { ProviderOriginKind, describeCaughtError } from '@wildo-ai/saas-models';\nimport type { ProviderSpecificationConfig } from '@wildo-ai/saas-specifications';\nimport { PROVIDER_BINDING_SCOPE_FACET, type IntegrationPlanKnownProviders } from '@wildo-ai/saas-specifications/application-creation';\n\n/** How long the brief waits for a registry server before saying it could not be read. */\nconst REGISTRY_SEARCH_TIMEOUT_MS = 10_000;\n\n/** Where the offered providers were read from. */\nexport enum ProviderRegistryListingSource {\n /** The framework checkout's `providers-registry/`, in framework development. */\n FRAMEWORK_CHECKOUT = 'framework-checkout',\n /** The application's module registry, over HTTP. */\n REGISTRY_SERVER = 'registry-server',\n}\n\n/** The registry's provider modules, or why they could not be read. */\nexport type ProviderRegistryListing =\n | { readonly source: ProviderRegistryListingSource; readonly location: string; readonly hits: readonly ModuleSearchHit[] }\n | { readonly source: ProviderRegistryListingSource; readonly location: string; readonly unreadableReason: string };\n\n/*\n * The registry lane searches anonymously: it reads the PUBLIC modules of the `wildo` domain, which is where Wildo\n * publishes its providers. A registry that requires authentication for that domain renders as unreadable here even\n * where an operator's own `wildo registry search` (which sends a stored key) succeeds (#2025 review F7).\n */\n\n/** The registry search, injectable so a test drives the server lane without a server. */\nexport type ProviderRegistrySearch = typeof RegistryServerClient.search;\n\n/**\n * Every provider module the registry offers. The checkout lane when the companion runs inside a framework checkout\n * (the same rule `wildo registry search` applies for the `wildo` domain), the registry lane otherwise.\n */\nexport async function listRegistryProviderModules(input: {\n readonly frameworkRoot: string | null;\n readonly moduleRegistries?: RegistryConfig;\n readonly search?: ProviderRegistrySearch;\n}): Promise<ProviderRegistryListing> {\n if (input.frameworkRoot !== null) {\n const location = join(input.frameworkRoot, 'providers-registry');\n try {\n const listings = await listLocalCheckoutModules(input.frameworkRoot, '');\n const hits = listings\n .filter((listing) => (listing.manifest.kind ?? ModuleKind.FEATURE) === ModuleKind.PROVIDER)\n .map((listing) => ({ moduleId: listing.moduleId, latestVersion: listing.version, description: listing.manifest.description, ...moduleSearchHitFacts(listing.manifest) }));\n return { source: ProviderRegistryListingSource.FRAMEWORK_CHECKOUT, location, hits };\n } catch (error) {\n return { source: ProviderRegistryListingSource.FRAMEWORK_CHECKOUT, location, unreadableReason: describeCaughtError(error) };\n }\n }\n let url: string;\n try {\n url = resolveRegistryUrl({ moduleRegistries: input.moduleRegistries }).url;\n } catch (error) {\n return { source: ProviderRegistryListingSource.REGISTRY_SERVER, location: '(unresolved)', unreadableReason: describeCaughtError(error) };\n }\n try {\n const search = input.search ?? RegistryServerClient.search.bind(RegistryServerClient);\n const hits = await search(\n { baseUrl: url, timeoutMs: REGISTRY_SEARCH_TIMEOUT_MS },\n { domain: WILDO_REGISTRY_DOMAIN, query: '', filter: { kind: ModuleKind.PROVIDER } },\n );\n return { source: ProviderRegistryListingSource.REGISTRY_SERVER, location: url, hits };\n } catch (error) {\n return { source: ProviderRegistryListingSource.REGISTRY_SERVER, location: url, unreadableReason: describeCaughtError(error) };\n }\n}\n\n/**\n * Whether the application has installed the provider module whose ref is `providerRef`: an install writes\n * `providers/<provider ref>/` (the manifest refuses a boundary anywhere else), so the directory is the answer, read from\n * the tree rather than from a list. Keyed by the provider's REF, not the module id, which nothing requires to match it.\n */\nexport function isRegistryProviderInstalled(applicationRoot: string, providerRef: string): boolean {\n return existsSync(join(applicationRoot, 'providers', providerRef));\n}\n\n/**\n * One provider the ENGINE ships (#3992): bound by declaring it, never installed. Listed beside the registry's offers so a\n * planner sees everything the framework already has before it concludes a need is unprovided.\n */\nexport interface EngineProviderOffer {\n readonly ref: string;\n /**\n * The facets it ships a module for (`backend`, `frontend-app`, `frontend-website`, `frontend-techdoc`): which binding\n * scopes it can serve. Shown so a planner does not bind a browser-only provider (the Dropbox Chooser) on the backend.\n */\n readonly facets: readonly string[];\n readonly engineCapabilities: readonly string[];\n /** The secrets an operator supplies before it serves; empty for a credential-free provider. */\n readonly requiredSecretEnvVars: readonly string[];\n readonly purpose: string;\n}\n\n/**\n * The engine's own providers, from the registered provider specifications whose origin is the engine.\n *\n * The population is every MAIN backend module and every browser module, which the CLI's reconciliation test (#328,\n * facet-aware since #3995) holds to one specification each; the frontend-only `dropbox` picker is in it since #3995 item 5.\n * One engine-shipped ref is deliberately not: `immudb`, a non-MAIN audit sink the platform chooses and no planner binds\n * (it is moving to the registry).\n */\nexport function engineProviderOffers(specifications: readonly ProviderSpecificationConfig[]): EngineProviderOffer[] {\n return specifications\n .filter((specification) => specification.origin.kind === ProviderOriginKind.ENGINE)\n .map((specification) => ({\n ref: specification.ref,\n facets: [...specification.facets],\n engineCapabilities: [...specification.engineCapabilities],\n requiredSecretEnvVars: specification.secretsContract.filter((secret) => secret.required).map((secret) => secret.envVarName),\n purpose: specification.purpose,\n }))\n .sort((left, right) => left.ref.localeCompare(right.ref));\n}\n\n/**\n * Which facet each binding scope loads, in the brief's words, from the one map the integration plan's scope check reads\n * (`PROVIDER_BINDING_SCOPE_FACET`): \"`backend` on BACKEND or COMPANION, `frontend-app` on FRONTEND_APP, …\".\n */\nfunction describeScopeFacets(): string {\n const scopesByFacet = new Map<string, string[]>();\n for (const [scope, facet] of Object.entries(PROVIDER_BINDING_SCOPE_FACET)) scopesByFacet.set(facet, [...(scopesByFacet.get(facet) ?? []), scope]);\n return [...scopesByFacet.entries()].map(([facet, scopes]) => `\\`${facet}\\` on ${scopes.join(' or ')}`).join(', ');\n}\n\n/** The engine half of the section: what the framework ships, bound by declaration alone. */\nfunction renderEngineProviderOffers(engineProviders: readonly EngineProviderOffer[]): string[] {\n return [\n '## Engine providers (shipped with the framework: declare one, nothing to install)',\n `Each binds only on a scope its facets serve: ${describeScopeFacets()}.`,\n ...(engineProviders.length > 0\n ? engineProviders.map((offer) => {\n const facets = ` · ${offer.facets.map((facet) => `\\`${facet}\\``).join(', ')}`;\n const fills = offer.engineCapabilities.length > 0 ? ` · fills ${offer.engineCapabilities.map((capability) => `\\`${capability}\\``).join(', ')}` : '';\n const secrets = offer.requiredSecretEnvVars.length > 0 ? ` · needs ${offer.requiredSecretEnvVars.map((name) => `\\`${name}\\``).join(', ')}` : ' · no credential';\n return `- \\`${offer.ref}\\`${facets}${fills}${secrets}\\n ${offer.purpose}`;\n })\n : ['(no engine provider specification is registered)']),\n ];\n}\n\n/**\n * The rule a planner applies before anything new is authored (#3992, Paul 2026-11-16): app creation USES the providers the\n * framework already has; a new provider is authored only for a need neither list fills, and the reason is recorded.\n */\nconst AUTHOR_ONLY_WHAT_NOTHING_FILLS = [\n '## A need neither list fills',\n 'Authoring a NEW provider is the last resort, not a third option beside these. Do it only when no engine provider and no',\n 'registry module fills the need: a vendor or behaviour none of them offers, or a business obligation that names a',\n 'vendor. Then record it in the plan\\'s `unprovidedNeeds` (the ref the new provider will have, the need, the requirements it',\n 'serves, and why nothing above fills it), never only in prose, AND bind that ref on the scope that needs it, or, when one of',\n 'the plan\\'s workers or minions alone uses it, name that surface in the entry\\'s `wiredByRef`: only a recorded need that a',\n 'binding or a named worker or minion wires becomes a task that writes the new provider.',\n];\n\n/** The section, as brief lines. `isInstalled` answers for a provider REF. */\nexport function renderProviderRegistryBrief(\n listing: ProviderRegistryListing,\n isInstalled: (providerRef: string) => boolean,\n engineProviders: readonly EngineProviderOffer[] = [],\n): string {\n const heading = '# Providers the framework already has';\n const where = listing.source === ProviderRegistryListingSource.FRAMEWORK_CHECKOUT\n ? `Registry modules read from the framework checkout (${listing.location}), which is what \\`wildo registry add wildo/…\\` installs from here.`\n : `Registry modules read from the module registry at ${listing.location}, domain \\`${WILDO_REGISTRY_DOMAIN}\\`.`;\n if ('unreadableReason' in listing) {\n return [\n heading,\n ...renderEngineProviderOffers(engineProviders),\n '',\n '## Provider modules the registry offers',\n where,\n `UNREADABLE: ${listing.unreadableReason}`,\n 'So this brief does not know which providers could be installed. Do not bind a third-party provider this application has not',\n 'installed on the strength of recollection: bind what the workspace already carries, and say in the plan\\'s rationale that the',\n 'registry could not be read, so the missing provider is decided later. Do not record such a need as unprovided either: the',\n 'registry may well fill it.',\n ].join('\\n');\n }\n const offers = listing.hits.filter((hit) => hit.provider !== undefined);\n const rows = offers.map((hit) => {\n const provider = hit.provider!;\n const bind = provider.augments !== undefined\n ? `bind as \\`${provider.ref}\\` with \\`augments: ${provider.augments}\\` (it adds operations to the \\`${provider.augments}\\` provider, which a scope must declare)`\n : `bind as \\`${provider.ref}\\``;\n const fills = provider.engineCapabilities.length > 0 ? ` · fills ${provider.engineCapabilities.map((capability) => `\\`${capability}\\``).join(', ')}` : '';\n const state = isInstalled(provider.ref) ? 'INSTALLED' : `not installed — \\`wildo registry add ${WILDO_REGISTRY_DOMAIN}/${hit.moduleId}\\``;\n return `- \\`${WILDO_REGISTRY_DOMAIN}/${hit.moduleId}\\` ${hit.latestVersion} · ${bind} · ${provider.maturity}${fills} · ${state}${hit.description ? `\\n ${hit.description}` : ''}`;\n });\n return [\n heading,\n ...renderEngineProviderOffers(engineProviders),\n '',\n '## Provider modules the registry offers',\n where,\n 'A third-party provider the engine does not ship reaches this application ONLY by being installed from the registry.',\n '- To bind one, write a provider binding whose `providerRef` is its \"bind as\" ref (and `augments` where shown), and whose',\n ' `rationale` names the need it serves and, when it is not installed, the install command shown. The binding\\'s build',\n ' task installs it first. An augmentation is also opted in, under `providers.augmentations.<augments>`, and that opt-in',\n ' is what shows its task landed.',\n '- Maturity: `adopted` has not yet met the real vendor; `proven` has, with the proof on record. Prefer `proven` when two fit.',\n '- Never bind a third-party vendor that neither list nor the workspace carries, unless an `unprovidedNeeds` entry names it',\n ' (below): otherwise no module would provide it.',\n '',\n ...(rows.length > 0 ? rows : ['(the registry offers no provider module)']),\n '',\n ...AUTHOR_ONLY_WHAT_NOTHING_FILLS,\n ].join('\\n');\n}\n\n/** The runtime import path every engine-shipped provider loads from: what tells it from an installed or authored one. */\nconst ENGINE_PROVIDER_IMPORT_PREFIX = '@wildo-ai/external-connectors-';\n\n/**\n * The providers an application's integration plan may reference (#3995), split as the check needs it:\n *\n * - `existing`, what the FRAMEWORK has: every registered provider specification (every MAIN engine module, backend or\n * browser, #3995 item 5), every registry module, and every discovered contribution the engine ships (it loads from\n * `@wildo-ai/external-connectors-*`). The last brings the engine provider that has no specification, the immudb sink;\n * - `bindable`, also what the APPLICATION has: every discovered contribution (an installed or authored package), every\n * `providers/<ref>/` on disk, and every ref its five typed scopes declare (`providers.scopes.backend`, `.companion`,\n * `.frontendServices.<k>`, `.minions.<k>`, `.workers.<k>`).\n *\n * `facetsByProvider` carries the facets of every engine provider whose specification is its ref's only source, for the\n * binding-scope check.\n *\n * `undefined` when any source could not be read (the registry, discovery) or no specification is registered: an unknown\n * provider is then not a wrong one, and a false refusal would cost every attempt and the build behind the plan.\n */\nexport function collectKnownProviderRefs(input: {\n readonly listing: ProviderRegistryListing;\n readonly applicationRoot: string;\n readonly specifications: readonly ProviderSpecificationConfig[];\n /** Discovery's contributions, or `undefined` when it could not be read. */\n readonly discoveredContributions: ReadonlyArray<{ readonly ref: string; readonly runtimeImportPath: string }> | undefined;\n readonly saasConfig: unknown;\n}): IntegrationPlanKnownProviders | undefined {\n if ('unreadableReason' in input.listing || input.discoveredContributions === undefined || input.specifications.length === 0) return undefined;\n const existing = new Set<string>(input.specifications.map((specification) => specification.ref));\n for (const hit of input.listing.hits) if (hit.provider !== undefined) existing.add(hit.provider.ref);\n for (const contribution of input.discoveredContributions) {\n if (contribution.runtimeImportPath.startsWith(ENGINE_PROVIDER_IMPORT_PREFIX)) existing.add(contribution.ref);\n }\n const bindable = new Set<string>(existing);\n for (const contribution of input.discoveredContributions) bindable.add(contribution.ref);\n const installedRoot = join(input.applicationRoot, 'providers');\n if (existsSync(installedRoot)) {\n for (const entry of readdirSync(installedRoot, { withFileTypes: true })) if (entry.isDirectory()) bindable.add(entry.name);\n }\n for (const ref of declaredScopeProviderRefs(input.saasConfig)) bindable.add(ref);\n /*\n * The facets each provider ships (#3995), from the SAME specifications the brief shows them from, and only where the\n * specification is the ref's whole story. A registry module, a package under `providers/<ref>/`, or a contribution not\n * shipped by the engine may carry the same ref with facets of its own (a backend Dropbox module beside the engine's\n * browser-only Chooser), and those facets are not known here, so such a ref is left out and its scope is not checked.\n */\n const otherSources = new Set<string>();\n for (const hit of input.listing.hits) if (hit.provider !== undefined) otherSources.add(hit.provider.ref);\n for (const contribution of input.discoveredContributions) {\n if (!contribution.runtimeImportPath.startsWith(ENGINE_PROVIDER_IMPORT_PREFIX)) otherSources.add(contribution.ref);\n }\n if (existsSync(installedRoot)) {\n for (const entry of readdirSync(installedRoot, { withFileTypes: true })) if (entry.isDirectory()) otherSources.add(entry.name);\n }\n const facetsByProvider = new Map<string, ReadonlySet<string>>();\n for (const specification of input.specifications) {\n if (!otherSources.has(specification.ref)) facetsByProvider.set(specification.ref, new Set(specification.facets));\n }\n return { existing, bindable, facetsByProvider };\n}\n\n/** Every provider ref the configuration's five typed scopes declare. */\nfunction declaredScopeProviderRefs(saasConfig: unknown): string[] {\n const record = (value: unknown): Record<string, unknown> => (value !== null && typeof value === 'object' && !Array.isArray(value) ? value as Record<string, unknown> : {});\n const scopes = record(record(record(saasConfig).providers).scopes);\n const scopeObjects = [\n record(scopes.backend),\n record(scopes.companion),\n ...Object.values(record(scopes.frontendServices)).map(record),\n ...Object.values(record(scopes.minions)).map(record),\n ...Object.values(record(scopes.workers)).map(record),\n ];\n return scopeObjects.flatMap((scope) => Object.keys(record(scope.providers)));\n}\n"]}
@@ -27,6 +27,22 @@ export interface WebsiteDemoScenarioCheck {
27
27
  readonly bound: number;
28
28
  /** Each way a bound scenario is untrue of the application, as a sentence naming where it was defined. */
29
29
  readonly problems: readonly string[];
30
+ /**
31
+ * The same problems, one per entry in the same order, with what each is ABOUT (#3881): where the scenario was defined
32
+ * (`definedAt`, `<file>:<line>` or `null`) and the resource it draws, with that resource's module when the application
33
+ * has the resource. What lets a coding run be charged only with the demos it touched.
34
+ */
35
+ readonly findings: readonly WebsiteDemoScenarioFinding[];
36
+ }
37
+ /** One way a bound demo scenario is untrue of the application, and what it is about (#3881). */
38
+ export interface WebsiteDemoScenarioFinding {
39
+ readonly sentence: string;
40
+ /** The problem without the site, so the same untruth keeps one identity when the line it is defined on moves. */
41
+ readonly problem: string;
42
+ readonly definedAt: string | null;
43
+ readonly resourceType: string;
44
+ /** The module that registers the resource; `null` for an engine resource, absent when the application lacks it. */
45
+ readonly moduleId?: string | null;
30
46
  }
31
47
  /**
32
48
  * Checks every scenario a site defined against the application it draws (#2784): a scenario bound to a resource
@@ -39,5 +55,7 @@ export interface WebsiteDemoScenarioCheck {
39
55
  * several scenarios (`goalScenario('done')`, `goalScenario('achieved')`) defines them all on one line, and keying on the
40
56
  * line kept only the last and dropped the rest unchecked.
41
57
  */
42
- export declare function checkWebsiteDemoScenarios(records: readonly DefinedWebsiteDemoScenarioRecord[], resources: ReadonlyMap<string, Pick<DomainModelResourceRow, 'resourceType' | 'fields' | 'operations'>>, describeSite: (definedAt: string | null) => string): WebsiteDemoScenarioCheck;
58
+ export declare function checkWebsiteDemoScenarios(records: readonly DefinedWebsiteDemoScenarioRecord[], resources: ReadonlyMap<string, Pick<DomainModelResourceRow, 'resourceType' | 'fields' | 'operations'> & {
59
+ readonly moduleId?: string | null;
60
+ }>, describeSite: (definedAt: string | null) => string): WebsiteDemoScenarioCheck;
43
61
  //# sourceMappingURL=website-demo-facts.models.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"website-demo-facts.models.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/website-demo-facts.models.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gCAAgC,EACrC,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAI1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAsBpH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,cAAc,GAAG,QAAQ,GAAG,YAAY,CAAC,GAAG,wBAAwB,CAqBnJ;AAED,kEAAkE;AAClE,MAAM,WAAW,wBAAwB;IACvC,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yGAAyG;IACzG,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,SAAS,gCAAgC,EAAE,EACpD,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,sBAAsB,EAAE,cAAc,GAAG,QAAQ,GAAG,YAAY,CAAC,CAAC,EACtG,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,GACjD,wBAAwB,CAkB1B"}
1
+ {"version":3,"file":"website-demo-facts.models.d.ts","sourceRoot":"","sources":["../../../../src/meta-workflows/services/website-demo-facts.models.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,gCAAgC,EACrC,KAAK,wBAAwB,EAC9B,MAAM,kCAAkC,CAAC;AAI1C,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,uEAAuE,CAAC;AAsBpH;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CAAC,QAAQ,EAAE,IAAI,CAAC,sBAAsB,EAAE,cAAc,GAAG,QAAQ,GAAG,YAAY,CAAC,GAAG,wBAAwB,CAqBnJ;AAED,kEAAkE;AAClE,MAAM,WAAW,wBAAwB;IACvC,yDAAyD;IACzD,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,yGAAyG;IACzG,QAAQ,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,SAAS,0BAA0B,EAAE,CAAC;CAC1D;AAED,gGAAgG;AAChG,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,iHAAiH;IACjH,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;IAC9B,mHAAmH;IACnH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,yBAAyB,CACvC,OAAO,EAAE,SAAS,gCAAgC,EAAE,EACpD,SAAS,EAAE,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,sBAAsB,EAAE,cAAc,GAAG,QAAQ,GAAG,YAAY,CAAC,GAAG;IAAE,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,EAC9I,YAAY,EAAE,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,KAAK,MAAM,GACjD,wBAAwB,CAqB1B"}
@@ -78,7 +78,7 @@ export function checkWebsiteDemoScenarios(records, resources, describeSite) {
78
78
  const distinct = new Map();
79
79
  for (const record of records)
80
80
  distinct.set(`${record.definedAt ?? ''}\u0000${JSON.stringify(record.scenario)}`, record);
81
- const problems = [];
81
+ const findings = [];
82
82
  let bound = 0;
83
83
  for (const record of distinct.values()) {
84
84
  const resourceType = record.scenario.resource;
@@ -88,12 +88,14 @@ export function checkWebsiteDemoScenarios(records, resources, describeSite) {
88
88
  const where = describeSite(record.definedAt);
89
89
  const resource = resources.get(resourceType);
90
90
  if (resource === undefined) {
91
- problems.push(`${where}: the scenario shows "${resourceType}", which is not a resource of the application`);
91
+ const problem = `the scenario shows "${resourceType}", which is not a resource of the application`;
92
+ findings.push({ sentence: `${where}: ${problem}`, problem, definedAt: record.definedAt, resourceType });
92
93
  continue;
93
94
  }
94
- for (const problem of validateWebsiteDemoScenario(record.scenario, websiteDemoResourceFacts(resource)))
95
- problems.push(`${where}: ${problem}`);
95
+ for (const problem of validateWebsiteDemoScenario(record.scenario, websiteDemoResourceFacts(resource))) {
96
+ findings.push({ sentence: `${where}: ${problem}`, problem, definedAt: record.definedAt, resourceType, moduleId: resource.moduleId ?? null });
97
+ }
96
98
  }
97
- return { defined: distinct.size, bound, problems };
99
+ return { defined: distinct.size, bound, problems: findings.map((finding) => finding.sentence), findings };
98
100
  }
99
101
  //# sourceMappingURL=website-demo-facts.models.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"website-demo-facts.models.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/website-demo-facts.models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAG5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iEAAiE,CAAC;AAE5G;;;;;;;;GAQG;AAEH,wHAAwH;AACxH,MAAM,UAAU,GAAsE;IACpF,CAAC,yBAAyB,CAAC,IAAI,CAAC,EAAE,oBAAoB,CAAC,IAAI;IAC3D,CAAC,yBAAyB,CAAC,MAAM,CAAC,EAAE,oBAAoB,CAAC,MA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AAC,SAAS,IAAI,EAAE,SAAS,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC,CAAC;IACxH,MAAM,QAAQ,GAAa,EAAE,CAAC;IAC9B,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KAAK,MAAM,MAAM,IAAI,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;QACvC,MAAM,YAAY,GAAG,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAC9C,IAAI,YAAY,KAAK,SAAS;YAAE,SAAS;QACzC,KAAK,IAAI,CAAC,CAAC;QACX,MAAM,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC7C,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAC7C,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;YAC3B,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,yBAAyB,YAAY,+CAA+C,CAAC,CAAC;YAC5G,SAAS;QACX,CAAC;QACD,KAAK,MAAM,OAAO,IAAI,2BAA2B,CAAC,MAAM,CAAC,QAAQ,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAC;YAAE,QAAQ,CAAC,IAAI,CAAC,GAAG,KAAK,KAAK,OAAO,EAAE,CAAC,CAAC;IAChJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AACrD,CAAC","sourcesContent":["import {\n WebsiteDemoFieldKind,\n validateWebsiteDemoScenario,\n type DefinedWebsiteDemoScenarioRecord,\n type WebsiteDemoResourceFacts,\n} from '@wildo-ai/saas-website/companion';\nimport { Resources_SharedUtils } from '@wildo-ai/saas-models';\nimport { ZodDecorator } from '@wildo-ai/zod-decorators';\n\nimport type { DomainModelResourceRow } from '../../core/introspection/subprocess/application-domain-model.behavior';\nimport { DomainModelFieldValueKind } from '../../core/introspection/subprocess/field-value-shape.companion';\n\n/**\n * What a drawn demo may show of the resource it is bound to (#2742 step 5e), as the website engine's scenario validator\n * reads it (`validateWebsiteDemoScenario`): every field with the kind of its values and an enum's members, read from the\n * resource's SCHEMA through the domain model, and the fields an update writes.\n *\n * The section's coding agent is handed these facts with the demo the plan decided, so a status it draws is one the\n * resource has and a change it shows is one an update makes. The same facts are what the validator checks a scenario\n * against, so the brief and the check cannot disagree about the application.\n */\n\n/** The domain model's value kinds as the scenario validator's field kinds. Total over the domain model's vocabulary. */\nconst FIELD_KIND: Readonly<Record<DomainModelFieldValueKind, WebsiteDemoFieldKind>> = {\n [DomainModelFieldValueKind.ENUM]: WebsiteDemoFieldKind.ENUM,\n [DomainModelFieldValueKind.NUMBER]: WebsiteDemoFieldKind.NUMBER,\n [DomainModelFieldValueKind.TEXT]: WebsiteDemoFieldKind.TEXT,\n [DomainModelFieldValueKind.BOOLEAN]: WebsiteDemoFieldKind.BOOLEAN,\n [DomainModelFieldValueKind.OTHER]: WebsiteDemoFieldKind.OTHER,\n};\n\n/**\n * The facts of one resource. A field whose schema could not be read is OTHER (named, its value unchecked), never\n * dropped: a drawing may still show it. A field is updatable unless its decorators exclude it from an update.\n *\n * Each CUSTOM operation is listed with the fields it writes, its `authoritativeFields` (every variant's, together):\n * that is how a lifecycle moves a status the update cannot touch (`resource-status-lifecycle` makes the status\n * `.excludeFromUpdate()` and each transition a custom operation naming it), so a status demo that moves through\n * `submit` or `approve` is true, and the same change drawn as an update is not. A custom operation that declares no\n * authoritative field is listed writing nothing, so a change drawn through it is reported rather than assumed.\n *\n * Only operations an author declared and the application serves: an operation the framework GENERATES is not a\n * transition, and a disabled or unimplemented one is not something the product does yet. The framework marks two\n * kinds with `generatedOperation` (a collection export, a file regeneration, which can inherit the update's\n * `authoritativeFields`). Its bulk relationship actions (`bulk_set_<field>`, …) carry no such marker and spread the\n * bulk update, so they are recognised the way the engine itself recognises them, by their identifier\n * (`Resources_SharedUtils.parseRelationshipBulkOperationIdentifier`). An AUTHORED bulk transition (\"complete all\")\n * stays: the predicate is \"generated\", never \"bulk\".\n */\nexport function websiteDemoResourceFacts(resource: Pick<DomainModelResourceRow, 'resourceType' | 'fields' | 'operations'>): WebsiteDemoResourceFacts {\n const fields: Record<string, { kind: WebsiteDemoFieldKind; members?: readonly string[] }> = {};\n const updatable: string[] = [];\n for (const field of resource.fields) {\n const shape = field.valueShape;\n const kind = shape === null ? WebsiteDemoFieldKind.OTHER : FIELD_KIND[shape.kind];\n fields[field.fieldName] = kind === WebsiteDemoFieldKind.ENUM ? { kind, members: [...(shape?.members ?? [])] } : { kind };\n // The metadata is keyed by decorator, its value the decorator's params: a key that is present is a decorator applied.\n const metadata = field.metadata ?? {};\n if (!Object.hasOwn(metadata, ZodDecorator.EXCLUDE_FROM_UPDATE) && !Object.hasOwn(metadata, ZodDecorator.IS_PRIMARY_KEY)) updatable.push(field.fieldName);\n }\n const operations: Record<string, string[]> = {};\n for (const operation of resource.operations) {\n if (operation.resourceOperationLike === null || operation.isDisabled || operation.isUnimplemented) continue;\n if (operation.attributes['generatedOperation'] !== undefined) continue;\n if (Resources_SharedUtils.parseRelationshipBulkOperationIdentifier(operation.operationIdentifier) !== undefined) continue;\n const written = operation.attributes['authoritativeFields'];\n const fieldsOfVariant = Array.isArray(written) ? written.filter((field): field is string => typeof field === 'string') : [];\n operations[operation.operationIdentifier] = [...new Set([...(operations[operation.operationIdentifier] ?? []), ...fieldsOfVariant])];\n }\n return { resource: resource.resourceType, fields, updatable, ...(Object.keys(operations).length > 0 ? { operations } : {}) };\n}\n\n/** What checking a site's landed demo scenarios found (#2784). */\nexport interface WebsiteDemoScenarioCheck {\n /** Distinct scenarios the site defined, bound or not. */\n readonly defined: number;\n /** Of those, the ones bound to a resource, which are the ones checked. */\n readonly bound: number;\n /** Each way a bound scenario is untrue of the application, as a sentence naming where it was defined. */\n readonly problems: readonly string[];\n}\n\n/**\n * Checks every scenario a site defined against the application it draws (#2784): a scenario bound to a resource\n * (`resource`) must name one the application has, and every value it shows or changes must be one that resource's\n * facts allow (`validateWebsiteDemoScenario`, with the facts `websiteDemoResourceFacts` derives, the same facts the\n * section's brief carried). An unbound scenario draws no record and is only counted.\n *\n * `records` may name one scenario twice (a check that imports two entries of the site evaluates a module once per\n * entry): a scenario is one DEFINITION SITE with one CONTENT. The site alone is not enough: a helper that builds\n * several scenarios (`goalScenario('done')`, `goalScenario('achieved')`) defines them all on one line, and keying on the\n * line kept only the last and dropped the rest unchecked.\n */\nexport function checkWebsiteDemoScenarios(\n records: readonly DefinedWebsiteDemoScenarioRecord[],\n resources: ReadonlyMap<string, Pick<DomainModelResourceRow, 'resourceType' | 'fields' | 'operations'>>,\n describeSite: (definedAt: string | null) => string,\n): WebsiteDemoScenarioCheck {\n const distinct = new Map<string, DefinedWebsiteDemoScenarioRecord>();\n for (const record of records) distinct.set(`${record.definedAt ?? ''}\\u0000${JSON.stringify(record.scenario)}`, record);\n const problems: string[] = [];\n let bound = 0;\n for (const record of distinct.values()) {\n const resourceType = record.scenario.resource;\n if (resourceType === undefined) continue;\n bound += 1;\n const where = describeSite(record.definedAt);\n const resource = resources.get(resourceType);\n if (resource === undefined) {\n problems.push(`${where}: the scenario shows \"${resourceType}\", which is not a resource of the application`);\n continue;\n }\n for (const problem of validateWebsiteDemoScenario(record.scenario, websiteDemoResourceFacts(resource))) problems.push(`${where}: ${problem}`);\n }\n return { defined: distinct.size, bound, problems };\n}\n"]}
1
+ {"version":3,"file":"website-demo-facts.models.js","sourceRoot":"","sources":["../../../../src/meta-workflows/services/website-demo-facts.models.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,2BAA2B,GAG5B,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGxD,OAAO,EAAE,yBAAyB,EAAE,MAAM,iEAAiE,CAAC;AAE5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E,YAAY,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,IAAI,IAAI,EAAE,CAAC,CAAC;QAC/I,CAAC;IACH,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,CAAC;AAC5G,CAAC","sourcesContent":["import {\n WebsiteDemoFieldKind,\n validateWebsiteDemoScenario,\n type DefinedWebsiteDemoScenarioRecord,\n type WebsiteDemoResourceFacts,\n} from '@wildo-ai/saas-website/companion';\nimport { Resources_SharedUtils } from '@wildo-ai/saas-models';\nimport { ZodDecorator } from '@wildo-ai/zod-decorators';\n\nimport type { DomainModelResourceRow } from '../../core/introspection/subprocess/application-domain-model.behavior';\nimport { DomainModelFieldValueKind } from '../../core/introspection/subprocess/field-value-shape.companion';\n\n/**\n * What a drawn demo may show of the resource it is bound to (#2742 step 5e), as the website engine's scenario validator\n * reads it (`validateWebsiteDemoScenario`): every field with the kind of its values and an enum's members, read from the\n * resource's SCHEMA through the domain model, and the fields an update writes.\n *\n * The section's coding agent is handed these facts with the demo the plan decided, so a status it draws is one the\n * resource has and a change it shows is one an update makes. The same facts are what the validator checks a scenario\n * against, so the brief and the check cannot disagree about the application.\n */\n\n/** The domain model's value kinds as the scenario validator's field kinds. Total over the domain model's vocabulary. */\nconst FIELD_KIND: Readonly<Record<DomainModelFieldValueKind, WebsiteDemoFieldKind>> = {\n [DomainModelFieldValueKind.ENUM]: WebsiteDemoFieldKind.ENUM,\n [DomainModelFieldValueKind.NUMBER]: WebsiteDemoFieldKind.NUMBER,\n [DomainModelFieldValueKind.TEXT]: WebsiteDemoFieldKind.TEXT,\n [DomainModelFieldValueKind.BOOLEAN]: WebsiteDemoFieldKind.BOOLEAN,\n [DomainModelFieldValueKind.OTHER]: WebsiteDemoFieldKind.OTHER,\n};\n\n/**\n * The facts of one resource. A field whose schema could not be read is OTHER (named, its value unchecked), never\n * dropped: a drawing may still show it. A field is updatable unless its decorators exclude it from an update.\n *\n * Each CUSTOM operation is listed with the fields it writes, its `authoritativeFields` (every variant's, together):\n * that is how a lifecycle moves a status the update cannot touch (`resource-status-lifecycle` makes the status\n * `.excludeFromUpdate()` and each transition a custom operation naming it), so a status demo that moves through\n * `submit` or `approve` is true, and the same change drawn as an update is not. A custom operation that declares no\n * authoritative field is listed writing nothing, so a change drawn through it is reported rather than assumed.\n *\n * Only operations an author declared and the application serves: an operation the framework GENERATES is not a\n * transition, and a disabled or unimplemented one is not something the product does yet. The framework marks two\n * kinds with `generatedOperation` (a collection export, a file regeneration, which can inherit the update's\n * `authoritativeFields`). Its bulk relationship actions (`bulk_set_<field>`, …) carry no such marker and spread the\n * bulk update, so they are recognised the way the engine itself recognises them, by their identifier\n * (`Resources_SharedUtils.parseRelationshipBulkOperationIdentifier`). An AUTHORED bulk transition (\"complete all\")\n * stays: the predicate is \"generated\", never \"bulk\".\n */\nexport function websiteDemoResourceFacts(resource: Pick<DomainModelResourceRow, 'resourceType' | 'fields' | 'operations'>): WebsiteDemoResourceFacts {\n const fields: Record<string, { kind: WebsiteDemoFieldKind; members?: readonly string[] }> = {};\n const updatable: string[] = [];\n for (const field of resource.fields) {\n const shape = field.valueShape;\n const kind = shape === null ? WebsiteDemoFieldKind.OTHER : FIELD_KIND[shape.kind];\n fields[field.fieldName] = kind === WebsiteDemoFieldKind.ENUM ? { kind, members: [...(shape?.members ?? [])] } : { kind };\n // The metadata is keyed by decorator, its value the decorator's params: a key that is present is a decorator applied.\n const metadata = field.metadata ?? {};\n if (!Object.hasOwn(metadata, ZodDecorator.EXCLUDE_FROM_UPDATE) && !Object.hasOwn(metadata, ZodDecorator.IS_PRIMARY_KEY)) updatable.push(field.fieldName);\n }\n const operations: Record<string, string[]> = {};\n for (const operation of resource.operations) {\n if (operation.resourceOperationLike === null || operation.isDisabled || operation.isUnimplemented) continue;\n if (operation.attributes['generatedOperation'] !== undefined) continue;\n if (Resources_SharedUtils.parseRelationshipBulkOperationIdentifier(operation.operationIdentifier) !== undefined) continue;\n const written = operation.attributes['authoritativeFields'];\n const fieldsOfVariant = Array.isArray(written) ? written.filter((field): field is string => typeof field === 'string') : [];\n operations[operation.operationIdentifier] = [...new Set([...(operations[operation.operationIdentifier] ?? []), ...fieldsOfVariant])];\n }\n return { resource: resource.resourceType, fields, updatable, ...(Object.keys(operations).length > 0 ? { operations } : {}) };\n}\n\n/** What checking a site's landed demo scenarios found (#2784). */\nexport interface WebsiteDemoScenarioCheck {\n /** Distinct scenarios the site defined, bound or not. */\n readonly defined: number;\n /** Of those, the ones bound to a resource, which are the ones checked. */\n readonly bound: number;\n /** Each way a bound scenario is untrue of the application, as a sentence naming where it was defined. */\n readonly problems: readonly string[];\n /**\n * The same problems, one per entry in the same order, with what each is ABOUT (#3881): where the scenario was defined\n * (`definedAt`, `<file>:<line>` or `null`) and the resource it draws, with that resource's module when the application\n * has the resource. What lets a coding run be charged only with the demos it touched.\n */\n readonly findings: readonly WebsiteDemoScenarioFinding[];\n}\n\n/** One way a bound demo scenario is untrue of the application, and what it is about (#3881). */\nexport interface WebsiteDemoScenarioFinding {\n readonly sentence: string;\n /** The problem without the site, so the same untruth keeps one identity when the line it is defined on moves. */\n readonly problem: string;\n readonly definedAt: string | null;\n readonly resourceType: string;\n /** The module that registers the resource; `null` for an engine resource, absent when the application lacks it. */\n readonly moduleId?: string | null;\n}\n\n/**\n * Checks every scenario a site defined against the application it draws (#2784): a scenario bound to a resource\n * (`resource`) must name one the application has, and every value it shows or changes must be one that resource's\n * facts allow (`validateWebsiteDemoScenario`, with the facts `websiteDemoResourceFacts` derives, the same facts the\n * section's brief carried). An unbound scenario draws no record and is only counted.\n *\n * `records` may name one scenario twice (a check that imports two entries of the site evaluates a module once per\n * entry): a scenario is one DEFINITION SITE with one CONTENT. The site alone is not enough: a helper that builds\n * several scenarios (`goalScenario('done')`, `goalScenario('achieved')`) defines them all on one line, and keying on the\n * line kept only the last and dropped the rest unchecked.\n */\nexport function checkWebsiteDemoScenarios(\n records: readonly DefinedWebsiteDemoScenarioRecord[],\n resources: ReadonlyMap<string, Pick<DomainModelResourceRow, 'resourceType' | 'fields' | 'operations'> & { readonly moduleId?: string | null }>,\n describeSite: (definedAt: string | null) => string,\n): WebsiteDemoScenarioCheck {\n const distinct = new Map<string, DefinedWebsiteDemoScenarioRecord>();\n for (const record of records) distinct.set(`${record.definedAt ?? ''}\\u0000${JSON.stringify(record.scenario)}`, record);\n const findings: WebsiteDemoScenarioFinding[] = [];\n let bound = 0;\n for (const record of distinct.values()) {\n const resourceType = record.scenario.resource;\n if (resourceType === undefined) continue;\n bound += 1;\n const where = describeSite(record.definedAt);\n const resource = resources.get(resourceType);\n if (resource === undefined) {\n const problem = `the scenario shows \"${resourceType}\", which is not a resource of the application`;\n findings.push({ sentence: `${where}: ${problem}`, problem, definedAt: record.definedAt, resourceType });\n continue;\n }\n for (const problem of validateWebsiteDemoScenario(record.scenario, websiteDemoResourceFacts(resource))) {\n findings.push({ sentence: `${where}: ${problem}`, problem, definedAt: record.definedAt, resourceType, moduleId: resource.moduleId ?? null });\n }\n }\n return { defined: distinct.size, bound, problems: findings.map((finding) => finding.sentence), findings };\n}\n"]}