@synap-core/workspace-templates 0.55.0 → 0.57.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/dist/wire.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { g as PackageDefinitionOutput, X as WorkspaceDefinitionInput } from './define-Dto5_E47.js';
1
+ import { g as PackageDefinitionOutput, X as WorkspaceDefinitionInput } from './define-KudS9Ja_.js';
2
2
  import '@synap-core/types/presentation';
3
3
  import '@synap-core/types/space-brief';
4
4
  import '@synap-core/types/capability-intents';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synap-core/workspace-templates",
3
- "version": "0.55.0",
3
+ "version": "0.57.0",
4
4
  "type": "module",
5
5
  "description": "Canonical workspace definitions — YAML source + typed exports for browser, backend, CLI, and marketplace",
6
6
  "repository": {
@@ -96,10 +96,11 @@ page becomes one frame) and every save writes 3.
96
96
  "page": {
97
97
  "root": { "props": {} },
98
98
  "content": [
99
- { "type": "Stack", "props": { "id": "s1", "gap": "space-300", "padding": "space-400", "children": [
100
- { "type": "Heading", "props": { "id": "h1", "text": "Welcome back", "level": "title" } },
101
- { "type": "SpatialButton", "props": { "id": "b1", "variant": "primary", "children": [
102
- { "type": "Text", "props": { "id": "t1", "text": "Continue" } } ] } } ] } }
99
+ { "type": "Section", "props": { "id": "sec1", "children": [
100
+ { "type": "Stack", "props": { "id": "s1", "gap": "space-300", "children": [
101
+ { "type": "Heading", "props": { "id": "h1", "text": "Welcome back", "level": "title" } },
102
+ { "type": "SpatialButton", "props": { "id": "b1", "variant": "primary", "children": [
103
+ { "type": "Text", "props": { "id": "t1", "text": "Continue" } } ] } } ] } } ] } }
103
104
  ]
104
105
  }
105
106
  }
@@ -112,8 +113,16 @@ page becomes one frame) and every save writes 3.
112
113
  the frame grows with its content.
113
114
  - Each `page` obeys section 2: real components only, a `props.id` unique within its frame, no hex, rgb, pixel value or
114
115
  font family.
