@wildo-ai/saas-specifications 1.1.13 → 1.1.15

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 (117) hide show
  1. package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts +2 -2
  2. package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts.map +1 -1
  3. package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js +13 -8
  4. package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js.map +1 -1
  5. package/dist/esm/_core/build-plan/build-plan.family-aspects.d.ts.map +1 -1
  6. package/dist/esm/_core/build-plan/build-plan.family-aspects.js +13 -7
  7. package/dist/esm/_core/build-plan/build-plan.family-aspects.js.map +1 -1
  8. package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.d.ts.map +1 -1
  9. package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.js +28 -5
  10. package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.js.map +1 -1
  11. package/dist/esm/_core/compliance-documents/launch-blockers.schemas.js +4 -1
  12. package/dist/esm/_core/compliance-documents/launch-blockers.schemas.js.map +1 -1
  13. package/dist/esm/_core/compliance-documents/processor-register.schemas.d.ts +4 -0
  14. package/dist/esm/_core/compliance-documents/processor-register.schemas.d.ts.map +1 -1
  15. package/dist/esm/_core/compliance-documents/processor-register.schemas.js +10 -0
  16. package/dist/esm/_core/compliance-documents/processor-register.schemas.js.map +1 -1
  17. package/dist/esm/_core/integration-plan/integration-execution-surface-refs.schemas.d.ts +32 -0
  18. package/dist/esm/_core/integration-plan/integration-execution-surface-refs.schemas.d.ts.map +1 -0
  19. package/dist/esm/_core/integration-plan/integration-execution-surface-refs.schemas.js +47 -0
  20. package/dist/esm/_core/integration-plan/integration-execution-surface-refs.schemas.js.map +1 -0
  21. package/dist/esm/_core/integration-plan/integration-plan-generation.schemas.d.ts +7 -0
  22. package/dist/esm/_core/integration-plan/integration-plan-generation.schemas.d.ts.map +1 -1
  23. package/dist/esm/_core/integration-plan/integration-plan-generation.schemas.js +4 -1
  24. package/dist/esm/_core/integration-plan/integration-plan-generation.schemas.js.map +1 -1
  25. package/dist/esm/_core/integration-plan/integration-plan-validation.d.ts +114 -1
  26. package/dist/esm/_core/integration-plan/integration-plan-validation.d.ts.map +1 -1
  27. package/dist/esm/_core/integration-plan/integration-plan-validation.js +176 -0
  28. package/dist/esm/_core/integration-plan/integration-plan-validation.js.map +1 -1
  29. package/dist/esm/_core/integration-plan/integration-plan.family-aspects.d.ts.map +1 -1
  30. package/dist/esm/_core/integration-plan/integration-plan.family-aspects.js +17 -1
  31. package/dist/esm/_core/integration-plan/integration-plan.family-aspects.js.map +1 -1
  32. package/dist/esm/_core/integration-plan/integration-plan.schemas.d.ts +43 -5
  33. package/dist/esm/_core/integration-plan/integration-plan.schemas.d.ts.map +1 -1
  34. package/dist/esm/_core/integration-plan/integration-plan.schemas.js +75 -7
  35. package/dist/esm/_core/integration-plan/integration-plan.schemas.js.map +1 -1
  36. package/dist/esm/_core/provider-specification.schemas.d.ts +16 -1
  37. package/dist/esm/_core/provider-specification.schemas.d.ts.map +1 -1
  38. package/dist/esm/_core/provider-specification.schemas.js +21 -0
  39. package/dist/esm/_core/provider-specification.schemas.js.map +1 -1
  40. package/dist/esm/application-creation.exports.d.ts +1 -0
  41. package/dist/esm/application-creation.exports.d.ts.map +1 -1
  42. package/dist/esm/application-creation.exports.js +1 -0
  43. package/dist/esm/application-creation.exports.js.map +1 -1
  44. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.d.ts.map +1 -1
  45. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js +5 -3
  46. package/dist/esm/assurance/assurance-evidence-requirement-bodies.definitions.js.map +1 -1
  47. package/dist/esm/engine/auth/resources/application-access-grants.resource.specification.d.ts.map +1 -1
  48. package/dist/esm/engine/auth/resources/application-access-grants.resource.specification.js +2 -1
  49. package/dist/esm/engine/auth/resources/application-access-grants.resource.specification.js.map +1 -1
  50. package/dist/esm/engine/compliance/resources/data-subject-requests.resource.specification.d.ts.map +1 -1
  51. package/dist/esm/engine/compliance/resources/data-subject-requests.resource.specification.js +6 -2
  52. package/dist/esm/engine/compliance/resources/data-subject-requests.resource.specification.js.map +1 -1
  53. package/dist/esm/engine/compliance/resources/siem-delivery-dlq.resource.specification.d.ts.map +1 -1
  54. package/dist/esm/engine/compliance/resources/siem-delivery-dlq.resource.specification.js +6 -5
  55. package/dist/esm/engine/compliance/resources/siem-delivery-dlq.resource.specification.js.map +1 -1
  56. package/dist/esm/engine/compliance/resources/signature-requests.resource.specification.d.ts +2 -2
  57. package/dist/esm/engine/compliance/resources/signature-requests.resource.specification.d.ts.map +1 -1
  58. package/dist/esm/engine/compliance/resources/signature-requests.resource.specification.js +22 -2
  59. package/dist/esm/engine/compliance/resources/signature-requests.resource.specification.js.map +1 -1
  60. package/dist/esm/engine/engine-resource-specifications.registry.d.ts.map +1 -1
  61. package/dist/esm/engine/engine-resource-specifications.registry.js +2 -0
  62. package/dist/esm/engine/engine-resource-specifications.registry.js.map +1 -1
  63. package/dist/esm/engine/flows-actors/resources/flow-actor-tasks.resource.specification.js +3 -3
  64. package/dist/esm/engine/flows-actors/resources/flow-actor-tasks.resource.specification.js.map +1 -1
  65. package/dist/esm/engine/flows-actors/resources/organization-chat-settings.resource.specification.js +1 -1
  66. package/dist/esm/engine/flows-actors/resources/organization-chat-settings.resource.specification.js.map +1 -1
  67. package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js +2 -2
  68. package/dist/esm/engine/infrastructure/resources/external-data-pipeline-states.resource.specification.js.map +1 -1
  69. package/dist/esm/engine/infrastructure/resources/queue-messages.resource.specification.d.ts +9 -0
  70. package/dist/esm/engine/infrastructure/resources/queue-messages.resource.specification.d.ts.map +1 -0
  71. package/dist/esm/engine/infrastructure/resources/queue-messages.resource.specification.js +136 -0
  72. package/dist/esm/engine/infrastructure/resources/queue-messages.resource.specification.js.map +1 -0
  73. package/dist/esm/engine/notifications/resources/inbound-email.resource.specification.d.ts.map +1 -1
  74. package/dist/esm/engine/notifications/resources/inbound-email.resource.specification.js +4 -2
  75. package/dist/esm/engine/notifications/resources/inbound-email.resource.specification.js.map +1 -1
  76. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.d.ts.map +1 -1
  77. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js +6 -5
  78. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js.map +1 -1
  79. package/dist/esm/engine/organizations/resources/organization-custom-domains.resource.specification.d.ts.map +1 -1
  80. package/dist/esm/engine/organizations/resources/organization-custom-domains.resource.specification.js +2 -1
  81. package/dist/esm/engine/organizations/resources/organization-custom-domains.resource.specification.js.map +1 -1
  82. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.d.ts.map +1 -1
  83. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js +10 -7
  84. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js.map +1 -1
  85. package/dist/esm/engine/organizations/resources/organization-units.resource.specification.js +1 -1
  86. package/dist/esm/engine/organizations/resources/organization-units.resource.specification.js.map +1 -1
  87. package/dist/esm/engine/organizations/resources/organizations.resource.specification.d.ts +1 -0
  88. package/dist/esm/engine/organizations/resources/organizations.resource.specification.d.ts.map +1 -1
  89. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js +7 -7
  90. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js.map +1 -1
  91. package/dist/esm/engine/providers/_engine-provider-shared.d.ts +5 -0
  92. package/dist/esm/engine/providers/_engine-provider-shared.d.ts.map +1 -1
  93. package/dist/esm/engine/providers/_engine-provider-shared.js +5 -0
  94. package/dist/esm/engine/providers/_engine-provider-shared.js.map +1 -1
  95. package/dist/esm/engine/providers/dropbox.provider.specification.d.ts +14 -0
  96. package/dist/esm/engine/providers/dropbox.provider.specification.d.ts.map +1 -0
  97. package/dist/esm/engine/providers/dropbox.provider.specification.js +76 -0
  98. package/dist/esm/engine/providers/dropbox.provider.specification.js.map +1 -0
  99. package/dist/esm/engine/providers/index.d.ts +3 -1
  100. package/dist/esm/engine/providers/index.d.ts.map +1 -1
  101. package/dist/esm/engine/providers/index.js +5 -2
  102. package/dist/esm/engine/providers/index.js.map +1 -1
  103. package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.d.ts +2 -2
  104. package/dist/esm/engine/users/resources/user-preferences-api-reference.examples.d.ts +1 -0
  105. package/dist/esm/engine/users/resources/user-preferences-api-reference.examples.d.ts.map +1 -1
  106. package/dist/esm/engine/users/resources/user-preferences-api-reference.examples.js +2 -0
  107. package/dist/esm/engine/users/resources/user-preferences-api-reference.examples.js.map +1 -1
  108. package/dist/esm/engine/users/resources/user-preferences.resource.specification.d.ts +1 -0
  109. package/dist/esm/engine/users/resources/user-preferences.resource.specification.d.ts.map +1 -1
  110. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts +1 -0
  111. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.d.ts.map +1 -1
  112. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js +1 -1
  113. package/dist/esm/engine/users/resources/user-self-preferences.resource.specification.js.map +1 -1
  114. package/dist/esm/engine/users/resources/users.resource.specification.js +1 -1
  115. package/dist/esm/engine/users/resources/users.resource.specification.js.map +1 -1
  116. package/dist/tsconfig.build.tsbuildinfo +1 -1
  117. package/package.json +9 -9
