@synap-core/workspace-templates 0.67.0 → 0.68.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/index.js CHANGED
@@ -3688,6 +3688,20 @@ var DATA = {
3688
3688
  "devplane.workspace"
3689
3689
  ]
3690
3690
  },
3691
+ "dependencies": [
3692
+ {
3693
+ "slug": "designing-with-real-components",
3694
+ "kind": "skill",
3695
+ "relation": "require",
3696
+ "reason": "How a screen is designed as Puck JSON from the real components, and carried to an implemented pull request."
3697
+ },
3698
+ {
3699
+ "slug": "design-critique",
3700
+ "kind": "skill",
3701
+ "relation": "require",
3702
+ "reason": "The rubric every design and every UI component review is judged by (checked, pattern and opinion rules with stable ids)."
3703
+ }
3704
+ ],
3691
3705
  "profiles": [
3692
3706
  {
3693
3707
  "slug": "devplane_app",
@@ -6086,6 +6100,422 @@ var DATA = {
6086
6100
  "inputType": "textarea"
6087
6101
  }
6088
6102
  ]
6103
+ },
6104
+ {
6105
+ "slug": "ui-component",
6106
+ "displayName": "UI component",
6107
+ "icon": "component",
6108
+ "color": "violet",
6109
+ "description": "A component of an app's Storybook (from a primitive to a whole section), mirrored by the Storybook sync, with its stories, screenshot, props, composition and review state.",
6110
+ "entityScope": "pod",
6111
+ "lifecycle": {
6112
+ "property": "ui-status",
6113
+ "options": [
6114
+ {
6115
+ "key": "proposed",
6116
+ "category": "open"
6117
+ },
6118
+ {
6119
+ "key": "stable",
6120
+ "category": "active"
6121
+ },
6122
+ {
6123
+ "key": "consolidate",
6124
+ "category": "active"
6125
+ },
6126
+ {
6127
+ "key": "deprecated",
6128
+ "category": "done",
6129
+ "humanOnly": true
6130
+ },
6131
+ {
6132
+ "key": "gone",
6133
+ "category": "lost"
6134
+ }
6135
+ ]
6136
+ },
6137
+ "presentation": {
6138
+ "family": "media",
6139
+ "media": {
6140
+ "source": {
6141
+ "entityRef": "screenshot"
6142
+ },
6143
+ "kind": "image"
6144
+ }
6145
+ },
6146
+ "properties": [
6147
+ {
6148
+ "slug": "ui-status",
6149
+ "label": "Status",
6150
+ "valueType": "string",
6151
+ "inputType": "select",
6152
+ "enumValues": [
6153
+ "proposed",
6154
+ "stable",
6155
+ "consolidate",
6156
+ "deprecated",
6157
+ "gone"
6158
+ ],
6159
+ "constraints": {
6160
+ "defaultValue": "proposed"
6161
+ }
6162
+ },
6163
+ {
6164
+ "slug": "component-level",
6165
+ "label": "Level",
6166
+ "description": "How big it is. primitive (a button), composite (a card, a row), section (a band of a page), layout (a frame other components sit in).",
6167
+ "valueType": "string",
6168
+ "inputType": "select",
6169
+ "enumValues": [
6170
+ "primitive",
6171
+ "composite",
6172
+ "section",
6173
+ "layout"
6174
+ ]
6175
+ },
6176
+ {
6177
+ "slug": "source-path",
6178
+ "label": "Source file",
6179
+ "description": "The repo path of the file that exports it (written by the sync).",
6180
+ "valueType": "string",
6181
+ "inputType": "text"
6182
+ },
6183
+ {
6184
+ "slug": "export-name",
6185
+ "label": "Export",
6186
+ "description": "The name it is exported as from its source file (written by the sync).",
6187
+ "valueType": "string",
6188
+ "inputType": "text"
6189
+ },
6190
+ {
6191
+ "slug": "story-ids",
6192
+ "label": "Stories",
6193
+ "description": "The Storybook story ids that show it (written by the sync).",
6194
+ "valueType": "array",
6195
+ "inputType": "text"
6196
+ },
6197
+ {
6198
+ "slug": "story-url",
6199
+ "label": "Story link",
6200
+ "valueType": "string",
6201
+ "inputType": "url"
6202
+ },
6203
+ {
6204
+ "slug": "screenshot",
6205
+ "label": "Screenshot",
6206
+ "valueType": "entity_id",
6207
+ "targetProfileSlug": "file",
6208
+ "inputType": "entity_select",
6209
+ "description": "A render of its main story, for review at a glance."
6210
+ },
6211
+ {
6212
+ "slug": "props-summary",
6213
+ "label": "Props",
6214
+ "description": "Its props as the Storybook manifest declares them: a list of { name, type, required, default } (written by the sync).",
6215
+ "valueType": "json",
6216
+ "inputType": "json"
6217
+ },
6218
+ {
6219
+ "slug": "component-family",
6220
+ "label": "Family",
6221
+ "description": "The inventory family it belongs to (apps/storybook/inventory/components.json), shared by its copies and variants.",
6222
+ "valueType": "string",
6223
+ "inputType": "text"
6224
+ },
6225
+ {
6226
+ "slug": "kit",
6227
+ "label": "Kit",
6228
+ "description": "The component kit it is part of, e.g. synap (spatial-ui) or an app's own kit.",
6229
+ "valueType": "string",
6230
+ "inputType": "text"
6231
+ },
6232
+ {
6233
+ "slug": "design-app",
6234
+ "label": "App",
6235
+ "valueType": "entity_id",
6236
+ "targetProfileSlug": "devplane_app",
6237
+ "inputType": "entity_select",
6238
+ "description": "The app (devplane_app) whose Storybook it comes from."
6239
+ },
6240
+ {
6241
+ "slug": "source-hash",
6242
+ "label": "Source hash",
6243
+ "description": "A content hash of the component at the last sync (its source or what its stories show). It differs from reviewed-hash when the component changed since its last review.",
6244
+ "valueType": "string",
6245
+ "inputType": "text"
6246
+ },
6247
+ {
6248
+ "slug": "reviewed-hash",
6249
+ "label": "Reviewed hash",
6250
+ "description": 'The source-hash it had when it was last reviewed ("Review a UI component" writes it at the end of a review).',
6251
+ "valueType": "string",
6252
+ "inputType": "text"
6253
+ },
6254
+ {
6255
+ "slug": "review-state",
6256
+ "label": "Review",
6257
+ "description": "fresh (reviewed at its current source), changed (its source moved since the last review; the sync sets it), in-review (a review is running).",
6258
+ "valueType": "string",
6259
+ "inputType": "select",
6260
+ "enumValues": [
6261
+ "fresh",
6262
+ "changed",
6263
+ "in-review"
6264
+ ]
6265
+ }
6266
+ ]
6267
+ },
6268
+ {
6269
+ "slug": "ui-page",
6270
+ "displayName": "Page",
6271
+ "icon": "app-window",
6272
+ "color": "violet",
6273
+ "description": "A page or phone screen of an app, as its Storybook page story shows it, mirrored by the Storybook sync with its template, layout, route and screenshot.",
6274
+ "entityScope": "pod",
6275
+ "lifecycle": {
6276
+ "property": "ui-status",
6277
+ "options": [
6278
+ {
6279
+ "key": "proposed",
6280
+ "category": "open"
6281
+ },
6282
+ {
6283
+ "key": "stable",
6284
+ "category": "active"
6285
+ },
6286
+ {
6287
+ "key": "consolidate",
6288
+ "category": "active"
6289
+ },
6290
+ {
6291
+ "key": "deprecated",
6292
+ "category": "done",
6293
+ "humanOnly": true
6294
+ },
6295
+ {
6296
+ "key": "gone",
6297
+ "category": "lost"
6298
+ }
6299
+ ]
6300
+ },
6301
+ "presentation": {
6302
+ "family": "media",
6303
+ "media": {
6304
+ "source": {
6305
+ "entityRef": "screenshot"
6306
+ },
6307
+ "kind": "image"
6308
+ }
6309
+ },
6310
+ "properties": [
6311
+ {
6312
+ "slug": "ui-status",
6313
+ "label": "Status",
6314
+ "valueType": "string",
6315
+ "inputType": "select",
6316
+ "enumValues": [
6317
+ "proposed",
6318
+ "stable",
6319
+ "consolidate",
6320
+ "deprecated",
6321
+ "gone"
6322
+ ],
6323
+ "constraints": {
6324
+ "defaultValue": "proposed"
6325
+ }
6326
+ },
6327
+ {
6328
+ "slug": "surface",
6329
+ "label": "Surface",
6330
+ "valueType": "string",
6331
+ "inputType": "select",
6332
+ "enumValues": [
6333
+ "desktop",
6334
+ "phone"
6335
+ ]
6336
+ },
6337
+ {
6338
+ "slug": "page-template",
6339
+ "label": "Template",
6340
+ "description": "What the page is for, one of the page grammar's nine templates.",
6341
+ "valueType": "string",
6342
+ "inputType": "select",
6343
+ "enumValues": [
6344
+ "hub",
6345
+ "collection",
6346
+ "object",
6347
+ "review",
6348
+ "conversation",
6349
+ "session-room",
6350
+ "view",
6351
+ "settings",
6352
+ "island"
6353
+ ]
6354
+ },
6355
+ {
6356
+ "slug": "page-layout",
6357
+ "label": "Layout",
6358
+ "description": "How its regions sit, one of the page grammar's six layouts.",
6359
+ "valueType": "string",
6360
+ "inputType": "select",
6361
+ "enumValues": [
6362
+ "column",
6363
+ "column-rail",
6364
+ "list-detail",
6365
+ "main-pane",
6366
+ "fill",
6367
+ "cover"
6368
+ ]
6369
+ },
6370
+ {
6371
+ "slug": "route",
6372
+ "label": "Route",
6373
+ "description": "Where it opens in the app, e.g. /work/:sessionId.",
6374
+ "valueType": "string",
6375
+ "inputType": "text"
6376
+ },
6377
+ {
6378
+ "slug": "story-id",
6379
+ "label": "Story",
6380
+ "description": "The Storybook story id of the page (written by the sync).",
6381
+ "valueType": "string",
6382
+ "inputType": "text"
6383
+ },
6384
+ {
6385
+ "slug": "story-url",
6386
+ "label": "Story link",
6387
+ "valueType": "string",
6388
+ "inputType": "url"
6389
+ },
6390
+ {
6391
+ "slug": "screenshot",
6392
+ "label": "Screenshot",
6393
+ "valueType": "entity_id",
6394
+ "targetProfileSlug": "file",
6395
+ "inputType": "entity_select",
6396
+ "description": "A render of the page story."
6397
+ },
6398
+ {
6399
+ "slug": "source-path",
6400
+ "label": "Source file",
6401
+ "valueType": "string",
6402
+ "inputType": "text"
6403
+ },
6404
+ {
6405
+ "slug": "source-hash",
6406
+ "label": "Source hash",
6407
+ "description": "A hash of its source and story files at the last sync.",
6408
+ "valueType": "string",
6409
+ "inputType": "text"
6410
+ },
6411
+ {
6412
+ "slug": "design-app",
6413
+ "label": "App",
6414
+ "valueType": "entity_id",
6415
+ "targetProfileSlug": "devplane_app",
6416
+ "inputType": "entity_select",
6417
+ "description": "The app (devplane_app) the page belongs to."
6418
+ }
6419
+ ]
6420
+ },
6421
+ {
6422
+ "slug": "user-flow",
6423
+ "displayName": "User flow",
6424
+ "icon": "route",
6425
+ "color": "violet",
6426
+ "description": "A person's journey through an app's pages toward what they came to do, from where they enter to when it is done; the pages it traverses are linked.",
6427
+ "entityScope": "pod",
6428
+ "lifecycle": {
6429
+ "property": "flow-status",
6430
+ "options": [
6431
+ {
6432
+ "key": "draft",
6433
+ "category": "open"
6434
+ },
6435
+ {
6436
+ "key": "designed",
6437
+ "category": "active"
6438
+ },
6439
+ {
6440
+ "key": "built",
6441
+ "category": "active"
6442
+ },
6443
+ {
6444
+ "key": "live",
6445
+ "category": "done",
6446
+ "humanOnly": true
6447
+ },
6448
+ {
6449
+ "key": "retired",
6450
+ "category": "lost",
6451
+ "humanOnly": true
6452
+ }
6453
+ ]
6454
+ },
6455
+ "properties": [
6456
+ {
6457
+ "slug": "flow-status",
6458
+ "label": "Status",
6459
+ "valueType": "string",
6460
+ "inputType": "select",
6461
+ "enumValues": [
6462
+ "draft",
6463
+ "designed",
6464
+ "built",
6465
+ "live",
6466
+ "retired"
6467
+ ],
6468
+ "constraints": {
6469
+ "defaultValue": "draft"
6470
+ }
6471
+ },
6472
+ {
6473
+ "slug": "need",
6474
+ "label": "Need",
6475
+ "description": "The job the person comes to do, in their words.",
6476
+ "valueType": "string",
6477
+ "inputType": "textarea"
6478
+ },
6479
+ {
6480
+ "slug": "entry",
6481
+ "label": "Entry",
6482
+ "description": "Where they enter (a door: a link, a notification, a page).",
6483
+ "valueType": "string",
6484
+ "inputType": "text"
6485
+ },
6486
+ {
6487
+ "slug": "done-when",
6488
+ "label": "Done when",
6489
+ "description": "What the person sees when the journey has succeeded.",
6490
+ "valueType": "string",
6491
+ "inputType": "textarea"
6492
+ },
6493
+ {
6494
+ "slug": "surface",
6495
+ "label": "Surface",
6496
+ "valueType": "string",
6497
+ "inputType": "select",
6498
+ "enumValues": [
6499
+ "desktop",
6500
+ "phone",
6501
+ "both"
6502
+ ]
6503
+ },
6504
+ {
6505
+ "slug": "flow-source-id",
6506
+ "label": "Flow source",
6507
+ "description": "The flow id in the Storybook flows (apps/storybook/flows), when the sync wrote it.",
6508
+ "valueType": "string",
6509
+ "inputType": "text"
6510
+ },
6511
+ {
6512
+ "slug": "steps",
6513
+ "label": "Steps",
6514
+ "description": "The steps in order: a list of { page, label }, where page is the ui-page key (page:<story id>) and label says what the person does there.",
6515
+ "valueType": "json",
6516
+ "inputType": "json"
6517
+ }
6518
+ ]
6089
6519
  }