115
- - Layout inside a frame is FLOW ONLY: stack blocks with `Stack`, `Row`, `Grid`, `Box`. A component never
116
- gets its own x or y.
116
+ - Layout inside a frame is FLOW ONLY on a column grid: content goes in a `Section` (a band holding the
117
+ page's grid: 12 columns at 1024 px and wider, 8 from 600, 4 below); arrange inside with `Stack`, `Row`,
118
+ `Grid` (on the page's columns, a subgrid inside a Section), `Box`. A component never gets its own x or y.
119
+ - A block in a `Section` or `Grid` may carry `span` (`{ "compact": 1-4, "medium": 1-8, "expanded": 1-12 }`,
120
+ absent = the whole row) and `hide` (`{ "<class>": true }`); nothing else changes per width. Section
121
+ spacing and the page's side margin are the brand's tokens, never a prop.
122
+ - To show a screen at several widths, add viewport frames: `{ "id": "f2", "name": "Phone", "x": 1600,
123
+ "y": 0, "w": 390, "h": 844, "pageOf": "f1", "page": { "root": { "props": {} }, "content": [] } }` shows
124
+ f1's page at 390. Never copy a page into a second frame for another width.
125
+ - `Grid` has no `columns` prop (dropped and named on read).
117
126
  - Layout blocks take exact values, never pixels: `gap`, `padding`, `paddingX`, `paddingY` take `none` or a
118
127
  spacing name (`space-025`, `space-050`, `space-075`, `space-100`, `space-125`, `space-150`, `space-200`,
119
128
  `space-250`, `space-300`, `space-400`, `space-500`, `space-600`, `space-800`, `space-1000`,
@@ -508,6 +508,7 @@ profiles:
508
508
  inputType: textarea
509
509
  - slug: token-json
510
510
  label: Tokens JSON
511
+ description: A W3C DTCG 2025.10 token file (Synap's own paths, e.g. space.space-200, radius.radius-container, grid.grid-columns-expanded) whose values are this brand's. The Design app draws a project's frames in it; a file that is not DTCG is kept, but frames keep Synap's values.
511
512
  valueType: string
512
513
  inputType: textarea
513
514
  - slug: token-css
package/src/builder.yaml CHANGED
@@ -48,10 +48,13 @@ meta:
48
48
  label: Product
49
49
  # The ONE primary output (One model decision 3): the feature is what the dev loop ships (Build a change works one).
50
50
  primary: devplane_feature
51
+ # A story and a UI design are worked here to serve the feature, not outputs of their own.
51
52
  produces:
52
53
  - profile: devplane_feature
53
54
  - profile: devplane_story
55
+ as: helper
54
56
  - profile: ui-design
57
+ as: helper
55
58
 
56
59
  workspace:
57
60
  name: Dev
@@ -1484,7 +1487,7 @@ profiles:
1484
1487
  inputType: text
1485
1488
  - slug: design-json
1486
1489
  label: Design (Puck JSON)
1487
- description: "A canvas (schema-version 3): a board { format, frames[] }, one frame per screen, each frame { id, name, x, y, w, h, page } holding a Puck page ({ content[] of { type, props: { id, … } }, root.props }) in flow layout, layout blocks taking token names, never px. A single screen is a canvas with one frame. Every type, at any depth and in every frame, is a component in the Storybook manifest."
1490
+ description: "A canvas (schema-version 3): a board { format, frames[] }, one frame per screen, each frame { id, name, x, y, w, h, page } holding a Puck page ({ content[] of { type, props: { id, … } }, root.props }) in flow layout on the page's column grid (12 / 8 / 4 columns by the frame's width class: under 600 compact, under 1024 medium, else expanded): a `Section` block is a band holding that grid; a block in a Section or Grid may carry `span` {compact 1-4, medium 1-8, expanded 1-12} and `hide` {<class>: true}; a frame may show another frame's page at its own width (`pageOf: <frameId>`, its own page empty); layout blocks take token names, never px. A single screen is a canvas with one frame. Every type, at any depth and in every frame, is a component in the Storybook manifest."
1488
1491
  valueType: json
1489
1492
  inputType: json
1490
1493
  - slug: components-used
@@ -2117,11 +2120,15 @@ playbooks:
2117
2120
  worktree, commit in verified slices, and run the smallest gate that
2118
2121
  answers for each finished slice, with its negative control; quote the
2119
2122
  output. PR OPENED: open a draft pull request whose body carries the line
2120
- "Pod session: <this session id>", and record it on this session as the
2121
- outcome pr-<repo>-<number> (kind pull_request, ref url); one outcome per
2122
- pull request, and for each a session criterion keyed the same,
2123
+ "Pod session: <this session id>", and complete THIS stage's output
2124
+ pull-request with its url (completeOutput pull-request, ref.url): this
2125
+ step's criterion pr-opened names it, so Checks waits for that one, and
2126
+ the Merged step's criterion merged names it too, so the merge grades it
2127
+ there. A second pull request, in another repo, is its own outcome
2128
+ pr-<repo>-<number> (kind pull_request, ref url), with a session
2129
+ criterion that names it with outputKey pr-<repo>-<number>,
2123
2130
  "<repo>#<number> is merged", checked by the capability
2124
- github_check_pr_merged, so the pod grades the merge itself. CHECKS: read the checks on the pull request's head with
2131
+ github_check_pr_merged, so the pod grades that merge itself. CHECKS: read the checks on the pull request's head with
2125
2132
  github_pr_checks (the github-read capability, on the person's own token)
2126
2133
  or wait for the ci.finished event; a red check sends the work back to
2127
2134
  Build. MERGE: a person merges; never merge and never push to main. The
@@ -2173,14 +2180,16 @@ playbooks:
2173
2180
  category: started
2174
2181
  tier: standard
2175
2182
  subjectStatus: in_review
2176
- goal: 'Open a draft pull request whose body carries the line "Pod session: <this session id>" and record it as the outcome pr-<repo>-<number> with its url.'
2183
+ goal: 'Open a draft pull request whose body carries the line "Pod session: <this session id>" and complete THIS output, pull-request, with its url (completeOutput pull-request, ref.url). A second pull request in another repo is its own outcome pr-<repo>-<number>.'
2177
2184
  expectedOutputs:
2178
- - kind: pull_request
2179
- label: Pull request (outcome pr-<repo>-<number>, ref = its url)
2185
+ - key: pull-request
2186
+ kind: pull_request
2187
+ label: 'Pull request: complete this output with its url (completeOutput pull-request, ref.url)'
2180
2188
  relationToSubject: none
2181
2189
  criteria:
2182
2190
  - key: pr-opened
2183
- statement: A pull request for this change is open and recorded on the session as a pr-<repo>-<number> outcome with its url.
2191
+ statement: A pull request for this change is open and recorded as this stage's pull-request output with its url.
2192
+ outputKey: pull-request
2184
2193
  check: { kind: evidence, evidenceKey: pr-opened }
2185
2194
  - key: pr-names-session
2186
2195
  statement: The pull request body carries the line naming this Pod session.
@@ -2202,10 +2211,11 @@ playbooks:
2202
2211
  name: Merged
2203
2212
  category: started
2204
2213
  tier: standard
2205
- goal: A person merges the pull request; the merge marks the pr-<repo>-<number> outcome met and its criterion of the same key (github_check_pr_merged) grades it on GitHub's own answer. Never merge and never push to main.
2214
+ goal: A person merges the pull request; the merge meets its output, graded by the criterion that names it by outputKey (merged for pull-request; for a second pull request its own, github_check_pr_merged on GitHub's own answer). Never merge and never push to main.
2206
2215
  criteria:
2207
2216
  - key: merged
2208
2217
  statement: The pull request is merged.
2218
+ outputKey: pull-request
2209
2219
  check:
2210
2220
  kind: evidence
2211
2221
  evidenceKey: merged
@@ -2363,17 +2373,18 @@ playbooks:
2363
2373
  - key: change-recorded
2364
2374
  check:
2365
2375
  kind: judge
2366
- statement: 'The change is recorded on the session as an outcome with its url: pr-<repo>-<number> for a public repo, commit-<repo>-<sha8> for a private repo.'
2376
+ statement: 'The change is recorded on the session with its url: the pull-request output of this stage for a public repo (a second PR in another repo: its own outcome pr-<repo>-<number>), commit-<repo>-<sha8> for a private repo.'
2367
2377
  - key: pr-names-session
2368
2378
  check:
2369
2379
  kind: judge
2370
2380
  statement: A pull request body, when there is one, carries the line naming this Pod session.
2371
- description: 'Shared land stage. Public repo (backend, synap-cli): open a DRAFT pull request whose body carries the line "Pod session: <session id>", then record the outcome pr-<repo>-<number> (kind pull_request, ref url). Private repo (app-bases, browser, relay-app, control-plane-api, control-plane-dashboard, synap-bridge): no PR; rebase on origin/main, push the branch and queue the smallest devbox gate on its full sha with GATE_POD_SESSION set. One session, one PR per repo. Done by the ship flow and the outcome verbs, not by free reasoning. Rules: work-units, github-ci, devbox-gates. Tools: git, gh, devbox queue, synap_update_session. Gate: none.'
2381
+ description: 'Shared land stage. Public repo (backend, synap-cli): open a DRAFT pull request whose body carries the line "Pod session: <session id>", then complete the pull-request output of THIS stage with its url (completeOutput pull-request, ref.url); a second pull request in another repo is its own outcome pr-<repo>-<number> (kind pull_request, ref url). Private repo (app-bases, browser, relay-app, control-plane-api, control-plane-dashboard, synap-bridge): no PR; rebase on origin/main, push the branch and queue the smallest devbox gate on its full sha with GATE_POD_SESSION set. One session, one PR per repo. Done by the ship flow and the outcome verbs, not by free reasoning. Rules: work-units, github-ci, devbox-gates. Tools: git, gh, devbox queue, synap_update_session. Gate: none.'
2372
2382
  tier: standard
2373
2383
  subjectStatus: in_review
2374
2384
  expectedOutputs:
2375
- - kind: pull_request
2376
- label: Draft pull request (outcome pr-<repo>-<number>, ref = its url); public repo only
2385
+ - key: pull-request
2386
+ kind: pull_request
2387
+ label: 'Draft pull request: complete this output with its url (completeOutput pull-request, ref.url); public repo only'
2377
2388
  optional: true
2378
2389
  - key: checks
2379
2390
  gate:
@@ -2547,16 +2558,17 @@ playbooks:
2547
2558
  - key: change-recorded
2548
2559
  check:
2549
2560
  kind: judge
2550
- statement: 'The change is recorded on the session as an outcome with its url: pr-<repo>-<number> for a public repo, commit-<repo>-<sha8> for a private repo.'
2561
+ statement: 'The change is recorded on the session with its url: the pull-request output of this stage for a public repo (a second PR in another repo: its own outcome pr-<repo>-<number>), commit-<repo>-<sha8> for a private repo.'
2551
2562
  - key: pr-names-session
2552
2563
  check:
2553
2564
  kind: judge
2554
2565
  statement: A pull request body, when there is one, carries the line naming this Pod session.
2555
- description: 'Shared land stage. Public repo (backend, synap-cli): open a DRAFT pull request whose body carries the line "Pod session: <session id>", then record the outcome pr-<repo>-<number> (kind pull_request, ref url). Private repo (app-bases, browser, relay-app, control-plane-api, control-plane-dashboard, synap-bridge): no PR; rebase on origin/main, push the branch and queue the smallest devbox gate on its full sha with GATE_POD_SESSION set. One session, one PR per repo. Done by the ship flow and the outcome verbs, not by free reasoning. Rules: work-units, github-ci, devbox-gates. Tools: git, gh, devbox queue, synap_update_session. Gate: none.'
2566
+ description: 'Shared land stage. Public repo (backend, synap-cli): open a DRAFT pull request whose body carries the line "Pod session: <session id>", then complete the pull-request output of THIS stage with its url (completeOutput pull-request, ref.url); a second pull request in another repo is its own outcome pr-<repo>-<number> (kind pull_request, ref url). Private repo (app-bases, browser, relay-app, control-plane-api, control-plane-dashboard, synap-bridge): no PR; rebase on origin/main, push the branch and queue the smallest devbox gate on its full sha with GATE_POD_SESSION set. One session, one PR per repo. Done by the ship flow and the outcome verbs, not by free reasoning. Rules: work-units, github-ci, devbox-gates. Tools: git, gh, devbox queue, synap_update_session. Gate: none.'
2556
2567
  tier: standard
2557
2568
  expectedOutputs:
2558
- - kind: pull_request
2559
- label: Draft pull request (outcome pr-<repo>-<number>, ref = its url); public repo only
2569
+ - key: pull-request
2570
+ kind: pull_request
2571
+ label: 'Draft pull request: complete this output with its url (completeOutput pull-request, ref.url); public repo only'
2560
2572
  optional: true
2561
2573
  - key: checks
2562
2574
  gate:
@@ -2791,16 +2803,17 @@ playbooks:
2791
2803
  - key: change-recorded
2792
2804
  check:
2793
2805
  kind: judge
2794
- statement: 'The change is recorded on the session as an outcome with its url: pr-<repo>-<number> for a public repo, commit-<repo>-<sha8> for a private repo.'
2806
+ statement: 'The change is recorded on the session with its url: the pull-request output of this stage for a public repo (a second PR in another repo: its own outcome pr-<repo>-<number>), commit-<repo>-<sha8> for a private repo.'
2795
2807
  - key: pr-names-session
2796
2808
  check:
2797
2809
  kind: judge
2798
2810
  statement: A pull request body, when there is one, carries the line naming this Pod session.
2799
- description: 'Shared land stage. Public repo (backend, synap-cli): open a DRAFT pull request whose body carries the line "Pod session: <session id>", then record the outcome pr-<repo>-<number> (kind pull_request, ref url). Private repo (app-bases, browser, relay-app, control-plane-api, control-plane-dashboard, synap-bridge): no PR; rebase on origin/main, push the branch and queue the smallest devbox gate on its full sha with GATE_POD_SESSION set. One session, one PR per repo. Done by the ship flow and the outcome verbs, not by free reasoning. Rules: work-units, github-ci, devbox-gates. Tools: git, gh, devbox queue, synap_update_session. Gate: none.'
2811
+ description: 'Shared land stage. Public repo (backend, synap-cli): open a DRAFT pull request whose body carries the line "Pod session: <session id>", then complete the pull-request output of THIS stage with its url (completeOutput pull-request, ref.url); a second pull request in another repo is its own outcome pr-<repo>-<number> (kind pull_request, ref url). Private repo (app-bases, browser, relay-app, control-plane-api, control-plane-dashboard, synap-bridge): no PR; rebase on origin/main, push the branch and queue the smallest devbox gate on its full sha with GATE_POD_SESSION set. One session, one PR per repo. Done by the ship flow and the outcome verbs, not by free reasoning. Rules: work-units, github-ci, devbox-gates. Tools: git, gh, devbox queue, synap_update_session. Gate: none.'
2800
2812
  tier: standard
2801
2813
  expectedOutputs:
2802
- - kind: pull_request
2803
- label: Draft pull request (outcome pr-<repo>-<number>, ref = its url); public repo only
2814
+ - key: pull-request
2815
+ kind: pull_request
2816
+ label: 'Draft pull request: complete this output with its url (completeOutput pull-request, ref.url); public repo only'
2804
2817
  optional: true
2805
2818
  - key: checks
2806
2819
  gate:
@@ -2952,16 +2965,17 @@ playbooks:
2952
2965
  - key: change-recorded
2953
2966
  check:
2954
2967
  kind: judge
2955
- statement: 'The change is recorded on the session as an outcome with its url: pr-<repo>-<number> for a public repo, commit-<repo>-<sha8> for a private repo.'
2968
+ statement: 'The change is recorded on the session with its url: the pull-request output of this stage for a public repo (a second PR in another repo: its own outcome pr-<repo>-<number>), commit-<repo>-<sha8> for a private repo.'
2956
2969
  - key: pr-names-session
2957
2970
  check:
2958
2971
  kind: judge
2959
2972
  statement: A pull request body, when there is one, carries the line naming this Pod session.
2960
- description: 'Shared land stage. Public repo (backend, synap-cli): open a DRAFT pull request whose body carries the line "Pod session: <session id>", then record the outcome pr-<repo>-<number> (kind pull_request, ref url). Private repo (app-bases, browser, relay-app, control-plane-api, control-plane-dashboard, synap-bridge): no PR; rebase on origin/main, push the branch and queue the smallest devbox gate on its full sha with GATE_POD_SESSION set. One session, one PR per repo. Done by the ship flow and the outcome verbs, not by free reasoning. Rules: work-units, github-ci, devbox-gates. Tools: git, gh, devbox queue, synap_update_session. Gate: none.'
2973
+ description: 'Shared land stage. Public repo (backend, synap-cli): open a DRAFT pull request whose body carries the line "Pod session: <session id>", then complete the pull-request output of THIS stage with its url (completeOutput pull-request, ref.url); a second pull request in another repo is its own outcome pr-<repo>-<number> (kind pull_request, ref url). Private repo (app-bases, browser, relay-app, control-plane-api, control-plane-dashboard, synap-bridge): no PR; rebase on origin/main, push the branch and queue the smallest devbox gate on its full sha with GATE_POD_SESSION set. One session, one PR per repo. Done by the ship flow and the outcome verbs, not by free reasoning. Rules: work-units, github-ci, devbox-gates. Tools: git, gh, devbox queue, synap_update_session. Gate: none.'
2961
2974
  tier: standard
2962
2975
  expectedOutputs:
2963
- - kind: pull_request
2964
- label: Draft pull request (outcome pr-<repo>-<number>, ref = its url); public repo only
2976
+ - key: pull-request
2977
+ kind: pull_request
2978
+ label: 'Draft pull request: complete this output with its url (completeOutput pull-request, ref.url); public repo only'
2965
2979
  optional: true
2966
2980
  - key: checks
2967
2981
  gate:
package/src/crm.yaml CHANGED
@@ -2409,9 +2409,11 @@ playbooks:
2409
2409
  table (entities.list, entities.get, views.list, profiles.list,
2410
2410
  lifecycle.board, flow.of, lifecycle.throughput, attention.needsYou,
2411
2411
  attention.count, sessions.list, lifecycle.home, lifecycle.moving,
2412
- documents.get, lens.page) and only that op's params; the host stamps
2413
- the space, so never put a workspaceId, a token, a pod URL or a fetch in
2414
- the page. What the bridge reads stays live: query it in the page, never
2412
+ documents.get, lens.page, sessions.get, playbook.process,
2413
+ playbook.scorecard, project.pillars) and only that op's params; the
2414
+ host stamps the space, so never put a workspaceId, a token, a pod URL
2415
+ or a fetch in the page. What the bridge reads stays live: query it in
2416
+ the page, never
2415
2417
  paste its rows. What it cannot read yet (messages, replies, sends: the
2416
2418
  bridge has no message op) you read now with your own tools
2417
2419
  (synap_get_channel, synap_get_entities) and write into the page as a
@@ -9,6 +9,8 @@
9
9
  * lifecycle may be declared there (a role foundation owns);
10
10
  * - one `primary` output per producing space, one of `produces`; a library
11
11
  * names none (`intent-primary-*`, One model decision 3);
12
+ * - a produced kind's `as` (output or helper): the primary is never a
13
+ * helper, and both doors carry it;
12
14
  * - (the catalog header half lives in `schema/intent-header.test.ts`);
13
15
  * - BOTH install doors carry it (top-level `intent` on both), driven through
14
16
  * the real converters.
@@ -121,6 +123,25 @@ describe("meta.intent — validator rules", () => {
121
123
  expect(errs.map((e) => e.rule)).toEqual(["intent-primary-library"]);
122
124
  });
123
125
 
126
+ // Negative control: goes red with the `as` checks removed from checkIntent.
127
+ it("a helper kind: the primary is never a helper; an unknown `as` is a shape error", () => {
128
+ const profiles = [lifecycled("feature"), lifecycled("story")];
129
+ const ok = make("t", profiles, {
130
+ label: "P",
131
+ primary: "feature",
132
+ produces: [{ profile: "feature", as: "output" }, { profile: "story", as: "helper" }],
133
+ });
134
+ expect(intentErrors(ok)).toEqual([]);
135
+ const helperPrimary = make("t", profiles, { label: "P", primary: "feature", produces: [{ profile: "feature", as: "helper" }, { profile: "story" }] });
136
+ expect(intentErrors(helperPrimary).map((e) => e.rule)).toEqual(["intent-primary-helper"]);
137
+ const unknownAs = make("t", profiles, {
138
+ label: "P",
139
+ primary: "feature",
140
+ produces: [{ profile: "feature" }, { profile: "story", as: "sidekick" }],
141
+ } as unknown as TemplateIntent);
142
+ expect(intentErrors(unknownAs).map((e) => e.rule)).toEqual(["intent-shape"]);
143
+ });
144
+
124
145
  it("an unresolvable dependency does not fabricate an unknown-profile error", () => {
125
146
  const t = make("t", [lifecycled("thing")], { label: "P", produces: [{ profile: "elsewhere" }] }, ["not-in-corpus"]);
126
147
  expect(intentErrors(t)).toEqual([]);
@@ -141,6 +162,17 @@ describe("meta.intent — both install doors carry it", () => {
141
162
  expect(toWorkspaceDefinition(t).definition.intent).toEqual(intent);
142
163
  });
143
164
 
165
+ it("a helper kind reaches both doors as declared", () => {
166
+ const helper = {
167
+ label: "Product",
168
+ primary: "thing",
169
+ produces: [{ profile: "thing" }, { profile: "step", as: "helper" as const }],
170
+ };
171
+ const h = make("t", [lifecycled("thing"), lifecycled("step")], helper);
172
+ expect(toPackageDefinition(h).intent).toEqual(helper);
173
+ expect(toWorkspaceDefinition(h).definition.intent).toEqual(helper);
174
+ });
175
+
144
176
  it("no intent → no field on either door", () => {
145
177
  const none = make("t", [lifecycled("thing")]);
146
178
  expect("intent" in toPackageDefinition(none)).toBe(false);
@@ -176,6 +208,15 @@ describe("meta.intent — the catalog", () => {
176
208
  expect(table["research-base"]).toEqual(["Research", "hypothesis", "research-finding"]);
177
209
  });
178
210
 
211
+ it("Builder: stories and UI designs are helpers of the feature", () => {
212
+ const builder = corpus.find((t) => t.meta.slug === "builder-workspace")!;
213
+ expect(builder.meta.intent!.produces).toEqual([
214
+ { profile: "devplane_feature" },
215
+ { profile: "devplane_story", as: "helper" },
216
+ { profile: "ui-design", as: "helper" },
217
+ ]);
218
+ });
219
+
179
220
  it("every producing space names its primary (One model decision 3)", () => {
180
221
  const primaries = Object.fromEntries(corpus.filter((t) => t.meta.intent?.produces?.length).map((t) => [t.meta.slug, t.meta.intent!.primary]));
181
222
  expect(primaries).toEqual({
@@ -204,3 +204,86 @@ describe("Ship a change - binds with no feature (structural guard P4 d)", () =>
204
204
  expect(pb.goalTemplate).not.toContain("({feature})");
205
205
  });
206
206
  });
207
+
208
+ describe("the merge criterion names the PR outcome (work-model W4)", () => {
209
+ // The pod pairs a criterion with an outcome by `outputKey` only; a shared key
210
+ // pairs nothing, so a text that teaches "keyed the same" leaves the merge
211
+ // check without its PR (the evaluator hands over no outcome).
212
+ const cap = JSON.parse(
213
+ readFileSync(join(HERE, "../capabilities/github-read.capability.json"), "utf8")
214
+ ).spec as { skills: { name: string; description: string; code?: string }[] };
215
+ const merged = cap.skills.find((v) => v.name === "github_check_pr_merged");
216
+
217
+ it("Ship a change teaches outputKey pr-<repo>-<number>, never a criterion keyed the same", () => {
218
+ expect(pb.goalTemplate).toContain("outputKey pr-<repo>-<number>");
219
+ const merge = pb.stages.find((s) => s.key === "merge") as unknown as { goal: string };
220
+ expect(merge.goal).toContain("by outputKey");
221
+ for (const text of [pb.goalTemplate, merge.goal]) {
222
+ expect(text).not.toMatch(/keyed the same|of the same key/);
223
+ }
224
+ });
225
+
226
+ it("github_check_pr_merged tells the caller to name the outcome by outputKey", () => {
227
+ expect(merged).toBeDefined();
228
+ for (const text of [merged!.description, merged!.code ?? ""]) {
229
+ expect(text).toContain("outputKey");
230
+ expect(text).not.toMatch(/key the criterion like/i);
231
+ }
232
+ });
233
+ });
234
+
235
+ describe("a declared PR slot is completed, never shadowed by a new outcome (W6)", () => {
236
+ // The session check gate reads the outputs the stage left declares
237
+ // (backend#1179): a PR recorded only as a NEW outcome pr-<repo>-<n> leaves the
238
+ // declared slot owed and holds the run. Every catalog stage that declares a
239
+ // pull request tells the agent to complete THAT output.
240
+ type Stage = {
241
+ key: string;
242
+ goal?: string;
243
+ description?: string;
244
+ expectedOutputs?: { key?: string; kind?: string; label?: string }[];
245
+ };
246
+ const declaring = (getWorkspaceTemplate("builder-workspace")!.playbooks ?? []).flatMap((p) => {
247
+ const q = p as unknown as { name: string; goalTemplate?: string; stages?: Stage[] };
248
+ return (q.stages ?? []).flatMap((stage) =>
249
+ (stage.expectedOutputs ?? [])
250
+ .filter((o) => o.kind === "pull_request")
251
+ .map((out) => ({ playbook: q.name, goalTemplate: q.goalTemplate ?? "", stage, out }))
252
+ );
253
+ });
254
+
255
+ it("Ship a change: the PR step's and the merge step's criteria name the declared slot (W6: a step counts only its own and earlier criteria)", () => {
256
+ const named = pb.stages.flatMap((st) =>
257
+ ((st as unknown as { criteria?: { key: string; outputKey?: string }[] }).criteria ?? [])
258
+ .filter((c) => c.outputKey === "pull-request")
259
+ .map((c) => `${st.key}/${c.key}`)
260
+ );
261
+ expect(named).toEqual(["pr-opened/pr-opened", "merge/merged"]);
262
+ });
263
+
264
+ it("finds the stages it checks (an empty scan is a blind guard)", () => {
265
+ expect(declaring.map((d) => d.playbook)).toEqual(
266
+ expect.arrayContaining(["Ship a change", "Build a change", "Fix a bug", "Maintain", "Fix main red"])
267
+ );
268
+ });
269
+
270
+ it("each names its slot and says to complete that output with the PR's url", () => {
271
+ for (const { playbook, goalTemplate, stage, out } of declaring) {
272
+ const where = `${playbook} / ${stage.key}`;
273
+ const text = `${stage.goal ?? ""} ${stage.description ?? ""}`;
274
+ expect(out.label, where).not.toMatch(/outcome pr-<repo>-<number>/);
275
+ if (out.key) {
276
+ expect(out.key, where).toBe("pull-request");
277
+ expect(out.label, where).toContain(
278
+ "complete this output with its url (completeOutput pull-request, ref.url)"
279
+ );
280
+ expect(text, where).toMatch(
281
+ /complete (THIS output, pull-request,|the pull-request output of THIS stage) with its url/
282
+ );
283
+ } else {
284
+ // A slot named by its label (Merged fix, Fix PR): the text names THAT output.
285
+ expect(`${text} ${goalTemplate}`, where).toContain(out.label!);
286
+ }
287
+ }
288
+ });
289
+ });