@@ -1,3 +1,5 @@
1
+ import { ProviderBindingScope } from '../build-plan/build-plan-task-graph.schemas.js';
2
+ import { ProviderSpecificationFacet } from '../provider-specification.schemas.js';
1
3
  /** Deterministic finding over an integration plan; authoring coherence beyond structural validity. */
2
4
  export var IntegrationPlanFindingCode;
3
5
  (function (IntegrationPlanFindingCode) {
@@ -7,6 +9,13 @@ export var IntegrationPlanFindingCode;
7
9
  IntegrationPlanFindingCode["EXECUTION_SURFACE_SERVES_NOTHING"] = "EXECUTION_SURFACE_SERVES_NOTHING";
8
10
  /** A worker whose only job shares its own name — the starter route, planned rather than designed. */
9
11
  IntegrationPlanFindingCode["WORKER_JOB_RESTATES_ITS_WORKER"] = "WORKER_JOB_RESTATES_ITS_WORKER";
12
+ /**
13
+ * A need recorded as unprovided (#3992) that no provider binding wires and no planned worker or minion wires for itself
14
+ * (`wiredByRef`, #3995 item 6): a provider would be authored for nothing.
15
+ */
16
+ IntegrationPlanFindingCode["UNPROVIDED_NEED_NEVER_BOUND"] = "UNPROVIDED_NEED_NEVER_BOUND";
17
+ /** A need recorded as unprovided that serves no requirement: a provider would be authored for nothing anyone asked for. */
18
+ IntegrationPlanFindingCode["UNPROVIDED_NEED_SERVES_NOTHING"] = "UNPROVIDED_NEED_SERVES_NOTHING";
10
19
  })(IntegrationPlanFindingCode || (IntegrationPlanFindingCode = {}));
