@tacuchi/agent-workflow-cli 20.26.0 → 21.1.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.
Files changed (220) hide show
  1. package/README.md +2 -1
  2. package/dist/adapters/node-file-system.js +3 -0
  3. package/dist/adapters/node-file-system.js.map +1 -1
  4. package/dist/application/capability/compose.js +161 -0
  5. package/dist/application/capability/compose.js.map +1 -0
  6. package/dist/application/capability/descriptor-loader.js +109 -0
  7. package/dist/application/capability/descriptor-loader.js.map +1 -0
  8. package/dist/application/capability/design-handler.js +299 -0
  9. package/dist/application/capability/design-handler.js.map +1 -0
  10. package/dist/application/capability/dispatcher.js +312 -0
  11. package/dist/application/capability/dispatcher.js.map +1 -0
  12. package/dist/application/capability/durable-effect.js +220 -0
  13. package/dist/application/capability/durable-effect.js.map +1 -0
  14. package/dist/application/capability/installed-inventory.js +168 -0
  15. package/dist/application/capability/installed-inventory.js.map +1 -0
  16. package/dist/application/capability/readiness.js +204 -0
  17. package/dist/application/capability/readiness.js.map +1 -0
  18. package/dist/application/capability/resolution.js +264 -0
  19. package/dist/application/capability/resolution.js.map +1 -0
  20. package/dist/application/capability/wrapper.js +187 -0
  21. package/dist/application/capability/wrapper.js.map +1 -0
  22. package/dist/application/context/manifest.js +11 -5
  23. package/dist/application/context/manifest.js.map +1 -1
  24. package/dist/application/context/measure.js +5 -2
  25. package/dist/application/context/measure.js.map +1 -1
  26. package/dist/application/context/plan-service.js +6 -6
  27. package/dist/application/context/plan-service.js.map +1 -1
  28. package/dist/application/design/design-bundle-service.js +148 -0
  29. package/dist/application/design/design-bundle-service.js.map +1 -0
  30. package/dist/application/design/design-gate-service.js +246 -0
  31. package/dist/application/design/design-gate-service.js.map +1 -0
  32. package/dist/application/design/design-graph-service.js +85 -0
  33. package/dist/application/design/design-graph-service.js.map +1 -0
  34. package/dist/application/design/design-index-service.js +132 -0
  35. package/dist/application/design/design-index-service.js.map +1 -0
  36. package/dist/application/design/design-proposal-service.js +69 -0
  37. package/dist/application/design/design-proposal-service.js.map +1 -0
  38. package/dist/application/design/design-publish-service.js +756 -0
  39. package/dist/application/design/design-publish-service.js.map +1 -0
  40. package/dist/application/design/design-record-service.js +100 -0
  41. package/dist/application/design/design-record-service.js.map +1 -0
  42. package/dist/application/design/design-resolver-service.js +165 -0
  43. package/dist/application/design/design-resolver-service.js.map +1 -0
  44. package/dist/application/flow/advance.js +533 -0
  45. package/dist/application/flow/advance.js.map +1 -0
  46. package/dist/application/flow/flow-service.js +65 -0
  47. package/dist/application/flow/flow-service.js.map +1 -0
  48. package/dist/application/flow/run-projection.js +80 -0
  49. package/dist/application/flow/run-projection.js.map +1 -0
  50. package/dist/application/flow/run-state-service.js +107 -0
  51. package/dist/application/flow/run-state-service.js.map +1 -0
  52. package/dist/application/flow/submit.js +423 -0
  53. package/dist/application/flow/submit.js.map +1 -0
  54. package/dist/application/resume-service.js +46 -14
  55. package/dist/application/resume-service.js.map +1 -1
  56. package/dist/application/self/install-skill.js +11 -0
  57. package/dist/application/self/install-skill.js.map +1 -1
  58. package/dist/application/self/uninstall.js +21 -0
  59. package/dist/application/self/uninstall.js.map +1 -1
  60. package/dist/application/semantic-operation/protocol.js +18 -12
  61. package/dist/application/semantic-operation/protocol.js.map +1 -1
  62. package/dist/application/semantic-operation/publish.js +56 -9
  63. package/dist/application/semantic-operation/publish.js.map +1 -1
  64. package/dist/application/skills-resolver-service.js +27 -6
  65. package/dist/application/skills-resolver-service.js.map +1 -1
  66. package/dist/application/status-service.js +5 -1
  67. package/dist/application/status-service.js.map +1 -1
  68. package/dist/application/workline-index-service.js +6 -0
  69. package/dist/application/workline-index-service.js.map +1 -1
  70. package/dist/application/workspace-init-service.js +22 -2
  71. package/dist/application/workspace-init-service.js.map +1 -1
  72. package/dist/cli/commands/capability.js +182 -0
  73. package/dist/cli/commands/capability.js.map +1 -0
  74. package/dist/cli/commands/designs.js +110 -0
  75. package/dist/cli/commands/designs.js.map +1 -0
  76. package/dist/cli/commands/flow.js +71 -0
  77. package/dist/cli/commands/flow.js.map +1 -0
  78. package/dist/cli/commands/index.js +6 -0
  79. package/dist/cli/commands/index.js.map +1 -1
  80. package/dist/cli/commands/resume.js +8 -0
  81. package/dist/cli/commands/resume.js.map +1 -1
  82. package/dist/cli/commands/skills.js +55 -2
  83. package/dist/cli/commands/skills.js.map +1 -1
  84. package/dist/cli/commands/status.js +50 -0
  85. package/dist/cli/commands/status.js.map +1 -1
  86. package/dist/cli/help-groups.js +9 -0
  87. package/dist/cli/help-groups.js.map +1 -1
  88. package/dist/cli/parser.js +7 -0
  89. package/dist/cli/parser.js.map +1 -1
  90. package/dist/cli/tui/data/workflow-content.js +5 -0
  91. package/dist/cli/tui/data/workflow-content.js.map +1 -1
  92. package/dist/cli/tui/tabs/workflow-tab.js +5 -1
  93. package/dist/cli/tui/tabs/workflow-tab.js.map +1 -1
  94. package/dist/domain/capability/descriptor.js +553 -0
  95. package/dist/domain/capability/descriptor.js.map +1 -0
  96. package/dist/domain/capability/effects.js +90 -0
  97. package/dist/domain/capability/effects.js.map +1 -0
  98. package/dist/domain/capability/protocol.js +494 -0
  99. package/dist/domain/capability/protocol.js.map +1 -0
  100. package/dist/domain/contract-reader.js +84 -0
  101. package/dist/domain/contract-reader.js.map +1 -0
  102. package/dist/domain/design/adapter.js +161 -0
  103. package/dist/domain/design/adapter.js.map +1 -0
  104. package/dist/domain/design/artifact-body.js +223 -0
  105. package/dist/domain/design/artifact-body.js.map +1 -0
  106. package/dist/domain/design/artifact.js +750 -0
  107. package/dist/domain/design/artifact.js.map +1 -0
  108. package/dist/domain/design/baseline.js +359 -0
  109. package/dist/domain/design/baseline.js.map +1 -0
  110. package/dist/domain/design/capability.js +310 -0
  111. package/dist/domain/design/capability.js.map +1 -0
  112. package/dist/domain/design/closure.js +161 -0
  113. package/dist/domain/design/closure.js.map +1 -0
  114. package/dist/domain/design/direct.js +108 -0
  115. package/dist/domain/design/direct.js.map +1 -0
  116. package/dist/domain/design/external-send.js +65 -0
  117. package/dist/domain/design/external-send.js.map +1 -0
  118. package/dist/domain/design/governance.js +298 -0
  119. package/dist/domain/design/governance.js.map +1 -0
  120. package/dist/domain/design/identity.js +145 -0
  121. package/dist/domain/design/identity.js.map +1 -0
  122. package/dist/domain/design/manifest.js +552 -0
  123. package/dist/domain/design/manifest.js.map +1 -0
  124. package/dist/domain/design/maturity.js +305 -0
  125. package/dist/domain/design/maturity.js.map +1 -0
  126. package/dist/domain/design/naming.js +117 -0
  127. package/dist/domain/design/naming.js.map +1 -0
  128. package/dist/domain/design/offline.js +92 -0
  129. package/dist/domain/design/offline.js.map +1 -0
  130. package/dist/domain/design/profiles.js +212 -0
  131. package/dist/domain/design/profiles.js.map +1 -0
  132. package/dist/domain/design/projections.js +165 -0
  133. package/dist/domain/design/projections.js.map +1 -0
  134. package/dist/domain/design/proposal.js +234 -0
  135. package/dist/domain/design/proposal.js.map +1 -0
  136. package/dist/domain/design/reference.js +234 -0
  137. package/dist/domain/design/reference.js.map +1 -0
  138. package/dist/domain/design/render-bundle.js +0 -0
  139. package/dist/domain/design/render-bundle.js.map +1 -0
  140. package/dist/domain/design/rendition.js +472 -0
  141. package/dist/domain/design/rendition.js.map +1 -0
  142. package/dist/domain/design/retired.js +61 -0
  143. package/dist/domain/design/retired.js.map +1 -0
  144. package/dist/domain/design/revision.js +219 -0
  145. package/dist/domain/design/revision.js.map +1 -0
  146. package/dist/domain/design/secrets.js +86 -0
  147. package/dist/domain/design/secrets.js.map +1 -0
  148. package/dist/domain/design/sources.js +180 -0
  149. package/dist/domain/design/sources.js.map +1 -0
  150. package/dist/domain/design/validation.js +19 -0
  151. package/dist/domain/design/validation.js.map +1 -0
  152. package/dist/domain/design/visual-evidence.js +155 -0
  153. package/dist/domain/design/visual-evidence.js.map +1 -0
  154. package/dist/domain/design/yaml-subset.js +390 -0
  155. package/dist/domain/design/yaml-subset.js.map +1 -0
  156. package/dist/domain/flow/answer.js +459 -0
  157. package/dist/domain/flow/answer.js.map +1 -0
  158. package/dist/domain/flow/authority.js +2276 -0
  159. package/dist/domain/flow/authority.js.map +1 -0
  160. package/dist/domain/flow/authorization.js +62 -0
  161. package/dist/domain/flow/authorization.js.map +1 -0
  162. package/dist/domain/flow/directive.js +421 -0
  163. package/dist/domain/flow/directive.js.map +1 -0
  164. package/dist/domain/flow/rules.js +140 -0
  165. package/dist/domain/flow/rules.js.map +1 -0
  166. package/dist/domain/flow/run-state.js +317 -0
  167. package/dist/domain/flow/run-state.js.map +1 -0
  168. package/dist/domain/harnesses.js +21 -0
  169. package/dist/domain/harnesses.js.map +1 -1
  170. package/dist/domain/safe-path.js +23 -0
  171. package/dist/domain/safe-path.js.map +1 -0
  172. package/dist/domain/skills.js +26 -3
  173. package/dist/domain/skills.js.map +1 -1
  174. package/package.json +1 -1
  175. package/skills/w/SKILL.md +15 -13
  176. package/skills/w/artifacts/README.md +3 -4
  177. package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +2 -2
  178. package/skills/w/commands/plan-exec.md +11 -5
  179. package/skills/w/commands/plan-new.md +6 -2
  180. package/skills/w/commands/plan-refine.md +6 -3
  181. package/skills/w/commands/quick.md +2 -2
  182. package/skills/w/commands/spec-new.md +2 -2
  183. package/skills/w/commands/spec-refine.md +1 -0
  184. package/skills/w/context/MANIFEST.json +57 -9
  185. package/skills/w/harness/HARNESS.md +20 -0
  186. package/skills/w/loops/CHASSIS.md +11 -20
  187. package/skills/w/loops/CODE-POLICIES.md +18 -9
  188. package/skills/w/loops/README.md +1 -1
  189. package/skills/w/loops/plan-exec-loop/LOOP.md +126 -62
  190. package/skills/w/loops/plan-new-loop/LOOP.md +71 -73
  191. package/skills/w/loops/plan-refine-loop/LOOP.md +20 -10
  192. package/skills/w/loops/quick-loop/LOOP.md +18 -26
  193. package/skills/w/loops/spec-refine-loop/LOOP.md +28 -30
  194. package/skills/w/modules/COMPACTION.md +2 -6
  195. package/skills/w/modules/DB-SCRIPTS-ONLY.md +2 -0
  196. package/skills/w/modules/DESIGN-REFERENCES.md +113 -0
  197. package/skills/w/modules/IDEATION-GATE.md +3 -3
  198. package/skills/w/modules/PERSIST-ROUTING.md +1 -0
  199. package/skills/w/modules/PLAN-EXECUTION-BATCHES.md +65 -0
  200. package/skills/w/modules/PLAN-INPUT.md +5 -3
  201. package/skills/w/modules/PLAN-REFINE-SPLIT.md +3 -1
  202. package/skills/w/modules/PLAN-SPLIT-GATE.md +7 -5
  203. package/skills/w/modules/PROMPT-CONTINUITY.md +3 -1
  204. package/skills/w/modules/SPEC-CHANGE-SHAPE.md +4 -4
  205. package/skills/w/roles/README.md +9 -5
  206. package/skills/w/roles/design/CONTRACT.md +80 -0
  207. package/skills/w/roles/design/ROLE.md +224 -0
  208. package/skills/w/schemas/capability-descriptor.schema.json +260 -0
  209. package/skills/w/schemas/design/design-baseline.v1.schema.json +71 -0
  210. package/skills/w/schemas/design/design-manifest.v1.schema.json +322 -0
  211. package/skills/w/schemas/design/design-render-bundle.v1.schema.json +191 -0
  212. package/skills/w/schemas/design/design-rendition.v1.schema.json +232 -0
  213. package/skills/w/schemas/design/design-review.v1.schema.json +72 -0
  214. package/skills/w/schemas/design/design-revocation.v1.schema.json +54 -0
  215. package/skills/w/schemas/design/ui-flow.v1.schema.json +211 -0
  216. package/skills/w/schemas/design/ui-screen.v1.schema.json +242 -0
  217. package/skills/w/artifacts/artifacts-design/SPEC.md +0 -42
  218. package/skills/w/modules/PLAN-DESIGN-SPECS.md +0 -12
  219. package/skills/w/modules/PLAN-REFINE-DESIGN-SPECS.md +0 -7
  220. package/skills/w/roles/ui-spec/ROLE.md +0 -147
