@x12i/graphenix-executable-format 1.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 (252) hide show
  1. package/README.md +341 -0
  2. package/dist/adapter/build-graph-execution-request-from-studio-execute.d.ts +6 -0
  3. package/dist/adapter/build-graph-execution-request-from-studio-execute.d.ts.map +1 -0
  4. package/dist/adapter/build-graph-execution-request-from-studio-execute.js +41 -0
  5. package/dist/adapter/build-graph-execution-request-from-studio-execute.js.map +1 -0
  6. package/dist/api.d.ts +36 -0
  7. package/dist/api.d.ts.map +1 -0
  8. package/dist/api.js +99 -0
  9. package/dist/api.js.map +1 -0
  10. package/dist/case-condition/allowed-paths.d.ts +4 -0
  11. package/dist/case-condition/allowed-paths.d.ts.map +1 -0
  12. package/dist/case-condition/allowed-paths.js +74 -0
  13. package/dist/case-condition/allowed-paths.js.map +1 -0
  14. package/dist/case-condition/evaluate-case-condition.d.ts +4 -0
  15. package/dist/case-condition/evaluate-case-condition.d.ts.map +1 -0
  16. package/dist/case-condition/evaluate-case-condition.js +106 -0
  17. package/dist/case-condition/evaluate-case-condition.js.map +1 -0
  18. package/dist/case-condition/select-graph-model-case.d.ts +6 -0
  19. package/dist/case-condition/select-graph-model-case.d.ts.map +1 -0
  20. package/dist/case-condition/select-graph-model-case.js +40 -0
  21. package/dist/case-condition/select-graph-model-case.js.map +1 -0
  22. package/dist/case-condition/select-node-model-case.d.ts +4 -0
  23. package/dist/case-condition/select-node-model-case.d.ts.map +1 -0
  24. package/dist/case-condition/select-node-model-case.js +34 -0
  25. package/dist/case-condition/select-node-model-case.js.map +1 -0
  26. package/dist/case-condition/validate-case-condition.d.ts +5 -0
  27. package/dist/case-condition/validate-case-condition.d.ts.map +1 -0
  28. package/dist/case-condition/validate-case-condition.js +118 -0
  29. package/dist/case-condition/validate-case-condition.js.map +1 -0
  30. package/dist/compile/build-node-execution-units.d.ts +6 -0
  31. package/dist/compile/build-node-execution-units.d.ts.map +1 -0
  32. package/dist/compile/build-node-execution-units.js +77 -0
  33. package/dist/compile/build-node-execution-units.js.map +1 -0
  34. package/dist/compile/compile-executable-plan.d.ts +5 -0
  35. package/dist/compile/compile-executable-plan.d.ts.map +1 -0
  36. package/dist/compile/compile-executable-plan.js +142 -0
  37. package/dist/compile/compile-executable-plan.js.map +1 -0
  38. package/dist/constants.d.ts +12 -0
  39. package/dist/constants.d.ts.map +1 -0
  40. package/dist/constants.js +19 -0
  41. package/dist/constants.js.map +1 -0
  42. package/dist/explain/explain-executable-graph-error.d.ts +4 -0
  43. package/dist/explain/explain-executable-graph-error.d.ts.map +1 -0
  44. package/dist/explain/explain-executable-graph-error.js +14 -0
  45. package/dist/explain/explain-executable-graph-error.js.map +1 -0
  46. package/dist/explain/explain-node-inheritance.d.ts +3 -0
  47. package/dist/explain/explain-node-inheritance.d.ts.map +1 -0
  48. package/dist/explain/explain-node-inheritance.js +41 -0
  49. package/dist/explain/explain-node-inheritance.js.map +1 -0
  50. package/dist/fixtures/minimal-executable-graph.d.ts +4 -0
  51. package/dist/fixtures/minimal-executable-graph.d.ts.map +1 -0
  52. package/dist/fixtures/minimal-executable-graph.js +170 -0
  53. package/dist/fixtures/minimal-executable-graph.js.map +1 -0
  54. package/dist/helpers/add-finalizer-node.d.ts +5 -0
  55. package/dist/helpers/add-finalizer-node.d.ts.map +1 -0
  56. package/dist/helpers/add-finalizer-node.js +13 -0
  57. package/dist/helpers/add-finalizer-node.js.map +1 -0
  58. package/dist/helpers/add-task-node.d.ts +5 -0
  59. package/dist/helpers/add-task-node.d.ts.map +1 -0
  60. package/dist/helpers/add-task-node.js +13 -0
  61. package/dist/helpers/add-task-node.js.map +1 -0
  62. package/dist/helpers/connect-task-to-task.d.ts +10 -0
  63. package/dist/helpers/connect-task-to-task.d.ts.map +1 -0
  64. package/dist/helpers/connect-task-to-task.js +23 -0
  65. package/dist/helpers/connect-task-to-task.js.map +1 -0
  66. package/dist/helpers/set-graph-model-config.d.ts +5 -0
  67. package/dist/helpers/set-graph-model-config.d.ts.map +1 -0
  68. package/dist/helpers/set-graph-model-config.js +30 -0
  69. package/dist/helpers/set-graph-model-config.js.map +1 -0
  70. package/dist/helpers/set-node-model-config.d.ts +5 -0
  71. package/dist/helpers/set-node-model-config.d.ts.map +1 -0
  72. package/dist/helpers/set-node-model-config.js +25 -0
  73. package/dist/helpers/set-node-model-config.js.map +1 -0
  74. package/dist/index.d.ts +2 -0
  75. package/dist/index.d.ts.map +1 -0
  76. package/dist/index.js +18 -0
  77. package/dist/index.js.map +1 -0
  78. package/dist/internal/hash.d.ts +4 -0
  79. package/dist/internal/hash.d.ts.map +1 -0
  80. package/dist/internal/hash.js +26 -0
  81. package/dist/internal/hash.js.map +1 -0
  82. package/dist/internal/utils.d.ts +16 -0
  83. package/dist/internal/utils.d.ts.map +1 -0
  84. package/dist/internal/utils.js +80 -0
  85. package/dist/internal/utils.js.map +1 -0
  86. package/dist/migration/migrate-legacy-graph-model-object.d.ts +4 -0
  87. package/dist/migration/migrate-legacy-graph-model-object.d.ts.map +1 -0
  88. package/dist/migration/migrate-legacy-graph-model-object.js +217 -0
  89. package/dist/migration/migrate-legacy-graph-model-object.js.map +1 -0
  90. package/dist/normalize/normalize-executable-graph.d.ts +3 -0
  91. package/dist/normalize/normalize-executable-graph.d.ts.map +1 -0
  92. package/dist/normalize/normalize-executable-graph.js +34 -0
  93. package/dist/normalize/normalize-executable-graph.js.map +1 -0
  94. package/dist/normalize/normalize-model-config.d.ts +4 -0
  95. package/dist/normalize/normalize-model-config.d.ts.map +1 -0
  96. package/dist/normalize/normalize-model-config.js +64 -0
  97. package/dist/normalize/normalize-model-config.js.map +1 -0
  98. package/dist/profile-choice/known-profile-choices.d.ts +10 -0
  99. package/dist/profile-choice/known-profile-choices.d.ts.map +1 -0
  100. package/dist/profile-choice/known-profile-choices.js +19 -0
  101. package/dist/profile-choice/known-profile-choices.js.map +1 -0
  102. package/dist/profile-choice/validate-profile-choice.d.ts +8 -0
  103. package/dist/profile-choice/validate-profile-choice.d.ts.map +1 -0
  104. package/dist/profile-choice/validate-profile-choice.js +55 -0
  105. package/dist/profile-choice/validate-profile-choice.js.map +1 -0
  106. package/dist/resolution/build-deterministic-case-context.d.ts +9 -0
  107. package/dist/resolution/build-deterministic-case-context.d.ts.map +1 -0
  108. package/dist/resolution/build-deterministic-case-context.js +26 -0
  109. package/dist/resolution/build-deterministic-case-context.js.map +1 -0
  110. package/dist/resolution/resolve-graph-model-config.d.ts +12 -0
  111. package/dist/resolution/resolve-graph-model-config.d.ts.map +1 -0
  112. package/dist/resolution/resolve-graph-model-config.js +28 -0
  113. package/dist/resolution/resolve-graph-model-config.js.map +1 -0
  114. package/dist/resolution/resolve-node-ai-plan.d.ts +7 -0
  115. package/dist/resolution/resolve-node-ai-plan.d.ts.map +1 -0
  116. package/dist/resolution/resolve-node-ai-plan.js +64 -0
  117. package/dist/resolution/resolve-node-ai-plan.js.map +1 -0
  118. package/dist/resolution/resolve-node-model-config.d.ts +15 -0
  119. package/dist/resolution/resolve-node-model-config.d.ts.map +1 -0
  120. package/dist/resolution/resolve-node-model-config.js +37 -0
  121. package/dist/resolution/resolve-node-model-config.js.map +1 -0
  122. package/dist/resolution/resolve-node-model-slot.d.ts +7 -0
  123. package/dist/resolution/resolve-node-model-slot.d.ts.map +1 -0
  124. package/dist/resolution/resolve-node-model-slot.js +65 -0
  125. package/dist/resolution/resolve-node-model-slot.js.map +1 -0
  126. package/dist/test/executable-format.test.d.ts +2 -0
  127. package/dist/test/executable-format.test.d.ts.map +1 -0
  128. package/dist/test/executable-format.test.js +844 -0
  129. package/dist/test/executable-format.test.js.map +1 -0
  130. package/dist/trace/append-execution-event.d.ts +5 -0
  131. package/dist/trace/append-execution-event.d.ts.map +1 -0
  132. package/dist/trace/append-execution-event.js +9 -0
  133. package/dist/trace/append-execution-event.js.map +1 -0
  134. package/dist/trace/create-execution-trace.d.ts +5 -0
  135. package/dist/trace/create-execution-trace.d.ts.map +1 -0
  136. package/dist/trace/create-execution-trace.js +56 -0
  137. package/dist/trace/create-execution-trace.js.map +1 -0
  138. package/dist/types/case-condition.d.ts +50 -0
  139. package/dist/types/case-condition.d.ts.map +1 -0
  140. package/dist/types/case-condition.js +3 -0
  141. package/dist/types/case-condition.js.map +1 -0
  142. package/dist/types/errors.d.ts +16 -0
  143. package/dist/types/errors.d.ts.map +1 -0
  144. package/dist/types/errors.js +3 -0
  145. package/dist/types/errors.js.map +1 -0
  146. package/dist/types/executable-graph.d.ts +19 -0
  147. package/dist/types/executable-graph.d.ts.map +1 -0
  148. package/dist/types/executable-graph.js +3 -0
  149. package/dist/types/executable-graph.js.map +1 -0
  150. package/dist/types/executable-nodes.d.ts +54 -0
  151. package/dist/types/executable-nodes.d.ts.map +1 -0
  152. package/dist/types/executable-nodes.js +3 -0
  153. package/dist/types/executable-nodes.js.map +1 -0
  154. package/dist/types/executable-plan.d.ts +78 -0
  155. package/dist/types/executable-plan.d.ts.map +1 -0
  156. package/dist/types/executable-plan.js +5 -0
  157. package/dist/types/executable-plan.js.map +1 -0
  158. package/dist/types/executable-profile.d.ts +18 -0
  159. package/dist/types/executable-profile.d.ts.map +1 -0
  160. package/dist/types/executable-profile.js +3 -0
  161. package/dist/types/executable-profile.js.map +1 -0
  162. package/dist/types/execution-trace.d.ts +278 -0
  163. package/dist/types/execution-trace.d.ts.map +1 -0
  164. package/dist/types/execution-trace.js +5 -0
  165. package/dist/types/execution-trace.js.map +1 -0
  166. package/dist/types/execution-unit.d.ts +19 -0
  167. package/dist/types/execution-unit.d.ts.map +1 -0
  168. package/dist/types/execution-unit.js +3 -0
  169. package/dist/types/execution-unit.js.map +1 -0
  170. package/dist/types/index.d.ts +16 -0
  171. package/dist/types/index.d.ts.map +1 -0
  172. package/dist/types/index.js +8 -0
  173. package/dist/types/index.js.map +1 -0
  174. package/dist/types/legacy.d.ts +21 -0
  175. package/dist/types/legacy.d.ts.map +1 -0
  176. package/dist/types/legacy.js +3 -0
  177. package/dist/types/legacy.js.map +1 -0
  178. package/dist/types/model-config.d.ts +80 -0
  179. package/dist/types/model-config.d.ts.map +1 -0
  180. package/dist/types/model-config.js +3 -0
  181. package/dist/types/model-config.js.map +1 -0
  182. package/dist/types/resolution.d.ts +55 -0
  183. package/dist/types/resolution.d.ts.map +1 -0
  184. package/dist/types/resolution.js +3 -0
  185. package/dist/types/resolution.js.map +1 -0
  186. package/dist/types/runtime.d.ts +19 -0
  187. package/dist/types/runtime.d.ts.map +1 -0
  188. package/dist/types/runtime.js +3 -0
  189. package/dist/types/runtime.js.map +1 -0
  190. package/dist/types/studio-execute.d.ts +25 -0
  191. package/dist/types/studio-execute.d.ts.map +1 -0
  192. package/dist/types/studio-execute.js +3 -0
  193. package/dist/types/studio-execute.js.map +1 -0
  194. package/dist/validators/assert-executable-graph.d.ts +3 -0
  195. package/dist/validators/assert-executable-graph.d.ts.map +1 -0
  196. package/dist/validators/assert-executable-graph.js +14 -0
  197. package/dist/validators/assert-executable-graph.js.map +1 -0
  198. package/dist/validators/assert-normalized-executable-graph.d.ts +3 -0
  199. package/dist/validators/assert-normalized-executable-graph.d.ts.map +1 -0
  200. package/dist/validators/assert-normalized-executable-graph.js +14 -0
  201. package/dist/validators/assert-normalized-executable-graph.js.map +1 -0
  202. package/dist/validators/validate-authoring-executable-graph.d.ts +3 -0
  203. package/dist/validators/validate-authoring-executable-graph.d.ts.map +1 -0
  204. package/dist/validators/validate-authoring-executable-graph.js +134 -0
  205. package/dist/validators/validate-authoring-executable-graph.js.map +1 -0
  206. package/dist/validators/validate-authoring-graph.d.ts +2 -0
  207. package/dist/validators/validate-authoring-graph.d.ts.map +1 -0
  208. package/dist/validators/validate-authoring-graph.js +6 -0
  209. package/dist/validators/validate-authoring-graph.js.map +1 -0
  210. package/dist/validators/validate-executable-graph.d.ts +4 -0
  211. package/dist/validators/validate-executable-graph.d.ts.map +1 -0
  212. package/dist/validators/validate-executable-graph.js +9 -0
  213. package/dist/validators/validate-executable-graph.js.map +1 -0
  214. package/dist/validators/validate-executable-plan.d.ts +3 -0
  215. package/dist/validators/validate-executable-plan.d.ts.map +1 -0
  216. package/dist/validators/validate-executable-plan.js +211 -0
  217. package/dist/validators/validate-executable-plan.js.map +1 -0
  218. package/dist/validators/validate-execution-trace.d.ts +4 -0
  219. package/dist/validators/validate-execution-trace.d.ts.map +1 -0
  220. package/dist/validators/validate-execution-trace.js +158 -0
  221. package/dist/validators/validate-execution-trace.js.map +1 -0
  222. package/dist/validators/validate-finalizer-node.d.ts +4 -0
  223. package/dist/validators/validate-finalizer-node.d.ts.map +1 -0
  224. package/dist/validators/validate-finalizer-node.js +36 -0
  225. package/dist/validators/validate-finalizer-node.js.map +1 -0
  226. package/dist/validators/validate-model-config.d.ts +7 -0
  227. package/dist/validators/validate-model-config.d.ts.map +1 -0
  228. package/dist/validators/validate-model-config.js +197 -0
  229. package/dist/validators/validate-model-config.js.map +1 -0
  230. package/dist/validators/validate-normalized-executable-graph.d.ts +3 -0
  231. package/dist/validators/validate-normalized-executable-graph.d.ts.map +1 -0
  232. package/dist/validators/validate-normalized-executable-graph.js +26 -0
  233. package/dist/validators/validate-normalized-executable-graph.js.map +1 -0
  234. package/dist/validators/validate-runtime-object.d.ts +10 -0
  235. package/dist/validators/validate-runtime-object.d.ts.map +1 -0
  236. package/dist/validators/validate-runtime-object.js +63 -0
  237. package/dist/validators/validate-runtime-object.js.map +1 -0
  238. package/dist/validators/validate-studio-execute-request.d.ts +5 -0
  239. package/dist/validators/validate-studio-execute-request.d.ts.map +1 -0
  240. package/dist/validators/validate-studio-execute-request.js +37 -0
  241. package/dist/validators/validate-studio-execute-request.js.map +1 -0
  242. package/dist/validators/validate-task-actions.d.ts +4 -0
  243. package/dist/validators/validate-task-actions.d.ts.map +1 -0
  244. package/dist/validators/validate-task-actions.js +93 -0
  245. package/dist/validators/validate-task-actions.js.map +1 -0
  246. package/dist/validators/validate-task-node.d.ts +6 -0
  247. package/dist/validators/validate-task-node.d.ts.map +1 -0
  248. package/dist/validators/validate-task-node.js +43 -0
  249. package/dist/validators/validate-task-node.js.map +1 -0
  250. package/docs/IMPLEMENTATION-REPORT.md +200 -0
  251. package/package.json +56 -0
  252. package/schema/graphenix-executable-format-1.0.0.schema.json +40 -0
