@intentius/chant 0.124.23 → 0.124.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ci-jobs.d.ts +41 -1
- package/dist/ci-jobs.d.ts.map +1 -1
- package/dist/ci-jobs.js +48 -1
- package/dist/cli/commands/build.d.ts.map +1 -1
- package/dist/cli/commands/build.js +14 -0
- package/dist/cli/handlers/approve.d.ts.map +1 -1
- package/dist/cli/handlers/approve.js +9 -0
- package/dist/cli/handlers/emulator.d.ts +13 -2
- package/dist/cli/handlers/emulator.d.ts.map +1 -1
- package/dist/cli/handlers/emulator.js +63 -3
- package/dist/cli/handlers/promote.d.ts.map +1 -1
- package/dist/cli/handlers/promote.js +7 -1
- package/dist/cli/handlers/run-wave.d.ts.map +1 -1
- package/dist/cli/handlers/run-wave.js +5 -4
- package/dist/cli/handlers/run.d.ts +4 -3
- package/dist/cli/handlers/run.d.ts.map +1 -1
- package/dist/cli/handlers/run.js +73 -9
- package/dist/cli/main.d.ts.map +1 -1
- package/dist/cli/main.js +38 -11
- package/dist/cli/mcp/workspace-tools.d.ts +3 -3
- package/dist/cli/mcp/workspace-tools.d.ts.map +1 -1
- package/dist/cli/mcp/workspace-tools.js +27 -4
- package/dist/cli/parse-args.d.ts.map +1 -1
- package/dist/cli/parse-args.js +31 -0
- package/dist/cli/registry.d.ts +12 -0
- package/dist/cli/registry.d.ts.map +1 -1
- package/dist/components/cli-support.d.ts +45 -6
- package/dist/components/cli-support.d.ts.map +1 -1
- package/dist/components/cli-support.js +97 -22
- package/dist/components/driver.d.ts.map +1 -1
- package/dist/components/driver.js +25 -10
- package/dist/effect-receipt.d.ts +13 -0
- package/dist/effect-receipt.d.ts.map +1 -1
- package/dist/effect-receipt.js +19 -0
- package/dist/graph-detail.d.ts.map +1 -1
- package/dist/graph-detail.js +24 -2
- package/dist/lexicon-module.d.ts +7 -1
- package/dist/lexicon-module.d.ts.map +1 -1
- package/dist/lexicon-module.js +7 -2
- package/dist/lifecycle/git.d.ts +11 -0
- package/dist/lifecycle/git.d.ts.map +1 -1
- package/dist/lifecycle/git.js +62 -6
- package/dist/lifecycle/no-record.d.ts +59 -0
- package/dist/lifecycle/no-record.d.ts.map +1 -0
- package/dist/lifecycle/no-record.js +88 -0
- package/dist/lifecycle/receipt-plan.d.ts.map +1 -1
- package/dist/lifecycle/receipt-plan.js +4 -2
- package/dist/op/activities/shell.d.ts.map +1 -1
- package/dist/op/activities/shell.js +30 -9
- package/dist/op/emulator-lifecycle.d.ts +23 -0
- package/dist/op/emulator-lifecycle.d.ts.map +1 -1
- package/dist/op/emulator-lifecycle.js +39 -2
- package/dist/op/gate.d.ts.map +1 -1
- package/dist/op/gate.js +3 -0
- package/dist/op/index.d.ts +1 -1
- package/dist/op/index.d.ts.map +1 -1
- package/dist/op/index.js +1 -1
- package/dist/op/local-executor.d.ts +10 -0
- package/dist/op/local-executor.d.ts.map +1 -1
- package/dist/op/local-executor.js +71 -7
- package/dist/op/op-waves-notify.d.ts +2 -0
- package/dist/op/op-waves-notify.d.ts.map +1 -1
- package/dist/op/op-waves-notify.js +9 -3
- package/dist/op/op-waves-run.d.ts +8 -2
- package/dist/op/op-waves-run.d.ts.map +1 -1
- package/dist/op/op-waves-run.js +36 -11
- package/dist/op/op-waves.d.ts +85 -1
- package/dist/op/op-waves.d.ts.map +1 -1
- package/dist/op/op-waves.js +153 -1
- package/dist/op/receipt-store.d.ts +5 -0
- package/dist/op/receipt-store.d.ts.map +1 -1
- package/dist/op/receipt-store.js +4 -3
- package/dist/op/runtimes/local.d.ts.map +1 -1
- package/dist/op/runtimes/local.js +6 -0
- package/dist/op/step-console.d.ts +65 -0
- package/dist/op/step-console.d.ts.map +1 -0
- package/dist/op/step-console.js +140 -0
- package/dist/op/step-output-ref.d.ts +26 -18
- package/dist/op/step-output-ref.d.ts.map +1 -1
- package/dist/op/step-output-ref.js +86 -63
- package/dist/point-decision.d.ts.map +1 -1
- package/dist/point-decision.js +3 -0
- package/dist/wave-runtime.mjs +239 -239
- package/dist/workspace/agent-cli.d.ts.map +1 -1
- package/dist/workspace/agent-cli.js +3 -0
- package/dist/workspace/compose-graph.d.ts +22 -3
- package/dist/workspace/compose-graph.d.ts.map +1 -1
- package/dist/workspace/compose-graph.js +18 -5
- package/dist/workspace/conformance/__writer_fixture__/answers/answer.schema.json +16 -1
- package/dist/workspace/conformance/writer.js +1 -1
- package/dist/workspace/decide.d.ts +51 -9
- package/dist/workspace/decide.d.ts.map +1 -1
- package/dist/workspace/decide.js +125 -14
- package/dist/workspace/graph.schema.json +68 -1
- package/dist/workspace/lineage-upgrade.d.ts.map +1 -1
- package/dist/workspace/lineage-upgrade.js +20 -11
- package/dist/workspace/nested-graph.d.ts +1 -1
- package/dist/workspace/nested-graph.d.ts.map +1 -1
- package/dist/workspace/nested-graph.js +5 -1
- package/dist/workspace/point-answer.schema.json +16 -1
- package/dist/workspace/points-cli.d.ts +5 -3
- package/dist/workspace/points-cli.d.ts.map +1 -1
- package/dist/workspace/points-cli.js +16 -7
- package/dist/workspace/points-write.schema.json +39 -4
- package/dist/workspace/points.schema.json +42 -3
- package/dist/workspace/reason-codes.d.ts +2 -1
- package/dist/workspace/reason-codes.d.ts.map +1 -1
- package/dist/workspace/reason-codes.js +2 -1
- package/dist/workspace/records-cli.d.ts +12 -2
- package/dist/workspace/records-cli.d.ts.map +1 -1
- package/dist/workspace/records-cli.js +27 -7
- package/dist/workspace/records-write.d.ts.map +1 -1
- package/dist/workspace/records-write.js +2 -3
- package/dist/workspace/records.d.ts +10 -4
- package/dist/workspace/records.d.ts.map +1 -1
- package/dist/workspace/records.js +16 -3
- package/dist/workspace/records.schema.json +2 -1
- package/dist/workspace/runs.d.ts.map +1 -1
- package/dist/workspace/runs.js +4 -2
- package/dist/workspace/trust/verify-cli.d.ts.map +1 -1
- package/dist/workspace/trust/verify-cli.js +2 -1
- package/dist/workspace/trust/verify.d.ts +22 -0
- package/dist/workspace/trust/verify.d.ts.map +1 -1
- package/dist/workspace/trust/verify.js +94 -14
- package/dist/workspace/write-scope.d.ts +3 -1
- package/dist/workspace/write-scope.d.ts.map +1 -1
- package/dist/workspace/write-scope.js +11 -4
- package/package.json +1 -1
- package/src/ci-jobs.ts +58 -1
- package/src/cli/commands/build.ts +18 -0
- package/src/cli/compiled-cli.e2e.test.ts +45 -1
- package/src/cli/handlers/approve.ts +9 -0
- package/src/cli/handlers/emulator.test.ts +61 -1
- package/src/cli/handlers/emulator.ts +65 -4
- package/src/cli/handlers/promote.test.ts +7 -0
- package/src/cli/handlers/promote.ts +7 -1
- package/src/cli/handlers/run-no-record.e2e.test.ts +87 -0
- package/src/cli/handlers/run-wave.ts +5 -4
- package/src/cli/handlers/run.test.ts +126 -0
- package/src/cli/handlers/run.ts +69 -9
- package/src/cli/main.test.ts +34 -0
- package/src/cli/main.ts +38 -11
- package/src/cli/mcp/workspace-tools.e2e.test.ts +1 -1
- package/src/cli/mcp/workspace-tools.ts +27 -4
- package/src/cli/parse-args.ts +21 -0
- package/src/cli/registry.ts +12 -0
- package/src/components/cli-support.test.ts +75 -0
- package/src/components/cli-support.ts +130 -25
- package/src/components/driver.test.ts +28 -0
- package/src/components/driver.ts +23 -10
- package/src/components/generate-disabled.test.ts +56 -0
- package/src/effect-receipt.ts +22 -0
- package/src/graph-ci-edges.test.ts +50 -0
- package/src/graph-detail.ts +21 -2
- package/src/lexicon-module.ts +9 -2
- package/src/lifecycle/git.ts +61 -6
- package/src/lifecycle/no-record.test.ts +175 -0
- package/src/lifecycle/no-record.ts +108 -0
- package/src/lifecycle/receipt-plan.test.ts +9 -0
- package/src/lifecycle/receipt-plan.ts +4 -1
- package/src/op/activities/shell.ts +28 -6
- package/src/op/effect-step.test.ts +95 -1
- package/src/op/emulator-lifecycle.test.ts +24 -1
- package/src/op/emulator-lifecycle.ts +58 -2
- package/src/op/gate.ts +3 -0
- package/src/op/index.ts +1 -1
- package/src/op/local-executor.test.ts +65 -0
- package/src/op/local-executor.ts +88 -8
- package/src/op/op-waves-jobs.test.ts +213 -0
- package/src/op/op-waves-notify.ts +11 -5
- package/src/op/op-waves-run.ts +42 -11
- package/src/op/op-waves.ts +202 -2
- package/src/op/receipt-store.ts +13 -3
- package/src/op/runtimes/local.ts +6 -0
- package/src/op/step-console.test.ts +150 -0
- package/src/op/step-console.ts +155 -0
- package/src/op/step-output-ref.test.ts +68 -24
- package/src/op/step-output-ref.ts +85 -65
- package/src/point-decision-bundle.test.ts +1 -0
- package/src/point-decision.ts +3 -0
- package/src/workspace/agent-cli.ts +2 -0
- package/src/workspace/compose-graph.test.ts +55 -0
- package/src/workspace/compose-graph.ts +28 -6
- package/src/workspace/conformance/__writer_fixture__/answers/answer.schema.json +16 -1
- package/src/workspace/conformance/writer.ts +1 -1
- package/src/workspace/decide.test.ts +87 -3
- package/src/workspace/decide.ts +142 -17
- package/src/workspace/graph-contract.test.ts +26 -1
- package/src/workspace/graph.schema.json +68 -1
- package/src/workspace/lineage-upgrade.test.ts +21 -0
- package/src/workspace/lineage-upgrade.ts +19 -11
- package/src/workspace/nested-graph.test.ts +14 -0
- package/src/workspace/nested-graph.ts +7 -2
- package/src/workspace/point-answer.schema.json +16 -1
- package/src/workspace/points-cli.ts +16 -8
- package/src/workspace/points-write.schema.json +39 -4
- package/src/workspace/points.schema.json +42 -3
- package/src/workspace/reason-codes.ts +2 -1
- package/src/workspace/record-assets.test.ts +14 -0
- package/src/workspace/records-cli.ts +28 -7
- package/src/workspace/records-write-commands.e2e.test.ts +32 -0
- package/src/workspace/records-write.ts +2 -3
- package/src/workspace/records.schema.json +2 -1
- package/src/workspace/records.ts +17 -4
- package/src/workspace/runs.ts +4 -2
- package/src/workspace/trust/trust.test.ts +105 -0
- package/src/workspace/trust/verify-cli.ts +2 -1
- package/src/workspace/trust/verify.ts +106 -13
- package/src/workspace/write-scope.test.ts +18 -0
- package/src/workspace/write-scope.ts +16 -5
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-cli.d.ts","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AE,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;
|
|
@@ -11,8 +11,12 @@
|
|
|
11
11
|
* `runtimeOwner` and export and import nodes are rewritten the same way.
|
|
12
12
|
* - `groups.byMember` maps each member to its node ids. `byLexicon` and
|
|
13
13
|
* `byComposite` keep their keys (a lexicon or composite type is the same
|
|
14
|
-
* thing in every member) and merge the ids. `byStack`, `byContainer
|
|
15
|
-
* `byWave` name things inside one member, so their keys
|
|
14
|
+
* thing in every member) and merge the ids. `byStack`, `byContainer`,
|
|
15
|
+
* `byWave` and `byPipeline` name things inside one member, so their keys
|
|
16
|
+
* are prefixed too.
|
|
17
|
+
* - Edges keep their `kind` and `crossPipeline` (#3910). A member's dangling
|
|
18
|
+
* references (`ir.dangling`) land on the top-level `dangling` list with
|
|
19
|
+
* `from` prefixed and a `member` field, like edges (#3922).
|
|
16
20
|
* - `links` holds the member links (#2524 D6, #2539): the declared links and
|
|
17
21
|
* the joins inferred from members' `imports` and `exports` with the core
|
|
18
22
|
* `joinKey()`, labelled `exact` or `folded` (`./links.ts`). A declared link
|
|
@@ -34,7 +38,7 @@ import type { KindRegistry } from "./kinds.js";
|
|
|
34
38
|
import { type LinkTableRow } from "./links.js";
|
|
35
39
|
import type { KindLinkRead } from "./kind-link-readers.js";
|
|
36
40
|
import type { RecordLinkRow } from "./record-assets.js";
|
|
37
|
-
import { type GraphIR, type IRExport, type IRGroups, type IRImport, type IREdge, type IRNode } from "../graph-ir.js";
|
|
41
|
+
import { type GraphIR, type IRExport, type IRDanglingRef, type IRGroups, type IRImport, type IREdge, type IRNode } from "../graph-ir.js";
|
|
38
42
|
/** The version of the composed document `chant workspace graph` writes. */
|
|
39
43
|
export declare const WORKSPACE_GRAPH_VERSION = 1;
|
|
40
44
|
/**
|
|
@@ -145,6 +149,11 @@ export type ComposedNode = IRNode & {
|
|
|
145
149
|
export type ComposedEdge = IREdge & {
|
|
146
150
|
member: string;
|
|
147
151
|
};
|
|
152
|
+
/** A member's dangling reference (#3910, #3922): `from` is prefixed like a node id. `nested` as on {@link ComposedNode}. */
|
|
153
|
+
export type ComposedDangling = IRDanglingRef & {
|
|
154
|
+
member: string;
|
|
155
|
+
nested?: string;
|
|
156
|
+
};
|
|
148
157
|
export interface WorkspaceGraph {
|
|
149
158
|
version: number;
|
|
150
159
|
workspace: {
|
|
@@ -164,6 +173,12 @@ export interface WorkspaceGraph {
|
|
|
164
173
|
member: string;
|
|
165
174
|
})[];
|
|
166
175
|
derivedAttrs?: Record<string, string[]>;
|
|
176
|
+
/**
|
|
177
|
+
* The members' dangling CI references (#3910, #3922): each `ir.dangling`
|
|
178
|
+
* entry with `from` prefixed by its member and a `member` field, sorted by
|
|
179
|
+
* `from`, `path` and `value`. Absent when no member has one.
|
|
180
|
+
*/
|
|
181
|
+
dangling?: ComposedDangling[];
|
|
167
182
|
/**
|
|
168
183
|
* Member links (#2524 D6, #2539), declared and inferred, then the links of
|
|
169
184
|
* the records read with `--kind` (#2549). Empty when no declaration is given.
|
|
@@ -202,6 +217,10 @@ export interface ComposeInput {
|
|
|
202
217
|
/** Present for a member whose IR was read. */
|
|
203
218
|
ir?: GraphIR;
|
|
204
219
|
}
|
|
220
|
+
/** The groups whose keys name something inside one member, so are prefixed with it. */
|
|
221
|
+
export declare const SCOPED_GROUPS: readonly ["byStack", "byContainer", "byWave", "byPipeline"];
|
|
222
|
+
/** The order the composed `dangling` list is sorted in. */
|
|
223
|
+
export declare const danglingKey: (d: IRDanglingRef) => string;
|
|
205
224
|
/**
|
|
206
225
|
* Compose the members' IRs into the workspace document. Members keep the
|
|
207
226
|
* order they are given in. With `links`, the `links` section is filled from
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compose-graph.d.ts","sourceRoot":"","sources":["../../src/workspace/compose-graph.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"compose-graph.d.ts","sourceRoot":"","sources":["../../src/workspace/compose-graph.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAC5C,OAAO,EAAc,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAErD,OA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eOwner` and export and import nodes are rewritten the same way.
|
|
12
12
|
* - `groups.byMember` maps each member to its node ids. `byLexicon` and
|
|
13
13
|
* `byComposite` keep their keys (a lexicon or composite type is the same
|
|
14
|
-
* thing in every member) and merge the ids. `byStack`, `byContainer
|
|
15
|
-
* `byWave` name things inside one member, so their keys
|
|
14
|
+
* thing in every member) and merge the ids. `byStack`, `byContainer`,
|
|
15
|
+
* `byWave` and `byPipeline` name things inside one member, so their keys
|
|
16
|
+
* are prefixed too.
|
|
17
|
+
* - Edges keep their `kind` and `crossPipeline` (#3910). A member's dangling
|
|
18
|
+
* references (`ir.dangling`) land on the top-level `dangling` list with
|
|
19
|
+
* `from` prefixed and a `member` field, like edges (#3922).
|
|
16
20
|
* - `links` holds the member links (#2524 D6, #2539): the declared links and
|
|
17
21
|
* the joins inferred from members' `imports` and `exports` with the core
|
|
18
22
|
* `joinKey()`, labelled `exact` or `folded` (`./links.ts`). A declared link
|
|
@@ -132,6 +136,10 @@ function prefixRefs(value, member) {
|
|
|
132
136
|
}
|
|
133
137
|
return out;
|
|
134
138
|
}
|
|
139
|
+
/** The groups whose keys name something inside one member, so are prefixed with it. */
|
|
140
|
+
export const SCOPED_GROUPS = ["byStack", "byContainer", "byWave", "byPipeline"];
|
|
141
|
+
/** The order the composed `dangling` list is sorted in. */
|
|
142
|
+
export const danglingKey = (d) => `${d.from}\u0000${d.path}\u0000${d.value}`;
|
|
135
143
|
function mergeInto(target, key, ids) {
|
|
136
144
|
(target[key] ?? (target[key] = [])).push(...ids);
|
|
137
145
|
}
|
|
@@ -155,7 +163,8 @@ export function composeWorkspaceGraph(workspace, inputs, links) {
|
|
|
155
163
|
const imports = [];
|
|
156
164
|
const byMember = {};
|
|
157
165
|
const shared = { byLexicon: {}, byComposite: {} };
|
|
158
|
-
const scoped = { byStack: {}, byContainer: {}, byWave: {} };
|
|
166
|
+
const scoped = { byStack: {}, byContainer: {}, byWave: {}, byPipeline: {} };
|
|
167
|
+
const dangling = [];
|
|
159
168
|
const derivedAttrs = {};
|
|
160
169
|
const collectors = [];
|
|
161
170
|
for (const { member, ir } of inputs) {
|
|
@@ -179,10 +188,12 @@ export function composeWorkspaceGraph(workspace, inputs, links) {
|
|
|
179
188
|
for (const [k, v] of Object.entries(ir.groups[key] ?? {}))
|
|
180
189
|
mergeInto(shared[key], k, v.map((id) => prefix(m, id)));
|
|
181
190
|
}
|
|
182
|
-
for (const key of
|
|
191
|
+
for (const key of SCOPED_GROUPS) {
|
|
183
192
|
for (const [k, v] of Object.entries(ir.groups[key] ?? {}))
|
|
184
193
|
mergeInto(scoped[key], prefix(m, k), v.map((id) => prefix(m, id)));
|
|
185
194
|
}
|
|
195
|
+
for (const d of ir.dangling ?? [])
|
|
196
|
+
dangling.push({ ...d, from: prefix(m, d.from), member: m });
|
|
186
197
|
for (const e of ir.exports ?? [])
|
|
187
198
|
exports.push({ ...e, ...(e.node ? { node: prefix(m, e.node) } : {}), member: m });
|
|
188
199
|
for (const i of ir.imports ?? [])
|
|
@@ -211,7 +222,7 @@ export function composeWorkspaceGraph(workspace, inputs, links) {
|
|
|
211
222
|
for (const key of ["byLexicon", "byComposite"])
|
|
212
223
|
if (Object.keys(shared[key]).length)
|
|
213
224
|
groups[key] = sorted(shared[key]);
|
|
214
|
-
for (const key of
|
|
225
|
+
for (const key of SCOPED_GROUPS)
|
|
215
226
|
if (Object.keys(scoped[key]).length)
|
|
216
227
|
groups[key] = sorted(scoped[key]);
|
|
217
228
|
const doc = {
|
|
@@ -229,6 +240,8 @@ export function composeWorkspaceGraph(workspace, inputs, links) {
|
|
|
229
240
|
collectors,
|
|
230
241
|
records: [],
|
|
231
242
|
};
|
|
243
|
+
if (dangling.length)
|
|
244
|
+
doc.dangling = dangling.sort((a, b) => danglingKey(a).localeCompare(danglingKey(b)));
|
|
232
245
|
if (Object.keys(derivedAttrs).length) {
|
|
233
246
|
doc.derivedAttrs = Object.fromEntries(Object.keys(derivedAttrs).sort().map((k) => [k, [...derivedAttrs[k]].sort()]));
|
|
234
247
|
}
|
|
@@ -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)
|
|
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
|
|
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
|
|
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
|
|
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`)
|
|
294
|
-
* A copy of point-answer.schema.json from before them
|
|
295
|
-
* retraction, a relay
|
|
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
|
|
1
|
+
{"version":3,"file":"decide.d.ts","sourceRoot":"","sources":["../../src/workspace/decide.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmDG;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,sHAAsH;AACtH,eAAO,MAAM,6BAA6B,IAAI,CAAC;AAC/C,eAAO,MAAM,sBAAsB,0FAA0F,CAAC;AAE9H,iIAAiI;AACjI,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,M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EAAE,MAAM,CAAC;IACd,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,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"}
|
package/dist/workspace/decide.js
CHANGED
|
@@ -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)
|
|
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
|
|
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
|
|
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 `
|
|
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
|
-
|
|
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
|
-
|
|
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`)
|
|
494
|
-
* A copy of point-answer.schema.json from before them
|
|
495
|
-
* retraction, a relay
|
|
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
|
+
}
|