@inventarch/runtime 1.1.1 → 2.0.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 (66) hide show
  1. package/LANGUAGE.md +2 -2
  2. package/README.md +17 -1
  3. package/SPEC.md +28 -4
  4. package/dist/context.d.ts +10 -1
  5. package/dist/context.d.ts.map +1 -1
  6. package/dist/context.js +14 -5
  7. package/dist/context.js.map +1 -1
  8. package/dist/coordinate.d.ts +9 -2
  9. package/dist/coordinate.d.ts.map +1 -1
  10. package/dist/coordinate.js +14 -0
  11. package/dist/coordinate.js.map +1 -1
  12. package/dist/door.d.ts +17 -0
  13. package/dist/door.d.ts.map +1 -1
  14. package/dist/door.js +111 -6
  15. package/dist/door.js.map +1 -1
  16. package/dist/editor/workspace.d.ts.map +1 -1
  17. package/dist/editor/workspace.js +6 -5
  18. package/dist/editor/workspace.js.map +1 -1
  19. package/dist/errors.d.ts +4 -2
  20. package/dist/errors.d.ts.map +1 -1
  21. package/dist/errors.js +13 -1
  22. package/dist/errors.js.map +1 -1
  23. package/dist/index.d.ts +14 -0
  24. package/dist/index.d.ts.map +1 -1
  25. package/dist/index.js +8 -0
  26. package/dist/index.js.map +1 -1
  27. package/dist/locator.d.ts +149 -0
  28. package/dist/locator.d.ts.map +1 -0
  29. package/dist/locator.js +572 -0
  30. package/dist/locator.js.map +1 -0
  31. package/dist/machine-protocol.d.ts +5 -0
  32. package/dist/machine-protocol.d.ts.map +1 -1
  33. package/dist/machine-protocol.js +141 -5
  34. package/dist/machine-protocol.js.map +1 -1
  35. package/dist/mandate-modes.d.ts +60 -0
  36. package/dist/mandate-modes.d.ts.map +1 -0
  37. package/dist/mandate-modes.js +112 -0
  38. package/dist/mandate-modes.js.map +1 -0
  39. package/dist/mentions.d.ts.map +1 -1
  40. package/dist/mentions.js +2 -3
  41. package/dist/mentions.js.map +1 -1
  42. package/dist/next.d.ts +151 -0
  43. package/dist/next.d.ts.map +1 -0
  44. package/dist/next.js +724 -0
  45. package/dist/next.js.map +1 -0
  46. package/dist/packet-host.d.ts +88 -0
  47. package/dist/packet-host.d.ts.map +1 -0
  48. package/dist/packet-host.js +239 -0
  49. package/dist/packet-host.js.map +1 -0
  50. package/dist/packet.d.ts +157 -0
  51. package/dist/packet.d.ts.map +1 -0
  52. package/dist/packet.js +207 -0
  53. package/dist/packet.js.map +1 -0
  54. package/dist/position.d.ts +275 -0
  55. package/dist/position.d.ts.map +1 -0
  56. package/dist/position.js +530 -0
  57. package/dist/position.js.map +1 -0
  58. package/dist/render.d.ts +12 -1
  59. package/dist/render.d.ts.map +1 -1
  60. package/dist/render.js +25 -0
  61. package/dist/render.js.map +1 -1
  62. package/dist/scope-key.d.ts +101 -0
  63. package/dist/scope-key.d.ts.map +1 -0
  64. package/dist/scope-key.js +175 -0
  65. package/dist/scope-key.js.map +1 -0
  66. package/package.json +32 -4
@@ -1,12 +1,17 @@
1
1
  /**
2
2
  * The machine protocol's one description (docs/specs/command-discoverability/README.md §2). For each Door operation:
3
3
  * its purpose, parameter schema, result, refusals with a next action, and an example that returns `ok: true` on
4
- * packages/compliance/fixtures/loop. `ia <operation> --help`, the MCP door's tools/list and
5
- * docs/reference/cli/machine-protocol.md are projections of this table. It describes the frozen wire format and changes none
6
- * of it: the Door validates every request itself, and tests/select-door.test.ts and apps/cli/tests/cli.test.ts hold this
7
- * table to what the Door admits and refuses.
4
+ * packages/compliance/fixtures/loop, or for `next`, as that fixture authors no @plan, on the delivery fixture
5
+ * packages/runtime/tests/fixtures/delivery/base laid over the conformance corpus. `ia <operation> --help` (the version
6
+ * 1 operations, which are the CLI's machine routes), the MCP door's tools/list and docs/reference/cli/machine-protocol.md
7
+ * are projections of this table. It describes the frozen wire format and changes none of it: the Door validates every
8
+ * request itself, and tests/select-door.test.ts, tests/door-read.test.ts, tests/next.test.ts,
9
+ * tests/door-position.test.ts and apps/cli/tests/cli.test.ts hold this table to what the Door admits and refuses. A
10
+ * later version only appends operations (`since`), so the version 1 rows stay byte-identical to 1.1.0's
11
+ * (tests/golden/machine-protocol-v1.json).
8
12
  */
9
13
  import { COORDINATE_DOMAINS } from './coordinate.js';
14
+ import { SCOPE_KEY_CAPS } from './scope-key.js';
10
15
  import { freeze } from './types.js';
11
16
  const text = (description) => ({ type: 'string', description });
12
17
  const strings = (description) => ({ type: 'array', items: { type: 'string' }, description });
