@intentius/chant 0.84.0 → 0.86.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (152) hide show
  1. package/dist/cli/main.d.ts.map +1 -1
  2. package/dist/cli/mcp/resource-handlers.d.ts +2 -1
  3. package/dist/cli/mcp/resource-handlers.d.ts.map +1 -1
  4. package/dist/cli/mcp/server.d.ts +1 -0
  5. package/dist/cli/mcp/server.d.ts.map +1 -1
  6. package/dist/cli/mcp/tools/composites.d.ts +44 -0
  7. package/dist/cli/mcp/tools/composites.d.ts.map +1 -0
  8. package/dist/cli/mcp/tools/search.d.ts.map +1 -1
  9. package/dist/cli/registry.d.ts +13 -1
  10. package/dist/cli/registry.d.ts.map +1 -1
  11. package/dist/components/cli-support.d.ts +4 -0
  12. package/dist/components/cli-support.d.ts.map +1 -1
  13. package/dist/composite.d.ts +6 -0
  14. package/dist/composite.d.ts.map +1 -1
  15. package/dist/lexicon.d.ts +44 -0
  16. package/dist/lexicon.d.ts.map +1 -1
  17. package/dist/lifecycle/gate-ledger.d.ts +13 -0
  18. package/dist/lifecycle/gate-ledger.d.ts.map +1 -1
  19. package/dist/workspace/__fixtures__/contract-repo.d.ts +7 -0
  20. package/dist/workspace/__fixtures__/contract-repo.d.ts.map +1 -1
  21. package/dist/workspace/__fixtures__/sessions.d.ts +23 -0
  22. package/dist/workspace/__fixtures__/sessions.d.ts.map +1 -0
  23. package/dist/workspace/checks/records.d.ts +1 -0
  24. package/dist/workspace/checks/records.d.ts.map +1 -1
  25. package/dist/workspace/checks.d.ts +4 -0
  26. package/dist/workspace/checks.d.ts.map +1 -1
  27. package/dist/workspace/composites.d.ts +152 -0
  28. package/dist/workspace/composites.d.ts.map +1 -0
  29. package/dist/workspace/conformance/index.d.ts +211 -0
  30. package/dist/workspace/conformance/index.d.ts.map +1 -0
  31. package/dist/workspace/conformance/vitest.d.ts +11 -0
  32. package/dist/workspace/conformance/vitest.d.ts.map +1 -0
  33. package/dist/workspace/declaration.d.ts +28 -0
  34. package/dist/workspace/declaration.d.ts.map +1 -1
  35. package/dist/workspace/declaration.schema.json +40 -0
  36. package/dist/workspace/declared-kinds.d.ts +43 -0
  37. package/dist/workspace/declared-kinds.d.ts.map +1 -0
  38. package/dist/workspace/graph-cli.d.ts +24 -2
  39. package/dist/workspace/graph-cli.d.ts.map +1 -1
  40. package/dist/workspace/intent-cli.d.ts +6 -1
  41. package/dist/workspace/intent-cli.d.ts.map +1 -1
  42. package/dist/workspace/intent-joins.d.ts +74 -9
  43. package/dist/workspace/intent-joins.d.ts.map +1 -1
  44. package/dist/workspace/intent.d.ts +90 -6
  45. package/dist/workspace/intent.d.ts.map +1 -1
  46. package/dist/workspace/ls.d.ts +31 -1
  47. package/dist/workspace/ls.d.ts.map +1 -1
  48. package/dist/workspace/member-commands.d.ts +7 -2
  49. package/dist/workspace/member-commands.d.ts.map +1 -1
  50. package/dist/workspace/reason-codes.d.ts +52 -2
  51. package/dist/workspace/reason-codes.d.ts.map +1 -1
  52. package/dist/workspace/record-sessions.d.ts +51 -0
  53. package/dist/workspace/record-sessions.d.ts.map +1 -0
  54. package/dist/workspace/record-source.d.ts +2 -0
  55. package/dist/workspace/record-source.d.ts.map +1 -1
  56. package/dist/workspace/records-cli.d.ts +65 -4
  57. package/dist/workspace/records-cli.d.ts.map +1 -1
  58. package/dist/workspace/records-since.d.ts +90 -0
  59. package/dist/workspace/records-since.d.ts.map +1 -0
  60. package/dist/workspace/records-write.d.ts +164 -0
  61. package/dist/workspace/records-write.d.ts.map +1 -0
  62. package/dist/workspace/records.d.ts +202 -15
  63. package/dist/workspace/records.d.ts.map +1 -1
  64. package/dist/workspace/runtimes.d.ts +60 -0
  65. package/dist/workspace/runtimes.d.ts.map +1 -0
  66. package/dist/workspace/status-gates.d.ts +90 -0
  67. package/dist/workspace/status-gates.d.ts.map +1 -0
  68. package/dist/workspace/status.d.ts +17 -0
  69. package/dist/workspace/status.d.ts.map +1 -1
  70. package/dist/workspace/work.d.ts +56 -0
  71. package/dist/workspace/work.d.ts.map +1 -0
  72. package/package.json +19 -1
  73. package/src/cli/handlers/graph.ts +4 -0
  74. package/src/cli/main.test.ts +9 -0
  75. package/src/cli/main.ts +56 -3
  76. package/src/cli/mcp/resource-handlers.ts +17 -0
  77. package/src/cli/mcp/server.test.ts +140 -4
  78. package/src/cli/mcp/server.ts +5 -1
  79. package/src/cli/mcp/tools/composites.ts +98 -0
  80. package/src/cli/mcp/tools/search.ts +47 -5
  81. package/src/cli/registry.ts +13 -1
  82. package/src/components/cli-support.test.ts +16 -0
  83. package/src/components/cli-support.ts +8 -2
  84. package/src/composite.ts +9 -0
  85. package/src/lexicon.ts +47 -0
  86. package/src/lifecycle/gate-ledger.ts +14 -0
  87. package/src/workspace/__fixtures__/contract-repo.ts +17 -0
  88. package/src/workspace/__fixtures__/sessions.ts +66 -0
  89. package/src/workspace/checks/records.ts +19 -0
  90. package/src/workspace/checks.test.ts +2 -0
  91. package/src/workspace/checks.ts +7 -1
  92. package/src/workspace/composites.schema.json +533 -0
  93. package/src/workspace/composites.test.ts +334 -0
  94. package/src/workspace/composites.ts +316 -0
  95. package/src/workspace/conformance/__fixture__/app/package.json +7 -0
  96. package/src/workspace/conformance/__fixture__/app/src/server.mjs +29 -0
  97. package/src/workspace/conformance/__fixture__/decisions/decision.kind.mjs +32 -0
  98. package/src/workspace/conformance/__fixture__/decisions/decision.schema.json +364 -0
  99. package/src/workspace/conformance/__fixture__/decisions/fix-001-how-the-app-is-deployed.md +40 -0
  100. package/src/workspace/conformance/__fixture__/delivery/chant.config.ts +7 -0
  101. package/src/workspace/conformance/__fixture__/delivery/lexicon/index.ts +26 -0
  102. package/src/workspace/conformance/__fixture__/delivery/package.json +7 -0
  103. package/src/workspace/conformance/__fixture__/delivery/src/app.component.ts +14 -0
  104. package/src/workspace/conformance/__fixture__/delivery/src/app.ts +4 -0
  105. package/src/workspace/conformance/conformance.test.ts +149 -0
  106. package/src/workspace/conformance/index.mjs +31 -0
  107. package/src/workspace/conformance/index.ts +453 -0
  108. package/src/workspace/conformance/vitest.ts +62 -0
  109. package/src/workspace/declaration.schema.json +40 -0
  110. package/src/workspace/declaration.ts +62 -0
  111. package/src/workspace/declared-kinds.test.ts +321 -0
  112. package/src/workspace/declared-kinds.ts +76 -0
  113. package/src/workspace/graph-cli.ts +40 -4
  114. package/src/workspace/intent-cli.ts +54 -7
  115. package/src/workspace/intent-joins.test.ts +60 -0
  116. package/src/workspace/intent-joins.ts +117 -20
  117. package/src/workspace/intent.schema.json +357 -19
  118. package/src/workspace/intent.test.ts +235 -20
  119. package/src/workspace/intent.ts +396 -51
  120. package/src/workspace/ls.schema.json +34 -0
  121. package/src/workspace/ls.ts +69 -4
  122. package/src/workspace/member-commands.ts +11 -5
  123. package/src/workspace/read-contract.test.ts +52 -3
  124. package/src/workspace/reason-codes.test.ts +48 -4
  125. package/src/workspace/reason-codes.ts +67 -2
  126. package/src/workspace/record-assets.test.ts +3 -1
  127. package/src/workspace/record-sessions.ts +105 -0
  128. package/src/workspace/record-source.ts +14 -5
  129. package/src/workspace/records-amend.schema.json +167 -0
  130. package/src/workspace/records-cli.ts +246 -19
  131. package/src/workspace/records-contract.test.ts +77 -2
  132. package/src/workspace/records-formats.test.ts +640 -0
  133. package/src/workspace/records-new.schema.json +158 -0
  134. package/src/workspace/records-quorum.test.ts +196 -0
  135. package/src/workspace/records-review.schema.json +202 -0
  136. package/src/workspace/records-sessions.test.ts +108 -0
  137. package/src/workspace/records-since.schema.json +193 -0
  138. package/src/workspace/records-since.test.ts +174 -0
  139. package/src/workspace/records-since.ts +259 -0
  140. package/src/workspace/records-write-contract.test.ts +125 -0
  141. package/src/workspace/records-write.test.ts +373 -0
  142. package/src/workspace/records-write.ts +736 -0
  143. package/src/workspace/records.schema.json +187 -9
  144. package/src/workspace/records.test.ts +93 -0
  145. package/src/workspace/records.ts +683 -49
  146. package/src/workspace/runtimes.ts +107 -0
  147. package/src/workspace/status-contract.test.ts +163 -0
  148. package/src/workspace/status-gates.ts +215 -0
  149. package/src/workspace/status.schema.json +69 -3
  150. package/src/workspace/status.ts +35 -2
  151. package/src/workspace/work.test.ts +388 -0
  152. package/src/workspace/work.ts +163 -0
