@intentius/chant 0.124.24 → 0.124.26

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 (195) hide show
  1. package/dist/cli/commands/build.d.ts.map +1 -1
  2. package/dist/cli/commands/build.js +4 -2
  3. package/dist/cli/commands/lint.d.ts.map +1 -1
  4. package/dist/cli/commands/lint.js +4 -2
  5. package/dist/cli/handlers/approve.d.ts.map +1 -1
  6. package/dist/cli/handlers/approve.js +39 -4
  7. package/dist/cli/main.d.ts.map +1 -1
  8. package/dist/cli/main.js +21 -7
  9. package/dist/cli/mcp/workspace-tools.d.ts +3 -3
  10. package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
  11. package/dist/cli/mcp/workspace-tools.js +27 -4
  12. package/dist/effect-receipt.d.ts +13 -0
  13. package/dist/effect-receipt.d.ts.map +1 -1
  14. package/dist/effect-receipt.js +19 -0
  15. package/dist/gate-decision.d.ts +1 -1
  16. package/dist/gate-decision.d.ts.map +1 -1
  17. package/dist/gate-decision.js +1 -1
  18. package/dist/lexicon-module.d.ts +7 -1
  19. package/dist/lexicon-module.d.ts.map +1 -1
  20. package/dist/lexicon-module.js +7 -2
  21. package/dist/lifecycle/gate-audit.d.ts +7 -1
  22. package/dist/lifecycle/gate-audit.d.ts.map +1 -1
  23. package/dist/lifecycle/gate-audit.js +40 -3
  24. package/dist/lifecycle/gate-checkpoint.d.ts +78 -0
  25. package/dist/lifecycle/gate-checkpoint.d.ts.map +1 -0
  26. package/dist/lifecycle/gate-checkpoint.js +103 -0
  27. package/dist/lifecycle/gate-ledger.d.ts +41 -0
  28. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  29. package/dist/lifecycle/gate-ledger.js +18 -0
  30. package/dist/lifecycle/receipt-plan.d.ts.map +1 -1
  31. package/dist/lifecycle/receipt-plan.js +4 -2
  32. package/dist/lifecycle/run-ledger.d.ts +2 -0
  33. package/dist/lifecycle/run-ledger.d.ts.map +1 -1
  34. package/dist/lifecycle/run-ledger.js +2 -0
  35. package/dist/lint/rules/op/index.d.ts +6 -2
  36. package/dist/lint/rules/op/index.d.ts.map +1 -1
  37. package/dist/lint/rules/op/index.js +7 -3
  38. package/dist/lint/rules/op/ops016-gate-resume.d.ts +14 -0
  39. package/dist/lint/rules/op/ops016-gate-resume.d.ts.map +1 -0
  40. package/dist/lint/rules/op/ops016-gate-resume.js +31 -0
  41. package/dist/lint/rules/op/ops017-gate-alias.d.ts +30 -0
  42. package/dist/lint/rules/op/ops017-gate-alias.d.ts.map +1 -0
  43. package/dist/lint/rules/op/ops017-gate-alias.js +67 -0
  44. package/dist/op/activity-contract.d.ts +14 -0
  45. package/dist/op/activity-contract.d.ts.map +1 -1
  46. package/dist/op/activity-contract.js +16 -0
  47. package/dist/op/builders.d.ts +7 -0
  48. package/dist/op/builders.d.ts.map +1 -1
  49. package/dist/op/builders.js +13 -0
  50. package/dist/op/gate-alias.d.ts +57 -0
  51. package/dist/op/gate-alias.d.ts.map +1 -0
  52. package/dist/op/gate-alias.js +127 -0
  53. package/dist/op/gate-checkpoint.d.ts +123 -0
  54. package/dist/op/gate-checkpoint.d.ts.map +1 -0
  55. package/dist/op/gate-checkpoint.js +280 -0
  56. package/dist/op/gate.d.ts +54 -2
  57. package/dist/op/gate.d.ts.map +1 -1
  58. package/dist/op/gate.js +142 -1
  59. package/dist/op/index.d.ts +4 -1
  60. package/dist/op/index.d.ts.map +1 -1
  61. package/dist/op/index.js +2 -1
  62. package/dist/op/local-executor.d.ts +57 -2
  63. package/dist/op/local-executor.d.ts.map +1 -1
  64. package/dist/op/local-executor.js +200 -11
  65. package/dist/op/local-output.d.ts.map +1 -1
  66. package/dist/op/local-output.js +20 -2
  67. package/dist/op/op-ir.d.ts +4 -0
  68. package/dist/op/op-ir.d.ts.map +1 -1
  69. package/dist/op/op-ir.js +4 -0
  70. package/dist/op/receipt-store.d.ts +5 -0
  71. package/dist/op/receipt-store.d.ts.map +1 -1
  72. package/dist/op/receipt-store.js +4 -3
  73. package/dist/op/runtime.d.ts +15 -0
  74. package/dist/op/runtime.d.ts.map +1 -1
  75. package/dist/op/runtimes/local.d.ts.map +1 -1
  76. package/dist/op/runtimes/local.js +5 -0
  77. package/dist/op/step-output-ref.d.ts +26 -18
  78. package/dist/op/step-output-ref.d.ts.map +1 -1
  79. package/dist/op/step-output-ref.js +86 -63
  80. package/dist/op/types.d.ts +31 -0
  81. package/dist/op/types.d.ts.map +1 -1
  82. package/dist/wave-runtime.mjs +223 -221
  83. package/dist/workspace/agent-cli.d.ts.map +1 -1
  84. package/dist/workspace/agent-cli.js +3 -0
  85. package/dist/workspace/conformance/__writer_fixture__/answers/answer.schema.json +16 -1
  86. package/dist/workspace/conformance/writer.js +1 -1
  87. package/dist/workspace/decide.d.ts +51 -9
  88. package/dist/workspace/decide.d.ts.map +1 -1
  89. package/dist/workspace/decide.js +125 -14
  90. package/dist/workspace/lineage-upgrade.d.ts.map +1 -1
  91. package/dist/workspace/lineage-upgrade.js +20 -11
  92. package/dist/workspace/point-answer.schema.json +16 -1
  93. package/dist/workspace/points-cli.d.ts +5 -3
  94. package/dist/workspace/points-cli.d.ts.map +1 -1
  95. package/dist/workspace/points-cli.js +16 -7
  96. package/dist/workspace/points-write.schema.json +39 -4
  97. package/dist/workspace/points.schema.json +42 -3
  98. package/dist/workspace/reason-codes.d.ts +2 -1
  99. package/dist/workspace/reason-codes.d.ts.map +1 -1
  100. package/dist/workspace/reason-codes.js +2 -1
  101. package/dist/workspace/records-cli.d.ts +12 -2
  102. package/dist/workspace/records-cli.d.ts.map +1 -1
  103. package/dist/workspace/records-cli.js +27 -7
  104. package/dist/workspace/records-write.d.ts.map +1 -1
  105. package/dist/workspace/records-write.js +2 -3
  106. package/dist/workspace/records.d.ts +10 -4
  107. package/dist/workspace/records.d.ts.map +1 -1
  108. package/dist/workspace/records.js +16 -3
  109. package/dist/workspace/records.schema.json +2 -1
  110. package/dist/workspace/trust/gate-seal.d.ts +32 -1
  111. package/dist/workspace/trust/gate-seal.d.ts.map +1 -1
  112. package/dist/workspace/trust/gate-seal.js +41 -2
  113. package/dist/workspace/trust/seal.d.ts +1 -1
  114. package/dist/workspace/trust/seal.d.ts.map +1 -1
  115. package/dist/workspace/trust/seal.js +1 -1
  116. package/dist/workspace/trust/verify-cli.d.ts.map +1 -1
  117. package/dist/workspace/trust/verify-cli.js +2 -1
  118. package/dist/workspace/trust/verify.d.ts +22 -0
  119. package/dist/workspace/trust/verify.d.ts.map +1 -1
  120. package/dist/workspace/trust/verify.js +94 -14
  121. package/dist/workspace/write-scope.d.ts +3 -1
  122. package/dist/workspace/write-scope.d.ts.map +1 -1
  123. package/dist/workspace/write-scope.js +11 -4
  124. package/package.json +1 -1
  125. package/src/cli/commands/build.ts +9 -2
  126. package/src/cli/commands/lint.ts +4 -2
  127. package/src/cli/compiled-cli.e2e.test.ts +45 -1
  128. package/src/cli/handlers/approve.ts +46 -4
  129. package/src/cli/handlers/operator.test.ts +91 -0
  130. package/src/cli/main.test.ts +10 -0
  131. package/src/cli/main.ts +21 -7
  132. package/src/cli/mcp/workspace-tools.e2e.test.ts +1 -1
  133. package/src/cli/mcp/workspace-tools.ts +27 -4
  134. package/src/effect-receipt.ts +22 -0
  135. package/src/gate-decision.ts +2 -0
  136. package/src/lexicon-module.ts +9 -2
  137. package/src/lifecycle/gate-audit.ts +41 -4
  138. package/src/lifecycle/gate-checkpoint.test.ts +128 -0
  139. package/src/lifecycle/gate-checkpoint.ts +133 -0
  140. package/src/lifecycle/gate-ledger.ts +61 -0
  141. package/src/lifecycle/receipt-plan.test.ts +9 -0
  142. package/src/lifecycle/receipt-plan.ts +4 -1
  143. package/src/lifecycle/run-ledger.ts +4 -0
  144. package/src/lint/rules/op/index.ts +9 -3
  145. package/src/lint/rules/op/ops016-gate-resume.test.ts +53 -0
  146. package/src/lint/rules/op/ops016-gate-resume.ts +48 -0
  147. package/src/lint/rules/op/ops017-gate-alias.test.ts +85 -0
  148. package/src/lint/rules/op/ops017-gate-alias.ts +89 -0
  149. package/src/op/activity-contract.ts +22 -1
  150. package/src/op/builders.ts +21 -1
  151. package/src/op/effect-step.test.ts +95 -1
  152. package/src/op/gate-alias.e2e.test.ts +78 -0
  153. package/src/op/gate-alias.test.ts +350 -0
  154. package/src/op/gate-alias.ts +137 -0
  155. package/src/op/gate-checkpoint.test.ts +284 -0
  156. package/src/op/gate-checkpoint.ts +322 -0
  157. package/src/op/gate.ts +198 -4
  158. package/src/op/index.ts +4 -1
  159. package/src/op/local-executor.test.ts +65 -0
  160. package/src/op/local-executor.ts +248 -12
  161. package/src/op/local-output.ts +18 -2
  162. package/src/op/op-ir.test.ts +25 -0
  163. package/src/op/op-ir.ts +8 -0
  164. package/src/op/receipt-store.ts +13 -3
  165. package/src/op/runtime.ts +8 -0
  166. package/src/op/runtimes/local.ts +5 -0
  167. package/src/op/step-output-ref.test.ts +68 -24
  168. package/src/op/step-output-ref.ts +85 -65
  169. package/src/op/types.ts +32 -0
  170. package/src/workspace/agent-cli.ts +2 -0
  171. package/src/workspace/conformance/__writer_fixture__/answers/answer.schema.json +16 -1
  172. package/src/workspace/conformance/writer.ts +1 -1
  173. package/src/workspace/decide.test.ts +87 -3
  174. package/src/workspace/decide.ts +142 -17
  175. package/src/workspace/lineage-upgrade.test.ts +21 -0
  176. package/src/workspace/lineage-upgrade.ts +19 -11
  177. package/src/workspace/point-answer.schema.json +16 -1
  178. package/src/workspace/points-cli.ts +16 -8
  179. package/src/workspace/points-write.schema.json +39 -4
  180. package/src/workspace/points.schema.json +42 -3
  181. package/src/workspace/reason-codes.ts +2 -1
  182. package/src/workspace/record-assets.test.ts +14 -0
  183. package/src/workspace/records-cli.ts +28 -7
  184. package/src/workspace/records-write-commands.e2e.test.ts +32 -0
  185. package/src/workspace/records-write.ts +2 -3
  186. package/src/workspace/records.schema.json +2 -1
  187. package/src/workspace/records.ts +17 -4
  188. package/src/workspace/trust/gate-seal.test.ts +29 -2
  189. package/src/workspace/trust/gate-seal.ts +46 -2
  190. package/src/workspace/trust/seal.ts +1 -1
  191. package/src/workspace/trust/trust.test.ts +105 -0
  192. package/src/workspace/trust/verify-cli.ts +2 -1
  193. package/src/workspace/trust/verify.ts +106 -13
  194. package/src/workspace/write-scope.test.ts +18 -0
  195. package/src/workspace/write-scope.ts +16 -5