6090
6520
  ],
6091
6521
  "views": [
@@ -6323,6 +6753,90 @@ var DATA = {
6323
6753
  "targetProfileSlug": "devplane_system_component",
6324
6754
  "type": "depends_on",
6325
6755
  "label": "Depends on"
6756
+ },
6757
+ {
6758
+ "sourceProfileSlug": "ui-component",
6759
+ "targetProfileSlug": "ui-component",
6760
+ "type": "composed_of",
6761
+ "label": "Made of"
6762
+ },
6763
+ {
6764
+ "sourceProfileSlug": "ui-page",
6765
+ "targetProfileSlug": "ui-component",
6766
+ "type": "composed_of",
6767
+ "label": "Made of"
6768
+ },
6769
+ {
6770
+ "sourceProfileSlug": "ui-component",
6771
+ "targetProfileSlug": "ui-component",
6772
+ "type": "extends",
6773
+ "label": "Variant of"
6774
+ },
6775
+ {
6776
+ "sourceProfileSlug": "user-flow",
6777
+ "targetProfileSlug": "ui-page",
6778
+ "type": "traverses",
6779
+ "label": "Goes through"
6780
+ },
6781
+ {
6782
+ "sourceProfileSlug": "ui-component",
6783
+ "targetProfileSlug": "devplane_app",
6784
+ "type": "belongs_to",
6785
+ "label": "Belongs to"
6786
+ },
6787
+ {
6788
+ "sourceProfileSlug": "ui-page",
6789
+ "targetProfileSlug": "devplane_app",
6790
+ "type": "belongs_to",
6791
+ "label": "Belongs to"
6792
+ },
6793
+ {
6794
+ "sourceProfileSlug": "user-flow",
6795
+ "targetProfileSlug": "devplane_app",
6796
+ "type": "belongs_to",
6797
+ "label": "Belongs to"
6798
+ }
6799
+ ],
6800
+ "relationDefs": [
6801
+ {
6802
+ "slug": "composed_of",
6803
+ "displayName": "Composed of",
6804
+ "description": "The source is made of the target: a capability of sub-capabilities, a UI component of the smaller components it renders, a page of the components on it.",
6805
+ "isDirectional": true,
6806
+ "uiHints": {
6807
+ "category": "hierarchy",
6808
+ "inverseLabel": "Used in"
6809
+ }
6810
+ },
6811
+ {
6812
+ "slug": "extends",
6813
+ "displayName": "Extends",
6814
+ "description": "The source builds on the target: a UI component that is a variant of another (same family, one more option), or a thing that specialises a broader one.",
6815
+ "isDirectional": true,
6816
+ "uiHints": {
6817
+ "category": "hierarchy",
6818
+ "inverseLabel": "Extended by"
6819
+ }
6820
+ },
6821
+ {
6822
+ "slug": "traverses",
6823
+ "displayName": "Traverses",
6824
+ "description": "The source passes through the target on its way: a workflow through system components, a user flow through the pages a person goes through, in order.",
6825
+ "isDirectional": true,
6826
+ "uiHints": {
6827
+ "category": "workflow",
6828
+ "inverseLabel": "Traversed by"
6829
+ }
6830
+ },
6831
+ {
6832
+ "slug": "belongs_to",
6833
+ "displayName": "Belongs to",
6834
+ "description": "The source belongs to the target: an entity to its parent pillar or container, a UI component, page or user flow to the app it is part of.",
6835
+ "isDirectional": true,
6836
+ "uiHints": {
6837
+ "category": "hierarchy",
6838
+ "inverseLabel": "Contains"
6839
+ }
6326
6840
  }
6327
6841
  ],
6328
6842
  "playbooks": [
@@ -8385,6 +8899,525 @@ var DATA = {
8385
8899
  ]
8386
8900
  }
8387
8901
  ]