@@ -122,13 +127,16 @@ const REQUESTED = [REQUEST_INVALID, SCOPE_UNAVAILABLE, REVISION_MISMATCH, COORDI
122
127
  const EXAMPLE_IDENTITY = 'governance-system/definition/procedure/sample-procedure';
123
128
  /** Frozen deeply, so a projection that shares its schema objects (the MCP tools) cannot change it. */
124
129
  export const MACHINE_PROTOCOL = freeze({
125
- version: 1,
130
+ version: 2,
126
131
  flow: [
127
132
  'scope issues a token that bounds later reads by phase or identities, and by root only where sources declare a reach. It is optional: without within, a call reads the initial boundary.',
128
133
  'context delivers the cited procedure cells and governance that apply to a coordinate; select chooses exactly one binding among candidates, or refuses.',
129
134
  'get, records, resolve, search and traverse read admitted records inside the scope; pass within to stay inside a narrowed one.',
130
135
  'A token lives as long as the process that issued it: one CLI invocation, or the MCP server process. A CLI invocation performs one operation, so its reads always cover the initial boundary; narrowing takes scope, then within, in one MCP session.',
131
136
  "report is privileged inspection of the whole workspace's admission, served by the CLI only.",
137
+ 'Version 2 adds read: the body behind one locator inside the scope, with its digest. The Door and the MCP door serve it; on the CLI the consumer verb ia read returns the same body and digest, and the machine routes stay the version 1 operations.',
138
+ "Version 2 also adds next: one plan's delivery view inside the scope, its tasks in prerequisite order with their verdicts, computed per call and never stored. The Door and the MCP door serve it, and on the CLI the consumer verb ia next prints the same view. Its refusals carry next, the one command to run, and the plans or the cycle they name.",
139
+ 'Version 2 also adds position: body(K), what a scope key (seat, shape, phase, depth, budget, word) loads inside the scope, with its digest and a host note beside it. The body is a pure function of the key and the admitted revision, so one key reads one body and digest wherever the workspace is, and nothing text-driven runs. The Door and the MCP door serve it, and the machine routes stay the version 1 operations. A refusal of the key carries next, the one command to run.',
132
140
  ],
133
141
  operations: [
134
142
  {
@@ -302,6 +310,134 @@ export const MACHINE_PROTOCOL = freeze({
302
310
  example: {},
303
311
  mcp: null,
304
312
  },
313
+ {
314
+ name: 'read',
315
+ summary: 'Read the body behind one locator inside the scope, with its digest.',
316
+ description: "Read the body behind one locator inside the scope: a cell's or requirement's text for a fragment, else the document the record's source locator names (the section under its markdown anchor), else the record's own body. digest is the SHA-256 of the body's UTF-8 bytes; a read certifies nothing. A locator outside the scope is refused without naming what lies outside it.",
317
+ params: object({
318
+ within: read.within,
319
+ locator: text('<identity>, <identity>#<phase>/<Primitive>, <identity>#<REQ-ID> or <path>:<line>, the path relative to the workspace root.'),
320
+ includeRuntime: {
321
+ type: 'boolean',
322
+ description: 'Read a record at runtime placement (band 0), which is refused otherwise; default false.',
323
+ },
324
+ }, ['locator']),
325
+ result: "The body: {locator, identity, kind, path?, digest, body, certified: false}. kind is record for a record's own body or a fragment's text, and document for the file its source locator names, at the workspace-relative path.",
326
+ refusals: [
327
+ REQUEST_INVALID,
328
+ SCOPE_UNAVAILABLE,
329
+ {
330
+ code: 'IA-RUNTIME-READ-UNADMITTED',
331
+ when: "No admitted record inside the scope answers the locator. In a scope narrower than the whole workspace the refusal names no path, line, identity or refused record; on the whole workspace's scope it says what the workspace's sources hold there, a record admission refused with its path, line and reason.",
332
+ next: 'Read a locator that records or search returns in this scope, or widen the scope.',
333
+ },
334
+ {
335
+ code: 'IA-RUNTIME-READ-FRAGMENT',
336
+ when: 'The record has no cell at the phase/Primitive address, or no requirement with the id.',
337
+ next: 'Read a cell address or requirement id that get returns for the record, or the record without a fragment.',
338
+ },
339
+ {
340
+ code: 'IA-RUNTIME-READ-UNREACHABLE',
341
+ when: "The document the record's source locator names cannot be read: a URL, a path outside the workspace or the record's tree, an adopted mount bound to no directory, a nonportable path, a missing, linked or oversized file, bytes that are not UTF-8, or an anchor no markdown heading has.",
342
+ next: "Restore the file the refusal's path names, or correct the record's source locator, which get shows with its source line.",
343
+ },
344
+ {
345
+ code: 'IA-RUNTIME-READ-PLACEMENT',
346
+ when: 'The record is at runtime placement (band 0) and includeRuntime is not true.',
347
+ next: 'Pass includeRuntime: true to read it.',
348
+ },
349
+ ],
350
+ example: { locator: `${EXAMPLE_IDENTITY}#act/Decision` },
351
+ mcp: 'ia_read',
352
+ since: 2,
353
+ },
354
+ {
355
+ name: 'next',
356
+ summary: "Read one plan's delivery view inside the scope: its tasks in order, each with a verdict.",
357
+ description: "Read one plan's delivery view inside the scope, computed per call and never stored: its milestones and tasks in one prerequisites-first order, each task with a basis line per requirement (its own and its milestone's), one verdict (exit evidence recorded, no declared blocker, or blocked), its work.status as self-declared, which is never a basis, and five state lines; then review items and the next task. Exit evidence is a success @observation on the task whose subject-revision is its current digest. What the scope does not read is never counted as met, and a relation row that carries a condition counts only where it holds at the coordinate the scope binds, as graph traversal decides it: a term that coordinate leaves undecided, such as a phase where none is bound or a severity the stating record's own does not decide, leaves the row conditional, its basis unknown, never met.",
358
+ params: object({
359
+ within: read.within,
360
+ seat: text("A @plan, @milestone or @task identity; the view is that plan's, or the plan of that milestone or task. Omitted, the only admitted @plan at authored placement (band 100)."),
361
+ }),
362
+ result: 'The view: {format: ia.delivery-view.v1, revision, plan, milestones, tasks, review, next, summary}. Each task is {identity, milestone, status, prerequisites, verdict, line, evidence?, states}; next is the command for the first task with no declared blocker, or null when every task has exit evidence or every other one is blocked, which summary says.',
363
+ refusals: [
364
+ REQUEST_INVALID,
365
+ SCOPE_UNAVAILABLE,
366
+ {
367
+ code: 'IA-RUNTIME-NEXT-SEAT',
368
+ when: 'seat is not an admitted record in the scope, or is not a @plan, @milestone or @task.',
369
+ next: "Run the command the refusal's next names: the view without a seat for a seat no admitted record answers (ia next, the first authored plan's, or ia next --help when none is authored), or the position of a record of another word.",
370
+ },
371
+ {
372
+ code: 'IA-RUNTIME-NEXT-NO-PLAN',
373
+ when: 'seat belongs to no admitted @plan, or no seat is given and no @plan is authored at band 100.',
374
+ next: "Author a @plan, @milestone records that name it in work.plan and @task records that name those in work.milestone; the refusal's next names the help that says so.",
375
+ },
376
+ {
377
+ code: 'IA-RUNTIME-NEXT-AMBIGUOUS',
378
+ when: 'No seat is given and several @plan records are authored at band 100; the refusal lists them in plans.',
379
+ next: "Pass one of plans as seat, as the refusal's next does with the first.",
380
+ },
381
+ {
382
+ code: 'IA-RUNTIME-NEXT-CYCLE',
383
+ when: "The plan's require rows form a cycle among its tasks, milestones or both, so no order exists; the refusal lists the cycle's declared rows in cycle.",
384
+ next: "Remove one of the require rows in cycle; the refusal's next names the position of its first task, or else its first milestone.",
385
+ },
386
+ ],
387
+ example: {},
388
+ mcp: 'ia_next',
389
+ since: 2,
390
+ },
391
+ {
392
+ name: 'position',
393
+ summary: 'Read body(K), what a scope key loads inside the scope, with its digest and host note.',
394
+ description: "Read the position a scope key K = (seat, shape, phase, depth, budget, word) names inside the scope: body(K), the seat, the records the key loads in the shape's order, the blocking governance reserved outside the budget, pointers and their tallies, the rules and playbooks that apply by word with their tallies and the playbook cells they deliver, the mandates that govern the seat, the frontier one hop past it, what is unknown and the keys that widen it; its digest; and the host note beside it. A key naming no part is K0 (the repository's @workspace, context, orient, depth 0, budget 0); one naming any part takes context, the anchor phase of its shape's primitive, depth 1 and budget 16 for the rest. A relation row with a condition is followed only where the condition holds at the key's coordinate. The body is a pure function of the key and the admitted records the scope reads: it names no root path, token, time or capture, nothing text-driven runs, and no record body enters it, only the cells delivered; read fetches a body. A refusal of the key carries next, the one command to run.",
395
+ params: object({
396
+ within: read.within,
397
+ seat: {
398
+ anyOf: [
399
+ { type: 'string' },
400
+ object({ path: text('Workspace-relative, or an absolute path inside the workspace root.') }, ['path'], 'A location.'),
401
+ ],
402
+ description: "S: an identity the scope admits, or {path} for a location inside the workspace. Omitted, the repository's own @workspace.",
403
+ },
404
+ shape: {
405
+ type: 'string',
406
+ enum: COORDINATE_DOMAINS.shape,
407
+ description: 'H, the intent shape; omitted, context.',
408
+ },
409
+ phase: {
410
+ type: 'string',
411
+ enum: COORDINATE_DOMAINS.phase,
412
+ description: "P; omitted, the anchor phase of the shape's primitive.",
413
+ },
414
+ depth: {
415
+ type: 'integer',
416
+ minimum: 0,
417
+ maximum: SCOPE_KEY_CAPS.depth,
418
+ description: "d, the rows a body hops along the shape's predicate focus; omitted, 1, or 0 when no part is named (K0).",
419
+ },
420
+ budget: {
421
+ type: 'integer',
422
+ minimum: 0,
423
+ maximum: SCOPE_KEY_CAPS.budget,
424
+ description: 'n, the entries loaded beyond the seat, blocking governance reserved outside it; omitted, 16, or 0 when no part is named (K0).',
425
+ },
426
+ word: text('w, a word the closure registers: only records of it load, are pointers or are tallied as pointers or frontier; the reserved rules, the rules and playbooks that apply by word with their tallies and cells, and the mandates are listed whatever their word. Omitted, none.'),
427
+ }),
428
+ result: "The position: {body, digest, hostNote}. body is body(K) in the format ia.position-body.v1, its key the one resolved and its revision that of the view the scope reads; digest is the SHA-256 of the body's canonical JSON text; hostNote is {revision, capturedRevision?, previousRevision?, freshness, key}, host state never digested, freshness current, stale or no-capture against the last capture and key the key as completed.",
429
+ refusals: [
430
+ {
431
+ code: 'IA-RUNTIME-REQUEST-INVALID',
432
+ when: 'A parameter is unknown or within is not a string, or the key breaks a bound: a shape or phase outside its closed set, a depth outside 0..2 or a budget outside 0..64, a seat that is neither an identity nor {path}, one the scope does not admit or at runtime placement, a path outside the workspace, or a word the closure does not register.',
433
+ next: "Run the command a refusal of the key names as next: the part's closed set or cap, ia vocabulary for a word, or the position without the seat. Otherwise match the parameters to this operation's schema.",
434
+ },
435
+ SCOPE_UNAVAILABLE,
436
+ ],
437
+ example: { seat: EXAMPLE_IDENTITY, shape: 'governance' },
438
+ mcp: 'ia_position',
439
+ since: 2,
440
+ },
305
441
  ],
306
442
  differences: [
307
443
  {
@@ -1 +1 @@
1
- {"version":3,"file":"machine-protocol.js","sourceRoot":"","sources":["../src/machine-protocol.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;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ACD,iBAAiB;aAClB;YACD,OAAO,EAAE,EAAE,IAAI,EAAE,gBAAgB,EAAE,KAAK,EAAE,YAAY,EAAE;YACxD,GAAG,EAAE,aAAa;YAClB,KAAK,EAAE,CAAC;SACT;KACF;IACD,WAAW,EAAE;QACX;YACE,KAAK,EAAE,QAAQ;YACf,GAAG,EAAE,mDAAmD;YACxD,GAAG,EAAE,iDAAiD;SACvD;QACD;YACE,KAAK,EAAE,YAAY;YACnB,GAAG,EAAE,4EAA4E;YACjF,GAAG,EAAE,qDAAqD;SAC3D;QACD;YACE,KAAK,EAAE,gBAAgB;YACvB,GAAG,EAAE,yHAAyH;YAC9H,GAAG,EAAE,8EAA8E;SACpF;QACD;YACE,KAAK,EAAE,WAAW;YAClB,GAAG,EAAE,sEAAsE;YAC3E,GAAG,EAAE,0DAA0D;SAChE;QACD;YACE,KAAK,EAAE,gBAAgB;YACvB,GAAG,EAAE,uCAAuC;YAC5C,GAAG,EAAE,0EAA0E;SAChF;QACD;YACE,KAAK,EAAE,UAAU;YACjB,GAAG,EAAE,yMAAyM;YAC9M,GAAG,EAAE,wGAAwG;SAC9G;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,60 @@
1
+ import type { CompiledRecord } from '@inventarch/language';
2
+ import type { RuntimeCode } from './errors.js';
3
+ /**
4
+ * Mandate authority as closed moves (position-and-projection design, items 2c and 13).
5
+ *
6
+ * A `@mandate` may declare an `authority` section: the participant it binds, the moves it allows (closed to the five
7
+ * kernel moves), the workspaces it scopes, and the words and path selections it excludes or covers. This module
8
+ * publishes the CLI mode -> move table and the pure refusal check that the authoring verbs will consume. Nothing here
9
+ * is wired into the CLI yet: the authoring verbs land in a later milestone, and until then no command consults a
10
+ * mandate. A mandate adds closed restrictions only; it never grants host permissions, and a mandate without
11
+ * `authority.moves` restricts no move.
12
+ */
13
+ /** The five kernel moves, in kernel order. */
14
+ export declare const MOVES: readonly ["Observation", "Execution", "Delegation", "Synthesis", "Verification"];
15
+ export type Move = (typeof MOVES)[number];
16
+ /** One kernel move per CLI mode (design item 13). */
17
+ export declare const MODE_MOVES: Readonly<{
18
+ readonly read: "Observation";
19
+ readonly validate: "Verification";
20
+ readonly author: "Synthesis";
21
+ readonly effect: "Execution";
22
+ readonly 're-seat': "Delegation";
23
+ }>;
24
+ export type Mode = keyof typeof MODE_MOVES;
25
+ /** The modes in table order. */
26
+ export declare const MODES: readonly Mode[];
27
+ export declare function isMode(value: unknown): value is Mode;
28
+ export type MandateCode = Extract<RuntimeCode, `IA-RUNTIME-MANDATE-${string}`>;
29
+ /** The refusal codes a mandate can return; both are registered in RUNTIME_CODES. */
30
+ export declare const MANDATE_CODES: readonly MandateCode[];
31
+ /** The `authority` section of one compiled `@mandate`; an absent field is an absent restriction. */
32
+ export interface MandateAuthority {
33
+ readonly identity: string;
34
+ /** The name of the `@agent` the mandate binds (`authority.participant`). */
35
+ readonly participant?: string;
36
+ /** The moves the mandate allows (`authority.moves`); absent, it allows every move. */
37
+ readonly moves?: readonly Move[];
38
+ /** Words the participant may not author (`authority.excluded-words`). */
39
+ readonly excludedWords?: readonly string[];
40
+ /** The names of the `@workspace` records the mandate applies in (`authority.scope`). */
41
+ readonly scope?: readonly string[];
42
+ /** Path selections the mandate claims (`authority.covers`). */
43
+ readonly covers?: readonly string[];
44
+ }
45
+ export interface MandateRefusal {
46
+ readonly code: MandateCode;
47
+ readonly message: string;
48
+ /** Exactly one catalog command with closed arguments. */
49
+ readonly next: string;
50
+ }
51
+ /** Read the authority a compiled `@mandate` declares; a non-mandate or a malformed field is IA-RUNTIME-REQUEST-INVALID. */
52
+ export declare function mandateAuthorityOf(record: CompiledRecord): MandateAuthority;
53
+ /**
54
+ * Undefined when the mandate permits `mode` for `words`, else one refusal. The move is judged first: a declared move
55
+ * list admits only the moves it lists and must name at least one (an empty list is IA-RUNTIME-REQUEST-INVALID); a
56
+ * mandate without moves restricts no move. Then any word in `excluded-words` is refused, whatever the moves. `next`
57
+ * names the one catalog command that shows the mandate.
58
+ */
59
+ export declare function mandateRefusal(mandate: MandateAuthority | CompiledRecord, mode: Mode, words?: readonly string[]): MandateRefusal | undefined;
60
+ //# sourceMappingURL=mandate-modes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mandate-modes.d.ts","sourceRoot":"","sources":["../src/mandate-modes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAiB,cAAc,EAAiB,MAAM,sBAAsB,CAAC;AAGzF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;;;;;;GASG;AAEH,8CAA8C;AAC9C,eAAO,MAAM,KAAK,kFAAe,CAAC;AAClC,MAAM,MAAM,IAAI,GAAG,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,CAAC,CAAC;AAE1C,qDAAqD;AACrD,eAAO,MAAM,UAAU;;;;;;EAM6B,CAAC;AACrD,MAAM,MAAM,IAAI,GAAG,MAAM,OAAO,UAAU,CAAC;AAC3C,gCAAgC;AAChC,eAAO,MAAM,KAAK,EAAE,SAAS,IAAI,EAAqD,CAAC;AACvF,wBAAgB,MAAM,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,IAAI,CAEpD;AAED,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,EAAE,sBAAsB,MAAM,EAAE,CAAC,CAAC;AAC/E,oFAAoF;AACpF,eAAO,MAAM,aAAa,EAAE,SAAS,WAAW,EAE/C,CAAC;AAEF,oGAAoG;AACpG,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,4EAA4E;IAC5E,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,sFAAsF;IACtF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,IAAI,EAAE,CAAC;IACjC,yEAAyE;IACzE,QAAQ,CAAC,aAAa,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC3C,wFAAwF;IACxF,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,+DAA+D;IAC/D,QAAQ,CAAC,MAAM,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACrC;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAkCD,2HAA2H;AAC3H,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,cAAc,GAAG,gBAAgB,CAuB3E;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAC5B,OAAO,EAAE,gBAAgB,GAAG,cAAc,EAC1C,IAAI,EAAE,IAAI,EACV,KAAK,GAAE,SAAS,MAAM,EAAO,GAC5B,cAAc,GAAG,SAAS,CAqB5B"}
@@ -0,0 +1,112 @@
1
+ import { MOVES as KERNEL_MOVES } from '@inventarch/language';
2
+ import { RUNTIME_CODES, RuntimeError } from './errors.js';
3
+ /**
4
+ * Mandate authority as closed moves (position-and-projection design, items 2c and 13).
5
+ *
6
+ * A `@mandate` may declare an `authority` section: the participant it binds, the moves it allows (closed to the five
7
+ * kernel moves), the workspaces it scopes, and the words and path selections it excludes or covers. This module
8
+ * publishes the CLI mode -> move table and the pure refusal check that the authoring verbs will consume. Nothing here
9
+ * is wired into the CLI yet: the authoring verbs land in a later milestone, and until then no command consults a
10
+ * mandate. A mandate adds closed restrictions only; it never grants host permissions, and a mandate without
11
+ * `authority.moves` restricts no move.
12
+ */
13
+ /** The five kernel moves, in kernel order. */
14
+ export const MOVES = KERNEL_MOVES;
15
+ /** One kernel move per CLI mode (design item 13). */
16
+ export const MODE_MOVES = Object.freeze({
17
+ read: 'Observation',
18
+ validate: 'Verification',
19
+ author: 'Synthesis',
20
+ effect: 'Execution',
21
+ 're-seat': 'Delegation',
22
+ });
23
+ /** The modes in table order. */
24
+ export const MODES = Object.freeze(Object.keys(MODE_MOVES));
25
+ export function isMode(value) {
26
+ return typeof value === 'string' && Object.hasOwn(MODE_MOVES, value);
27
+ }
28
+ /** The refusal codes a mandate can return; both are registered in RUNTIME_CODES. */
29
+ export const MANDATE_CODES = Object.freeze(RUNTIME_CODES.filter((code) => code.startsWith('IA-RUNTIME-MANDATE-')));
30
+ const invalid = (message) => {
31
+ throw new RuntimeError('IA-RUNTIME-REQUEST-INVALID', message);
32
+ };
33
+ /** Every value authored under `authority.<key>`: a repeated list key contributes each of its lists' items. */
34
+ function authorityValues(record, key) {
35
+ const fields = record.sections
36
+ .filter((section) => section.name === 'authority')
37
+ .flatMap((section) => section.fields)
38
+ .filter((child) => 'key' in child && child.key === key);
39
+ for (const field of fields)
40
+ if (field.when !== undefined || field.fields !== undefined || field.value.kind === 'block')
41
+ invalid(`${record.identity}: authority.${key} must be an unconditional inline value`);
42
+ return fields.flatMap((field) => (field.value.kind === 'list' ? field.value.items : [field.value]));
43
+ }
44
+ function texts(record, key) {
45
+ return authorityValues(record, key).map((value) => value.kind === 'scalar' || value.kind === 'string' || value.kind === 'prose'
46
+ ? value.text
47
+ : invalid(`${record.identity}: authority.${key} holds a value that is not text`));
48
+ }
49
+ function names(record, key, discriminator) {
50
+ return authorityValues(record, key).map((value) => value.kind === 'ref' && value.discriminator === discriminator && value.fragment === undefined
51
+ ? value.name
52
+ : invalid(`${record.identity}: authority.${key} holds a value that is not a @${discriminator} reference`));
53
+ }
54
+ function isMove(value) {
55
+ return MOVES.includes(value);
56
+ }
57
+ /** Read the authority a compiled `@mandate` declares; a non-mandate or a malformed field is IA-RUNTIME-REQUEST-INVALID. */
58
+ export function mandateAuthorityOf(record) {
59
+ if (record.discriminator !== 'mandate')
60
+ invalid(`${record.identity} is not a @mandate`);
61
+ const participants = names(record, 'participant', 'agent');
62
+ if (participants.length > 1)
63
+ invalid(`${record.identity}: authority.participant names more than one agent`);
64
+ const present = (key) => authorityValues(record, key).length > 0;
65
+ const moves = texts(record, 'moves').map((move) => isMove(move) ? move : invalid(`${record.identity}: authority.moves names ${move}, not a kernel move`));
66
+ // Presence is judged by the key: a declared but empty list names no move, which the design's one-or-more refuses
67
+ // rather than reading as a lockout of every mode or as an absent restriction.
68
+ const hasMoves = record.sections
69
+ .filter((section) => section.name === 'authority')
70
+ .flatMap((section) => section.fields)
71
+ .some((child) => 'key' in child && child.key === 'moves');
72
+ if (hasMoves && moves.length === 0)
73
+ invalid(`${record.identity}: authority.moves must name at least one kernel move`);
74
+ return Object.freeze({
75
+ identity: record.identity,
76
+ ...(participants.length === 1 ? { participant: participants[0] } : {}),
77
+ ...(hasMoves ? { moves: Object.freeze(moves) } : {}),
78
+ ...(present('excluded-words') ? { excludedWords: Object.freeze(texts(record, 'excluded-words')) } : {}),
79
+ ...(present('scope') ? { scope: Object.freeze(names(record, 'scope', 'workspace')) } : {}),
80
+ ...(present('covers') ? { covers: Object.freeze(texts(record, 'covers')) } : {}),
81
+ });
82
+ }
83
+ /**
84
+ * Undefined when the mandate permits `mode` for `words`, else one refusal. The move is judged first: a declared move
85
+ * list admits only the moves it lists and must name at least one (an empty list is IA-RUNTIME-REQUEST-INVALID); a
86
+ * mandate without moves restricts no move. Then any word in `excluded-words` is refused, whatever the moves. `next`
87
+ * names the one catalog command that shows the mandate.
88
+ */
89
+ export function mandateRefusal(mandate, mode, words = []) {
90
+ if (!isMode(mode))
91
+ invalid(`Mode must be one of ${MODES.join(', ')}`);
92
+ const authority = 'sections' in mandate ? mandateAuthorityOf(mandate) : mandate;
93
+ if (authority.moves !== undefined && authority.moves.length === 0)
94
+ invalid(`${authority.identity}: authority.moves must name at least one kernel move`);
95
+ const move = MODE_MOVES[mode];
96
+ const next = `ia inspect ${authority.identity} --edges both`;
97
+ if (authority.moves !== undefined && !authority.moves.includes(move))
98
+ return Object.freeze({
99
+ code: 'IA-RUNTIME-MANDATE-MOVE',
100
+ message: `${authority.identity} allows ${authority.moves.join(', ')}; ${mode} needs ${move}`,
101
+ next,
102
+ });
103
+ const excluded = words.filter((word) => authority.excludedWords?.includes(word));
104
+ if (excluded.length > 0)
105
+ return Object.freeze({
106
+ code: 'IA-RUNTIME-MANDATE-WORD',
107
+ message: `${authority.identity} excludes ${excluded.join(', ')}`,
108
+ next,
109
+ });
110
+ return undefined;
111
+ }
112
+ //# sourceMappingURL=mandate-modes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mandate-modes.js","sourceRoot":"","sources":["../src/mandate-modes.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,IAAI,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG1D;;;;;;;;;GASG;AAEH,8CAA8C;AAC9C,MAAM,CAAC,MAAM,KAAK,GAAG,YAAY,CAAC;AAGlC,qDAAqD;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC;IACtC,IAAI,EAAE,aAAa;IACnB,QAAQ,EAAE,cAAc;IACxB,MAAM,EAAE,WAAW;IACnB,MAAM,EAAE,WAAW;IACnB,SAAS,EAAE,YAAY;CAC0B,CAAC,CAAC;AAErD,gCAAgC;AAChC,MAAM,CAAC,MAAM,KAAK,GAAoB,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,CAAW,CAAC,CAAC;AACvF,MAAM,UAAU,MAAM,CAAC,KAAc;IACnC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACvE,CAAC;AAGD,oFAAoF;AACpF,MAAM,CAAC,MAAM,aAAa,GAA2B,MAAM,CAAC,MAAM,CAChE,aAAa,CAAC,MAAM,CAAC,CAAC,IAAI,EAAuB,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,qBAAqB,CAAC,CAAC,CAC5F,CAAC;AAwBF,MAAM,OAAO,GAAG,CAAC,OAAe,EAAS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AC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CA0BnF"}
1
+ {"version":3,"file":"mentions.d.ts","sourceRoot":"","sources":["../src/mentions.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAGjD,UAAU,OAAO;IACf,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,aAAa,CAAC;IACnC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,aAAa,GAAG,OAAO,CAqCvE;AACD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,OAAO,EAAE,CAezD;AACD,wBAAgB,cAAc,CAC5B,MAAM,EAAE,UAAU,EAClB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,SAAS,IAAI,EAAE,EACtB,OAAO,EAAE,OAAO,GACf;IAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAsBnF"}
package/dist/mentions.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { KINDS } from '@inventarch/language';
2
+ import { fragmentText } from './locator.js';
2
3
  const SIGIL = /^@([a-z][a-z0-9-]*)\s+("(?:\\.|[^"\\])*"|[^\s#]+)(?:#([^\s]+))?$/i;
3
4
  export function subjectMention(subject) {
4
5
  if (typeof subject !== 'string')
@@ -70,9 +71,7 @@ export function resolveMention(handle, within, nodes, mention) {
70
71
  identity = matches[0].identity;
71
72
  }
72
73
  const node = nodes.find((n) => n.identity === identity);
73
- if (fragment !== undefined &&
74
- !node.cells.some((c) => `${c.phase}/${c.primitive}` === fragment) &&
75
- !node.requirements.some((r) => r.id === fragment))
74
+ if (fragment !== undefined && fragmentText(node, fragment) === undefined)
76
75
  return { detail: `No cell or requirement fragment '${fragment}'` };
77
76
  return { node, ...(fragment === undefined ? {} : { fragment }) };
78
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mentions.js","sourceRoot":"","sources":["../src/mentions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,sBAAsB,CAAC;AAY7C,MAAM,KAAK,GAAG,mEAAmE,CAAC;AAClF,MAAM,UAAU,cAAc,CAAC,OAA+B;IAC5D,IAAI,OAAO,OAAO,KAAK,QAAQ;QAC7B,OAAO;YACL,OAAO,EAAE,OAAO,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,IAAI,EAAE;YACrG,SAAS,EAAE,OAAO;SACnB,CAAC;IACJ,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAClC,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACnB,IAAI,IAAI,GAAG,KAAK,CAAC,CAAC,CAAE,CAAC;QACrB,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;YACtB,IAAI,CAAC;gBACH,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAW,CAAC;YACpC,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;YAC9B,CAAC;QACH,OAAO;YACL,OAAO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AAC;QAC3B,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;IAC7B,CAAC;SAAM,CAAC;QACN,MAAM,OAAO,GAAG,KAAK,CAAC,MAAM,CAC1B,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,CAAC,WAAW,CAAC,WAAW,EAAE,KAAK,OAAO,CAAC,IAAI,EAAE,WAAW,EAAE,CAAC;YACvG,CAAC,OAAO,CAAC,IAAI,KAAK,SAAS,IAAI,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,IAAI,CAAC,CAC1D,CAAC;QACF,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC;YACtB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,2BAA2B,EAAE,CAAC;QACpG,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAE,CAAC,QAAQ,CAAC;IAClC,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAE,CAAC;IACzD,IAAI,QAAQ,KAAK,SAAS,IAAI,YAAY,CAAC,IAAI,EAAE,QAAQ,CAAC,KAAK,SAAS;QACtE,OAAO,EAAE,MAAM,EAAE,oCAAoC,QAAQ,GAAG,EAAE,CAAC;IACrE,OAAO,EAAE,IAAI,EAAE,GAAG,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,CAAC,EAAE,CAAC;AACnE,CAAC"}
package/dist/next.d.ts ADDED
@@ -0,0 +1,151 @@
1
+ import type { ReadHandle } from '@inventarch/db';
2
+ import type { RuntimeCode } from './errors.js';
3
+ /**
4
+ * The delivery view: position-and-projection §9 step 2, the five lines of §10 and design row 21, which `ia next` reads.
5
+ *
6
+ * One @plan, its milestones and their tasks in one prerequisites-first order, each task with the basis lines of its
7
+ * effective prerequisites, one verdict and the five state lines, then the review items and the next command. It is a
8
+ * pure function of the admitted records one scope reads: computed per read, never stored, and nothing is written.
9
+ *
10
+ * A task's effective prerequisites are the records it requires plus those its milestone requires; work-system consents
11
+ * `require` to a @task, @milestone or @decision only, so no @spec is ever one. Exit evidence is an @observation whose
12
+ * `evidence.verdict` is success, whose `evidence.subject` names the record or which the record's `work.exit-evidence`
13
+ * names, and whose `evidence.subject-revision` reads `current` under the handle's `readiness` (db D08). A record's own
14
+ * `work.status` is printed as self-declared and is never a basis.
15
+ *
16
+ * What the scope does not read is never a basis either (design §10, IM-24). A requirement a record declares whose
17
+ * answer this scope does not read blocks, as unknown; and no milestone is satisfied through its tasks, nor is every
18
+ * task said to have exit evidence, while some task may go unread: on a narrowed scope, and on a whole-workspace scope
19
+ * (db PT5, the only one that may disclose admission findings) while admission refuses a @task, or a whole file (D03).
20
+ *
21
+ * A relation row that carries a condition, such as `grounds @task guide when phase is act`, counts only where its
22
+ * condition holds at the coordinate the scope binds (decision conditional-relations-in-delivery), decided as graph
23
+ * traversal decides it; where the coordinates the scope may still be completed to disagree on it, as on an axis the
24
+ * scope binds no value for, the row is conditional and its basis unknown, so it is never satisfied: a conditional
25
+ * requirement blocks as unknown and orders nothing, and the intent read through a conditional grounding or supersession
26
+ * is unknown unless it reads the same at every such coordinate.
27
+ */
28
+ export type NextCode = Extract<RuntimeCode, `IA-RUNTIME-NEXT-${string}`>;
29
+ /** The refusal codes the delivery view can return; each is registered in RUNTIME_CODES. */
30
+ export declare const NEXT_CODES: readonly NextCode[];
31
+ /** One declared `require` row of a refused cycle: `from` requires `to`, stated on `declaredOn` at `path`:`line`. */
32
+ export interface CycleRow {
33
+ readonly from: string;
34
+ readonly to: string;
35
+ readonly declaredOn: string;
36
+ readonly path: string;
37
+ readonly line: number;
38
+ }
39
+ export interface NextRefusal {
40
+ readonly ok: false;
41
+ readonly code: NextCode;
42
+ readonly message: string;
43
+ /** Exactly one catalog command with closed arguments (design row 27). */
44
+ readonly next: string;
45
+ /** IA-RUNTIME-NEXT-AMBIGUOUS: the admitted @plan identities at band 100, in identity order. */
46
+ readonly plans?: readonly string[];
47
+ /** IA-RUNTIME-NEXT-CYCLE: the declared rows of one cycle, each row's `to` requiring the next row's. */
48
+ readonly cycle?: readonly CycleRow[];
49
+ }
50
+ /** One effective prerequisite of a task, its own or inherited from its milestone, with its basis line. */
51
+ export interface Prerequisite {
52
+ /** The required record, or the reference as authored when no admitted record answers the requirement. */
53
+ readonly target: string;
54
+ /** The required record's word; absent when no admitted record answers the requirement. */
55
+ readonly word?: string;
56
+ /** The milestone whose requirement the task inherits; absent for the task's own. */
57
+ readonly via?: string;
58
+ readonly satisfied: boolean;
59
+ readonly basis: string;
60
+ }
61
+ export type StateDimension = 'intent' | 'definition' | 'realizable' | 'realized' | 'worked';
62
+ /** One of the five independent state lines of design §10: a value and the only basis it is read from. */
63
+ export interface StateLine {
64
+ readonly dimension: StateDimension;
65
+ readonly value: string;
66
+ readonly basis: string;
67
+ }
68
+ export interface ExitEvidence {
69
+ readonly observation: string;
70
+ /** `evidence.evaluator` as recorded; absent when the observation records none. */
71
+ readonly evaluator?: string;
72
+ /**
73
+ * `self` when the evaluator is the identity the task's `work.owner-agent` names (decision
74
+ * task-owner-and-agent-description); `unknown` when the task states an owner-agent that no admitted @agent in this
75
+ * scope answers, or the observation records no evaluator for a task that names one; else `other`.
76
+ */
77
+ readonly attribution: 'self' | 'other' | 'unknown';
78
+ }
79
+ export interface DeliveryTask {
80
+ readonly identity: string;
81
+ readonly milestone: string;
82
+ /** `status <work.status> (self-declared)`: printed beside the verdict, never its basis. */
83
+ readonly status: string;
84
+ readonly prerequisites: readonly Prerequisite[];
85
+ readonly verdict: 'evidenced' | 'unblocked' | 'blocked';
86
+ /**
87
+ * `exit evidence recorded (<observation>, evaluator <evaluator>[, self-attributed | , self-attribution unknown])`,
88
+ * `no declared blocker`, or `blocked (<basis>; …)` naming each unsatisfied prerequisite.
89
+ */
90
+ readonly line: string;
91
+ readonly evidence?: ExitEvidence;
92
+ /** intent, definition, realizable, realized and worked, in that order. */
93
+ readonly states: readonly StateLine[];
94
+ }
95
+ export interface DeliveryMilestone {
96
+ readonly identity: string;
97
+ readonly status: string;
98
+ /** Its tasks, in the view's order. */
99
+ readonly tasks: readonly string[];
100
+ /** It has exit evidence of its own, or it has tasks, each of them has exit evidence and no task can go unread. */
101
+ readonly satisfied: boolean;
102
+ /** Which of the two applies, or why neither does. */
103
+ readonly basis: string;
104
+ }
105
+ /** A contradiction or finding the view reports and does not resolve, for the owner it names (IM-32). */
106
+ export interface ReviewItem {
107
+ /**
108
+ * `grounding`: decisions grounding one record of the plan; `currency`: accepted specs, one superseding the other;
109
+ * `admission`: a @plan, @milestone or @task admission refused, or a file a language error refuses whole, which the
110
+ * view cannot place in any plan.
111
+ */
112
+ readonly kind: 'grounding' | 'currency' | 'admission';
113
+ /**
114
+ * The grounded record then its decisions, the superseding spec then the spec it supersedes, or the refused record;
115
+ * empty for a refused file.
116
+ */
117
+ readonly records: readonly string[];
118
+ /** The `head.steward` of the system of the record the item is about, when the scope admits that @system. */
119
+ readonly owner?: string;
120
+ readonly message: string;
121
+ }
122
+ export interface DeliveryView {
123
+ readonly format: 'ia.delivery-view.v1';
124
+ /** The revision of the view the scope reads. */
125
+ readonly revision: string;
126
+ readonly plan: string;
127
+ /** In the order their prerequisites are met. */
128
+ readonly milestones: readonly DeliveryMilestone[];
129
+ /** Prerequisites first, ties by (milestone identity, task identity). */
130
+ readonly tasks: readonly DeliveryTask[];
131
+ readonly review: readonly ReviewItem[];
132
+ /** `ia position --seat <task> --shape sequence` for the first task in order with no declared blocker, else null. */
133
+ readonly next: string | null;
134
+ /** How many tasks have exit evidence, then the next task or why there is none. */
135
+ readonly summary: string;
136
+ }
137
+ export type DeliveryResult = {
138
+ readonly ok: true;
139
+ readonly view: DeliveryView;
140
+ } | NextRefusal;
141
+ /**
142
+ * The delivery view of one @plan in the scope `within`, or one refusal naming one next command. The seat is a @plan,
143
+ * @milestone or @task identity, read as its plan; without one, the plan is the only admitted @plan at band 100.
144
+ * IA-RUNTIME-NEXT-SEAT refuses a seat that is no admitted @plan, @milestone or @task; IA-RUNTIME-NEXT-NO-PLAN a seat
145
+ * that belongs to no admitted plan, or no seat and no authored plan; IA-RUNTIME-NEXT-AMBIGUOUS no seat and several
146
+ * authored plans; IA-RUNTIME-NEXT-CYCLE a plan whose `require` rows form a cycle, among tasks, milestones or both.
147
+ * Every read goes through `within`, but for the admission findings a whole-workspace `within` alone may disclose
148
+ * (db PT5), and nothing is written.
149
+ */
150
+ export declare function deliveryView(handle: ReadHandle, within: string, seat?: string): DeliveryResult;
151
+ //# sourceMappingURL=next.d.ts.map