@@ -3,9 +3,11 @@
3
3
  *
4
4
  * A record kind is data. It says where its records live, which JSON Schema
5
5
  * they follow and which of their states are closed. This module reads every
6
- * record a kind locates, parses its front matter as the JSON subset of YAML,
6
+ * record a kind locates, parses its structured core (the front matter, as the
7
+ * JSON subset of YAML, or the whole file as one I-JSON object, ws-053),
7
8
  * validates it against the kind's schema and derives supersession from the
8
- * records' own `supersedes` links. It never writes a record.
9
+ * records' own `supersedes` links. It never writes a record; `records-write.ts`
10
+ * does, through the rules here (#2670).
9
11
  *
10
12
  * A record that fails any of that is still returned, with reason codes, and the
11
13
  * read succeeds. Only a failure to read the kind, its schema or the revision is
@@ -17,22 +19,31 @@
17
19
  */
18
20
  import { z } from "zod";
19
21
  import { type AssetPin } from "./record-assets.js";
22
+ import { type SessionCitation } from "./record-sessions.js";
20
23
  import type { RecordSource } from "./record-source.js";
21
24
  import type { WorkspaceTree } from "./tree.js";
25
+ import type { DecisionWork, WorkLink, WorkWarningCode } from "./work.js";
22
26
  /**
23
27
  * Why one record is not valid. The list is closed: a reader may switch on it,
24
28
  * and a new code is a contract change (#2536).
25
29
  */
26
- export declare const RECORD_REASON_CODES: readonly ["record-unparseable", "record-schema-invalid", "record-id-duplicate", "record-supersedes-unknown", "record-supersedes-conflict"];
30
+ export declare const RECORD_REASON_CODES: readonly ["record-unparseable", "record-schema-invalid", "record-id-duplicate", "record-supersedes-unknown", "record-supersedes-conflict", "session-seal-mismatch", "session-verdict-unknown-record"];
27
31
  export type RecordReasonCode = (typeof RECORD_REASON_CODES)[number];
28
32
  /**
29
33
  * Why a record carries a warning. Closed, like the reason codes. A warning
30
34
  * never makes a record invalid, and `--current` still lists the record.
31
35
  */
32
- export declare const RECORD_WARNING_CODES: readonly ["asset-drift", "asset-missing", "asset-stale", "record-supersedes-pending"];
36
+ export declare const RECORD_WARNING_CODES: readonly ["asset-drift", "asset-missing", "asset-stale", "record-supersedes-pending", "record-no-evidence", "review-undigested"];
33
37
  export type RecordWarningCode = (typeof RECORD_WARNING_CODES)[number];
38
+ /**
39
+ * Why a verdict does not count toward a record's quorum (#2671). Closed, like
40
+ * the reason codes. A verdict with none of these counts.
41
+ */
42
+ export declare const REVIEW_REASON_CODES: readonly ["review-decider", "review-agent", "review-duplicate", "review-older-digest", "review-unattested"];
43
+ export type ReviewReasonCode = (typeof REVIEW_REASON_CODES)[number];
34
44
  export interface RecordWarning {
35
- code: RecordWarningCode;
45
+ /** A work kind's records also carry the codes of `WORK_WARNING_CODES` (#2683). */
46
+ code: RecordWarningCode | WorkWarningCode;
36
47
  message: string;
37
48
  }
38
49
  /**
@@ -45,6 +56,9 @@ export declare class RecordReadError extends Error {
45
56
  readonly code: ReadErrorCode;
46
57
  constructor(code: ReadErrorCode, message: string);
47
58
  }
59
+ /** The formats a kind file may name. Closed. */
60
+ export declare const RECORD_FORMATS: readonly ["markdown-front-matter", "json"];
61
+ export type RecordFormat = (typeof RECORD_FORMATS)[number];
48
62
  /** The data a kind file exports as `recordKind`. */
49
63
  export declare const recordKindSchema: z.ZodObject<{
50
64
  name: z.ZodString;
@@ -52,19 +66,27 @@ export declare const recordKindSchema: z.ZodObject<{
52
66
  dir: z.ZodString;
53
67
  match: z.ZodString;
54
68
  }, z.core.$strict>;
55
- format: z.ZodLiteral<"markdown-front-matter">;
69
+ format: z.ZodEnum<{
70
+ json: "json";
71
+ "markdown-front-matter": "markdown-front-matter";
72
+ }>;
56
73
  schema: z.ZodObject<{
57
74
  id: z.ZodString;
58
75
  path: z.ZodString;
76
+ refs: z.ZodOptional<z.ZodArray<z.ZodObject<{
77
+ id: z.ZodString;
78
+ path: z.ZodString;
79
+ }, z.core.$strict>>>;
59
80
  }, z.core.$strict>;
60
- idField: z.ZodString;
61
- stateField: z.ZodString;
62
- states: z.ZodArray<z.ZodString>;
63
- closedStates: z.ZodArray<z.ZodString>;
64
- supersedes: z.ZodObject<{
81
+ idField: z.ZodOptional<z.ZodString>;
82
+ idFrom: z.ZodOptional<z.ZodLiteral<"sha256">>;
83
+ stateField: z.ZodOptional<z.ZodString>;
84
+ states: z.ZodOptional<z.ZodArray<z.ZodString>>;
85
+ closedStates: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ supersedes: z.ZodOptional<z.ZodObject<{
65
87
  field: z.ZodString;
66
- key: z.ZodString;
67
- }, z.core.$strict>;
88
+ key: z.ZodOptional<z.ZodString>;
89
+ }, z.core.$strict>>;
68
90
  approval: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
69
91
  pins: z.ZodOptional<z.ZodObject<{
70
92
  field: z.ZodString;
@@ -72,6 +94,25 @@ export declare const recordKindSchema: z.ZodObject<{
72
94
  constrains: z.ZodOptional<z.ZodObject<{
73
95
  field: z.ZodString;
74
96
  }, z.core.$strict>>;
97
+ reviews: z.ZodOptional<z.ZodObject<{
98
+ field: z.ZodString;
99
+ decider: z.ZodString;
100
+ }, z.core.$strict>>;
101
+ session: z.ZodOptional<z.ZodObject<{
102
+ verdicts: z.ZodString;
103
+ seal: z.ZodString;
104
+ subjects: z.ZodObject<{
105
+ kind: z.ZodString;
106
+ }, z.core.$strict>;
107
+ }, z.core.$strict>>;
108
+ work: z.ZodOptional<z.ZodObject<{
109
+ needs: z.ZodString;
110
+ implements: z.ZodString;
111
+ decisions: z.ZodString;
112
+ open: z.ZodString;
113
+ done: z.ZodString;
114
+ closedOn: z.ZodString;
115
+ }, z.core.$strict>>;
75
116
  }, z.core.$strict>;
76
117
  export type RecordKind = z.infer<typeof recordKindSchema>;
77
118
  /** A kind as loaded: its data, where it came from, and its schema. */
@@ -82,6 +123,8 @@ export interface LoadedRecordKind {
82
123
  /** Absolute path of the records directory in the working tree. */
83
124
  dir: string;
84
125
  schema: Record<string, unknown>;
126
+ /** The schema files `schema.refs` names, in order (ws-053). Empty without it. */
127
+ refs: Record<string, unknown>[];
85
128
  }
86
129
  /**
87
130
  * Import the kind file at `path` through the path loader lexicons use (#2520).
@@ -104,6 +147,113 @@ export type FrontMatter = {
104
147
  * cannot hold, are refused, so the same text always reads as the same JSON.
105
148
  */
106
149
  export declare function parseFrontMatter(text: string): FrontMatter;
150
+ /**
151
+ * A JSON record: the whole file is one object, read as I-JSON (RFC 7493)
152
+ * requires on the two points JSON.parse lets through (ws-053). A top-level
153
+ * value other than an object is refused, and so is a member name that repeats
154
+ * within one object, at any depth, which JSON.parse accepts by keeping the
155
+ * last value. Names compare after their escapes are decoded, so `"a"` and
156
+ * `"\u0061"` are the same name. A number too large for a double is refused as
157
+ * front matter's is.
158
+ */
159
+ export declare function parseJsonRecord(text: string): FrontMatter;
160
+ /** A record's structured core, parsed as the kind's format says. */
161
+ export declare function parseRecord(format: RecordFormat, text: string): FrontMatter;
162
+ /**
163
+ * The digest a review verdict names: the lowercase hex SHA-256 of the record
164
+ * file's text with its reviews block taken out of the front matter (#2672), or
165
+ * for a JSON record its reviews member taken out of the object (ws-053).
166
+ * Adding, changing or removing a verdict leaves it as it was; any other edit
167
+ * to the file changes it, so a verdict given before an amendment stops
168
+ * counting.
169
+ *
170
+ * The rule, which a hand-editor can follow with a text editor and
171
+ * `sha256sum`:
172
+ *
173
+ * 1. Line endings become LF (CRLF and a lone CR each become one LF).
174
+ * 2. When the text starts with a `---` line and a later line is exactly
175
+ * `---`, the lines between them are the front matter. In it, the line
176
+ * that starts, at column 0, with the key `field` (bare, or in single or
177
+ * double quotes), optional spaces or tabs and a `:`, is removed, and so
178
+ * is every line after it, up to the closing `---`, that is empty or
179
+ * starts with a space, a tab, `#` or `-`. Removal stops at the first
180
+ * other line. Everything else, the `---` lines and the body included, is
181
+ * kept byte for byte.
182
+ * 3. The digest is the SHA-256 of the result's UTF-8 bytes.
183
+ *
184
+ * Text with no front matter, or no such key, is hashed after step 1 alone.
185
+ * A writer that adds a verdict must change only the reviews block: a
186
+ * reformatted front matter is a new digest, and every earlier verdict stops
187
+ * counting.
188
+ */
189
+ export declare function recordTextDigest(text: string, field?: string | null, format?: RecordFormat): string;
190
+ /** The quorum a workspace sets when its declaration names none: two verdicts besides the decider's (#2555). */
191
+ export declare const DEFAULT_QUORUM = 2;
192
+ /** A principal as the quorum compares it: NFKC, trimmed and lower-cased, so `alice` and `Alice ` are one reviewer (#2671). */
193
+ export declare function normalisePrincipal(name: string): string;
194
+ /** One verdict as the quorum reads it. */
195
+ export interface QuorumVerdict {
196
+ /** The entry's position in the record's reviews list, from 0. */
197
+ index: number;
198
+ /** The reviewer, normalised. */
199
+ principal: string;
200
+ /** The reviewer as written. */
201
+ reviewer: string;
202
+ verdict: "agree" | "dissent" | "abstain";
203
+ /** The digest the verdict names, or null when it names none. */
204
+ digest: string | null;
205
+ /** Why it does not count. Absent on a counted verdict. */
206
+ reason?: {
207
+ code: ReviewReasonCode;
208
+ message: string;
209
+ };
210
+ }
211
+ /** A dissent that is neither addressed nor withdrawn. */
212
+ export interface OpenConcern {
213
+ index: number;
214
+ principal: string;
215
+ reviewer: string;
216
+ note: string | null;
217
+ /** The proposed decision the dissent opened, when it names one. */
218
+ proposes?: string;
219
+ }
220
+ export interface Quorum {
221
+ /** How many counted agree verdicts, besides the decider's, the record needs. */
222
+ need: number;
223
+ /** Whether `need` comes from the workspace declaration or is the default. */
224
+ needFrom: "declaration" | "default";
225
+ /** Counted verdicts that agree. */
226
+ agreed: number;
227
+ /** Verdicts that count: one per principal, the latest, after the exclusions. */
228
+ counted: QuorumVerdict[];
229
+ /** Verdicts that don't, each with its reason. */
230
+ notCounted: QuorumVerdict[];
231
+ openConcerns: OpenConcern[];
232
+ /** `agreed` reaches `need`. */
233
+ met: boolean;
234
+ /** `met`, with at least one open concern. A met quorum with an open concern is never consensus (RFC 7282). */
235
+ metWithObjections: boolean;
236
+ }
237
+ export interface QuorumOptions {
238
+ need: number;
239
+ needFrom: "declaration" | "default";
240
+ /** Normalised principals that hold the agent role. */
241
+ agents: ReadonlySet<string>;
242
+ /** Whether an attestation policy is active, so a verdict needs a seal to count. */
243
+ attestation: boolean;
244
+ }
245
+ /**
246
+ * The quorum of one record, read from its reviews list, or null when the
247
+ * kind has no reviews list or the front matter could not be read (#2671).
248
+ * Malformed entries are skipped; the schema reports them.
249
+ *
250
+ * A verdict is not counted when its reviewer is the decider, holds the agent
251
+ * role, names a digest other than the record's own now, or carries no seal
252
+ * under an active attestation policy, in that order. Of the rest, the latest
253
+ * verdict per principal counts and each earlier one is a duplicate. No
254
+ * verdict carries a seal yet (#2546), so under an active policy none counts.
255
+ */
256
+ export declare function computeQuorum(kind: RecordKind, entry: Pick<RecordEntry, "data" | "digest">, options: QuorumOptions): Quorum | null;
107
257
  export interface RecordReason {
108
258
  code: RecordReasonCode;
109
259
  message: string;
@@ -119,12 +269,26 @@ export interface RecordEntry {
119
269
  reasons: RecordReason[];
120
270
  /** The id of the closed record whose `supersedes` link replaces this one, or null. */
121
271
  supersededBy: string | null;
122
- /** The front matter as JSON, or null when it could not be parsed. */
272
+ /** The record's structured core as JSON (the front matter, or the whole JSON file), or null when it could not be parsed. */
123
273
  data: Record<string, unknown> | null;
124
- /** Each workspace file the record pins, checked against the tree read (#2549). Empty when nothing was checked. */
274
+ /**
275
+ * Each workspace file the record pins, checked against the tree read
276
+ * (#2549). Empty when nothing was checked. A content-addressed record whose
277
+ * name claims a hash other than its bytes' lists itself, drifted (ws-053).
278
+ */
125
279
  assets: AssetPin[];
126
280
  /** Findings that leave the record valid, such as a pinned file that changed (#2549). */
127
281
  warnings: RecordWarning[];
282
+ /** {@link recordTextDigest} of the file's text, without the kind's reviews list when it has one (#2672). */
283
+ digest: string;
284
+ /** For a session kind only: the subject records' review entries that name this session (#2673). */
285
+ citedBy?: SessionCitation[];
286
+ /** For a work kind (#2683): the record's state is its kind's open state and every need is done. */
287
+ ready?: boolean;
288
+ /** For a work kind: each need that is not done, with its state, or null when no record has the id. */
289
+ blockedBy?: WorkLink[];
290
+ /** For a work kind: each decision the record implements, with its state, or null when no decision has the id. */
291
+ implements?: WorkLink[];
128
292
  }
129
293
  export interface ReadRecordsOptions {
130
294
  /** Where record paths are reported from, and what `source` reads relative to. */
@@ -143,6 +307,21 @@ export interface ReadRecordsOptions {
143
307
  * compared.
144
308
  */
145
309
  history?: RecordHistory;
310
+ /**
311
+ * For a session kind: the records its `session.subjects.kind` locates, read
312
+ * from the same tree (#2673). Without them no verdict is checked and no
313
+ * session is cited.
314
+ */
315
+ subjects?: {
316
+ records: RecordEntry[];
317
+ reviews: string;
318
+ };
319
+ /**
320
+ * The workspace root, from `root` with / separators ("." for `root`
321
+ * itself): where a content-addressed record's own path is reported from
322
+ * when it lists itself in `assets` (ws-053). Defaults to ".".
323
+ */
324
+ workspaceRoot?: string;
146
325
  }
147
326
  /** Commit times, in seconds since the epoch, read from git. */
148
327
  export interface RecordHistory {
@@ -159,7 +338,15 @@ export interface ReadRecordsResult {
159
338
  invalid: number;
160
339
  superseded: number;
161
340
  };
341
+ /** For a work kind (#2683): every decision its decision kind reads, with the work records implementing it. */
342
+ decisions?: DecisionWork[];
162
343
  }
344
+ /**
345
+ * The ids a record's supersedes field names (ws-053). With the kind's `key`,
346
+ * the field is a list of objects and each one's `key` holds an id; without
347
+ * it, the field holds one id or a list of ids. Anything else names none.
348
+ */
349
+ export declare function supersedesTargets(kind: Pick<RecordKind, "supersedes">, data: Record<string, unknown> | null): string[];
163
350
  /** Read every record `loaded` locates, through `options.source`. */
164
351
  export declare function readRecords(loaded: LoadedRecordKind, options: ReadRecordsOptions): Promise<ReadRecordsResult>;
165
352
  //# sourceMappingURL=records.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"records.d.ts","sourceRoot":"","sources":["../../src/workspace/records.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAyB,KAAK,QAAQ,EAAE,MAA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AAQ,CAAC,EAAE;QAAE,OAAO,EAAE,WAAW,EAAE,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC;IACvD;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,+DAA+D;AAC/D,MAAM,WAAW,aAAa;IAC5B,2FAA2F;IAC3F,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IACzC,+GAA+G;IAC/G,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;CACvC;AAED,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IAC/E,8GAA8G;IAC9G,SAAS,CAAC,EAAE,YAAY,EAAE,CAAC;CAC5B;AA0DD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,YAAY,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,GAAG,MAAM,EAAE,CAQtH;AAWD,oEAAoE;AACpE,wBAAsB,WAAW,CAAC,MAAM,EAAE,gBAAgB,EAAE,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAyKnH"}
@@ -0,0 +1,60 @@
1
+ /**
2
+ * The runtimes a member's components can deploy on, for `chant workspace
3
+ * graph --composites` (#2674): the built-in `local` runtime, and every lexicon
4
+ * the member's `chant.config.ts` configures whose `opRuntime` hosts
5
+ * `chant run --components`. That is the list `chant run --components <name>
6
+ * --on <runtime>` accepts in the member's directory (`../cli/handlers/run.ts`),
7
+ * so a reader such as hud offers these and never guesses a runtime.
8
+ *
9
+ * `local` is the default. A configured default (`run.on`) is read once the
10
+ * config type has one; until then the command without `--on` runs locally.
11
+ *
12
+ * The config is read the way `chant run` reads it, from the member's
13
+ * directory, in the working tree or in the tree `--at` exported. Reading it
14
+ * runs the member's `chant.config.ts` and imports the lexicons it lists.
15
+ */
16
+ /** The runtime core provides, which `chant run` uses without `--on`. */
17
+ export declare const LOCAL_RUNTIME = "local";
18
+ /** Why a member's runtimes list only part of what its config names. Closed: part of the read contract. */
19
+ export declare const RUNTIME_REASON_CODES: readonly ["runtimes-config-unreadable", "runtimes-lexicon-unreadable"];
20
+ export type RuntimeReasonCode = (typeof RUNTIME_REASON_CODES)[number];
21
+ export interface RuntimeReason {
22
+ code: RuntimeReasonCode;
23
+ message: string;
24
+ }
25
+ /** One runtime a component can deploy on. */
26
+ export interface ComponentRuntime {
27
+ /** What `--on` takes: the lexicon's name, or `local`. */
28
+ name: string;
29
+ /** The lexicon that hosts it, or null for `local`. */
30
+ lexicon: string | null;
31
+ /** True for the runtime `chant run --components` uses without `--on`. */
32
+ default: boolean;
33
+ /** The command that deploys the component on it, run in the member's directory. */
34
+ command: string;
35
+ }
36
+ /** What one member's config says about runtimes. */
37
+ export interface MemberRuntimes {
38
+ /** Configured lexicons whose `opRuntime` hosts component runs, in config order. */
39
+ lexicons: string[];
40
+ /** The default runtime's name. */
41
+ default: string;
42
+ reasons: RuntimeReason[];
43
+ }
44
+ /** Loads a lexicon plugin by name; `loadPlugin` from the CLI unless a test swaps it. */
45
+ export type PluginLoader = (name: string) => Promise<{
46
+ opRuntime?: {
47
+ runComponents?: unknown;
48
+ };
49
+ }>;
50
+ /** Read the runtimes a member's config offers. `dir` is the member's directory on disk. */
51
+ export declare function readMemberRuntimes(dir: string, load?: PluginLoader): Promise<MemberRuntimes>;
52
+ /** The runtimes one component can deploy on, `local` first, each with its command line. */
53
+ export declare function componentRuntimes(component: string, member: MemberRuntimes | undefined): ComponentRuntime[];
54
+ /** Read the runtimes of each member of kind chant, from the tree at `root`. */
55
+ export declare function readRuntimesIn(root: string, members: readonly {
56
+ name: string;
57
+ dir: string;
58
+ kind: string;
59
+ }[], load?: PluginLoader): Promise<Map<string, MemberRuntimes>>;
60
+ //# sourceMappingURL=runtimes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runtimes.d.ts","sourceRoot":"","sources":["../../src/workspace/runtimes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,wEAAwE;AACxE,eAAO,MAAM,aAAa,UAAU,CAAC;AAErC,0GAA0G;AAC1G,eAAO,MAAM,oBAAoB,wEAKS,CAAC;AAC3C,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,6CAA6C;AAC7C,MAAM,WAAW,gBAAgB;IAC/B,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,sDAAsD;IACtD,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,yEAAyE;IACzE,OAAO,EAAE,OAAO,CAAC;IACjB,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,oDAAoD;AACpD,MAAM,WAAW,cAAc;IAC7B,mFAAmF;IACnF,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,aAAa,EAAE,CAAC;CAC1B;AAED,wFAAwF;AACxF,MAAM,MAAM,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,SAAS,CAAC,EAAE;QAAE,aAAa,CAAC,EAAE,OAAO,CAAA;KAAE,CAAA;CAAE,CAAC,CAAC;AAIlG,2FAA2F;AAC3F,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,cAAc,CAAC,CAoBlG;AAED,2FAA2F;AAC3F,wBAAgB,iBAAiB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,SAAS,GAAG,gBAAgB,EAAE,CAS3G;AAED,+EAA+E;AAC/E,wBAAsB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC,CAO7K"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Gate state for `chant workspace status --json` (#2674): each member's gates
3
+ * as its gate ledger on `chant/lifecycle` records them, so a reader such as
4
+ * hud never runs `git show` on the branch itself.
5
+ *
6
+ * A member's gate ledger is the `_gates/` directory under its ledger prefix:
7
+ * `_members/<member>/_gates/<component>.jsonl` for a member that writes the
8
+ * member layout (#2538), and the flat `_gates/<component>.jsonl` otherwise,
9
+ * chosen the same way as its release ledger. Each file is keyed by the
10
+ * component, or by the op for a gate an Op run reached, and holds both the
11
+ * pending facts a run records and the approvals `chant approve` records
12
+ * (`../lifecycle/gate-ledger.ts`).
13
+ *
14
+ * A gate's state is decided the way a run decides it (`evaluateGate` in
15
+ * `../op/gate.ts`), without writing anything: the newest pending fact for the
16
+ * gate in its environment is the anchor, only approvals recorded since it and
17
+ * for its plan count, and a gate with an `approval` block counts them with
18
+ * `tallyGateApprovals`, as `describeApprovalProgress` does after an approve.
19
+ */
20
+ /** Why a member's gates can't be listed. Closed: a new code is a contract change. */
21
+ export declare const GATE_REASON_CODES: readonly ["gates-no-ledger", "gates-no-gate-ledger", "gates-ledger-unreadable"];
22
+ export type GateReasonCode = (typeof GATE_REASON_CODES)[number];
23
+ export type GateState = "pending" | "approved" | "expired" | "superseded";
24
+ export interface StatusGateApproval {
25
+ /** Who recorded it: `chant approve --approver`, or the CI or shell identity. */
26
+ principal: string;
27
+ /** The channel it was recorded on (`cli`, `mcp`, `acp`), or null for a record older than chant#2384. */
28
+ channel: string | null;
29
+ at: string;
30
+ }
31
+ export interface StatusGate {
32
+ /** The ledger file's key: the component, or the op for a gate an Op run reached. */
33
+ component: string;
34
+ /** The gate's name. */
35
+ name: string;
36
+ /** The environment the gate was reached in, or null for a gate that records none (an Op gate). */
37
+ env: string | null;
38
+ /** The plan the run reached the gate with, or null for a gate that binds no plan. */
39
+ planDigest: string | null;
40
+ state: GateState;
41
+ /** When the run recorded the pending fact the state is read against. */
42
+ recordedAt: string;
43
+ expiresAt: string;
44
+ /** The approvals that count toward the gate for this plan, oldest first. */
45
+ approvals: StatusGateApproval[];
46
+ /** How many human approvals the gate needs: its quorum's count, 1 without one. */
47
+ needed: number;
48
+ /** The command that approves it, run in the member's directory. */
49
+ approve: string;
50
+ }
51
+ export interface StatusGateLedger {
52
+ /** `members` for `_members/<member>/_gates`, `flat` for `_gates`. */
53
+ layout: "members" | "flat";
54
+ /** The gate ledger directory on the branch. */
55
+ path: string;
56
+ /** True when more than one member in this output reads the same flat directory. */
57
+ shared: boolean;
58
+ /** Lines that are neither a pending fact nor an approval, skipped. */
59
+ malformed: number;
60
+ reason: {
61
+ code: GateReasonCode;
62
+ message: string;
63
+ } | null;
64
+ }
65
+ /**
66
+ * Reads the gate ledger files in `dir` on the branch at `commit`: file name
67
+ * without `.jsonl` to contents. Null when the directory doesn't exist; throws
68
+ * when it can't be read.
69
+ */
70
+ export type GateLedgerReader = (dir: string, commit: string, cwd: string) => Promise<Map<string, string> | null>;
71
+ export declare const defaultGateLedgerReader: GateLedgerReader;
72
+ /** The exact `chant approve` line for a gate. */
73
+ export declare function approveCommand(component: string, gate: string, env: string | null): string;
74
+ /**
75
+ * Every gate in one ledger file, one per gate and environment, for the
76
+ * environments in `envs`. A gate whose facts record no environment (an Op
77
+ * gate) is listed whatever `envs` is. A pending fact with no environment on a
78
+ * gate whose other facts have one is left out, as a run leaves it out: such a
79
+ * line binds no environment, and `chant approve --expire` writes one.
80
+ */
81
+ export declare function gatesInLedger(component: string, content: string, envs: readonly string[], now: string): {
82
+ gates: StatusGate[];
83
+ malformed: number;
84
+ };
85
+ /** Read one member's gate ledger directory at `commit` and list its gates. */
86
+ export declare function readMemberGates(dir: string, layout: "members" | "flat", commit: string | null, envs: readonly string[], cwd: string, now: string, read?: GateLedgerReader): Promise<{
87
+ gates: StatusGate[];
88
+ ledger: StatusGateLedger;
89
+ }>;
90
+ //# sourceMappingURL=status-gates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"status-gates.d.ts","sourceRoot":"","sources":["../../src/workspace/status-gates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAQH,qFAAqF;AACrF,eAAO,MAAM,iBAAiB,iFAOY,CAAC;AAC3C,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,iBAAiB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEhE,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;AAE1E,MAAM,WAAW,kBAAkB;IACjC,gFAAgF;IAChF,SAAS,EAAE,MAAM,CAAC;IAClB,wGAAwG;IACxG,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,MAAM,WAAW,UAAU;IACzB,oFAAoF;IACpF,SAAS,EAAE,MAAM,CAAC;IAClB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,kGAAkG;IAClG,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB,qFAAqF;IACrF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,KAAK,EAAE,SAAS,CAAC;IACjB,wEAAwE;IACxE,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,CA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,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,gBAA0C,GAC/C,OAAO,CAAC;IAAE,KAAK,EAAE,UAAU,EAAE,CAAC;IAAC,MAAM,EAAE,gBAAgB,CAAA;CAAE,CAAC,CAsB5D"}
@@ -20,10 +20,16 @@
20
20
  * declaration that can't be read, or an environment name that can't be one,
21
21
  * exits 1. The `--json` output is part of the read contract and is described
22
22
  * by `status.schema.json` beside this file.
23
+ *
24
+ * The JSON also lists each member's gates, read from its gate ledger on the
25
+ * same branch (#2674, `status-gates.ts`): the state of each, the approvals
26
+ * that count, and the `chant approve` line that answers it. The text view
27
+ * doesn't show them.
23
28
  */
24
29
  import type { CommandContext } from "../cli/registry.js";
25
30
  import { type ReleaseRecord } from "../lifecycle/release-ledger.js";
26
31
  import { type ErrorLocation } from "./declaration.js";
32
+ import { type GateLedgerReader, type StatusGate, type StatusGateLedger } from "./status-gates.js";
27
33
  /** The version of the `status` output this chant writes. */
28
34
  export declare const STATUS_CONTRACT_VERSION = 1;
29
35
  /** `$id` of the JSON Schema for the `--json` output, shipped beside this file. */
@@ -38,6 +44,8 @@ export declare const MEMBERS_DIR = "_members";
38
44
  */
39
45
  export declare const STATUS_REASON_CODES: readonly ["ledger-unreadable", "ledger-malformed"];
40
46
  export type StatusReasonCode = (typeof STATUS_REASON_CODES)[number];
47
+ /** Why a member's gates can't be listed (#2674). Closed, like {@link STATUS_REASON_CODES}. */
48
+ export declare const STATUS_GATE_REASON_CODES: readonly ["gates-no-ledger", "gates-no-gate-ledger", "gates-ledger-unreadable"];
41
49
  /**
42
50
  * Why the status couldn't be read at all. The declaration's own codes, except
43
51
  * the two that only `--at` returns, and one for the environment name.
@@ -93,7 +101,12 @@ export interface StatusMember {
93
101
  environments: StatusEnvironment[];
94
102
  /** Null without `--compare-to`. */
95
103
  compare: StatusCompare | null;
104
+ /** True when no environment's release ledger has a reason. Gate reasons don't change it. */
96
105
  readable: boolean;
106
+ /** Where the member's gates were read from, and why none are listed when none can be (#2674). */
107
+ gateLedger: StatusGateLedger;
108
+ /** Each gate in the member's gate ledger, one per environment asked for, sorted by component then gate. */
109
+ gates: StatusGate[];
97
110
  }
98
111
  export type StatusDocument = {
99
112
  $schema: string;
@@ -138,6 +151,10 @@ export interface StatusQuery {
138
151
  compareTo?: string;
139
152
  /** Reads one ledger; the lifecycle reader unless a test swaps it. */
140
153
  readLedger?: LedgerReader;
154
+ /** Reads one member's gate ledger directory; git unless a test swaps it. */
155
+ readGates?: GateLedgerReader;
156
+ /** The instant a gate's expiry is measured against; now by default. */
157
+ now?: string;
141
158
  }
142
159
  export declare function compareEnvironments(a: StatusEnvironment, b: StatusEnvironment): StatusCompare;
143
160
  /** Find the workspace, read every member's ledger and build the document `--json` prints. */
@@ -1 +1 @@
1
- {"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/workspace/status.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEtD,OAAO,EAAyC,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAExG,OAAO,EAAsD,KAAK,aAAa,EAAe,MAAM,eAAe,CAAC;AAKpH,4DAA4D;AAC5D,eAAO,MAAM,uBAAuB,IAAI,CAAC;AAEzC,kFAAkF;AAClF,eAAO,MAAM,uBAAuB,8EAA8E,CAAC;AAEnH,wCAAwC;AACxC,eAAO,MAAM,aAAa,oBAAoB,CAAC;AAE/C,gFAAgF;AAChF,eAAO,MAAM,WAAW,aAAa,CAAC;AAItC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,oDAKU,CAAC;AAC3C,MAAM,MAAM,gBAAgB,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE;;;GAGG;AACH,eAAO,MAAM,kBAAkB,0NAYW,CAAC;AAC3C,MAAM,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EAAE;QAAE,IAAI,EAAE,eAAe,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,aAAa,GAAG,IAAI,CAAA;KAAE,CAAC;CACnF,CAAC;AAEN,KAAK,YAAY,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC;IAAE,OAAO,EAAE,aAAa,EAAE,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE5G,MAAM,WAAW,WAAW;IAC1B,mDAAmD;IACnD,GAAG,EAAE,MAAM,CAAC;IACZ,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qEAAqE;IACrE,UAAU,CAAC,EAAE,YAAY,CAAC;IAC1B,4EAA4E;IAC5E,SAAS,CAAC,EAAE,gBAAgB,CAAC;IAC7B,uEAAuE;IACvE,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAuFD,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,iBAAiB,EAAE,CAAC,EAAE,iBAAiB,GAAG,aAAa,CAW7F;AAED,6FAA6F;AAC7F,wBAAsB,eAAe,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAqEjF;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAuC7E;AAeD,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,cAAc,EAAE;IAAE,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,GAAG,MAAM,CAqCvF"}
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Work items on read (#2683): a record kind with a `work` block.
3
+ *
4
+ * A work item is a record in the workspace, a git-tracked file with its
5
+ * dependencies written inside it, that people and agents share as one queue
6
+ * with no server. Most work items come from a gap the intent graph already
7
+ * reports (`source.finding`), given an id, an owner and a lifecycle.
8
+ *
9
+ * `records.ts` calls {@link applyWork} after it has read a work kind's
10
+ * records, before it sets `valid` and applies `--current`. This module reads
11
+ * the decision kind the work kind names, at the same revision, and gives each
12
+ * work record:
13
+ *
14
+ * - `ready`: its state is the kind's open state, every need is done, and the
15
+ * record is valid and not superseded;
16
+ * - `blockedBy`: each need that is not done, with its state;
17
+ * - `implements`: each decision it names, with that decision's state;
18
+ *
19
+ * and each decision `implementedBy`, the work records naming it. The
20
+ * warnings are closed codes. `work-done-gap-open` is not raised here: only
21
+ * `graph --intent` walks a region, so only it can tell whether the finding a
22
+ * done item came from still fires. It never writes a record.
23
+ */
24
+ import { type LoadedRecordKind, type ReadRecordsOptions, type RecordEntry } from "./records.js";
25
+ /** Why a work record carries a warning. Closed, like the record warning codes. */
26
+ export declare const WORK_WARNING_CODES: readonly ["work-needs-unknown", "work-implements-unknown", "work-needs-cycle", "work-implements-undecided", "work-done-unpinned", "work-closed-without-date", "work-done-gap-open"];
27
+ export type WorkWarningCode = (typeof WORK_WARNING_CODES)[number];
28
+ /** A link from a work record to another record, with that record's state now. */
29
+ export interface WorkLink {
30
+ id: string;
31
+ /** The linked record's state, or null when no record has the id. */
32
+ state: string | null;
33
+ }
34
+ /** A decision as a work read lists it: its state and the work records implementing it. */
35
+ export interface DecisionWork {
36
+ id: string;
37
+ path: string;
38
+ state: string | null;
39
+ supersededBy: string | null;
40
+ implementedBy: WorkLink[];
41
+ }
42
+ /** The strings of a front-matter list, or none. */
43
+ export declare function idList(data: Record<string, unknown> | null, field: string): string[];
44
+ /**
45
+ * Whether `state` counts as decided in the decision kind: ranked above 0 by
46
+ * its approval ranks, or, for a kind without them, closed.
47
+ */
48
+ export declare function isDecided(kind: LoadedRecordKind["kind"], state: string | null): boolean;
49
+ /**
50
+ * Give each work record its links, ready and blockedBy, and its warnings, in
51
+ * place. Throws a `RecordReadError` when the decision kind can't be read.
52
+ */
53
+ export declare function applyWork(loaded: LoadedRecordKind, entries: RecordEntry[], options: ReadRecordsOptions): Promise<{
54
+ decisions: Dec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