@@ -1 +1 @@
1
- {"version":3,"file":"agent-cli.d.ts","sourceRoot":"","sources":["../../src/workspace/agent-cli.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,EAAyE,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAEtH,OAAO,EAA2C,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGvF,6DAA6D;AAC7D,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,eAAO,MAAM,sBAAsB,4EAA4E,CAAC;AAEhH,gDAAgD;AAChD,eAAO,MAAM,iBAAiB,wOAAuF,CAAC;AACtH,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,iFAAiF;AACjF,MAAM,WAAW,cAAc;IAC7B,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,wEAAwE;IACxE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,kDAAkD;IAClD,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,oEAAoE;IACpE,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,+DAA+D;IAC/D,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB;AAED,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;CACd;AAED,UAAU,IAAI;IACZ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,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,0FAA0F;QAC1F,MAAM,EAAE,WAAW,CAAC;QACpB,iFAAiF;QACjF,OAAO,EAAE,WAAW,EAAE,CAAC;QACvB,UAAU,EAAE,MAAM,EAAE,CAAC;KACtB,CAAC;IACF,KAAK,EAAE;QACL,kDAAkD;QAClD,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,6EAA6E;QAC7E,OAAO,EAAE,cAAc,EAAE,CAAC;QAC1B,yHAAyH;QACzH,SAAS,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YAAC,MAAM,EAAE,MAAM,EAAE,CAAA;SAAE,EAAE,CAAC;KACjD,CAAC;IACF,uDAAuD;IACvD,IAAI,EAAE,QAAQ,CAAC;IACf,oDAAoD;IACpD,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC,GACF,CAAC,IAAI,GAAG;IAAE,KAAK,EAAE;QAAE,IAAI,EAAE,cAAc,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAAC,CAAC;AAElE,wGAAwG;AACxG,wBAAsB,YAAY,CAAC,CAAC,EAAE;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,aAAa,CAAC,CAuC3F;AAID,iFAAiF;AACjF,wBAAsB,iBAAiB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAwB5E"}
@@ -30,6 +30,9 @@ export async function agentSession(q) {
30
30
  try {
31
31
  const source = scopeSource(q.cwd);
32
32
  if (source.declaration === null || source.from === null) {
33
+ // A declaration that is there but fails validation says so (#3433).
34
+ if (source.failure && source.failure.code !== "declaration-missing")
35
+ throw source.failure;
33
36
  throw new WorkspaceReadError("declaration-missing", "no chant.workspace.json or .jsonc between this directory and the git root, so no agent session is declared");
34
37
  }
35
38
  const decl = source.declaration;
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "urn:intentius:chant:point-answer:1",
4
4
  "title": "Decision point answer front matter",
5
- "description": "The front matter of one answer to a decision point (ws-058, #2739), as `chant workspace points ask` and `points answer` write it into the records directory of a record kind with an `answers` block. One record per point, declaration and inputs: its id is the point's name and the first 12 hex digits of the inputs hash, so the same question is answered once. A table's answer is `answered`; a model's answer at or above its threshold is `proposed` until a person confirms it; a question no decider before the quorum answered is `escalated`, open for people. An answer never changes in place: `points retract` escalates the question to people again and moves the answer into `retractions` (#3351, ws-084). An ad-hoc point's answer keeps the question and candidates its ask gave as `asked`, and they are part of the inputs hash (#3403). A workspace copies this file next to its answer kind, as reference-workspace/answers/ does. Values stay within what YAML and JSON share. Fields other than these must start with x-.",
5
+ "description": "The front matter of one answer to a decision point (ws-058, #2739), as `chant workspace points ask` and `points answer` write it into the records directory of a record kind with an `answers` block. One record per point, declaration and inputs: its id is the point's name and the first 12 hex digits of the inputs hash, so the same question is answered once. A table's answer is `answered`; a model's answer at or above its threshold is `proposed` until a person confirms it; a question no decider before the quorum answered is `escalated`, open for people. An answer never changes in place: `points retract` escalates the question to people again and moves the answer into `retractions` (#3351, ws-084). An open question that no longer applies is `withdrawn` (`points withdraw`, #2888), and asking it again opens it again. An ad-hoc point's answer keeps the question and candidates its ask gave as `asked`, and they are part of the inputs hash (#3403). A workspace copies this file next to its answer kind, as reference-workspace/answers/ does. Values stay within what YAML and JSON share. Fields other than these must start with x-.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "patternProperties": { "^x-": {} },
@@ -65,6 +65,17 @@
65
65
  "description": "Answers people took back, oldest first (`points retract`, #3351): each answer as it was, and who retracted it, when and why. A retracted question is escalated to people again.",
66
66
  "items": { "$ref": "#/definitions/retraction" }
67
67
  },
68
+ "withdrawn": {
69
+ "type": "object",
70
+ "description": "An open question that no longer applies, such as one about a work item its author changed, which a run asks about anew (`points withdraw`, #2888): who withdrew it, when and why. A withdrawn question is not open, and nobody answers it; asking it again opens it again.",
71
+ "required": ["by", "on"],
72
+ "properties": {
73
+ "by": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "description": "Who withdrew it." },
74
+ "on": { "$ref": "#/definitions/date" },
75
+ "note": { "type": "string", "minLength": 1, "description": "Why it was withdrawn (`points withdraw --note`)." }
76
+ },
77
+ "additionalProperties": false
78
+ },
68
79
  "asked_on": { "$ref": "#/definitions/date" },
69
80
  "answered_on": { "$ref": "#/definitions/date" },
70
81
  "source": {
@@ -85,6 +96,10 @@
85
96
  "if": { "properties": { "state": { "const": "escalated" } }, "required": ["state"] },
86
97
  "then": { "not": { "required": ["answer"] }, "properties": { "decider": { "properties": { "kind": { "const": "quorum" } } } } }
87
98
  },
99
+ {
100
+ "if": { "required": ["withdrawn"] },
101
+ "then": { "properties": { "state": { "enum": ["escalated", "proposed"] } } }
102
+ },
88
103
  {
89
104
  "if": { "properties": { "decider": { "properties": { "kind": { "const": "model" } }, "required": ["kind"] } }, "required": ["decider"] },
90
105
  "then": { "required": ["probabilities", "confidence", "threshold"], "properties": { "decider": { "required": ["backend", "model"] } } }
@@ -461,7 +461,7 @@ export function isReadCall(argv) {
461
461
  case "runs":
462
462
  return !["start", "end", "record"].includes(sub ?? "");
463
463
  case "points":
464
- return !["ask", "answer", "retract"].includes(sub ?? "");
464
+ return !["ask", "answer", "retract", "withdraw"].includes(sub ?? "");
465
465
  case "work":
466
466
  return sub === "history";
467
467
  case "wip":
@@ -4,7 +4,8 @@
4
4
  * {@link askPoint} asks a point's deciders for one set of inputs and records
5
5
  * the answer in the answer kind's records directory, {@link answerPoint}
6
6
  * records people's answer to an open question, with an optional note, and
7
- * {@link retractAnswer} takes an answer back (#3351). Each writes one Markdown
7
+ * {@link retractAnswer} takes an answer back (#3351), and {@link withdrawQuestion}
8
+ * closes an open question that no longer applies (#2888). Each writes one Markdown
8
9
  * record or none, never commits, and goes through the checks every records write goes
9
10
  * through (`records-write.ts`): the record is read back with the kind's schema
10
11
  * before it is written, and no other record may become invalid.
@@ -33,6 +34,14 @@
33
34
  * and why. Asking a retracted question again returns it as it stands, since
34
35
  * people took it back from the deciders; people answer it again.
35
36
  *
37
+ * An open question that no longer applies, such as one about a work item its
38
+ * author changed while it was escalated, is withdrawn (#2888): it keeps its
39
+ * state, with who withdrew it, when and why as `withdrawn`, is no longer open,
40
+ * and nobody answers it. A changed item is another question with another id,
41
+ * so nothing closes the earlier one on its own; whoever asked withdraws it.
42
+ * Asking a withdrawn question again opens it again, as when the item changes
43
+ * back.
44
+ *
36
45
  * Each write holds the working tree's write lock (#3173, ws-089) from the first read
37
46
  * to the write, so two answers to one question are never both taken from the
38
47
  * same reading of it.
@@ -47,10 +56,10 @@ import { type Asked, type Escalation, type ModelAsk, type Point } from "./points
47
56
  import { type TrustPolicy } from "./trust/policy.js";
48
57
  import type { SourceVia } from "./source-block.js";
49
58
  import { type GateOrigin } from "../lifecycle/gate-origin.js";
50
- /** The version of the write documents `points ask`, `points answer` and `points retract` print. */
59
+ /** The version of the write documents `points ask`, `points answer`, `points retract` and `points withdraw` print. */
51
60
  export declare const POINTS_WRITE_CONTRACT_VERSION = 1;
52
61
  export declare const POINTS_WRITE_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/points-write/v1/points-write.schema.json";
53
- /** Why `points ask`, `points answer` or `points retract` wrote nothing. Closed: a reader may switch on it. */
62
+ /** Why `points ask`, `points answer`, `points retract` or `points withdraw` wrote nothing. Closed: a reader may switch on it. */
54
63
  export declare const POINTS_WRITE_ERROR_CODES: readonly ["kind-unreadable", "kind-invalid", "schema-unreadable", "schema-id-mismatch", "schema-invalid", "location-missing", "write-usage-invalid", "write-input-invalid", "points-undeclared", "points-invalid", "point-unknown", "point-inputs-invalid", "point-decider-failed", "answer-not-candidate", "quorum-not-met", "record-not-found", "record-closed", "record-id-taken", "answer-in-steward-turn", "answer-never-over-mcp", "principal-unidentified", "answer-not-answered", "answer-field-unsupported", "point-candidates-invalid", "write-lock-timeout", "write-lock-not-held", "record-unparseable", "record-schema-invalid", "record-id-duplicate", "record-supersedes-unknown", "record-supersedes-conflict", "record-remediates-unknown", "record-remediates-not-closed", "record-seal-mismatch", "session-seal-mismatch", "session-verdict-unknown-record"];
55
64
  export type PointsWriteErrorCode = (typeof POINTS_WRITE_ERROR_CODES)[number];
56
65
  export declare class PointsWriteError extends Error {
@@ -67,7 +76,7 @@ export interface QuestionView {
67
76
  /** What the question is about, the record's first `constrains` entry, or null. */
68
77
  subject: string | null;
69
78
  state: "escalated" | "proposed" | "answered";
70
- /** Not answered yet: escalated to people, or proposed by a model and waiting for a person to confirm it. */
79
+ /** Not answered yet: escalated to people, or proposed by a model and waiting for a person to confirm it, and not withdrawn (#2888). */
71
80
  open: boolean;
72
81
  questionType: string;
73
82
  candidates: (string | boolean)[];
@@ -111,6 +120,12 @@ export interface QuestionView {
111
120
  relayedBy: string | null;
112
121
  /** Answers people took back, oldest first (`points retract`, #3351). Empty when none was. */
113
122
  retractions: RetractionView[];
123
+ /** Who withdrew the question, when and why, when it no longer applies (`points withdraw`, #2888), or null. A withdrawn question is not open. */
124
+ withdrawn: {
125
+ by: string[];
126
+ on: string | null;
127
+ note: string | null;
128
+ } | null;
114
129
  /**
115
130
  * An ad-hoc point's question as its ask gave it (#3403): the question's text
116
131
  * and its criteria, what each candidate means. null for a declared point's
@@ -164,8 +179,8 @@ export declare function askedByOf(data: Record<string, unknown>): QuestionView["
164
179
  */
165
180
  export declare function questionView(entry: RecordEntry, point: Point | undefined, ledger?: string | null): QuestionView | null;
166
181
  /** The write verbs of `points`. */
167
- export type PointsWriteVerb = "ask" | "answer" | "retract";
168
- /** What `points ask`, `points answer` and `points retract` print. */
182
+ export type PointsWriteVerb = "ask" | "answer" | "retract" | "withdraw";
183
+ /** What `points ask`, `points answer`, `points retract` and `points withdraw` print. */
169
184
  export type PointsWriteDocument = {
170
185
  $schema: string;
171
186
  contract: number;
@@ -290,9 +305,10 @@ export interface AnswerPointOptions {
290
305
  }
291
306
  /**
292
307
  * Whether an answer kind's schema copy takes the fields of #3351 (`note` on an
293
- * answer, and `retractions`), of #3402 (`relayed_by`) and of #3403 (`asked`).
294
- * A copy of point-answer.schema.json from before them refuses a note, a
295
- * retraction, a relay or an ad-hoc ask with `answer-field-unsupported`, rather
308
+ * answer, and `retractions`), of #3402 (`relayed_by`), of #3403 (`asked`) and
309
+ * of #2888 (`withdrawn`). A copy of point-answer.schema.json from before them
310
+ * refuses a note, a retraction, a relay, an ad-hoc ask or a withdrawal with
311
+ * `answer-field-unsupported`, rather
296
312
  * than dropping what a person wrote or the question an agent asked.
297
313
  */
298
314
  export declare function answerFields(schema: Record<string, unknown>): {
@@ -300,6 +316,7 @@ export declare function answerFields(schema: Record<string, unknown>): {
300
316
  retractions: boolean;
301
317
  relayedBy: boolean;
302
318
  asked: boolean;
319
+ withdrawn: boolean;
303
320
  };
304
321
  /**
305
322
  * Count `by` toward a point's quorum: distinct people, after normalising,
@@ -352,4 +369,29 @@ export interface RetractAnswerOptions {
352
369
  * answer the question again with `points answer`.
353
370
  */
354
371
  export declare function retractAnswer(opts: RetractAnswerOptions): Promise<PointsWriteDocument>;
372
+ export interface WithdrawQuestionOptions {
373
+ cwd: string;
374
+ /** The answer record's id. */
375
+ id: string;
376
+ /** Who withdraws the question, such as the factory that asked it. At least one. */
377
+ by: string[];
378
+ /** Why, such as the question that asks about the subject now. */
379
+ note?: string;
380
+ kind?: string;
381
+ on?: string;
382
+ dryRun?: boolean;
383
+ }
384
+ /**
385
+ * Close an open question that no longer applies: `points withdraw` (#2888).
386
+ * A run asks about a work item whose author then changes it, so the next ask
387
+ * is another question, and the first one would wait on people forever. The
388
+ * question keeps its state, escalated or proposed, and gains `withdrawn`: who
389
+ * withdrew it, when and why. It is no longer open, so `points --open` leaves
390
+ * it out, and `points answer` refuses it. Asking it again opens it again.
391
+ *
392
+ * Withdrawing answers nothing and passes no gate, so it needs no quorum, and
393
+ * the asker withdraws its own question, a steward's turn or an MCP session
394
+ * included. An answered question is not withdrawn: people retract it.
395
+ */
396
+ export declare function withdrawQuestion(opts: WithdrawQuestionOptions): Promise<PointsWriteDocument>;
355
397
  //# sourceMappingURL=decide.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"decide.d.ts","sourceRoot":"","sources":["../../src/workspace/decide.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAMH,OAAO,EAA4E,KAAK,WAAW,EAAE,KAAK,aAAa,EAAE,MAAM,WAAW,CAAC;AAE3I,OAAO,EAWL,KAAK,QAAQ,EAEd,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAcL,KAAK,KAAK,EAEV,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,KAAK,EACX,MAAM,UAAU,CAAC;AAGlB,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAOhD,OAAO,EAAsC,KAAK,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAE/F,mGAAmG;AACnG,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAC/C,eAAO,MAAM,sBAAsB,0FAA0F,CAAC;AAE9H,8GAA8G;AAC9G,eAAO,MAAM,wBAAwB,i1BAmCK,CAAC;AAC3C,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,qBAAa,gBAAiB,SAAQ,KAAK;IAEvC,QAAQ,CAAC,IAAI,EAAE,oBAAoB;IADrC,YACW,IAAI,EAAE,oBAAoB,EACnC,OAAO,EAAE,MAAM,EAIhB;CACF;AAED,+HAA+H;AAC/H,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,oEAAoE;IACpE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,kFAAkF;IAClF,OAAO,EAAE,MAAM,GAAG,IAAI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EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,oBAAoB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAM5F;AA8FD,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,8BAA8B;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,mFAAmF;IACnF,EAAE,EAAE,MAAM,EAAE,CAAC;IACb,iEAAiE;IACjE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAMlG"}
@@ -4,7 +4,8 @@
4
4
  * {@link askPoint} asks a point's deciders for one set of inputs and records
5
5
  * the answer in the answer kind's records directory, {@link answerPoint}
6
6
  * records people's answer to an open question, with an optional note, and
7
- * {@link retractAnswer} takes an answer back (#3351). Each writes one Markdown
7
+ * {@link retractAnswer} takes an answer back (#3351), and {@link withdrawQuestion}
8
+ * closes an open question that no longer applies (#2888). Each writes one Markdown
8
9
  * record or none, never commits, and goes through the checks every records write goes
9
10
  * through (`records-write.ts`): the record is read back with the kind's schema
10
11
  * before it is written, and no other record may become invalid.
@@ -33,6 +34,14 @@
33
34
  * and why. Asking a retracted question again returns it as it stands, since
34
35
  * people took it back from the deciders; people answer it again.
35
36
  *
37
+ * An open question that no longer applies, such as one about a work item its
38
+ * author changed while it was escalated, is withdrawn (#2888): it keeps its
39
+ * state, with who withdrew it, when and why as `withdrawn`, is no longer open,
40
+ * and nobody answers it. A changed item is another question with another id,
41
+ * so nothing closes the earlier one on its own; whoever asked withdraws it.
42
+ * Asking a withdrawn question again opens it again, as when the item changes
43
+ * back.
44
+ *
36
45
  * Each write holds the working tree's write lock (#3173, ws-089) from the first read
37
46
  * to the write, so two answers to one question are never both taken from the
38
47
  * same reading of it.
@@ -58,10 +67,10 @@ import { scopeSource } from "./write-scope.js";
58
67
  import { RefCASConflictError } from "../lifecycle/git.js";
59
68
  import { readLedgerAnswers, refreshLedger, withLedgerAnswers, writeLedgerAnswer } from "./answers-ledger.js";
60
69
  import { currentGateOrigin, isModelAuthored } from "../lifecycle/gate-origin.js";
61
- /** The version of the write documents `points ask`, `points answer` and `points retract` print. */
70
+ /** The version of the write documents `points ask`, `points answer`, `points retract` and `points withdraw` print. */
62
71
  export const POINTS_WRITE_CONTRACT_VERSION = 1;
63
72
  export const POINTS_WRITE_SCHEMA_ID = "https://intentius.io/chant/schemas/workspace/points-write/v1/points-write.schema.json";
64
- /** Why `points ask`, `points answer` or `points retract` wrote nothing. Closed: a reader may switch on it. */
73
+ /** Why `points ask`, `points answer`, `points retract` or `points withdraw` wrote nothing. Closed: a reader may switch on it. */
65
74
  export const POINTS_WRITE_ERROR_CODES = [
66
75
  ...LOAD_ERROR_CODES,
67
76
  "write-usage-invalid",
@@ -91,7 +100,7 @@ export const POINTS_WRITE_ERROR_CODES = [
91
100
  "principal-unidentified",
92
101
  /** `points retract` names a question that has no answer: escalated or proposed (#3351). */
93
102
  "answer-not-answered",
94
- /** The answer kind's schema copy has no `note`, `retractions`, `relayed_by` or `asked` field for what the write was given (#3351, #3402, #3403). */
103
+ /** The answer kind's schema copy has no `note`, `retractions`, `relayed_by`, `asked` or `withdrawn` field for what the write was given (#3351, #3402, #3403, #2888). */
95
104
  "answer-field-unsupported",
96
105
  /** An ad-hoc point was asked without its question and candidates, a declared point with them, or they don't fit the point's question type (#3403). */
97
106
  "point-candidates-invalid",
@@ -125,6 +134,14 @@ function retractionsOf(d) {
125
134
  note: str(r.note),
126
135
  }));
127
136
  }
137
+ /** The record's `withdrawn`, as a view, or null. */
138
+ function withdrawnOf(d) {
139
+ const w = d.withdrawn;
140
+ if (w === null || typeof w !== "object" || Array.isArray(w))
141
+ return null;
142
+ const r = w;
143
+ return { by: Array.isArray(r.by) ? r.by.filter((x) => typeof x === "string") : [], on: typeof r.on === "string" ? r.on : null, note: typeof r.note === "string" ? r.note : null };
144
+ }
128
145
  /** The harness a steward's question names in its source block (#2749). */
129
146
  export const STEWARD_HARNESS = "chant-steward";
130
147
  /** The steward that asked, from a record's source block, or null. */
@@ -177,6 +194,7 @@ export function questionView(entry, point, ledger = null) {
177
194
  }
178
195
  }
179
196
  const constrains = Array.isArray(d.constrains) ? d.constrains.filter((c) => typeof c === "string") : [];
197
+ const withdrawn = withdrawnOf(d);
180
198
  return {
181
199
  id: entry.id,
182
200
  path: entry.path,
@@ -184,7 +202,7 @@ export function questionView(entry, point, ledger = null) {
184
202
  title: str(d.title) ?? "",
185
203
  subject: constrains[0] ?? null,
186
204
  state,
187
- open: state !== "answered",
205
+ open: state !== "answered" && withdrawn === null,
188
206
  questionType: str(d.question_type) ?? "",
189
207
  candidates: Array.isArray(d.candidates) ? d.candidates : [],
190
208
  inputs: d.inputs !== null && typeof d.inputs === "object" && !Array.isArray(d.inputs) ? d.inputs : {},
@@ -205,6 +223,7 @@ export function questionView(entry, point, ledger = null) {
205
223
  note: str(d.note),
206
224
  relayedBy: str(d.relayed_by),
207
225
  retractions: retractionsOf(d),
226
+ withdrawn,
208
227
  asked: askedOf(d) ?? null,
209
228
  askedBy: askedByOf(d),
210
229
  ledger,
@@ -257,7 +276,7 @@ const today = () => new Date().toISOString().slice(0, 10);
257
276
  const show = (answer, type) => (type === "noul" ? (answer ? "yes" : "no") : String(answer));
258
277
  /** A record's title: the point's title, or an ad-hoc question's own text (#3403), what it is about, and where it stands. */
259
278
  function titleFor(point, subject, state, answer, asked) {
260
- const outcome = state === "escalated" ? "open for people" : state === "proposed" ? `${show(answer, point.question.type)}, proposed` : show(answer, point.question.type);
279
+ const outcome = state === "withdrawn" ? "withdrawn" : state === "escalated" ? "open for people" : state === "proposed" ? `${show(answer, point.question.type)}, proposed` : show(answer, point.question.type);
261
280
  return `${asked ? asked.question : point.title}${subject ? ` (${subject})` : ""}: ${outcome}`;
262
281
  }
263
282
  function body(point, title, asked) {
@@ -426,11 +445,27 @@ async function askPointLocked(opts) {
426
445
  question: questionView(entry, point, extra.ledger !== undefined ? extra.ledger : heldAt(entry)),
427
446
  ...(extra.text !== undefined ? { text: extra.text } : {}),
428
447
  });
429
- if (existing && existing.data !== null && (existing.state === "answered" || existing.state === "proposed"))
448
+ /** A retracted question withdrawn and now asked again: open for people again, as it stood before it was withdrawn (#2888). */
449
+ const reopen = async (entry) => {
450
+ const { withdrawn: _, ...rest } = entry.data;
451
+ const subject = Array.isArray(rest.constrains) && typeof rest.constrains[0] === "string" ? rest.constrains[0] : undefined;
452
+ const title = titleFor(point, subject, String(rest.state), rest.answer, asked);
453
+ const data = recordData(o, { ...rest, title });
454
+ const text = renderRecord(data, body(point, title, asked));
455
+ const message = `Decision point ${opts.point}: asked again${subject ? ` (${subject})` : ""}`;
456
+ const wrote = await write(o, before, entry.path, text, false, !!opts.dryRun, { source: read, ledger, onLedger: toLedger || ledger.byPath.has(entry.path), message, who: { verb: "points ask", by: steward?.name ?? null } });
457
+ return done({ ...entry, data, valid: true, reasons: [], warnings: wrote.warnings }, { reused: false, written: !opts.dryRun, ledger: wrote.ledger, ...(opts.dryRun ? { text } : {}) });
458
+ };
459
+ // A withdrawn question is asked again (#2888): it applies again, so it is open again.
460
+ const withdrawn = existing !== undefined && existing.data !== null && existing.data.withdrawn !== undefined;
461
+ if (existing && existing.data !== null && !withdrawn && (existing.state === "answered" || existing.state === "proposed"))
430
462
  return done(existing, { reused: true, written: false });
431
463
  // People took a retracted question back from the deciders (ws-084): they answer it again, and asking returns it as it stands.
432
- if (existing && existing.data !== null && Array.isArray(existing.data.retractions) && existing.data.retractions.length > 0)
433
- return done(existing, { reused: true, written: false });
464
+ if (existing && existing.data !== null && Array.isArray(existing.data.retractions) && existing.data.retractions.length > 0) {
465
+ if (!withdrawn)
466
+ return done(existing, { reused: true, written: false });
467
+ return reopen(existing);
468
+ }
434
469
  let result;
435
470
  try {
436
471
  result = await runChain(opts.point, { ...point, question: askedQuestion(point, asked) }, inputs, opts.ask);
@@ -441,7 +476,7 @@ async function askPointLocked(opts) {
441
476
  throw err;
442
477
  }
443
478
  // A standing escalation is kept while the chain still escalates.
444
- if (existing && existing.data !== null && result.status === "escalated")
479
+ if (existing && existing.data !== null && !withdrawn && result.status === "escalated")
445
480
  return done(existing, { reused: true, written: false });
446
481
  const on = opts.on ?? today();
447
482
  const state = result.status;
@@ -490,15 +525,16 @@ function emptyEntry(path) {
490
525
  }
491
526
  /**
492
527
  * Whether an answer kind's schema copy takes the fields of #3351 (`note` on an
493
- * answer, and `retractions`), of #3402 (`relayed_by`) and of #3403 (`asked`).
494
- * A copy of point-answer.schema.json from before them refuses a note, a
495
- * retraction, a relay or an ad-hoc ask with `answer-field-unsupported`, rather
528
+ * answer, and `retractions`), of #3402 (`relayed_by`), of #3403 (`asked`) and
529
+ * of #2888 (`withdrawn`). A copy of point-answer.schema.json from before them
530
+ * refuses a note, a retraction, a relay, an ad-hoc ask or a withdrawal with
531
+ * `answer-field-unsupported`, rather
496
532
  * than dropping what a person wrote or the question an agent asked.
497
533
  */
498
534
  export function answerFields(schema) {
499
535
  const props = schema.properties;
500
536
  const has = (key) => props !== undefined && props !== null && typeof props === "object" && Object.prototype.hasOwnProperty.call(props, key);
501
- return { note: has("note"), retractions: has("retractions"), relayedBy: has("relayed_by"), asked: has("asked") };
537
+ return { note: has("note"), retractions: has("retractions"), relayedBy: has("relayed_by"), asked: has("asked"), withdrawn: has("withdrawn") };
502
538
  }
503
539
  /** A note as given, trimmed, or undefined when it is empty. */
504
540
  const noteOf = (note) => {
@@ -683,6 +719,9 @@ async function answerPointLocked(opts) {
683
719
  if (target.state === "answered") {
684
720
  throw new PointsWriteError("record-closed", `${opts.id} is answered, and an answer never changes in place: retract it with \`points retract ${opts.id}\` and answer again, ask again with other inputs, or change the point, which asks the question anew`);
685
721
  }
722
+ if (d.withdrawn !== undefined) {
723
+ throw new PointsWriteError("record-closed", `${opts.id} was withdrawn, so nobody answers it: ask it again with \`points ask\`, which opens it again, when it applies again`);
724
+ }
686
725
  const note = noteOf(opts.note);
687
726
  if (note !== undefined && !answerFields(o.loaded.schema).note) {
688
727
  throw new PointsWriteError("answer-field-unsupported", `the ${o.loaded.kind.name} kind's schema has no note field, so ${opts.id} can't keep the note: copy point-answer.schema.json from @intentius/chant anew`);
@@ -877,3 +916,75 @@ async function retractAnswerLocked(opts) {
877
916
  return failure("retract", err);
878
917
  }
879
918
  }
919
+ /**
920
+ * Close an open question that no longer applies: `points withdraw` (#2888).
921
+ * A run asks about a work item whose author then changes it, so the next ask
922
+ * is another question, and the first one would wait on people forever. The
923
+ * question keeps its state, escalated or proposed, and gains `withdrawn`: who
924
+ * withdrew it, when and why. It is no longer open, so `points --open` leaves
925
+ * it out, and `points answer` refuses it. Asking it again opens it again.
926
+ *
927
+ * Withdrawing answers nothing and passes no gate, so it needs no quorum, and
928
+ * the asker withdraws its own question, a steward's turn or an MCP session
929
+ * included. An answered question is not withdrawn: people retract it.
930
+ */
931
+ export async function withdrawQuestion(opts) {
932
+ try {
933
+ return await withWriteLock(opts.cwd, { verb: "points withdraw", by: (opts.by ?? []).join(", ") || null }, opts.dryRun, () => withdrawQuestionLocked(opts));
934
+ }
935
+ catch (err) {
936
+ return failure("withdraw", err);
937
+ }
938
+ }
939
+ async function withdrawQuestionLocked(opts) {
940
+ try {
941
+ const by = [...new Set((opts.by ?? []).map((b) => b.trim()).filter((b) => b !== ""))];
942
+ if (by.length === 0)
943
+ throw new PointsWriteError("write-usage-invalid", "--by <name> is required: who withdraws the question");
944
+ refuseUnidentified(scopeSource(opts.cwd), by, "--by");
945
+ const found = await findQuestion(opts.cwd, opts.kind, opts.id);
946
+ const { opened, before, target } = found;
947
+ const ledger = found.read.ledger;
948
+ const { o } = opened;
949
+ const d = target.data;
950
+ if (target.state === "answered") {
951
+ throw new PointsWriteError("record-closed", `${opts.id} is answered, so it is not withdrawn: people take the answer back with \`points retract ${opts.id}\``);
952
+ }
953
+ if (d.withdrawn !== undefined)
954
+ throw new PointsWriteError("record-closed", `${opts.id} is withdrawn already`);
955
+ if (!answerFields(o.loaded.schema).withdrawn) {
956
+ throw new PointsWriteError("answer-field-unsupported", `the ${o.loaded.kind.name} kind's schema has no withdrawn field, so ${opts.id} can't record that it no longer applies: copy point-answer.schema.json from @intentius/chant anew`);
957
+ }
958
+ const name = String(d.point);
959
+ const point = pointOf(opened.points, name);
960
+ if (!point)
961
+ throw new PointsWriteError("point-unknown", `${opts.id} asks ${name}, which ${opened.pointsFile} no longer declares`);
962
+ const on = opts.on ?? today();
963
+ const note = noteOf(opts.note);
964
+ const subject = Array.isArray(d.constrains) && typeof d.constrains[0] === "string" ? d.constrains[0] : undefined;
965
+ const asked = askedOf(d);
966
+ const title = titleFor(point, subject, "withdrawn", undefined, asked);
967
+ const data = recordData(o, { ...d, title, withdrawn: Object.fromEntries(Object.entries({ by, on, note }).filter(([, v]) => v !== undefined)) });
968
+ const text = renderRecord(data, body(point, title, asked));
969
+ const onLedger = ledger.byPath.has(target.path);
970
+ const message = `Decision point ${name}: withdrawn by ${by.join(", ")}${subject ? ` (${subject})` : ""}`;
971
+ const wrote = await write(o, before, target.path, text, false, !!opts.dryRun, { source: found.read.source, ledger, onLedger, message, who: { verb: "points withdraw", by: by.join(", ") } });
972
+ const entry = { ...target, data, valid: true, reasons: [], warnings: wrote.warnings };
973
+ return {
974
+ $schema: POINTS_WRITE_SCHEMA_ID,
975
+ contract: POINTS_WRITE_CONTRACT_VERSION,
976
+ verb: "withdraw",
977
+ kind: o.view,
978
+ id: opts.id,
979
+ path: target.path,
980
+ reused: false,
981
+ written: !opts.dryRun,
982
+ dryRun: !!opts.dryRun,
983
+ question: questionView(entry, point, onLedger ? (wrote.ledger ?? ledger.byPath.get(target.path)?.ledger ?? null) : null),
984
+ ...(opts.dryRun ? { text } : {}),
985
+ };
986
+ }
987
+ catch (err) {
988
+ return failure("withdraw", err);
989
+ }
990
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"lineage-upgrade.d.ts","sourceRoot":"","sources":["../../src/workspace/lineage-upgrade.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AAOH,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAGhE,OAAO,EAEL,SAAS,EAOT,KAAK,OAAO,EAGZ,KAAK,UAAU,EAChB,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAkC,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAG/F,OAAO,EAAiB,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAOpE,gGAAgG;AAChG,eAAO,MAAM,iBAAiB,sBAAsB,CAAC;AAErD,kEAAkE;AAClE,eAAO,MAAM,WAAW,mBAAmB,CAAC;AAE5C,qBAAa,YAAa,SAAQ,SAAS;IAChC,IAAI,SAAkB;CAChC;AAID,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,iBAAiB,GAAG,WAAW,CAAC;IACzD,MAAM,EAAE,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;IACxC,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uGAAuG;IACvG,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE9I;;;;GAIG;AACH,eAAO,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AAiH;IACjH,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACpC,MAAM,EAAE,YAAY,EAAE,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;IAClB,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,4DAA4D;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;IACxB,+CAA+C;IAC/C,OAAO,IAAI,IAAI,CAAC;CACjB;AA+OD,mGAAmG;AACnG,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEtD;AAoFD;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAyBjI;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,aAAa,CAAC,CA0QlF;AAyBD,2EAA2E;AAC3E,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAa9D;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAiBlG;AAED,sEAAsE;AACtE,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,EAAE,CAmC9D"}
@@ -399,23 +399,32 @@ export function isGovernancePath(path) {
399
399
  * strictest gate declared at HEAD in any Op file the patch changes, at least
400
400
  * one. The Op files are read from the project's tree, which the upgrade
401
401
  * requires to match HEAD for every path the patch touches.
402
+ *
403
+ * Discovery runs from each changed Op file's own directory, so it finds the
404
+ * file under the project that owns it. Run from a workspace root, it would
405
+ * skip every member's Op files (#2892).
402
406
  */
403
- async function rulesAtHead(root, repo, paths) {
407
+ async function rulesAtHead(repo, paths) {
404
408
  const opFiles = new Set(paths.filter((p) => GOVERNANCE[0].test(p)));
405
409
  let count = 1;
406
410
  let roles;
407
411
  if (opFiles.size > 0) {
408
412
  const { discoverOps } = await import("../op/discover.js");
409
- const { ops } = await discoverOps({ cwd: root });
410
- for (const { config, filePath } of ops.values()) {
411
- const rel = relative(repo, filePath).split(sep).join("/");
412
- if (!opFiles.has(rel))
413
+ const dirs = new Set([...opFiles].map((p) => dirname(join(repo, p))));
414
+ for (const dir of dirs) {
415
+ if (!existsSync(dir))
413
416
  continue;
414
- for (const approval of gateApprovals(config)) {
415
- const need = approval.quorum?.count ?? 1;
416
- if (need > count) {
417
- count = need;
418
- roles = approval.quorum?.roles;
417
+ const { ops } = await discoverOps({ cwd: dir });
418
+ for (const { config, filePath } of ops.values()) {
419
+ const rel = relative(repo, filePath).split(sep).join("/");
420
+ if (!opFiles.has(rel))
421
+ continue;
422
+ for (const approval of gateApprovals(config)) {
423
+ const need = approval.quorum?.count ?? 1;
424
+ if (need > count) {
425
+ count = need;
426
+ roles = approval.quorum?.roles;
427
+ }
419
428
  }
420
429
  }
421
430
  }
@@ -681,7 +690,7 @@ export async function stageUpgrade(options) {
681
690
  if (touched.length > 0) {
682
691
  throw new UpgradeError(`the upgrade changes governance files that have uncommitted edits (${touched.map((l) => l.slice(3)).join(", ")}). Commit them first: their gates are read at HEAD.`);
683
692
  }
684
- governance = { paths: governed, approval: await rulesAtHead(root, repo, governed), rules: head };
693
+ governance = { paths: governed, approval: await rulesAtHead(repo, governed), rules: head };
685
694
  }
686
695
  // 5. Checks.
687
696
  const checks = [];
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/draft-07/schema#",
3
3
  "$id": "urn:intentius:chant:point-answer:1",
4
4
  "title": "Decision point answer front matter",
5
- "description": "The front matter of one answer to a decision point (ws-058, #2739), as `chant workspace points ask` and `points answer` write it into the records directory of a record kind with an `answers` block. One record per point, declaration and inputs: its id is the point's name and the first 12 hex digits of the inputs hash, so the same question is answered once. A table's answer is `answered`; a model's answer at or above its threshold is `proposed` until a person confirms it; a question no decider before the quorum answered is `escalated`, open for people. An answer never changes in place: `points retract` escalates the question to people again and moves the answer into `retractions` (#3351, ws-084). An ad-hoc point's answer keeps the question and candidates its ask gave as `asked`, and they are part of the inputs hash (#3403). A workspace copies this file next to its answer kind, as reference-workspace/answers/ does. Values stay within what YAML and JSON share. Fields other than these must start with x-.",
5
+ "description": "The front matter of one answer to a decision point (ws-058, #2739), as `chant workspace points ask` and `points answer` write it into the records directory of a record kind with an `answers` block. One record per point, declaration and inputs: its id is the point's name and the first 12 hex digits of the inputs hash, so the same question is answered once. A table's answer is `answered`; a model's answer at or above its threshold is `proposed` until a person confirms it; a question no decider before the quorum answered is `escalated`, open for people. An answer never changes in place: `points retract` escalates the question to people again and moves the answer into `retractions` (#3351, ws-084). An open question that no longer applies is `withdrawn` (`points withdraw`, #2888), and asking it again opens it again. An ad-hoc point's answer keeps the question and candidates its ask gave as `asked`, and they are part of the inputs hash (#3403). A workspace copies this file next to its answer kind, as reference-workspace/answers/ does. Values stay within what YAML and JSON share. Fields other than these must start with x-.",
6
6
  "type": "object",
7
7
  "additionalProperties": false,
8
8
  "patternProperties": { "^x-": {} },
@@ -65,6 +65,17 @@
65
65
  "description": "Answers people took back, oldest first (`points retract`, #3351): each answer as it was, and who retracted it, when and why. A retracted question is escalated to people again.",
66
66
  "items": { "$ref": "#/definitions/retraction" }
67
67
  },
68
+ "withdrawn": {
69
+ "type": "object",
70
+ "description": "An open question that no longer applies, such as one about a work item its author changed, which a run asks about anew (`points withdraw`, #2888): who withdrew it, when and why. A withdrawn question is not open, and nobody answers it; asking it again opens it again.",
71
+ "required": ["by", "on"],
72
+ "properties": {
73
+ "by": { "type": "array", "minItems": 1, "items": { "type": "string", "minLength": 1 }, "description": "Who withdrew it." },
74
+ "on": { "$ref": "#/definitions/date" },
75
+ "note": { "type": "string", "minLength": 1, "description": "Why it was withdrawn (`points withdraw --note`)." }
76
+ },
77
+ "additionalProperties": false
78
+ },
68
79
  "asked_on": { "$ref": "#/definitions/date" },
69
80
  "answered_on": { "$ref": "#/definitions/date" },
70
81
  "source": {
@@ -85,6 +96,10 @@
85
96
  "if": { "properties": { "state": { "const": "escalated" } }, "required": ["state"] },
86
97
  "then": { "not": { "required": ["answer"] }, "properties": { "decider": { "properties": { "kind": { "const": "quorum" } } } } }
87
98
  },
99
+ {
100
+ "if": { "required": ["withdrawn"] },
101
+ "then": { "properties": { "state": { "enum": ["escalated", "proposed"] } } }
102
+ },
88
103
  {
89
104
  "if": { "properties": { "decider": { "properties": { "kind": { "const": "model" } }, "required": ["kind"] } }, "required": ["decider"] },
90
105
  "then": { "required": ["probabilities", "confidence", "threshold"], "properties": { "decider": { "required": ["backend", "model"] } } }
@@ -6,12 +6,12 @@
6
6
  * The points come from each record kind the declaration names with an
7
7
  * `answers` block, or from `--kind`, and the questions are that kind's
8
8
  * records. A question is open while it is escalated to people or proposed by a
9
- * model and not yet confirmed, and it lists any model's answer with its
9
+ * model and not yet confirmed, and not withdrawn (#2888), and it lists any model's answer with its
10
10
  * confidence, so a reader such as hud can prompt a person and an MCP client
11
11
  * can see it. With `--open`, only open questions are listed. It never writes
12
12
  * and never calls a model.
13
13
  *
14
- * `points ask`, `points answer` and `points retract` are the writes, in
14
+ * `points ask`, `points answer`, `points retract` and `points withdraw` are the writes, in
15
15
  * `decide.ts`.
16
16
  */
17
17
  import type { CommandContext } from "../cli/registry.js";
@@ -83,6 +83,7 @@ export type PointsDocument = {
83
83
  sources: SourceView[];
84
84
  points: PointView[];
85
85
  questions: QuestionView[];
86
+ /** escalated, proposed and answered count by state, withdrawn ones included; withdrawn counts the questions withdrawn (#2888). */
86
87
  summary: {
87
88
  points: number;
88
89
  questions: number;
@@ -90,6 +91,7 @@ export type PointsDocument = {
90
91
  escalated: number;
91
92
  proposed: number;
92
93
  answered: number;
94
+ withdrawn: number;
93
95
  };
94
96
  } | {
95
97
  $schema: string;
@@ -124,7 +126,7 @@ export declare function formatPoints(doc: Extract<PointsDocument, {
124
126
  }>): string;
125
127
  /** A POST /v1/systemone response the caller already has, as the model call: its answer to the point asked. */
126
128
  export declare function responseAsk(response: unknown): ModelAsk;
127
- /** `chant workspace points`, and its `ask`, `answer` and `retract` verbs. */
129
+ /** `chant workspace points`, and its `ask`, `answer`, `retract` and `withdraw` verbs. */
128
130
  export declare function runWorkspacePoints(ctx: CommandContext): Promise<number>;
129
131
  export {};
130
132
  //# sourceMappingURL=points-cli.d.ts.map