@@ -0,0 +1,310 @@
1
+ import { CAPABILITY_CONTRACT_VERSION } from "../capability/descriptor.js";
2
+ /**
3
+ * What the `design` capability IS, said once.
4
+ *
5
+ * The public identity is `design` and nothing else. `ui-design` — the role this
6
+ * replaces — and `ui-spec` — the skill that used to fill it — are not aliases,
7
+ * not alternative implementations and not accepted names (S013/AC-CAP-01). A
8
+ * second name for one capability is a second contract wearing a disguise: the
9
+ * day they disagree, there is no way to say which one the package obeys.
10
+ *
11
+ * Typed as `SkillRole` on purpose: if `design` ever left the role catalog this
12
+ * stops compiling, so the identity cannot rot into a string that means nothing.
13
+ */
14
+ export const DESIGN_CAPABILITY = "design";
15
+ /**
16
+ * The five semantic operations, all over the SAME package (S013/AC-CAP-02).
17
+ *
18
+ * - `create` — the first revision of a package.
19
+ * - `update` — the next revision of one that exists.
20
+ * - `validate` — judge without writing: schemas, naming, references, maturity.
21
+ * - `render` — regenerate the projections; never normative, never sealed.
22
+ * - `record` — seal a governance decision about a revision that exists.
23
+ *
24
+ * `create` and `update` are one route with a different compare-and-swap base,
25
+ * not two formats. `render` and `record` write files a baseline never selects.
26
+ * None of them may invent a layout or a schema of its own — that is the whole
27
+ * content of «no parallel format».
28
+ */
29
+ export const DESIGN_OPERATIONS = ["create", "update", "validate", "render", "record"];
30
+ /**
31
+ * Every format this capability produces, and the only ones it accepts.
32
+ *
33
+ * The validators read their id from here rather than repeating a literal, so
34
+ * the registry is load-bearing instead of documentation: a new format cannot
35
+ * appear in code without appearing here, and `design-schema-guard` proves this
36
+ * table and the published JSON Schemas under `skills/w/schemas/design/` name
37
+ * the same things.
38
+ *
39
+ * This is the canonical authority (S013/AC-CAP-03). The built-in floor and any
40
+ * third-party improvement bound to the role write these and are validated by
41
+ * the same code; a contributor extends the domain by adding fields to a schema,
42
+ * never by declaring a format of their own.
43
+ */
44
+ export const CANONICAL_SCHEMAS = {
45
+ manifest: "workline.design-manifest/v1",
46
+ baseline: "workline.design-baseline/v1",
47
+ flow: "workline.ui-flow/v1",
48
+ screen: "workline.ui-screen/v1",
49
+ review: "workline.design-review/v1",
50
+ revocation: "workline.design-revocation/v1",
51
+ rendition: "workline.design-rendition/v1",
52
+ renderBundle: "workline.design-render-bundle/v1",
53
+ };
54
+ /**
55
+ * `design` as a capability descriptor — the v1 conformant instance.
56
+ *
57
+ * This is the same capability the table above describes, restated in the ONE
58
+ * form every consumer reads: the wrapper installed into a host, the dispatcher,
59
+ * discovery, the generated help and any flow that composes an operation all
60
+ * derive from this object rather than re-describing it. Two descriptions of one
61
+ * contract is the failure mode the whole layer exists to prevent.
62
+ *
63
+ * The typing is load-bearing twice over. `CapabilityDescriptor` keeps the shape
64
+ * honest, and `name: SkillRole` proves at COMPILE TIME that the capability's
65
+ * public identity and the `skills.toml` binding slot are the same string. The
66
+ * day someone names a capability differently from its role, the parallel public
67
+ * identity `S014/AC-ID-01` forbids reappears — and this annotation is the only
68
+ * barrier against it.
69
+ *
70
+ * The `schema` fields point at formats already published under
71
+ * `skills/w/schemas/design/`; the descriptor references them and does not become
72
+ * another one. That is why it lives here and the CONTRACT lives in
73
+ * `domain/capability` — a design format never has to know a capability exists.
74
+ */
75
+ export const DESIGN_DESCRIPTOR = {
76
+ contract_version: CAPABILITY_CONTRACT_VERSION,
77
+ name: DESIGN_CAPABILITY,
78
+ purpose: "producir, actualizar, juzgar, proyectar y sellar un UI Design Package v1 sobre un contrato único",
79
+ exposure: ["direct", "compose"],
80
+ default_operation: null,
81
+ operations: [
82
+ {
83
+ name: "create",
84
+ summary: "primera revisión de un package a partir de fuentes declaradas",
85
+ exposure: ["direct", "compose"],
86
+ // `optional`, not `required`: inside a workspace the package defaults to
87
+ // `docs/designs/`, and OUTSIDE one an explicit root still produces a
88
+ // portable package (`AC-DIR-04`). Refusing outside a workspace would turn
89
+ // "design something on a machine with no Workline project" into an error
90
+ // instead of an answer — and `resolveOutputRoot` is what keeps the other
91
+ // half of `AC-REQ-03` intact: no root declared, no writing, and never an
92
+ // invented one.
93
+ workspace: "optional",
94
+ interaction: "needs_input",
95
+ inputs: [
96
+ { name: "title", kind: "text", required: true, sensitivity: "public", schema: null },
97
+ { name: "sources", kind: "reference", required: true, sensitivity: "public", schema: null },
98
+ { name: "target", kind: "text", required: true, sensitivity: "public", schema: null },
99
+ {
100
+ name: "profile",
101
+ kind: "selection",
102
+ required: false,
103
+ sensitivity: "public",
104
+ schema: null,
105
+ },
106
+ { name: "context", kind: "text", required: false, sensitivity: "public", schema: null },
107
+ // The maturity the caller ASKS FOR. Declared as an input because the
108
+ // answer "you got `outline`, not `handoff`" only means something
109
+ // against something that was requested.
110
+ {
111
+ name: "maturity",
112
+ kind: "selection",
113
+ required: false,
114
+ sensitivity: "public",
115
+ schema: null,
116
+ },
117
+ ],
118
+ output: {
119
+ kind: "value_and_reference",
120
+ schema: CANONICAL_SCHEMAS.baseline,
121
+ completeness: ["complete", "partial"],
122
+ },
123
+ effects: [
124
+ { class: "read_only", idempotent: true, authorization: "invocation", approval: "none" },
125
+ {
126
+ class: "local_additive",
127
+ idempotent: false,
128
+ authorization: "invocation",
129
+ approval: "none",
130
+ },
131
+ ],
132
+ off: "blocked",
133
+ },
134
+ {
135
+ name: "update",
136
+ summary: "revisión siguiente de un package existente, con base de compare-and-swap",
137
+ exposure: ["direct", "compose"],
138
+ workspace: "optional",
139
+ interaction: "needs_input",
140
+ inputs: [
141
+ { name: "package", kind: "reference", required: true, sensitivity: "public", schema: null },
142
+ { name: "base", kind: "reference", required: true, sensitivity: "public", schema: null },
143
+ {
144
+ name: "sources",
145
+ kind: "reference",
146
+ required: false,
147
+ sensitivity: "public",
148
+ schema: null,
149
+ },
150
+ { name: "context", kind: "text", required: false, sensitivity: "public", schema: null },
151
+ {
152
+ name: "maturity",
153
+ kind: "selection",
154
+ required: false,
155
+ sensitivity: "public",
156
+ schema: null,
157
+ },
158
+ ],
159
+ output: {
160
+ kind: "value_and_reference",
161
+ schema: CANONICAL_SCHEMAS.baseline,
162
+ completeness: ["complete", "partial"],
163
+ },
164
+ effects: [
165
+ { class: "read_only", idempotent: true, authorization: "invocation", approval: "none" },
166
+ {
167
+ class: "local_additive",
168
+ idempotent: false,
169
+ authorization: "invocation",
170
+ approval: "none",
171
+ },
172
+ // Publishing a revision moves the manifest's current baseline: an
173
+ // existing file says something else afterwards, so a human sees it first.
174
+ {
175
+ class: "mutate_overwrite",
176
+ idempotent: false,
177
+ authorization: "preflight",
178
+ approval: "visible",
179
+ },
180
+ ],
181
+ off: "blocked",
182
+ },
183
+ {
184
+ name: "validate",
185
+ summary: "juzgar un package sin escribir: schemas, naming, referencias y madurez",
186
+ exposure: ["direct", "compose"],
187
+ // The one operation a flow can reach with `design` off, so it must not
188
+ // depend on workspace state it might not have.
189
+ workspace: "optional",
190
+ interaction: "single_pass",
191
+ inputs: [
192
+ { name: "package", kind: "reference", required: true, sensitivity: "public", schema: null },
193
+ {
194
+ name: "profile",
195
+ kind: "selection",
196
+ required: false,
197
+ sensitivity: "public",
198
+ schema: null,
199
+ },
200
+ ],
201
+ output: { kind: "value", schema: null, completeness: ["complete"] },
202
+ effects: [
203
+ { class: "read_only", idempotent: true, authorization: "invocation", approval: "none" },
204
+ ],
205
+ // Survives `off` on purpose: a package that already exists stays
206
+ // consultable and consumable, or turning the capability off would
207
+ // retroactively invalidate work nobody asked to discard.
208
+ off: "allowed",
209
+ },
210
+ {
211
+ name: "render",
212
+ summary: "regenerar las proyecciones de una revisión y preparar el handoff a un proveedor",
213
+ exposure: ["direct", "compose"],
214
+ workspace: "optional",
215
+ interaction: "single_pass",
216
+ inputs: [
217
+ { name: "package", kind: "reference", required: true, sensitivity: "public", schema: null },
218
+ { name: "profile", kind: "selection", required: true, sensitivity: "public", schema: null },
219
+ ],
220
+ output: {
221
+ kind: "reference",
222
+ schema: CANONICAL_SCHEMAS.renderBundle,
223
+ completeness: ["complete", "partial"],
224
+ },
225
+ effects: [
226
+ { class: "read_only", idempotent: true, authorization: "invocation", approval: "none" },
227
+ {
228
+ class: "local_additive",
229
+ idempotent: true,
230
+ authorization: "invocation",
231
+ approval: "none",
232
+ },
233
+ // A provider profile can leave the machine. Declared here rather than
234
+ // decided at call time: the preflight is what makes the destination and
235
+ // the payload visible before anything is sent.
236
+ {
237
+ class: "network_external",
238
+ idempotent: false,
239
+ authorization: "preflight",
240
+ approval: "visible",
241
+ },
242
+ ],
243
+ off: "blocked",
244
+ },
245
+ {
246
+ name: "record",
247
+ summary: "sellar una decisión de gobierno sobre una revisión existente",
248
+ exposure: ["direct", "compose"],
249
+ workspace: "optional",
250
+ interaction: "single_pass",
251
+ inputs: [
252
+ { name: "package", kind: "reference", required: true, sensitivity: "public", schema: null },
253
+ {
254
+ name: "revision",
255
+ kind: "reference",
256
+ required: true,
257
+ sensitivity: "public",
258
+ schema: null,
259
+ },
260
+ { name: "decision", kind: "text", required: true, sensitivity: "public", schema: null },
261
+ ],
262
+ output: {
263
+ kind: "reference",
264
+ schema: CANONICAL_SCHEMAS.review,
265
+ completeness: ["complete"],
266
+ },
267
+ effects: [
268
+ { class: "read_only", idempotent: true, authorization: "invocation", approval: "none" },
269
+ {
270
+ class: "local_additive",
271
+ idempotent: false,
272
+ authorization: "invocation",
273
+ approval: "none",
274
+ },
275
+ // A revocation changes what a published revision means downstream.
276
+ {
277
+ class: "mutate_overwrite",
278
+ idempotent: false,
279
+ authorization: "preflight",
280
+ approval: "visible",
281
+ },
282
+ ],
283
+ off: "blocked",
284
+ },
285
+ ],
286
+ // Core with a built-in floor: the PLAN and SPEC gates that consume a package
287
+ // must keep working on a machine where nothing extra is installed.
288
+ floor: { builtin: true, kind: "core", improvements: "host_selected" },
289
+ degradations: [
290
+ { cause: "opaque_selection", action: "floor" },
291
+ { cause: "incompatible_improvement", action: "floor" },
292
+ { cause: "invalid_binding", action: "floor" },
293
+ { cause: "digest_changed", action: "floor" },
294
+ ],
295
+ compatibility: {
296
+ status: "active",
297
+ minimum_contract_version: CAPABILITY_CONTRACT_VERSION,
298
+ // This descriptor IS the capability, not an improvement to one.
299
+ improves: null,
300
+ // Not aliases. Listed so every entry surface can refuse them by NAME with a
301
+ // corrective action instead of failing with "unknown skill".
302
+ retired_names: ["ui-design", "ui-spec"],
303
+ retired_formats: [
304
+ "spec-section:## UI spec",
305
+ "session-design-spec:NNN-SPEC-<SLUG>.md",
306
+ "ui-spec-generator:output",
307
+ ],
308
+ },
309
+ };
310
+ //# sourceMappingURL=capability.js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;QAC5E,6DAA6D;QAC7D,aAAa,EAAE,CAAC,WAAW,EAAE,SAAS,CAAC;QACvC,eAAe,EAAE;YACf,yBAAyB;YACzB,wCAAwC;YACxC,0BAA0B;SAC3B;KACF;CACF,CAAC"}
@@ -0,0 +1,161 @@
1
+ import { parseArtifactRef } from "./identity.js";
2
+ const KIND_OF_PREFIX = {
3
+ FLW: "flow",
4
+ SCR: "screen",
5
+ RUL: "rule",
6
+ TOK: "token",
7
+ VIS: "rendition",
8
+ };
9
+ export function computeClosure(manifest, roots, read) {
10
+ const members = new Map();
11
+ const assets = new Set();
12
+ const failures = [];
13
+ const queue = roots.map((ref) => ({
14
+ ref,
15
+ via: null,
16
+ }));
17
+ while (queue.length > 0) {
18
+ const next = queue.shift();
19
+ if (next === undefined)
20
+ break;
21
+ const reached = visit(manifest, next, members, read);
22
+ if ("failure" in reached) {
23
+ failures.push(reached.failure);
24
+ continue;
25
+ }
26
+ for (const ref of reached.refs)
27
+ queue.push({ ref, via: reached.via });
28
+ for (const digest of reached.assets) {
29
+ // Un asset se alcanza solo si el package lo CUSTODIA: afirmar haber
30
+ // llegado a bytes que no están es la clausura mintiendo sobre su alcance.
31
+ if (manifest.catalog.assets.some((a) => a.digest === digest))
32
+ assets.add(digest);
33
+ else
34
+ failures.push(uncustodied(digest, manifest.id));
35
+ }
36
+ }
37
+ return { members: [...members.values()], assets: [...assets], failures };
38
+ }
39
+ /**
40
+ * Reaching the same revision twice can only WIDEN what is required.
41
+ *
42
+ * `states: []` means the whole revision, not "no states": a root written
43
+ * without an anchor asked for all of it. So an anchor never narrows a member
44
+ * that was already whole, and a whole reference swallows the anchors collected
45
+ * so far — otherwise adding a MORE specific root would shrink the closure.
46
+ */
47
+ function widen(member, anchor) {
48
+ if (member.states.length === 0)
49
+ return;
50
+ if (anchor === null) {
51
+ member.states.length = 0;
52
+ return;
53
+ }
54
+ if (!member.states.includes(anchor))
55
+ member.states.push(anchor);
56
+ }
57
+ /** One step of the walk: admit the reference, or say why it does not resolve. */
58
+ function visit(manifest, next, members, read) {
59
+ const nothing = { refs: [], assets: [], via: null };
60
+ const parsed = parseArtifactRef(next.ref);
61
+ if (parsed === null || parsed.package !== manifest.id) {
62
+ return { failure: foreignRoot(next.ref, manifest.id) };
63
+ }
64
+ const key = `${parsed.package}/${parsed.artifact}@r${parsed.revision}`;
65
+ const anchor = parsed.state ?? null;
66
+ const already = members.get(key);
67
+ if (already !== undefined) {
68
+ widen(already, anchor);
69
+ return nothing;
70
+ }
71
+ const entry = findEntry(manifest, parsed.artifact, parsed.revision);
72
+ const kind = KIND_OF_PREFIX[parsed.artifact.slice(0, 3)];
73
+ if (entry === null || kind === undefined) {
74
+ return { failure: unresolvable(next.ref, manifest.id) };
75
+ }
76
+ members.set(key, { ref: key, kind, states: anchor === null ? [] : [anchor], via: next.via });
77
+ if (kind !== "flow" && kind !== "screen")
78
+ return nothing;
79
+ const document = read(entry.path);
80
+ if (document === null)
81
+ return { failure: unreadable(entry.path, key) };
82
+ return { refs: reachableFrom(document), assets: assetsOf(document), via: key };
83
+ }
84
+ /**
85
+ * Everything a document DEPENDS ON, in the closure's terms.
86
+ *
87
+ * `flow_refs` is deliberately absent. It records which flows visit a screen —
88
+ * the INVERSE of `flow.nodes`, the screen's membership, not its needs. Walking
89
+ * both directions turns the closure into the connected component of the graph:
90
+ * one screen would drag in every flow that mentions it and every screen those
91
+ * flows touch, and a task would be blocked by designs it never consumes.
92
+ */
93
+ function reachableFrom(document) {
94
+ if (document.kind === "flow") {
95
+ return [document.entry, ...document.nodes, ...document.dependencies];
96
+ }
97
+ return [...document.dependencies.rules, ...document.dependencies.tokens];
98
+ }
99
+ function assetsOf(document) {
100
+ return document.kind === "flow" ? [] : document.dependencies.assets;
101
+ }
102
+ function findEntry(manifest, id, revision) {
103
+ for (const key of ["flows", "screens", "rules", "tokens", "renditions"]) {
104
+ const hit = manifest.catalog[key].find((e) => e.id === id && e.revision === revision);
105
+ if (hit !== undefined)
106
+ return hit;
107
+ }
108
+ return null;
109
+ }
110
+ function foreignRoot(ref, packageId) {
111
+ return {
112
+ code: "DESIGN_REFERENCE_MISSING",
113
+ artifact: ref,
114
+ message: `'${ref}' no es una referencia resoluble dentro de ${packageId}`,
115
+ action: "una clausura se calcula dentro de un package: usá DES-NNN/XXX-NNN@rN",
116
+ };
117
+ }
118
+ function unresolvable(ref, packageId) {
119
+ return {
120
+ code: "DESIGN_REFERENCE_MISSING",
121
+ artifact: ref,
122
+ message: `${packageId} no cataloga '${ref}'`,
123
+ action: "revisá la revisión exacta: la clausura no adivina la vigente",
124
+ };
125
+ }
126
+ function uncustodied(digest, packageId) {
127
+ return {
128
+ code: "DESIGN_REFERENCE_MISSING",
129
+ artifact: digest,
130
+ message: `${packageId} no custodia el asset ${digest}`,
131
+ action: "publicá el asset dentro del package: una clausura no alcanza bytes que no están",
132
+ };
133
+ }
134
+ function unreadable(path, ref) {
135
+ return {
136
+ code: "DESIGN_REFERENCE_FILE_MISSING",
137
+ artifact: path,
138
+ message: `'${path}' no se pudo leer para expandir ${ref}`,
139
+ action: "el catálogo promete ese archivo: restauralo o corregí su ruta",
140
+ };
141
+ }
142
+ /**
143
+ * The maturity a set of roots demands.
144
+ *
145
+ * Consuming an `outline` revision is not an error in itself — a task may
146
+ * legitimately reference a design that is still being shaped. What fails closed
147
+ * is IMPLEMENTING against it, which is the question this answers: which members
148
+ * of the closure are not yet `handoff`.
149
+ */
150
+ export function notReadyForHandoff(manifest, closure) {
151
+ return closure.members.filter((member) => {
152
+ if (member.kind !== "flow" && member.kind !== "screen")
153
+ return false;
154
+ const key = member.kind === "flow" ? "flows" : "screens";
155
+ const id = member.ref.split("/")[1]?.split("@")[0];
156
+ const revision = Number(member.ref.split("@r")[1]);
157
+ const entry = manifest.catalog[key].find((e) => e.id === id && e.revision === revision);
158
+ return entry?.maturity !== "handoff";
159
+ });
160
+ }
161
+ //# sourceMappingURL=closure.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"closure.js","sourceRoot":"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AAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,MAAM,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QACnD,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;QACxF,OAAO,KAAK,EAAE,QAAQ,KAAK,SAAS,CAAC;IACvC,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * What the DIRECT route adds on top of the capability contract.
3
+ *
4
+ * The generic half — envelope, attempts, outcomes, receipt correlation, the
5
+ * rule that a direct invocation opens no flow session — is already delivered
6
+ * and tested by the capability layer. Three things are left, and all three are
7
+ * design-domain decisions:
8
+ *
9
+ * - **Where the output lands.** Inside a workspace it defaults to
10
+ * `docs/designs/`; outside one it needs an explicit root and still produces
11
+ * something portable. A capability that simply refused outside a workspace
12
+ * would make "design something on a machine that has no Workline project" an
13
+ * error instead of an answer.
14
+ * - **Which domain fields the receipt carries.** The canonical receipt already
15
+ * says operation, validations, degradations, effects and next action; it
16
+ * knows nothing about packages, baselines or maturity. Those are added here
17
+ * and nowhere else — repeating the canonical ones would be a second receipt.
18
+ * - **What maturity the result may claim.** The one rule the whole ladder rests
19
+ * on: an omission that could change behavior means the answer is `outline`
20
+ * with a gap, never a `handoff` nobody can trace back.
21
+ */
22
+ import { checkSafeRelativePath } from "../safe-path.js";
23
+ import { handoffGapsFrom } from "./sources.js";
24
+ /** The conventional home of packages inside a workspace. */
25
+ export const DESIGNS_DIR = "docs/designs";
26
+ /**
27
+ * Decide where a directly-invoked operation writes.
28
+ *
29
+ * Being outside a workspace is not an error — it is a different mode, and the
30
+ * only thing it costs is that the caller has to say where. What is refused is
31
+ * guessing: writing a package into whatever directory the process happened to
32
+ * start in is how a design ends up somewhere nobody looks again.
33
+ */
34
+ export function resolveOutputRoot(workspace, target, artifact = "design") {
35
+ if (workspace === null) {
36
+ if (target === null || target.trim().length === 0) {
37
+ return {
38
+ ok: false,
39
+ failure: {
40
+ code: "DESIGN_OUTPUT_ROOT_REQUIRED",
41
+ artifact,
42
+ message: "fuera de un workspace hace falta una raíz explícita para el package",
43
+ action: "pasá 'target' con la ruta donde debe quedar el package",
44
+ },
45
+ };
46
+ }
47
+ // An explicit root outside a workspace is the caller's own path: it is not
48
+ // validated as workspace-relative, because it is not relative to one.
49
+ return { ok: true, value: { kind: "explicit", root: target.trim() } };
50
+ }
51
+ if (target === null || target.trim().length === 0) {
52
+ return { ok: true, value: { kind: "workspace", root: DESIGNS_DIR, declared: false } };
53
+ }
54
+ const safe = checkSafeRelativePath(target.trim());
55
+ if (!safe.ok) {
56
+ return {
57
+ ok: false,
58
+ failure: {
59
+ code: "DESIGN_OUTPUT_ROOT_UNSAFE",
60
+ artifact,
61
+ message: `'${target}' no es una ruta relativa válida dentro del workspace: ${safe.why}`,
62
+ action: `usá una ruta relativa dentro del workspace, por ejemplo '${DESIGNS_DIR}'`,
63
+ },
64
+ };
65
+ }
66
+ return { ok: true, value: { kind: "workspace", root: safe.path, declared: true } };
67
+ }
68
+ /**
69
+ * Whether a package written at this root is discoverable by the index.
70
+ *
71
+ * Only the ones under `docs/designs/` are. That is not a limitation of the
72
+ * index — it is what makes `AC-DIR-06` meaningful: a package created directly
73
+ * inside a workspace can be referenced later by a spec or a plan without ever
74
+ * having had a relationship with those flows, precisely because it landed where
75
+ * discovery looks.
76
+ */
77
+ export function isIndexable(root) {
78
+ if (root.kind !== "workspace")
79
+ return false;
80
+ const segments = root.root.split("/").filter((s) => s.length > 0);
81
+ const expected = DESIGNS_DIR.split("/");
82
+ return expected.every((segment, i) => segments[i] === segment);
83
+ }
84
+ /**
85
+ * The maturity the result may honestly claim.
86
+ *
87
+ * Two independent reasons to fall back to `outline`, and both are ceilings
88
+ * rather than opinions: the document-level verdict the `012` gate already
89
+ * computes, and an essential source that did not contribute. Neither can be
90
+ * argued past — a floor and an improvement get the same answer here, which is
91
+ * what stops an improvement from "achieving" a `handoff` the evidence does not
92
+ * support.
93
+ */
94
+ export function attainedMaturity(requested, gateVerdict, report) {
95
+ const gaps = handoffGapsFrom(report);
96
+ if (report.blocksHandoff)
97
+ return { attained: "outline", gaps };
98
+ if (requested === "handoff" && gateVerdict !== "handoff") {
99
+ return {
100
+ attained: gateVerdict,
101
+ gaps: [
102
+ `se pidió 'handoff' y la evidencia del package alcanza '${gateVerdict}': completá lo que el gate reclama`,
103
+ ],
104
+ };
105
+ }
106
+ return { attained: gateVerdict, gaps: [] };
107
+ }
108
+ //# sourceMappingURL=direct.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"direct.js","sourceRoot":"","sources":["../../../src/domain/design/direct.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAGxD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAG/C,4DAA4D;AAC5D,MAAM,CAAC,MAAM,WAAW,GAAG,cAAc,CAAC;AAY1C;;;;;;;GAOG;AACH,MAAM,UAAU,iBAAiB,CAC/B,SAAwB,EACxB,MAAqB,EACrB,QAAQ,GAAG,QAAQ;IAEnB,IAAI,SAAS,KAAK,IAAI,EAAE,CAAC;QACvB,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YAClD,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,OAAO,EAAE;oBACP,IAAI,EAAE,6BAA6B;oBACnC,QAAQ;oBACR,OAAO,EAAE,qEAAqE;oBAC9E,MAAM,EAAE,wDAAwD;iBACjE;aACF,CAAC;QACJ,CAAC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