11
20
  /**
12
21
  * The finding codes that must block a landing — NONE, and that is a decision rather than an omission.
@@ -58,6 +67,173 @@ export function validateIntegrationPlan(plan) {
58
67
  });
59
68
  }
60
69
  }
70
+ const boundRefs = new Set(plan.providerBindings.map((binding) => binding.providerRef));
71
+ // The schema refuses a `wiredByRef` naming no planned surface, so a present one wires the need.
72
+ const plannedSurfaceRefs = new Set([...plan.workers.map((worker) => worker.workerRef), ...plan.minions.map((minion) => minion.minionRef)]);
73
+ for (const need of plan.unprovidedNeeds) {
74
+ const wiredBySurface = need.wiredByRef !== undefined && plannedSurfaceRefs.has(need.wiredByRef);
75
+ if (!boundRefs.has(need.providerRef) && !wiredBySurface) {
76
+ findings.push({
77
+ code: IntegrationPlanFindingCode.UNPROVIDED_NEED_NEVER_BOUND,
78
+ surfaceRef: need.providerRef,
79
+ message: `${need.providerRef} is recorded as a need no existing provider fills, but nothing wires it: bind it on the scope that needs it, name the worker or minion that alone uses it in wiredByRef, or drop the entry.`,
80
+ });
81
+ }
82
+ if (need.servesRefs.length === 0) {
83
+ findings.push({
84
+ code: IntegrationPlanFindingCode.UNPROVIDED_NEED_SERVES_NOTHING,
85
+ surfaceRef: need.providerRef,
86
+ message: `${need.providerRef} is recorded as a need no existing provider fills, but it serves no requirement: a new provider is authored only for something the product was asked to do.`,
87
+ });
88
+ }
89
+ }
61
90
  return findings;
62
91
  }
92
+ /** Why a provider reference in an integration plan names no provider it may (#3995). */
93
+ export var IntegrationPlanProviderRefFindingCode;
94
+ (function (IntegrationPlanProviderRefFindingCode) {
95
+ /** A binding names a provider that is no engine provider, no registry module, nothing installed, and no recorded need. */
96
+ IntegrationPlanProviderRefFindingCode["BINDING_NAMES_NO_KNOWN_PROVIDER"] = "BINDING_NAMES_NO_KNOWN_PROVIDER";
97
+ /** An unprovided need names a provider that EXISTS: authoring it would fork a provider the framework already has. */
98
+ IntegrationPlanProviderRefFindingCode["UNPROVIDED_NEED_NAMES_EXISTING_PROVIDER"] = "UNPROVIDED_NEED_NAMES_EXISTING_PROVIDER";
99
+ /**
100
+ * A binding puts a provider on a scope whose facet it does not ship (a `BACKEND` binding to the browser-only Dropbox
101
+ * Chooser): a task with nothing to load there, refused like an unknown provider. Checked only for a provider whose
102
+ * facets are known (`IntegrationPlanKnownProviders.facetsByProvider`).
103
+ */
104
+ IntegrationPlanProviderRefFindingCode["BINDING_SCOPE_NOT_SHIPPED_BY_PROVIDER"] = "BINDING_SCOPE_NOT_SHIPPED_BY_PROVIDER";
105
+ })(IntegrationPlanProviderRefFindingCode || (IntegrationPlanProviderRefFindingCode = {}));
106
+ /**
107
+ * The facet a provider must ship for a binding on each scope to load (#3995): total over {@link ProviderBindingScope}, so a
108
+ * scope added tomorrow names its facet or does not compile. The backend and the companion both load backend modules.
109
+ */
110
+ export const PROVIDER_BINDING_SCOPE_FACET = {
111
+ [ProviderBindingScope.BACKEND]: ProviderSpecificationFacet.BACKEND,
112
+ [ProviderBindingScope.COMPANION]: ProviderSpecificationFacet.BACKEND,
113
+ [ProviderBindingScope.FRONTEND_APP]: ProviderSpecificationFacet.FRONTEND_APP,
114
+ [ProviderBindingScope.WEBSITE]: ProviderSpecificationFacet.FRONTEND_WEBSITE,
115
+ };
116
+ /**
117
+ * The binding scopes whose providers the known set describes COMPLETELY (#3995 review R1): every scope, since #3995 item 5.
118
+ *
119
+ * The set's framework half comes from the registered provider specifications, so a scope may be checked only when every
120
+ * engine provider that scope can bind has one. For the backend side that was always true (every MAIN backend module is
121
+ * described). For the frontend side it was not: the Dropbox picker had no specification, and discovery finds an engine
122
+ * browser module only when an application's frontend scope already declares a provider, so FRONTEND_APP and WEBSITE were
123
+ * left unchecked rather than refuse a real engine provider and steer the model into recording it as unprovided (a fork).
124
+ * Dropbox now has its specification, and the CLI's provider-specification reconciliation (#328, facet-aware since #3995)
125
+ * fails when any engine browser module lacks one, so the frontend scopes are as completely described as the backend.
126
+ * Enumerated when widened: `frontend-app` dropbox, google-drive, google-places, microsoft-onedrive; `frontend-website`
127
+ * recaptcha; `frontend-techdoc` none. The application's own browser providers are in `bindable` through discovery and the
128
+ * refs its frontend scopes declare; a host that cannot read any discovery owner, frontend included, reports no set (the
129
+ * companion's `readKnownProviderRefsFor`).
130
+ *
131
+ * Kept as a named set rather than deleted, so a scope added to {@link ProviderBindingScope} without a complete source is a
132
+ * decision written here, not a check that silently starts refusing.
133
+ */
134
+ export const PROVIDER_BINDING_SCOPES_CHECKED_FOR_EXISTENCE = new Set([
135
+ ProviderBindingScope.BACKEND,
136
+ ProviderBindingScope.COMPANION,
137
+ ProviderBindingScope.FRONTEND_APP,
138
+ ProviderBindingScope.WEBSITE,
139
+ ]);
140
+ /**
141
+ * The provider references of an integration plan, against the providers that exist (#3995). Kept out of
142
+ * {@link validateIntegrationPlan} on purpose: that one reads the plan alone, and this needs the application around it, so
143
+ * a host calls it only when it could read the whole set (an unreadable source means no set, and no check, since unknown is
144
+ * not wrong).
145
+ *
146
+ * Every finding makes the plan UNTRUE, not thin (`application-creation-directive.md`): a binding to a provider nothing
147
+ * provides, or on a scope whose facet its provider does not ship, is a task with nothing to wire, and a recorded need for
148
+ * a provider that exists is a decision to fork it, which is what Paul's rule (#3992) forbids. So a host rejects the
149
+ * candidate into the model's retry with these findings.
150
+ * Bindings are checked only on {@link PROVIDER_BINDING_SCOPES_CHECKED_FOR_EXISTENCE}. `augments` is not checked: it names
151
+ * the provider an augmentation extends, which configuration sync already resolves.
152
+ */
153
+ export function validateIntegrationPlanProviderRefs(plan, known) {
154
+ const findings = [];
155
+ const recordedNeeds = new Set(plan.unprovidedNeeds.map((need) => need.providerRef));
156
+ plan.unprovidedNeeds.forEach((need, index) => {
157
+ if (known.existing.has(need.providerRef)) {
158
+ findings.push({
159
+ code: IntegrationPlanProviderRefFindingCode.UNPROVIDED_NEED_NAMES_EXISTING_PROVIDER,
160
+ providerRef: need.providerRef,
161
+ path: `unprovidedNeeds.${index}.providerRef`,
162
+ message: `${need.providerRef} is recorded as a need no existing provider fills, but ${need.providerRef} EXISTS (an engine provider or a registry module): bind it instead, and drop the entry.`,
163
+ });
164
+ }
165
+ });
166
+ plan.providerBindings.forEach((binding, index) => {
167
+ if (!PROVIDER_BINDING_SCOPES_CHECKED_FOR_EXISTENCE.has(binding.scope))
168
+ return;
169
+ if (known.bindable.has(binding.providerRef) || recordedNeeds.has(binding.providerRef))
170
+ return;
171
+ findings.push({
172
+ code: IntegrationPlanProviderRefFindingCode.BINDING_NAMES_NO_KNOWN_PROVIDER,
173
+ providerRef: binding.providerRef,
174
+ path: `providerBindings.${index}.providerRef`,
175
+ message: `${binding.providerRef} is bound, but it is no engine provider, no registry module and nothing this application has. Bind one the brief lists, or, if none fills the need, record ${binding.providerRef} in unprovidedNeeds with why.`,
176
+ });
177
+ });
178
+ plan.providerBindings.forEach((binding, index) => {
179
+ if (!PROVIDER_BINDING_SCOPES_CHECKED_FOR_EXISTENCE.has(binding.scope))
180
+ return;
181
+ const facets = known.facetsByProvider?.get(binding.providerRef);
182
+ const needed = PROVIDER_BINDING_SCOPE_FACET[binding.scope];
183
+ if (facets === undefined || facets.has(needed))
184
+ return;
185
+ findings.push({
186
+ code: IntegrationPlanProviderRefFindingCode.BINDING_SCOPE_NOT_SHIPPED_BY_PROVIDER,
187
+ providerRef: binding.providerRef,
188
+ path: `providerBindings.${index}.scope`,
189
+ message: `${binding.providerRef} is bound on ${binding.scope}, which loads a \`${needed}\` module, but ${binding.providerRef} ships only [${[...facets].sort().join(', ')}]. Bind it on a scope its facets serve, or bind a provider that ships \`${needed}\`.`,
190
+ });
191
+ });
192
+ return findings;
193
+ }
194
+ /**
195
+ * The plan with every provider reference {@link validateIntegrationPlanProviderRefs} refuses REMOVED, for the generation's
196
+ * LAST attempt (#3995 review follow-up): the same mechanical repair `skipDroppableRefs` makes for an optional dangling ref
197
+ * (#2556, #3074), so one wrong ref costs that element rather than the whole plan, and with it the run.
198
+ *
199
+ * - An `unprovidedNeeds` entry naming an EXISTING provider is dropped. Its binding stays: it now wires the provider that
200
+ * exists, which is exactly what Paul's rule (#3992) asks for. Nothing is authored, nothing is forked.
201
+ * - A binding to a provider that is neither bindable nor a remaining recorded need is dropped, and so is a binding on a
202
+ * scope whose facet its provider does not ship: a task with nothing to wire is not one the build can do. The
203
+ * requirement it served is then served by no binding, which the host reports as an advisory (in the generation's trace
204
+ * and attempt record, and the companion's log); the landing record does not carry it. A binding refused for two reasons
205
+ * is removed once, and recorded once, with its first finding.
206
+ *
207
+ * Needs first, then bindings, against the needs that remain. A dropped need names a provider in `existing`, which the
208
+ * host keeps inside `bindable`, so dropping it never orphans a binding. Pure; the caller decides whether to use it, and
209
+ * uses it only when the model has no attempt left to correct the refs itself.
210
+ */
211
+ export function repairIntegrationPlanProviderRefs(plan, known) {
212
+ // The needs first: each refused one names a provider that exists, and its binding (if any) wires that provider instead.
213
+ const refusedNeeds = validateIntegrationPlanProviderRefs(plan, known)
214
+ .filter((finding) => finding.code === IntegrationPlanProviderRefFindingCode.UNPROVIDED_NEED_NAMES_EXISTING_PROVIDER);
215
+ const refusedNeedPaths = new Set(refusedNeeds.map((finding) => finding.path));
216
+ const withKeptNeeds = {
217
+ ...plan,
218
+ unprovidedNeeds: plan.unprovidedNeeds.filter((_need, index) => !refusedNeedPaths.has(`unprovidedNeeds.${index}.providerRef`)),
219
+ };
220
+ // Then the bindings, judged against the needs that remain; the binding list is unchanged, so their paths still hold.
221
+ const refusedBindings = validateIntegrationPlanProviderRefs(withKeptNeeds, known)
222
+ .filter((finding) => finding.code === IntegrationPlanProviderRefFindingCode.BINDING_NAMES_NO_KNOWN_PROVIDER
223
+ || finding.code === IntegrationPlanProviderRefFindingCode.BINDING_SCOPE_NOT_SHIPPED_BY_PROVIDER);
224
+ // A binding is named by `providerBindings.<index>.<field>`, whichever field its finding is about; one removal per binding.
225
+ const bindingIndexOf = (finding) => Number(finding.path.split('.')[1]);
226
+ const refusedBindingIndexes = new Set(refusedBindings.map(bindingIndexOf));
227
+ const firstFindingPerBinding = refusedBindings.filter((finding, position) => refusedBindings.findIndex((other) => bindingIndexOf(other) === bindingIndexOf(finding)) === position);
228
+ const removed = [...refusedNeeds, ...firstFindingPerBinding];
229
+ if (removed.length === 0)
230
+ return { plan, removed };
231
+ return {
232
+ plan: {
233
+ ...withKeptNeeds,
234
+ providerBindings: plan.providerBindings.filter((_binding, index) => !refusedBindingIndexes.has(index)),
235
+ },
236
+ removed,
237
+ };
238
+ }
63
239
  //# sourceMappingURL=integration-plan-validation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"integration-plan-validation.js","sourceRoot":"","sources":["../../../../src/_core/integration-plan/integration-plan-validation.ts"],"names":[],"mappings":"AAEA,sGAAsG;AACtG,MAAM,CAAN,IAAY,0BAOX;AAPD,WAAY,0BAA0B;IACpC,+FAA+F;IAC/F,uGAAyE,CAAA;IACzE,8GAA8G;IAC9G,mGAAqE,CAAA;IACrE,qGAAqG;IACrG,+FAAiE,CAAA;AACnE,CAAC,EAPW,0BAA0B,KAA1B,0BAA0B,QAOrC;AAQD;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAA0C,EAAE,CAAC;AAE3F,MAAM,UAAU,uBAAuB,CAAC,IAAqB;IAC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AQ,CAAC,IAAI,CAAC;gBACZ,IAAI,EAAE,0BAA0B,CAAC,8BAA8B;gBAC/D,UAAU,EAAE,MAAM,CAAC,SAAS;gBAC5B,OAAO,EAAE,GAAG,MAAM,CAAC,SAAS,mGAAmG;aAChI,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import type { IntegrationPlan } from './integration-plan.schemas';\n\n/** Deterministic finding over an integration plan; authoring coherence beyond structural validity. */\nexport enum IntegrationPlanFindingCode {\n /** A minion that names no resource it touches — its containment whitelist would be guessed. */\n MINION_DECLARES_NO_RESOURCE_ACCESS = 'MINION_DECLARES_NO_RESOURCE_ACCESS',\n /** A worker or minion accountable to nothing: no requirement, feature draft or roadmap phase asked for it. */\n EXECUTION_SURFACE_SERVES_NOTHING = 'EXECUTION_SURFACE_SERVES_NOTHING',\n /** A worker whose only job shares its own name — the starter route, planned rather than designed. */\n WORKER_JOB_RESTATES_ITS_WORKER = 'WORKER_JOB_RESTATES_ITS_WORKER',\n}\n\nexport interface IntegrationPlanFinding {\n readonly code: IntegrationPlanFindingCode;\n readonly surfaceRef: string | null;\n readonly message: string;\n}\n\n/**\n * The finding codes that must block a landing — NONE, and that is a decision rather than an omission.\n *\n * Every finding here is about a plan that is thin, and a thin plan still composes a package that\n * runs: a minion with no declared access lands with the DENY-ALL starter whitelist, which is the\n * safe direction. Refusing would stop the lane over authoring judgement, which\n * `application-creation-directive.md` forbids — mark, never gate. A plan in this lane has a floor\n * only when it has a state that cannot be USED (a site with no landing page); this family has none.\n */\nexport const INTEGRATION_PLAN_HARD_FLOOR_CODES: readonly IntegrationPlanFindingCode[] = [];\n\nexport function validateIntegrationPlan(plan: IntegrationPlan): readonly IntegrationPlanFinding[] {\n const findings: IntegrationPlanFinding[] = [];\n for (const minion of plan.minions) {\n if (minion.readsResourceRefs.length === 0 && minion.writesResourceRefs.length === 0) {\n findings.push({\n code: IntegrationPlanFindingCode.MINION_DECLARES_NO_RESOURCE_ACCESS,\n surfaceRef: minion.minionRef,\n message: `${minion.minionRef} names no resource it reads or writes, so its containment whitelist would be guessed — and an empty whitelist logs a soft warning and keeps running, so the minion would appear healthy while touching nothing.`,\n });\n }\n if (minion.servesRefs.length === 0) {\n findings.push({\n code: IntegrationPlanFindingCode.EXECUTION_SURFACE_SERVES_NOTHING,\n surfaceRef: minion.minionRef,\n message: `${minion.minionRef} is accountable to nothing: no requirement, feature draft or roadmap phase asked for this schedule.`,\n });\n }\n }\n for (const worker of plan.workers) {\n if (worker.servesRefs.length === 0) {\n findings.push({\n code: IntegrationPlanFindingCode.EXECUTION_SURFACE_SERVES_NOTHING,\n surfaceRef: worker.workerRef,\n message: `${worker.workerRef} is accountable to nothing: no requirement, feature draft or roadmap phase asked for this process.`,\n });\n }\n /*\n * `worker-imports` exposing only `imports` is the scenario's starter shape carried into the plan:\n * the route says nothing the worker's own name did not, so nobody has decided what the backend\n * actually delegates.\n */\n const bareName = worker.workerRef.replace(/^worker-/u, '');\n if (worker.jobRefs.length === 1 && worker.jobRefs[0] === bareName) {\n findings.push({\n code: IntegrationPlanFindingCode.WORKER_JOB_RESTATES_ITS_WORKER,\n surfaceRef: worker.workerRef,\n message: `${worker.workerRef} exposes one route named after itself, which says nothing about what the backend delegates to it.`,\n });\n }\n }\n return findings;\n}\n"]}
