@inventarch/runtime 1.2.0 → 3.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 (82) hide show
  1. package/README.md +18 -2
  2. package/SPEC.md +41 -7
  3. package/dist/authoring-execution/execution.d.ts.map +1 -1
  4. package/dist/authoring-execution/execution.js +4 -2
  5. package/dist/authoring-execution/execution.js.map +1 -1
  6. package/dist/authoring-execution/inventory.d.ts.map +1 -1
  7. package/dist/authoring-execution/inventory.js +2 -0
  8. package/dist/authoring-execution/inventory.js.map +1 -1
  9. package/dist/authoring-execution/types.d.ts +2 -0
  10. package/dist/authoring-execution/types.d.ts.map +1 -1
  11. package/dist/context.d.ts +10 -1
  12. package/dist/context.d.ts.map +1 -1
  13. package/dist/context.js +14 -5
  14. package/dist/context.js.map +1 -1
  15. package/dist/coordinate.d.ts +9 -2
  16. package/dist/coordinate.d.ts.map +1 -1
  17. package/dist/coordinate.js +14 -0
  18. package/dist/coordinate.js.map +1 -1
  19. package/dist/door.d.ts +17 -0
  20. package/dist/door.d.ts.map +1 -1
  21. package/dist/door.js +104 -5
  22. package/dist/door.js.map +1 -1
  23. package/dist/editor/index.d.ts +3 -1
  24. package/dist/editor/index.d.ts.map +1 -1
  25. package/dist/editor/index.js +4 -1
  26. package/dist/editor/index.js.map +1 -1
  27. package/dist/editor/workspace.d.ts.map +1 -1
  28. package/dist/editor/workspace.js +11 -2
  29. package/dist/editor/workspace.js.map +1 -1
  30. package/dist/errors.d.ts +20 -2
  31. package/dist/errors.d.ts.map +1 -1
  32. package/dist/errors.js +16 -1
  33. package/dist/errors.js.map +1 -1
  34. package/dist/index.d.ts +15 -3
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +7 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/locator.d.ts +22 -2
  39. package/dist/locator.d.ts.map +1 -1
  40. package/dist/locator.js +290 -26
  41. package/dist/locator.js.map +1 -1
  42. package/dist/machine-protocol.d.ts +5 -0
  43. package/dist/machine-protocol.d.ts.map +1 -1
  44. package/dist/machine-protocol.js +142 -6
  45. package/dist/machine-protocol.js.map +1 -1
  46. package/dist/mandate-guard.d.ts +91 -0
  47. package/dist/mandate-guard.d.ts.map +1 -0
  48. package/dist/mandate-guard.js +160 -0
  49. package/dist/mandate-guard.js.map +1 -0
  50. package/dist/mandate-modes.d.ts +251 -4
  51. package/dist/mandate-modes.d.ts.map +1 -1
  52. package/dist/mandate-modes.js +426 -18
  53. package/dist/mandate-modes.js.map +1 -1
  54. package/dist/next.d.ts +154 -0
  55. package/dist/next.d.ts.map +1 -0
  56. package/dist/next.js +724 -0
  57. package/dist/next.js.map +1 -0
  58. package/dist/packet-host.d.ts +208 -0
  59. package/dist/packet-host.d.ts.map +1 -0
  60. package/dist/packet-host.js +244 -0
  61. package/dist/packet-host.js.map +1 -0
  62. package/dist/packet.d.ts +172 -0
  63. package/dist/packet.d.ts.map +1 -0
  64. package/dist/packet.js +211 -0
  65. package/dist/packet.js.map +1 -0
  66. package/dist/position.d.ts +284 -0
  67. package/dist/position.d.ts.map +1 -0
  68. package/dist/position.js +531 -0
  69. package/dist/position.js.map +1 -0
  70. package/dist/render.d.ts +6 -1
  71. package/dist/render.d.ts.map +1 -1
  72. package/dist/render.js +12 -0
  73. package/dist/render.js.map +1 -1
  74. package/dist/scope-key.d.ts +101 -0
  75. package/dist/scope-key.d.ts.map +1 -0
  76. package/dist/scope-key.js +175 -0
  77. package/dist/scope-key.js.map +1 -0
  78. package/dist/steward.d.ts +8 -1
  79. package/dist/steward.d.ts.map +1 -1
  80. package/dist/steward.js +10 -0
  81. package/dist/steward.js.map +1 -1
  82. package/package.json +28 -4
package/dist/next.d.ts ADDED
@@ -0,0 +1,154 @@
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
+ /**
125
+ * The authored revision of the view the scope reads (db `Snapshot.authoredRevision`): runtime-band evidence that the
126
+ * view counts as exit evidence moves its verdicts, never this revision.
127
+ */
128
+ readonly revision: string;
129
+ readonly plan: string;
130
+ /** In the order their prerequisites are met. */
131
+ readonly milestones: readonly DeliveryMilestone[];
132
+ /** Prerequisites first, ties by (milestone identity, task identity). */
133
+ readonly tasks: readonly DeliveryTask[];
134
+ readonly review: readonly ReviewItem[];
135
+ /** `ia position --seat <task> --shape sequence` for the first task in order with no declared blocker, else null. */
136
+ readonly next: string | null;
137
+ /** How many tasks have exit evidence, then the next task or why there is none. */
138
+ readonly summary: string;
139
+ }
140
+ export type DeliveryResult = {
141
+ readonly ok: true;
142
+ readonly view: DeliveryView;
143
+ } | NextRefusal;
144
+ /**
145
+ * The delivery view of one @plan in the scope `within`, or one refusal naming one next command. The seat is a @plan,
146
+ * @milestone or @task identity, read as its plan; without one, the plan is the only admitted @plan at band 100.
147
+ * IA-RUNTIME-NEXT-SEAT refuses a seat that is no admitted @plan, @milestone or @task; IA-RUNTIME-NEXT-NO-PLAN a seat
148
+ * that belongs to no admitted plan, or no seat and no authored plan; IA-RUNTIME-NEXT-AMBIGUOUS no seat and several
149
+ * authored plans; IA-RUNTIME-NEXT-CYCLE a plan whose `require` rows form a cycle, among tasks, milestones or both.
150
+ * Every read goes through `within`, but for the admission findings a whole-workspace `within` alone may disclose
151
+ * (db PT5), and nothing is written.
152
+ */
153
+ export declare function deliveryView(handle: ReadHandle, within: string, seat?: string): DeliveryResult;
154
+ //# sourceMappingURL=next.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"next.d.ts","sourceRoot":"","sources":["../src/next.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAa,MAAM,gBAAgB,CAAC;AAE5D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI/C;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,MAAM,QAAQ,GAAG,OAAO,CAAC,WAAW,EAAE,mBAAmB,MAAM,EAAE,CAAC,CAAC;AACzE,2FAA2F;AAC3F,eAAO,MAAM,UAAU,EAAE,SAAS,QAAQ,EAEzC,CAAC;AAEF,oHAAoH;AACpH,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AACD,MAAM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