@tacuchi/agent-workflow-cli 21.0.0 → 21.3.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 (170) hide show
  1. package/README.md +3 -2
  2. package/dist/adapters/git-cli.js +12 -7
  3. package/dist/adapters/git-cli.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 +195 -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-proposal-service.js +69 -0
  31. package/dist/application/design/design-proposal-service.js.map +1 -0
  32. package/dist/application/design/design-publish-service.js +275 -7
  33. package/dist/application/design/design-publish-service.js.map +1 -1
  34. package/dist/application/design/design-record-service.js +100 -0
  35. package/dist/application/design/design-record-service.js.map +1 -0
  36. package/dist/application/flow/advance.js +533 -0
  37. package/dist/application/flow/advance.js.map +1 -0
  38. package/dist/application/flow/flow-service.js +65 -0
  39. package/dist/application/flow/flow-service.js.map +1 -0
  40. package/dist/application/flow/run-projection.js +80 -0
  41. package/dist/application/flow/run-projection.js.map +1 -0
  42. package/dist/application/flow/run-state-service.js +107 -0
  43. package/dist/application/flow/run-state-service.js.map +1 -0
  44. package/dist/application/flow/submit.js +423 -0
  45. package/dist/application/flow/submit.js.map +1 -0
  46. package/dist/application/markdown.js +16 -2
  47. package/dist/application/markdown.js.map +1 -1
  48. package/dist/application/resume-service.js +23 -10
  49. package/dist/application/resume-service.js.map +1 -1
  50. package/dist/application/self/hooks-toml.js +137 -17
  51. package/dist/application/self/hooks-toml.js.map +1 -1
  52. package/dist/application/self/host-states.js +87 -1
  53. package/dist/application/self/host-states.js.map +1 -1
  54. package/dist/application/self/install-hooks.js +62 -6
  55. package/dist/application/self/install-hooks.js.map +1 -1
  56. package/dist/application/self/install-skill.js +37 -6
  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/skills-resolver-service.js +8 -2
  61. package/dist/application/skills-resolver-service.js.map +1 -1
  62. package/dist/application/status-service.js +4 -1
  63. package/dist/application/status-service.js.map +1 -1
  64. package/dist/application/workline-index-service.js +15 -2
  65. package/dist/application/workline-index-service.js.map +1 -1
  66. package/dist/application/workspace-init-service.js +13 -1
  67. package/dist/application/workspace-init-service.js.map +1 -1
  68. package/dist/cli/commands/capability.js +182 -0
  69. package/dist/cli/commands/capability.js.map +1 -0
  70. package/dist/cli/commands/flow.js +71 -0
  71. package/dist/cli/commands/flow.js.map +1 -0
  72. package/dist/cli/commands/index.js +4 -0
  73. package/dist/cli/commands/index.js.map +1 -1
  74. package/dist/cli/commands/skills.js +55 -2
  75. package/dist/cli/commands/skills.js.map +1 -1
  76. package/dist/cli/commands/status.js +5 -0
  77. package/dist/cli/commands/status.js.map +1 -1
  78. package/dist/cli/help-groups.js +6 -0
  79. package/dist/cli/help-groups.js.map +1 -1
  80. package/dist/cli/parser.js +6 -0
  81. package/dist/cli/parser.js.map +1 -1
  82. package/dist/cli/tui/components/host-admin-section.js +14 -2
  83. package/dist/cli/tui/components/host-admin-section.js.map +1 -1
  84. package/dist/cli/tui/data/workflow-content.js +13 -1
  85. package/dist/cli/tui/data/workflow-content.js.map +1 -1
  86. package/dist/cli/tui/tabs/workflow-tab.js +8 -1
  87. package/dist/cli/tui/tabs/workflow-tab.js.map +1 -1
  88. package/dist/domain/capability/descriptor.js +553 -0
  89. package/dist/domain/capability/descriptor.js.map +1 -0
  90. package/dist/domain/capability/effects.js +90 -0
  91. package/dist/domain/capability/effects.js.map +1 -0
  92. package/dist/domain/capability/protocol.js +494 -0
  93. package/dist/domain/capability/protocol.js.map +1 -0
  94. package/dist/domain/contract-reader.js +84 -0
  95. package/dist/domain/contract-reader.js.map +1 -0
  96. package/dist/domain/design/adapter.js +161 -0
  97. package/dist/domain/design/adapter.js.map +1 -0
  98. package/dist/domain/design/artifact.js +148 -4
  99. package/dist/domain/design/artifact.js.map +1 -1
  100. package/dist/domain/design/capability.js +263 -4
  101. package/dist/domain/design/capability.js.map +1 -1
  102. package/dist/domain/design/direct.js +108 -0
  103. package/dist/domain/design/direct.js.map +1 -0
  104. package/dist/domain/design/external-send.js +65 -0
  105. package/dist/domain/design/external-send.js.map +1 -0
  106. package/dist/domain/design/maturity.js +71 -0
  107. package/dist/domain/design/maturity.js.map +1 -1
  108. package/dist/domain/design/offline.js +92 -0
  109. package/dist/domain/design/offline.js.map +1 -0
  110. package/dist/domain/design/profiles.js +212 -0
  111. package/dist/domain/design/profiles.js.map +1 -0
  112. package/dist/domain/design/proposal.js +234 -0
  113. package/dist/domain/design/proposal.js.map +1 -0
  114. package/dist/domain/design/render-bundle.js +0 -0
  115. package/dist/domain/design/render-bundle.js.map +1 -0
  116. package/dist/domain/design/rendition.js +472 -0
  117. package/dist/domain/design/rendition.js.map +1 -0
  118. package/dist/domain/design/sources.js +180 -0
  119. package/dist/domain/design/sources.js.map +1 -0
  120. package/dist/domain/design/validation.js +12 -68
  121. package/dist/domain/design/validation.js.map +1 -1
  122. package/dist/domain/design/visual-evidence.js +155 -0
  123. package/dist/domain/design/visual-evidence.js.map +1 -0
  124. package/dist/domain/flow/answer.js +459 -0
  125. package/dist/domain/flow/answer.js.map +1 -0
  126. package/dist/domain/flow/authority.js +2338 -0
  127. package/dist/domain/flow/authority.js.map +1 -0
  128. package/dist/domain/flow/authorization.js +62 -0
  129. package/dist/domain/flow/authorization.js.map +1 -0
  130. package/dist/domain/flow/directive.js +421 -0
  131. package/dist/domain/flow/directive.js.map +1 -0
  132. package/dist/domain/flow/rules.js +140 -0
  133. package/dist/domain/flow/rules.js.map +1 -0
  134. package/dist/domain/flow/run-state.js +317 -0
  135. package/dist/domain/flow/run-state.js.map +1 -0
  136. package/dist/domain/harnesses.js +124 -4
  137. package/dist/domain/harnesses.js.map +1 -1
  138. package/dist/domain/host-verification.js +8 -8
  139. package/dist/domain/skills.js +13 -14
  140. package/dist/domain/skills.js.map +1 -1
  141. package/dist/domain/structured-choice-stamp.js +106 -0
  142. package/dist/domain/structured-choice-stamp.js.map +1 -0
  143. package/package.json +1 -1
  144. package/skills/w/SKILL.md +5 -5
  145. package/skills/w/context/MANIFEST.json +42 -1
  146. package/skills/w/harness/HARNESS.md +30 -4
  147. package/skills/w/loops/CHASSIS.md +11 -20
  148. package/skills/w/loops/CODE-POLICIES.md +9 -15
  149. package/skills/w/loops/plan-exec-loop/LOOP.md +11 -13
  150. package/skills/w/loops/plan-new-loop/LOOP.md +6 -4
  151. package/skills/w/loops/plan-refine-loop/LOOP.md +5 -3
  152. package/skills/w/loops/quick-loop/LOOP.md +18 -26
  153. package/skills/w/loops/spec-refine-loop/LOOP.md +14 -18
  154. package/skills/w/modules/COMPACTION.md +2 -6
  155. package/skills/w/modules/DB-SCRIPTS-ONLY.md +2 -0
  156. package/skills/w/modules/DESIGN-REFERENCES.md +15 -11
  157. package/skills/w/modules/IDEATION-GATE.md +3 -3
  158. package/skills/w/modules/PLAN-EXECUTION-BATCHES.md +17 -36
  159. package/skills/w/modules/PLAN-INPUT.md +5 -3
  160. package/skills/w/modules/PLAN-REFINE-SPLIT.md +3 -1
  161. package/skills/w/modules/PLAN-SPLIT-GATE.md +7 -5
  162. package/skills/w/modules/PROMPT-CONTINUITY.md +3 -1
  163. package/skills/w/modules/SPEC-CHANGE-SHAPE.md +4 -4
  164. package/skills/w/roles/README.md +2 -0
  165. package/skills/w/roles/design/CONTRACT.md +80 -0
  166. package/skills/w/roles/design/ROLE.md +7 -0
  167. package/skills/w/schemas/capability-descriptor.schema.json +260 -0
  168. package/skills/w/schemas/design/design-render-bundle.v1.schema.json +191 -0
  169. package/skills/w/schemas/design/design-rendition.v1.schema.json +232 -0
  170. package/skills/w/schemas/design/ui-screen.v1.schema.json +29 -1
