@wildo-ai/saas-specifications 1.1.8 → 1.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/_core/application-specification-family-identity.schemas.d.ts +9 -0
- package/dist/esm/_core/application-specification-family-identity.schemas.d.ts.map +1 -1
- package/dist/esm/_core/application-specification-family-identity.schemas.js +9 -0
- package/dist/esm/_core/application-specification-family-identity.schemas.js.map +1 -1
- package/dist/esm/_core/brand/brand-name-choice.d.ts +136 -0
- package/dist/esm/_core/brand/brand-name-choice.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-choice.js +193 -0
- package/dist/esm/_core/brand/brand-name-choice.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-generation.schemas.d.ts +108 -0
- package/dist/esm/_core/brand/brand-name-screening-generation.schemas.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-generation.schemas.js +59 -0
- package/dist/esm/_core/brand/brand-name-screening-generation.schemas.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-validation.d.ts +51 -0
- package/dist/esm/_core/brand/brand-name-screening-validation.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-validation.js +157 -0
- package/dist/esm/_core/brand/brand-name-screening-validation.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-view.d.ts +120 -0
- package/dist/esm/_core/brand/brand-name-screening-view.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening-view.js +47 -0
- package/dist/esm/_core/brand/brand-name-screening-view.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening.family-aspects.d.ts +3 -0
- package/dist/esm/_core/brand/brand-name-screening.family-aspects.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening.family-aspects.js +42 -0
- package/dist/esm/_core/brand/brand-name-screening.family-aspects.js.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening.schemas.d.ts +310 -0
- package/dist/esm/_core/brand/brand-name-screening.schemas.d.ts.map +1 -0
- package/dist/esm/_core/brand/brand-name-screening.schemas.js +272 -0
- package/dist/esm/_core/brand/brand-name-screening.schemas.js.map +1 -0
- package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts +23 -0
- package/dist/esm/_core/brand/brand-snapshot.schemas.d.ts.map +1 -1
- package/dist/esm/_core/brand/brand-snapshot.schemas.js +32 -0
- package/dist/esm/_core/brand/brand-snapshot.schemas.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts +10 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts +57 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js +89 -0
- package/dist/esm/_core/build-plan/build-plan-task-graph-validation.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts +79 -19
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js +61 -11
- package/dist/esm/_core/build-plan/build-plan-task-graph.schemas.js.map +1 -1
- package/dist/esm/_core/build-plan/build-plan.family-aspects.d.ts.map +1 -1
- package/dist/esm/_core/build-plan/build-plan.family-aspects.js +18 -2
- package/dist/esm/_core/build-plan/build-plan.family-aspects.js.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.d.ts +28 -4
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js +53 -5
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-generation.schemas.js.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts +24 -4
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.js +64 -4
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot-validation.js.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot.schemas.d.ts +59 -0
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot.schemas.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot.schemas.js +64 -0
- package/dist/esm/_core/business-model-lite/business-model-lite-snapshot.schemas.js.map +1 -1
- package/dist/esm/_core/business-model-lite/pricing-plan.schemas.d.ts +3 -0
- package/dist/esm/_core/business-model-lite/pricing-plan.schemas.d.ts.map +1 -1
- package/dist/esm/_core/business-model-lite/pricing-plan.schemas.js +16 -0
- package/dist/esm/_core/business-model-lite/pricing-plan.schemas.js.map +1 -1
- package/dist/esm/_core/capability-composition/capability-composition-validation.d.ts +7 -1
- package/dist/esm/_core/capability-composition/capability-composition-validation.d.ts.map +1 -1
- package/dist/esm/_core/capability-composition/capability-composition-validation.js +34 -28
- package/dist/esm/_core/capability-composition/capability-composition-validation.js.map +1 -1
- package/dist/esm/_core/capability-composition/capability-composition.schemas.d.ts +75 -4
- package/dist/esm/_core/capability-composition/capability-composition.schemas.d.ts.map +1 -1
- package/dist/esm/_core/capability-composition/capability-composition.schemas.js +62 -4
- package/dist/esm/_core/capability-composition/capability-composition.schemas.js.map +1 -1
- package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.d.ts.map +1 -1
- package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.js +7 -0
- package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.js.map +1 -1
- package/dist/esm/_core/compliance-documents/launch-blockers.schemas.d.ts +153 -0
- package/dist/esm/_core/compliance-documents/launch-blockers.schemas.d.ts.map +1 -0
- package/dist/esm/_core/compliance-documents/launch-blockers.schemas.js +241 -0
- package/dist/esm/_core/compliance-documents/launch-blockers.schemas.js.map +1 -0
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.d.ts +8 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.d.ts.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.js +19 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set-validation.js.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.d.ts +61 -3
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.d.ts.map +1 -1
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.js +73 -3
- package/dist/esm/_core/domain-plan/domain-plan-output-set.schemas.js.map +1 -1
- package/dist/esm/_core/experience-plan/experience-plan.family-aspects.js +1 -1
- package/dist/esm/_core/experience-plan/experience-plan.family-aspects.js.map +1 -1
- package/dist/esm/_core/experience-plan/experience-plan.schemas.d.ts.map +1 -1
- package/dist/esm/_core/experience-plan/experience-plan.schemas.js +1 -0
- package/dist/esm/_core/experience-plan/experience-plan.schemas.js.map +1 -1
- package/dist/esm/_core/family-aspects.registry.d.ts.map +1 -1
- package/dist/esm/_core/family-aspects.registry.js +2 -0
- package/dist/esm/_core/family-aspects.registry.js.map +1 -1
- package/dist/esm/_core/index.d.ts +6 -0
- package/dist/esm/_core/index.d.ts.map +1 -1
- package/dist/esm/_core/index.js +6 -0
- package/dist/esm/_core/index.js.map +1 -1
- package/dist/esm/_core/integration-plan/integration-plan.family-aspects.d.ts.map +1 -1
- package/dist/esm/_core/integration-plan/integration-plan.family-aspects.js +5 -1
- package/dist/esm/_core/integration-plan/integration-plan.family-aspects.js.map +1 -1
- package/dist/esm/_core/market/market-icp.schemas.d.ts +7 -0
- package/dist/esm/_core/market/market-icp.schemas.d.ts.map +1 -1
- package/dist/esm/_core/market/market-icp.schemas.js +7 -0
- package/dist/esm/_core/market/market-icp.schemas.js.map +1 -1
- package/dist/esm/_core/market/market-language-coverage.d.ts +62 -0
- package/dist/esm/_core/market/market-language-coverage.d.ts.map +1 -0
- package/dist/esm/_core/market/market-language-coverage.js +48 -0
- package/dist/esm/_core/market/market-language-coverage.js.map +1 -0
- package/dist/esm/_core/market/market-snapshot-validation.js +2 -2
- package/dist/esm/_core/market/market-snapshot-validation.js.map +1 -1
- package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.d.ts +63 -2
- package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.js +73 -5
- package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/application-line.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/application-line.application-creation.schemas.js +2 -0
- package/dist/esm/application-creation/application-line.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts +28 -0
- package/dist/esm/application-creation/playbooks.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/playbooks.application-creation.schemas.js +19 -1
- package/dist/esm/application-creation/playbooks.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.d.ts +1 -0
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.d.ts.map +1 -1
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.js +1 -0
- package/dist/esm/application-creation/structured-artifact-landing.application-creation.schemas.js.map +1 -1
- package/dist/esm/application-creation.exports.d.ts +7 -0
- package/dist/esm/application-creation.exports.d.ts.map +1 -1
- package/dist/esm/application-creation.exports.js +7 -0
- package/dist/esm/application-creation.exports.js.map +1 -1
- package/dist/esm/assurance/application-risk-signals.derivations.d.ts +20 -0
- package/dist/esm/assurance/application-risk-signals.derivations.d.ts.map +1 -1
- package/dist/esm/assurance/application-risk-signals.derivations.js +81 -0
- package/dist/esm/assurance/application-risk-signals.derivations.js.map +1 -1
- package/dist/esm/assurance/governed-document-release.d.ts +9 -0
- package/dist/esm/assurance/governed-document-release.d.ts.map +1 -1
- package/dist/esm/assurance/governed-document-release.js +9 -0
- package/dist/esm/assurance/governed-document-release.js.map +1 -1
- package/dist/esm/companion-exports.d.ts +10 -1
- package/dist/esm/companion-exports.d.ts.map +1 -1
- package/dist/esm/companion-exports.js.map +1 -1
- package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.d.ts +1 -0
- package/dist/esm/engine/infrastructure/resources/job-executions.resource.specification.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/esm/assurance/__tests__/authority-evaluation-instant.fixture.d.ts +0 -24
- package/dist/esm/assurance/__tests__/authority-evaluation-instant.fixture.d.ts.map +0 -1
- package/dist/esm/assurance/__tests__/authority-evaluation-instant.fixture.js +0 -24
- package/dist/esm/assurance/__tests__/authority-evaluation-instant.fixture.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { ApplicationInterviewDepth } from "@wildo-ai/saas-models/meta-workflows";
|
|
2
3
|
import { ApplicationSpecificationFamily } from "../_core/application-specification-family-identity.schemas.js";
|
|
3
4
|
import { PlaybookInstanceKeySchema, playbookInstanceId } from "./playbook-instance.application-creation.schemas.js";
|
|
4
5
|
/**
|
|
@@ -31,6 +32,29 @@ import { PlaybookInstanceKeySchema, playbookInstanceId } from "./playbook-instan
|
|
|
31
32
|
* here and WRITTEN into `wildo.saas.config.ts` by the run that reads it — the dossier is the
|
|
32
33
|
* interview's memory, the config stays the declaration.
|
|
33
34
|
*/
|
|
35
|
+
/**
|
|
36
|
+
* Whether an answer is something the creator DECIDED or something assumed on their behalf (#2129).
|
|
37
|
+
*
|
|
38
|
+
* Orthogonal to WHO answered (`answeredByRef`): a person can relay an assumption, and an agent can relay a
|
|
39
|
+
* derivation the application's own files settle. What this records is the answer's epistemic standing —
|
|
40
|
+
* whether anything downstream may treat it as the creator's statement.
|
|
41
|
+
*/
|
|
42
|
+
export var ApplicationCreatorInputAnswerStanding;
|
|
43
|
+
(function (ApplicationCreatorInputAnswerStanding) {
|
|
44
|
+
/**
|
|
45
|
+
* The creator decided it, or the application's own files settle it. The meaning of every answer recorded
|
|
46
|
+
* before this vocabulary existed, and of an answer that declares no standing.
|
|
47
|
+
*/
|
|
48
|
+
ApplicationCreatorInputAnswerStanding["DECIDED"] = "decided";
|
|
49
|
+
/**
|
|
50
|
+
* Proposed by the companion, never decided by the creator: either the creator did not know and let the
|
|
51
|
+
* proposal stand, or the creator chose a quick interview and an unattended round recorded the proposal with
|
|
52
|
+
* nobody present (#2129). The companion proposed it from what the creator had already said and what the
|
|
53
|
+
* application holds; the run treats it as a working hypothesis, and the dossier lists it to revisit. Always
|
|
54
|
+
* carries its rationale. Refused for a question whose `whenUnknown` is ASK.
|
|
55
|
+
*/
|
|
56
|
+
ApplicationCreatorInputAnswerStanding["ASSUMED"] = "assumed";
|
|
57
|
+
})(ApplicationCreatorInputAnswerStanding || (ApplicationCreatorInputAnswerStanding = {}));
|
|
34
58
|
export const ApplicationCreatorInputAnswerSchema = z.strictObject({
|
|
35
59
|
/** The playbook that asks this question — its compiled `ref` (`top_down.vision-elicitation`). */
|
|
36
60
|
playbookRef: z.string().trim().min(1),
|
|
@@ -48,6 +72,17 @@ export const ApplicationCreatorInputAnswerSchema = z.strictObject({
|
|
|
48
72
|
answeredAt: z.iso.datetime(),
|
|
49
73
|
/** Who answered — a user ref of the workbench session that recorded it. Provenance, never authority. */
|
|
50
74
|
answeredByRef: z.string().trim().min(1),
|
|
75
|
+
/**
|
|
76
|
+
* DECIDED or ASSUMED (#2129). Absent means DECIDED — read it through {@link creatorInputAnswerStanding},
|
|
77
|
+
* never directly — so every answer recorded before assumptions existed keeps the meaning it had.
|
|
78
|
+
*/
|
|
79
|
+
standing: z.enum(ApplicationCreatorInputAnswerStanding).optional(),
|
|
80
|
+
/**
|
|
81
|
+
* Why the proposed answer was assumed, in the proposer's words: what it inferred the value from. Every ASSUMED
|
|
82
|
+
* answer carries one and only an ASSUMED answer does (the family validator refuses both mismatches), so a reader
|
|
83
|
+
* can always see the basis of an assumption before deciding whether to keep it.
|
|
84
|
+
*/
|
|
85
|
+
assumptionRationale: z.string().trim().min(1).optional(),
|
|
51
86
|
});
|
|
52
87
|
/**
|
|
53
88
|
* One playbook INSTANCE the creator opened (#1609, carried from #1607): the non-derivable act the dossier
|
|
@@ -122,7 +157,20 @@ export const ApplicationCreatorInputsSchema = z.strictObject({
|
|
|
122
157
|
* choice. A list appended at the tail would conflict on every concurrent addition.
|
|
123
158
|
*/
|
|
124
159
|
activations: z.record(z.string(), ApplicationPlaybookActivationSchema).optional(),
|
|
160
|
+
/**
|
|
161
|
+
* How deep this application's interviews go (#2129). Absent until the creator chooses: a surface that
|
|
162
|
+
* starts an interview asks first, and records the answer with {@link withInterviewDepth}.
|
|
163
|
+
*/
|
|
164
|
+
interviewDepth: z.enum(ApplicationInterviewDepth).optional(),
|
|
125
165
|
});
|
|
166
|
+
/** The answer's standing — DECIDED when it declares none. The ONE place absence is interpreted. */
|
|
167
|
+
export function creatorInputAnswerStanding(answer) {
|
|
168
|
+
return answer.standing ?? ApplicationCreatorInputAnswerStanding.DECIDED;
|
|
169
|
+
}
|
|
170
|
+
/** The dossier with its interview depth recorded or changed. Answers and activations are untouched. */
|
|
171
|
+
export function withInterviewDepth(inputs, interviewDepth) {
|
|
172
|
+
return { ...(inputs ?? { answers: [] }), schemaVersion: 1, interviewDepth };
|
|
173
|
+
}
|
|
126
174
|
/**
|
|
127
175
|
* The one key an answer is addressed by. `playbookRef` and `questionRef` are refs, never free text, so `#`
|
|
128
176
|
* cannot occur in either. The default instance keeps the key it always had (`<ref>#<question>`); an
|
|
@@ -135,6 +183,8 @@ export function creatorInputAnswerKey(playbookRef, questionRef, instanceKey) {
|
|
|
135
183
|
export function withPlaybookActivation(inputs, activation) {
|
|
136
184
|
const merged = { ...(inputs?.activations ?? {}), [playbookInstanceId(activation.playbookRef, activation.instanceKey)]: activation };
|
|
137
185
|
return {
|
|
186
|
+
// Every other dossier field (the interview depth) is carried as it was: an activation changes only activations.
|
|
187
|
+
...(inputs ?? {}),
|
|
138
188
|
schemaVersion: 1,
|
|
139
189
|
answers: inputs?.answers ?? [],
|
|
140
190
|
activations: Object.fromEntries(Object.entries(merged).sort(([left], [right]) => left.localeCompare(right))),
|
|
@@ -173,6 +223,17 @@ export function validateApplicationCreatorInputs(inputs) {
|
|
|
173
223
|
findings.push(`question "${answer.questionRef}" of "${playbookInstanceId(answer.playbookRef, answer.instanceKey)}" is answered more than once`);
|
|
174
224
|
seen.add(key);
|
|
175
225
|
}
|
|
226
|
+
// A rationale explains an assumption; on a decided answer it would read as the creator's reasoning, which nobody gave.
|
|
227
|
+
// And an assumption without one cannot be reviewed: nothing says what it rests on.
|
|
228
|
+
for (const answer of inputs.answers) {
|
|
229
|
+
const assumed = creatorInputAnswerStanding(answer) === ApplicationCreatorInputAnswerStanding.ASSUMED;
|
|
230
|
+
if (answer.assumptionRationale !== undefined && !assumed) {
|
|
231
|
+
findings.push(`question "${answer.questionRef}" of "${playbookInstanceId(answer.playbookRef, answer.instanceKey)}" carries an assumption rationale but is not assumed`);
|
|
232
|
+
}
|
|
233
|
+
if (assumed && answer.assumptionRationale === undefined) {
|
|
234
|
+
findings.push(`question "${answer.questionRef}" of "${playbookInstanceId(answer.playbookRef, answer.instanceKey)}" is assumed with no rationale`);
|
|
235
|
+
}
|
|
236
|
+
}
|
|
176
237
|
// An activation is addressed by its own identity; a key that says another would be read as the wrong instance.
|
|
177
238
|
for (const [key, activation] of Object.entries(inputs.activations ?? {})) {
|
|
178
239
|
const expected = playbookInstanceId(activation.playbookRef, activation.instanceKey);
|
|
@@ -201,15 +262,22 @@ export function readCreatorInputAnswersForPlaybook(inputs, playbookRef, instance
|
|
|
201
262
|
const byQuestion = new Map();
|
|
202
263
|
for (const answer of inputs?.answers ?? []) {
|
|
203
264
|
if (answer.playbookRef === playbookRef && answer.instanceKey === undefined)
|
|
204
|
-
byQuestion.set(answer.questionRef, answer
|
|
265
|
+
byQuestion.set(answer.questionRef, answer);
|
|
205
266
|
}
|
|
206
267
|
if (instanceKey !== undefined) {
|
|
207
268
|
for (const answer of inputs?.answers ?? []) {
|
|
208
269
|
if (answer.playbookRef === playbookRef && answer.instanceKey === instanceKey)
|
|
209
|
-
byQuestion.set(answer.questionRef, answer
|
|
270
|
+
byQuestion.set(answer.questionRef, answer);
|
|
210
271
|
}
|
|
211
272
|
}
|
|
212
|
-
return [...byQuestion].map(([questionRef, answer]) => ({
|
|
273
|
+
return [...byQuestion].map(([questionRef, answer]) => ({
|
|
274
|
+
questionRef,
|
|
275
|
+
answer: answer.value,
|
|
276
|
+
/* Only an assumption is marked: a decided answer reads exactly as every answer did before #2129. */
|
|
277
|
+
...(creatorInputAnswerStanding(answer) === ApplicationCreatorInputAnswerStanding.ASSUMED
|
|
278
|
+
? { standing: ApplicationCreatorInputAnswerStanding.ASSUMED, ...(answer.assumptionRationale !== undefined ? { assumptionRationale: answer.assumptionRationale } : {}) }
|
|
279
|
+
: {}),
|
|
280
|
+
}));
|
|
213
281
|
}
|
|
214
282
|
/**
|
|
215
283
|
* The dossier after one more answer, or after one answer changed — REPLACE by key, keep the rest,
|
|
@@ -221,10 +289,10 @@ export function withCreatorInputAnswer(inputs, answer) {
|
|
|
221
289
|
const keyOf = (candidate) => creatorInputAnswerKey(candidate.playbookRef, candidate.questionRef, candidate.instanceKey);
|
|
222
290
|
const replaced = existing.some((candidate) => keyOf(candidate) === key);
|
|
223
291
|
return {
|
|
292
|
+
// The activations and the interview depth are separate records: an answer never adds, drops or changes them.
|
|
293
|
+
...(inputs ?? {}),
|
|
224
294
|
schemaVersion: 1,
|
|
225
295
|
answers: replaced ? existing.map((candidate) => (keyOf(candidate) === key ? answer : candidate)) : [...existing, answer],
|
|
226
|
-
// The activations are a separate record: an answer never adds, drops or reorders one.
|
|
227
|
-
...(inputs?.activations ? { activations: inputs.activations } : {}),
|
|
228
296
|
};
|
|
229
297
|
}
|
|
230
298
|
//# sourceMappingURL=application-creator-inputs.application-creation.schemas.js.map
|
package/dist/esm/application-creation/application-creator-inputs.application-creation.schemas.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-creator-inputs.application-creation.schemas.js","sourceRoot":"","sources":["../../../../src/application-creation/application-creator-inputs.application-creation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAEjH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,YAAY,CAAC;IAChE,iGAAiG;IACjG,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,sFAAsF;IACtF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC;;;;OAIG;IACH,WAAW,EAAE,yBAAyB,CAAC,QAAQ,EAAE;IACjD,+GAA+G;IAC/G,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,mGAAmG;IACnG,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAAE;IAC5B,wGAAwG;IACxG,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACxC,CAAC,CAAC;AAGH;;;;;;;GAOG;AACH;;;GAGG;AACH,MAAM,CAAN,IAAY,sCAQX;AARD,WAAY,sCAAsC;IAChD,qEAAqE;IACrE,iEAAuB,CAAA;IACvB;;;OAGG;IACH,iEAAuB,CAAA;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;;;GAGG;AACH,MAAM,UAAU,sBAAsB,CACpC,MAA4C,EAC5C,MAAqC;IAErC,MAAM,GAAG,GAAG,qBAAqB,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,WAAW,CAAC,CAAC;IAC9F,MAAM,QAAQ,GAAG,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC;IACvC,MAAM,KAAK,GAAG,CAAC,SAAwC,EAAE,EAAE,CAAC,qBAAqB,CAAC,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,WAAW,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACvJ,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC;IACxE,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,MAAM,CAAC;QACxH,sFAAsF;QACtF,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC;AACJ,CAAC","sourcesContent":["import { z } from \"zod\";\n\nimport { ApplicationSpecificationFamily } from \"../_core/application-specification-family-identity.schemas\";\nimport { PlaybookInstanceKeySchema, playbookInstanceId } from \"./playbook-instance.application-creation.schemas\";\n\n/**\n * THE DOSSIER's committed half: what the creator answered, question by question (#1454, Step 5).\n *\n * ## What one entry is\n *\n * One answer to one question a playbook DECLARES in its `method.elicitation`. The keys are the\n * playbook's own `ref` and the question's own `ref`, so nothing here invents a vocabulary: a\n * question that no playbook asks cannot be answered, and a playbook run that needs an answer finds\n * it under the ref it declared. The value is kept exactly as the interview's validation admitted\n * it — a CONFIRM answer canonically (`yes` / `no`), a CHOICE answer as one of its declared options,\n * free text trimmed.\n *\n * ## Why ONE file for every playbook, rather than one file per playbook\n *\n * The design note proposed a file per source. The family machinery lands one file per family and\n * reads it through one companion-exports slot, so a per-playbook split would need a second layout\n * and a second reader for no gain in truth: `answeredAt` on every entry already carries the\n * instant a per-file git history would have carried, and it carries it per ANSWER, which is finer\n * than per file. Freshness of a playbook's outputs against its answers is derived from that instant\n * (Step 8), not from a file's commit.\n *\n * ## What it deliberately is not\n *\n * Not a form. A creator answers through the conversation or the dossier, one question at a time,\n * and each answer lands here as a working edit that a commit accepts\n * (`.claude/rules/one-source-of-truth.md`, rules 2 and 3). Not a product declaration either: a\n * question whose answer is a typed config key (the operating entity, the jurisdictions) is answered\n * here and WRITTEN into `wildo.saas.config.ts` by the run that reads it — the dossier is the\n * interview's memory, the config stays the declaration.\n */\nexport const ApplicationCreatorInputAnswerSchema = z.strictObject({\n /** The playbook that asks this question — its compiled `ref` (`top_down.vision-elicitation`). */\n playbookRef: z.string().trim().min(1),\n /** The question's own `ref` inside that playbook's `method.elicitation.questions`. */\n questionRef: z.string().trim().min(1),\n /**\n * The playbook INSTANCE this answer belongs to (#1609); absent for the default instance. An instance\n * reads its own answer first and falls back to the default instance's, so company-level answers are\n * given once and a feature line answers only what differs for it.\n */\n instanceKey: PlaybookInstanceKeySchema.optional(),\n /** The answer, as the interview's validation admitted it. Never empty: an unanswered question has no entry. */\n value: z.string().trim().min(1),\n /** When this answer was given, ISO 8601. The instant a playbook's outputs are measured against. */\n answeredAt: z.iso.datetime(),\n /** Who answered — a user ref of the workbench session that recorded it. Provenance, never authority. */\n answeredByRef: z.string().trim().min(1),\n});\nexport type ApplicationCreatorInputAnswer = z.infer<typeof ApplicationCreatorInputAnswerSchema>;\n\n/**\n * One playbook INSTANCE the creator opened (#1609, carried from #1607): the non-derivable act the dossier\n * records beside the line.\n *\n * Only what cannot be derived. Which playbooks the line runs is derived (`describeApplicationActiveSet`);\n * when and by whom this was opened is the commit that recorded it (author, time, and the purpose and actor\n * trailers). So an activation is its identity and its purpose, nothing else.\n */\n/**\n * How an instance ENDED (#1608, #1609 R10). An instance is closed rather than deleted: what it contributed\n * stays, with its provenance, and its record says it no longer runs.\n */\nexport enum ApplicationPlaybookInstanceClosureKind {\n /** Its work is done, e.g. the feature it was opened for is built. */\n COMPLETED = \"completed\",\n /**\n * Stopped before it was done. Its contributions stay, marked with it; its waiting runs are cancelled and its\n * interrupted progress is consumed, so nothing resumes it.\n */\n ABANDONED = \"abandoned\",\n}\n\nexport const ApplicationPlaybookInstanceClosureSchema = z.strictObject({\n kind: z.enum(ApplicationPlaybookInstanceClosureKind),\n /** Why, in the words of whoever closed it. When and by whom is the commit that recorded it. */\n reason: z.string().trim().min(1).optional(),\n});\nexport type ApplicationPlaybookInstanceClosure = z.infer<typeof ApplicationPlaybookInstanceClosureSchema>;\n\nexport const ApplicationPlaybookActivationSchema = z.strictObject({\n playbookRef: z.string().trim().min(1),\n instanceKey: PlaybookInstanceKeySchema,\n /** What this instance is for, in the creator's terms (\"the enterprise segment\", \"the invoicing feature\"). */\n purpose: z.string().trim().min(1),\n /** Present once the instance is closed: it no longer runs, and a secondary line no longer counts as open. */\n closure: ApplicationPlaybookInstanceClosureSchema.optional(),\n /**\n * Families a SECONDARY LINE needs although the main line declares them not applicable (#1608): an internal\n * tool adding a public website as a feature needs the website plan, and the market snapshot the plan's\n * sections draw on. While the line is not abandoned they apply to the application, so the playbooks that\n * produce them run again and their files are read. Sorted and unique; absent when the line needs nothing\n * the main line excludes.\n *\n * The creator's decision, taken when the line is opened. The assistant may PROPOSE it from what the person\n * asked for (\"add a public website\"), and the approval card names the families, so what is recorded is what\n * the person approved; it is never inferred silently from the purpose, which would record a guess as a\n * decision. Only an instance of a secondary line's entry carries it; the landing refuses it on any other\n * instance.\n */\n neededFamilies: z.array(z.enum(ApplicationSpecificationFamily)).min(1).optional(),\n /**\n * The families a REFINEMENT line re-derives (#1608): what the creator asked to refine, e.g. the requirements\n * or the experience plan. Required on a refinement line and refused on any other instance. Each is a family\n * the application already holds and a producer of it re-derives from its own prior output, so the line\n * refines what exists instead of re-authoring it. Sorted and unique.\n *\n * The creator's decision, like `neededFamilies`: the assistant may propose it from what the person asked,\n * and the approval card names it, so what is recorded is what the person approved.\n */\n refinedFamilies: z.array(z.enum(ApplicationSpecificationFamily)).min(1).optional(),\n});\nexport type ApplicationPlaybookActivation = z.infer<typeof ApplicationPlaybookActivationSchema>;\n\nexport const ApplicationCreatorInputsSchema = z.strictObject({\n schemaVersion: z.literal(1),\n answers: z.array(ApplicationCreatorInputAnswerSchema),\n /**\n * The playbook instances the creator opened, keyed by instance id (`<ref>@<key>`), in SORTED key order\n * (#1609). Absent until the first one: a fresh application records no activation, and a run that lands\n * never writes here.\n *\n * A keyed object rather than a list, one entry per block, kept sorted by {@link withPlaybookActivation}:\n * two branches that each open an instance then touch different lines, so they merge without a textual\n * conflict unless the two keys are adjacent in sort order, in which case the conflict is a one-line\n * choice. A list appended at the tail would conflict on every concurrent addition.\n */\n activations: z.record(z.string(), ApplicationPlaybookActivationSchema).optional(),\n});\nexport type ApplicationCreatorInputs = z.infer<typeof ApplicationCreatorInputsSchema>;\n\n/**\n * The one key an answer is addressed by. `playbookRef` and `questionRef` are refs, never free text, so `#`\n * cannot occur in either. The default instance keeps the key it always had (`<ref>#<question>`); an\n * instance's answer is `<ref>@<key>#<question>` (#1609).\n */\nexport function creatorInputAnswerKey(playbookRef: string, questionRef: string, instanceKey?: string): string {\n return `${playbookInstanceId(playbookRef, instanceKey)}#${questionRef}`;\n}\n\n/** The dossier with one more activation, or one reworded, keyed by instance id and kept in sorted order. */\nexport function withPlaybookActivation(\n inputs: ApplicationCreatorInputs | undefined,\n activation: ApplicationPlaybookActivation,\n): ApplicationCreatorInputs {\n const merged = { ...(inputs?.activations ?? {}), [playbookInstanceId(activation.playbookRef, activation.instanceKey)]: activation };\n return {\n schemaVersion: 1,\n answers: inputs?.answers ?? [],\n activations: Object.fromEntries(Object.entries(merged).sort(([left], [right]) => left.localeCompare(right))),\n };\n}\n\n/** Whether this activation is still open: opened and not closed. */\nexport function isPlaybookInstanceOpen(activation: ApplicationPlaybookActivation | undefined): boolean {\n return activation !== undefined && activation.closure === undefined;\n}\n\n/**\n * The dossier with one instance closed (#1608). Refused for an instance nobody opened, and for one already\n * closed: closing is a decision taken once, and a second closure would overwrite the first one's reason.\n */\nexport function withPlaybookInstanceClosure(\n inputs: ApplicationCreatorInputs | undefined,\n instanceId: string,\n closure: ApplicationPlaybookInstanceClosure,\n): ApplicationCreatorInputs {\n const activation = inputs?.activations?.[instanceId];\n if (activation === undefined) throw new Error(`\"${instanceId}\" was never opened, so it cannot be closed.`);\n if (activation.closure !== undefined) throw new Error(`\"${instanceId}\" is already ${activation.closure.kind}.`);\n return withPlaybookActivation(inputs, { ...activation, closure });\n}\n\n/**\n * The family validator — FINDINGS, each an error: a dossier holding two answers to one question\n * cannot be read, because a run would have to pick one and nothing says which.\n *\n * Whether an answer names a question its playbook actually asks is NOT checked here: the family\n * schema does not know the catalog, and an answer to a question a later catalog renamed is a\n * stale answer to report, never a corrupt file. The dossier projection reports those as orphaned.\n */\nexport function validateApplicationCreatorInputs(inputs: ApplicationCreatorInputs): readonly string[] {\n const findings: string[] = [];\n const seen = new Set<string>();\n for (const answer of inputs.answers) {\n const key = creatorInputAnswerKey(answer.playbookRef, answer.questionRef, answer.instanceKey);\n if (seen.has(key)) findings.push(`question \"${answer.questionRef}\" of \"${playbookInstanceId(answer.playbookRef, answer.instanceKey)}\" is answered more than once`);\n seen.add(key);\n }\n // An activation is addressed by its own identity; a key that says another would be read as the wrong instance.\n for (const [key, activation] of Object.entries(inputs.activations ?? {})) {\n const expected = playbookInstanceId(activation.playbookRef, activation.instanceKey);\n if (key !== expected) findings.push(`activation \"${key}\" records the instance \"${expected}\"`);\n }\n // An answer to an instance nobody opened would be read by no run; keeping it unreported would hide a typo.\n for (const answer of inputs.answers) {\n if (answer.instanceKey === undefined) continue;\n const id = playbookInstanceId(answer.playbookRef, answer.instanceKey);\n if (!inputs.activations || !(id in inputs.activations)) findings.push(`question \"${answer.questionRef}\" is answered for \"${id}\", an instance that was never opened`);\n }\n return findings;\n}\n\n/**\n * The answers one playbook's interview reads, in the `{ questionRef, answer }` shape the run route\n * already accepts. A dossier with nothing for this playbook yields `[]`, which the run treats as\n * \"not interviewed yet\", never as a refusal.\n *\n * For an INSTANCE (#1609), its own answer wins per question and the default instance's fills the rest:\n * what the company answered once is shared, and the instance answers only what differs for it.\n */\nexport function readCreatorInputAnswersForPlaybook(\n inputs: ApplicationCreatorInputs | undefined,\n playbookRef: string,\n instanceKey?: string,\n): readonly { readonly questionRef: string; readonly answer: string }[] {\n const byQuestion = new Map<string, string>();\n for (const answer of inputs?.answers ?? []) {\n if (answer.playbookRef === playbookRef && answer.instanceKey === undefined) byQuestion.set(answer.questionRef, answer.value);\n }\n if (instanceKey !== undefined) {\n for (const answer of inputs?.answers ?? []) {\n if (answer.playbookRef === playbookRef && answer.instanceKey === instanceKey) byQuestion.set(answer.questionRef, answer.value);\n }\n }\n return [...byQuestion].map(([questionRef, answer]) => ({ questionRef, answer }));\n}\n\n/**\n * The dossier after one more answer, or after one answer changed — REPLACE by key, keep the rest,\n * keep the file's order for the entries that were already there so a diff shows only the change.\n */\nexport function withCreatorInputAnswer(\n inputs: ApplicationCreatorInputs | undefined,\n answer: ApplicationCreatorInputAnswer,\n): ApplicationCreatorInputs {\n const key = creatorInputAnswerKey(answer.playbookRef, answer.questionRef, answer.instanceKey);\n const existing = inputs?.answers ?? [];\n const keyOf = (candidate: ApplicationCreatorInputAnswer) => creatorInputAnswerKey(candidate.playbookRef, candidate.questionRef, candidate.instanceKey);\n const replaced = existing.some((candidate) => keyOf(candidate) === key);\n return {\n schemaVersion: 1,\n answers: replaced ? existing.map((candidate) => (keyOf(candidate) === key ? answer : candidate)) : [...existing, answer],\n // The activations are a separate record: an answer never adds, drops or reorders one.\n ...(inputs?.activations ? { activations: inputs.activations } : {}),\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"application-creator-inputs.application-creation.schemas.js","sourceRoot":"","sources":["../../../../src/application-creation/application-creator-inputs.application-creation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,yBAAyB,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAEjH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH;;;;;;GAMG;AACH,MAAM,CAAN,IAAY,qCAcX;AAdD,WAAY,qCAAqC;IAC/C;;;OAGG;IACH,4DAAmB,CAAA;IACnB;;;;;;OAMG;IACH,4DAAmB,CAAA;AACrB,CAAC,EAdW,qCAAqC,KAArC,qCAAqC,QAchD;AAED,MAAM,CAAC,MAAM,mCAAmC,GAAG,CAAC,CAAC,YAAY,CAAC;IAChE,iGAAiG;IACjG,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC,sFAAsF;IACtF,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IACrC;;;;OAIG;IACH,WAAW,EAAE,yBAAyB,CAAC,QAAQ,EAAE;IACjD,+GAA+G;IAC/G,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC/B,mGAAmG;IACnG,UAAU,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,EAA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AAO;QACL,6GAA6G;QAC7G,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC;QACjB,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,QAAQ,EAAE,MAAM,CAAC;KACzH,CAAC;AACJ,CAAC","sourcesContent":["import { z } from \"zod\";\nimport { ApplicationInterviewDepth } from \"@wildo-ai/saas-models/meta-workflows\";\n\nimport { ApplicationSpecificationFamily } from \"../_core/application-specification-family-identity.schemas\";\nimport { PlaybookInstanceKeySchema, playbookInstanceId } from \"./playbook-instance.application-creation.schemas\";\n\n/**\n * THE DOSSIER's committed half: what the creator answered, question by question (#1454, Step 5).\n *\n * ## What one entry is\n *\n * One answer to one question a playbook DECLARES in its `method.elicitation`. The keys are the\n * playbook's own `ref` and the question's own `ref`, so nothing here invents a vocabulary: a\n * question that no playbook asks cannot be answered, and a playbook run that needs an answer finds\n * it under the ref it declared. The value is kept exactly as the interview's validation admitted\n * it — a CONFIRM answer canonically (`yes` / `no`), a CHOICE answer as one of its declared options,\n * free text trimmed.\n *\n * ## Why ONE file for every playbook, rather than one file per playbook\n *\n * The design note proposed a file per source. The family machinery lands one file per family and\n * reads it through one companion-exports slot, so a per-playbook split would need a second layout\n * and a second reader for no gain in truth: `answeredAt` on every entry already carries the\n * instant a per-file git history would have carried, and it carries it per ANSWER, which is finer\n * than per file. Freshness of a playbook's outputs against its answers is derived from that instant\n * (Step 8), not from a file's commit.\n *\n * ## What it deliberately is not\n *\n * Not a form. A creator answers through the conversation or the dossier, one question at a time,\n * and each answer lands here as a working edit that a commit accepts\n * (`.claude/rules/one-source-of-truth.md`, rules 2 and 3). Not a product declaration either: a\n * question whose answer is a typed config key (the operating entity, the jurisdictions) is answered\n * here and WRITTEN into `wildo.saas.config.ts` by the run that reads it — the dossier is the\n * interview's memory, the config stays the declaration.\n */\n/**\n * Whether an answer is something the creator DECIDED or something assumed on their behalf (#2129).\n *\n * Orthogonal to WHO answered (`answeredByRef`): a person can relay an assumption, and an agent can relay a\n * derivation the application's own files settle. What this records is the answer's epistemic standing —\n * whether anything downstream may treat it as the creator's statement.\n */\nexport enum ApplicationCreatorInputAnswerStanding {\n /**\n * The creator decided it, or the application's own files settle it. The meaning of every answer recorded\n * before this vocabulary existed, and of an answer that declares no standing.\n */\n DECIDED = \"decided\",\n /**\n * Proposed by the companion, never decided by the creator: either the creator did not know and let the\n * proposal stand, or the creator chose a quick interview and an unattended round recorded the proposal with\n * nobody present (#2129). The companion proposed it from what the creator had already said and what the\n * application holds; the run treats it as a working hypothesis, and the dossier lists it to revisit. Always\n * carries its rationale. Refused for a question whose `whenUnknown` is ASK.\n */\n ASSUMED = \"assumed\",\n}\n\nexport const ApplicationCreatorInputAnswerSchema = z.strictObject({\n /** The playbook that asks this question — its compiled `ref` (`top_down.vision-elicitation`). */\n playbookRef: z.string().trim().min(1),\n /** The question's own `ref` inside that playbook's `method.elicitation.questions`. */\n questionRef: z.string().trim().min(1),\n /**\n * The playbook INSTANCE this answer belongs to (#1609); absent for the default instance. An instance\n * reads its own answer first and falls back to the default instance's, so company-level answers are\n * given once and a feature line answers only what differs for it.\n */\n instanceKey: PlaybookInstanceKeySchema.optional(),\n /** The answer, as the interview's validation admitted it. Never empty: an unanswered question has no entry. */\n value: z.string().trim().min(1),\n /** When this answer was given, ISO 8601. The instant a playbook's outputs are measured against. */\n answeredAt: z.iso.datetime(),\n /** Who answered — a user ref of the workbench session that recorded it. Provenance, never authority. */\n answeredByRef: z.string().trim().min(1),\n /**\n * DECIDED or ASSUMED (#2129). Absent means DECIDED — read it through {@link creatorInputAnswerStanding},\n * never directly — so every answer recorded before assumptions existed keeps the meaning it had.\n */\n standing: z.enum(ApplicationCreatorInputAnswerStanding).optional(),\n /**\n * Why the proposed answer was assumed, in the proposer's words: what it inferred the value from. Every ASSUMED\n * answer carries one and only an ASSUMED answer does (the family validator refuses both mismatches), so a reader\n * can always see the basis of an assumption before deciding whether to keep it.\n */\n assumptionRationale: z.string().trim().min(1).optional(),\n});\nexport type ApplicationCreatorInputAnswer = z.infer<typeof ApplicationCreatorInputAnswerSchema>;\n\n/**\n * One playbook INSTANCE the creator opened (#1609, carried from #1607): the non-derivable act the dossier\n * records beside the line.\n *\n * Only what cannot be derived. Which playbooks the line runs is derived (`describeApplicationActiveSet`);\n * when and by whom this was opened is the commit that recorded it (author, time, and the purpose and actor\n * trailers). So an activation is its identity and its purpose, nothing else.\n */\n/**\n * How an instance ENDED (#1608, #1609 R10). An instance is closed rather than deleted: what it contributed\n * stays, with its provenance, and its record says it no longer runs.\n */\nexport enum ApplicationPlaybookInstanceClosureKind {\n /** Its work is done, e.g. the feature it was opened for is built. */\n COMPLETED = \"completed\",\n /**\n * Stopped before it was done. Its contributions stay, marked with it; its waiting runs are cancelled and its\n * interrupted progress is consumed, so nothing resumes it.\n */\n ABANDONED = \"abandoned\",\n}\n\nexport const ApplicationPlaybookInstanceClosureSchema = z.strictObject({\n kind: z.enum(ApplicationPlaybookInstanceClosureKind),\n /** Why, in the words of whoever closed it. When and by whom is the commit that recorded it. */\n reason: z.string().trim().min(1).optional(),\n});\nexport type ApplicationPlaybookInstanceClosure = z.infer<typeof ApplicationPlaybookInstanceClosureSchema>;\n\nexport const ApplicationPlaybookActivationSchema = z.strictObject({\n playbookRef: z.string().trim().min(1),\n instanceKey: PlaybookInstanceKeySchema,\n /** What this instance is for, in the creator's terms (\"the enterprise segment\", \"the invoicing feature\"). */\n purpose: z.string().trim().min(1),\n /** Present once the instance is closed: it no longer runs, and a secondary line no longer counts as open. */\n closure: ApplicationPlaybookInstanceClosureSchema.optional(),\n /**\n * Families a SECONDARY LINE needs although the main line declares them not applicable (#1608): an internal\n * tool adding a public website as a feature needs the website plan, and the market snapshot the plan's\n * sections draw on. While the line is not abandoned they apply to the application, so the playbooks that\n * produce them run again and their files are read. Sorted and unique; absent when the line needs nothing\n * the main line excludes.\n *\n * The creator's decision, taken when the line is opened. The assistant may PROPOSE it from what the person\n * asked for (\"add a public website\"), and the approval card names the families, so what is recorded is what\n * the person approved; it is never inferred silently from the purpose, which would record a guess as a\n * decision. Only an instance of a secondary line's entry carries it; the landing refuses it on any other\n * instance.\n */\n neededFamilies: z.array(z.enum(ApplicationSpecificationFamily)).min(1).optional(),\n /**\n * The families a REFINEMENT line re-derives (#1608): what the creator asked to refine, e.g. the requirements\n * or the experience plan. Required on a refinement line and refused on any other instance. Each is a family\n * the application already holds and a producer of it re-derives from its own prior output, so the line\n * refines what exists instead of re-authoring it. Sorted and unique.\n *\n * The creator's decision, like `neededFamilies`: the assistant may propose it from what the person asked,\n * and the approval card names it, so what is recorded is what the person approved.\n */\n refinedFamilies: z.array(z.enum(ApplicationSpecificationFamily)).min(1).optional(),\n});\nexport type ApplicationPlaybookActivation = z.infer<typeof ApplicationPlaybookActivationSchema>;\n\nexport const ApplicationCreatorInputsSchema = z.strictObject({\n schemaVersion: z.literal(1),\n answers: z.array(ApplicationCreatorInputAnswerSchema),\n /**\n * The playbook instances the creator opened, keyed by instance id (`<ref>@<key>`), in SORTED key order\n * (#1609). Absent until the first one: a fresh application records no activation, and a run that lands\n * never writes here.\n *\n * A keyed object rather than a list, one entry per block, kept sorted by {@link withPlaybookActivation}:\n * two branches that each open an instance then touch different lines, so they merge without a textual\n * conflict unless the two keys are adjacent in sort order, in which case the conflict is a one-line\n * choice. A list appended at the tail would conflict on every concurrent addition.\n */\n activations: z.record(z.string(), ApplicationPlaybookActivationSchema).optional(),\n /**\n * How deep this application's interviews go (#2129). Absent until the creator chooses: a surface that\n * starts an interview asks first, and records the answer with {@link withInterviewDepth}.\n */\n interviewDepth: z.enum(ApplicationInterviewDepth).optional(),\n});\nexport type ApplicationCreatorInputs = z.infer<typeof ApplicationCreatorInputsSchema>;\n\n/** The answer's standing — DECIDED when it declares none. The ONE place absence is interpreted. */\nexport function creatorInputAnswerStanding(answer: ApplicationCreatorInputAnswer): ApplicationCreatorInputAnswerStanding {\n return answer.standing ?? ApplicationCreatorInputAnswerStanding.DECIDED;\n}\n\n/** The dossier with its interview depth recorded or changed. Answers and activations are untouched. */\nexport function withInterviewDepth(inputs: ApplicationCreatorInputs | undefined, interviewDepth: ApplicationInterviewDepth): ApplicationCreatorInputs {\n return { ...(inputs ?? { answers: [] }), schemaVersion: 1, interviewDepth };\n}\n\n/**\n * The one key an answer is addressed by. `playbookRef` and `questionRef` are refs, never free text, so `#`\n * cannot occur in either. The default instance keeps the key it always had (`<ref>#<question>`); an\n * instance's answer is `<ref>@<key>#<question>` (#1609).\n */\nexport function creatorInputAnswerKey(playbookRef: string, questionRef: string, instanceKey?: string): string {\n return `${playbookInstanceId(playbookRef, instanceKey)}#${questionRef}`;\n}\n\n/** The dossier with one more activation, or one reworded, keyed by instance id and kept in sorted order. */\nexport function withPlaybookActivation(\n inputs: ApplicationCreatorInputs | undefined,\n activation: ApplicationPlaybookActivation,\n): ApplicationCreatorInputs {\n const merged = { ...(inputs?.activations ?? {}), [playbookInstanceId(activation.playbookRef, activation.instanceKey)]: activation };\n return {\n // Every other dossier field (the interview depth) is carried as it was: an activation changes only activations.\n ...(inputs ?? {}),\n schemaVersion: 1,\n answers: inputs?.answers ?? [],\n activations: Object.fromEntries(Object.entries(merged).sort(([left], [right]) => left.localeCompare(right))),\n };\n}\n\n/** Whether this activation is still open: opened and not closed. */\nexport function isPlaybookInstanceOpen(activation: ApplicationPlaybookActivation | undefined): boolean {\n return activation !== undefined && activation.closure === undefined;\n}\n\n/**\n * The dossier with one instance closed (#1608). Refused for an instance nobody opened, and for one already\n * closed: closing is a decision taken once, and a second closure would overwrite the first one's reason.\n */\nexport function withPlaybookInstanceClosure(\n inputs: ApplicationCreatorInputs | undefined,\n instanceId: string,\n closure: ApplicationPlaybookInstanceClosure,\n): ApplicationCreatorInputs {\n const activation = inputs?.activations?.[instanceId];\n if (activation === undefined) throw new Error(`\"${instanceId}\" was never opened, so it cannot be closed.`);\n if (activation.closure !== undefined) throw new Error(`\"${instanceId}\" is already ${activation.closure.kind}.`);\n return withPlaybookActivation(inputs, { ...activation, closure });\n}\n\n/**\n * The family validator — FINDINGS, each an error: a dossier holding two answers to one question\n * cannot be read, because a run would have to pick one and nothing says which.\n *\n * Whether an answer names a question its playbook actually asks is NOT checked here: the family\n * schema does not know the catalog, and an answer to a question a later catalog renamed is a\n * stale answer to report, never a corrupt file. The dossier projection reports those as orphaned.\n */\nexport function validateApplicationCreatorInputs(inputs: ApplicationCreatorInputs): readonly string[] {\n const findings: string[] = [];\n const seen = new Set<string>();\n for (const answer of inputs.answers) {\n const key = creatorInputAnswerKey(answer.playbookRef, answer.questionRef, answer.instanceKey);\n if (seen.has(key)) findings.push(`question \"${answer.questionRef}\" of \"${playbookInstanceId(answer.playbookRef, answer.instanceKey)}\" is answered more than once`);\n seen.add(key);\n }\n // A rationale explains an assumption; on a decided answer it would read as the creator's reasoning, which nobody gave.\n // And an assumption without one cannot be reviewed: nothing says what it rests on.\n for (const answer of inputs.answers) {\n const assumed = creatorInputAnswerStanding(answer) === ApplicationCreatorInputAnswerStanding.ASSUMED;\n if (answer.assumptionRationale !== undefined && !assumed) {\n findings.push(`question \"${answer.questionRef}\" of \"${playbookInstanceId(answer.playbookRef, answer.instanceKey)}\" carries an assumption rationale but is not assumed`);\n }\n if (assumed && answer.assumptionRationale === undefined) {\n findings.push(`question \"${answer.questionRef}\" of \"${playbookInstanceId(answer.playbookRef, answer.instanceKey)}\" is assumed with no rationale`);\n }\n }\n // An activation is addressed by its own identity; a key that says another would be read as the wrong instance.\n for (const [key, activation] of Object.entries(inputs.activations ?? {})) {\n const expected = playbookInstanceId(activation.playbookRef, activation.instanceKey);\n if (key !== expected) findings.push(`activation \"${key}\" records the instance \"${expected}\"`);\n }\n // An answer to an instance nobody opened would be read by no run; keeping it unreported would hide a typo.\n for (const answer of inputs.answers) {\n if (answer.instanceKey === undefined) continue;\n const id = playbookInstanceId(answer.playbookRef, answer.instanceKey);\n if (!inputs.activations || !(id in inputs.activations)) findings.push(`question \"${answer.questionRef}\" is answered for \"${id}\", an instance that was never opened`);\n }\n return findings;\n}\n\n/**\n * The answers one playbook's interview reads, in the `{ questionRef, answer }` shape the run route\n * already accepts. A dossier with nothing for this playbook yields `[]`, which the run treats as\n * \"not interviewed yet\", never as a refusal.\n *\n * For an INSTANCE (#1609), its own answer wins per question and the default instance's fills the rest:\n * what the company answered once is shared, and the instance answers only what differs for it.\n */\nexport function readCreatorInputAnswersForPlaybook(\n inputs: ApplicationCreatorInputs | undefined,\n playbookRef: string,\n instanceKey?: string,\n): readonly CreatorInputAnswerForPlaybook[] {\n const byQuestion = new Map<string, ApplicationCreatorInputAnswer>();\n for (const answer of inputs?.answers ?? []) {\n if (answer.playbookRef === playbookRef && answer.instanceKey === undefined) byQuestion.set(answer.questionRef, answer);\n }\n if (instanceKey !== undefined) {\n for (const answer of inputs?.answers ?? []) {\n if (answer.playbookRef === playbookRef && answer.instanceKey === instanceKey) byQuestion.set(answer.questionRef, answer);\n }\n }\n return [...byQuestion].map(([questionRef, answer]) => ({\n questionRef,\n answer: answer.value,\n /* Only an assumption is marked: a decided answer reads exactly as every answer did before #2129. */\n ...(creatorInputAnswerStanding(answer) === ApplicationCreatorInputAnswerStanding.ASSUMED\n ? { standing: ApplicationCreatorInputAnswerStanding.ASSUMED, ...(answer.assumptionRationale !== undefined ? { assumptionRationale: answer.assumptionRationale } : {}) }\n : {}),\n }));\n}\n\n/**\n * One answer as a playbook READS it: the value, and — for an ASSUMED one only (#2129) — its standing and the\n * proposer's reason, so a run can tell the creator's statement from a hypothesis. No `standing` means DECIDED.\n */\nexport interface CreatorInputAnswerForPlaybook {\n readonly questionRef: string;\n readonly answer: string;\n readonly standing?: ApplicationCreatorInputAnswerStanding;\n readonly assumptionRationale?: string;\n}\n\n/**\n * The dossier after one more answer, or after one answer changed — REPLACE by key, keep the rest,\n * keep the file's order for the entries that were already there so a diff shows only the change.\n */\nexport function withCreatorInputAnswer(\n inputs: ApplicationCreatorInputs | undefined,\n answer: ApplicationCreatorInputAnswer,\n): ApplicationCreatorInputs {\n const key = creatorInputAnswerKey(answer.playbookRef, answer.questionRef, answer.instanceKey);\n const existing = inputs?.answers ?? [];\n const keyOf = (candidate: ApplicationCreatorInputAnswer) => creatorInputAnswerKey(candidate.playbookRef, candidate.questionRef, candidate.instanceKey);\n const replaced = existing.some((candidate) => keyOf(candidate) === key);\n return {\n // The activations and the interview depth are separate records: an answer never adds, drops or changes them.\n ...(inputs ?? {}),\n schemaVersion: 1,\n answers: replaced ? existing.map((candidate) => (keyOf(candidate) === key ? answer : candidate)) : [...existing, answer],\n };\n}\n"]}
|
package/dist/esm/application-creation/application-line.application-creation.schemas.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-line.application-creation.schemas.d.ts","sourceRoot":"","sources":["../../../../src/application-creation/application-line.application-creation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAyF,KAAK,wBAAwB,EAAE,MAAM,2DAA2D,CAAC;AAGjM;;;;;;;;;;;;;;;;;;GAkBG;AACH,oBAAY,eAAe;IACzB;;;;OAIG;IACH,QAAQ,aAAa;IACrB;;;;;OAKG;IACH,aAAa,kBAAkB;CAChC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,6FAA6F;IAC7F,QAAQ,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,EAAE,SAAS,8BAA8B,EAAE,CAAC;IAC1E;;;;OAIG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,yBAAyB,CAAC,
|
|
1
|
+
{"version":3,"file":"application-line.application-creation.schemas.d.ts","sourceRoot":"","sources":["../../../../src/application-creation/application-line.application-creation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAyF,KAAK,wBAAwB,EAAE,MAAM,2DAA2D,CAAC;AAGjM;;;;;;;;;;;;;;;;;;GAkBG;AACH,oBAAY,eAAe;IACzB;;;;OAIG;IACH,QAAQ,aAAa;IACrB;;;;;OAKG;IACH,aAAa,kBAAkB;CAChC;AAED;;;;;;;;;GASG;AACH,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,+CAA+C;IAC/C,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;IACjC,6FAA6F;IAC7F,QAAQ,CAAC,oBAAoB,EAAE,SAAS,MAAM,EAAE,CAAC;IACjD;;;;OAIG;IACH,QAAQ,CAAC,qBAAqB,EAAE,SAAS,8BAA8B,EAAE,CAAC;IAC1E;;;;OAIG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,CAAC;CAC1C;AAED;;;;;;;;;GASG;AACH,eAAO,MAAM,4BAA4B,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,yBAAyB,CAAC,CAmCrG,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,yBAAyB,EAAE;IAAE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAGnG,CAAC;AAEF,gHAAgH;AAChH,oBAAY,+BAA+B;IACzC,mFAAmF;IACnF,QAAQ,a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;IAC1E;;;OAGG;IACH,QAAQ,CAAC,oBAAoB,EAAE,OAAO,CAAC;CACxC;AAED,gHAAgH;AAChH,eAAO,MAAM,sCAAsC,EAAE,QAAQ,CAAC,MAAM,CAAC,wBAAwB,EAAE,kCAAkC,CAAC,CAcjI,CAAC;AAEF,4EAA4E;AAC5E,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,IAAI,EAAE,wBAAwB,CAAC;IACxC,gEAAgE;IAChE,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,yEAAyE;IACzE,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,oGAAoG;IACpG,QAAQ,CAAC,cAAc,EAAE,SAAS,8BAA8B,EAAE,CAAC;IACnE,mFAAmF;IACnF,QAAQ,CAAC,eAAe,EAAE,SAAS,8BAA8B,EAAE,CAAC;CACrE;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,wBAAwB,GAAG,SAAS,GAAG,SAAS,4BAA4B,EAAE,CAiB/H;AAED,qGAAqG;AACrG,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAEzE;AAED,4FAA4F;AAC5F,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,MAAM,GAAG,kCAAkC,GAAG,SAAS,CAElH;AAED;;;;;;;GAOG;AACH,wBAAgB,kCAAkC,CAAC,MAAM,EAAE,wBAAwB,GAAG,SAAS,GAAG,WAAW,CAAC,8BAA8B,CAAC,CAQ5I"}
|
|
@@ -75,6 +75,8 @@ export const APPLICATION_LINE_DEFINITIONS = {
|
|
|
75
75
|
ApplicationSpecificationFamily.MARKET_SNAPSHOT,
|
|
76
76
|
ApplicationSpecificationFamily.BUSINESS_MODEL,
|
|
77
77
|
ApplicationSpecificationFamily.BRAND_BRIEF,
|
|
78
|
+
// No brand, so no name to screen: the naming lane leaves the line with the brand it names.
|
|
79
|
+
ApplicationSpecificationFamily.BRAND_NAME_SCREENING,
|
|
78
80
|
ApplicationSpecificationFamily.WEBSITE_PLAN,
|
|
79
81
|
],
|
|
80
82
|
ownedByOneOrganization: true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"application-line.application-creation.schemas.js","sourceRoot":"","sources":["../../../../src/application-creation/application-line.application-creation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,sCAAsC,EAAE,qBAAqB,EAAE,sBAAsB,EAAiC,MAAM,2DAA2D,CAAC;AACjM,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAEtF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,eAcX;AAdD,WAAY,eAAe;IACzB;;;;OAIG;IACH,wCAAqB,CAAA;IACrB;;;;;OAKG;IACH,kDAA+B,CAAA;AACjC,CAAC,EAdW,eAAe,KAAf,eAAe,QAc1B;AAgCD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAiE;IACxG,CAAC,eAAe,CAAC,QAAQ,CAAC,EAAE;QAC1B,IAAI,EAAE,eAAe,CAAC,QAAQ;QAC9B,eAAe,EAAE,oCAAoC;QACrD;;;WAGG;QACH,oBAAoB,EAAE,CAAC,yBAAyB,CAAC;QACjD,qBAAqB,EAAE,EAAE;QACzB,0GAA0G;QAC1G,sBAAsB,EAAE,KAAK;KAC9B;IACD,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE;QAC/B,IAAI,EAAE,eAAe,CAAC,aAAa;QACnC,eAAe,EAAE,oCAAoC;QACrD;;;;;;;WAOG;QACH,oBAAoB,EAAE,CAAC,yBAAyB,CAAC;QACjD,qBAAqB,EAAE;YACrB,8BAA8B,CAAC,eAAe;YAC9C,8BAA8B,CAAC,cAAc;YAC7C,8BAA8B,CAAC,WAAW;YAC1C,8BAA8B,CAAC,YAAY;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U,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC;AACrF,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,4BAA4B,CAAC,WAAmB;IAC9D,OAAO,8BAA8B,CAAC,WAAW,CAAC,KAAK,SAAS,CAAC;AACnE,CAAC;AAED,4FAA4F;AAC5F,MAAM,UAAU,8BAA8B,CAAC,WAAmB;IAChE,OAAO,MAAM,CAAC,MAAM,CAAC,sCAAsC,CAAC,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,gBAAgB,KAAK,WAAW,CAAC,CAAC;AACjI,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,kCAAkC,CAAC,MAA4C;IAC7F,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkC,CAAC;IACzD,KAAK,MAAM,UAAU,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,IAAI,EAAE,CAAC,EAAE,CAAC;QAClE,IAAI,CAAC,4BAA4B,CAAC,UAAU,CAAC,WAAW,CAAC;YAAE,SAAS;QACpE,IAAI,UAAU,CAAC,OAAO,EAAE,IAAI,KAAK,sCAAsC,CAAC,SAAS;YAAE,SAAS;QAC5F,KAAK,MAAM,MAAM,IAAI,UAAU,CAAC,cAAc,IAAI,EAAE;YAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { ApplicationSpecificationFamily } from \"../_core/application-specification-family-identity.schemas\";\nimport { ApplicationPlaybookInstanceClosureKind, creatorInputAnswerKey, isPlaybookInstanceOpen, type ApplicationCreatorInputs } from \"./application-creator-inputs.application-creation.schemas\";\nimport { playbookInstanceId } from \"./playbook-instance.application-creation.schemas\";\n\n/**\n * The kind of application being created: its MAIN LINE (epic #1602, #1603).\n *\n * App creation is not a B2B SaaS pipeline. It serves several lines of application, and not every\n * playbook applies to every line: an internal tool has no marketing website and needs no market\n * analysis. The line an application is created on decides which playbooks it may run, and which\n * specification families do not apply to it at all.\n *\n * An application has exactly ONE main line at a time (Paul, 2026-09-25). The CREATOR chooses it,\n * as a typed answer in the first playbook's interview ({@link APPLICATION_LINE_QUESTION}), and it is\n * changeable deliberately by answering again. The model never proposes it: a line inferred from a\n * vision would be a guess recorded as a decision.\n *\n * Secondary lines, opened in the middle of an application's life for a feature or a refinement,\n * are a different concept with their own record (#1608); they never change this value.\n *\n * Members are added with the line they name, and only then. AI-native service companies come later\n * (#1593), with the families and playbooks that line adds.\n */\nexport enum ApplicationLine {\n /**\n * A commercial software product sold to other businesses: a market it competes in, a business model,\n * a brand, usually a public website and documentation. The line every application was created on\n * before lines existed, and its definition reproduces that catalog exactly.\n */\n B2B_SAAS = \"b2b_saas\",\n /**\n * Software a company builds for its own people (#1605): an operating team, not a market. No market\n * analysis, business model, brand or public website applies; its users belong to the company that\n * owns the application, which is typically signed in through its own identity provider and often\n * reads its data from systems of record the company already runs.\n */\n INTERNAL_TOOL = \"internal_tool\",\n}\n\n/**\n * What one line admits, declared rather than listed.\n *\n * A line is the tree under its ROOT composite (every playbook its `method.choreography.admits` reach,\n * transitively), minus what it EXCLUDES. Declaring a root instead of enumerating playbooks is what keeps\n * a line correct when the catalog grows: a playbook added to a lane joins every line that admits the\n * lane, rather than joining none until someone remembers each line's list.\n *\n * Excluding a composite excludes the part of the tree reached only through it.\n */\nexport interface ApplicationLineDefinition {\n readonly line: ApplicationLine;\n /** The composite whose tree this line runs. */\n readonly rootPlaybookRef: string;\n /** Playbooks (leaf or composite) this line never runs, even though its root reaches them. */\n readonly excludedPlaybookRefs: readonly string[];\n /**\n * Specification families that do not apply to an application on this line, e.g. the market snapshot\n * of an internal tool. Declared here because it is a fact about the line; read by eligibility once a\n * family can be not applicable (#1604).\n */\n readonly notApplicableFamilies: readonly ApplicationSpecificationFamily[];\n /**\n * Whether an application on this line is OWNED by one organization, whose members are its users\n * (#1605): an internal tool belongs to the company that built it. The foundation declares the\n * application's organization type `ownsApplication` before its first initialization when true.\n */\n readonly ownedByOneOrganization: boolean;\n}\n\n/**\n * Every line's definition, keyed by the vocabulary, so a member added to {@link ApplicationLine}\n * without a definition does not compile.\n *\n * Kept here, beside the vocabulary, rather than as a compiled framework-knowledge artifact kind:\n * a definition is a few declarations that reference playbook refs, the `Record` gives totality for\n * free, and a new artifact kind would need its own generator, loader, allow-list entry and audit\n * rules for data no application ever ships. The catalog references are checked by the runtime's\n * line-scope tests against the real catalog.\n */\nexport const APPLICATION_LINE_DEFINITIONS: Readonly<Record<ApplicationLine, ApplicationLineDefinition>> = {\n [ApplicationLine.B2B_SAAS]: {\n line: ApplicationLine.B2B_SAAS,\n rootPlaybookRef: \"cross_cutting.application-creation\",\n /*\n * The drafts-only variant of capability-map exists for lines with no market (#1604). This line has a\n * market, so it runs capability-map, which drafts the features AND wires each benefit to them.\n */\n excludedPlaybookRefs: [\"top_down.feature-drafts\"],\n notApplicableFamilies: [],\n // Sold to other businesses: each customer is its own tenant, and no single organization owns the product.\n ownedByOneOrganization: false,\n },\n [ApplicationLine.INTERNAL_TOOL]: {\n line: ApplicationLine.INTERNAL_TOOL,\n rootPlaybookRef: \"cross_cutting.application-creation\",\n /*\n * Only what the not-applicable families cannot decide. Capability-map produces the market AND the feature\n * drafts, so it is named; this line drafts its features with top_down.feature-drafts instead. The market\n * lane, the business model, the brand, the value proposition and the website plan leave the line by\n * themselves: everything their trees produce is declared not applicable below. (The market lane was named\n * here until #1608, when the walk learned to read a composite's whole tree; derived, it comes back when a\n * secondary line needs the market snapshot, and a name would have kept it out.)\n */\n excludedPlaybookRefs: [\"top_down.capability-map\"],\n notApplicableFamilies: [\n ApplicationSpecificationFamily.MARKET_SNAPSHOT,\n ApplicationSpecificationFamily.BUSINESS_MODEL,\n ApplicationSpecificationFamily.BRAND_BRIEF,\n ApplicationSpecificationFamily.WEBSITE_PLAN,\n ],\n ownedByOneOrganization: true,\n },\n};\n\n/**\n * Where the creator's choice of line is asked and recorded: one CHOICE question of the ENTRY\n * playbook, whose options are the {@link ApplicationLine} values.\n *\n * The entry playbook belongs to no line, so an application with no line yet can still run it; it is\n * the playbook in which the line gets declared.\n */\nexport const APPLICATION_LINE_QUESTION: { readonly playbookRef: string; readonly questionRef: string } = {\n playbookRef: \"top_down.vision-elicitation\",\n questionRef: \"application-line\",\n};\n\n/** Whether an application has declared its main line, and what the dossier says if it cannot be read as one. */\nexport enum ApplicationLineDeclarationState {\n /** The dossier answers the line question with an {@link ApplicationLine} value. */\n DECLARED = \"declared\",\n /** The line question has no answer yet: the application has not been told what it is. */\n UNDECLARED = \"undeclared\",\n /**\n * The dossier answers the line question with a value that is not a line, e.g. one a later release\n * removed. Kept apart from UNDECLARED because the remedy differs: the creator answered, and the answer\n * no longer means anything.\n */\n UNRECOGNIZED = \"unrecognized\",\n}\n\n/**\n * Why a playbook is, or is not, in the application's ACTIVE SET (#1607): the playbooks its line lets it run.\n *\n * DERIVED on every read from the line and the catalog, never stored: growth inside a line is eligibility\n * over the line's tree, and a record of it would be bookkeeping (`one-source-of-truth.md`). Whether an\n * active playbook may run RIGHT NOW is a separate answer, the eligibility board's; this one says whether\n * the application runs it at all, and why not.\n */\nexport enum PlaybookActivationStatus {\n /** In the tree of the application's line: it runs whenever its preconditions hold. */\n ACTIVE = \"active\",\n /** The line does not run it: excluded by name, or not reached from the line's root. */\n OUTSIDE_LINE = \"outside_line\",\n /** Everything it produces is a family the line declares not applicable, so there is nothing for it to do. */\n NOT_APPLICABLE = \"not_applicable\",\n /** No line is declared yet: only the entry playbook, and the composites that reach it, run until then. */\n AWAITING_LINE = \"awaiting_line\",\n}\n\nexport type ApplicationLineDeclaration =\n | { readonly state: ApplicationLineDeclarationState.DECLARED; readonly line: ApplicationLine }\n | { readonly state: ApplicationLineDeclarationState.UNDECLARED }\n | { readonly state: ApplicationLineDeclarationState.UNRECOGNIZED; readonly value: string };\n\nconst APPLICATION_LINE_VALUES: ReadonlySet<string> = new Set(Object.values(ApplicationLine));\n\n/** Read the application's main line from its dossier. Pure; the dossier is the only place the line lives. */\nexport function resolveApplicationLineDeclaration(inputs: ApplicationCreatorInputs | undefined): ApplicationLineDeclaration {\n const key = creatorInputAnswerKey(APPLICATION_LINE_QUESTION.playbookRef, APPLICATION_LINE_QUESTION.questionRef);\n // The line is the DEFAULT instance's answer (#1609): an instance of the entry playbook never re-declares it.\n const answer = (inputs?.answers ?? []).find((candidate) => creatorInputAnswerKey(candidate.playbookRef, candidate.questionRef, candidate.instanceKey) === key);\n if (answer === undefined) return { state: ApplicationLineDeclarationState.UNDECLARED };\n return APPLICATION_LINE_VALUES.has(answer.value)\n ? { state: ApplicationLineDeclarationState.DECLARED, line: answer.value as ApplicationLine }\n : { state: ApplicationLineDeclarationState.UNRECOGNIZED, value: answer.value };\n}\n\n/**\n * The specification families that do not apply to this application, read from its dossier (#1604).\n * Empty while no line is declared: nothing can be said not to apply before the kind of application is\n * known. One resolution for every reader that sees only the application's exports, such as the expert\n * charter derivation, so none of them re-derives the line.\n */\nexport function resolveNotApplicableFamilies(\n inputs: ApplicationCreatorInputs | undefined,\n definitions: Readonly<Record<string, ApplicationLineDefinition>> = APPLICATION_LINE_DEFINITIONS,\n): ReadonlySet<string> {\n const declaration = resolveApplicationLineDeclaration(inputs);\n if (declaration.state !== ApplicationLineDeclarationState.DECLARED) return new Set<string>();\n /*\n * Over the UNION of the lines (#1608): a family the main line declares not applicable applies again while\n * a secondary line needs it. The one computation of applicability: the run scope reads this function too.\n */\n const needed = resolveSecondaryLineNeededFamilies(inputs);\n return new Set<string>(definitions[declaration.line]!.notApplicableFamilies.filter((family) => !needed.has(family)));\n}\n\n/**\n * A SECONDARY LINE: work opened beside the main line in the middle of an application's life (#1608), such as\n * developing one feature or refining what exists. The main line decides what KIND of application it is; a\n * secondary line never changes that. It changes the application's content: a feature line adds elements of\n * its own, and a refinement line re-derives families the application already holds.\n *\n * A secondary line is an opened INSTANCE of its kind's entry composite (#1609): its instance key names the\n * line, and the activation's purpose says what it is for. Its kind is derived from the entry playbook, so it\n * has no record of its own beside the activation, which is committed the moment it is opened.\n *\n * Members are added with the line they name, and only then (the same rule as {@link ApplicationLine}).\n */\nexport enum ApplicationSecondaryLine {\n /**\n * Develop one feature through the product model: the feature lands as elements of the requirements and\n * the feature drafts, contributed by this line, and the domain plan and build decomposition re-derive\n * from them before the feature is built. The alternative, appending a build task, stays the shortcut for\n * a small code change.\n */\n FEATURE_DEVELOPMENT = \"feature_development\",\n /**\n * Refine one or more families the application already holds, in place (#1608): the requirements, the\n * experience plan, the value proposition. The main line re-derives a family only when it is missing or\n * stale, so without this line nothing re-derives a landed family on purpose. The line re-runs each named\n * family's producer on its own prior output, guided by the line's purpose, then refreshes what that made\n * stale and builds it. It adds no elements of its own: every child runs as the application.\n */\n REFINEMENT = \"refinement\",\n}\n\n/** What one kind of secondary line runs, and what it may add to. */\nexport interface ApplicationSecondaryLineDefinition {\n readonly line: ApplicationSecondaryLine;\n /** The composite an instance of which IS a line of this kind. It belongs to no main line's tree. */\n readonly entryPlaybookRef: string;\n /**\n * The families this line adds ELEMENTS to, each element stamped with the line. It never replaces a family\n * the main line holds: a whole-file landing from a line would overwrite the main line's content.\n */\n readonly contributesToFamilies: readonly ApplicationSpecificationFamily[];\n /**\n * Whether an instance of this line NAMES the families it re-derives (`refinedFamilies` on its activation):\n * required when true, refused when false. What the line is FOR is then a typed fact, not only a sentence.\n */\n readonly namesRefinedFamilies: boolean;\n}\n\n/** Every kind's definition; a member added to {@link ApplicationSecondaryLine} without one does not compile. */\nexport const APPLICATION_SECONDARY_LINE_DEFINITIONS: Readonly<Record<ApplicationSecondaryLine, ApplicationSecondaryLineDefinition>> = {\n [ApplicationSecondaryLine.FEATURE_DEVELOPMENT]: {\n line: ApplicationSecondaryLine.FEATURE_DEVELOPMENT,\n entryPlaybookRef: \"cross_cutting.feature-development\",\n contributesToFamilies: [ApplicationSpecificationFamily.REQUIREMENTS, ApplicationSpecificationFamily.FEATURE_DRAFTS],\n namesRefinedFamilies: false,\n },\n [ApplicationSecondaryLine.REFINEMENT]: {\n line: ApplicationSecondaryLine.REFINEMENT,\n entryPlaybookRef: \"cross_cutting.refinement\",\n // It adds no elements: each family it touches is re-derived whole, as the application.\n contributesToFamilies: [],\n namesRefinedFamilies: true,\n },\n};\n\n/** One secondary line the application has opened, read from its dossier. */\nexport interface OpenApplicationSecondaryLine {\n readonly line: ApplicationSecondaryLine;\n /** The line's name: the instance key of its entry composite. */\n readonly instanceKey: string;\n /** `<entry ref>@<key>`: how runs, rows and answers address this line. */\n readonly instanceId: string;\n readonly purpose: string;\n /** Families the line needs although the main line declares them not applicable; empty when none. */\n readonly neededFamilies: readonly ApplicationSpecificationFamily[];\n /** The families a refinement line re-derives; empty for a line that names none. */\n readonly refinedFamilies: readonly ApplicationSpecificationFamily[];\n}\n\n/**\n * The secondary lines the application has opened (#1608), derived from the dossier's activations: every\n * opened instance of a secondary-line entry composite. Sorted by instance id, like the activations.\n */\nexport function resolveOpenSecondaryLines(inputs: ApplicationCreatorInputs | undefined): readonly OpenApplicationSecondaryLine[] {\n const lineByEntry = new Map(Object.values(APPLICATION_SECONDARY_LINE_DEFINITIONS).map((definition) => [definition.entryPlaybookRef, definition.line]));\n const open: OpenApplicationSecondaryLine[] = [];\n for (const activation of Object.values(inputs?.activations ?? {})) {\n const line = lineByEntry.get(activation.playbookRef);\n // A closed line is no longer open; what it contributed stays, marked with it.\n if (line === undefined || !isPlaybookInstanceOpen(activation)) continue;\n open.push({\n line,\n instanceKey: activation.instanceKey,\n instanceId: playbookInstanceId(activation.playbookRef, activation.instanceKey),\n purpose: activation.purpose,\n neededFamilies: activation.neededFamilies ?? [],\n refinedFamilies: activation.refinedFamilies ?? [],\n });\n }\n return open.sort((left, right) => left.instanceId.localeCompare(right.instanceId));\n}\n\n/** Whether a playbook is the entry of a secondary line, i.e. whether an instance of it IS a line. */\nexport function isSecondaryLineEntryPlaybook(playbookRef: string): boolean {\n return secondaryLineDefinitionOfEntry(playbookRef) !== undefined;\n}\n\n/** The secondary-line definition whose entry composite this playbook is, or `undefined`. */\nexport function secondaryLineDefinitionOfEntry(playbookRef: string): ApplicationSecondaryLineDefinition | undefined {\n return Object.values(APPLICATION_SECONDARY_LINE_DEFINITIONS).find((definition) => definition.entryPlaybookRef === playbookRef);\n}\n\n/**\n * The families the application's secondary lines need although its main line declares them not applicable\n * (#1608): the union over every line that is not ABANDONED.\n *\n * A COMPLETED line still counts: what it built is part of the product now, and a public website a finished\n * feature added still needs its plan. An ABANDONED line's need lapses with it, and a file it landed is then\n * reported as ignored, never deleted (#1604). An open line counts, of course.\n */\nexport function resolveSecondaryLineNeededFamilies(inputs: ApplicationCreatorInputs | undefined): ReadonlySet<ApplicationSpecificationFamily> {\n const needed = new Set<ApplicationSpecificationFamily>();\n for (const activation of Object.values(inputs?.activations ?? {})) {\n if (!isSecondaryLineEntryPlaybook(activation.playbookRef)) continue;\n if (activation.closure?.kind === ApplicationPlaybookInstanceClosureKind.ABANDONED) continue;\n for (const family of activation.neededFamilies ?? []) needed.add(family);\n }\n return needed;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"application-line.application-creation.schemas.js","sourceRoot":"","sources":["../../../../src/application-creation/application-line.application-creation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,8BAA8B,EAAE,MAAM,4DAA4D,CAAC;AAC5G,OAAO,EAAE,sCAAsC,EAAE,qBAAqB,EAAE,sBAAsB,EAAiC,MAAM,2DAA2D,CAAC;AACjM,OAAO,EAAE,kBAAkB,EAAE,MAAM,kDAAkD,CAAC;AAEtF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,CAAN,IAAY,eAcX;AAdD,WAAY,eAAe;IACzB;;;;OAIG;IACH,wCAAqB,CAAA;IACrB;;;;;OAKG;IACH,kDAA+B,CAAA;AACjC,CAAC,EAdW,eAAe,KAAf,eAAe,QAc1B;AAgCD;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,4BAA4B,GAAiE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,WAAW,CAAC;YAAE,SAAS;QACpE,IAAI,UAAU,CAAC,OAAO,EAAE,IAAI,KAAK,sCAAsC,CAAC,SAAS;YAAE,SAAS;QAC5F,KAAK,MAAM,MAAM,IAAI,UAAU,CAAC,cAAc,IAAI,EAAE;YAAE,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3E,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import { ApplicationSpecificationFamily } from \"../_core/application-specification-family-identity.schemas\";\nimport { ApplicationPlaybookInstanceClosureKind, creatorInputAnswerKey, isPlaybookInstanceOpen, type ApplicationCreatorInputs } from \"./application-creator-inputs.application-creation.schemas\";\nimport { playbookInstanceId } from \"./playbook-instance.application-creation.schemas\";\n\n/**\n * The kind of application being created: its MAIN LINE (epic #1602, #1603).\n *\n * App creation is not a B2B SaaS pipeline. It serves several lines of application, and not every\n * playbook applies to every line: an internal tool has no marketing website and needs no market\n * analysis. The line an application is created on decides which playbooks it may run, and which\n * specification families do not apply to it at all.\n *\n * An application has exactly ONE main line at a time (Paul, 2026-09-25). The CREATOR chooses it,\n * as a typed answer in the first playbook's interview ({@link APPLICATION_LINE_QUESTION}), and it is\n * changeable deliberately by answering again. The model never proposes it: a line inferred from a\n * vision would be a guess recorded as a decision.\n *\n * Secondary lines, opened in the middle of an application's life for a feature or a refinement,\n * are a different concept with their own record (#1608); they never change this value.\n *\n * Members are added with the line they name, and only then. AI-native service companies come later\n * (#1593), with the families and playbooks that line adds.\n */\nexport enum ApplicationLine {\n /**\n * A commercial software product sold to other businesses: a market it competes in, a business model,\n * a brand, usually a public website and documentation. The line every application was created on\n * before lines existed, and its definition reproduces that catalog exactly.\n */\n B2B_SAAS = \"b2b_saas\",\n /**\n * Software a company builds for its own people (#1605): an operating team, not a market. No market\n * analysis, business model, brand or public website applies; its users belong to the company that\n * owns the application, which is typically signed in through its own identity provider and often\n * reads its data from systems of record the company already runs.\n */\n INTERNAL_TOOL = \"internal_tool\",\n}\n\n/**\n * What one line admits, declared rather than listed.\n *\n * A line is the tree under its ROOT composite (every playbook its `method.choreography.admits` reach,\n * transitively), minus what it EXCLUDES. Declaring a root instead of enumerating playbooks is what keeps\n * a line correct when the catalog grows: a playbook added to a lane joins every line that admits the\n * lane, rather than joining none until someone remembers each line's list.\n *\n * Excluding a composite excludes the part of the tree reached only through it.\n */\nexport interface ApplicationLineDefinition {\n readonly line: ApplicationLine;\n /** The composite whose tree this line runs. */\n readonly rootPlaybookRef: string;\n /** Playbooks (leaf or composite) this line never runs, even though its root reaches them. */\n readonly excludedPlaybookRefs: readonly string[];\n /**\n * Specification families that do not apply to an application on this line, e.g. the market snapshot\n * of an internal tool. Declared here because it is a fact about the line; read by eligibility once a\n * family can be not applicable (#1604).\n */\n readonly notApplicableFamilies: readonly ApplicationSpecificationFamily[];\n /**\n * Whether an application on this line is OWNED by one organization, whose members are its users\n * (#1605): an internal tool belongs to the company that built it. The foundation declares the\n * application's organization type `ownsApplication` before its first initialization when true.\n */\n readonly ownedByOneOrganization: boolean;\n}\n\n/**\n * Every line's definition, keyed by the vocabulary, so a member added to {@link ApplicationLine}\n * without a definition does not compile.\n *\n * Kept here, beside the vocabulary, rather than as a compiled framework-knowledge artifact kind:\n * a definition is a few declarations that reference playbook refs, the `Record` gives totality for\n * free, and a new artifact kind would need its own generator, loader, allow-list entry and audit\n * rules for data no application ever ships. The catalog references are checked by the runtime's\n * line-scope tests against the real catalog.\n */\nexport const APPLICATION_LINE_DEFINITIONS: Readonly<Record<ApplicationLine, ApplicationLineDefinition>> = {\n [ApplicationLine.B2B_SAAS]: {\n line: ApplicationLine.B2B_SAAS,\n rootPlaybookRef: \"cross_cutting.application-creation\",\n /*\n * The drafts-only variant of capability-map exists for lines with no market (#1604). This line has a\n * market, so it runs capability-map, which drafts the features AND wires each benefit to them.\n */\n excludedPlaybookRefs: [\"top_down.feature-drafts\"],\n notApplicableFamilies: [],\n // Sold to other businesses: each customer is its own tenant, and no single organization owns the product.\n ownedByOneOrganization: false,\n },\n [ApplicationLine.INTERNAL_TOOL]: {\n line: ApplicationLine.INTERNAL_TOOL,\n rootPlaybookRef: \"cross_cutting.application-creation\",\n /*\n * Only what the not-applicable families cannot decide. Capability-map produces the market AND the feature\n * drafts, so it is named; this line drafts its features with top_down.feature-drafts instead. The market\n * lane, the business model, the brand, the value proposition and the website plan leave the line by\n * themselves: everything their trees produce is declared not applicable below. (The market lane was named\n * here until #1608, when the walk learned to read a composite's whole tree; derived, it comes back when a\n * secondary line needs the market snapshot, and a name would have kept it out.)\n */\n excludedPlaybookRefs: [\"top_down.capability-map\"],\n notApplicableFamilies: [\n ApplicationSpecificationFamily.MARKET_SNAPSHOT,\n ApplicationSpecificationFamily.BUSINESS_MODEL,\n ApplicationSpecificationFamily.BRAND_BRIEF,\n // No brand, so no name to screen: the naming lane leaves the line with the brand it names.\n ApplicationSpecificationFamily.BRAND_NAME_SCREENING,\n ApplicationSpecificationFamily.WEBSITE_PLAN,\n ],\n ownedByOneOrganization: true,\n },\n};\n\n/**\n * Where the creator's choice of line is asked and recorded: one CHOICE question of the ENTRY\n * playbook, whose options are the {@link ApplicationLine} values.\n *\n * The entry playbook belongs to no line, so an application with no line yet can still run it; it is\n * the playbook in which the line gets declared.\n */\nexport const APPLICATION_LINE_QUESTION: { readonly playbookRef: string; readonly questionRef: string } = {\n playbookRef: \"top_down.vision-elicitation\",\n questionRef: \"application-line\",\n};\n\n/** Whether an application has declared its main line, and what the dossier says if it cannot be read as one. */\nexport enum ApplicationLineDeclarationState {\n /** The dossier answers the line question with an {@link ApplicationLine} value. */\n DECLARED = \"declared\",\n /** The line question has no answer yet: the application has not been told what it is. */\n UNDECLARED = \"undeclared\",\n /**\n * The dossier answers the line question with a value that is not a line, e.g. one a later release\n * removed. Kept apart from UNDECLARED because the remedy differs: the creator answered, and the answer\n * no longer means anything.\n */\n UNRECOGNIZED = \"unrecognized\",\n}\n\n/**\n * Why a playbook is, or is not, in the application's ACTIVE SET (#1607): the playbooks its line lets it run.\n *\n * DERIVED on every read from the line and the catalog, never stored: growth inside a line is eligibility\n * over the line's tree, and a record of it would be bookkeeping (`one-source-of-truth.md`). Whether an\n * active playbook may run RIGHT NOW is a separate answer, the eligibility board's; this one says whether\n * the application runs it at all, and why not.\n */\nexport enum PlaybookActivationStatus {\n /** In the tree of the application's line: it runs whenever its preconditions hold. */\n ACTIVE = \"active\",\n /** The line does not run it: excluded by name, or not reached from the line's root. */\n OUTSIDE_LINE = \"outside_line\",\n /** Everything it produces is a family the line declares not applicable, so there is nothing for it to do. */\n NOT_APPLICABLE = \"not_applicable\",\n /** No line is declared yet: only the entry playbook, and the composites that reach it, run until then. */\n AWAITING_LINE = \"awaiting_line\",\n}\n\nexport type ApplicationLineDeclaration =\n | { readonly state: ApplicationLineDeclarationState.DECLARED; readonly line: ApplicationLine }\n | { readonly state: ApplicationLineDeclarationState.UNDECLARED }\n | { readonly state: ApplicationLineDeclarationState.UNRECOGNIZED; readonly value: string };\n\nconst APPLICATION_LINE_VALUES: ReadonlySet<string> = new Set(Object.values(ApplicationLine));\n\n/** Read the application's main line from its dossier. Pure; the dossier is the only place the line lives. */\nexport function resolveApplicationLineDeclaration(inputs: ApplicationCreatorInputs | undefined): ApplicationLineDeclaration {\n const key = creatorInputAnswerKey(APPLICATION_LINE_QUESTION.playbookRef, APPLICATION_LINE_QUESTION.questionRef);\n // The line is the DEFAULT instance's answer (#1609): an instance of the entry playbook never re-declares it.\n const answer = (inputs?.answers ?? []).find((candidate) => creatorInputAnswerKey(candidate.playbookRef, candidate.questionRef, candidate.instanceKey) === key);\n if (answer === undefined) return { state: ApplicationLineDeclarationState.UNDECLARED };\n return APPLICATION_LINE_VALUES.has(answer.value)\n ? { state: ApplicationLineDeclarationState.DECLARED, line: answer.value as ApplicationLine }\n : { state: ApplicationLineDeclarationState.UNRECOGNIZED, value: answer.value };\n}\n\n/**\n * The specification families that do not apply to this application, read from its dossier (#1604).\n * Empty while no line is declared: nothing can be said not to apply before the kind of application is\n * known. One resolution for every reader that sees only the application's exports, such as the expert\n * charter derivation, so none of them re-derives the line.\n */\nexport function resolveNotApplicableFamilies(\n inputs: ApplicationCreatorInputs | undefined,\n definitions: Readonly<Record<string, ApplicationLineDefinition>> = APPLICATION_LINE_DEFINITIONS,\n): ReadonlySet<string> {\n const declaration = resolveApplicationLineDeclaration(inputs);\n if (declaration.state !== ApplicationLineDeclarationState.DECLARED) return new Set<string>();\n /*\n * Over the UNION of the lines (#1608): a family the main line declares not applicable applies again while\n * a secondary line needs it. The one computation of applicability: the run scope reads this function too.\n */\n const needed = resolveSecondaryLineNeededFamilies(inputs);\n return new Set<string>(definitions[declaration.line]!.notApplicableFamilies.filter((family) => !needed.has(family)));\n}\n\n/**\n * A SECONDARY LINE: work opened beside the main line in the middle of an application's life (#1608), such as\n * developing one feature or refining what exists. The main line decides what KIND of application it is; a\n * secondary line never changes that. It changes the application's content: a feature line adds elements of\n * its own, and a refinement line re-derives families the application already holds.\n *\n * A secondary line is an opened INSTANCE of its kind's entry composite (#1609): its instance key names the\n * line, and the activation's purpose says what it is for. Its kind is derived from the entry playbook, so it\n * has no record of its own beside the activation, which is committed the moment it is opened.\n *\n * Members are added with the line they name, and only then (the same rule as {@link ApplicationLine}).\n */\nexport enum ApplicationSecondaryLine {\n /**\n * Develop one feature through the product model: the feature lands as elements of the requirements and\n * the feature drafts, contributed by this line, and the domain plan and build decomposition re-derive\n * from them before the feature is built. The alternative, appending a build task, stays the shortcut for\n * a small code change.\n */\n FEATURE_DEVELOPMENT = \"feature_development\",\n /**\n * Refine one or more families the application already holds, in place (#1608): the requirements, the\n * experience plan, the value proposition. The main line re-derives a family only when it is missing or\n * stale, so without this line nothing re-derives a landed family on purpose. The line re-runs each named\n * family's producer on its own prior output, guided by the line's purpose, then refreshes what that made\n * stale and builds it. It adds no elements of its own: every child runs as the application.\n */\n REFINEMENT = \"refinement\",\n}\n\n/** What one kind of secondary line runs, and what it may add to. */\nexport interface ApplicationSecondaryLineDefinition {\n readonly line: ApplicationSecondaryLine;\n /** The composite an instance of which IS a line of this kind. It belongs to no main line's tree. */\n readonly entryPlaybookRef: string;\n /**\n * The families this line adds ELEMENTS to, each element stamped with the line. It never replaces a family\n * the main line holds: a whole-file landing from a line would overwrite the main line's content.\n */\n readonly contributesToFamilies: readonly ApplicationSpecificationFamily[];\n /**\n * Whether an instance of this line NAMES the families it re-derives (`refinedFamilies` on its activation):\n * required when true, refused when false. What the line is FOR is then a typed fact, not only a sentence.\n */\n readonly namesRefinedFamilies: boolean;\n}\n\n/** Every kind's definition; a member added to {@link ApplicationSecondaryLine} without one does not compile. */\nexport const APPLICATION_SECONDARY_LINE_DEFINITIONS: Readonly<Record<ApplicationSecondaryLine, ApplicationSecondaryLineDefinition>> = {\n [ApplicationSecondaryLine.FEATURE_DEVELOPMENT]: {\n line: ApplicationSecondaryLine.FEATURE_DEVELOPMENT,\n entryPlaybookRef: \"cross_cutting.feature-development\",\n contributesToFamilies: [ApplicationSpecificationFamily.REQUIREMENTS, ApplicationSpecificationFamily.FEATURE_DRAFTS],\n namesRefinedFamilies: false,\n },\n [ApplicationSecondaryLine.REFINEMENT]: {\n line: ApplicationSecondaryLine.REFINEMENT,\n entryPlaybookRef: \"cross_cutting.refinement\",\n // It adds no elements: each family it touches is re-derived whole, as the application.\n contributesToFamilies: [],\n namesRefinedFamilies: true,\n },\n};\n\n/** One secondary line the application has opened, read from its dossier. */\nexport interface OpenApplicationSecondaryLine {\n readonly line: ApplicationSecondaryLine;\n /** The line's name: the instance key of its entry composite. */\n readonly instanceKey: string;\n /** `<entry ref>@<key>`: how runs, rows and answers address this line. */\n readonly instanceId: string;\n readonly purpose: string;\n /** Families the line needs although the main line declares them not applicable; empty when none. */\n readonly neededFamilies: readonly ApplicationSpecificationFamily[];\n /** The families a refinement line re-derives; empty for a line that names none. */\n readonly refinedFamilies: readonly ApplicationSpecificationFamily[];\n}\n\n/**\n * The secondary lines the application has opened (#1608), derived from the dossier's activations: every\n * opened instance of a secondary-line entry composite. Sorted by instance id, like the activations.\n */\nexport function resolveOpenSecondaryLines(inputs: ApplicationCreatorInputs | undefined): readonly OpenApplicationSecondaryLine[] {\n const lineByEntry = new Map(Object.values(APPLICATION_SECONDARY_LINE_DEFINITIONS).map((definition) => [definition.entryPlaybookRef, definition.line]));\n const open: OpenApplicationSecondaryLine[] = [];\n for (const activation of Object.values(inputs?.activations ?? {})) {\n const line = lineByEntry.get(activation.playbookRef);\n // A closed line is no longer open; what it contributed stays, marked with it.\n if (line === undefined || !isPlaybookInstanceOpen(activation)) continue;\n open.push({\n line,\n instanceKey: activation.instanceKey,\n instanceId: playbookInstanceId(activation.playbookRef, activation.instanceKey),\n purpose: activation.purpose,\n neededFamilies: activation.neededFamilies ?? [],\n refinedFamilies: activation.refinedFamilies ?? [],\n });\n }\n return open.sort((left, right) => left.instanceId.localeCompare(right.instanceId));\n}\n\n/** Whether a playbook is the entry of a secondary line, i.e. whether an instance of it IS a line. */\nexport function isSecondaryLineEntryPlaybook(playbookRef: string): boolean {\n return secondaryLineDefinitionOfEntry(playbookRef) !== undefined;\n}\n\n/** The secondary-line definition whose entry composite this playbook is, or `undefined`. */\nexport function secondaryLineDefinitionOfEntry(playbookRef: string): ApplicationSecondaryLineDefinition | undefined {\n return Object.values(APPLICATION_SECONDARY_LINE_DEFINITIONS).find((definition) => definition.entryPlaybookRef === playbookRef);\n}\n\n/**\n * The families the application's secondary lines need although its main line declares them not applicable\n * (#1608): the union over every line that is not ABANDONED.\n *\n * A COMPLETED line still counts: what it built is part of the product now, and a public website a finished\n * feature added still needs its plan. An ABANDONED line's need lapses with it, and a file it landed is then\n * reported as ignored, never deleted (#1604). An open line counts, of course.\n */\nexport function resolveSecondaryLineNeededFamilies(inputs: ApplicationCreatorInputs | undefined): ReadonlySet<ApplicationSpecificationFamily> {\n const needed = new Set<ApplicationSpecificationFamily>();\n for (const activation of Object.values(inputs?.activations ?? {})) {\n if (!isSecondaryLineEntryPlaybook(activation.playbookRef)) continue;\n if (activation.closure?.kind === ApplicationPlaybookInstanceClosureKind.ABANDONED) continue;\n for (const family of activation.neededFamilies ?? []) needed.add(family);\n }\n return needed;\n}\n"]}
|
|
@@ -441,6 +441,28 @@ export declare const MetaWorkflowPlaybookInputSchema: z.ZodObject<{
|
|
|
441
441
|
}, z.core.$strict>>;
|
|
442
442
|
}, z.core.$strip>;
|
|
443
443
|
export type MetaWorkflowPlaybookInput = z.infer<typeof MetaWorkflowPlaybookInputSchema>;
|
|
444
|
+
/**
|
|
445
|
+
* One declared OUTPUT of a playbook: the shared artifact contract plus, optionally, the aspects of that family
|
|
446
|
+
* this playbook WRITES (#2146).
|
|
447
|
+
*
|
|
448
|
+
* Several families have more than one writer, each owning a slice: `top_down.compliance-posture` writes only
|
|
449
|
+
* the vision's constraints, `top_down.vision-elicitation` the whole vision. Without this, a writer of one slice
|
|
450
|
+
* reopened every reader of the whole family: measured on app-creation-test-004, the posture's write into the
|
|
451
|
+
* vision made five definition leaves refresh, among them ones whose brief never uses a constraint.
|
|
452
|
+
*
|
|
453
|
+
* Read by the rerun verdict only: a landing by this writer reopens a reader of the family only when the aspects
|
|
454
|
+
* written meet the aspects the reader reads (`inputs[].aspects`, or the aspects its `intent` resolves to; a
|
|
455
|
+
* reader that narrows nothing reads the whole family and is reopened by any writer). Absent = this playbook may
|
|
456
|
+
* write any aspect of the family, which is the safe reading. Keys are validated against the family at
|
|
457
|
+
* `wildo fwk generate-docs`, exactly like `inputs[].aspects`.
|
|
458
|
+
*/
|
|
459
|
+
export declare const MetaWorkflowPlaybookOutputSchema: z.ZodObject<{
|
|
460
|
+
family: z.ZodString;
|
|
461
|
+
schemaRef: z.ZodOptional<z.ZodString>;
|
|
462
|
+
description: z.ZodOptional<z.ZodString>;
|
|
463
|
+
aspects: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
464
|
+
}, z.core.$strip>;
|
|
465
|
+
export type MetaWorkflowPlaybookOutput = z.infer<typeof MetaWorkflowPlaybookOutputSchema>;
|
|
444
466
|
export declare const MetaWorkflowPlaybookSchema: z.ZodObject<{
|
|
445
467
|
ref: z.ZodString;
|
|
446
468
|
version: z.ZodString;
|
|
@@ -505,6 +527,7 @@ export declare const MetaWorkflowPlaybookSchema: z.ZodObject<{
|
|
|
505
527
|
family: z.ZodString;
|
|
506
528
|
schemaRef: z.ZodOptional<z.ZodString>;
|
|
507
529
|
description: z.ZodOptional<z.ZodString>;
|
|
530
|
+
aspects: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
508
531
|
}, z.core.$strip>>>;
|
|
509
532
|
stepOutputs: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
510
533
|
ref: z.ZodString;
|
|
@@ -522,10 +545,14 @@ export declare const MetaWorkflowPlaybookSchema: z.ZodObject<{
|
|
|
522
545
|
question: z.ZodString;
|
|
523
546
|
kind: z.ZodEnum<typeof HumanDecision_FieldKind>;
|
|
524
547
|
options: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
548
|
+
optionsFrom: z.ZodOptional<z.ZodEnum<typeof import("@wildo-ai/saas-models/meta-workflows").MetaWorkflow_ElicitationOptionsSource>>;
|
|
525
549
|
sameDecisionAs: z.ZodOptional<z.ZodObject<{
|
|
526
550
|
playbookRef: z.ZodString;
|
|
527
551
|
questionRef: z.ZodString;
|
|
528
552
|
}, z.core.$strip>>;
|
|
553
|
+
depth: z.ZodOptional<z.ZodEnum<typeof import("@wildo-ai/saas-models/meta-workflows").MetaWorkflow_ElicitationQuestionDepth>>;
|
|
554
|
+
whenUnknown: z.ZodOptional<z.ZodEnum<typeof import("@wildo-ai/saas-models/meta-workflows").MetaWorkflow_ElicitationUnknownPolicy>>;
|
|
555
|
+
regulatedDomain: z.ZodOptional<z.ZodBoolean>;
|
|
529
556
|
}, z.core.$strip>>;
|
|
530
557
|
}, z.core.$strip>>;
|
|
531
558
|
contextSources: z.ZodDefault<z.ZodArray<z.ZodEnum<typeof MetaWorkflow_ContextSource>>>;
|
|
@@ -544,6 +571,7 @@ export declare const MetaWorkflowPlaybookSchema: z.ZodObject<{
|
|
|
544
571
|
reopen: z.ZodArray<z.ZodString>;
|
|
545
572
|
}, z.core.$strict>>>;
|
|
546
573
|
actsOnApplication: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
574
|
+
closingMove: z.ZodOptional<z.ZodString>;
|
|
547
575
|
}, z.core.$strip>>;
|
|
548
576
|
suspendsForClarification: z.ZodDefault<z.ZodBoolean>;
|
|
549
577
|
briefAdequacyGate: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"playbooks.application-creation.schemas.d.ts","sourceRoot":"","sources":["../../../../src/application-creation/playbooks.application-creation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,2BAA2B,EAK3B,qBAAqB,EACrB,0BAA0B,EAI1B,0BAA0B,EAE3B,MAAM,sCAAsC,CAAC;AAsD9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,oBAAY,kBAAkB;IAC5B,0GAA0G;IAC1G,QAAQ,aAAa;IACrB,2FAA2F;IAC3F,SAAS,cAAc;IACvB,oFAAoF;IACpF,UAAU,eAAe;IACzB,gDAAgD;IAChD,aAAa,kBAAkB;CAChC;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,oBAAY,4BAA4B;IACtC,gCAAgC,qCAAqC;IACrE,kBAAkB,uBAAuB;IACzC,4BAA4B,iCAAiC;IAC7D,qBAAqB,0BAA0B;IAC/C,kBAAkB,uBAAuB;IACzC,yCAAyC,8CAA8C;IACvF,2BAA2B,gCAAgC;CAC5D;AAqBD;;;;;;;GAOG;AACH,oBAAY,+BAA+B;IACzC,GAAG,QAAQ;IACX,EAAE,OAAO;CACV;AAED;;;;;;;;;;;;;;;;;;;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AAO,MAAM,+BAA+B;;;;;;QAnC1C;;;WAGG;;QAEH,6FAA6F;;;iBA+C7F,CAAC;AACH,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"playbooks.application-creation.schemas.d.ts","sourceRoot":"","sources":["../../../../src/application-creation/playbooks.application-creation.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EACL,uBAAuB,EACxB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,2BAA2B,EAK3B,qBAAqB,EACrB,0BAA0B,EAI1B,0BAA0B,EAE3B,MAAM,sCAAsC,CAAC;AAsD9C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,oBAAY,kBAAkB;IAC5B,0GAA0G;IAC1G,QAAQ,aAAa;IACrB,2FAA2F;IAC3F,SAAS,cAAc;IACvB,oFAAoF;IACpF,UAAU,eAAe;IACzB,gDAAgD;IAChD,aAAa,kBAAkB;CAChC;AAGD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,oBAAY,4BAA4B;IACtC,gCAAgC,qCAAqC;IACrE,kBAAkB,uBAAuB;IACzC,4BAA4B,iCAAiC;IAC7D,qBAAqB,0BAA0B;IAC/C,kBAAkB,uBAAuB;IACzC,yCAAyC,8CAA8C;IACvF,2BAA2B,gCAAgC;CAC5D;AAqBD;;;;;;;GAOG;AACH,oBAAY,+BAA+B;IACzC,GAAG,QAAQ;IACX,EAAE,OAAO;CACV;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,+BAA+B,GAAG,IAAI,CAMnG;AAOD,yGA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,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,+BAA+B,CAAC,CAAC;AAExF;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,gCAAgC;;;;;iBAE3C,CAAC;AACH,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE1F,eAAO,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YA3ErC;;;eAGG;;YAEH,6FAA6F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyU7F,CAAC;AACH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAC9E;;;;;GAKG;AACH,MAAM,MAAM,6BAA6B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAC"}
|
|
@@ -528,6 +528,24 @@ export const MetaWorkflowPlaybookInputSchema = MetaWorkflow_ArtifactSelectorSche
|
|
|
528
528
|
});
|
|
529
529
|
}
|
|
530
530
|
});
|
|
531
|
+
/**
|
|
532
|
+
* One declared OUTPUT of a playbook: the shared artifact contract plus, optionally, the aspects of that family
|
|
533
|
+
* this playbook WRITES (#2146).
|
|
534
|
+
*
|
|
535
|
+
* Several families have more than one writer, each owning a slice: `top_down.compliance-posture` writes only
|
|
536
|
+
* the vision's constraints, `top_down.vision-elicitation` the whole vision. Without this, a writer of one slice
|
|
537
|
+
* reopened every reader of the whole family: measured on app-creation-test-004, the posture's write into the
|
|
538
|
+
* vision made five definition leaves refresh, among them ones whose brief never uses a constraint.
|
|
539
|
+
*
|
|
540
|
+
* Read by the rerun verdict only: a landing by this writer reopens a reader of the family only when the aspects
|
|
541
|
+
* written meet the aspects the reader reads (`inputs[].aspects`, or the aspects its `intent` resolves to; a
|
|
542
|
+
* reader that narrows nothing reads the whole family and is reopened by any writer). Absent = this playbook may
|
|
543
|
+
* write any aspect of the family, which is the safe reading. Keys are validated against the family at
|
|
544
|
+
* `wildo fwk generate-docs`, exactly like `inputs[].aspects`.
|
|
545
|
+
*/
|
|
546
|
+
export const MetaWorkflowPlaybookOutputSchema = MetaWorkflow_ArtifactContractSchema.extend({
|
|
547
|
+
aspects: z.array(z.string().min(1)).min(1).optional(),
|
|
548
|
+
});
|
|
531
549
|
export const MetaWorkflowPlaybookSchema = z.object({
|
|
532
550
|
ref: z.string().min(1),
|
|
533
551
|
version: z.string().min(1),
|
|
@@ -547,7 +565,7 @@ export const MetaWorkflowPlaybookSchema = z.object({
|
|
|
547
565
|
*/
|
|
548
566
|
preconditions: z.array(MetaWorkflow_JourneyPredicateSchema).default([]),
|
|
549
567
|
inputs: z.array(MetaWorkflowPlaybookInputSchema).default([]),
|
|
550
|
-
outputs: z.array(
|
|
568
|
+
outputs: z.array(MetaWorkflowPlaybookOutputSchema).default([]),
|
|
551
569
|
/**
|
|
552
570
|
* Values this playbook returns to its PARENT choreography instead of landing.
|
|
553
571
|
*
|