@elaraai/e3-ui 1.0.4 → 1.0.6

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 (100) hide show
  1. package/README.md +3 -2
  2. package/dist/src/data.d.ts +22 -1
  3. package/dist/src/data.d.ts.map +1 -1
  4. package/dist/src/data.js.map +1 -1
  5. package/dist/src/decision/bind.d.ts +4594 -0
  6. package/dist/src/decision/bind.d.ts.map +1 -0
  7. package/dist/src/decision/bind.js +156 -0
  8. package/dist/src/decision/bind.js.map +1 -0
  9. package/dist/src/decision/index.d.ts +1787 -0
  10. package/dist/src/decision/index.d.ts.map +1 -0
  11. package/dist/src/decision/index.js +36 -0
  12. package/dist/src/decision/index.js.map +1 -0
  13. package/dist/src/decision/journal.d.ts +405 -0
  14. package/dist/src/decision/journal.d.ts.map +1 -0
  15. package/dist/src/decision/journal.js +74 -0
  16. package/dist/src/decision/journal.js.map +1 -0
  17. package/dist/src/decision/queue.d.ts +2876 -0
  18. package/dist/src/decision/queue.d.ts.map +1 -0
  19. package/dist/src/decision/queue.js +166 -0
  20. package/dist/src/decision/queue.js.map +1 -0
  21. package/dist/src/decision/types.d.ts +1338 -0
  22. package/dist/src/decision/types.d.ts.map +1 -0
  23. package/dist/src/decision/types.js +389 -0
  24. package/dist/src/decision/types.js.map +1 -0
  25. package/dist/src/diff.d.ts +72 -0
  26. package/dist/src/diff.d.ts.map +1 -1
  27. package/dist/src/diff.js +6 -0
  28. package/dist/src/diff.js.map +1 -1
  29. package/dist/src/index.d.ts +27 -11
  30. package/dist/src/index.d.ts.map +1 -1
  31. package/dist/src/index.js +30 -10
  32. package/dist/src/index.js.map +1 -1
  33. package/dist/src/internal.d.ts +28 -0
  34. package/dist/src/internal.d.ts.map +1 -0
  35. package/dist/src/internal.js +28 -0
  36. package/dist/src/internal.js.map +1 -0
  37. package/dist/src/ontology.d.ts +205 -10
  38. package/dist/src/ontology.d.ts.map +1 -1
  39. package/dist/src/ontology.js +23 -4
  40. package/dist/src/ontology.js.map +1 -1
  41. package/dist/src/runtime/decision/journal.d.ts +29 -0
  42. package/dist/src/runtime/decision/journal.d.ts.map +1 -0
  43. package/dist/src/runtime/decision/journal.js +27 -0
  44. package/dist/src/runtime/decision/journal.js.map +1 -0
  45. package/dist/src/runtime/decision/queue.d.ts +47 -0
  46. package/dist/src/runtime/decision/queue.d.ts.map +1 -0
  47. package/dist/src/runtime/decision/queue.js +45 -0
  48. package/dist/src/runtime/decision/queue.js.map +1 -0
  49. package/dist/src/runtime/diff.d.ts +36 -0
  50. package/dist/src/runtime/diff.d.ts.map +1 -0
  51. package/dist/src/runtime/diff.js +34 -0
  52. package/dist/src/runtime/diff.js.map +1 -0
  53. package/dist/src/runtime/index.d.ts +15 -0
  54. package/dist/src/runtime/index.d.ts.map +1 -0
  55. package/dist/src/runtime/index.js +15 -0
  56. package/dist/src/runtime/index.js.map +1 -0
  57. package/dist/src/runtime/ontology.d.ts +36 -0
  58. package/dist/src/runtime/ontology.d.ts.map +1 -0
  59. package/dist/src/runtime/ontology.js +34 -0
  60. package/dist/src/runtime/ontology.js.map +1 -0
  61. package/dist/src/runtime/runtime.d.ts +7 -0
  62. package/dist/src/runtime/runtime.d.ts.map +1 -0
  63. package/dist/src/runtime/runtime.js +7 -0
  64. package/dist/src/runtime/runtime.js.map +1 -0
  65. package/dist/src/ui.d.ts +6 -6
  66. package/dist/src/ui.d.ts.map +1 -1
  67. package/dist/src/ui.js +9 -1
  68. package/dist/src/ui.js.map +1 -1
  69. package/dist/test/{data.examples.d.ts → data/data.examples.d.ts} +1 -0
  70. package/dist/test/data/data.examples.d.ts.map +1 -0
  71. package/dist/test/{data.examples.js → data/data.examples.js} +30 -68
  72. package/dist/test/data/data.examples.js.map +1 -0
  73. package/dist/test/decision/journal.examples.d.ts +266 -0
  74. package/dist/test/decision/journal.examples.d.ts.map +1 -0
  75. package/dist/test/decision/journal.examples.js +107 -0
  76. package/dist/test/decision/journal.examples.js.map +1 -0
  77. package/dist/test/decision/loop.examples.d.ts +455 -0
  78. package/dist/test/decision/loop.examples.d.ts.map +1 -0
  79. package/dist/test/decision/loop.examples.js +120 -0
  80. package/dist/test/decision/loop.examples.js.map +1 -0
  81. package/dist/test/decision/queue.examples.d.ts +269 -0
  82. package/dist/test/decision/queue.examples.d.ts.map +1 -0
  83. package/dist/test/decision/queue.examples.js +273 -0
  84. package/dist/test/decision/queue.examples.js.map +1 -0
  85. package/dist/test/{diff.examples.d.ts → diff/diff.examples.d.ts} +5 -4
  86. package/dist/test/diff/diff.examples.d.ts.map +1 -0
  87. package/dist/test/diff/diff.examples.js +582 -0
  88. package/dist/test/diff/diff.examples.js.map +1 -0
  89. package/dist/test/{ontology.examples.d.ts → ontology/ontology.examples.d.ts} +6 -4
  90. package/dist/test/ontology/ontology.examples.d.ts.map +1 -0
  91. package/dist/test/{ontology.examples.js → ontology/ontology.examples.js} +37 -57
  92. package/dist/test/ontology/ontology.examples.js.map +1 -0
  93. package/package.json +19 -19
  94. package/dist/test/data.examples.d.ts.map +0 -1
  95. package/dist/test/data.examples.js.map +0 -1
  96. package/dist/test/diff.examples.d.ts.map +0 -1
  97. package/dist/test/diff.examples.js +0 -964
  98. package/dist/test/diff.examples.js.map +0 -1
  99. package/dist/test/ontology.examples.d.ts.map +0 -1
  100. package/dist/test/ontology.examples.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind.d.ts","sourceRoot":"","sources":["../../../src/decision/bind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAEH,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,EAGR,KAAK,QAAQ,EACb,KAAK,QAAQ,EACb,KAAK,kBAAkB,EAC1B,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAiB,MAAM,2BAA2B,CAAC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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAMlC,CAAC;AAMF;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,mBAAmB,CAAC,CAAC,SAAS,QAAQ,GAAG,sBAAsB;IAC5E,SAAS,EAAE,UAAU,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC;IACjD,UAAU,EAAE,UAAU,CAAC,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC7D,KAAK,CAAC,EAAE,kBAAkB,CAAC,cAAc,CAAC,CAAC;CAC9C;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB,GAAG,cAAc,CAAC;AAC3E,wBAAgB,YAAY,CAAC,CAAC,SAAS,QAAQ,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,mBAAmB,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,CAAC,CAAC,CAAC"}