@@ -0,0 +1,90 @@
1
+ /**
2
+ * What an operation is allowed to DO, said as a closed taxonomy.
3
+ *
4
+ * The six classes are ordered by how much trust they need, and the order is the
5
+ * point: the first two are what an invocation may authorize by itself, and
6
+ * everything below them needs a preflight the human can see before it happens.
7
+ * A descriptor that declares an operation `read_only` and then writes is a lie
8
+ * the runtime can catch, which is only possible because the declaration exists.
9
+ *
10
+ * `class` alone is not enough to decide, so each declaration also carries
11
+ * whether repeating it is safe (`idempotent`), who grants it (`authorization`)
12
+ * and whether a human sees it first (`approval`). Those three are what the
13
+ * authorization policy reads; the class is what makes them comparable across
14
+ * capabilities that share no code.
15
+ */
16
+ export const EFFECT_CLASSES = [
17
+ /** Reads declared, non-sensitive sources and returns. Persists nothing. */
18
+ "read_only",
19
+ /** Creates something new INSIDE the requested target. Overwrites nothing. */
20
+ "local_additive",
21
+ /** Rewrites or replaces something that already exists. */
22
+ "mutate_overwrite",
23
+ /** Runs code — a build, a renderer, a subprocess. */
24
+ "execute",
25
+ /** Leaves the machine: network, or a third-party provider. */
26
+ "network_external",
27
+ /** Removes or invalidates something a later run cannot reconstruct. */
28
+ "destructive",
29
+ ];
30
+ const CLASS_SET = new Set(EFFECT_CLASSES);
31
+ export function isEffectClass(value) {
32
+ return typeof value === "string" && CLASS_SET.has(value);
33
+ }
34
+ /**
35
+ * The only two classes an invocation may grant itself, and even then not always.
36
+ *
37
+ * Reading declared, non-sensitive sources and creating something new inside the
38
+ * target the caller already named are the two effects where asking would be
39
+ * ceremony: the caller asked for exactly that. Everything else — rewriting,
40
+ * running code, leaving the machine, destroying — is a decision someone has to
41
+ * see before it happens, and the ordering of `EFFECT_CLASSES` says which is
42
+ * which.
43
+ */
44
+ export const SELF_AUTHORIZABLE_CLASSES = ["read_only", "local_additive"];
45
+ export const OPEN_EFFECT_POLICY = { denied: [], preflight: [] };
46
+ /**
47
+ * Decide, for one operation, what the invocation may do by itself and what has
48
+ * to be shown first.
49
+ *
50
+ * Four gates, and a class has to clear all of them to be self-authorized: the
51
+ * taxonomy allows it, the descriptor asked for `invocation` rather than
52
+ * `preflight`, the host does not demand a preflight, and the concrete context
53
+ * has not turned it into something bigger — reading SENSITIVE sources is not the
54
+ * `read_only` the caller authorized, and writing OUTSIDE the named target is not
55
+ * the `local_additive` they asked for.
56
+ */
57
+ export function authorizeEffects(effects, context, policy = OPEN_EFFECT_POLICY, annotations = []) {
58
+ const planned = [];
59
+ const selfAuthorized = [];
60
+ const needsPreflight = [];
61
+ const denied = [];
62
+ for (const effect of effects) {
63
+ planned.push(effect.class);
64
+ if (policy.denied.includes(effect.class)) {
65
+ denied.push({
66
+ class: effect.class,
67
+ why: "la política del host no admite esta clase de efecto",
68
+ });
69
+ continue;
70
+ }
71
+ if (selfAuthorizes(effect, context, policy)) {
72
+ selfAuthorized.push(effect.class);
73
+ continue;
74
+ }
75
+ needsPreflight.push(effect.class);
76
+ }
77
+ return { planned, selfAuthorized, needsPreflight, denied, annotations: [...annotations] };
78
+ }
79
+ function selfAuthorizes(effect, context, policy) {
80
+ if (!SELF_AUTHORIZABLE_CLASSES.includes(effect.class))
81
+ return false;
82
+ if (effect.authorization !== "invocation" || effect.approval !== "none")
83
+ return false;
84
+ if (policy.preflight.includes(effect.class))
85
+ return false;
86
+ if (effect.class === "read_only")
87
+ return !context.sensitiveSources;
88
+ return !context.scopeExpanded;
89
+ }
90
+ //# sourceMappingURL=effects.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"effects.js","sourceRoot":"","sources":["../../../src/domain/capability/effects.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,2EAA2E;IAC3E,WAAW;IACX,6EAA6E;IAC7E,gBAAgB;IAChB,0DAA0D;IAC1D,kBAAkB;IAClB,qDAAqD;IACrD,SAAS;IACT,8DAA8D;IAC9D,kBAAkB;IAClB,uEAAuE;IACvE,aAAa;CACL,CAAC;AAkBX,MAAM,SAAS,GAAwB,IAAI,GAAG,CAAC,cAAc,CAAC,CAAC;AAE/D,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;AAC3D,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAA2B,CAAC,WAAW,EAAE,gBAAgB,CAAC,CAAC;AAgBjG,MAAM,CAAC,MAAM,kBAAkB,GAAiB,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,EAAE,EAAE,CAAC;AAsC9E;;;;;;;;;;GAUG;AACH,MAAM,UAAU,gBAAgB,CAC9B,OAAqC,EACrC,OAAsB,EACtB,SAAuB,kBAAkB,EACzC,cAA2C,EAAE;IAE7C,MAAM,OAAO,GAAkB,EAAE,CAAC;IAClC,MAAM,cAAc,GAAkB,EAAE,CAAC;IACzC,MAAM,cAAc,GAAkB,EAAE,CAAC;IACzC,MAAM,MAAM,GAAmB,EAAE,CAAC;IAElC,K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+ *
4
+ * The direct wrapper and a composing flow build this envelope with the SAME
5
+ * builder. That is the whole mechanism behind "the two routes share a contract":
6
+ * not a promise in Markdown, but a single function neither caller can bypass
7
+ * without the difference showing up in a digest.
8
+ *
9
+ * **Attempts, not a fourth stage.** `prepare → validate → apply` is the durable
10
+ * handshake for previewing, approving and writing; it is not a conversation.
11
+ * When an operation needs more information it answers `needs_input` and the
12
+ * reply becomes a NEW request: same `invocation_id`, `attempt + 1`, and
13
+ * `parent_request_digest` pointing at the one it answers. Reusing the parent
14
+ * request instead would let a stale envelope be re-submitted against a world
15
+ * that moved, and would make a retry indistinguishable from a new attempt.
16
+ *
17
+ * **Two digests, because two questions.** `request_digest` seals the whole
18
+ * envelope — route, caller, authorizations, everything — and answers "is this
19
+ * the exact attempt I saw?". `semantic_inputs_digest` seals only the normalized
20
+ * semantic entry and answers "is this the same work?". They must be separate:
21
+ * the direct route and a flow legitimately differ in caller and route while
22
+ * asking for identical work, and a single digest would make that equality
23
+ * unprovable.
24
+ *
25
+ * **Nothing invisible.** Every input arrives declared, with provenance. There is
26
+ * no field here for a private prompt or ambient state, and that absence is
27
+ * enforced by a guard: semantics the caller cannot see are semantics the caller
28
+ * cannot audit.
29
+ */
30
+ import { randomUUID } from "node:crypto";
31
+ import { semanticDigest } from "../../application/semantic-operation/protocol.js";
32
+ import { findOperation } from "./descriptor.js";
33
+ export const CAPABILITY_PROTOCOL_VERSION = 1;
34
+ const INVOCATION_ID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
35
+ export function newInvocationId() {
36
+ return randomUUID();
37
+ }
38
+ /**
39
+ * THE builder. Both routes go through it, and it refuses anything the
40
+ * descriptor does not declare — an unknown operation, a route the operation does
41
+ * not answer on, an undeclared input, a missing required one, or an attempt
42
+ * number that does not line up with its parent.
43
+ */
44
+ export function buildCapabilityRequest(input) {
45
+ const gate = checkEnvelope(input);
46
+ if (gate !== null)
47
+ return { ok: false, failure: gate };
48
+ const operation = findOperation(input.descriptor, input.operation);
49
+ const inputs = [...input.inputs].sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
50
+ const seed = {
51
+ protocol_version: CAPABILITY_PROTOCOL_VERSION,
52
+ invocation_id: input.invocationId,
53
+ attempt: input.attempt,
54
+ capability: input.descriptor.name,
55
+ contract_version: input.descriptor.contract_version,
56
+ operation: input.operation,
57
+ caller: input.caller,
58
+ context: input.context,
59
+ inputs,
60
+ policy: input.policy,
61
+ authorizations: [...input.authorizations].sort(),
62
+ parent_request_digest: input.parentRequestDigest,
63
+ };
64
+ return {
65
+ ok: true,
66
+ operation,
67
+ request: {
68
+ ...seed,
69
+ request_digest: semanticDigest(seed),
70
+ semantic_inputs_digest: semanticInputsDigest(seed),
71
+ },
72
+ };
73
+ }
74
+ /**
75
+ * The seal over WHAT WAS ASKED, deliberately blind to WHO ASKED.
76
+ *
77
+ * Route, host, flow and the authorizations a preflight granted are all excluded:
78
+ * they are properties of the call, not of the work. That exclusion is what lets
79
+ * a conformance test prove the direct wrapper and a flow asked for the same
80
+ * thing without demanding byte equality the contract never promised.
81
+ */
82
+ function semanticInputsDigest(seed) {
83
+ return semanticDigest({
84
+ capability: seed.capability,
85
+ operation: seed.operation,
86
+ target: seed.context.target,
87
+ base: seed.context.base,
88
+ profile: seed.context.profile,
89
+ inputs: seed.inputs.map((i) => ({ name: i.name, value: i.value })),
90
+ });
91
+ }
92
+ function checkEnvelope(input) {
93
+ if (!INVOCATION_ID_RE.test(input.invocationId)) {
94
+ return {
95
+ code: "CAPABILITY_INVOCATION_ID_INVALID",
96
+ message: `'${input.invocationId}' no es un invocation id`,
97
+ action: "generá el id con newInvocationId() y conservalo durante toda la conversación",
98
+ };
99
+ }
100
+ if (!Number.isInteger(input.attempt) || input.attempt < 1) {
101
+ return {
102
+ code: "CAPABILITY_ATTEMPT_INVALID",
103
+ message: `attempt inválido: ${String(input.attempt)}`,
104
+ action: "el primer intento es 1 y cada continuación suma exactamente 1",
105
+ };
106
+ }
107
+ // The first attempt answers nothing and a continuation always answers
108
+ // something: either mismatch means the chain is not what it claims to be.
109
+ if (input.attempt === 1 && input.parentRequestDigest !== null) {
110
+ return {
111
+ code: "CAPABILITY_PARENT_UNEXPECTED",
112
+ message: "el primer intento declara un request padre",
113
+ action: "dejá 'parent_request_digest' en null para attempt = 1",
114
+ };
115
+ }
116
+ if (input.attempt > 1 && input.parentRequestDigest === null) {
117
+ return {
118
+ code: "CAPABILITY_PARENT_MISSING",
119
+ message: `attempt ${input.attempt} no declara el request padre que contesta`,
120
+ action: "pasá el 'request_digest' del intento anterior como parent_request_digest",
121
+ };
122
+ }
123
+ const operation = findOperation(input.descriptor, input.operation);
124
+ if (operation === null) {
125
+ return {
126
+ code: "CAPABILITY_OPERATION_UNKNOWN",
127
+ message: `'${input.descriptor.name}' no declara la operación '${input.operation}'`,
128
+ action: `usá una de: ${input.descriptor.operations.map((o) => o.name).join(", ")}`,
129
+ };
130
+ }
131
+ if (!operation.exposure.includes(input.caller.route)) {
132
+ return {
133
+ code: "CAPABILITY_ROUTE_UNSUPPORTED",
134
+ message: `'${input.operation}' no se expone por la ruta '${input.caller.route}'`,
135
+ action: `invocala por: ${operation.exposure.join(", ")}`,
136
+ };
137
+ }
138
+ return checkInputs(operation, input);
139
+ }
140
+ function checkInputs(operation, input) {
141
+ const declared = new Map(operation.inputs.map((i) => [i.name, i]));
142
+ const seen = new Set();
143
+ for (const given of input.inputs) {
144
+ const spec = declared.get(given.name);
145
+ if (spec === undefined) {
146
+ return {
147
+ code: "CAPABILITY_INPUT_UNDECLARED",
148
+ message: `'${operation.name}' no declara el input '${given.name}'`,
149
+ action: `pasá solo: ${operation.inputs.map((i) => i.name).join(", ") || "(ninguno)"}`,
150
+ };
151
+ }
152
+ if (seen.has(given.name)) {
153
+ return {
154
+ code: "CAPABILITY_INPUT_REPEATED",
155
+ message: `el input '${given.name}' viene dos veces`,
156
+ action: "pasá cada input una sola vez",
157
+ };
158
+ }
159
+ seen.add(given.name);
160
+ // Provenance is not decoration: without it the receipt cannot say what the
161
+ // output was derived from, which is the only auditable claim it makes.
162
+ if (given.provenance.origin.trim().length === 0) {
163
+ return {
164
+ code: "CAPABILITY_INPUT_PROVENANCE_MISSING",
165
+ message: `el input '${given.name}' no declara de dónde salió`,
166
+ action: "declará 'origin' con el locator o la fuente que produjo el valor",
167
+ };
168
+ }
169
+ if (given.provenance.sensitivity === "sensitive" && !input.policy.sensitive_sources) {
170
+ return {
171
+ code: "CAPABILITY_SENSITIVE_INPUT_UNAUTHORIZED",
172
+ message: `el input '${given.name}' es sensible y la política de la invocación no lo permite`,
173
+ action: "pedí aprobación para fuentes sensibles o quitá el input",
174
+ };
175
+ }
176
+ }
177
+ for (const spec of operation.inputs) {
178
+ if (spec.required && !seen.has(spec.name)) {
179
+ return {
180
+ code: "CAPABILITY_INPUT_REQUIRED_MISSING",
181
+ message: `'${operation.name}' exige el input '${spec.name}'`,
182
+ action: `pasá '${spec.name}' con su proveniencia`,
183
+ };
184
+ }
185
+ }
186
+ return null;
187
+ }
188
+ export function checkWorkspaceRequirement(operation, context) {
189
+ if (operation.workspace !== "required" || context.workspace !== null) {
190
+ return { ok: true, requirement: operation.workspace };
191
+ }
192
+ return {
193
+ ok: false,
194
+ failure: {
195
+ code: "CAPABILITY_WORKSPACE_REQUIRED",
196
+ message: `'${operation.name}' necesita un workspace Workline y no hay ninguno acá`,
197
+ action: "corré la operación dentro de un workspace, o inicializá uno con 'aw workspace-init'",
198
+ },
199
+ };
200
+ }
201
+ /**
202
+ * Build the attempt that answers a `needs_input`.
203
+ *
204
+ * The parent is re-sealed before anything else: a caller can hand back an
205
+ * envelope it edited, and the digest is the only thing that notices. Everything
206
+ * downstream — the pinned selection, the receipt chain — trusts that link.
207
+ */
208
+ export function continueInvocation(input) {
209
+ const { parent } = input;
210
+ const resealed = semanticDigest(withoutDigests(parent));
211
+ if (resealed !== parent.request_digest) {
212
+ return {
213
+ ok: false,
214
+ failure: {
215
+ code: "CAPABILITY_PARENT_ALTERED",
216
+ message: "el request padre no coincide con su propio digest",
217
+ action: "reenviá el request padre tal como lo devolvió el intento anterior",
218
+ },
219
+ };
220
+ }
221
+ return buildCapabilityRequest({
222
+ invocationId: parent.invocation_id,
223
+ attempt: parent.attempt + 1,
224
+ descriptor: input.descriptor,
225
+ operation: parent.operation,
226
+ caller: input.caller,
227
+ context: input.context,
228
+ inputs: input.inputs,
229
+ policy: input.policy,
230
+ authorizations: input.authorizations,
231
+ parentRequestDigest: parent.request_digest,
232
+ });
233
+ }
234
+ /** The envelope minus its own two seals — what `request_digest` is computed over. */
235
+ function withoutDigests(request) {
236
+ const { request_digest: _seal, semantic_inputs_digest: _semantic, ...rest } = request;
237
+ return rest;
238
+ }
239
+ export class AttemptLedger {
240
+ seen = new Map();
241
+ record(request) {
242
+ const attempts = this.seen.get(request.invocation_id) ?? new Map();
243
+ const known = attempts.get(request.attempt);
244
+ if (known !== undefined) {
245
+ if (known === request.request_digest)
246
+ return { ok: true, kind: "retry" };
247
+ return {
248
+ ok: false,
249
+ failure: {
250
+ code: "CAPABILITY_ATTEMPT_DIVERGED",
251
+ message: `el intento ${request.attempt} ya existe con otro contenido`,
252
+ action: "para pedir algo distinto usá el attempt siguiente, no el mismo número",
253
+ },
254
+ };
255
+ }
256
+ const highest = Math.max(0, ...attempts.keys());
257
+ if (request.attempt !== highest + 1) {
258
+ return {
259
+ ok: false,
260
+ failure: {
261
+ code: "CAPABILITY_ATTEMPT_OUT_OF_SEQUENCE",
262
+ message: `llegó el intento ${request.attempt} y el anterior registrado es ${highest}`,
263
+ action: `enviá el intento ${highest + 1}`,
264
+ },
265
+ };
266
+ }
267
+ if (request.attempt > 1) {
268
+ const parentDigest = attempts.get(request.attempt - 1);
269
+ if (parentDigest !== request.parent_request_digest) {
270
+ return {
271
+ ok: false,
272
+ failure: {
273
+ code: "CAPABILITY_PARENT_NOT_IMMEDIATE",
274
+ message: "el request padre no es el intento inmediatamente anterior",
275
+ action: `enlazá el intento ${request.attempt} con el digest del intento ${request.attempt - 1}`,
276
+ },
277
+ };
278
+ }
279
+ }
280
+ attempts.set(request.attempt, request.request_digest);
281
+ this.seen.set(request.invocation_id, attempts);
282
+ return { ok: true, kind: "new" };
283
+ }
284
+ }
285
+ /**
286
+ * How an attempt ended — five values, and none of them means "roughly fine".
287
+ *
288
+ * `completed` is the only success. The other four are distinct on purpose:
289
+ * `needs_input` is a question, `blocked` is a precondition nobody in this run
290
+ * can clear, `failed` is something that broke, and `cancelled` is a human
291
+ * changing their mind. Collapsing them would turn "I need the target directory"
292
+ * and "the provider rejected the payload" into the same word, and the next
293
+ * action for those two has nothing in common.
294
+ */
295
+ export const CAPABILITY_OUTCOMES = [
296
+ "completed",
297
+ "needs_input",
298
+ "blocked",
299
+ "failed",
300
+ "cancelled",
301
+ ];
302
+ /**
303
+ * Build the receipt, refusing the combinations that would let a run lie.
304
+ *
305
+ * Every rule here exists because its absence produces a specific lie: a
306
+ * `completed` with nothing to show, a `failed` that names no error, a
307
+ * `needs_input` that asks for nothing, applied effects nobody planned, a
308
+ * degradation whose cause the contract never declared, or an attribution to an
309
+ * instance the resolution could not identify.
310
+ */
311
+ export function buildReceipt(input) {
312
+ const effects = {
313
+ planned: [...(input.effects?.planned ?? [])],
314
+ approved: [...(input.effects?.approved ?? [])],
315
+ applied: [...(input.effects?.applied ?? [])],
316
+ };
317
+ const receipt = {
318
+ protocol_version: CAPABILITY_PROTOCOL_VERSION,
319
+ invocation_id: input.request.invocation_id,
320
+ attempt: input.request.attempt,
321
+ capability: input.request.capability,
322
+ operation: input.request.operation,
323
+ request_digest: input.request.request_digest,
324
+ semantic_inputs_digest: input.request.semantic_inputs_digest,
325
+ parent_request_digest: input.request.parent_request_digest,
326
+ outcome: input.outcome,
327
+ floor: input.floor,
328
+ selection: [...(input.selection ?? [])],
329
+ inputs: [...input.inputs],
330
+ output: input.output ?? null,
331
+ validations: [...(input.validations ?? [])],
332
+ effects,
333
+ degradations: [...(input.degradations ?? [])],
334
+ gaps: [...(input.gaps ?? [])],
335
+ error: input.error ?? null,
336
+ next_action: input.nextAction,
337
+ };
338
+ const failure = checkReceipt(receipt, input.descriptor);
339
+ return failure === null ? { ok: true, receipt } : { ok: false, failure };
340
+ }
341
+ function reject(code, message, action) {
342
+ return { code, message, action };
343
+ }
344
+ function checkNextAction(receipt) {
345
+ if (receipt.next_action.trim().length > 0)
346
+ return null;
347
+ return reject("CAPABILITY_RECEIPT_NO_NEXT_ACTION", "el receipt no dice qué hacer después", "declará una próxima acción: un receipt sin salida es un callejón");
348
+ }
349
+ function checkCompleted(receipt) {
350
+ if (receipt.outcome !== "completed")
351
+ return null;
352
+ if (receipt.output === null || receipt.output.completeness === null) {
353
+ return reject("CAPABILITY_COMPLETED_WITHOUT_OUTPUT", "un intento 'completed' no trae output con completitud declarada", "declará el output y su completitud, o devolvé el outcome que corresponde");
354
+ }
355
+ if (receipt.error !== null) {
356
+ return reject("CAPABILITY_COMPLETED_WITH_ERROR", "un intento 'completed' declara un error", "un fallo nunca se reporta como éxito: usá 'failed', 'blocked' o 'cancelled'");
357
+ }
358
+ return null;
359
+ }
360
+ function checkUnfinished(receipt) {
361
+ const broke = receipt.outcome === "failed" || receipt.outcome === "blocked";
362
+ if (broke && receipt.error === null) {
363
+ return reject("CAPABILITY_FAILURE_WITHOUT_ERROR", `un intento '${receipt.outcome}' no dice qué falló`, "declará el error con código, mensaje y acción");
364
+ }
365
+ if (receipt.outcome === "needs_input" && receipt.gaps.length === 0) {
366
+ return reject("CAPABILITY_NEEDS_INPUT_WITHOUT_GAPS", "un intento 'needs_input' no enumera qué falta", "declará los requisitos que la continuación tiene que traer");
367
+ }
368
+ if (receipt.outcome !== "needs_input" && receipt.gaps.length > 0) {
369
+ return reject("CAPABILITY_GAPS_WITHOUT_NEEDS_INPUT", `un intento '${receipt.outcome}' enumera requisitos pendientes`, "si falta información el outcome es 'needs_input'");
370
+ }
371
+ return null;
372
+ }
373
+ function checkInputDispositions(receipt) {
374
+ for (const disposition of receipt.inputs) {
375
+ if (disposition.used || (disposition.reason ?? "").trim().length > 0)
376
+ continue;
377
+ return reject("CAPABILITY_INPUT_DISCARDED_SILENTLY", `el input '${disposition.name}' no se usó y el receipt no dice por qué`, "declará el motivo: un input ignorado en silencio es una decisión invisible");
378
+ }
379
+ return null;
380
+ }
381
+ function checkEffectLedger(receipt) {
382
+ const planned = new Set(receipt.effects.planned);
383
+ const stages = [
384
+ [receipt.effects.applied, "aplicó"],
385
+ [receipt.effects.approved, "aprobó"],
386
+ ];
387
+ for (const [effects, verb] of stages) {
388
+ for (const effect of effects) {
389
+ if (planned.has(effect))
390
+ continue;
391
+ return reject("CAPABILITY_EFFECT_UNPLANNED", `se ${verb} un efecto '${effect}' que no estaba planeado`, "declará cada efecto antes de ejercerlo");
392
+ }
393
+ }
394
+ return null;
395
+ }
396
+ function checkDegradations(receipt, descriptor) {
397
+ const declared = new Set(descriptor.degradations.map((d) => d.cause));
398
+ for (const degradation of receipt.degradations) {
399
+ if (!declared.has(degradation.cause)) {
400
+ return reject("CAPABILITY_DEGRADATION_UNDECLARED", `'${degradation.cause}' no está entre las degradaciones que el contrato declara`, "agregá la causa al descriptor o reportá el intento como fallido");
401
+ }
402
+ if (degradation.loss.trim().length === 0) {
403
+ return reject("CAPABILITY_DEGRADATION_WITHOUT_LOSS", `la degradación '${degradation.cause}' no dice qué se perdió`, "declará la pérdida observable");
404
+ }
405
+ }
406
+ return null;
407
+ }
408
+ /**
409
+ * Running the floor means no improvement contributed. Listing contributors
410
+ * anyway is the invented attribution the contract forbids outright.
411
+ */
412
+ function checkAttribution(receipt) {
413
+ if (!receipt.floor || receipt.selection.length === 0)
414
+ return null;
415
+ return reject("CAPABILITY_FLOOR_WITH_SELECTION", "el receipt dice que corrió el floor y a la vez atribuye contribuyentes", "si corrió el floor, la selección va vacía: no se atribuye lo que no contribuyó");
416
+ }
417
+ const RECEIPT_CHECKS = [
418
+ checkNextAction,
419
+ checkCompleted,
420
+ checkUnfinished,
421
+ checkInputDispositions,
422
+ checkEffectLedger,
423
+ checkDegradations,
424
+ checkAttribution,
425
+ ];
426
+ function checkReceipt(receipt, descriptor) {
427
+ for (const check of RECEIPT_CHECKS) {
428
+ const failure = check(receipt, descriptor);
429
+ if (failure !== null)
430
+ return failure;
431
+ }
432
+ return null;
433
+ }
434
+ /**
435
+ * The completeness gate, as one predicate everybody shares.
436
+ *
437
+ * A gate that demands completeness cannot accept a `partial` output, and the
438
+ * reason is not pedantry: `partial` means the requested profile is not covered,
439
+ * so accepting it would let an incomplete package satisfy the very check that
440
+ * exists to notice incompleteness.
441
+ */
442
+ export function satisfiesCompletenessGate(receipt) {
443
+ return receipt.outcome === "completed" && receipt.output?.completeness === "complete";
444
+ }
445
+ /**
446
+ * Read-only returns and writes nothing. Anything durable or external keeps its
447
+ * receipt in the registry that ALREADY owns that lifecycle — the governance
448
+ * record, the session — rather than growing a second store next to it.
449
+ */
450
+ export function receiptPersistence(receipt) {
451
+ const touchesTheWorld = receipt.effects.applied.some((e) => e !== "read_only");
452
+ const durable = receipt.output?.reference != null;
453
+ return touchesTheWorld || durable ? "registry" : "none";
454
+ }
455
+ /**
456
+ * The human synthesis — DERIVED, never authored beside the data.
457
+ *
458
+ * Every line reads a field of the receipt it was given. That is the same rule
459
+ * `renderHumanError` already follows for command failures, and it is what makes
460
+ * "the prose cannot contradict the structured form" a property instead of a
461
+ * hope: there is no second source for it to disagree with.
462
+ */
463
+ export function renderReceiptHuman(receipt) {
464
+ const lines = [
465
+ `${receipt.capability}.${receipt.operation} — ${receipt.outcome} (intento ${receipt.attempt})`,
466
+ ];
467
+ if (receipt.output?.completeness != null) {
468
+ lines.push(`completitud: ${receipt.output.completeness}`);
469
+ }
470
+ if (receipt.output?.reference != null) {
471
+ const ref = receipt.output.reference;
472
+ const revision = ref.revision === null ? "" : `@r${ref.revision}`;
473
+ lines.push(`salida: ${ref.id}${revision} (${ref.digest}) en ${ref.locator}`);
474
+ }
475
+ lines.push(receipt.floor
476
+ ? "ejecutó el floor incorporado"
477
+ : `contribuyentes: ${receipt.selection.map((s) => `${s.order}. ${s.name}@${s.digest}`).join(", ") || "ninguno"}`);
478
+ for (const degradation of receipt.degradations) {
479
+ lines.push(`degradación (${degradation.cause}): ${degradation.loss}`);
480
+ }
481
+ for (const validation of receipt.validations) {
482
+ lines.push(`validación ${validation.id}: ${validation.passed ? "ok" : "falla"}`);
483
+ }
484
+ if (receipt.effects.applied.length > 0) {
485
+ lines.push(`efectos aplicados: ${receipt.effects.applied.join(", ")}`);
486
+ }
487
+ for (const gap of receipt.gaps)
488
+ lines.push(`falta: ${gap}`);
489
+ if (receipt.error !== null)
490
+ lines.push(`error ${receipt.error.code}: ${receipt.error.message}`);
491
+ lines.push(`siguiente: ${receipt.next_action}`);
492
+ return lines.join("\n");
493
+ }
494
+ //# sourceMappingURL=protocol.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../../src/domain/capability/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kDAAkD,CAAC;AAWlF,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGhD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAY7C,MAAM,gBAAgB,GAAG,gEAAgE,CAAC;AAE1F,MAAM,UAAU,eAAe;IAC7B,OAAO,UAAU,EAAE,CAAC;AACtB,CAAC;AAuFD;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CAAC,KAAkC;IACvE,MAAM,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,CAAC;IAClC,IAAI,IAAI,KAAK,IAAI;QAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;IAEvD,MA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