8902
+ },
8903
+ {
8904
+ "name": "Review a UI component",
8905
+ "description": "Review one UI component of an app's Storybook against the design-critique rubric and decide what to do with it: nothing (fine, the run ends), a rewrite plan (the founder decides on it, nothing is built), or a small fix, built and gated on a branch and shown to the founder. Approving `approve` releases land, publish and done; no later stage asks the person again. Ends with the component marked reviewed at its current source.",
8906
+ "goalTemplate": "Review the UI component {component} and decide what to do with it. Load the design-critique skill first (and designing-with-real-components for a fix). Read the component record: its stories, screenshot, props, composition (composed_of), variants (extends), the pages that use it, its family in the inventory, and its source file at the synced sha; read what the pod already knows about it (recall first). Set review-state to in-review when you start. CRITIQUE: judge each of its stories with the rubric (each finding with its rule id, tier, severity and region); opinions are never applied. VERDICT, which branches before any code: fine ends the run (reviewed-hash = source-hash, review-state fresh, no build); rewrite writes a plan document and stops on the founder's ask, nothing is built; only a small fix goes on. IMPLEMENT and GATE the fix on a branch of the project's repo (nothing reaches main before Approve). APPROVE: the founder sees the before/after of the story, the diff summary and the green gate at the full head sha, and approves once; that releases LAND, PUBLISH and DONE, run through the project's ship actions, never by an agent pushing main by hand. DONE: reviewed-hash = source-hash and review-state fresh. Code facts of the record (name, props, stories, source, composition) belong to the Storybook sync: never edit them on the pod.",
8907
+ "scope": "session",
8908
+ "subjectProfile": {
8909
+ "profileSlug": "ui-component"
8910
+ },
8911
+ "activators": [
8912
+ {
8913
+ "on": "manual",
8914
+ "mode": "propose"
8915
+ },
8916
+ {
8917
+ "on": "schedule",
8918
+ "cron": "0 7 * * 1",
8919
+ "size": "per_thing",
8920
+ "only": {
8921
+ "property": "review-state",
8922
+ "in": [
8923
+ "changed"
8924
+ ]
8925
+ },
8926
+ "mode": "propose",
8927
+ "maxPendingApprovals": 10,
8928
+ "startsPaused": true
8929
+ }
8930
+ ],
8931
+ "params": [
8932
+ {
8933
+ "name": "component",
8934
+ "type": "entity",
8935
+ "label": "UI component",
8936
+ "required": true
8937
+ }
8938
+ ],
8939
+ "executor": "is-agent",
8940
+ "status": "active",
8941
+ "stages": [
8942
+ {
8943
+ "key": "critique",
8944
+ "name": "Critique",
8945
+ "category": "started",
8946
+ "goal": "Set the component's review-state to in-review, then judge each of its stories with the design-critique rubric and write the findings (rule id, tier, severity, confidence, region, evidence) into the critique document.",
8947
+ "expectedOutputs": [
8948
+ {
8949
+ "kind": "document",
8950
+ "label": "Component critique (findings by story, tier and rule id)",
8951
+ "relationToSubject": "relates_to"
8952
+ }
8953
+ ],
8954
+ "criteria": [
8955
+ {
8956
+ "key": "critique-findings-ruled",
8957
+ "statement": "Every finding in the critique names a rule id of the design-critique rubric, a tier, a severity and the story and region it is about.",
8958
+ "check": {
8959
+ "kind": "judge"
8960
+ }
8961
+ },
8962
+ {
8963
+ "key": "critique-every-story",
8964
+ "statement": "Every story id of the component (story-ids) is critiqued or named as skipped with why.",
8965
+ "check": {
8966
+ "kind": "judge"
8967
+ }
8968
+ }
8969
+ ]
8970
+ },
8971
+ {
8972
+ "key": "verdict",
8973
+ "name": "Verdict",
8974
+ "category": "started",
8975
+ "goal": "Decide ONE verdict from the findings, with its reasons; it branches here, before any code. FINE: write reviewed-hash = source-hash and review-state fresh on the component, and stop there: the run ends, nothing is built. REWRITE: write a plan document naming what replaces the component, every caller (the pages and components made of it) and the order of the work; add an outcome owned by the person on this session (owner human, an ask confirming the rewrite) and pause on it; never go on to Implement in this run. SMALL FIX: draw the enhanced version as a ui-design (design-scope component, current-story-id the component's main story, design-goal what the fix achieves) from real components only, and go on to Implement.",
8976
+ "expectedOutputs": [
8977
+ {
8978
+ "kind": "decision",
8979
+ "label": "Review verdict (fine, small fix or rewrite)",
8980
+ "relationToSubject": "relates_to"
8981
+ },
8982
+ {
8983
+ "kind": "ui-design",
8984
+ "label": "Enhanced version (a small fix)",
8985
+ "relationToSubject": "relates_to",
8986
+ "optional": true
8987
+ },
8988
+ {
8989
+ "kind": "document",
8990
+ "label": "Rewrite plan",
8991
+ "relationToSubject": "relates_to",
8992
+ "optional": true
8993
+ }
8994
+ ],
8995
+ "criteria": [
8996
+ {
8997
+ "key": "verdict-one-of-three",
8998
+ "statement": "The verdict is exactly one of fine, small fix or rewrite, and names the findings it rests on.",
8999
+ "check": {
9000
+ "kind": "judge"
9001
+ }
9002
+ },
9003
+ {
9004
+ "key": "verdict-branches-before-code",
9005
+ "statement": "Only a small fix went on to Implement; a fine verdict ended the run with the component marked reviewed, and a rewrite stopped on the person's ask with its plan document.",
9006
+ "check": {
9007
+ "kind": "judge"
9008
+ }
9009
+ }
9010
+ ]
9011
+ },
9012
+ {
9013
+ "key": "implement",
9014
+ "name": "Implement",
9015
+ "category": "started",
9016
+ "goal": "Build the enhanced version in the component's source with the real components, on a branch of the project's repo, with its story updated, and capture the story before and after. Nothing reaches main here. Record the branch and its full head sha on the session.",
9017
+ "criteria": [
9018
+ {
9019
+ "key": "implement-matches-design",
9020
+ "statement": "The change builds the enhanced version and nothing else, with no invented component and no hard-coded colour, and its before/after captures are on the session.",
9021
+ "check": {
9022
+ "kind": "judge"
9023
+ }
9024
+ }
9025
+ ]
9026
+ },
9027
+ {
9028
+ "key": "gate",
9029
+ "name": "Gate",
9030
+ "category": "started",
9031
+ "goal": "Run the smallest gate that answers on the full head sha (the component's tests and stories, typecheck of its package) and write the result; a red sends the run back to Implement.",
9032
+ "gate": {
9033
+ "kind": "check"
9034
+ },
9035
+ "onFail": {
9036
+ "toStage": "implement"
9037
+ },
9038
+ "expectedOutputs": [
9039
+ {
9040
+ "kind": "document",
9041
+ "label": "Gate summary (the full sha, each gate and its result)",
9042
+ "relationToSubject": "none"
9043
+ }
9044
+ ],
9045
+ "criteria": [
9046
+ {
9047
+ "key": "gate-green-at-sha",
9048
+ "statement": "Every gate in the summary ran on the full head sha and is green, with no INFRA result counted as green.",
9049
+ "check": {
9050
+ "kind": "judge"
9051
+ }
9052
+ }
9053
+ ]
9054
+ },
9055
+ {
9056
+ "key": "approve",
9057
+ "name": "Approve",
9058
+ "category": "started",
9059
+ "goal": "The card shows the before/after capture of the story, the diff summary and the green devbox run at the full head sha. Approving it releases land, publish and done; no later stage asks again. A change touching auth, keys, vault, billing or a migration, or publishing to anyone but this pod, files its own approval instead of riding this one.",
9060
+ "gate": {
9061
+ "kind": "human"
9062
+ },
9063
+ "onFail": {
9064
+ "toStage": "implement"
9065
+ },
9066
+ "expectedOutputs": [
9067
+ {
9068
+ "kind": "commit",
9069
+ "key": "approved-change",
9070
+ "label": "Approved change (the commit at the full head sha)",
9071
+ "relationToSubject": "none"
9072
+ }
9073
+ ]
9074
+ },
9075
+ {
9076
+ "key": "land",
9077
+ "name": "Land",
9078
+ "category": "started",
9079
+ "goal": "The approved sha reaches the project's main through its ship action (a gated commit, or the merge of its pull request once its checks are green), started by this run, never by an agent pushing main by hand. Record it as the outcome commit-<repo>-<sha8>. If the diff changed after the approval, stop and ask again.",
9080
+ "expectedOutputs": [
9081
+ {
9082
+ "kind": "commit",
9083
+ "key": "landed-commit",
9084
+ "label": "Landed commit on main",
9085
+ "relationToSubject": "none"
9086
+ }
9087
+ ],
9088
+ "criteria": [
9089
+ {
9090
+ "key": "land-main-has-approved",
9091
+ "statement": "Main contains the approved change, and the landed diff is the one that was approved.",
9092
+ "check": {
9093
+ "kind": "judge"
9094
+ }
9095
+ }
9096
+ ]
9097
+ },
9098
+ {
9099
+ "key": "publish",
9100
+ "name": "Publish",
9101
+ "category": "started",
9102
+ "goal": "The landed change goes live (the project's publish that follows main; in app-bases the push to main publishes the catalog and SDK), Storybook is rebuilt and storybook.sync runs, so the component's record carries its new source-hash and screenshot.",
9103
+ "criteria": [
9104
+ {
9105
+ "key": "publish-record-current",
9106
+ "statement": "After the sync, the component's source-hash is the one of the landed sha and its screenshot shows the change.",
9107
+ "check": {
9108
+ "kind": "judge"
9109
+ }
9110
+ }
9111
+ ]
9112
+ },
9113
+ {
9114
+ "key": "done",
9115
+ "name": "Done",
9116
+ "category": "completed",
9117
+ "goal": "Mark the component reviewed (update_entity) by writing reviewed-hash = its current source-hash and review-state fresh.",
9118
+ "criteria": [
9119
+ {
9120
+ "key": "done-reviewed-hash",
9121
+ "statement": "The component's reviewed-hash equals its source-hash and its review-state is fresh.",
9122
+ "check": {
9123
+ "kind": "judge"
9124
+ }
9125
+ }
9126
+ ]
9127
+ }
9128
+ ]
9129
+ },
9130
+ {
9131
+ "name": "Design a user flow (UX, from need to buildable design)",
9132
+ "description": 'Turn a wanted user flow into a researched, compared, challenged and validated UX, one step at a time, each step with its skill and one output on the pod. Ends by handing the chosen design to "Design to implementation". Reusable for any surface or page.',
9133
+ "goalTemplate": `Design the user flow {flow} for {surface}, from the intent "{intent}". One step at a time, each step with its skill and one output filed on the pod (a document linked to this session); stop at each person's gate. References to look at: {references}. Move the flow only through its lifecycle (update_entity with expectedStatus): draft while it is framed and drawn, designed once the person chooses a variant; never invent a status. Record the pages the flow goes through as traverses links to their ui-page records when they exist.`,
9134
+ "scope": "session",
9135
+ "subjectProfile": {
9136
+ "profileSlug": "user-flow"
9137
+ },
9138
+ "activators": [
9139
+ {
9140
+ "on": "manual",
9141
+ "mode": "propose"
9142
+ }
9143
+ ],
9144
+ "params": [
9145
+ {
9146
+ "name": "flow",
9147
+ "type": "entity",
9148
+ "label": "User flow",
9149
+ "required": true
9150
+ },
9151
+ {
9152
+ "name": "intent",
9153
+ "type": "text",
9154
+ "label": "What should this experience let a person do? (the job, in their words)",
9155
+ "required": true
9156
+ },
9157
+ {
9158
+ "name": "surface",
9159
+ "type": "text",
9160
+ "label": "Surface(s) and existing page to start from (e.g. browser Work page, SessionRoomView)",
9161
+ "required": true
9162
+ },
9163
+ {
9164
+ "name": "references",
9165
+ "type": "text",
9166
+ "label": "Products or libraries to look at (optional)"
9167
+ }
9168
+ ],
9169
+ "executor": "is-agent",
9170
+ "status": "active",
9171
+ "stages": [
9172
+ {
9173
+ "key": "frame",
9174
+ "name": "1. Frame",
9175
+ "category": "planned",
9176
+ "subjectStatus": "draft",
9177
+ "goal": "Load skills layers-orient, xp-triage, synap-context and the views skill (playbooks/design-a-user-flow/views). Pass the FULL session id on every write. Name which artifact each complaint is about (live code, a design board, a page) and the code baseline (repo, branch, sha). Read the existing page and what the pod knows (synap_ask; name entity ids). Name the weak layer. Output: framing brief (pod document, tables allowed) with the job, principle, starting page, surfaces with paths, existing reads, gaps and founder-only questions; then its view.",
9178
+ "expectedOutputs": [
9179
+ {
9180
+ "kind": "document",
9181
+ "label": "Framing brief",
9182
+ "relationToSubject": "relates_to"
9183
+ },
9184
+ {
9185
+ "kind": "view",
9186
+ "label": "Framing brief view",
9187
+ "relationToSubject": "none"
9188
+ }
9189
+ ]
9190
+ },
9191
+ {
9192
+ "key": "needs",
9193
+ "name": "2. Needs",
9194
+ "category": "started",
9195
+ "goal": "Load skills layers-user-needs, layers-product-strategy, product-check (apply it against the company brief 05c14349 section 5 and the vision 8ca6767d, not PRODUCT.md). Use ONE lens for what needs the person: the pod-wide needs-you read, plus the goal's own read for a goal; state which. Rank jobs of each person from pod records; where no person was observed (no client yet) mark the row assumed and name the research to do. Output: ranked needs with ids, the riskiest assumption and its cheapest test; then its view.",
9196
+ "expectedOutputs": [
9197
+ {
9198
+ "kind": "document",
9199
+ "label": "Ranked needs with evidence",
9200
+ "relationToSubject": "relates_to"
9201
+ },
9202
+ {
9203
+ "kind": "view",
9204
+ "label": "Ranked needs view",
9205
+ "relationToSubject": "none"
9206
+ }
9207
+ ]
9208
+ },
9209
+ {
9210
+ "key": "compare",
9211
+ "name": "3. Search and compare",
9212
+ "category": "started",
9213
+ "goal": "Can start with Frame (needs only the references param). Load research-decision-room, find-skills; WebSearch extended; agent-browser or headless Chrome for screenshots (the browser MCPs may not connect). Compare 5 to 8 products. Markdown document is the source; the HTML view is the decision-room page generated from it. Output: evidence ledger (source, confidence, unverified marked), comparison table, patterns, steal/avoid, licence and reuse, 5 ranked moves for the product.",
9214
+ "expectedOutputs": [
9215
+ {
9216
+ "kind": "document",
9217
+ "label": "Comparison table and evidence ledger",
9218
+ "relationToSubject": "relates_to"
9219
+ },
9220
+ {
9221
+ "kind": "view",
9222
+ "label": "Comparison view",
9223
+ "relationToSubject": "none"
9224
+ }
9225
+ ]
9226
+ },
9227
+ {
9228
+ "key": "pov",
9229
+ "name": "4. Point of view",
9230
+ "category": "started",
9231
+ "goal": "Load layers-conceptual-model, layers-domain, ui-surface-design, lens-page. Use the vocabulary door words (Job, Request, Activity; read @synap-core/types/vocabulary); where it has no word (for example a branch), propose a default and name it so it can be overridden, never coin a label silently. Output: stance in 2 sentences, one definition per object, the questions the page answers, keep/change/cut for the existing page, what each surface shows, ranked first moves, what is rejected, and 3 to 5 decisions with a recommended default. The view IS the decision page: stance, then the choices as a card.",
9232
+ "gate": {
9233
+ "kind": "human"
9234
+ },
9235
+ "onFail": {
9236
+ "toStage": "needs"
9237
+ },
9238
+ "expectedOutputs": [
9239
+ {
9240
+ "kind": "document",
9241
+ "label": "Point of view",
9242
+ "relationToSubject": "relates_to"
9243
+ },
9244
+ {
9245
+ "kind": "view",
9246
+ "label": "Point of view decision page",
9247
+ "relationToSubject": "none"
9248
+ },
9249
+ {
9250
+ "kind": "decision",
9251
+ "label": "Point of view agreed",
9252
+ "relationToSubject": "none",
9253
+ "ask": {
9254
+ "mode": "choose",
9255
+ "stakes": "commitment",
9256
+ "allowOther": true,
9257
+ "consequence": "Steps 5 to 10 start from this point of view; a change sends the run back to Needs",
9258
+ "options": [
9259
+ {
9260
+ "label": "Agree with the defaults",
9261
+ "recommended": true
9262
+ },
9263
+ {
9264
+ "label": "Agree with changes"
9265
+ },
9266
+ {
9267
+ "label": "Send back to Needs"
9268
+ }
9269
+ ]
9270
+ }
9271
+ }
9272
+ ]
9273
+ },
9274
+ {
9275
+ "key": "flow",
9276
+ "name": "5. Flow and consolidation",
9277
+ "category": "started",
9278
+ "goal": "Load layers-interaction-flow, ui-consolidation, layers-surface, diagram-design, artifact-diagramming. Map the first door, places, affordances, and the edge and failure paths (empty, loading, failed read, offline, many waiting, nothing waiting, answered elsewhere, expired). Fold map: every surface that shows work or approvals is keep, redirect (to what) or cut, with its path. Write the flow's entry, done-when and steps (each step a page and what the person does there) on the user flow. Output: flow document, fold map, and one view with ONE diagram (happy path bold, failures dashed).",
9279
+ "expectedOutputs": [
9280
+ {
9281
+ "kind": "document",
9282
+ "label": "Flow and fold map",
9283
+ "relationToSubject": "relates_to"
9284
+ },
9285
+ {
9286
+ "kind": "view",
9287
+ "label": "Flow and fold map view",
9288
+ "relationToSubject": "none"
9289
+ }
9290
+ ]
9291
+ },
9292
+ {
9293
+ "key": "options",
9294
+ "name": "6. Design options",
9295
+ "category": "started",
9296
+ "goal": "Load synap-design, impeccable, design-brief, dataviz, artifact-design. EVOLVE the existing page (name its file and the sections kept, changed, cut); never draw from scratch. 2 or 3 variants that differ by idea, on REAL data only, each screen in all states (full, empty, failed read with retry, many waiting capped with Show all, loading), light and dark, phone width. No screen has more than 7 things above the fold. Screenshot and look before publishing. Output: design-options document and the variants (Design canvas or one artifact).",
9297
+ "expectedOutputs": [
9298
+ {
9299
+ "kind": "document",
9300
+ "label": "Design options",
9301
+ "relationToSubject": "relates_to"
9302
+ },
9303
+ {
9304
+ "kind": "view",
9305
+ "label": "Design options view",
9306
+ "relationToSubject": "none"
9307
+ }
9308
+ ]
9309
+ },
9310
+ {
9311
+ "key": "challenge",
9312
+ "name": "7. Challenge",
9313
+ "category": "started",
9314
+ "goal": "Load parallel-review. Separate read-only reviewers (UX, slop, architecture) and agents code-reviewer, product-owner; give each the document and the artifact URL, not your conclusion. Must-fix sends the run back to options; justified keeps are named with why. Output: findings board (must-fix first).",
9315
+ "gate": {
9316
+ "kind": "check"
9317
+ },
9318
+ "onFail": {
9319
+ "toStage": "options"
9320
+ },
9321
+ "expectedOutputs": [
9322
+ {
9323
+ "kind": "document",
9324
+ "label": "Challenge findings",
9325
+ "relationToSubject": "relates_to"
9326
+ },
9327
+ {
9328
+ "kind": "view",
9329
+ "label": "Challenge findings view",
9330
+ "relationToSubject": "none"
9331
+ }
9332
+ ]
9333
+ },
9334
+ {
9335
+ "key": "choose",
9336
+ "name": "8. Choose",
9337
+ "category": "started",
9338
+ "goal": "Show the variants side by side with the challenge findings and one recommended. The person picks one or sends it back with what to change. Record the decision with alternatives and rationale. Choosing a variant moves the flow to designed.",
9339
+ "gate": {
9340
+ "kind": "human"
9341
+ },
9342
+ "onFail": {
9343
+ "toStage": "options"
9344
+ },
9345
+ "onApproved": "designed",
9346
+ "expectedOutputs": [
9347
+ {
9348
+ "kind": "decision",
9349
+ "label": "Chosen variant",
9350
+ "relationToSubject": "none",
9351
+ "ask": {
9352
+ "mode": "choose",
9353
+ "stakes": "commitment",
9354
+ "allowOther": true,
9355
+ "consequence": "The chosen variant goes to Design to implementation",
9356
+ "options": [
9357
+ {
9358
+ "label": "Variant A"
9359
+ },
9360
+ {
9361
+ "label": "Variant B"
9362
+ },
9363
+ {
9364
+ "label": "Send back"
9365
+ }
9366
+ ]
9367
+ }
9368
+ }
9369
+ ]
9370
+ },
9371
+ {
9372
+ "key": "validate",
9373
+ "name": "9. Validate",
9374
+ "category": "started",
9375
+ "goal": "Load dogfood and agent-browser. Walk the chosen flow on real data through the doors a user enters by; WORKS, BROKEN or CANNOT-TELL with screenshots; BROKEN goes back to options. Output: verdict page.",
9376
+ "gate": {
9377
+ "kind": "check"
9378
+ },
9379
+ "onFail": {
9380
+ "toStage": "options"
9381
+ },
9382
+ "expectedOutputs": [
9383
+ {
9384
+ "kind": "document",
9385
+ "label": "Dogfood verdict",
9386
+ "relationToSubject": "relates_to"
9387
+ },
9388
+ {
9389
+ "kind": "view",
9390
+ "label": "Dogfood verdict view",
9391
+ "relationToSubject": "none"
9392
+ }
9393
+ ]
9394
+ },
9395
+ {
9396
+ "key": "handoff",
9397
+ "name": "10. Hand off and capture",
9398
+ "category": "completed",
9399
+ "goal": "Launch playbook Design to implementation with the chosen design. Load engineering-memory: file the decision, what we learned, and what the process got wrong; update the views skill (playbooks/design-a-user-flow/views) run notes. Close open asks; the run ends here. The flow moves to built when Design to implementation lands the design, not here.",
9400
+ "expectedOutputs": [
9401
+ {
9402
+ "kind": "document",
9403
+ "label": "Learnings and process notes",
9404
+ "relationToSubject": "relates_to"
9405
+ }
9406
+ ]
9407
+ }
9408
+ ]
9409
+ }
9410
+ ],
9411
+ "skills": [
9412
+ {
9413
+ "slug": "designing-with-real-components",
9414
+ "when": "Designing, mocking up or implementing a screen or a component as a ui-design",
9415
+ "mode": "on-demand"
9416
+ },
9417
+ {
9418
+ "slug": "design-critique",
9419
+ "when": "Critiquing a ui-design, a built screen or a UI component (the review rubric)",
9420
+ "mode": "on-demand"
8388
9421
  }
8389
9422
  ],