@@ -0,0 +1,156 @@
1
+ /**
2
+ * Copyright (c) 2025 Elara AI Pty Ltd
3
+ * Dual-licensed under AGPL-3.0 and commercial license. See LICENSE for details.
4
+ */
5
+ /**
6
+ * `Decision.bind` — the per-surface decision handle (see
7
+ * `docs/decision-loop.md` and the `Decision.Handle` block in
8
+ * `design/decide.html`).
9
+ *
10
+ * Decisions arrive from multiple reasoning tasks, each bound with its own
11
+ * {@link Data.bind} diff view (read-only source ⊕ operator patch overlay);
12
+ * the operator's staged contribution is a judgements dict bound the same
13
+ * way. `Decision.bind` is a generic platform function over those bindings'
14
+ * descriptors — the `Data.bind` / `Slice.bind` pattern: the East layer
15
+ * declares the contract, the runtime (in `@elaraai/e3-ui-components`)
16
+ * implements the handle's closures. It adds only what no single binding
17
+ * can: the union of the decision views, write-routing by case id, the
18
+ * handle-owned case selection, and the derived commit gate.
19
+ *
20
+ * The type parameter is the solution's **constraint contract** — a by-name
21
+ * `VariantType` declared once in the solution package and imported by both
22
+ * the reasoning task (which `$.matchTag`s injected constraints, fully
23
+ * typed) and the surface. Pass it like `Data.bind`'s type token:
24
+ * `Decision.bind([RosterConstraint], { decisions, judgements })`; omit it
25
+ * for the default primitive op-variant.
26
+ *
27
+ * @packageDocumentation
28
+ */
29
+ import { East, ArrayType, DictType, OptionType, StructType, VariantType, FunctionType, StringType, IntegerType, NullType, some, none, } from '@elaraai/east';
30
+ import { SliceStateType, SliceBindType } from '@elaraai/east-ui/internal';
31
+ import { DiffBindingType } from '../data.js';
32
+ import { DecisionType, DecisionConstraintType, judgementInputType, AnswerType, VerdictType, } from './types.js';
33
+ // ============================================================================
34
+ // Commit state — derived per case, never stored.
35
+ // ============================================================================
36
+ /**
37
+ * The derived commit gate for one case — a pure function of the decision's
38
+ * `prompts` and the staged judgement's `answers`.
39
+ *
40
+ * @property gated - That many prompts are still unanswered; Apply disabled
41
+ * @property blocked - Some prompt was answered `no`; commit blocked
42
+ * @property handoff - Some prompt was answered `unknown`; the case routes to
43
+ * handoff
44
+ * @property ready - Every prompt answered `yes` (or the case has no
45
+ * prompts); Apply enabled
46
+ */
47
+ export const CommitStateType = VariantType({
48
+ gated: IntegerType,
49
+ blocked: NullType,
50
+ handoff: NullType,
51
+ ready: NullType,
52
+ });
53
+ // ============================================================================
54
+ // Handle type — generic over the solution's constraint contract.
55
+ // ============================================================================
56
+ /**
57
+ * Build the judgements dataset type for a constraint contract — staged
58
+ * judgements keyed by case id. Bind it with
59
+ * `Data.bind([Decision.Types.Judgements(Contract)], judgementsInput.path)`.
60
+ */
61
+ export function judgementsType(constraint) {
62
+ return DictType(StringType, judgementInputType(constraint));
63
+ }
64
+ /** The default judgements dataset type (primitive op-variant constraints). */
65
+ export const JudgementsType = judgementsType();
66
+ /**
67
+ * Build the decision-handle type for a constraint contract.
68
+ *
69
+ * The descriptor fields identify the underlying bindings (renderer
70
+ * subscriptions, provenance); the closures — implemented by the platform
71
+ * runtime, like `Data.bind`'s — are the only read/write paths, so the
72
+ * handle's semantics live once.
73
+ *
74
+ * @property decisions - Per-source binding descriptors
75
+ * @property judgements - The judgements binding descriptor
76
+ * @property sliceInit - The initial slice state passed at bind (data; feeds
77
+ * component payload refs)
78
+ * @property slice - The handle-owned slice over the unioned queue (canonical
79
+ * `DecisionType` config; key derived from the bound source paths, like the
80
+ * selection). Components mount its rail; seeding `slice` at bind with no
81
+ * rail mounted gives an invisible author scope.
82
+ * @property queue - The visible queue: union of every bound view (source ⊕
83
+ * patch each)
84
+ * @property selected - The selected case id, if any
85
+ * @property select - Open a case (Triage → Understand)
86
+ * @property clearSelection - Close the case without resolving
87
+ * @property decision - The selected case's decision, if it is still queued
88
+ * @property update - Probe edit: write an edited decision through its owning
89
+ * view's patch overlay (routed by `id`)
90
+ * @property judgement - The staged judgement for a case (a fresh empty one
91
+ * when nothing is staged yet)
92
+ * @property answer - Record the response to one judgement prompt (keyed by
93
+ * prompt id)
94
+ * @property addKnowledge - Record free-text context the model can't see
95
+ * @property inject - Stage a typed constraint (a contract-variant value;
96
+ * upserts by case name); the next optimiser run folds it in
97
+ * @property resolve - Commit a verdict: writes it to the judgement, removes
98
+ * the case through its owning patch overlay, clears the selection (closes
99
+ * the loop back to Triage)
100
+ * @property commitState - The derived commit gate for a case — see
101
+ * {@link CommitStateType}
102
+ */
103
+ export function decisionHandleType(constraint) {
104
+ const c = (constraint ?? DecisionConstraintType);
105
+ return StructType({
106
+ decisions: ArrayType(DiffBindingType),
107
+ judgements: DiffBindingType,
108
+ sliceInit: OptionType(SliceStateType),
109
+ slice: SliceBindType,
110
+ queue: FunctionType([], ArrayType(DecisionType)),
111
+ selected: FunctionType([], OptionType(StringType)),
112
+ select: FunctionType([StringType], NullType),
113
+ clearSelection: FunctionType([], NullType),
114
+ decision: FunctionType([], OptionType(DecisionType)),
115
+ update: FunctionType([DecisionType], NullType),
116
+ judgement: FunctionType([StringType], judgementInputType(c)),
117
+ answer: FunctionType([StringType, StringType, AnswerType], NullType),
118
+ addKnowledge: FunctionType([StringType, StringType], NullType),
119
+ inject: FunctionType([StringType, c], NullType),
120
+ resolve: FunctionType([StringType, VerdictType], NullType),
121
+ commitState: FunctionType([StringType], CommitStateType),
122
+ });
123
+ }
124
+ /** The default handle type (primitive op-variant constraints). */
125
+ export const DecisionHandleType = decisionHandleType();
126
+ /**
127
+ * The encodable identity of a handle — its binding descriptors. Extension
128
+ * component payloads are beast2-encoded, so they carry this ref (plain
129
+ * data); the renderer runtime reconstructs the live handle from it. The
130
+ * closure-rich handle itself never crosses an encoding boundary.
131
+ *
132
+ * @property decisions - Per-source binding descriptors
133
+ * @property judgements - The judgements binding descriptor
134
+ */
135
+ export const DecisionHandleRefType = StructType({
136
+ decisions: ArrayType(DiffBindingType),
137
+ judgements: DiffBindingType,
138
+ slice: OptionType(SliceStateType),
139
+ });
140
+ // ============================================================================
141
+ // Platform function — generic over the constraint contract.
142
+ // ============================================================================
143
+ /**
144
+ * The underlying `Decision.bind` platform-function definition. End-users
145
+ * call {@link decisionBind} (via `Decision.bind`); the runtime
146
+ * implementation registers against this raw definition in
147
+ * `@elaraai/e3-ui-components` via `decisionBindPlatformFn.implement(...)`.
148
+ */
149
+ export const decisionBindPlatformFn = East.genericPlatform("decision_bind", ["C"], [ArrayType(DiffBindingType), DiffBindingType, OptionType(SliceStateType)], decisionHandleType("C"), { optional: true });
150
+ export function decisionBind(typesOrOptions, maybeOptions) {
151
+ const [constraint, options] = maybeOptions !== undefined
152
+ ? [typesOrOptions[0], maybeOptions]
153
+ : [DecisionConstraintType, typesOrOptions];
154
+ return decisionBindPlatformFn([constraint], options.decisions.map(view => view.binding), options.judgements.binding, options.slice !== undefined ? some(East.value(options.slice, SliceStateType)) : none);
155
+ }
156
+ //# sourceMappingURL=bind.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bind.js","sourceRoot":"","sources":["../../../src/decision/bind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EACH,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,UAAU,EACV,UAAU,EACV,WAAW,EACX,YAAY,EACZ,UAAU,EACV,WAAW,EACX,QAAQ,EACR,IAAI,EACJ,IAAI,GAIP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAE1E,OAAO,EAAE,eAAe,EAAmB,MAAM,YAAY,CAAC;AAC9D,OAAO,EACH,YAAY,EACZ,sBAAsB,EACtB,kBAAkB,EAClB,UAAU,EACV,WAAW,GACd,MAAM,YAAY,CAAC;AAEpB,+EAA+E;AAC/E,iDAAiD;AACjD,+EAA+E;AAE/E;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAC;IACvC,KAAK,EAAE,WAAW;IAClB,OAAO,EAAE,QAAQ;IACjB,OAAO,EAAE,QAAQ;IACjB,KAAK,EAAE,QAAQ;CAClB,CAAC,CAAC;AAIH,+EAA+E;AAC/E,iEAAiE;AACjE,+EAA+E;AAE/E;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAA8C,UAAc;IACtF,OAAO,QAAQ,CAAC,UAAU,EAAE,kBAAkB,CAAC,UAAU,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,8EAA8E;AAC9E,MAAM,CAAC,MAAM,cAAc,GAAG,cAAc,EAAE,CAAC;AAI/C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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