package/README.md ADDED
@@ -0,0 +1,341 @@
1
+ # @x12i/graphenix-executable-format
2
+
3
+ Strict **X12i executable graph profile** built on [`@x12i/graphenix-core`](../core), with deterministic model configuration cases validated against [`@x12i/ai-profiles`](https://www.npmjs.com/package/@x12i/ai-profiles).
4
+
5
+ Graphenix core defines the structural graph format. This package defines the X12i executable lifecycle: authoring graphs, compiled executable plans, execution traces, model inheritance, fallback, and the studio adapter.
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @x12i/graphenix-executable-format @x12i/graphenix-core
11
+ ```
12
+
13
+ `@x12i/ai-profiles` is installed automatically as a dependency (profile registry and `profileChoice` key validation).
14
+
15
+ ## Relationship
16
+
17
+ ```txt
18
+ @x12i/graphenix-core
19
+ generic graph document format (2.0.0)
20
+
21
+ @x12i/ai-profiles
22
+ profile/choice registry (cheap/default, vol/pro, deep/openai_deep, …)
23
+
24
+ @x12i/graphenix-executable-format
25
+ strict runnable profile + compile + trace
26
+ ```
27
+
28
+ A valid authoring graph is always a valid Graphenix document, but not every Graphenix document is executable.
29
+
30
+ ## Lifecycle artifacts
31
+
32
+ ```txt
33
+ AuthoringGraphDocument ← Studio saves this (source of truth)
34
+ ↓ compileExecutablePlan()
35
+ ExecutableGraphPlan ← Engine consumes this
36
+ ↓ executeGraph()
37
+ GraphExecutionTrace ← Append-only run evidence
38
+ ```
39
+
40
+ | Artifact | Purpose | Saved? | Used by engine? |
41
+ | -------- | ------- | -----: | --------------: |
42
+ | **AuthoringGraphDocument** | Human/studio source of truth | Yes | No, not directly |
43
+ | **ExecutableGraphPlan** | Normalized, deterministic, run-ready plan | Optional cache / per run | Yes |
44
+ | **GraphExecutionTrace** | What happened during one run | Yes, append-only | No |
45
+
46
+ ## Extension namespace
47
+
48
+ ```txt
49
+ graph.metadata.extensions["x12i.executable/v1"]
50
+ ```
51
+
52
+ ## Key rule: deterministic cases
53
+
54
+ ```txt
55
+ Cases may choose stronger or weaker AI profiles.
56
+ AI may not choose the case.
57
+ ```
58
+
59
+ Allowed case selectors:
60
+
61
+ ```txt
62
+ runtime.mode = "simulate"
63
+ runtime.input.riskLevel = "high"
64
+ runtime.environment = "prod"
65
+ runtime.input.analysisDepth = "deep"
66
+ ```
67
+
68
+ Forbidden:
69
+
70
+ ```txt
71
+ Ask AI whether input is high risk, then pick a model case
72
+ LLM classification as a case condition
73
+ semanticMatch / function / script selectors
74
+ node.output.* / ai.* / executionMemory.ai.*
75
+ ```
76
+
77
+ ## Profile choice format
78
+
79
+ Use explicit `profile/choice` composite keys from `@x12i/ai-profiles`:
80
+
81
+ ```json
82
+ {
83
+ "kind": "profileChoice",
84
+ "key": "vol/default"
85
+ }
86
+ ```
87
+
88
+ Examples: `cheap/default`, `sum/default`, `vol/default`, `vol/pro`, `deep/openai_deep`.
89
+
90
+ Rejected:
91
+
92
+ ```txt
93
+ kind: "profile" with bare names (economy, balanced)
94
+ bare keys (cheap, default, strong)
95
+ vendor slugs as profileChoice (openai/gpt-4o-mini → unknown key)
96
+ ```
97
+
98
+ Direct concrete model (separate from profiles):
99
+
100
+ ```json
101
+ {
102
+ "kind": "model",
103
+ "provider": "openai",
104
+ "modelId": "gpt-4o-mini"
105
+ }
106
+ ```
107
+
108
+ `profileChoice` is **not** resolved to vendor/model during normalization — only at invocation/planning via `@x12i/ai-profiles`.
109
+
110
+ ## Model configuration cases
111
+
112
+ ### Graph-level (`modelConfig`)
113
+
114
+ Authoring form may use `default` shorthand or explicit `cases[]`:
115
+
116
+ ```json
117
+ {
118
+ "version": "graph-model-config/v1",
119
+ "cases": [
120
+ {
121
+ "id": "default",
122
+ "modelConfig": {
123
+ "preActionModel": { "kind": "profileChoice", "key": "cheap/default" },
124
+ "skillModel": { "kind": "profileChoice", "key": "vol/default" },
125
+ "postActionModel": { "kind": "profileChoice", "key": "cheap/default" }
126
+ }
127
+ },
128
+ {
129
+ "id": "simulate",
130
+ "when": { "path": "runtime.mode", "op": "eq", "value": "simulate" },
131
+ "modelConfig": {
132
+ "preActionModel": { "kind": "profileChoice", "key": "cheap/default" },
133
+ "skillModel": { "kind": "profileChoice", "key": "sum/default" },
134
+ "postActionModel": { "kind": "profileChoice", "key": "cheap/default" }
135
+ }
136
+ }
137
+ ]
138
+ }
139
+ ```
140
+
141
+ Rules:
142
+
143
+ - Evaluate conditional cases in order; select the first match.
144
+ - If none match, use case `id: "default"`.
145
+ - Exactly one default graph case required.
146
+ - Every graph case must define the full triplet: `preActionModel`, `skillModel`, `postActionModel`.
147
+
148
+ ### Node-level (`taskConfiguration.modelConfig`)
149
+
150
+ Node cases may be partial when `inherit: true`. Missing slots inherit from the **selected graph case**.
151
+
152
+ ```json
153
+ {
154
+ "inherit": true,
155
+ "cases": [
156
+ {
157
+ "id": "high-risk-input",
158
+ "when": {
159
+ "path": "runtime.input.riskLevel",
160
+ "op": "eq",
161
+ "value": "high"
162
+ },
163
+ "modelConfig": {
164
+ "skillModel": { "kind": "profileChoice", "key": "deep/openai_deep" }
165
+ }
166
+ }
167
+ ]
168
+ }
169
+ ```
170
+
171
+ ## Case condition DSL
172
+
173
+ ```ts
174
+ type CaseCondition =
175
+ | { all: CaseCondition[] }
176
+ | { any: CaseCondition[] }
177
+ | { not: CaseCondition }
178
+ | {
179
+ path: string;
180
+ op: "eq" | "neq" | "in" | "notIn" | "exists" | "notExists"
181
+ | "gt" | "gte" | "lt" | "lte" | "matches";
182
+ value?: string | number | boolean | null | string[] | number[];
183
+ };
184
+ ```
185
+
186
+ Allowed path roots: `runtime.mode`, `runtime.environment`, `runtime.job.*`, `runtime.input.*`, `runtime.variables.*`, `runtime.flags.*`, `runtime.context.*`, `graph.id`, `graph.revision`.
187
+
188
+ ## Validate authoring graph
189
+
190
+ ```ts
191
+ import {
192
+ validateAuthoringGraph,
193
+ validateExecutableGraph,
194
+ createMinimalExecutableGraph
195
+ } from "@x12i/graphenix-executable-format";
196
+ import { validateGraph } from "@x12i/graphenix-core";
197
+
198
+ const doc = createMinimalExecutableGraph();
199
+
200
+ validateGraph(doc); // Graphenix structure
201
+ validateAuthoringGraph(doc); // authoring profile semantics
202
+ validateExecutableGraph(doc); // alias for authoring validation
203
+ ```
204
+
205
+ ## Normalize and preview resolution
206
+
207
+ ```ts
208
+ import {
209
+ normalizeExecutableGraph,
210
+ resolveNodeAiPlan,
211
+ explainNodeInheritance,
212
+ buildDeterministicCaseContext,
213
+ evaluateCaseCondition,
214
+ validateCaseCondition
215
+ } from "@x12i/graphenix-executable-format";
216
+
217
+ const normalized = normalizeExecutableGraph(doc); // non-mutating
218
+
219
+ const context = buildDeterministicCaseContext(doc, {
220
+ mode: "live",
221
+ input: { analysisDepth: "deep", riskLevel: "high" }
222
+ });
223
+
224
+ const plan = resolveNodeAiPlan(normalized, "node:professional-answer", context);
225
+ console.log(explainNodeInheritance(plan));
226
+ // Graph case selected: deep-live
227
+ // Node case selected: high-risk-input
228
+ // ...
229
+ ```
230
+
231
+ ## Compile executable plan
232
+
233
+ ```ts
234
+ import {
235
+ compileExecutablePlan,
236
+ validateExecutablePlan,
237
+ buildRuntimeObject
238
+ } from "@x12i/graphenix-executable-format";
239
+
240
+ const runtime = buildRuntimeObject({
241
+ jobId: "wg-1780698714844-8q8izhb",
242
+ mode: "live",
243
+ input: { analysisDepth: "deep" }
244
+ });
245
+
246
+ const plan = compileExecutablePlan(authoringGraph, runtime, {
247
+ profileRegistry: { version: "3.2.0" },
248
+ environment: "prod"
249
+ });
250
+
251
+ validateExecutablePlan(plan);
252
+ ```
253
+
254
+ Flow inside `compileExecutablePlan`:
255
+
256
+ ```txt
257
+ validateAuthoringExecutableGraph()
258
+ normalizeExecutableGraph()
259
+ assertNormalizedExecutableGraph()
260
+ selectGraphModelCase() → resolveNodeAiPlan() per task node
261
+ buildNodeExecutionUnits()
262
+ ```
263
+
264
+ The engine should consume only `ExecutableGraphPlan`.
265
+
266
+ ## Studio → engine adapter
267
+
268
+ ```ts
269
+ import { buildGraphExecutionRequestFromStudioExecute } from "@x12i/graphenix-executable-format";
270
+
271
+ const { plan, runtime } = buildGraphExecutionRequestFromStudioExecute(
272
+ studioRequest,
273
+ { agentId: "agent-1" }
274
+ );
275
+ ```
276
+
277
+ The engine receives only `{ plan, runtime }`. Credentials and request-level model defaults are never copied.
278
+
279
+ ## Model inheritance and fallback
280
+
281
+ - Graph-level `modelConfig` is **required** with a complete model triplet per case.
282
+ - Node overrides may be partial; missing slots inherit from the **selected graph case**.
283
+ - Fallback is same-slot only: `node.skillModel → graph.skillModel` from the selected graph case (never cross-slot, another case, or runtime defaults).
284
+
285
+ ## Execution trace
286
+
287
+ ```ts
288
+ import {
289
+ createExecutionTrace,
290
+ appendExecutionEvent,
291
+ validateExecutionTrace
292
+ } from "@x12i/graphenix-executable-format";
293
+
294
+ const trace = createExecutionTrace(plan, runtime);
295
+ const withStart = appendExecutionEvent(trace, {
296
+ id: "evt:1",
297
+ ts: new Date().toISOString(),
298
+ level: "info",
299
+ type: "graph.started",
300
+ message: "Graph execution started."
301
+ });
302
+
303
+ validateExecutionTrace(withStart, plan.nodePlans);
304
+ ```
305
+
306
+ ## Public APIs (case selection)
307
+
308
+ | API | Purpose |
309
+ | --- | ------- |
310
+ | `validateCaseCondition(condition)` | Validate deterministic `when` DSL |
311
+ | `evaluateCaseCondition(condition, context)` | Evaluate against runtime/graph context |
312
+ | `selectGraphModelCase(modelConfig, context)` | Pick graph case |
313
+ | `selectNodeModelCase(nodeModelConfig, context)` | Pick node case |
314
+ | `resolveNodeAiPlan(doc, nodeId, context)` | Full resolved plan with `caseSelection` |
315
+ | `isProfileChoiceKeyFormat(key)` | From `@x12i/ai-profiles` |
316
+ | `isKnownProfileChoice(key)` | Bundled registry lookup |
317
+
318
+ ## Node kinds
319
+
320
+ | Kind | Purpose |
321
+ | ---- | ------- |
322
+ | `x12i:task` | Run a skill with optional per-node model overrides and pre/post actions |
323
+ | `x12i:finalizer` | Produce final graph output |
324
+
325
+ ## Development
326
+
327
+ From monorepo root:
328
+
329
+ ```bash
330
+ npm install
331
+ npm run build --workspace=@x12i/graphenix-executable-format
332
+ npm run test --workspace=@x12i/graphenix-executable-format
333
+ ```
334
+
335
+ ## Schema
336
+
337
+ Profile JSON Schema fragment: `schema/graphenix-executable-format-1.0.0.schema.json` (structural subset; full semantics enforced by TypeScript validators).
338
+
339
+ ## Implementation report
340
+
341
+ See [`docs/IMPLEMENTATION-REPORT.md`](./docs/IMPLEMENTATION-REPORT.md) for the full CR/FR gap analysis and acceptance test matrix.
@@ -0,0 +1,6 @@
1
+ import type { GraphExecutionRequest, StudioGraphExecuteRequest } from "../types/studio-execute.js";
2
+ export declare function buildGraphExecutionRequestFromStudioExecute(request: StudioGraphExecuteRequest, options?: {
3
+ agentId?: string;
4
+ jobTypeId?: string;
5
+ }): GraphExecutionRequest;
6
+ //# sourceMappingURL=build-graph-execution-request-from-studio-execute.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-graph-execution-request-from-studio-execute.d.ts","sourceRoot":"","sources":["../../src/adapter/build-graph-execution-request-from-studio-execute.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,qBAAqB,EACrB,yBAAyB,EAC1B,MAAM,4BAA4B,CAAC;AAMpC,wBAAgB,2CAA2C,CACzD,OAAO,EAAE,yBAAyB,EAClC,OAAO,GAAE;IACP,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACf,GACL,qBAAqB,CAyCvB"}
@@ -0,0 +1,41 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildGraphExecutionRequestFromStudioExecute = buildGraphExecutionRequestFromStudioExecute;
4
+ const validate_studio_execute_request_js_1 = require("../validators/validate-studio-execute-request.js");
5
+ const validate_runtime_object_js_1 = require("../validators/validate-runtime-object.js");
6
+ const compile_executable_plan_js_1 = require("../compile/compile-executable-plan.js");
7
+ const validate_executable_plan_js_1 = require("../validators/validate-executable-plan.js");
8
+ function buildGraphExecutionRequestFromStudioExecute(request, options = {}) {
9
+ const validation = (0, validate_studio_execute_request_js_1.validateStudioExecuteRequest)(request);
10
+ if (!validation.valid) {
11
+ const summary = validation.errors
12
+ .map((error) => `${error.path}: ${error.message}`)
13
+ .join("; ");
14
+ throw new Error(`Invalid studio execute request: ${summary}`);
15
+ }
16
+ const runtime = (0, validate_runtime_object_js_1.buildRuntimeObject)({
17
+ jobId: request.jobId,
18
+ input: request.runtime?.input,
19
+ mode: request.graphExecution?.mode ?? request.runtime?.mode,
20
+ runLogMode: request.runLogMode ?? request.runtime?.runLogMode,
21
+ maxRunLogEntries: request.maxRunLogEntries ?? request.runtime?.maxRunLogEntries,
22
+ maxRunLogDataJsonChars: request.maxRunLogDataJsonChars ??
23
+ request.runtime?.maxRunLogDataJsonChars,
24
+ runTaskDiagnostics: request.runTaskDiagnostics ?? request.runtime?.runTaskDiagnostics,
25
+ variables: request.runtime?.variables,
26
+ job: request.runtime?.job
27
+ }, options);
28
+ const plan = (0, compile_executable_plan_js_1.compileExecutablePlan)(request.graph, runtime);
29
+ const planValidation = (0, validate_executable_plan_js_1.validateExecutablePlan)(plan);
30
+ if (!planValidation.valid) {
31
+ const summary = planValidation.errors
32
+ .map((error) => `${error.path}: ${error.message}`)
33
+ .join("; ");
34
+ throw new Error(`Invalid executable plan: ${summary}`);
35
+ }
36
+ return {
37
+ plan,
38
+ runtime
39
+ };
40
+ }
41
+ //# sourceMappingURL=build-graph-execution-request-from-studio-execute.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-graph-execution-request-from-studio-execute.js","sourceRoot":"","sources":["../../src/adapter/build-graph-execution-request-from-studio-execute.ts"],"names":[],"mappings":";;AASA,kGA+CC;AApDD,yGAAgG;AAChG,yFAA8E;AAC9E,sFAA8E;AAC9E,2FAAmF;AAEnF,SAAgB,2CAA2C,CACzD,OAAkC,EAClC,UAGI,EAAE;IAEN,MAAM,UAAU,GAAG,IAAA,iEAA4B,EAAC,OAAO,CAAC,CAAC;IACzD,IAAI,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC;QACtB,MAAM,OAAO,GAAG,UAAU,CAAC,MAAM;aAC9B,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aACjD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,mCAAmC,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED,MAAM,OAAO,GAAG,IAAA,+CAAkB,EAChC;QACE,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE,KAAK;QAC7B,IAAI,EAAE,OAAO,CAAC,cAAc,EAAE,IAAI,IAAI,OAAO,CAAC,OAAO,EAAE,IAAI;QAC3D,UAAU,EAAE,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU;QAC7D,gBAAgB,EACd,OAAO,CAAC,gBAAgB,IAAI,OAAO,CAAC,OAAO,EAAE,gBAAgB;QAC/D,sBAAsB,EACpB,OAAO,CAAC,sBAAsB;YAC9B,OAAO,CAAC,OAAO,EAAE,sBAAsB;QACzC,kBAAkB,EAChB,OAAO,CAAC,kBAAkB,IAAI,OAAO,CAAC,OAAO,EAAE,kBAAkB;QACnE,SAAS,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS;QACrC,GAAG,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG;KAC1B,EACD,OAAO,CACR,CAAC;IAEF,MAAM,IAAI,GAAG,IAAA,kDAAqB,EAAC,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,IAAA,oDAAsB,EAAC,IAAI,CAAC,CAAC;IACpD,IAAI,CAAC,cAAc,CAAC,KAAK,EAAE,CAAC;QAC1B,MAAM,OAAO,GAAG,cAAc,CAAC,MAAM;aAClC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,IAAI,KAAK,KAAK,CAAC,OAAO,EAAE,CAAC;aACjD,IAAI,CAAC,IAAI,CAAC,CAAC;QACd,MAAM,IAAI,KAAK,CAAC,4BAA4B,OAAO,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,OAAO;QACL,IAAI;QACJ,OAAO;KACR,CAAC;AACJ,CAAC"}
package/dist/api.d.ts ADDED
@@ -0,0 +1,36 @@
1
+ export { EXECUTABLE_PROFILE_NAMESPACE } from "./constants.js";
2
+ export { assertExecutableGraph } from "./validators/assert-executable-graph.js";
3
+ export { validateExecutableGraph } from "./validators/validate-executable-graph.js";
4
+ export { validateAuthoringExecutableGraph } from "./validators/validate-authoring-executable-graph.js";
5
+ export { validateAuthoringGraph } from "./validators/validate-authoring-graph.js";
6
+ export { validateExecutablePlan } from "./validators/validate-executable-plan.js";
7
+ export { validateExecutionTrace } from "./validators/validate-execution-trace.js";
8
+ export { validateNormalizedExecutableGraph } from "./validators/validate-normalized-executable-graph.js";
9
+ export { assertNormalizedExecutableGraph } from "./validators/assert-normalized-executable-graph.js";
10
+ export { validateStudioExecuteRequest } from "./validators/validate-studio-execute-request.js";
11
+ export { validateRuntimeObject, buildRuntimeObject } from "./validators/validate-runtime-object.js";
12
+ export { buildGraphExecutionRequestFromStudioExecute } from "./adapter/build-graph-execution-request-from-studio-execute.js";
13
+ export { normalizeExecutableGraph } from "./normalize/normalize-executable-graph.js";
14
+ export { compileExecutablePlan } from "./compile/compile-executable-plan.js";
15
+ export { createExecutionTrace } from "./trace/create-execution-trace.js";
16
+ export { appendExecutionEvent } from "./trace/append-execution-event.js";
17
+ export { resolveGraphModelConfig, selectGraphModelCase } from "./resolution/resolve-graph-model-config.js";
18
+ export { resolveNodeModelConfig, selectNodeModelCase } from "./resolution/resolve-node-model-config.js";
19
+ export { resolveNodeModelSlot } from "./resolution/resolve-node-model-slot.js";
20
+ export { resolveNodeAiPlan, resolveAllNodeAiPlans } from "./resolution/resolve-node-ai-plan.js";
21
+ export { buildDeterministicCaseContext } from "./resolution/build-deterministic-case-context.js";
22
+ export { validateCaseCondition } from "./case-condition/validate-case-condition.js";
23
+ export { evaluateCaseCondition } from "./case-condition/evaluate-case-condition.js";
24
+ export { isProfileChoiceKeyFormat, isKnownProfileChoice, KNOWN_PROFILE_CHOICE_KEYS } from "./profile-choice/known-profile-choices.js";
25
+ export { explainNodeInheritance } from "./explain/explain-node-inheritance.js";
26
+ export { explainExecutableGraphError, explainExecutableGraphErrors } from "./explain/explain-executable-graph-error.js";
27
+ export { migrateLegacyGraphModelObjectToGraphenixExecutable } from "./migration/migrate-legacy-graph-model-object.js";
28
+ export { isExecutableTaskNode, isExecutableFinalizerNode, getExecutableProfile, getTaskNodeConfig, getFinalizerNodeConfig } from "./internal/utils.js";
29
+ export { addTaskNode } from "./helpers/add-task-node.js";
30
+ export { addFinalizerNode } from "./helpers/add-finalizer-node.js";
31
+ export { setGraphModelConfig } from "./helpers/set-graph-model-config.js";
32
+ export { setNodeModelConfig } from "./helpers/set-node-model-config.js";
33
+ export { connectTaskToTask } from "./helpers/connect-task-to-task.js";
34
+ export { createMinimalExecutableGraph, createPlainGraphenixGraph } from "./fixtures/minimal-executable-graph.js";
35
+ export * from "./types/index.js";
36
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gBAAgB,CAAC;AAE9D,OAAO,EACL,qBAAqB,EACtB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,uBAAuB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,gCAAgC,EAAE,MAAM,qDAAqD,CAAC;AACvG,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,iCAAiC,EAAE,MAAM,sDAAsD,CAAC;AACzG,OAAO,EAAE,+BAA+B,EAAE,MAAM,oDAAoD,CAAC;AACrG,OAAO,EAAE,4BAA4B,EAAE,MAAM,iDAAiD,CAAC;AAC/F,OAAO,EACL,qBAAqB,EACrB,kBAAkB,EACnB,MAAM,yCAAyC,CAAC;AAEjD,OAAO,EAAE,2CAA2C,EAAE,MAAM,gEAAgE,CAAC;AAE7H,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAC7E,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAEzE,OAAO,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAC3G,OAAO,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,2CAA2C,CAAC;AACxG,OAAO,EAAE,oBAAoB,EAAE,MAAM,yCAAyC,CAAC;AAC/E,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,6BAA6B,EAAE,MAAM,kDAAkD,CAAC;AAEjG,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAEpF,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,yBAAyB,EAC1B,MAAM,2CAA2C,CAAC;AAEnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAC/E,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC7B,MAAM,6CAA6C,CAAC;AAErD,OAAO,EAAE,kDAAkD,EAAE,MAAM,kDAAkD,CAAC;AAEtH,OAAO,EACL,oBAAoB,EACpB,yBAAyB,EACzB,oBAAoB,EACpB,iBAAiB,EACjB,sBAAsB,EACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACnE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,oCAAoC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAEtE,OAAO,EACL,4BAA4B,EAC5B,yBAAyB,EAC1B,MAAM,wCAAwC,CAAC;AAEhD,cAAc,kBAAkB,CAAC"}
package/dist/api.js ADDED
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ exports.createPlainGraphenixGraph = exports.createMinimalExecutableGraph = exports.connectTaskToTask = exports.setNodeModelConfig = exports.setGraphModelConfig = exports.addFinalizerNode = exports.addTaskNode = exports.getFinalizerNodeConfig = exports.getTaskNodeConfig = exports.getExecutableProfile = exports.isExecutableFinalizerNode = exports.isExecutableTaskNode = exports.migrateLegacyGraphModelObjectToGraphenixExecutable = exports.explainExecutableGraphErrors = exports.explainExecutableGraphError = exports.explainNodeInheritance = exports.KNOWN_PROFILE_CHOICE_KEYS = exports.isKnownProfileChoice = exports.isProfileChoiceKeyFormat = exports.evaluateCaseCondition = exports.validateCaseCondition = exports.buildDeterministicCaseContext = exports.resolveAllNodeAiPlans = exports.resolveNodeAiPlan = exports.resolveNodeModelSlot = exports.selectNodeModelCase = exports.resolveNodeModelConfig = exports.selectGraphModelCase = exports.resolveGraphModelConfig = exports.appendExecutionEvent = exports.createExecutionTrace = exports.compileExecutablePlan = exports.normalizeExecutableGraph = exports.buildGraphExecutionRequestFromStudioExecute = exports.buildRuntimeObject = exports.validateRuntimeObject = exports.validateStudioExecuteRequest = exports.assertNormalizedExecutableGraph = exports.validateNormalizedExecutableGraph = exports.validateExecutionTrace = exports.validateExecutablePlan = exports.validateAuthoringGraph = exports.validateAuthoringExecutableGraph = exports.validateExecutableGraph = exports.assertExecutableGraph = exports.EXECUTABLE_PROFILE_NAMESPACE = void 0;
18
+ var constants_js_1 = require("./constants.js");
19
+ Object.defineProperty(exports, "EXECUTABLE_PROFILE_NAMESPACE", { enumerable: true, get: function () { return constants_js_1.EXECUTABLE_PROFILE_NAMESPACE; } });
20
+ var assert_executable_graph_js_1 = require("./validators/assert-executable-graph.js");
21
+ Object.defineProperty(exports, "assertExecutableGraph", { enumerable: true, get: function () { return assert_executable_graph_js_1.assertExecutableGraph; } });
22
+ var validate_executable_graph_js_1 = require("./validators/validate-executable-graph.js");
23
+ Object.defineProperty(exports, "validateExecutableGraph", { enumerable: true, get: function () { return validate_executable_graph_js_1.validateExecutableGraph; } });
24
+ var validate_authoring_executable_graph_js_1 = require("./validators/validate-authoring-executable-graph.js");
25
+ Object.defineProperty(exports, "validateAuthoringExecutableGraph", { enumerable: true, get: function () { return validate_authoring_executable_graph_js_1.validateAuthoringExecutableGraph; } });
26
+ var validate_authoring_graph_js_1 = require("./validators/validate-authoring-graph.js");
27
+ Object.defineProperty(exports, "validateAuthoringGraph", { enumerable: true, get: function () { return validate_authoring_graph_js_1.validateAuthoringGraph; } });
28
+ var validate_executable_plan_js_1 = require("./validators/validate-executable-plan.js");
29
+ Object.defineProperty(exports, "validateExecutablePlan", { enumerable: true, get: function () { return validate_executable_plan_js_1.validateExecutablePlan; } });
30
+ var validate_execution_trace_js_1 = require("./validators/validate-execution-trace.js");
31
+ Object.defineProperty(exports, "validateExecutionTrace", { enumerable: true, get: function () { return validate_execution_trace_js_1.validateExecutionTrace; } });
32
+ var validate_normalized_executable_graph_js_1 = require("./validators/validate-normalized-executable-graph.js");
33
+ Object.defineProperty(exports, "validateNormalizedExecutableGraph", { enumerable: true, get: function () { return validate_normalized_executable_graph_js_1.validateNormalizedExecutableGraph; } });
34
+ var assert_normalized_executable_graph_js_1 = require("./validators/assert-normalized-executable-graph.js");
35
+ Object.defineProperty(exports, "assertNormalizedExecutableGraph", { enumerable: true, get: function () { return assert_normalized_executable_graph_js_1.assertNormalizedExecutableGraph; } });
36
+ var validate_studio_execute_request_js_1 = require("./validators/validate-studio-execute-request.js");
37
+ Object.defineProperty(exports, "validateStudioExecuteRequest", { enumerable: true, get: function () { return validate_studio_execute_request_js_1.validateStudioExecuteRequest; } });
38
+ var validate_runtime_object_js_1 = require("./validators/validate-runtime-object.js");
39
+ Object.defineProperty(exports, "validateRuntimeObject", { enumerable: true, get: function () { return validate_runtime_object_js_1.validateRuntimeObject; } });
40
+ Object.defineProperty(exports, "buildRuntimeObject", { enumerable: true, get: function () { return validate_runtime_object_js_1.buildRuntimeObject; } });
41
+ var build_graph_execution_request_from_studio_execute_js_1 = require("./adapter/build-graph-execution-request-from-studio-execute.js");
42
+ Object.defineProperty(exports, "buildGraphExecutionRequestFromStudioExecute", { enumerable: true, get: function () { return build_graph_execution_request_from_studio_execute_js_1.buildGraphExecutionRequestFromStudioExecute; } });
43
+ var normalize_executable_graph_js_1 = require("./normalize/normalize-executable-graph.js");
44
+ Object.defineProperty(exports, "normalizeExecutableGraph", { enumerable: true, get: function () { return normalize_executable_graph_js_1.normalizeExecutableGraph; } });
45
+ var compile_executable_plan_js_1 = require("./compile/compile-executable-plan.js");
46
+ Object.defineProperty(exports, "compileExecutablePlan", { enumerable: true, get: function () { return compile_executable_plan_js_1.compileExecutablePlan; } });
47
+ var create_execution_trace_js_1 = require("./trace/create-execution-trace.js");
48
+ Object.defineProperty(exports, "createExecutionTrace", { enumerable: true, get: function () { return create_execution_trace_js_1.createExecutionTrace; } });
49
+ var append_execution_event_js_1 = require("./trace/append-execution-event.js");
50
+ Object.defineProperty(exports, "appendExecutionEvent", { enumerable: true, get: function () { return append_execution_event_js_1.appendExecutionEvent; } });
51
+ var resolve_graph_model_config_js_1 = require("./resolution/resolve-graph-model-config.js");
52
+ Object.defineProperty(exports, "resolveGraphModelConfig", { enumerable: true, get: function () { return resolve_graph_model_config_js_1.resolveGraphModelConfig; } });
53
+ Object.defineProperty(exports, "selectGraphModelCase", { enumerable: true, get: function () { return resolve_graph_model_config_js_1.selectGraphModelCase; } });
54
+ var resolve_node_model_config_js_1 = require("./resolution/resolve-node-model-config.js");
55
+ Object.defineProperty(exports, "resolveNodeModelConfig", { enumerable: true, get: function () { return resolve_node_model_config_js_1.resolveNodeModelConfig; } });
56
+ Object.defineProperty(exports, "selectNodeModelCase", { enumerable: true, get: function () { return resolve_node_model_config_js_1.selectNodeModelCase; } });
57
+ var resolve_node_model_slot_js_1 = require("./resolution/resolve-node-model-slot.js");
58
+ Object.defineProperty(exports, "resolveNodeModelSlot", { enumerable: true, get: function () { return resolve_node_model_slot_js_1.resolveNodeModelSlot; } });
59
+ var resolve_node_ai_plan_js_1 = require("./resolution/resolve-node-ai-plan.js");
60
+ Object.defineProperty(exports, "resolveNodeAiPlan", { enumerable: true, get: function () { return resolve_node_ai_plan_js_1.resolveNodeAiPlan; } });
61
+ Object.defineProperty(exports, "resolveAllNodeAiPlans", { enumerable: true, get: function () { return resolve_node_ai_plan_js_1.resolveAllNodeAiPlans; } });
62
+ var build_deterministic_case_context_js_1 = require("./resolution/build-deterministic-case-context.js");
63
+ Object.defineProperty(exports, "buildDeterministicCaseContext", { enumerable: true, get: function () { return build_deterministic_case_context_js_1.buildDeterministicCaseContext; } });
64
+ var validate_case_condition_js_1 = require("./case-condition/validate-case-condition.js");
65
+ Object.defineProperty(exports, "validateCaseCondition", { enumerable: true, get: function () { return validate_case_condition_js_1.validateCaseCondition; } });
66
+ var evaluate_case_condition_js_1 = require("./case-condition/evaluate-case-condition.js");
67
+ Object.defineProperty(exports, "evaluateCaseCondition", { enumerable: true, get: function () { return evaluate_case_condition_js_1.evaluateCaseCondition; } });
68
+ var known_profile_choices_js_1 = require("./profile-choice/known-profile-choices.js");
69
+ Object.defineProperty(exports, "isProfileChoiceKeyFormat", { enumerable: true, get: function () { return known_profile_choices_js_1.isProfileChoiceKeyFormat; } });
70
+ Object.defineProperty(exports, "isKnownProfileChoice", { enumerable: true, get: function () { return known_profile_choices_js_1.isKnownProfileChoice; } });
71
+ Object.defineProperty(exports, "KNOWN_PROFILE_CHOICE_KEYS", { enumerable: true, get: function () { return known_profile_choices_js_1.KNOWN_PROFILE_CHOICE_KEYS; } });
72
+ var explain_node_inheritance_js_1 = require("./explain/explain-node-inheritance.js");
73
+ Object.defineProperty(exports, "explainNodeInheritance", { enumerable: true, get: function () { return explain_node_inheritance_js_1.explainNodeInheritance; } });
74
+ var explain_executable_graph_error_js_1 = require("./explain/explain-executable-graph-error.js");
75
+ Object.defineProperty(exports, "explainExecutableGraphError", { enumerable: true, get: function () { return explain_executable_graph_error_js_1.explainExecutableGraphError; } });
76
+ Object.defineProperty(exports, "explainExecutableGraphErrors", { enumerable: true, get: function () { return explain_executable_graph_error_js_1.explainExecutableGraphErrors; } });
77
+ var migrate_legacy_graph_model_object_js_1 = require("./migration/migrate-legacy-graph-model-object.js");
78
+ Object.defineProperty(exports, "migrateLegacyGraphModelObjectToGraphenixExecutable", { enumerable: true, get: function () { return migrate_legacy_graph_model_object_js_1.migrateLegacyGraphModelObjectToGraphenixExecutable; } });
79
+ var utils_js_1 = require("./internal/utils.js");
80
+ Object.defineProperty(exports, "isExecutableTaskNode", { enumerable: true, get: function () { return utils_js_1.isExecutableTaskNode; } });
81
+ Object.defineProperty(exports, "isExecutableFinalizerNode", { enumerable: true, get: function () { return utils_js_1.isExecutableFinalizerNode; } });
82
+ Object.defineProperty(exports, "getExecutableProfile", { enumerable: true, get: function () { return utils_js_1.getExecutableProfile; } });
83
+ Object.defineProperty(exports, "getTaskNodeConfig", { enumerable: true, get: function () { return utils_js_1.getTaskNodeConfig; } });
84
+ Object.defineProperty(exports, "getFinalizerNodeConfig", { enumerable: true, get: function () { return utils_js_1.getFinalizerNodeConfig; } });
85
+ var add_task_node_js_1 = require("./helpers/add-task-node.js");
86
+ Object.defineProperty(exports, "addTaskNode", { enumerable: true, get: function () { return add_task_node_js_1.addTaskNode; } });
87
+ var add_finalizer_node_js_1 = require("./helpers/add-finalizer-node.js");
88
+ Object.defineProperty(exports, "addFinalizerNode", { enumerable: true, get: function () { return add_finalizer_node_js_1.addFinalizerNode; } });
89
+ var set_graph_model_config_js_1 = require("./helpers/set-graph-model-config.js");
90
+ Object.defineProperty(exports, "setGraphModelConfig", { enumerable: true, get: function () { return set_graph_model_config_js_1.setGraphModelConfig; } });
91
+ var set_node_model_config_js_1 = require("./helpers/set-node-model-config.js");
92
+ Object.defineProperty(exports, "setNodeModelConfig", { enumerable: true, get: function () { return set_node_model_config_js_1.setNodeModelConfig; } });
93
+ var connect_task_to_task_js_1 = require("./helpers/connect-task-to-task.js");
94
+ Object.defineProperty(exports, "connectTaskToTask", { enumerable: true, get: function () { return connect_task_to_task_js_1.connectTaskToTask; } });
95
+ var minimal_executable_graph_js_1 = require("./fixtures/minimal-executable-graph.js");
96
+ Object.defineProperty(exports, "createMinimalExecutableGraph", { enumerable: true, get: function () { return minimal_executable_graph_js_1.createMinimalExecutableGraph; } });
97
+ Object.defineProperty(exports, "createPlainGraphenixGraph", { enumerable: true, get: function () { return minimal_executable_graph_js_1.createPlainGraphenixGraph; } });
98
+ __exportStar(require("./types/index.js"), exports);
99
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,+CAA8D;AAArD,4HAAA,4BAA4B,OAAA;AAErC,sFAEiD;AAD/C,mIAAA,qBAAqB,OAAA;AAEvB,0FAAoF;AAA3E,uIAAA,uBAAuB,OAAA;AAChC,8GAAuG;AAA9F,0JAAA,gCAAgC,OAAA;AACzC,wFAAkF;AAAzE,qIAAA,sBAAsB,OAAA;AAC/B,wFAAkF;AAAzE,qIAAA,sBAAsB,OAAA;AAC/B,wFAAkF;AAAzE,qIAAA,sBAAsB,OAAA;AAC/B,gHAAyG;AAAhG,4JAAA,iCAAiC,OAAA;AAC1C,4GAAqG;AAA5F,wJAAA,+BAA+B,OAAA;AACxC,sGAA+F;AAAtF,kJAAA,4BAA4B,OAAA;AACrC,sFAGiD;AAF/C,mIAAA,qBAAqB,OAAA;AACrB,gIAAA,kBAAkB,OAAA;AAGpB,uIAA6H;AAApH,mLAAA,2CAA2C,OAAA;AAEpD,2FAAqF;AAA5E,yIAAA,wBAAwB,OAAA;AACjC,mFAA6E;AAApE,mIAAA,qBAAqB,OAAA;AAC9B,+EAAyE;AAAhE,iIAAA,oBAAoB,OAAA;AAC7B,+EAAyE;AAAhE,iIAAA,oBAAoB,OAAA;AAE7B,4FAA2G;AAAlG,wIAAA,uBAAuB,OAAA;AAAE,qIAAA,oBAAoB,OAAA;AACtD,0FAAwG;AAA/F,sIAAA,sBAAsB,OAAA;AAAE,mIAAA,mBAAmB,OAAA;AACpD,sFAA+E;AAAtE,kIAAA,oBAAoB,OAAA;AAC7B,gFAG8C;AAF5C,4HAAA,iBAAiB,OAAA;AACjB,gIAAA,qBAAqB,OAAA;AAEvB,wGAAiG;AAAxF,oJAAA,6BAA6B,OAAA;AAEtC,0FAAoF;AAA3E,mIAAA,qBAAqB,OAAA;AAC9B,0FAAoF;AAA3E,mIAAA,qBAAqB,OAAA;AAE9B,sFAImD;AAHjD,oIAAA,wBAAwB,OAAA;AACxB,gIAAA,oBAAoB,OAAA;AACpB,qIAAA,yBAAyB,OAAA;AAG3B,qFAA+E;AAAtE,qIAAA,sBAAsB,OAAA;AAC/B,iGAGqD;AAFnD,gJAAA,2BAA2B,OAAA;AAC3B,iJAAA,4BAA4B,OAAA;AAG9B,yGAAsH;AAA7G,0KAAA,kDAAkD,OAAA;AAE3D,gDAM6B;AAL3B,gHAAA,oBAAoB,OAAA;AACpB,qHAAA,yBAAyB,OAAA;AACzB,gHAAA,oBAAoB,OAAA;AACpB,6GAAA,iBAAiB,OAAA;AACjB,kHAAA,sBAAsB,OAAA;AAGxB,+DAAyD;AAAhD,+GAAA,WAAW,OAAA;AACpB,yEAAmE;AAA1D,yHAAA,gBAAgB,OAAA;AACzB,iFAA0E;AAAjE,gIAAA,mBAAmB,OAAA;AAC5B,+EAAwE;AAA/D,8HAAA,kBAAkB,OAAA;AAC3B,6EAAsE;AAA7D,4HAAA,iBAAiB,OAAA;AAE1B,sFAGgD;AAF9C,2IAAA,4BAA4B,OAAA;AAC5B,wIAAA,yBAAyB,OAAA;AAG3B,mDAAiC"}
@@ -0,0 +1,4 @@
1
+ export declare function isForbiddenCaseSelectorKey(key: string): boolean;
2
+ export declare function isForbiddenCasePath(path: string): boolean;
3
+ export declare function isAllowedCasePath(path: string): boolean;
4
+ //# sourceMappingURL=allowed-paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-paths.d.ts","sourceRoot":"","sources":["../../src/case-condition/allowed-paths.ts"],"names":[],"mappings":"AAoCA,wBAAgB,0BAA0B,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAE/D;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAoCvD"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isForbiddenCaseSelectorKey = isForbiddenCaseSelectorKey;
4
+ exports.isForbiddenCasePath = isForbiddenCasePath;
5
+ exports.isAllowedCasePath = isAllowedCasePath;
6
+ const ALLOWED_PATH_ROOTS = [
7
+ "runtime.mode",
8
+ "runtime.environment",
9
+ "runtime.job.agentId",
10
+ "runtime.job.jobTypeId",
11
+ "runtime.input",
12
+ "runtime.variables",
13
+ "runtime.flags",
14
+ "runtime.context",
15
+ "graph.revision",
16
+ "graph.id"
17
+ ];
18
+ const FORBIDDEN_PATH_ROOTS = [
19
+ "ai.",
20
+ "llm.",
21
+ "model.",
22
+ "provider.",
23
+ "node.output.",
24
+ "executionMemory.ai.",
25
+ "executionMemory.nodeOutputs.",
26
+ "previousAiResult.",
27
+ "semantic.",
28
+ "classification."
29
+ ];
30
+ const FORBIDDEN_SELECTOR_KEYS = new Set([
31
+ "ai",
32
+ "llm",
33
+ "semanticMatch",
34
+ "function",
35
+ "eval",
36
+ "script",
37
+ "prompt"
38
+ ]);
39
+ function isForbiddenCaseSelectorKey(key) {
40
+ return FORBIDDEN_SELECTOR_KEYS.has(key);
41
+ }
42
+ function isForbiddenCasePath(path) {
43
+ return FORBIDDEN_PATH_ROOTS.some((root) => path.startsWith(root));
44
+ }
45
+ function isAllowedCasePath(path) {
46
+ if (isForbiddenCasePath(path)) {
47
+ return false;
48
+ }
49
+ if (path === "runtime.mode" || path === "runtime.environment") {
50
+ return true;
51
+ }
52
+ if (path === "runtime.job.agentId" || path === "runtime.job.jobTypeId") {
53
+ return true;
54
+ }
55
+ if (path === "graph.id" || path === "graph.revision") {
56
+ return true;
57
+ }
58
+ if (path.startsWith("runtime.input.") ||
59
+ path === "runtime.input") {
60
+ return true;
61
+ }
62
+ if (path.startsWith("runtime.variables.") ||
63
+ path === "runtime.variables") {
64
+ return true;
65
+ }
66
+ if (path.startsWith("runtime.flags.") || path === "runtime.flags") {
67
+ return true;
68
+ }
69
+ if (path.startsWith("runtime.context.") || path === "runtime.context") {
70
+ return true;
71
+ }
72
+ return ALLOWED_PATH_ROOTS.some((root) => path === root || path.startsWith(`${root}.`));
73
+ }
74
+ //# sourceMappingURL=allowed-paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"allowed-paths.js","sourceRoot":"","sources":["../../src/case-condition/allowed-paths.ts"],"names":[],"mappings":";;AAoCA,gEAEC;AAED,kDAEC;AAED,8CAoCC;AAhFD,MAAM,kBAAkB,GAAG;IACzB,cAAc;IACd,qBAAqB;IACrB,qBAAqB;IACrB,uBAAuB;IACvB,eAAe;IACf,mBAAmB;IACnB,eAAe;IACf,iBAAiB;IACjB,gBAAgB;IAChB,UAAU;CACF,CAAC;AAEX,MAAM,oBAAoB,GAAG;IAC3B,KAAK;IACL,MAAM;IACN,QAAQ;IACR,WAAW;IACX,cAAc;IACd,qBAAqB;IACrB,8BAA8B;IAC9B,mBAAmB;IACnB,WAAW;IACX,iBAAiB;CACT,CAAC;AAEX,MAAM,uBAAuB,GAAG,IAAI,GAAG,CAAC;IACtC,IAAI;IACJ,KAAK;IACL,eAAe;IACf,UAAU;IACV,MAAM;IACN,QAAQ;IACR,QAAQ;CACT,CAAC,CAAC;AAEH,SAAgB,0BAA0B,CAAC,GAAW;IACpD,OAAO,uBAAuB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AAC1C,CAAC;AAED,SAAgB,mBAAmB,CAAC,IAAY;IAC9C,OAAO,oBAAoB,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,SAAgB,iBAAiB,CAAC,IAAY;IAC5C,IAAI,mBAAmB,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,IAAI,KAAK,cAAc,IAAI,IAAI,KAAK,qBAAqB,EAAE,CAAC;QAC9D,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,KAAK,qBAAqB,IAAI,IAAI,KAAK,uBAAuB,EAAE,CAAC;QACvE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,gBAAgB,EAAE,CAAC;QACrD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IACE,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC;QACjC,IAAI,KAAK,eAAe,EACxB,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IACE,IAAI,CAAC,UAAU,CAAC,oBAAoB,CAAC;QACrC,IAAI,KAAK,mBAAmB,EAC5B,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,CAAC,gBAAgB,CAAC,IAAI,IAAI,KAAK,eAAe,EAAE,CAAC;QAClE,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,IAAI,CAAC,UAAU,CAAC,kBAAkB,CAAC,IAAI,IAAI,KAAK,iBAAiB,EAAE,CAAC;QACtE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,kBAAkB,CAAC,IAAI,CAC5B,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,IAAI,GAAG,CAAC,CACvD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,4 @@
1
+ import type { CaseCondition, DeterministicCaseContext } from "../types/case-condition.js";
2
+ export declare function evaluateCaseCondition(condition: CaseCondition, context: DeterministicCaseContext): boolean;
3
+ export declare function explainMatchedCondition(condition: CaseCondition, context: DeterministicCaseContext): string[];
4
+ //# sourceMappingURL=evaluate-case-condition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"evaluate-case-condition.d.ts","sourceRoot":"","sources":["../../src/case-condition/evaluate-case-condition.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EAEb,wBAAwB,EACzB,MAAM,4BAA4B,CAAC;AAGpC,wBAAgB,qBAAqB,CACnC,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,wBAAwB,GAChC,OAAO,CAsBT;AAuED,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,aAAa,EACxB,OAAO,EAAE,wBAAwB,GAChC,MAAM,EAAE,CAkCV"}