8390
9423
  "onboarding": {
@@ -37893,7 +38926,10 @@ var SYSTEM_PROFILES = /* @__PURE__ */ new Set([
37893
38926
  "tool_request"
37894
38927
  ]);
37895
38928
  var TEMPLATE_FORBIDDEN_SYSTEM_PROFILE_SLUGS = /* @__PURE__ */ new Set(["knowledge"]);
37896
- var RESERVED_PROFILE_SLUGS = /* @__PURE__ */ new Set(["project", "projects"]);
38929
+ var RESERVED_PROFILE_SLUGS = /* @__PURE__ */ new Set([
38930
+ "project",
38931
+ "projects"
38932
+ ]);
37897
38933
  var KNOWLEDGE_FORMS = /* @__PURE__ */ new Set(["insight", "caution"]);
37898
38934
  var LEGACY_KNOWLEDGE_SEED_FIELDS = /* @__PURE__ */ new Set(["ek_type", "type"]);
37899
38935
  function isPodWideProfile(p) {
@@ -37925,7 +38961,8 @@ function composeBaseDocumentSlugs(data, resolveDep, seen = /* @__PURE__ */ new S
37925
38961
  const base = resolveDep(dep.slug);
37926
38962
  if (!base) continue;
37927
38963
  for (const d of base.documents || []) if (d?.slug) out.add(d.slug);
37928
- for (const s of composeBaseDocumentSlugs(base, resolveDep, seen)) out.add(s);
38964
+ for (const s of composeBaseDocumentSlugs(base, resolveDep, seen))
38965
+ out.add(s);
37929
38966
  }
37930
38967
  return out;
37931
38968
  }
@@ -38099,11 +39136,25 @@ function knownRelationTypes(tpl, resolveDep, corpus) {
38099
39136
  return out;
38100
39137
  }
38101
39138
  var MAX_SESSION_CRITERIA = 12;
38102
- var TEMPLATE_ACTIVATOR_ON = ["created", "enters_status", "count", "schedule", "manual", "run_ended"];
39139
+ var TEMPLATE_ACTIVATOR_ON = [
39140
+ "created",
39141
+ "enters_status",
39142
+ "count",
39143
+ "schedule",
39144
+ "manual",
39145
+ "run_ended"
39146
+ ];
38103
39147
  function goalNamesStatus(goal, value, labels) {
38104
39148
  if (typeof goal !== "string" || typeof value !== "string") return false;
38105
- const names = [value, labels?.get(value)].filter((n) => !!n && n.trim() !== "");
38106
- return names.some((n) => new RegExp(`(^|[^\\p{L}\\p{N}_])${n.trim().replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}($|[^\\p{L}\\p{N}_])`, "iu").test(goal));
39149
+ const names = [value, labels?.get(value)].filter(
39150
+ (n) => !!n && n.trim() !== ""
39151
+ );
39152
+ return names.some(
39153
+ (n) => new RegExp(
39154
+ `(^|[^\\p{L}\\p{N}_])${n.trim().replace(/[.*+?^${}()|[\]\\]/g, "\\$&")}($|[^\\p{L}\\p{N}_])`,
39155
+ "iu"
39156
+ ).test(goal)
39157
+ );
38107
39158
  }
38108
39159
  function checkProcessContract(tpl, resolveDep, corpus, add) {
38109
39160
  let relations = null;
@@ -38114,11 +39165,17 @@ function checkProcessContract(tpl, resolveDep, corpus, add) {
38114
39165
  const raw = pb;
38115
39166
  const subjectRaw = pb.subjectProfile ?? {};
38116
39167
  for (const [field, present] of [
38117
- ["subjectProfile.statusProperty", subjectRaw.statusProperty !== void 0],
39168
+ [
39169
+ "subjectProfile.statusProperty",
39170
+ subjectRaw.statusProperty !== void 0
39171
+ ],
38118
39172
  ["subjectProfile.onEnd", subjectRaw.onEnd !== void 0],
38119
39173
  ["onEnd", raw.onEnd !== void 0],
38120
39174
  ["humanOnlyStatuses", raw.humanOnlyStatuses !== void 0],
38121
- ["subjectProfile.humanOnlyStatuses", subjectRaw.humanOnlyStatuses !== void 0]
39175
+ [
39176
+ "subjectProfile.humanOnlyStatuses",
39177
+ subjectRaw.humanOnlyStatuses !== void 0
39178
+ ]
38122
39179
  ])
38123
39180
  if (present)
38124
39181
  add(
@@ -38143,7 +39200,9 @@ function checkProcessContract(tpl, resolveDep, corpus, add) {
38143
39200
  if (declared) {
38144
39201
  lifecycleProperty = declared.property;
38145
39202
  statuses = new Set(declared.options.map((o) => o.key));
38146
- labels = new Map(declared.options.map((o) => [o.key, o.label ?? o.key]));
39203
+ labels = new Map(
39204
+ declared.options.map((o) => [o.key, o.label ?? o.key])
39205
+ );
38147
39206
  }
38148
39207
  }
38149
39208
  const checkStatus = (rule, path, value) => {
@@ -38176,10 +39235,20 @@ function checkProcessContract(tpl, resolveDep, corpus, add) {
38176
39235
  stages.forEach((stage, i) => {
38177
39236
  const sp = `${at}.stages.${stage.key}`;
38178
39237
  if (stage.subjectStatus !== void 0)
38179
- checkStatus("stage-subject-status-unknown", `${sp}.subjectStatus`, stage.subjectStatus);
39238
+ checkStatus(
39239
+ "stage-subject-status-unknown",
39240
+ `${sp}.subjectStatus`,
39241
+ stage.subjectStatus
39242
+ );
38180
39243
  if (stage.onApproved !== void 0) {
38181
- checkStatus("stage-on-approved-unknown", `${sp}.onApproved`, stage.onApproved);
38182
- const owesOutput = (stage.expectedOutputs ?? []).some((o) => o.optional !== true);
39244
+ checkStatus(
39245
+ "stage-on-approved-unknown",
39246
+ `${sp}.onApproved`,
39247
+ stage.onApproved
39248
+ );
39249
+ const owesOutput = (stage.expectedOutputs ?? []).some(
39250
+ (o) => o.optional !== true
39251
+ );
38183
39252
  const nextGated = !!stages[i + 1]?.gate;
38184
39253
  if (!owesOutput && !nextGated && !goalNamesStatus(stage.goal, stage.onApproved, labels))
38185
39254
  add(
@@ -38199,20 +39268,40 @@ function checkProcessContract(tpl, resolveDep, corpus, add) {
38199
39268
  (pb.activators ?? []).forEach((a, i) => {
38200
39269
  const ap = `${at}.activators[${i}]`;
38201
39270
  if (!TEMPLATE_ACTIVATOR_ON.includes(a.on))
38202
- add("activator-on-invalid", `${ap}.on`, `${ap}.on "${String(a.on)}" must be one of ${TEMPLATE_ACTIVATOR_ON.join(", ")}`);
39271
+ add(
39272
+ "activator-on-invalid",
39273
+ `${ap}.on`,
39274
+ `${ap}.on "${String(a.on)}" must be one of ${TEMPLATE_ACTIVATOR_ON.join(", ")}`
39275
+ );
38203
39276
  if (a.mode !== "run" && a.mode !== "propose" && a.mode !== "appointment")
38204
- add("activator-mode-invalid", `${ap}.mode`, `${ap}.mode "${String(a.mode)}" must be "run", "propose" or "appointment"`);
39277
+ add(
39278
+ "activator-mode-invalid",
39279
+ `${ap}.mode`,
39280
+ `${ap}.mode "${String(a.mode)}" must be "run", "propose" or "appointment"`
39281
+ );
38205
39282
  if (!kind && a.on !== "schedule")
38206
- add("activator-no-subject", ap, `${ap} needs subjectProfile.profileSlug \u2014 an activator fires on an entity of that kind`);
39283
+ add(
39284
+ "activator-no-subject",
39285
+ ap,
39286
+ `${ap} needs subjectProfile.profileSlug \u2014 an activator fires on an entity of that kind`
39287
+ );
38207
39288
  if (a.on === "enters_status" || a.on === "count") {
38208
39289
  if (a.status === void 0)
38209
- add("activator-status-required", `${ap}.status`, `${ap} on "${a.on}" names no status`);
39290
+ add(
39291
+ "activator-status-required",
39292
+ `${ap}.status`,
39293
+ `${ap} on "${a.on}" names no status`
39294
+ );
38210
39295
  else checkStatus("activator-status-unknown", `${ap}.status`, a.status);
38211
39296
  } else if (a.on === "schedule") {
38212
39297
  for (const st of a.status === void 0 ? [] : typeof a.status === "string" ? [a.status] : a.status)
38213
39298
  checkStatus("activator-status-unknown", `${ap}.status`, st);
38214
39299
  } else if (a.status !== void 0) {
38215
- add("activator-status-unexpected", `${ap}.status`, `${ap}.status is not read when on = "${a.on}"`);
39300
+ add(
39301
+ "activator-status-unexpected",
39302
+ `${ap}.status`,
39303
+ `${ap}.status is not read when on = "${a.on}"`
39304
+ );
38216
39305
  }
38217
39306
  });
38218
39307
  const outputs = [
@@ -38233,18 +39322,36 @@ function checkProcessContract(tpl, resolveDep, corpus, add) {
38233
39322
  ];
38234
39323
  for (const o of outputs)
38235
39324
  if (o.optional !== void 0 && typeof o.optional !== "boolean")
38236
- add("output-optional-not-boolean", `${o.at}.optional`, `${o.at}.optional = ${JSON.stringify(o.optional)} must be true or false \u2014 the pod treats anything but a real true as required`);
39325
+ add(
39326
+ "output-optional-not-boolean",
39327
+ `${o.at}.optional`,
39328
+ `${o.at}.optional = ${JSON.stringify(o.optional)} must be true or false \u2014 the pod treats anything but a real true as required`
39329
+ );
38237
39330
  for (const { path, rel } of outputs) {
38238
39331
  if (rel === void 0 || rel === NO_SUBJECT_RELATION) continue;
38239
39332
  if (!kind) {
38240
- add("output-relation-no-subject", path, `${path} = "${String(rel)}" but playbook "${pb.name}" has no subject to relate to (use "${NO_SUBJECT_RELATION}")`);
39333
+ add(
39334
+ "output-relation-no-subject",
39335
+ path,
39336
+ `${path} = "${String(rel)}" but playbook "${pb.name}" has no subject to relate to (use "${NO_SUBJECT_RELATION}")`
39337
+ );
38241
39338
  } else if (typeof rel !== "string" || !relationsOnce().has(rel)) {
38242
- add("output-relation-unknown", path, `${path} = "${String(rel)}" is not a relation the corpus defines (entityLinks[].type / relationDefs[].slug)`);
39339
+ add(
39340
+ "output-relation-unknown",
39341
+ path,
39342
+ `${path} = "${String(rel)}" is not a relation the corpus defines (entityLinks[].type / relationDefs[].slug)`
39343
+ );
38243
39344
  }
38244
39345
  }
38245
39346
  }
38246
39347
  }
38247
- var LIFECYCLE_CATEGORIES = ["open", "active", "paused", "done", "lost"];
39348
+ var LIFECYCLE_CATEGORIES = [
39349
+ "open",
39350
+ "active",
39351
+ "paused",
39352
+ "done",
39353
+ "lost"
39354
+ ];
38248
39355
  var STUCK_AFTER_DAYS_MAX = 3650;
38249
39356
  var LIFECYCLE_OPTION_FIELDS = [
38250
39357
  "key",
@@ -38257,8 +39364,21 @@ var LIFECYCLE_OPTION_FIELDS = [
38257
39364
  "waits",
38258
39365
  "requires"
38259
39366
  ];
38260
- var LIFECYCLE_OPTION_WAITS_FIELDS = ["on", "waitKind", "refFrom", "dateBinding"];
38261
- var LIFECYCLE_WAITS_ON = ["person", "agent", "external", "thing", "decision", "date", "nobody"];
39367
+ var LIFECYCLE_OPTION_WAITS_FIELDS = [
39368
+ "on",
39369
+ "waitKind",
39370
+ "refFrom",
39371
+ "dateBinding"
39372
+ ];
39373
+ var LIFECYCLE_WAITS_ON = [
39374
+ "person",
39375
+ "agent",
39376
+ "external",
39377
+ "thing",
39378
+ "decision",
39379
+ "date",
39380
+ "nobody"
39381
+ ];
38262
39382
  var LIFECYCLE_WAIT_KINDS = [
38263
39383
  "answer",
38264
39384
  "approval",
@@ -38306,16 +39426,22 @@ function lifecycleOptionWaitsProblems(option2) {
38306
39426
  return out;
38307
39427
  };
38308
39428
  if (!w || typeof w !== "object" || Array.isArray(w))
38309
- return fail(`option "${key}" waits must be an object { on, waitKind?, refFrom?, dateBinding? }`);
39429
+ return fail(
39430
+ `option "${key}" waits must be an object { on, waitKind?, refFrom?, dateBinding? }`
39431
+ );
38310
39432
  if (finished)
38311
39433
  return fail(
38312
39434
  `option "${key}" is ${String(option2.category)}: a finished thing waits on nothing (waits is for open, active or paused options)`
38313
39435
  );
38314
39436
  const waits = w;
38315
39437
  if (typeof waits.on !== "string" || !LIFECYCLE_WAITS_ON.includes(waits.on))
38316
- return fail(`option "${key}" waits.on must be one of ${LIFECYCLE_WAITS_ON.join(" | ")}`);
39438
+ return fail(
39439
+ `option "${key}" waits.on must be one of ${LIFECYCLE_WAITS_ON.join(" | ")}`
39440
+ );
38317
39441
  if (waits.waitKind !== void 0 && (typeof waits.waitKind !== "string" || !LIFECYCLE_WAIT_KINDS.includes(waits.waitKind)))
38318
- return fail(`option "${key}" waits.waitKind is not a wait kind (WAIT_KINDS)`);
39442
+ return fail(
39443
+ `option "${key}" waits.waitKind is not a wait kind (WAIT_KINDS)`
39444
+ );
38319
39445
  for (const field of ["refFrom", "dateBinding"]) {
38320
39446
  const v = waits[field];
38321
39447
  if (v !== void 0 && (typeof v !== "string" || !LIFECYCLE_PROPERTY_SLUG.test(v)))
@@ -38326,7 +39452,10 @@ function lifecycleOptionWaitsProblems(option2) {
38326
39452
  const unknown = Object.keys(waits).filter(
38327
39453
  (k) => !LIFECYCLE_OPTION_WAITS_FIELDS.includes(k)
38328
39454
  );
38329
- if (unknown.length > 0) return fail(`option "${key}" waits has unknown field(s): ${unknown.join(", ")}`);
39455
+ if (unknown.length > 0)
39456
+ return fail(
39457
+ `option "${key}" waits has unknown field(s): ${unknown.join(", ")}`
39458
+ );
38330
39459
  return out;
38331
39460
  }
38332
39461
  var LIFECYCLE_REQUIREMENT_OWNERS = ["you", "agent"];
@@ -38338,35 +39467,54 @@ function lifecycleOptionRequiresProblem(option2) {
38338
39467
  if (raw === void 0) return null;
38339
39468
  const key = String(option2.key);
38340
39469
  const at = (i) => `option "${key}" requires[${i}]`;
38341
- if (!Array.isArray(raw)) return `option "${key}" requires must be a list of { kind: "link" | "property", blockerKey, ... }`;
39470
+ if (!Array.isArray(raw))
39471
+ return `option "${key}" requires must be a list of { kind: "link" | "property", blockerKey, ... }`;
38342
39472
  if (raw.length > 0 && (option2.category === "done" || option2.category === "lost"))
38343
39473
  return `option "${key}" is ${String(option2.category)}: a finished thing requires nothing (requires is for open, active or paused options)`;
38344
- if (raw.length > REQUIREMENTS_PER_OPTION_MAX) return `option "${key}" requires at most ${REQUIREMENTS_PER_OPTION_MAX} things`;
39474
+ if (raw.length > REQUIREMENTS_PER_OPTION_MAX)
39475
+ return `option "${key}" requires at most ${REQUIREMENTS_PER_OPTION_MAX} things`;
38345
39476
  const seen = /* @__PURE__ */ new Set();
38346
39477
  for (const [i, item] of raw.entries()) {
38347
- if (!item || typeof item !== "object" || Array.isArray(item)) return `${at(i)} must be an object`;
39478
+ if (!item || typeof item !== "object" || Array.isArray(item))
39479
+ return `${at(i)} must be an object`;
38348
39480
  const r = item;
38349
39481
  if (typeof r.blockerKey !== "string" || !BLOCKER_KEY.test(r.blockerKey))
38350
39482
  return `${at(i)}.blockerKey must be a lowercase name (letters, digits, _), e.g. "no_contact"`;
38351
- if (seen.has(r.blockerKey)) return `${at(i)}.blockerKey "${r.blockerKey}" is declared twice`;
39483
+ if (seen.has(r.blockerKey))
39484
+ return `${at(i)}.blockerKey "${r.blockerKey}" is declared twice`;
38352
39485
  seen.add(r.blockerKey);
38353
- if (r.label !== void 0 && (typeof r.label !== "string" || !r.label.trim())) return `${at(i)}.label must be words`;
39486
+ if (r.label !== void 0 && (typeof r.label !== "string" || !r.label.trim()))
39487
+ return `${at(i)}.label must be words`;
38354
39488
  if (r.owner !== void 0 && !LIFECYCLE_REQUIREMENT_OWNERS.includes(r.owner))
38355
39489
  return `${at(i)}.owner must be one of ${LIFECYCLE_REQUIREMENT_OWNERS.join(" | ")}`;
38356
39490
  if (r.clearedBy !== void 0 && !requirementClearedByOk(r.clearedBy))
38357
39491
  return `${at(i)}.clearedBy must be one of { answer: true } | { intent } | { playbookId } | { capability }`;
38358
- if (r.forKinds !== void 0 && (!Array.isArray(r.forKinds) || r.forKinds.length === 0 || !r.forKinds.every((k) => typeof k === "string" && LIFECYCLE_PROPERTY_SLUG.test(k))))
39492
+ if (r.forKinds !== void 0 && (!Array.isArray(r.forKinds) || r.forKinds.length === 0 || !r.forKinds.every(
39493
+ (k) => typeof k === "string" && LIFECYCLE_PROPERTY_SLUG.test(k)
39494
+ )))
38359
39495
  return `${at(i)}.forKinds must be a list of kind slugs (e.g. ["person"])`;
38360
- const common = ["kind", "blockerKey", "label", "owner", "clearedBy", "forKinds"];
39496
+ const common = [
39497
+ "kind",
39498
+ "blockerKey",
39499
+ "label",
39500
+ "owner",
39501
+ "clearedBy",
39502
+ "forKinds"
39503
+ ];
38361
39504
  if (r.kind === "link") {
38362
39505
  if (typeof r.relation !== "string" || !LIFECYCLE_PROPERTY_SLUG.test(r.relation))
38363
39506
  return `${at(i)}.relation must name a relation type (its slug, e.g. "works_at")`;
38364
- if (!LIFECYCLE_REQUIREMENT_DIRECTIONS.includes(r.direction))
39507
+ if (!LIFECYCLE_REQUIREMENT_DIRECTIONS.includes(
39508
+ r.direction
39509
+ ))
38365
39510
  return `${at(i)}.direction must be "out" (the thing is the link's source) or "in" (its target)`;
38366
39511
  if (r.min !== void 0 && !(typeof r.min === "number" && Number.isInteger(r.min) && r.min >= 1 && r.min <= 1e3))
38367
39512
  return `${at(i)}.min must be a whole number from 1 to 1000`;
38368
- const unknown = Object.keys(r).filter((k) => ![...common, "relation", "direction", "min"].includes(k));
38369
- if (unknown.length > 0) return `${at(i)} has unknown field(s): ${unknown.join(", ")}`;
39513
+ const unknown = Object.keys(r).filter(
39514
+ (k) => ![...common, "relation", "direction", "min"].includes(k)
39515
+ );
39516
+ if (unknown.length > 0)
39517
+ return `${at(i)} has unknown field(s): ${unknown.join(", ")}`;
38370
39518
  continue;
38371
39519
  }
38372
39520
  if (r.kind === "property") {
@@ -38374,8 +39522,11 @@ function lifecycleOptionRequiresProblem(option2) {
38374
39522
  return `${at(i)}.property must name a property (its slug, e.g. "linkedinUrl")`;
38375
39523
  if (r.in !== void 0 && !(Array.isArray(r.in) && r.in.length > 0 && r.in.every((v) => typeof v === "string" && v.trim())))
38376
39524
  return `${at(i)}.in must be a non-empty list of values`;
38377
- const unknown = Object.keys(r).filter((k) => ![...common, "property", "in"].includes(k));
38378
- if (unknown.length > 0) return `${at(i)} has unknown field(s): ${unknown.join(", ")}`;
39525
+ const unknown = Object.keys(r).filter(
39526
+ (k) => ![...common, "property", "in"].includes(k)
39527
+ );
39528
+ if (unknown.length > 0)
39529
+ return `${at(i)} has unknown field(s): ${unknown.join(", ")}`;
38379
39530
  continue;
38380
39531
  }
38381
39532
  return `${at(i)}.kind must be "link" or "property"`;
@@ -38387,12 +39538,16 @@ function requirementClearedByOk(raw) {
38387
39538
  const c = raw;
38388
39539
  if (Object.keys(c).length !== 1) return false;
38389
39540
  if (c.answer === true) return true;
38390
- return ["intent", "playbookId", "capability"].some((k) => typeof c[k] === "string" && c[k].trim() !== "");
39541
+ return ["intent", "playbookId", "capability"].some(
39542
+ (k) => typeof c[k] === "string" && c[k].trim() !== ""
39543
+ );
38391
39544
  }
38392
39545
  function stableJson(v) {
38393
39546
  if (Array.isArray(v)) return `[${v.map(stableJson).join(",")}]`;
38394
39547
  if (v && typeof v === "object")
38395
- return `{${Object.keys(v).filter((k) => v[k] !== void 0).sort().map((k) => `${JSON.stringify(k)}:${stableJson(v[k])}`).join(",")}}`;
39548
+ return `{${Object.keys(v).filter((k) => v[k] !== void 0).sort().map(
39549
+ (k) => `${JSON.stringify(k)}:${stableJson(v[k])}`
39550
+ ).join(",")}}`;
38396
39551
  return JSON.stringify(v);
38397
39552
  }
38398
39553
  function checkLifecycleDeclarations(tpl, resolveDep, corpus, add) {
@@ -38401,7 +39556,9 @@ function checkLifecycleDeclarations(tpl, resolveDep, corpus, add) {
38401
39556
  const lc = profile.lifecycle;
38402
39557
  const at = `profiles.${profile.slug}.lifecycle`;
38403
39558
  if (lc !== void 0) {
38404
- const prop = (profile.properties ?? []).find((p) => p.slug === lc?.property);
39559
+ const prop = (profile.properties ?? []).find(
39560
+ (p) => p.slug === lc?.property
39561
+ );
38405
39562
  if (!prop || prop.inputType !== "select" || !Array.isArray(prop.enumValues) || prop.enumValues.length === 0) {
38406
39563
  add(
38407
39564
  "lifecycle-property-unknown",
@@ -38425,7 +39582,11 @@ function checkLifecycleDeclarations(tpl, resolveDep, corpus, add) {
38425
39582
  `option "${String(o?.key)}" category "${String(o?.category)}" is not one of ${LIFECYCLE_CATEGORIES.join(" \xB7 ")}`
38426
39583
  );
38427
39584
  if (o?.humanOnly !== void 0 && typeof o.humanOnly !== "boolean")
38428
- add("lifecycle-option-shape", `${at}.options[${i}].humanOnly`, `option "${String(o?.key)}" humanOnly must be a boolean`);
39585
+ add(
39586
+ "lifecycle-option-shape",
39587
+ `${at}.options[${i}].humanOnly`,
39588
+ `option "${String(o?.key)}" humanOnly must be a boolean`
39589
+ );
38429
39590
  const stuck = o?.stuckAfterDays;
38430
39591
  if (stuck !== void 0) {
38431
39592
  if (typeof stuck !== "number" || !Number.isInteger(stuck) || stuck < 1 || stuck > STUCK_AFTER_DAYS_MAX)
@@ -38442,9 +39603,18 @@ function checkLifecycleDeclarations(tpl, resolveDep, corpus, add) {
38442
39603
  );
38443
39604
  }
38444
39605
  for (const p of lifecycleOptionWaitsProblems(o ?? {}))
38445
- add("lifecycle-option-shape", `${at}.options[${i}].${p.field}`, p.message);
39606
+ add(
39607
+ "lifecycle-option-shape",
39608
+ `${at}.options[${i}].${p.field}`,
39609
+ p.message
39610
+ );
38446
39611
  const requiresProblem = lifecycleOptionRequiresProblem(o ?? {});
38447
- if (requiresProblem) add("lifecycle-option-shape", `${at}.options[${i}].requires`, requiresProblem);
39612
+ if (requiresProblem)
39613
+ add(
39614
+ "lifecycle-option-shape",
39615
+ `${at}.options[${i}].requires`,
39616
+ requiresProblem
39617
+ );
38448
39618
  });
38449
39619
  }
38450
39620
  }
@@ -38479,9 +39649,14 @@ function checkPresentationDeclarations(tpl, resolveDep, corpus, add) {
38479
39649
  const named = [];
38480
39650
  declaredMediaSources(parsed.value).forEach((source, i) => {
38481
39651
  const where = i === 0 ? `${at}.media.source` : `${at}.media.fallbacks[${i - 1}]`;
38482
- if ("property" in source) named.push({ path: `${where}.property`, slug: source.property });
39652
+ if ("property" in source)
39653
+ named.push({ path: `${where}.property`, slug: source.property });
38483
39654
  if ("entityRef" in source)
38484
- named.push({ path: `${where}.entityRef`, slug: source.entityRef, entityRef: true });
39655
+ named.push({
39656
+ path: `${where}.entityRef`,
39657
+ slug: source.entityRef,
39658
+ entityRef: true
39659
+ });
38485
39660
  });
38486
39661
  for (const alt of ["card", "row"])
38487
39662
  (parsed.value.fields?.[alt] ?? []).forEach(
@@ -38529,7 +39704,11 @@ function checkKanbanGrouping(tpl, resolveDep, corpus, add) {
38529
39704
  );
38530
39705
  const field = v.config?.groupByField;
38531
39706
  if (typeof field !== "string" || !field.trim()) {
38532
- add("view-kanban-group-missing", `${at}.config.groupByField`, `kanban "${v.name}" names no config.groupByField \u2014 its columns would be the values of "status"`);
39707
+ add(
39708
+ "view-kanban-group-missing",
39709
+ `${at}.config.groupByField`,
39710
+ `kanban "${v.name}" names no config.groupByField \u2014 its columns would be the values of "status"`
39711
+ );
38533
39712
  continue;
38534
39713
  }
38535
39714
  const kind = v.scopeProfileSlug;
@@ -38559,7 +39738,11 @@ function checkIntent(tpl, resolveDep, add) {
38559
39738
  return;
38560
39739
  }
38561
39740
  if (!intent || typeof intent !== "object" || Array.isArray(intent)) {
38562
- add("intent-shape", "meta.intent", "meta.intent must be { label, primary?, produces?: [{ profile }] }");
39741
+ add(
39742
+ "intent-shape",
39743
+ "meta.intent",
39744
+ "meta.intent must be { label, primary?, produces?: [{ profile }] }"
39745
+ );
38563
39746
  return;
38564
39747
  }
38565
39748
  const { label, produces, primary } = intent;
@@ -38571,7 +39754,11 @@ function checkIntent(tpl, resolveDep, add) {
38571
39754
  );
38572
39755
  const producedSlugs = Array.isArray(produces) ? produces.map((e) => e?.profile).filter((s) => typeof s === "string") : [];
38573
39756
  if (primary !== void 0 && (typeof primary !== "string" || !primary.trim()))
38574
- add("intent-shape", "meta.intent.primary", `meta.intent.primary must be a profile slug (got ${JSON.stringify(primary)})`);
39757
+ add(
39758
+ "intent-shape",
39759
+ "meta.intent.primary",
39760
+ `meta.intent.primary must be a profile slug (got ${JSON.stringify(primary)})`
39761
+ );
38575
39762
  else if (primary === void 0 && producedSlugs.length > 0)
38576
39763
  add(
38577
39764
  "intent-primary-missing",
@@ -38592,32 +39779,50 @@ function checkIntent(tpl, resolveDep, add) {
38592
39779
  );
38593
39780
  if (produces === void 0) return;
38594
39781
  if (!Array.isArray(produces)) {
38595
- add("intent-shape", "meta.intent.produces", "meta.intent.produces must be a list of { profile }");
39782
+ add(
39783
+ "intent-shape",
39784
+ "meta.intent.produces",
39785
+ "meta.intent.produces must be a list of { profile }"
39786
+ );
38596
39787
  return;
38597
39788
  }
38598
39789
  const closure = [...collectDependencyClosure(tpl, resolveDep)];
38599
- const sources = [tpl, ...closure.map(resolveDep).filter((t) => !!t)];
39790
+ const sources = [
39791
+ tpl,
39792
+ ...closure.map(resolveDep).filter((t) => !!t)
39793
+ ];
38600
39794
  const unresolved = closure.some((d) => !resolveDep(d));
38601
39795
  const seen = /* @__PURE__ */ new Set();
38602
39796
  produces.forEach((entry, i) => {
38603
39797
  const at = `meta.intent.produces[${i}]`;
38604
39798
  const slug = entry?.profile;
38605
39799
  if (typeof slug !== "string" || !slug) {
38606
- add("intent-shape", `${at}.profile`, `${at} must be { profile: <profile slug> }`);
39800
+ add(
39801
+ "intent-shape",
39802
+ `${at}.profile`,
39803
+ `${at} must be { profile: <profile slug> }`
39804
+ );
38607
39805
  return;
38608
39806
  }
38609
- if (seen.has(slug)) add("intent-duplicate", `${at}.profile`, `"${slug}" is produced twice`);
39807
+ if (seen.has(slug))
39808
+ add("intent-duplicate", `${at}.profile`, `"${slug}" is produced twice`);
38610
39809
  seen.add(slug);
38611
39810
  const as = entry.as;
38612
39811
  if (as !== void 0 && !TEMPLATE_KIND_AS.includes(as))
38613
- add("intent-shape", `${at}.as`, `${at}.as must be one of ${TEMPLATE_KIND_AS.join(", ")} (got ${JSON.stringify(as)})`);
39812
+ add(
39813
+ "intent-shape",
39814
+ `${at}.as`,
39815
+ `${at}.as must be one of ${TEMPLATE_KIND_AS.join(", ")} (got ${JSON.stringify(as)})`
39816
+ );
38614
39817
  if (as === "helper" && slug === primary)
38615
39818
  add(
38616
39819
  "intent-primary-helper",
38617
39820
  `${at}.as`,
38618
39821
  `"${slug}" is the space's primary output and cannot be a helper \u2014 a helper is worked to serve an output, it is not one`
38619
39822
  );
38620
- const decls = sources.flatMap((t) => (t.profiles ?? []).filter((p) => p.slug === slug));
39823
+ const decls = sources.flatMap(
39824
+ (t) => (t.profiles ?? []).filter((p) => p.slug === slug)
39825
+ );
38621
39826
  if (decls.length === 0) {
38622
39827
  if (!unresolved)
38623
39828
  add(
@@ -38640,78 +39845,157 @@ function checkStart(tpl, resolveDep, corpus, add) {
38640
39845
  if (raw === void 0) return;
38641
39846
  const why = ownsNoWorkspace(tpl);
38642
39847
  if (why) {
38643
- add("start-no-workspace", "meta.start", `"${tpl.meta.slug}" is ${why} \u2014 it owns no space, so it cannot be an onboarding start`);
39848
+ add(
39849
+ "start-no-workspace",
39850
+ "meta.start",
39851
+ `"${tpl.meta.slug}" is ${why} \u2014 it owns no space, so it cannot be an onboarding start`
39852
+ );
38644
39853
  return;
38645
39854
  }
38646
39855
  const isStr = (v) => typeof v === "string" && v.trim().length > 0;
38647
39856
  const strList = (v) => Array.isArray(v) && v.every(isStr);
38648
39857
  const st = raw;
38649
39858
  const fs = st?.firstSession;
38650
- const shapeOk = !!st && typeof st === "object" && !Array.isArray(st) && Number.isInteger(st.order) && st.order > 0 && isStr(st.label) && isStr(st.promise) && strList(st.suggestFor) && (st.profile === void 0 || isStr(st.profile)) && strList(st.views) && strList(st.starters) && Array.isArray(st.example) && st.example.every((e) => e && isStr(e.title) && (e.values === void 0 || typeof e.values === "object" && e.values !== null && !Array.isArray(e.values))) && !!fs && isStr(fs.title) && isStr(fs.goal);
39859
+ const shapeOk = !!st && typeof st === "object" && !Array.isArray(st) && Number.isInteger(st.order) && st.order > 0 && isStr(st.label) && isStr(st.promise) && strList(st.suggestFor) && (st.profile === void 0 || isStr(st.profile)) && strList(st.views) && strList(st.starters) && Array.isArray(st.example) && st.example.every(
39860
+ (e) => e && isStr(e.title) && (e.values === void 0 || typeof e.values === "object" && e.values !== null && !Array.isArray(e.values))
39861
+ ) && !!fs && isStr(fs.title) && isStr(fs.goal);
38651
39862
  if (!shapeOk) {
38652
- add("start-shape", "meta.start", "meta.start must be { order (int \u2265 1), label, promise, suggestFor[], profile?, views[], example[{ title, values? }], firstSession{ title, goal }, starters[] }");
39863
+ add(
39864
+ "start-shape",
39865
+ "meta.start",
39866
+ "meta.start must be { order (int \u2265 1), label, promise, suggestFor[], profile?, views[], example[{ title, values? }], firstSession{ title, goal }, starters[] }"
39867
+ );
38653
39868
  return;
38654
39869
  }
38655
39870
  const start = st;
38656
39871
  const primary = tpl.meta.intent?.primary;
38657
39872
  if (start.profile !== void 0 && start.profile === primary)
38658
- add("start-profile-redundant", "meta.start.profile", `meta.start.profile repeats meta.intent.primary "${primary}" \u2014 omit it (the start defaults to the primary output)`);
39873
+ add(
39874
+ "start-profile-redundant",
39875
+ "meta.start.profile",
39876
+ `meta.start.profile repeats meta.intent.primary "${primary}" \u2014 omit it (the start defaults to the primary output)`
39877
+ );
38659
39878
  const profile = startProfileOf(tpl.meta);
38660
39879
  if (!profile) {
38661
- add("start-profile-missing", "meta.profile", `meta.start names no kind and "${tpl.meta.slug}" declares no meta.intent.primary to default to`);
39880
+ add(
39881
+ "start-profile-missing",
39882
+ "meta.profile",
39883
+ `meta.start names no kind and "${tpl.meta.slug}" declares no meta.intent.primary to default to`
39884
+ );
38662
39885
  return;
38663
39886
  }
38664
39887
  if (start.label.trim().length > INTENT_LABEL_MAX)
38665
- add("start-label", "meta.start.label", `meta.start.label must be at most ${INTENT_LABEL_MAX} characters (got ${JSON.stringify(start.label)})`);
39888
+ add(
39889
+ "start-label",
39890
+ "meta.start.label",
39891
+ `meta.start.label must be at most ${INTENT_LABEL_MAX} characters (got ${JSON.stringify(start.label)})`
39892
+ );
38666
39893
  const [exMin, exMax] = START_EXAMPLE_RANGE;
38667
39894
  if (start.example.length < exMin || start.example.length > exMax)
38668
- add("start-example-count", "meta.start.example", `meta.start.example needs ${exMin}-${exMax} rows (got ${start.example.length})`);
39895
+ add(
39896
+ "start-example-count",
39897
+ "meta.start.example",
39898
+ `meta.start.example needs ${exMin}-${exMax} rows (got ${start.example.length})`
39899
+ );
38669
39900
  const [stMin, stMax] = START_STARTERS_RANGE;
38670
39901
  if (start.starters.length < stMin || start.starters.length > stMax)
38671
- add("start-starters-count", "meta.start.starters", `meta.start.starters needs ${stMin}-${stMax} chips (got ${start.starters.length})`);
39902
+ add(
39903
+ "start-starters-count",
39904
+ "meta.start.starters",
39905
+ `meta.start.starters needs ${stMin}-${stMax} chips (got ${start.starters.length})`
39906
+ );
38672
39907
  if (start.views.length < 1 || start.views.length > START_VIEWS_MAX)
38673
- add("start-views-count", "meta.start.views", `meta.start.views needs 1-${START_VIEWS_MAX} view slugs (got ${start.views.length})`);
39908
+ add(
39909
+ "start-views-count",
39910
+ "meta.start.views",
39911
+ `meta.start.views needs 1-${START_VIEWS_MAX} view slugs (got ${start.views.length})`
39912
+ );
38674
39913
  start.views.forEach((slug, i) => {
38675
39914
  const at = `meta.start.views[${i}]`;
38676
39915
  const view = (tpl.views ?? []).find((v) => v.slug === slug);
38677
39916
  if (!view) {
38678
- add("start-views-exist", at, `"${slug}" is not a view (by slug) of "${tpl.meta.slug}"`);
39917
+ add(
39918
+ "start-views-exist",
39919
+ at,
39920
+ `"${slug}" is not a view (by slug) of "${tpl.meta.slug}"`
39921
+ );
38679
39922
  return;
38680
39923
  }
38681
- const scope = [view.scopeProfileSlug, ...view.scopeProfileSlugs ?? []].filter(Boolean);
39924
+ const scope = [
39925
+ view.scopeProfileSlug,
39926
+ ...view.scopeProfileSlugs ?? []
39927
+ ].filter(Boolean);
38682
39928
  if (!scope.includes(profile))
38683
- add("start-views-scope", at, `view "${slug}" is not scoped to "${profile}" (scope: ${scope.join(", ") || "none"})`);
39929
+ add(
39930
+ "start-views-scope",
39931
+ at,
39932
+ `view "${slug}" is not scoped to "${profile}" (scope: ${scope.join(", ") || "none"})`
39933
+ );
38684
39934
  });
38685
39935
  const closure = [...collectDependencyClosure(tpl, resolveDep)];
38686
- const sources = [tpl, ...closure.map(resolveDep).filter((t) => !!t)];
38687
- const decls = sources.flatMap((t) => (t.profiles ?? []).filter((p) => p.slug === profile));
39936
+ const sources = [
39937
+ tpl,
39938
+ ...closure.map(resolveDep).filter((t) => !!t)
39939
+ ];
39940
+ const decls = sources.flatMap(
39941
+ (t) => (t.profiles ?? []).filter((p) => p.slug === profile)
39942
+ );
38688
39943
  if (decls.length === 0) {
38689
39944
  if (!closure.some((d) => !resolveDep(d)))
38690
- add("start-profile-unknown", "meta.profile", `"${profile}" is neither declared by "${tpl.meta.slug}" nor by a template it depends on`);
39945
+ add(
39946
+ "start-profile-unknown",
39947
+ "meta.profile",
39948
+ `"${profile}" is neither declared by "${tpl.meta.slug}" nor by a template it depends on`
39949
+ );
38691
39950
  } else {
38692
- const props = new Map(decls.flatMap((p) => p.properties ?? []).map((p) => [p.slug, p]));
39951
+ const props = new Map(
39952
+ decls.flatMap((p) => p.properties ?? []).map((p) => [p.slug, p])
39953
+ );
38693
39954
  start.example.forEach((row, i) => {
38694
39955
  for (const [key, value] of Object.entries(row.values ?? {})) {
38695
39956
  const at = `meta.start.example[${i}].values.${key}`;
38696
39957
  const prop = props.get(key);
38697
- if (!prop) add("start-example-property", at, `"${key}" is not a property of "${profile}"`);
39958
+ if (!prop)
39959
+ add(
39960
+ "start-example-property",
39961
+ at,
39962
+ `"${key}" is not a property of "${profile}"`
39963
+ );
38698
39964
  else if (prop.enumValues?.length && !prop.enumValues.includes(value))
38699
- add("start-example-enum", at, `${JSON.stringify(value)} is not one of ${profile}.${key}: ${prop.enumValues.join(", ")}`);
39965
+ add(
39966
+ "start-example-enum",
39967
+ at,
39968
+ `${JSON.stringify(value)} is not one of ${profile}.${key}: ${prop.enumValues.join(", ")}`
39969
+ );
38700
39970
  }
38701
39971
  });
38702
39972
  }
38703
39973
  const ids = /* @__PURE__ */ new Set();
38704
39974
  start.suggestFor.forEach((id, i) => {
38705
- if (ids.has(id)) add("start-suggest-duplicate", `meta.start.suggestFor[${i}]`, `identity "${id}" is listed twice`);
39975
+ if (ids.has(id))
39976
+ add(
39977
+ "start-suggest-duplicate",
39978
+ `meta.start.suggestFor[${i}]`,
39979
+ `identity "${id}" is listed twice`
39980
+ );
38706
39981
  ids.add(id);
38707
39982
  });
38708
39983
  for (const other of corpus ?? []) {
38709
39984
  const o = other.meta?.start;
38710
39985
  if (!o || other.meta.slug === tpl.meta.slug) continue;
38711
39986
  if (o.order === start.order)
38712
- add("start-order-duplicate", "meta.start.order", `order ${start.order} is also used by "${other.meta.slug}"`);
39987
+ add(
39988
+ "start-order-duplicate",
39989
+ "meta.start.order",
39990
+ `order ${start.order} is also used by "${other.meta.slug}"`
39991
+ );
38713
39992
  for (const id of o.suggestFor ?? [])
38714
- if (ids.has(id)) add("start-suggest-duplicate", "meta.start.suggestFor", `identity "${id}" is also suggested by "${other.meta.slug}"`);
39993
+ if (ids.has(id))
39994
+ add(
39995
+ "start-suggest-duplicate",
39996
+ "meta.start.suggestFor",
39997
+ `identity "${id}" is also suggested by "${other.meta.slug}"`
39998
+ );
38715
39999
  }
38716
40000
  }
38717
40001
  function hasCorpus(resolveDep) {
@@ -38839,9 +40123,17 @@ function validateTemplate(authored, authoredOpts = {}) {
38839
40123
  for (const [i, cell] of (tpl.spacePackage?.cells ?? []).entries()) {
38840
40124
  const at = `spacePackage.cells[${i}]`;
38841
40125
  if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(cell.key ?? "")) {
38842
- add("space-package-cell-key", `${at}.key`, "A space package cell needs a kebab-case key");
40126
+ add(
40127
+ "space-package-cell-key",
40128
+ `${at}.key`,
40129
+ "A space package cell needs a kebab-case key"
40130
+ );
38843
40131
  } else if (packageCellKeys.has(cell.key)) {
38844
- add("space-package-cell-key-duplicate", `${at}.key`, `Space package cell key "${cell.key}" is declared twice`);
40132
+ add(
40133
+ "space-package-cell-key-duplicate",
40134
+ `${at}.key`,
40135
+ `Space package cell key "${cell.key}" is declared twice`
40136
+ );
38845
40137
  } else {
38846
40138
  packageCellKeys.add(cell.key);
38847
40139
  }
@@ -38856,7 +40148,10 @@ function validateTemplate(authored, authoredOpts = {}) {
38856
40148
  }
38857
40149
  const entryCellKeys = [
38858
40150
  ["app.cellKey", tpl.app?.kind === "stored" ? tpl.app.cellKey : void 0],
38859
- ["layout.primarySurface.cellKey", authoredPrimary?.kind === "cell" ? authoredPrimary.cellKey : void 0]
40151
+ [
40152
+ "layout.primarySurface.cellKey",
40153
+ authoredPrimary?.kind === "cell" ? authoredPrimary.cellKey : void 0
40154
+ ]
38860
40155
  ];
38861
40156
  for (const [path, cellKey] of entryCellKeys) {
38862
40157
  if (!cellKey?.startsWith("cell:")) continue;
@@ -38881,7 +40176,8 @@ function validateTemplate(authored, authoredOpts = {}) {
38881
40176
  );
38882
40177
  }
38883
40178
  for (const profile of tpl.profiles || []) {
38884
- if (!RESERVED_PROFILE_SLUGS.has(String(profile.slug).trim().toLowerCase())) continue;
40179
+ if (!RESERVED_PROFILE_SLUGS.has(String(profile.slug).trim().toLowerCase()))
40180
+ continue;
38885
40181
  add(
38886
40182
  "profile-slug-reserved",
38887
40183
  `profiles.${profile.slug}`,
@@ -39135,7 +40431,11 @@ function validateTemplate(authored, authoredOpts = {}) {
39135
40431
  "a template rule needs a kebab-case `key` (its identity across versions)"
39136
40432
  );
39137
40433
  } else if (ruleKeys.has(r.key)) {
39138
- add("rule-key-duplicate", `${where}.key`, `duplicate rule key "${r.key}"`);
40434
+ add(
40435
+ "rule-key-duplicate",
40436
+ `${where}.key`,
40437
+ `duplicate rule key "${r.key}"`
40438
+ );
39139
40439
  } else {
39140
40440
  ruleKeys.add(r.key);
39141
40441
  }
@@ -39156,7 +40456,11 @@ function validateTemplate(authored, authoredOpts = {}) {
39156
40456
  continue;
39157
40457
  }
39158
40458
  if (skillSlugs.has(s.slug)) {
39159
- add("skill-duplicate", `${where}.slug`, `duplicate skill slug "${s.slug}"`);
40459
+ add(
40460
+ "skill-duplicate",
40461
+ `${where}.slug`,
40462
+ `duplicate skill slug "${s.slug}"`
40463
+ );
39160
40464
  } else {
39161
40465
  skillSlugs.add(s.slug);
39162
40466
  }