1
+ {"version":3,"file":"integration-plan-validation.js","sourceRoot":"","sources":["../../../../src/_core/integration-plan/integration-plan-validation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AACnF,OAAO,EAAE,0BAA0B,EAAE,MAAM,mCAAmC,CAAC;AAG/E,sGAAsG;AACtG,MAAM,CAAN,IAAY,0BAcX;AAdD,WAAY,0BAA0B;IACpC,+FAA+F;IAC/F,uGAAyE,CAAA;IACzE,8GAA8G;IAC9G,mGAAqE,CAAA;IACrE,qGAAqG;IACrG,+FAAiE,CAAA;IACjE;;;OAGG;IACH,yFAA2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C,CAAC,qBAAqB,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;SACvG;QACD,OAAO;KACR,CAAC;AACJ,CAAC","sourcesContent":["import { ProviderBindingScope } from '../build-plan/build-plan-task-graph.schemas';\nimport { ProviderSpecificationFacet } from '../provider-specification.schemas';\nimport type { IntegrationPlan } from './integration-plan.schemas';\n\n/** Deterministic finding over an integration plan; authoring coherence beyond structural validity. */\nexport enum IntegrationPlanFindingCode {\n /** A minion that names no resource it touches — its containment whitelist would be guessed. */\n MINION_DECLARES_NO_RESOURCE_ACCESS = 'MINION_DECLARES_NO_RESOURCE_ACCESS',\n /** A worker or minion accountable to nothing: no requirement, feature draft or roadmap phase asked for it. */\n EXECUTION_SURFACE_SERVES_NOTHING = 'EXECUTION_SURFACE_SERVES_NOTHING',\n /** A worker whose only job shares its own name — the starter route, planned rather than designed. */\n WORKER_JOB_RESTATES_ITS_WORKER = 'WORKER_JOB_RESTATES_ITS_WORKER',\n /**\n * A need recorded as unprovided (#3992) that no provider binding wires and no planned worker or minion wires for itself\n * (`wiredByRef`, #3995 item 6): a provider would be authored for nothing.\n */\n UNPROVIDED_NEED_NEVER_BOUND = 'UNPROVIDED_NEED_NEVER_BOUND',\n /** A need recorded as unprovided that serves no requirement: a provider would be authored for nothing anyone asked for. */\n UNPROVIDED_NEED_SERVES_NOTHING = 'UNPROVIDED_NEED_SERVES_NOTHING',\n}\n\nexport interface IntegrationPlanFinding {\n readonly code: IntegrationPlanFindingCode;\n readonly surfaceRef: string | null;\n readonly message: string;\n}\n\n/**\n * The finding codes that must block a landing — NONE, and that is a decision rather than an omission.\n *\n * Every finding here is about a plan that is thin, and a thin plan still composes a package that\n * runs: a minion with no declared access lands with the DENY-ALL starter whitelist, which is the\n * safe direction. Refusing would stop the lane over authoring judgement, which\n * `application-creation-directive.md` forbids — mark, never gate. A plan in this lane has a floor\n * only when it has a state that cannot be USED (a site with no landing page); this family has none.\n */\nexport const INTEGRATION_PLAN_HARD_FLOOR_CODES: readonly IntegrationPlanFindingCode[] = [];\n\nexport function validateIntegrationPlan(plan: IntegrationPlan): readonly IntegrationPlanFinding[] {\n const findings: IntegrationPlanFinding[] = [];\n for (const minion of plan.minions) {\n if (minion.readsResourceRefs.length === 0 && minion.writesResourceRefs.length === 0) {\n findings.push({\n code: IntegrationPlanFindingCode.MINION_DECLARES_NO_RESOURCE_ACCESS,\n surfaceRef: minion.minionRef,\n message: `${minion.minionRef} names no resource it reads or writes, so its containment whitelist would be guessed — and an empty whitelist logs a soft warning and keeps running, so the minion would appear healthy while touching nothing.`,\n });\n }\n if (minion.servesRefs.length === 0) {\n findings.push({\n code: IntegrationPlanFindingCode.EXECUTION_SURFACE_SERVES_NOTHING,\n surfaceRef: minion.minionRef,\n message: `${minion.minionRef} is accountable to nothing: no requirement, feature draft or roadmap phase asked for this schedule.`,\n });\n }\n }\n for (const worker of plan.workers) {\n if (worker.servesRefs.length === 0) {\n findings.push({\n code: IntegrationPlanFindingCode.EXECUTION_SURFACE_SERVES_NOTHING,\n surfaceRef: worker.workerRef,\n message: `${worker.workerRef} is accountable to nothing: no requirement, feature draft or roadmap phase asked for this process.`,\n });\n }\n /*\n * `worker-imports` exposing only `imports` is the scenario's starter shape carried into the plan:\n * the route says nothing the worker's own name did not, so nobody has decided what the backend\n * actually delegates.\n */\n const bareName = worker.workerRef.replace(/^worker-/u, '');\n if (worker.jobRefs.length === 1 && worker.jobRefs[0] === bareName) {\n findings.push({\n code: IntegrationPlanFindingCode.WORKER_JOB_RESTATES_ITS_WORKER,\n surfaceRef: worker.workerRef,\n message: `${worker.workerRef} exposes one route named after itself, which says nothing about what the backend delegates to it.`,\n });\n }\n }\n const boundRefs = new Set(plan.providerBindings.map((binding) => binding.providerRef));\n // The schema refuses a `wiredByRef` naming no planned surface, so a present one wires the need.\n const plannedSurfaceRefs = new Set([...plan.workers.map((worker) => worker.workerRef), ...plan.minions.map((minion) => minion.minionRef)]);\n for (const need of plan.unprovidedNeeds) {\n const wiredBySurface = need.wiredByRef !== undefined && plannedSurfaceRefs.has(need.wiredByRef);\n if (!boundRefs.has(need.providerRef) && !wiredBySurface) {\n findings.push({\n code: IntegrationPlanFindingCode.UNPROVIDED_NEED_NEVER_BOUND,\n surfaceRef: need.providerRef,\n message: `${need.providerRef} is recorded as a need no existing provider fills, but nothing wires it: bind it on the scope that needs it, name the worker or minion that alone uses it in wiredByRef, or drop the entry.`,\n });\n }\n if (need.servesRefs.length === 0) {\n findings.push({\n code: IntegrationPlanFindingCode.UNPROVIDED_NEED_SERVES_NOTHING,\n surfaceRef: need.providerRef,\n message: `${need.providerRef} is recorded as a need no existing provider fills, but it serves no requirement: a new provider is authored only for something the product was asked to do.`,\n });\n }\n }\n return findings;\n}\n\n/** Why a provider reference in an integration plan names no provider it may (#3995). */\nexport enum IntegrationPlanProviderRefFindingCode {\n /** A binding names a provider that is no engine provider, no registry module, nothing installed, and no recorded need. */\n BINDING_NAMES_NO_KNOWN_PROVIDER = 'BINDING_NAMES_NO_KNOWN_PROVIDER',\n /** An unprovided need names a provider that EXISTS: authoring it would fork a provider the framework already has. */\n UNPROVIDED_NEED_NAMES_EXISTING_PROVIDER = 'UNPROVIDED_NEED_NAMES_EXISTING_PROVIDER',\n /**\n * A binding puts a provider on a scope whose facet it does not ship (a `BACKEND` binding to the browser-only Dropbox\n * Chooser): a task with nothing to load there, refused like an unknown provider. Checked only for a provider whose\n * facets are known (`IntegrationPlanKnownProviders.facetsByProvider`).\n */\n BINDING_SCOPE_NOT_SHIPPED_BY_PROVIDER = 'BINDING_SCOPE_NOT_SHIPPED_BY_PROVIDER',\n}\n\n/**\n * The facet a provider must ship for a binding on each scope to load (#3995): total over {@link ProviderBindingScope}, so a\n * scope added tomorrow names its facet or does not compile. The backend and the companion both load backend modules.\n */\nexport const PROVIDER_BINDING_SCOPE_FACET: Readonly<Record<ProviderBindingScope, ProviderSpecificationFacet>> = {\n [ProviderBindingScope.BACKEND]: ProviderSpecificationFacet.BACKEND,\n [ProviderBindingScope.COMPANION]: ProviderSpecificationFacet.BACKEND,\n [ProviderBindingScope.FRONTEND_APP]: ProviderSpecificationFacet.FRONTEND_APP,\n [ProviderBindingScope.WEBSITE]: ProviderSpecificationFacet.FRONTEND_WEBSITE,\n};\n\nexport interface IntegrationPlanProviderRefFinding {\n readonly code: IntegrationPlanProviderRefFindingCode;\n readonly providerRef: string;\n /**\n * The element's path in the plan (`providerBindings.0.providerRef`). A correction that changes a binding's provider\n * changes that element's identity, and the retry's drop guard (#3363) lets a correction remove or re-identify an\n * element only when a finding names it by its position: without the path the model could never fix what it is told.\n */\n readonly path: string;\n readonly message: string;\n}\n\n/**\n * The providers an integration plan is checked against (#3995), as two sets because the two checks ask different things.\n * `existing` is what the FRAMEWORK already has (the engine's providers and the registry's modules): a recorded need naming\n * one would fork it. `bindable` adds what THIS application has (installed or authored packages, refs its scopes declare):\n * a binding may name any of them. An authored provider is bindable but not existing, so a plan rerun after authoring it\n * keeps the need that records why.\n */\nexport interface IntegrationPlanKnownProviders {\n readonly existing: ReadonlySet<string>;\n readonly bindable: ReadonlySet<string>;\n /**\n * The facets each provider ships a module for, ONLY for a provider whose every source is known: an engine provider\n * specification that no registry module, application package or non-engine contribution shares the ref with. A provider\n * absent here has unknown facets (an installed, authored or registry one), and its binding's scope is not checked:\n * unknown is not wrong. Absent as a whole, no scope is checked.\n */\n readonly facetsByProvider?: ReadonlyMap<string, ReadonlySet<string>>;\n}\n\n/**\n * The binding scopes whose providers the known set describes COMPLETELY (#3995 review R1): every scope, since #3995 item 5.\n *\n * The set's framework half comes from the registered provider specifications, so a scope may be checked only when every\n * engine provider that scope can bind has one. For the backend side that was always true (every MAIN backend module is\n * described). For the frontend side it was not: the Dropbox picker had no specification, and discovery finds an engine\n * browser module only when an application's frontend scope already declares a provider, so FRONTEND_APP and WEBSITE were\n * left unchecked rather than refuse a real engine provider and steer the model into recording it as unprovided (a fork).\n * Dropbox now has its specification, and the CLI's provider-specification reconciliation (#328, facet-aware since #3995)\n * fails when any engine browser module lacks one, so the frontend scopes are as completely described as the backend.\n * Enumerated when widened: `frontend-app` dropbox, google-drive, google-places, microsoft-onedrive; `frontend-website`\n * recaptcha; `frontend-techdoc` none. The application's own browser providers are in `bindable` through discovery and the\n * refs its frontend scopes declare; a host that cannot read any discovery owner, frontend included, reports no set (the\n * companion's `readKnownProviderRefsFor`).\n *\n * Kept as a named set rather than deleted, so a scope added to {@link ProviderBindingScope} without a complete source is a\n * decision written here, not a check that silently starts refusing.\n */\nexport const PROVIDER_BINDING_SCOPES_CHECKED_FOR_EXISTENCE: ReadonlySet<ProviderBindingScope> = new Set([\n ProviderBindingScope.BACKEND,\n ProviderBindingScope.COMPANION,\n ProviderBindingScope.FRONTEND_APP,\n ProviderBindingScope.WEBSITE,\n]);\n\n/**\n * The provider references of an integration plan, against the providers that exist (#3995). Kept out of\n * {@link validateIntegrationPlan} on purpose: that one reads the plan alone, and this needs the application around it, so\n * a host calls it only when it could read the whole set (an unreadable source means no set, and no check, since unknown is\n * not wrong).\n *\n * Every finding makes the plan UNTRUE, not thin (`application-creation-directive.md`): a binding to a provider nothing\n * provides, or on a scope whose facet its provider does not ship, is a task with nothing to wire, and a recorded need for\n * a provider that exists is a decision to fork it, which is what Paul's rule (#3992) forbids. So a host rejects the\n * candidate into the model's retry with these findings.\n * Bindings are checked only on {@link PROVIDER_BINDING_SCOPES_CHECKED_FOR_EXISTENCE}. `augments` is not checked: it names\n * the provider an augmentation extends, which configuration sync already resolves.\n */\nexport function validateIntegrationPlanProviderRefs(plan: IntegrationPlan, known: IntegrationPlanKnownProviders): readonly IntegrationPlanProviderRefFinding[] {\n const findings: IntegrationPlanProviderRefFinding[] = [];\n const recordedNeeds = new Set(plan.unprovidedNeeds.map((need) => need.providerRef));\n plan.unprovidedNeeds.forEach((need, index) => {\n if (known.existing.has(need.providerRef)) {\n findings.push({\n code: IntegrationPlanProviderRefFindingCode.UNPROVIDED_NEED_NAMES_EXISTING_PROVIDER,\n providerRef: need.providerRef,\n path: `unprovidedNeeds.${index}.providerRef`,\n message: `${need.providerRef} is recorded as a need no existing provider fills, but ${need.providerRef} EXISTS (an engine provider or a registry module): bind it instead, and drop the entry.`,\n });\n }\n });\n plan.providerBindings.forEach((binding, index) => {\n if (!PROVIDER_BINDING_SCOPES_CHECKED_FOR_EXISTENCE.has(binding.scope)) return;\n if (known.bindable.has(binding.providerRef) || recordedNeeds.has(binding.providerRef)) return;\n findings.push({\n code: IntegrationPlanProviderRefFindingCode.BINDING_NAMES_NO_KNOWN_PROVIDER,\n providerRef: binding.providerRef,\n path: `providerBindings.${index}.providerRef`,\n message: `${binding.providerRef} is bound, but it is no engine provider, no registry module and nothing this application has. Bind one the brief lists, or, if none fills the need, record ${binding.providerRef} in unprovidedNeeds with why.`,\n });\n });\n plan.providerBindings.forEach((binding, index) => {\n if (!PROVIDER_BINDING_SCOPES_CHECKED_FOR_EXISTENCE.has(binding.scope)) return;\n const facets = known.facetsByProvider?.get(binding.providerRef);\n const needed = PROVIDER_BINDING_SCOPE_FACET[binding.scope];\n if (facets === undefined || facets.has(needed)) return;\n findings.push({\n code: IntegrationPlanProviderRefFindingCode.BINDING_SCOPE_NOT_SHIPPED_BY_PROVIDER,\n providerRef: binding.providerRef,\n path: `providerBindings.${index}.scope`,\n message: `${binding.providerRef} is bound on ${binding.scope}, which loads a \\`${needed}\\` module, but ${binding.providerRef} ships only [${[...facets].sort().join(', ')}]. Bind it on a scope its facets serve, or bind a provider that ships \\`${needed}\\`.`,\n });\n });\n return findings;\n}\n\n/** What {@link repairIntegrationPlanProviderRefs} removed from a plan, each with the finding that removed it. */\nexport interface IntegrationPlanProviderRefRepair {\n readonly plan: IntegrationPlan;\n /** The findings whose elements were removed, paths as they stood BEFORE the removal. Empty when nothing was. */\n readonly removed: readonly IntegrationPlanProviderRefFinding[];\n}\n\n/**\n * The plan with every provider reference {@link validateIntegrationPlanProviderRefs} refuses REMOVED, for the generation's\n * LAST attempt (#3995 review follow-up): the same mechanical repair `skipDroppableRefs` makes for an optional dangling ref\n * (#2556, #3074), so one wrong ref costs that element rather than the whole plan, and with it the run.\n *\n * - An `unprovidedNeeds` entry naming an EXISTING provider is dropped. Its binding stays: it now wires the provider that\n * exists, which is exactly what Paul's rule (#3992) asks for. Nothing is authored, nothing is forked.\n * - A binding to a provider that is neither bindable nor a remaining recorded need is dropped, and so is a binding on a\n * scope whose facet its provider does not ship: a task with nothing to wire is not one the build can do. The\n * requirement it served is then served by no binding, which the host reports as an advisory (in the generation's trace\n * and attempt record, and the companion's log); the landing record does not carry it. A binding refused for two reasons\n * is removed once, and recorded once, with its first finding.\n *\n * Needs first, then bindings, against the needs that remain. A dropped need names a provider in `existing`, which the\n * host keeps inside `bindable`, so dropping it never orphans a binding. Pure; the caller decides whether to use it, and\n * uses it only when the model has no attempt left to correct the refs itself.\n */\nexport function repairIntegrationPlanProviderRefs(plan: IntegrationPlan, known: IntegrationPlanKnownProviders): IntegrationPlanProviderRefRepair {\n // The needs first: each refused one names a provider that exists, and its binding (if any) wires that provider instead.\n const refusedNeeds = validateIntegrationPlanProviderRefs(plan, known)\n .filter((finding) => finding.code === IntegrationPlanProviderRefFindingCode.UNPROVIDED_NEED_NAMES_EXISTING_PROVIDER);\n const refusedNeedPaths = new Set(refusedNeeds.map((finding) => finding.path));\n const withKeptNeeds: IntegrationPlan = {\n ...plan,\n unprovidedNeeds: plan.unprovidedNeeds.filter((_need, index) => !refusedNeedPaths.has(`unprovidedNeeds.${index}.providerRef`)),\n };\n // Then the bindings, judged against the needs that remain; the binding list is unchanged, so their paths still hold.\n const refusedBindings = validateIntegrationPlanProviderRefs(withKeptNeeds, known)\n .filter((finding) => finding.code === IntegrationPlanProviderRefFindingCode.BINDING_NAMES_NO_KNOWN_PROVIDER\n || finding.code === IntegrationPlanProviderRefFindingCode.BINDING_SCOPE_NOT_SHIPPED_BY_PROVIDER);\n // A binding is named by `providerBindings.<index>.<field>`, whichever field its finding is about; one removal per binding.\n const bindingIndexOf = (finding: IntegrationPlanProviderRefFinding): number => Number(finding.path.split('.')[1]);\n const refusedBindingIndexes = new Set(refusedBindings.map(bindingIndexOf));\n const firstFindingPerBinding = refusedBindings.filter((finding, position) => refusedBindings.findIndex((other) => bindingIndexOf(other) === bindingIndexOf(finding)) === position);\n const removed = [...refusedNeeds, ...firstFindingPerBinding];\n if (removed.length === 0) return { plan, removed };\n return {\n plan: {\n ...withKeptNeeds,\n providerBindings: plan.providerBindings.filter((_binding, index) => !refusedBindingIndexes.has(index)),\n },\n removed,\n };\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"integration-plan.family-aspects.d.ts","sourceRoot":"","sources":["../../../../src/_core/integration-plan/integration-plan.family-aspects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAgB1E,eAAO,MAAM,+BAA+B,EAAE,wBAwD7C,CAAC"}
1
+ {"version":3,"file":"integration-plan.family-aspects.d.ts","sourceRoot":"","sources":["../../../../src/_core/integration-plan/integration-plan.family-aspects.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2BAA2B,CAAC;AAiB1E,eAAO,MAAM,+BAA+B,EAAE,wBAwE7C,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import { ApplicationSpecificationFamilySemanticSchemaRef } from '../application-specification-family-identity.schemas.js';
2
2
  import { FamilyAspectKind } from '../family-aspects.schemas.js';
3
- import { IntegrationInboundChannelPlanSchema, IntegrationMinionPlanSchema, IntegrationProviderBindingPlanSchema, IntegrationWorkerPlanSchema, } from './integration-plan.schemas.js';
3
+ import { IntegrationInboundChannelPlanSchema, IntegrationUnprovidedNeedSchema, IntegrationMinionPlanSchema, IntegrationProviderBindingPlanSchema, IntegrationWorkerPlanSchema, } from './integration-plan.schemas.js';
4
4
  /**
5
5
  * The five targets a background surface's `servesRefs` addresses. A build task's `servesRefs` addresses these and
6
6
  * more (vision constraints, pricing plans and the brand, #629 #1835 #2221): a background surface serves product
@@ -52,6 +52,22 @@ export const INTEGRATION_PLAN_FAMILY_ASPECTS = {
52
52
  augments: 'the provider an augmentation module adds operations to — a provider ref, not a decided element',
53
53
  },
54
54
  },
55
+ {
56
+ key: 'integration-plan.unprovided-need',
57
+ snapshotPath: 'unprovidedNeeds',
58
+ kind: FamilyAspectKind.COLLECTION,
59
+ itemSchema: IntegrationUnprovidedNeedSchema,
60
+ businessKey: 'providerRef',
61
+ headlineField: 'need',
62
+ edges: [
63
+ { field: 'servesRefs', targetAspects: SERVES_TARGETS },
64
+ /* The worker or minion that wires the provider for itself (#3995 item 6); its prefix says which. */
65
+ { field: 'wiredByRef', targetAspects: ['integration-plan.worker', 'integration-plan.minion'] },
66
+ ],
67
+ nonEdgeRefFields: {
68
+ providerRef: 'the ref the provider to author will have — a provider ref, not a decided element',
69
+ },
70
+ },
55
71
  {
56
72
  key: 'integration-plan.inbound-channel',
57
73
  snapshotPath: 'inboundChannels',
@@ -1 +1 @@
1
- {"version":3,"file":"integration-plan.family-aspects.js","sourceRoot":"","sources":["../../../../src/_core/integration-plan/integration-plan.family-aspects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+CAA+C,EAAE,MAAM,sDAAsD,CAAC;AAEvH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,mCAAmC,EACnC,2BAA2B,EAC3B,oCAAoC,EACpC,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,yBAAyB,EAAE,6BAA6B,EAAE,eAAe,EAAE,sBAAsB,EAAE,0BAA0B,CAAU,CAAC;AAEhK,MAAM,CAAC,MAAM,+BAA+B,GAA6B;IACvE,SAAS,EAAE,+CAA+C,CAAC,gBAAgB;IAC3E,OAAO,EAAE;QACP;YACE,GAAG,EAAE,yBAAyB;YAC9B,YAAY,EAAE,SAAS;YACvB,IAAI,EAAE,gBAAgB,CAAC,UAAU;YACjC,UAAU,EAAE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D,gBAAgB,EAAE,EAAE;SACrB;KACF;CACF,CAAC","sourcesContent":["import { ApplicationSpecificationFamilySemanticSchemaRef } from '../application-specification-family-identity.schemas';\nimport type { FamilyAspectsDeclaration } from '../family-aspects.schemas';\nimport { FamilyAspectKind } from '../family-aspects.schemas';\nimport {\n IntegrationInboundChannelPlanSchema,\n IntegrationMinionPlanSchema,\n IntegrationProviderBindingPlanSchema,\n IntegrationWorkerPlanSchema,\n} from './integration-plan.schemas';\n\n/**\n * The five targets a background surface's `servesRefs` addresses. A build task's `servesRefs` addresses these and\n * more (vision constraints, pricing plans and the brand, #629 #1835 #2221): a background surface serves product\n * scope, never a pricing plan or a brand element.\n */\nconst SERVES_TARGETS = ['requirements.functional', 'requirements.non-functional', 'roadmap.phase', 'feature-drafts.draft', 'vision.success-criterion'] as const;\n\nexport const INTEGRATION_PLAN_FAMILY_ASPECTS: FamilyAspectsDeclaration = {\n schemaRef: ApplicationSpecificationFamilySemanticSchemaRef.INTEGRATION_PLAN,\n aspects: [\n {\n key: 'integration-plan.worker',\n snapshotPath: 'workers',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: IntegrationWorkerPlanSchema,\n businessKey: 'workerRef',\n headlineField: 'purpose',\n edges: [{ field: 'servesRefs', targetAspects: SERVES_TARGETS }],\n nonEdgeRefFields: {\n jobRefs: 'the routes the worker registers — units of work of the BUILT package, not decided elements',\n },\n },\n {\n key: 'integration-plan.minion',\n snapshotPath: 'minions',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: IntegrationMinionPlanSchema,\n businessKey: 'minionRef',\n headlineField: 'purpose',\n edges: [\n /* The containment decision, as a link: which decided resources this tick may touch. */\n { field: 'readsResourceRefs', targetAspects: ['domain-plan.resource'] },\n { field: 'writesResourceRefs', targetAspects: ['domain-plan.resource'] },\n { field: 'servesRefs', targetAspects: SERVES_TARGETS },\n ],\n nonEdgeRefFields: {\n behaviorRefs: \"the tick's named behaviours — work of the BUILT package, not decided elements\",\n },\n },\n {\n key: 'integration-plan.provider-binding',\n snapshotPath: 'providerBindings',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: IntegrationProviderBindingPlanSchema,\n businessKey: 'providerRef',\n headlineField: 'providerRef',\n edges: [],\n nonEdgeRefFields: {\n providerRef: \"a provider ref — an engine provider's or a registry provider module's, not a decided element\",\n augments: 'the provider an augmentation module adds operations to — a provider ref, not a decided element',\n },\n },\n {\n key: 'integration-plan.inbound-channel',\n snapshotPath: 'inboundChannels',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: IntegrationInboundChannelPlanSchema,\n businessKey: 'channel',\n headlineField: 'purpose',\n edges: [{ field: 'servesRefs', targetAspects: SERVES_TARGETS }],\n nonEdgeRefFields: {},\n },\n ],\n};\n"]}
1
+ {"version":3,"file":"integration-plan.family-aspects.js","sourceRoot":"","sources":["../../../../src/_core/integration-plan/integration-plan.family-aspects.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,+CAA+C,EAAE,MAAM,sDAAsD,CAAC;AAEvH,OAAO,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAC7D,OAAO,EACL,mCAAmC,EACnC,+BAA+B,EAC/B,2BAA2B,EAC3B,oCAAoC,EACpC,2BAA2B,GAC5B,MAAM,4BAA4B,CAAC;AAEpC;;;;GAIG;AACH,MAAM,cAAc,GAAG,CAAC,yBAAyB,EAAE,6BAA6B,EAAE,eAAe,EAAE,sBAAsB,EAAE,0BAA0B,CAAU,CAAC;AAEhK,MAAM,CAAC,MAAM,+BAA+B,GAA6B;IACvE,SAAS,EAAE,+CAA+C,CAAC,gBAAgB;IAC3E,OAAO,EAAE;QACP;YACE,GAAG,EAAE,yBAAyB;YAC9B,YAAY,EAAE,SAAS;YACvB,IAAI,EAAE,gBAAgB,CAAC,UAAU;YACjC,UAAU,EAAE,2BAA2B;YACvC,WAAW,EAAE,WAAW;YACxB,aAAa,EAAE,SAAS;YACxB,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,a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gB,EAAE;gBAChB,WAAW,EAAE,kFAAkF;aAChG;SACF;QACD;YACE,GAAG,EAAE,kCAAkC;YACvC,YAAY,EAAE,iBAAiB;YAC/B,IAAI,EAAE,gBAAgB,CAAC,UAAU;YACjC,UAAU,EAAE,mCAAmC;YAC/C,WAAW,EAAE,SAAS;YACtB,aAAa,EAAE,SAAS;YACxB,KAAK,EAAE,CAAC,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,CAAC;YAC/D,gBAAgB,EAAE,EAAE;SACrB;KACF;CACF,CAAC","sourcesContent":["import { ApplicationSpecificationFamilySemanticSchemaRef } from '../application-specification-family-identity.schemas';\nimport type { FamilyAspectsDeclaration } from '../family-aspects.schemas';\nimport { FamilyAspectKind } from '../family-aspects.schemas';\nimport {\n IntegrationInboundChannelPlanSchema,\n IntegrationUnprovidedNeedSchema,\n IntegrationMinionPlanSchema,\n IntegrationProviderBindingPlanSchema,\n IntegrationWorkerPlanSchema,\n} from './integration-plan.schemas';\n\n/**\n * The five targets a background surface's `servesRefs` addresses. A build task's `servesRefs` addresses these and\n * more (vision constraints, pricing plans and the brand, #629 #1835 #2221): a background surface serves product\n * scope, never a pricing plan or a brand element.\n */\nconst SERVES_TARGETS = ['requirements.functional', 'requirements.non-functional', 'roadmap.phase', 'feature-drafts.draft', 'vision.success-criterion'] as const;\n\nexport const INTEGRATION_PLAN_FAMILY_ASPECTS: FamilyAspectsDeclaration = {\n schemaRef: ApplicationSpecificationFamilySemanticSchemaRef.INTEGRATION_PLAN,\n aspects: [\n {\n key: 'integration-plan.worker',\n snapshotPath: 'workers',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: IntegrationWorkerPlanSchema,\n businessKey: 'workerRef',\n headlineField: 'purpose',\n edges: [{ field: 'servesRefs', targetAspects: SERVES_TARGETS }],\n nonEdgeRefFields: {\n jobRefs: 'the routes the worker registers — units of work of the BUILT package, not decided elements',\n },\n },\n {\n key: 'integration-plan.minion',\n snapshotPath: 'minions',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: IntegrationMinionPlanSchema,\n businessKey: 'minionRef',\n headlineField: 'purpose',\n edges: [\n /* The containment decision, as a link: which decided resources this tick may touch. */\n { field: 'readsResourceRefs', targetAspects: ['domain-plan.resource'] },\n { field: 'writesResourceRefs', targetAspects: ['domain-plan.resource'] },\n { field: 'servesRefs', targetAspects: SERVES_TARGETS },\n ],\n nonEdgeRefFields: {\n behaviorRefs: \"the tick's named behaviours — work of the BUILT package, not decided elements\",\n },\n },\n {\n key: 'integration-plan.provider-binding',\n snapshotPath: 'providerBindings',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: IntegrationProviderBindingPlanSchema,\n businessKey: 'providerRef',\n headlineField: 'providerRef',\n edges: [],\n nonEdgeRefFields: {\n providerRef: \"a provider ref — an engine provider's or a registry provider module's, not a decided element\",\n augments: 'the provider an augmentation module adds operations to — a provider ref, not a decided element',\n },\n },\n {\n key: 'integration-plan.unprovided-need',\n snapshotPath: 'unprovidedNeeds',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: IntegrationUnprovidedNeedSchema,\n businessKey: 'providerRef',\n headlineField: 'need',\n edges: [\n { field: 'servesRefs', targetAspects: SERVES_TARGETS },\n /* The worker or minion that wires the provider for itself (#3995 item 6); its prefix says which. */\n { field: 'wiredByRef', targetAspects: ['integration-plan.worker', 'integration-plan.minion'] },\n ],\n nonEdgeRefFields: {\n providerRef: 'the ref the provider to author will have — a provider ref, not a decided element',\n },\n },\n {\n key: 'integration-plan.inbound-channel',\n snapshotPath: 'inboundChannels',\n kind: FamilyAspectKind.COLLECTION,\n itemSchema: IntegrationInboundChannelPlanSchema,\n businessKey: 'channel',\n headlineField: 'purpose',\n edges: [{ field: 'servesRefs', targetAspects: SERVES_TARGETS }],\n nonEdgeRefFields: {},\n },\n ],\n};\n"]}
@@ -6,7 +6,8 @@ import { BuildPlanWorkerRuntime, ProviderBindingScope } from '../build-plan/buil
6
6
  * @wildo_source:part:start integration-plan.config facet:layer:specification facet:family:integration-plan
7
7
  *
8
8
  * WHAT RUNS BESIDE THE BACKEND, and what the application reaches out to (#1495) — its workers, its
9
- * minions, the providers it binds, and the channels work arrives on (#1630).
9
+ * minions, the providers it binds, the channels work arrives on (#1630), and the needs no existing
10
+ * provider fills, each with why (#3992): the only door to authoring a new provider.
10
11
  *
11
12
  * ## Why this family exists
12
13
  *
@@ -66,9 +67,6 @@ export declare const INTEGRATION_PROVIDER_BINDING_SKILL_REF: Readonly<Record<Pro
66
67
  * the sender assurance it requires, and whether it answers (#1630).
67
68
  */
68
69
  export declare const INTEGRATION_INBOUND_CHANNEL_SKILL_REF = "inbound-channels";
69
- /** Stable prefixes the trusted runtime stamps; a provider supplies only the slug. */
70
- export declare const INTEGRATION_WORKER_REF_PREFIX = "worker-";
71
- export declare const INTEGRATION_MINION_REF_PREFIX = "minion-";
72
70
  /** One worker: an HTTP-only subprocess the backend delegates to. */
73
71
  export declare const IntegrationWorkerPlanSchema: z.ZodObject<{
74
72
  workerRef: z.ZodString;
@@ -96,6 +94,37 @@ export declare const IntegrationProviderBindingPlanSchema: z.ZodObject<{
96
94
  rationale: z.ZodString;
97
95
  }, z.core.$strict>;
98
96
  export type IntegrationProviderBindingPlan = z.infer<typeof IntegrationProviderBindingPlanSchema>;
97
+ /**
98
+ * A need NO provider the framework already has fills (#3992), recorded so that a provider is authored only for a reason
99
+ * someone wrote down. App creation USES the engine's providers and the registry's modules; authoring a new one is the last
100
+ * resort (Paul, 2026-11-16), and only an entry here may become a build task that authors a provider package. A binding may
101
+ * name a provider that does not exist yet only when an entry here names it.
102
+ *
103
+ * ## Who wires it: a provider binding, or the worker or minion named by `wiredByRef` (#3995 item 6)
104
+ *
105
+ * A need reaches the build in one of two ways. Either a {@link IntegrationProviderBindingPlanSchema binding} names its
106
+ * `providerRef` on the runtime owner that needs it (backend, companion, application frontend, website), and that binding's
107
+ * task authors the provider; or {@link wiredByRef} names the planned worker or minion that alone uses it, and THAT
108
+ * surface's task authors the provider and declares it in the surface's own scope
109
+ * (`providers.scopes.workers.<key>` / `providers.scopes.minions.<key>`, which the worker and minion tasks already write).
110
+ *
111
+ * Decided by what the framework already does: a worker's or minion's provider is declared on that surface's own
112
+ * `providers` block and belongs to the task that builds it (see {@link ProviderBindingScope}), so the plan names the
113
+ * surface rather than inventing a scope for it. Rejected: adding `WORKER` and `MINION` members to `ProviderBindingScope`.
114
+ * The scope is a closed set of SINGLE owners, each with one declaration file a landing probe reads and one skill; a
115
+ * worker or minion scope is keyed per surface (`scopes.workers.<key>`), so a bare `WORKER` member would name no file and
116
+ * no surface, and carrying the key would turn every binding into a second worker-or-minion reference beside the one
117
+ * this field already is. It would also give a minion's provider a task of its own, apart from the minion that holds its
118
+ * whitelist and its schedule, which the scope's own contract forbids.
119
+ */
120
+ export declare const IntegrationUnprovidedNeedSchema: z.ZodObject<{
121
+ providerRef: z.ZodString;
122
+ need: z.ZodString;
123
+ whyNoExistingProvider: z.ZodString;
124
+ wiredByRef: z.ZodOptional<z.ZodString>;
125
+ servesRefs: z.ZodDefault<z.ZodArray<z.ZodString>>;
126
+ }, z.core.$strict>;
127
+ export type IntegrationUnprovidedNeed = z.infer<typeof IntegrationUnprovidedNeedSchema>;
99
128
  /**
100
129
  * One channel work ARRIVES on (#1630, #3394): the application declares that messages on this channel are
101
130
  * work it acts on, which is what makes the foundation enable the channel's engine capability
@@ -118,7 +147,9 @@ export type IntegrationInboundChannelPlan = z.infer<typeof IntegrationInboundCha
118
147
  * THE integration-plan payload.
119
148
  *
120
149
  * **Artifact-family id: `integration-plan`.** Produced by `bottom_up.integration-plan`, consumed by
121
- * `bottom_up.build-decompose`, which emits one task per worker, minion, provider binding and inbound channel.
150
+ * `bottom_up.build-decompose`, which emits one task per worker, minion, provider binding and inbound channel. A binding
151
+ * whose provider is an {@link IntegrationUnprovidedNeedSchema unprovided need}, or the worker or minion such a need names
152
+ * as `wiredByRef`, is the one task that AUTHORS the provider; every other binding wires a provider that exists.
122
153
  *
123
154
  * Every collection may be EMPTY and the whole plan is still meaningful: most applications need no
124
155
  * worker and no minion, and saying so is an answer. There is no `min(1)` anywhere here, and that is
@@ -158,6 +189,13 @@ export declare const IntegrationPlanSchema: z.ZodObject<{
158
189
  purpose: z.ZodString;
159
190
  servesRefs: z.ZodDefault<z.ZodArray<z.ZodString>>;
160
191
  }, z.core.$strict>>>;
192
+ unprovidedNeeds: z.ZodDefault<z.ZodArray<z.ZodObject<{
193
+ providerRef: z.ZodString;
194
+ need: z.ZodString;
195
+ whyNoExistingProvider: z.ZodString;
196
+ wiredByRef: z.ZodOptional<z.ZodString>;
197
+ servesRefs: z.ZodDefault<z.ZodArray<z.ZodString>>;
198
+ }, z.core.$strict>>>;
161
199
  }, z.core.$strip>;
162
200
  export type IntegrationPlan = z.infer<typeof IntegrationPlanSchema>;
163
201
  /** @wildo_source:part:end integration-plan.config */
@@ -1 +1 @@
1
- {"version":3,"file":"integration-plan.schemas.d.ts","sourceRoot":"","sources":["../../../../src/_core/integration-plan/integration-plan.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAA+B,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;AAExI;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,oBAAY,sBAAsB;IAChC,EAAE,OAAO;CACV;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAGzF,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,4BAA4B,qBAAqB,CAAC;AAE/D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,MAAM,CAAC,oBAAoB,EAAE,MAAM,CAAC,CAKjG,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,qCAAqC,qBAAqB,CAAC;AAExE,qFAAqF;AACrF,eAAO,MAAM,6BAA6B,YAAY,CAAC;AACvD,eAAO,MAAM,6BAA6B,YAAY,CAAC;AAKvD,oEAAoE;AACpE,eAAO,MAAM,2BAA2B;;;;;;kBAYtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,iDAAiD;AACjD,eAAO,MAAM,2BAA2B;;;;;;;kBAkBtC,CAAC;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAEhF,yDAAyD;AACzD,eAAO,MAAM,oCAAoC;;;;;kBAkB/C,CAAC;AACH,MAAM,MAAM,8BAA8B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oCAAoC,CAAC,CAAC;AAElG;;;;;;;;GAQG;AACH,eAAO,MAAM,mCAAmC;;;;;;;kBAK9C,CAAC;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mCAAmC,CAAC,CAAC;AAEhG;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAoDhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,qDAAqD"}
1
+ {"version":3,"file":"integration-plan.schemas.d.ts","sourceRoot":"","sources":["../../../../src/_core/integration-plan/integration-plan.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,0BAA0B,CAAC;AAElC,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,sBAAsB,EAA+B,oBAAoB,EAAE,MAAM,6CAA6C,CAAC;A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qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAkEhC,CAAC;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACpE,qDAAqD"}
@@ -3,11 +3,13 @@ import { z } from 'zod';
3
3
  // never by the importer's luck (#966). A named import used only as a type would be elided and install nothing.
4
4
  import '@wildo-ai/zod-decorators';
5
5
  import { BuildPlanWorkerRuntime, PlannableInboundChannelKind, ProviderBindingScope } from '../build-plan/build-plan-task-graph.schemas.js';
6
+ import { INTEGRATION_MINION_REF_PREFIX, INTEGRATION_WORKER_REF_PREFIX, IntegrationMinionRefSchema, IntegrationWorkerRefSchema, } from './integration-execution-surface-refs.schemas.js';
6
7
  /**
7
8
  * @wildo_source:part:start integration-plan.config facet:layer:specification facet:family:integration-plan
8
9
  *
9
10
  * WHAT RUNS BESIDE THE BACKEND, and what the application reaches out to (#1495) — its workers, its
10
- * minions, the providers it binds, and the channels work arrives on (#1630).
11
+ * minions, the providers it binds, the channels work arrives on (#1630), and the needs no existing
12
+ * provider fills, each with why (#3992): the only door to authoring a new provider.
11
13
  *
12
14
  * ## Why this family exists
13
15
  *
@@ -76,14 +78,11 @@ export const INTEGRATION_PROVIDER_BINDING_SKILL_REF = {
76
78
  * the sender assurance it requires, and whether it answers (#1630).
77
79
  */
78
80
  export const INTEGRATION_INBOUND_CHANNEL_SKILL_REF = 'inbound-channels';
79
- /** Stable prefixes the trusted runtime stamps; a provider supplies only the slug. */
80
- export const INTEGRATION_WORKER_REF_PREFIX = 'worker-';
81
- export const INTEGRATION_MINION_REF_PREFIX = 'minion-';
82
81
  const SlugSchema = z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/);
83
82
  const NonEmptyStringSchema = z.string().trim().min(1);
84
83
  /** One worker: an HTTP-only subprocess the backend delegates to. */
85
84
  export const IntegrationWorkerPlanSchema = z.strictObject({
86
- workerRef: z.string().regex(new RegExp(`^${INTEGRATION_WORKER_REF_PREFIX}[a-z0-9]+(?:-[a-z0-9]+)*$`)),
85
+ workerRef: IntegrationWorkerRefSchema,
87
86
  runtime: z.enum(BuildPlanWorkerRuntime).systemEnum('BuildPlanWorkerRuntime'),
88
87
  /** What the backend delegates to it, and why that cannot happen inside a request. */
89
88
  purpose: NonEmptyStringSchema,
@@ -97,7 +96,7 @@ export const IntegrationWorkerPlanSchema = z.strictObject({
97
96
  });
98
97
  /** One minion: a cron unit that wakes itself. */
99
98
  export const IntegrationMinionPlanSchema = z.strictObject({
100
- minionRef: z.string().regex(new RegExp(`^${INTEGRATION_MINION_REF_PREFIX}[a-z0-9]+(?:-[a-z0-9]+)*$`)),
99
+ minionRef: IntegrationMinionRefSchema,
101
100
  /** What happens because time passed, and why it is not a request. */
102
101
  purpose: NonEmptyStringSchema,
103
102
  /** The named behaviours its tick performs. At least one: a minion that does nothing is a schedule with no work. */
@@ -135,6 +134,58 @@ export const IntegrationProviderBindingPlanSchema = z.strictObject({
135
134
  /** Why this application reaches this provider from this scope. */
136
135
  rationale: NonEmptyStringSchema,
137
136
  });
137
+ /**
138
+ * The ref of a planned WORKER or MINION (`worker-<slug>`, `minion-<slug>`): the surface that wires an unprovided need for
139
+ * itself (#3995 item 6). The prefix says which collection it names, so a worker and a minion sharing a slug stay distinct.
140
+ */
141
+ const IntegrationExecutionSurfaceRefSchema = z.string().regex(new RegExp(`^(?:${INTEGRATION_WORKER_REF_PREFIX}|${INTEGRATION_MINION_REF_PREFIX})[a-z0-9]+(?:-[a-z0-9]+)*$`));
142
+ /**
143
+ * A need NO provider the framework already has fills (#3992), recorded so that a provider is authored only for a reason
144
+ * someone wrote down. App creation USES the engine's providers and the registry's modules; authoring a new one is the last
145
+ * resort (Paul, 2026-11-16), and only an entry here may become a build task that authors a provider package. A binding may
146
+ * name a provider that does not exist yet only when an entry here names it.
147
+ *
148
+ * ## Who wires it: a provider binding, or the worker or minion named by `wiredByRef` (#3995 item 6)
149
+ *
150
+ * A need reaches the build in one of two ways. Either a {@link IntegrationProviderBindingPlanSchema binding} names its
151
+ * `providerRef` on the runtime owner that needs it (backend, companion, application frontend, website), and that binding's
152
+ * task authors the provider; or {@link wiredByRef} names the planned worker or minion that alone uses it, and THAT
153
+ * surface's task authors the provider and declares it in the surface's own scope
154
+ * (`providers.scopes.workers.<key>` / `providers.scopes.minions.<key>`, which the worker and minion tasks already write).
155
+ *
156
+ * Decided by what the framework already does: a worker's or minion's provider is declared on that surface's own
157
+ * `providers` block and belongs to the task that builds it (see {@link ProviderBindingScope}), so the plan names the
158
+ * surface rather than inventing a scope for it. Rejected: adding `WORKER` and `MINION` members to `ProviderBindingScope`.
159
+ * The scope is a closed set of SINGLE owners, each with one declaration file a landing probe reads and one skill; a
160
+ * worker or minion scope is keyed per surface (`scopes.workers.<key>`), so a bare `WORKER` member would name no file and
161
+ * no surface, and carrying the key would turn every binding into a second worker-or-minion reference beside the one
162
+ * this field already is. It would also give a minion's provider a task of its own, apart from the minion that holds its
163
+ * whitelist and its schedule, which the scope's own contract forbids.
164
+ */
165
+ export const IntegrationUnprovidedNeedSchema = z.strictObject({
166
+ /**
167
+ * The ref the provider to author will have: what the binding that wires it names as its `providerRef`. The entry's
168
+ * business key, on its OWN schema instance: the workbench takes an entry's own key out of its reading, and a key sharing
169
+ * an instance with another aspect's headline (a binding is headed by its `providerRef`) would either stay printed or
170
+ * blank that headline.
171
+ */
172
+ providerRef: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
173
+ /** What the application needs from outside, in its own words — "send invoices through the client's Fortnox ledger". */
174
+ need: NonEmptyStringSchema,
175
+ /**
176
+ * Why no engine provider and no registry module fills it: a vendor none of them offers, a behaviour they lack, or a
177
+ * business obligation that names a vendor. Checked against the lists the planner was shown; "it seemed simpler" is not one.
178
+ */
179
+ whyNoExistingProvider: NonEmptyStringSchema,
180
+ /**
181
+ * The planned worker or minion that wires this provider for itself (`worker-<slug>`, `minion-<slug>`), when no other
182
+ * runtime owner uses it. Its build task then authors the provider and declares it in that surface's own scope. Absent
183
+ * when a provider binding wires it; both may be present when the surface and a runtime owner both use it.
184
+ */
185
+ wiredByRef: IntegrationExecutionSurfaceRefSchema.optional(),
186
+ /** The requirements it is accountable to. */
187
+ servesRefs: z.array(NonEmptyStringSchema).default([]),
188
+ });
138
189
  /**
139
190
  * One channel work ARRIVES on (#1630, #3394): the application declares that messages on this channel are
140
191
  * work it acts on, which is what makes the foundation enable the channel's engine capability
@@ -154,7 +205,9 @@ export const IntegrationInboundChannelPlanSchema = z.strictObject({
154
205
  * THE integration-plan payload.
155
206
  *
156
207
  * **Artifact-family id: `integration-plan`.** Produced by `bottom_up.integration-plan`, consumed by
157
- * `bottom_up.build-decompose`, which emits one task per worker, minion, provider binding and inbound channel.
208
+ * `bottom_up.build-decompose`, which emits one task per worker, minion, provider binding and inbound channel. A binding
209
+ * whose provider is an {@link IntegrationUnprovidedNeedSchema unprovided need}, or the worker or minion such a need names
210
+ * as `wiredByRef`, is the one task that AUTHORS the provider; every other binding wires a provider that exists.
158
211
  *
159
212
  * Every collection may be EMPTY and the whole plan is still meaningful: most applications need no
160
213
  * worker and no minion, and saying so is an answer. There is no `min(1)` anywhere here, and that is
@@ -171,7 +224,16 @@ export const IntegrationPlanSchema = z.object({
171
224
  providerBindings: z.array(IntegrationProviderBindingPlanSchema).default([]),
172
225
  /** Channels work arrives on. Empty for an application no message ever reaches, which is most of them. */
173
226
  inboundChannels: z.array(IntegrationInboundChannelPlanSchema).default([]),
227
+ /** Needs no existing provider fills, each with why (#3992). Empty for nearly every application, and that is the point. */
228
+ unprovidedNeeds: z.array(IntegrationUnprovidedNeedSchema).default([]),
174
229
  }).superRefine((plan, context) => {
230
+ const unprovided = new Set();
231
+ plan.unprovidedNeeds.forEach((need, index) => {
232
+ if (unprovided.has(need.providerRef)) {
233
+ context.addIssue({ code: 'custom', message: `the unprovided need ${need.providerRef} is recorded twice; one entry says why it is authored`, path: ['unprovidedNeeds', index, 'providerRef'] });
234
+ }
235
+ unprovided.add(need.providerRef);
236
+ });
175
237
  const workerRefs = new Set();
176
238
  plan.workers.forEach((worker, index) => {
177
239
  if (workerRefs.has(worker.workerRef)) {
@@ -186,6 +248,12 @@ export const IntegrationPlanSchema = z.object({
186
248
  }
187
249
  minionRefs.add(minion.minionRef);
188
250
  });
251
+ // A need wired by a surface the plan does not run would be authored for nothing (#3995 item 6).
252
+ plan.unprovidedNeeds.forEach((need, index) => {
253
+ if (need.wiredByRef === undefined || workerRefs.has(need.wiredByRef) || minionRefs.has(need.wiredByRef))
254
+ return;
255
+ context.addIssue({ code: 'custom', message: `the unprovided need ${need.providerRef} is wired by ${need.wiredByRef}, which this plan neither runs as a worker nor as a minion`, path: ['unprovidedNeeds', index, 'wiredByRef'] });
256
+ });
189
257
  /*
190
258
  * One provider bound TWICE on one scope is one declaration written twice — the config carries a
191
259
  * single entry per ref per scope, so the second is either a duplicate or a disagreement, and