@synap-core/workspace-templates 0.67.0 → 0.69.0
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/README.md +135 -68
- package/capabilities/design.capability.json +126 -643
- package/capabilities/storybook.capability.json +84 -0
- package/capabilities/vast-ai-compute-worker.capability.json +178 -76
- package/dist/index.js +1588 -104
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/skills/designing-with-real-components/SKILL.md +7 -1
- package/src/agency-os.yaml +22 -4
- package/src/builder.yaml +1480 -773
- package/src/campaign-channel-platforms.template.test.ts +13 -2
- package/src/catalog-safety.test.ts +14 -3
- package/src/content-os.campaigns.template.test.ts +63 -20
- package/src/content-os.piece-model.template.test.ts +185 -41
- package/src/content-os.template.test.ts +174 -58
- package/src/content-os.yaml +170 -28
- package/src/crm.yaml +289 -46
- package/src/decisions-wave.template.test.ts +171 -47
- package/src/design-system.template.test.ts +87 -0
- package/src/design-system.yaml +173 -0
- package/src/ecosystem.yaml +7 -1
- package/src/finance.yaml +27 -5
- package/src/lifecycle-declarations.test.ts +8 -0
- package/src/marketing.yaml +6 -3
- package/src/process-contract.validate.test.ts +217 -71
- package/src/templates.ts +2522 -1310
- package/src/types.ts +35 -6
- package/src/ui-inventory.template.test.ts +256 -0
- package/src/validate.ts +541 -130
package/src/ecosystem.yaml
CHANGED
|
@@ -451,7 +451,13 @@ playbooks:
|
|
|
451
451
|
# workspace never silently starts paid AI runs — the user turns it on when
|
|
452
452
|
# they want the watch.
|
|
453
453
|
activators:
|
|
454
|
-
- {
|
|
454
|
+
- {
|
|
455
|
+
on: schedule,
|
|
456
|
+
cron: "0 9 * * 1",
|
|
457
|
+
size: per_thing,
|
|
458
|
+
mode: run,
|
|
459
|
+
startsPaused: true,
|
|
460
|
+
}
|
|
455
461
|
tools: [update_entity, exa_search, apify_run_actor, entity.create]
|
|
456
462
|
status: active
|
|
457
463
|
|
package/src/finance.yaml
CHANGED
|
@@ -686,7 +686,11 @@ playbooks:
|
|
|
686
686
|
forceProposeWrites: true
|
|
687
687
|
tools: [create_entity, create_relation, list_records]
|
|
688
688
|
expectedOutputs:
|
|
689
|
-
- {
|
|
689
|
+
- {
|
|
690
|
+
kind: invoice,
|
|
691
|
+
label: This month's invoice,
|
|
692
|
+
relationToSubject: relates_to,
|
|
693
|
+
}
|
|
690
694
|
|
|
691
695
|
- name: Approve an expense
|
|
692
696
|
description: Review an expense against its budget, get a person's approval, and record the payment.
|
|
@@ -753,10 +757,19 @@ playbooks:
|
|
|
753
757
|
executor: is-agent
|
|
754
758
|
status: active
|
|
755
759
|
activators:
|
|
756
|
-
- {
|
|
760
|
+
- {
|
|
761
|
+
on: schedule,
|
|
762
|
+
cron: "0 9 1 * *",
|
|
763
|
+
mode: appointment,
|
|
764
|
+
startsPaused: true,
|
|
765
|
+
}
|
|
757
766
|
tools: [fetch_record, list_records]
|
|
758
767
|
expectedOutputs:
|
|
759
|
-
- {
|
|
768
|
+
- {
|
|
769
|
+
kind: financial-metric,
|
|
770
|
+
label: Month-end metrics,
|
|
771
|
+
relationToSubject: none,
|
|
772
|
+
}
|
|
760
773
|
- { kind: document, label: Month-end note, relationToSubject: none }
|
|
761
774
|
stages:
|
|
762
775
|
- key: reconcile
|
|
@@ -777,8 +790,17 @@ playbooks:
|
|
|
777
790
|
ask:
|
|
778
791
|
mode: choose
|
|
779
792
|
options:
|
|
780
|
-
- {
|
|
781
|
-
|
|
793
|
+
- {
|
|
794
|
+
label: Go on with the close,
|
|
795
|
+
value: continue,
|
|
796
|
+
recommended: true,
|
|
797
|
+
description: Unconnected accounts stay listed in the month-end note,
|
|
798
|
+
}
|
|
799
|
+
- {
|
|
800
|
+
label: "I connected them: reconcile again",
|
|
801
|
+
value: reconcile_again,
|
|
802
|
+
description: The run reconciles the newly connected accounts first,
|
|
803
|
+
}
|
|
782
804
|
- key: receivables
|
|
783
805
|
name: Receivables
|
|
784
806
|
category: started
|
|
@@ -294,6 +294,10 @@ describe("lifecycle declarations — coverage (derived from the playbooks)", ()
|
|
|
294
294
|
* playbook renders into the AI's instructions, design b199a3a4, 8 Nov 2026),
|
|
295
295
|
* content-composition.approved ("Ready": the person signs a piece off,
|
|
296
296
|
* founder 6 Nov declaration 305683a8, kept by the piece model of 12 Nov 2026).
|
|
297
|
+
* ui-component.deprecated / ui-page.deprecated and user-flow.live / retired
|
|
298
|
+
* (the UI inventory, plan 48854969 §9, 23 Nov 2026: the Storybook sync owns
|
|
299
|
+
* every other status and moves a dropped record to `gone`; retiring a
|
|
300
|
+
* component or page, and calling a flow live or retired, is a person's call).
|
|
297
301
|
*/
|
|
298
302
|
const HUMAN_ONLY = [
|
|
299
303
|
"brand-library:brand-asset.deprecated",
|
|
@@ -305,8 +309,12 @@ describe("lifecycle declarations — coverage (derived from the playbooks)", ()
|
|
|
305
309
|
"builder-workspace:finding.superseded",
|
|
306
310
|
"builder-workspace:finding.wont_fix",
|
|
307
311
|
"builder-workspace:issue.wont_fix",
|
|
312
|
+
"builder-workspace:ui-component.deprecated",
|
|
308
313
|
"builder-workspace:ui-design.approved",
|
|
309
314
|
"builder-workspace:ui-design.archived",
|
|
315
|
+
"builder-workspace:ui-page.deprecated",
|
|
316
|
+
"builder-workspace:user-flow.live",
|
|
317
|
+
"builder-workspace:user-flow.retired",
|
|
310
318
|
"content-os:campaign.cancelled",
|
|
311
319
|
"content-os:campaign.paused",
|
|
312
320
|
"content-os:content-composition.approved",
|
package/src/marketing.yaml
CHANGED
|
@@ -130,8 +130,7 @@ profiles:
|
|
|
130
130
|
label: Type
|
|
131
131
|
valueType: string
|
|
132
132
|
inputType: select
|
|
133
|
-
enumValues:
|
|
134
|
-
[scoping, outreach, live, partnership, event, other]
|
|
133
|
+
enumValues: [scoping, outreach, live, partnership, event, other]
|
|
135
134
|
constraints: { defaultValue: outreach }
|
|
136
135
|
# `campaign-color` backs the per-campaign colour the CRM surfaces render.
|
|
137
136
|
# Stored as a palette NAME (see apps/crm/lib/campaignColors.ts), not a hex.
|
|
@@ -424,7 +423,11 @@ playbooks:
|
|
|
424
423
|
tools: [publish_post, send_message, list_records]
|
|
425
424
|
expectedOutputs:
|
|
426
425
|
- { kind: post, label: Campaign pieces, relationToSubject: relates_to }
|
|
427
|
-
- {
|
|
426
|
+
- {
|
|
427
|
+
kind: person,
|
|
428
|
+
label: Leads from the campaign,
|
|
429
|
+
relationToSubject: relates_to,
|
|
430
|
+
}
|
|
428
431
|
- { kind: document, label: Campaign report }
|
|
429
432
|
stages:
|
|
430
433
|
- key: brief
|
|
@@ -56,7 +56,13 @@ const WIDGET_LIFECYCLE = {
|
|
|
56
56
|
],
|
|
57
57
|
};
|
|
58
58
|
const owner = {
|
|
59
|
-
meta: {
|
|
59
|
+
meta: {
|
|
60
|
+
slug: "owner",
|
|
61
|
+
name: "Owner",
|
|
62
|
+
description: "d",
|
|
63
|
+
icon: "x",
|
|
64
|
+
color: "gray",
|
|
65
|
+
},
|
|
60
66
|
workspace: { name: "Owner", description: "d" },
|
|
61
67
|
profiles: [
|
|
62
68
|
{
|
|
@@ -65,24 +71,51 @@ const owner = {
|
|
|
65
71
|
scope: "shared",
|
|
66
72
|
lifecycle: WIDGET_LIFECYCLE,
|
|
67
73
|
properties: [
|
|
68
|
-
{
|
|
69
|
-
|
|
74
|
+
{
|
|
75
|
+
slug: "widget-stage",
|
|
76
|
+
label: "Stage",
|
|
77
|
+
valueType: "string",
|
|
78
|
+
inputType: "select",
|
|
79
|
+
enumValues: ["New", "Built", "Shipped", "Archived"],
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
slug: "widget-notes",
|
|
83
|
+
label: "Notes",
|
|
84
|
+
valueType: "string",
|
|
85
|
+
inputType: "text",
|
|
86
|
+
},
|
|
70
87
|
],
|
|
71
88
|
},
|
|
72
89
|
],
|
|
73
|
-
entityLinks: [
|
|
90
|
+
entityLinks: [
|
|
91
|
+
{
|
|
92
|
+
sourceProfileSlug: "widget",
|
|
93
|
+
targetProfileSlug: "widget",
|
|
94
|
+
type: "spawned_from",
|
|
95
|
+
label: "Spawned from",
|
|
96
|
+
},
|
|
97
|
+
],
|
|
74
98
|
} as unknown as WorkspaceYaml;
|
|
75
99
|
|
|
76
|
-
function proc(
|
|
100
|
+
function proc(
|
|
101
|
+
mutate: (pb: Record<string, any>) => void = () => {}
|
|
102
|
+
): WorkspaceYaml {
|
|
77
103
|
const pb: Record<string, any> = {
|
|
78
104
|
name: "Build Widget",
|
|
79
105
|
goalTemplate: "Build {widget}",
|
|
80
106
|
params: [{ name: "widget", type: "entity", required: true }],
|
|
81
107
|
subjectProfile: { profileSlug: "widget" },
|
|
82
108
|
activators: [{ on: "enters_status", status: "Built", mode: "propose" }],
|
|
83
|
-
expectedOutputs: [
|
|
109
|
+
expectedOutputs: [
|
|
110
|
+
{ kind: "widget", label: "Spin-off", relationToSubject: "spawned_from" },
|
|
111
|
+
],
|
|
84
112
|
stages: [
|
|
85
|
-
{
|
|
113
|
+
{
|
|
114
|
+
key: "build",
|
|
115
|
+
name: "Build",
|
|
116
|
+
category: "started",
|
|
117
|
+
subjectStatus: "Built",
|
|
118
|
+
},
|
|
86
119
|
{
|
|
87
120
|
key: "ship",
|
|
88
121
|
name: "Ship",
|
|
@@ -90,16 +123,35 @@ function proc(mutate: (pb: Record<string, any>) => void = () => {}): WorkspaceYa
|
|
|
90
123
|
subjectStatus: "Shipped",
|
|
91
124
|
gate: { kind: "human" },
|
|
92
125
|
onFail: { toStage: "build" },
|
|
93
|
-
expectedOutputs: [
|
|
126
|
+
expectedOutputs: [
|
|
127
|
+
{
|
|
128
|
+
kind: "widget",
|
|
129
|
+
label: "Release",
|
|
130
|
+
relationToSubject: "spawned_from",
|
|
131
|
+
},
|
|
132
|
+
],
|
|
94
133
|
},
|
|
95
134
|
],
|
|
96
135
|
};
|
|
97
136
|
mutate(pb);
|
|
98
137
|
return {
|
|
99
|
-
meta: {
|
|
138
|
+
meta: {
|
|
139
|
+
slug: "proc",
|
|
140
|
+
name: "Proc",
|
|
141
|
+
description: "d",
|
|
142
|
+
icon: "x",
|
|
143
|
+
color: "gray",
|
|
144
|
+
},
|
|
100
145
|
workspace: { name: "Proc", description: "d" },
|
|
101
146
|
dependencies: [{ slug: "owner", kind: "workspace", relation: "require" }],
|
|
102
|
-
profiles: [
|
|
147
|
+
profiles: [
|
|
148
|
+
{
|
|
149
|
+
slug: "widget",
|
|
150
|
+
displayName: "Widget",
|
|
151
|
+
scope: "shared",
|
|
152
|
+
properties: [],
|
|
153
|
+
},
|
|
154
|
+
],
|
|
103
155
|
playbooks: [pb],
|
|
104
156
|
} as unknown as WorkspaceYaml;
|
|
105
157
|
}
|
|
@@ -120,60 +172,88 @@ describe("process contract — each rule fires on its own fixture", () => {
|
|
|
120
172
|
// Negative control: each assertion goes red with the `playbook-field-retired`
|
|
121
173
|
// loop removed from checkProcessContract.
|
|
122
174
|
it("each retired field is refused (statusProperty, onEnd, humanOnlyStatuses, schedule)", () => {
|
|
123
|
-
expect(
|
|
124
|
-
"
|
|
125
|
-
]);
|
|
126
|
-
expect(
|
|
175
|
+
expect(
|
|
176
|
+
rulesOf(proc((pb) => (pb.subjectProfile.statusProperty = "widget-stage")))
|
|
177
|
+
).toEqual(["playbook-field-retired"]);
|
|
178
|
+
expect(
|
|
179
|
+
rulesOf(proc((pb) => (pb.subjectProfile.onEnd = { cancelled: "New" })))
|
|
180
|
+
).toEqual(["playbook-field-retired"]);
|
|
181
|
+
expect(rulesOf(proc((pb) => (pb.humanOnlyStatuses = ["New"])))).toEqual([
|
|
127
182
|
"playbook-field-retired",
|
|
128
183
|
]);
|
|
129
|
-
expect(
|
|
130
|
-
|
|
184
|
+
expect(
|
|
185
|
+
rulesOf(
|
|
186
|
+
proc((pb) => (pb.schedule = { cron: "0 8 * * *", enabled: true }))
|
|
187
|
+
)
|
|
188
|
+
).toEqual(["playbook-field-retired"]);
|
|
131
189
|
});
|
|
132
190
|
|
|
133
191
|
it("a stage subjectStatus outside the enum", () => {
|
|
134
|
-
expect(
|
|
135
|
-
"
|
|
136
|
-
]);
|
|
192
|
+
expect(
|
|
193
|
+
rulesOf(proc((pb) => (pb.stages[0].subjectStatus = "Done")))
|
|
194
|
+
).toEqual(["stage-subject-status-unknown"]);
|
|
137
195
|
});
|
|
138
196
|
|
|
139
197
|
it("a stage subjectStatus on a kind that declares no lifecycle", () => {
|
|
140
|
-
const noLifecycle = structuredClone(owner) as unknown as {
|
|
198
|
+
const noLifecycle = structuredClone(owner) as unknown as {
|
|
199
|
+
profiles: Array<Record<string, unknown>>;
|
|
200
|
+
};
|
|
141
201
|
delete noLifecycle.profiles[0]!.lifecycle;
|
|
142
|
-
const tpl = proc(
|
|
143
|
-
|
|
144
|
-
|
|
202
|
+
const tpl = proc(
|
|
203
|
+
(pb) => (pb.activators = [{ on: "created", mode: "propose" }])
|
|
204
|
+
);
|
|
205
|
+
const { errors } = validateTemplate(tpl, {
|
|
206
|
+
corpus: [noLifecycle as unknown as WorkspaceYaml, tpl],
|
|
207
|
+
});
|
|
208
|
+
expect(
|
|
209
|
+
errors.filter((e) => PROCESS_RULES.has(e.rule)).map((e) => e.rule)
|
|
210
|
+
).toEqual([
|
|
145
211
|
"stage-subject-status-unknown-no-lifecycle",
|
|
146
212
|
"stage-subject-status-unknown-no-lifecycle",
|
|
147
213
|
]);
|
|
148
214
|
});
|
|
149
215
|
|
|
150
216
|
it("onFail.toStage naming no stage of the playbook", () => {
|
|
151
|
-
expect(
|
|
152
|
-
"
|
|
153
|
-
]);
|
|
217
|
+
expect(
|
|
218
|
+
rulesOf(proc((pb) => (pb.stages[1].onFail = { toStage: "qa" })))
|
|
219
|
+
).toEqual(["stage-onfail-unknown"]);
|
|
154
220
|
});
|
|
155
221
|
|
|
156
222
|
it("onFail.toStage may name a stage by its name", () => {
|
|
157
|
-
expect(
|
|
223
|
+
expect(
|
|
224
|
+
rulesOf(proc((pb) => (pb.stages[1].onFail = { toStage: "Build" })))
|
|
225
|
+
).toEqual([]);
|
|
158
226
|
});
|
|
159
227
|
|
|
160
228
|
it("an activator status outside the enum", () => {
|
|
161
229
|
expect(
|
|
162
|
-
rulesOf(
|
|
230
|
+
rulesOf(
|
|
231
|
+
proc(
|
|
232
|
+
(pb) =>
|
|
233
|
+
(pb.activators = [
|
|
234
|
+
{ on: "enters_status", status: "Done", mode: "run" },
|
|
235
|
+
])
|
|
236
|
+
)
|
|
237
|
+
)
|
|
163
238
|
).toEqual(["activator-status-unknown"]);
|
|
164
239
|
});
|
|
165
240
|
|
|
166
241
|
it("an enters_status activator with no status", () => {
|
|
167
|
-
expect(
|
|
168
|
-
|
|
169
|
-
|
|
242
|
+
expect(
|
|
243
|
+
rulesOf(
|
|
244
|
+
proc(
|
|
245
|
+
(pb) => (pb.activators = [{ on: "enters_status", mode: "propose" }])
|
|
246
|
+
)
|
|
247
|
+
)
|
|
248
|
+
).toEqual(["activator-status-required"]);
|
|
170
249
|
});
|
|
171
250
|
|
|
172
251
|
it("an activator with an unknown trigger or mode", () => {
|
|
173
|
-
expect(
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
252
|
+
expect(
|
|
253
|
+
rulesOf(
|
|
254
|
+
proc((pb) => (pb.activators = [{ on: "updated", mode: "always" }]))
|
|
255
|
+
)
|
|
256
|
+
).toEqual(["activator-on-invalid", "activator-mode-invalid"]);
|
|
177
257
|
});
|
|
178
258
|
|
|
179
259
|
/**
|
|
@@ -188,22 +268,52 @@ describe("process contract — each rule fires on its own fixture", () => {
|
|
|
188
268
|
proc(
|
|
189
269
|
(pb) =>
|
|
190
270
|
(pb.activators = [
|
|
191
|
-
{
|
|
192
|
-
|
|
271
|
+
{
|
|
272
|
+
on: "count",
|
|
273
|
+
status: "Built",
|
|
274
|
+
min: 5,
|
|
275
|
+
size: "per_moment",
|
|
276
|
+
mode: "propose",
|
|
277
|
+
maxPendingApprovals: 10,
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
on: "schedule",
|
|
281
|
+
cron: "0 9 * * 1",
|
|
282
|
+
status: "Built",
|
|
283
|
+
mode: "run",
|
|
284
|
+
},
|
|
193
285
|
{ on: "manual", mode: "propose" },
|
|
194
286
|
])
|
|
195
287
|
)
|
|
196
288
|
)
|
|
197
289
|
).toEqual([]);
|
|
198
290
|
expect(
|
|
199
|
-
rulesOf(
|
|
291
|
+
rulesOf(
|
|
292
|
+
proc(
|
|
293
|
+
(pb) =>
|
|
294
|
+
(pb.activators = [
|
|
295
|
+
{ on: "count", status: "Done", min: 5, mode: "propose" },
|
|
296
|
+
])
|
|
297
|
+
)
|
|
298
|
+
)
|
|
200
299
|
).toEqual(["activator-status-unknown"]);
|
|
201
|
-
expect(
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
300
|
+
expect(
|
|
301
|
+
rulesOf(
|
|
302
|
+
proc(
|
|
303
|
+
(pb) => (pb.activators = [{ on: "count", min: 5, mode: "propose" }])
|
|
304
|
+
)
|
|
305
|
+
)
|
|
306
|
+
).toEqual(["activator-status-required"]);
|
|
307
|
+
expect(
|
|
308
|
+
rulesOf(
|
|
309
|
+
proc(
|
|
310
|
+
(pb) =>
|
|
311
|
+
(pb.activators = [
|
|
312
|
+
{ on: "manual", status: "Built", mode: "propose" },
|
|
313
|
+
])
|
|
314
|
+
)
|
|
315
|
+
)
|
|
316
|
+
).toEqual(["activator-status-unexpected"]);
|
|
207
317
|
});
|
|
208
318
|
|
|
209
319
|
it("an activator on a playbook with no subject kind", () => {
|
|
@@ -231,26 +341,35 @@ describe("process contract — each rule fires on its own fixture", () => {
|
|
|
231
341
|
});
|
|
232
342
|
|
|
233
343
|
it("a playbook-level relationToSubject the corpus does not define", () => {
|
|
234
|
-
expect(
|
|
235
|
-
|
|
236
|
-
|
|
344
|
+
expect(
|
|
345
|
+
rulesOf(
|
|
346
|
+
proc((pb) => (pb.expectedOutputs[0].relationToSubject = "spawned_by"))
|
|
347
|
+
)
|
|
348
|
+
).toEqual(["output-relation-unknown"]);
|
|
237
349
|
});
|
|
238
350
|
|
|
239
351
|
it("a stage-level relationToSubject the corpus does not define", () => {
|
|
240
352
|
expect(
|
|
241
|
-
rulesOf(
|
|
353
|
+
rulesOf(
|
|
354
|
+
proc(
|
|
355
|
+
(pb) =>
|
|
356
|
+
(pb.stages[1].expectedOutputs[0].relationToSubject = "spawned_by")
|
|
357
|
+
)
|
|
358
|
+
)
|
|
242
359
|
).toEqual(["output-relation-unknown"]);
|
|
243
360
|
});
|
|
244
361
|
|
|
245
362
|
it("an output `optional` that is not a boolean, at playbook and stage level", () => {
|
|
246
363
|
// The pod reads `optional` strictly (only a real `true`): a quoted value
|
|
247
364
|
// would leave the slot owed while the YAML reads as if it were not.
|
|
248
|
-
expect(
|
|
249
|
-
|
|
250
|
-
]);
|
|
251
|
-
expect(
|
|
252
|
-
|
|
253
|
-
|
|
365
|
+
expect(
|
|
366
|
+
rulesOf(proc((pb) => (pb.expectedOutputs[0].optional = "true")))
|
|
367
|
+
).toEqual(["output-optional-not-boolean"]);
|
|
368
|
+
expect(
|
|
369
|
+
rulesOf(
|
|
370
|
+
proc((pb) => (pb.stages[1].expectedOutputs[0].optional = "false"))
|
|
371
|
+
)
|
|
372
|
+
).toEqual(["output-optional-not-boolean"]);
|
|
254
373
|
// A real boolean is clean at both levels.
|
|
255
374
|
expect(
|
|
256
375
|
rulesOf(
|
|
@@ -263,8 +382,11 @@ describe("process contract — each rule fires on its own fixture", () => {
|
|
|
263
382
|
});
|
|
264
383
|
|
|
265
384
|
it("a DEFAULT relation (base.yaml relationDefs) resolves through the corpus", () => {
|
|
266
|
-
const base = readYamlTemplates().find((t) => t.slug === "base")
|
|
267
|
-
|
|
385
|
+
const base = readYamlTemplates().find((t) => t.slug === "base")!
|
|
386
|
+
.data as WorkspaceYaml;
|
|
387
|
+
const tpl = proc(
|
|
388
|
+
(pb) => (pb.expectedOutputs[0].relationToSubject = "relates_to")
|
|
389
|
+
);
|
|
268
390
|
const { errors } = validateTemplate(tpl, { corpus: [owner, base, tpl] });
|
|
269
391
|
expect(errors.filter((e) => PROCESS_RULES.has(e.rule))).toEqual([]);
|
|
270
392
|
// …and the same value is refused when base is not in the corpus.
|
|
@@ -290,12 +412,20 @@ describe("process contract — each rule fires on its own fixture", () => {
|
|
|
290
412
|
});
|
|
291
413
|
|
|
292
414
|
describe("process contract — a session keeps at most MAX_SESSION_CRITERIA criteria", () => {
|
|
293
|
-
const crit = (key: string) => ({
|
|
415
|
+
const crit = (key: string) => ({
|
|
416
|
+
key,
|
|
417
|
+
statement: `${key} holds.`,
|
|
418
|
+
check: { kind: "judge" },
|
|
419
|
+
});
|
|
294
420
|
const withCriteria = (playbookLevel: number, perStage: number) =>
|
|
295
421
|
proc((pb) => {
|
|
296
|
-
pb.criteria = Array.from({ length: playbookLevel }, (_, i) =>
|
|
422
|
+
pb.criteria = Array.from({ length: playbookLevel }, (_, i) =>
|
|
423
|
+
crit(`pb-${i}`)
|
|
424
|
+
);
|
|
297
425
|
pb.stages.forEach((s: Record<string, any>) => {
|
|
298
|
-
s.criteria = Array.from({ length: perStage }, (_, i) =>
|
|
426
|
+
s.criteria = Array.from({ length: perStage }, (_, i) =>
|
|
427
|
+
crit(`${s.key}-${i}`)
|
|
428
|
+
);
|
|
299
429
|
});
|
|
300
430
|
});
|
|
301
431
|
|
|
@@ -306,7 +436,9 @@ describe("process contract — a session keeps at most MAX_SESSION_CRITERIA crit
|
|
|
306
436
|
|
|
307
437
|
it("one over the cap is refused (the pod drops the extra one silently)", () => {
|
|
308
438
|
// 3 + 2 × 5 = 13
|
|
309
|
-
expect(rulesOf(withCriteria(3, 5))).toEqual([
|
|
439
|
+
expect(rulesOf(withCriteria(3, 5))).toEqual([
|
|
440
|
+
"playbook-criteria-over-session-cap",
|
|
441
|
+
]);
|
|
310
442
|
});
|
|
311
443
|
|
|
312
444
|
it("a key repeated across stages counts once, as the pod keeps it once", () => {
|
|
@@ -322,23 +454,37 @@ const BACKEND_PLAYBOOKS = resolve(
|
|
|
322
454
|
dirname(fileURLToPath(import.meta.url)),
|
|
323
455
|
"../../../../synap-backend/packages/playbooks/src/index.ts"
|
|
324
456
|
);
|
|
325
|
-
describe.skipIf(!existsSync(BACKEND_PLAYBOOKS))(
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
457
|
+
describe.skipIf(!existsSync(BACKEND_PLAYBOOKS))(
|
|
458
|
+
"MAX_SESSION_CRITERIA mirrors the pod's cap",
|
|
459
|
+
() => {
|
|
460
|
+
if (!existsSync(BACKEND_PLAYBOOKS))
|
|
461
|
+
console.warn(
|
|
462
|
+
`[process-contract] SKIP: no synap-backend checkout at ${BACKEND_PLAYBOOKS}`
|
|
463
|
+
);
|
|
464
|
+
it("equals @synap/playbooks MAX_SESSION_CRITERIA", () => {
|
|
465
|
+
const m = readFileSync(BACKEND_PLAYBOOKS, "utf8").match(
|
|
466
|
+
/export const MAX_SESSION_CRITERIA = (\d+);/
|
|
467
|
+
);
|
|
468
|
+
expect(
|
|
469
|
+
m,
|
|
470
|
+
"the pod's MAX_SESSION_CRITERIA declaration was not found"
|
|
471
|
+
).not.toBeNull();
|
|
472
|
+
expect(MAX_SESSION_CRITERIA).toBe(Number(m![1]));
|
|
473
|
+
});
|
|
474
|
+
}
|
|
475
|
+
);
|
|
334
476
|
|
|
335
477
|
describe("process contract — the shipped corpus", () => {
|
|
336
478
|
it("non-vacuity: Content OS declares the contract, and the whole corpus passes it", () => {
|
|
337
479
|
const corpus = readYamlTemplates().map((t) => t.data as WorkspaceYaml);
|
|
338
480
|
const contentOs = corpus.find((t) => t.meta.slug === "content-os")!;
|
|
339
|
-
const produce = contentOs.playbooks!.find(
|
|
481
|
+
const produce = contentOs.playbooks!.find(
|
|
482
|
+
(p) => p.name === "Produce Content"
|
|
483
|
+
)!;
|
|
340
484
|
expect(produce.subjectProfile).toEqual({ profileSlug: "post" });
|
|
341
|
-
expect(
|
|
485
|
+
expect(
|
|
486
|
+
contentOs.profiles.find((p) => p.slug === "post")?.lifecycle?.property
|
|
487
|
+
).toBe("post-status");
|
|
342
488
|
// D2: two statuses held while worked (In Draft, Review), four reached on
|
|
343
489
|
// approval (Briefed, Scripted, Scheduled, Published).
|
|
344
490
|
expect(produce.stages!.filter((s) => s.subjectStatus).length).toBe(2);
|