@interf/compiler 0.7.3 → 0.9.1

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 (302) hide show
  1. package/README.md +123 -89
  2. package/TRADEMARKS.md +1 -1
  3. package/agent-skills/interf-actions/SKILL.md +71 -0
  4. package/agent-skills/interf-actions/references/cli.md +190 -0
  5. package/apps/compiler-ui/.next/server/app/index.html +1 -0
  6. package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_buildManifest.js +11 -0
  7. package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_clientMiddlewareManifest.js +1 -0
  8. package/apps/compiler-ui/.next/static/XWKL548yXD_UOG4ID9G3J/_ssgManifest.js +1 -0
  9. package/apps/compiler-ui/.next/static/chunks/03~yq9q893hmn.js +1 -0
  10. package/apps/compiler-ui/.next/static/chunks/06z~l3kwb891e.js +1 -0
  11. package/apps/compiler-ui/.next/static/chunks/08g7lvje.te.u.js +1 -0
  12. package/apps/compiler-ui/.next/static/chunks/08m7vf5asqlsm.js +91 -0
  13. package/apps/compiler-ui/.next/static/chunks/0_i-3_5l9t2qe.js +1 -0
  14. package/apps/compiler-ui/.next/static/chunks/0b-ywny_j0g~0.js +1 -0
  15. package/apps/compiler-ui/.next/static/chunks/0b52v41o1gixx.js +1 -0
  16. package/apps/compiler-ui/.next/static/chunks/0fgt_8knmicoz.js +124 -0
  17. package/apps/compiler-ui/.next/static/chunks/0gpzgsv0w.q~m.js +31 -0
  18. package/apps/compiler-ui/.next/static/chunks/0ilwfezfvu6~-.js +1 -0
  19. package/apps/compiler-ui/.next/static/chunks/0n51hrfoufc7g.js +1 -0
  20. package/apps/compiler-ui/.next/static/chunks/0ti_66mx7~w2-.js +5 -0
  21. package/apps/compiler-ui/.next/static/chunks/0xxmf45eskdt~.css +1 -0
  22. package/apps/compiler-ui/.next/static/chunks/0y5z3t-z1c8ks.js.map +5 -0
  23. package/apps/compiler-ui/.next/static/chunks/13g~4mamjft.c.css +3 -0
  24. package/apps/compiler-ui/.next/static/chunks/14wtz~vq25~qq.js +1 -0
  25. package/apps/compiler-ui/.next/static/chunks/turbopack-109rtik40vwh5.js +1 -0
  26. package/apps/compiler-ui/.next/static/chunks/turbopack-10e~t1yzi4svj.js +1 -0
  27. package/apps/compiler-ui/.next/static/chunks/turbopack-worker-0sjn--fhq~1cg.js +1 -0
  28. package/apps/compiler-ui/.next/static/media/GeistMono_Variable.p.17jn9btb_52pq.woff2 +0 -0
  29. package/apps/compiler-ui/.next/static/media/Geist_Variable-s.p.0-te~ja_gpvcf.woff2 +0 -0
  30. package/apps/compiler-ui/.next/static/media/worker.102zas1s52_pf.js +109 -0
  31. package/builtin-workflows/interf/README.md +8 -8
  32. package/builtin-workflows/interf/compile/stages/shape/SKILL.md +4 -4
  33. package/builtin-workflows/interf/compile/stages/structure/SKILL.md +1 -1
  34. package/builtin-workflows/interf/improve/SKILL.md +1 -1
  35. package/builtin-workflows/interf/use/query/SKILL.md +1 -1
  36. package/builtin-workflows/interf/workflow.json +8 -8
  37. package/builtin-workflows/interf/workflow.schema.json +1 -1
  38. package/dist/cli/commands/check-draft.d.ts +5 -4
  39. package/dist/cli/commands/check-draft.js +18 -17
  40. package/dist/cli/commands/compile-controller.d.ts +3 -0
  41. package/dist/cli/commands/compile-controller.js +53 -45
  42. package/dist/cli/commands/compile.js +83 -27
  43. package/dist/cli/commands/compiled-flow.d.ts +3 -0
  44. package/dist/cli/commands/compiled-flow.js +9 -7
  45. package/dist/cli/commands/control-path.d.ts +11 -0
  46. package/dist/cli/commands/control-path.js +72 -0
  47. package/dist/cli/commands/create-workflow-wizard.d.ts +6 -0
  48. package/dist/cli/commands/create-workflow-wizard.js +191 -77
  49. package/dist/cli/commands/create.js +54 -40
  50. package/dist/cli/commands/default.js +4 -3
  51. package/dist/cli/commands/doctor.js +5 -5
  52. package/dist/cli/commands/executor-flow.js +1 -1
  53. package/dist/cli/commands/init.js +326 -76
  54. package/dist/cli/commands/list.js +8 -7
  55. package/dist/cli/commands/preparation-selection.d.ts +6 -0
  56. package/dist/cli/commands/preparation-selection.js +11 -0
  57. package/dist/cli/commands/reset.js +3 -3
  58. package/dist/cli/commands/source-config-wizard.d.ts +4 -3
  59. package/dist/cli/commands/source-config-wizard.js +175 -197
  60. package/dist/cli/commands/status.js +116 -8
  61. package/dist/cli/commands/test-flow.d.ts +1 -1
  62. package/dist/cli/commands/test-flow.js +31 -31
  63. package/dist/cli/commands/test.d.ts +4 -0
  64. package/dist/cli/commands/test.js +95 -58
  65. package/dist/cli/commands/verify.js +7 -7
  66. package/dist/cli/commands/web.d.ts +11 -0
  67. package/dist/cli/commands/web.js +373 -0
  68. package/dist/cli/index.d.ts +2 -1
  69. package/dist/cli/index.js +3 -1
  70. package/dist/index.d.ts +4 -2
  71. package/dist/index.js +3 -1
  72. package/dist/packages/agents/lib/execution.js +4 -2
  73. package/dist/packages/agents/lib/executors.d.ts +1 -0
  74. package/dist/packages/agents/lib/executors.js +1 -0
  75. package/dist/packages/agents/lib/render.d.ts +2 -2
  76. package/dist/packages/agents/lib/render.js +10 -9
  77. package/dist/packages/agents/lib/shells.d.ts +3 -11
  78. package/dist/packages/agents/lib/shells.js +45 -96
  79. package/dist/packages/agents/lib/types.d.ts +1 -0
  80. package/dist/packages/compiler/compiled-paths.d.ts +4 -1
  81. package/dist/packages/compiler/compiled-paths.js +7 -1
  82. package/dist/packages/compiler/compiled-pipeline.d.ts +7 -0
  83. package/dist/packages/compiler/compiled-pipeline.js +15 -4
  84. package/dist/packages/compiler/compiled-schema.js +1 -1
  85. package/dist/packages/compiler/compiled-stage-plan.d.ts +2 -2
  86. package/dist/packages/compiler/compiled-stage-plan.js +4 -4
  87. package/dist/packages/compiler/compiled-stage-runner.d.ts +5 -0
  88. package/dist/packages/compiler/compiled-stage-runner.js +50 -2
  89. package/dist/packages/compiler/compiled-target.d.ts +1 -1
  90. package/dist/packages/compiler/compiled-target.js +2 -2
  91. package/dist/packages/compiler/lib/schema.d.ts +161 -1
  92. package/dist/packages/compiler/lib/schema.js +87 -1
  93. package/dist/packages/compiler/raw-snapshot.d.ts +9 -2
  94. package/dist/packages/compiler/runtime-acceptance.js +1 -1
  95. package/dist/packages/compiler/runtime-contracts.js +2 -2
  96. package/dist/packages/compiler/runtime-prompt.js +6 -6
  97. package/dist/packages/compiler/runtime-reconcile.js +3 -3
  98. package/dist/packages/compiler/runtime-runs.js +3 -0
  99. package/dist/packages/compiler/runtime-types.d.ts +1 -0
  100. package/dist/packages/compiler/state-health.js +1 -1
  101. package/dist/packages/compiler/state-view.js +2 -2
  102. package/dist/packages/compiler/validate-compiled.js +11 -9
  103. package/dist/packages/execution/adapters.d.ts +15 -0
  104. package/dist/packages/execution/adapters.js +1 -0
  105. package/dist/packages/execution/events.d.ts +8 -0
  106. package/dist/packages/execution/events.js +16 -0
  107. package/dist/packages/execution/index.d.ts +9 -0
  108. package/dist/packages/execution/index.js +6 -0
  109. package/dist/packages/execution/lib/schema.d.ts +1554 -0
  110. package/dist/packages/execution/lib/schema.js +319 -0
  111. package/dist/packages/local-service/action-values.d.ts +23 -0
  112. package/dist/packages/local-service/action-values.js +31 -0
  113. package/dist/packages/local-service/client.d.ts +119 -0
  114. package/dist/packages/local-service/client.js +356 -0
  115. package/dist/packages/local-service/index.d.ts +15 -0
  116. package/dist/packages/local-service/index.js +11 -0
  117. package/dist/packages/local-service/lib/schema.d.ts +7355 -0
  118. package/dist/packages/local-service/lib/schema.js +636 -0
  119. package/dist/packages/local-service/routes.d.ts +27 -0
  120. package/dist/packages/local-service/routes.js +32 -0
  121. package/dist/packages/local-service/runtime.d.ts +134 -0
  122. package/dist/packages/local-service/runtime.js +2841 -0
  123. package/dist/packages/local-service/server.d.ts +17 -0
  124. package/dist/packages/local-service/server.js +572 -0
  125. package/dist/packages/project-model/index.d.ts +2 -1
  126. package/dist/packages/project-model/index.js +1 -0
  127. package/dist/packages/project-model/interf-detect.d.ts +6 -2
  128. package/dist/packages/project-model/interf-detect.js +25 -10
  129. package/dist/packages/project-model/interf-scaffold.js +9 -6
  130. package/dist/packages/project-model/interf.d.ts +1 -1
  131. package/dist/packages/project-model/interf.js +1 -1
  132. package/dist/packages/project-model/lib/schema.d.ts +80 -6
  133. package/dist/packages/project-model/lib/schema.js +29 -19
  134. package/dist/packages/project-model/source-config.d.ts +22 -13
  135. package/dist/packages/project-model/source-config.js +140 -123
  136. package/dist/packages/project-model/source-folders.d.ts +11 -0
  137. package/dist/packages/project-model/source-folders.js +110 -0
  138. package/dist/packages/testing/test-execution.js +5 -5
  139. package/dist/packages/testing/test-paths.js +1 -3
  140. package/dist/packages/workflow-authoring/workflow-authoring.d.ts +4 -6
  141. package/dist/packages/workflow-authoring/workflow-authoring.js +45 -86
  142. package/dist/packages/workflow-authoring/workflow-edit-session.d.ts +2 -0
  143. package/dist/packages/workflow-authoring/workflow-edit-session.js +80 -49
  144. package/dist/packages/workflow-authoring/workflow-improvement.js +2 -1
  145. package/dist/packages/workflow-package/context-interface.js +1 -1
  146. package/dist/packages/workflow-package/interf-workflow-package.d.ts +6 -0
  147. package/dist/packages/workflow-package/interf-workflow-package.js +115 -8
  148. package/dist/packages/workflow-package/local-workflows.js +33 -17
  149. package/dist/packages/workflow-package/workflow-definitions.d.ts +5 -5
  150. package/dist/packages/workflow-package/workflow-definitions.js +23 -22
  151. package/dist/packages/workflow-package/workflow-helpers.js +10 -6
  152. package/dist/packages/workflow-package/workflow-stage-runner.d.ts +1 -0
  153. package/dist/packages/workflow-package/workflow-stage-runner.js +2 -0
  154. package/package.json +17 -1
  155. package/dist/cli/commands/dataset-selection.d.ts +0 -6
  156. package/dist/cli/commands/dataset-selection.js +0 -11
  157. package/dist/lib/agent-args.d.ts +0 -1
  158. package/dist/lib/agent-args.js +0 -1
  159. package/dist/lib/agent-constants.d.ts +0 -1
  160. package/dist/lib/agent-constants.js +0 -1
  161. package/dist/lib/agent-detection.d.ts +0 -1
  162. package/dist/lib/agent-detection.js +0 -1
  163. package/dist/lib/agent-execution.d.ts +0 -1
  164. package/dist/lib/agent-execution.js +0 -1
  165. package/dist/lib/agent-logs.d.ts +0 -1
  166. package/dist/lib/agent-logs.js +0 -1
  167. package/dist/lib/agent-preflight.d.ts +0 -1
  168. package/dist/lib/agent-preflight.js +0 -1
  169. package/dist/lib/agent-render.d.ts +0 -1
  170. package/dist/lib/agent-render.js +0 -1
  171. package/dist/lib/agent-shells.d.ts +0 -1
  172. package/dist/lib/agent-shells.js +0 -1
  173. package/dist/lib/agent-status.d.ts +0 -1
  174. package/dist/lib/agent-status.js +0 -1
  175. package/dist/lib/agent-types.d.ts +0 -1
  176. package/dist/lib/agent-types.js +0 -1
  177. package/dist/lib/agents.d.ts +0 -1
  178. package/dist/lib/agents.js +0 -1
  179. package/dist/lib/builtin-compiled-workflow.d.ts +0 -1
  180. package/dist/lib/builtin-compiled-workflow.js +0 -1
  181. package/dist/lib/chart-guidance.d.ts +0 -1
  182. package/dist/lib/chart-guidance.js +0 -1
  183. package/dist/lib/compiled-compile.d.ts +0 -1
  184. package/dist/lib/compiled-compile.js +0 -1
  185. package/dist/lib/compiled-paths.d.ts +0 -1
  186. package/dist/lib/compiled-paths.js +0 -3
  187. package/dist/lib/compiled-raw.d.ts +0 -1
  188. package/dist/lib/compiled-raw.js +0 -3
  189. package/dist/lib/compiled-reset.d.ts +0 -1
  190. package/dist/lib/compiled-reset.js +0 -3
  191. package/dist/lib/compiled-schema.d.ts +0 -1
  192. package/dist/lib/compiled-schema.js +0 -1
  193. package/dist/lib/discovery.d.ts +0 -1
  194. package/dist/lib/discovery.js +0 -1
  195. package/dist/lib/execution-profile.d.ts +0 -1
  196. package/dist/lib/execution-profile.js +0 -1
  197. package/dist/lib/executors.d.ts +0 -1
  198. package/dist/lib/executors.js +0 -1
  199. package/dist/lib/filesystem.d.ts +0 -1
  200. package/dist/lib/filesystem.js +0 -1
  201. package/dist/lib/interf-bootstrap.d.ts +0 -1
  202. package/dist/lib/interf-bootstrap.js +0 -3
  203. package/dist/lib/interf-detect.d.ts +0 -1
  204. package/dist/lib/interf-detect.js +0 -3
  205. package/dist/lib/interf-scaffold.d.ts +0 -1
  206. package/dist/lib/interf-scaffold.js +0 -3
  207. package/dist/lib/interf-workflow-package.d.ts +0 -1
  208. package/dist/lib/interf-workflow-package.js +0 -1
  209. package/dist/lib/interf.d.ts +0 -1
  210. package/dist/lib/interf.js +0 -3
  211. package/dist/lib/local-workflows.d.ts +0 -1
  212. package/dist/lib/local-workflows.js +0 -1
  213. package/dist/lib/logger.d.ts +0 -1
  214. package/dist/lib/logger.js +0 -1
  215. package/dist/lib/package-root.d.ts +0 -1
  216. package/dist/lib/package-root.js +0 -1
  217. package/dist/lib/parse.d.ts +0 -1
  218. package/dist/lib/parse.js +0 -1
  219. package/dist/lib/project-paths.d.ts +0 -1
  220. package/dist/lib/project-paths.js +0 -3
  221. package/dist/lib/runtime-acceptance.d.ts +0 -1
  222. package/dist/lib/runtime-acceptance.js +0 -1
  223. package/dist/lib/runtime-contracts.d.ts +0 -1
  224. package/dist/lib/runtime-contracts.js +0 -1
  225. package/dist/lib/runtime-inventory.d.ts +0 -1
  226. package/dist/lib/runtime-inventory.js +0 -1
  227. package/dist/lib/runtime-paths.d.ts +0 -1
  228. package/dist/lib/runtime-paths.js +0 -1
  229. package/dist/lib/runtime-prompt.d.ts +0 -1
  230. package/dist/lib/runtime-prompt.js +0 -1
  231. package/dist/lib/runtime-reconcile.d.ts +0 -1
  232. package/dist/lib/runtime-reconcile.js +0 -1
  233. package/dist/lib/runtime-runs.d.ts +0 -1
  234. package/dist/lib/runtime-runs.js +0 -1
  235. package/dist/lib/runtime-types.d.ts +0 -1
  236. package/dist/lib/runtime-types.js +0 -1
  237. package/dist/lib/runtime.d.ts +0 -1
  238. package/dist/lib/runtime.js +0 -1
  239. package/dist/lib/schema.d.ts +0 -4
  240. package/dist/lib/schema.js +0 -6
  241. package/dist/lib/source-config.d.ts +0 -1
  242. package/dist/lib/source-config.js +0 -3
  243. package/dist/lib/state-artifacts.d.ts +0 -1
  244. package/dist/lib/state-artifacts.js +0 -1
  245. package/dist/lib/state-health.d.ts +0 -1
  246. package/dist/lib/state-health.js +0 -1
  247. package/dist/lib/state-io.d.ts +0 -1
  248. package/dist/lib/state-io.js +0 -1
  249. package/dist/lib/state-paths.d.ts +0 -1
  250. package/dist/lib/state-paths.js +0 -1
  251. package/dist/lib/state-view.d.ts +0 -1
  252. package/dist/lib/state-view.js +0 -1
  253. package/dist/lib/state.d.ts +0 -1
  254. package/dist/lib/state.js +0 -1
  255. package/dist/lib/test-execution.d.ts +0 -1
  256. package/dist/lib/test-execution.js +0 -3
  257. package/dist/lib/test-matrices.d.ts +0 -1
  258. package/dist/lib/test-matrices.js +0 -3
  259. package/dist/lib/test-paths.d.ts +0 -1
  260. package/dist/lib/test-paths.js +0 -3
  261. package/dist/lib/test-profile-presets.d.ts +0 -1
  262. package/dist/lib/test-profile-presets.js +0 -3
  263. package/dist/lib/test-sandbox.d.ts +0 -1
  264. package/dist/lib/test-sandbox.js +0 -3
  265. package/dist/lib/test-specs.d.ts +0 -1
  266. package/dist/lib/test-specs.js +0 -3
  267. package/dist/lib/test-targets.d.ts +0 -1
  268. package/dist/lib/test-targets.js +0 -3
  269. package/dist/lib/test-types.d.ts +0 -1
  270. package/dist/lib/test-types.js +0 -3
  271. package/dist/lib/test.d.ts +0 -1
  272. package/dist/lib/test.js +0 -3
  273. package/dist/lib/util.d.ts +0 -1
  274. package/dist/lib/util.js +0 -1
  275. package/dist/lib/validate-compiled.d.ts +0 -1
  276. package/dist/lib/validate-compiled.js +0 -1
  277. package/dist/lib/validate-helpers.d.ts +0 -1
  278. package/dist/lib/validate-helpers.js +0 -1
  279. package/dist/lib/validate.d.ts +0 -1
  280. package/dist/lib/validate.js +0 -1
  281. package/dist/lib/workflow-authoring.d.ts +0 -1
  282. package/dist/lib/workflow-authoring.js +0 -1
  283. package/dist/lib/workflow-definitions.d.ts +0 -1
  284. package/dist/lib/workflow-definitions.js +0 -1
  285. package/dist/lib/workflow-edit-session.d.ts +0 -1
  286. package/dist/lib/workflow-edit-session.js +0 -1
  287. package/dist/lib/workflow-edit-utils.d.ts +0 -1
  288. package/dist/lib/workflow-edit-utils.js +0 -1
  289. package/dist/lib/workflow-helpers.d.ts +0 -1
  290. package/dist/lib/workflow-helpers.js +0 -1
  291. package/dist/lib/workflow-improvement.d.ts +0 -1
  292. package/dist/lib/workflow-improvement.js +0 -1
  293. package/dist/lib/workflow-primitives.d.ts +0 -1
  294. package/dist/lib/workflow-primitives.js +0 -1
  295. package/dist/lib/workflow-review-paths.d.ts +0 -1
  296. package/dist/lib/workflow-review-paths.js +0 -1
  297. package/dist/lib/workflow-stage-policy.d.ts +0 -1
  298. package/dist/lib/workflow-stage-policy.js +0 -1
  299. package/dist/lib/workflow-stage-runner.d.ts +0 -1
  300. package/dist/lib/workflow-stage-runner.js +0 -1
  301. package/dist/lib/workflows.d.ts +0 -1
  302. package/dist/lib/workflows.js +0 -1
@@ -0,0 +1,356 @@
1
+ import { existsSync, readFileSync } from "node:fs";
2
+ import { join, resolve } from "node:path";
3
+ import { CompileRunCreateRequestSchema, CompileRunListResponseSchema, CompileRunResourceSchema, LocalServiceInstancePointerSchema, LocalJobEventAppendRequestSchema, LocalJobRunCreateRequestSchema, LocalJobRunListResponseSchema, LocalJobRunResourceSchema, LocalServiceHealthSchema, ReadinessCheckDraftCreateRequestSchema, ReadinessCheckDraftResultSchema, ReadinessListResponseSchema, TestRunCreateRequestSchema, TestRunListResponseSchema, TestRunResourceSchema, WorkflowAuthoringCreateRequestSchema, WorkflowAuthoringResultSchema, } from "./lib/schema.js";
4
+ import { LOCAL_SERVICE_INSTANCE_POINTER_PATH, LOCAL_SERVICE_ROUTES, buildLocalServiceUrl, } from "./routes.js";
5
+ function trimTrailingSlash(value) {
6
+ return value.replace(/\/+$/, "");
7
+ }
8
+ export function configuredLocalServiceUrl() {
9
+ const explicit = process.env.INTERF_SERVICE_URL?.trim();
10
+ if (explicit)
11
+ return trimTrailingSlash(explicit);
12
+ return buildLocalServiceUrl();
13
+ }
14
+ function projectLocalServiceUrl(projectPath) {
15
+ const pointerPath = join(projectPath, ...LOCAL_SERVICE_INSTANCE_POINTER_PATH);
16
+ if (!existsSync(pointerPath))
17
+ return null;
18
+ try {
19
+ const pointer = LocalServiceInstancePointerSchema.parse(JSON.parse(readFileSync(pointerPath, "utf8")));
20
+ return trimTrailingSlash(pointer.service_url);
21
+ }
22
+ catch {
23
+ return null;
24
+ }
25
+ }
26
+ function localServiceUrlCandidates(projectPath) {
27
+ const explicit = process.env.INTERF_SERVICE_URL?.trim();
28
+ if (explicit)
29
+ return [trimTrailingSlash(explicit)];
30
+ return Array.from(new Set([
31
+ projectLocalServiceUrl(projectPath),
32
+ buildLocalServiceUrl(),
33
+ ].filter((value) => Boolean(value))));
34
+ }
35
+ async function fetchJson(url, options = {}) {
36
+ const controller = new AbortController();
37
+ const timeout = setTimeout(() => controller.abort(), options.timeoutMs ?? 500);
38
+ try {
39
+ const response = await fetch(url, {
40
+ ...options,
41
+ signal: controller.signal,
42
+ headers: {
43
+ ...(options.body ? { "content-type": "application/json" } : {}),
44
+ ...(options.headers ?? {}),
45
+ },
46
+ });
47
+ if (!response.ok) {
48
+ const detail = await response.text().catch(() => "");
49
+ throw new Error(detail || `Interf local service returned HTTP ${response.status}.`);
50
+ }
51
+ return await response.json();
52
+ }
53
+ finally {
54
+ clearTimeout(timeout);
55
+ }
56
+ }
57
+ function healthMatchesProject(health, projectPath, explicitServiceUrl) {
58
+ if (explicitServiceUrl)
59
+ return true;
60
+ if (!health.control_path)
61
+ return true;
62
+ return resolve(health.control_path) === resolve(projectPath);
63
+ }
64
+ export async function findLocalService(options) {
65
+ const explicitServiceUrl = Boolean(process.env.INTERF_SERVICE_URL?.trim());
66
+ for (const serviceUrl of localServiceUrlCandidates(options.projectPath)) {
67
+ try {
68
+ const health = LocalServiceHealthSchema.parse(await fetchJson(`${serviceUrl}${LOCAL_SERVICE_ROUTES.health}`, {
69
+ method: "GET",
70
+ timeoutMs: options.timeoutMs,
71
+ }));
72
+ if (!healthMatchesProject(health, options.projectPath, explicitServiceUrl)) {
73
+ continue;
74
+ }
75
+ return { serviceUrl, health };
76
+ }
77
+ catch {
78
+ continue;
79
+ }
80
+ }
81
+ return null;
82
+ }
83
+ export async function submitCompileRunToLocalService(options) {
84
+ const connection = await findLocalService({ projectPath: options.projectPath });
85
+ if (!connection)
86
+ return null;
87
+ const request = CompileRunCreateRequestSchema.parse(options.request);
88
+ const resource = CompileRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${LOCAL_SERVICE_ROUTES.compileRuns}`, {
89
+ method: "POST",
90
+ body: JSON.stringify(request),
91
+ }));
92
+ return {
93
+ serviceUrl: connection.serviceUrl,
94
+ resource,
95
+ };
96
+ }
97
+ export async function submitTestRunToLocalService(options) {
98
+ const connection = await findLocalService({ projectPath: options.projectPath });
99
+ if (!connection)
100
+ return null;
101
+ const request = TestRunCreateRequestSchema.parse(options.request);
102
+ const resource = TestRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${LOCAL_SERVICE_ROUTES.testRuns}`, {
103
+ method: "POST",
104
+ body: JSON.stringify(request),
105
+ }));
106
+ return {
107
+ serviceUrl: connection.serviceUrl,
108
+ resource,
109
+ };
110
+ }
111
+ function isTerminalJobStatus(status) {
112
+ return status === "succeeded" || status === "failed" || status === "cancelled";
113
+ }
114
+ function isTerminalRunStatus(status) {
115
+ return status === "succeeded" || status === "failed" || status === "cancelled";
116
+ }
117
+ export async function getLocalCompileRun(options) {
118
+ return CompileRunResourceSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.compileRuns}/${encodeURIComponent(options.runId)}`, {
119
+ method: "GET",
120
+ timeoutMs: 2000,
121
+ }));
122
+ }
123
+ export async function listLocalCompileRuns(options) {
124
+ return CompileRunListResponseSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.compileRuns}`, {
125
+ method: "GET",
126
+ timeoutMs: options.timeoutMs ?? 2000,
127
+ }));
128
+ }
129
+ export async function listLocalReadiness(options) {
130
+ return ReadinessListResponseSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.readiness}`, {
131
+ method: "GET",
132
+ timeoutMs: options.timeoutMs ?? 2000,
133
+ }));
134
+ }
135
+ export async function waitForLocalCompileRun(options) {
136
+ const pollMs = options.pollMs ?? 1000;
137
+ while (true) {
138
+ const resource = await getLocalCompileRun({
139
+ serviceUrl: options.serviceUrl,
140
+ runId: options.runId,
141
+ });
142
+ options.onUpdate?.(resource);
143
+ if (isTerminalRunStatus(resource.run.status))
144
+ return resource;
145
+ await new Promise((resolveWait) => setTimeout(resolveWait, pollMs));
146
+ }
147
+ }
148
+ export async function getLocalTestRun(options) {
149
+ return TestRunResourceSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.testRuns}/${encodeURIComponent(options.runId)}`, {
150
+ method: "GET",
151
+ timeoutMs: 2000,
152
+ }));
153
+ }
154
+ export async function listLocalTestRuns(options) {
155
+ return TestRunListResponseSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.testRuns}`, {
156
+ method: "GET",
157
+ timeoutMs: options.timeoutMs ?? 2000,
158
+ }));
159
+ }
160
+ export async function waitForLocalTestRun(options) {
161
+ const pollMs = options.pollMs ?? 1000;
162
+ while (true) {
163
+ const resource = await getLocalTestRun({
164
+ serviceUrl: options.serviceUrl,
165
+ runId: options.runId,
166
+ });
167
+ options.onUpdate?.(resource);
168
+ if (isTerminalRunStatus(resource.status))
169
+ return resource;
170
+ await new Promise((resolveWait) => setTimeout(resolveWait, pollMs));
171
+ }
172
+ }
173
+ export async function getLocalJobRun(options) {
174
+ return LocalJobRunResourceSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.jobs}/${encodeURIComponent(options.runId)}`, {
175
+ method: "GET",
176
+ timeoutMs: 2000,
177
+ }));
178
+ }
179
+ export async function listLocalJobRuns(options) {
180
+ return LocalJobRunListResponseSchema.parse(await fetchJson(`${options.serviceUrl}${LOCAL_SERVICE_ROUTES.jobs}`, {
181
+ method: "GET",
182
+ timeoutMs: options.timeoutMs ?? 2000,
183
+ }));
184
+ }
185
+ export async function readLocalServiceRunSnapshot(options) {
186
+ const [jobs, compileRuns, testRuns] = await Promise.all([
187
+ listLocalJobRuns(options),
188
+ listLocalCompileRuns(options),
189
+ listLocalTestRuns(options),
190
+ ]);
191
+ return {
192
+ jobs: jobs.jobs,
193
+ compileRuns: compileRuns.compile_runs,
194
+ testRuns: testRuns.test_runs,
195
+ };
196
+ }
197
+ export async function waitForLocalJobRun(options) {
198
+ const startedAt = Date.now();
199
+ const pollMs = options.pollMs ?? 1000;
200
+ while (true) {
201
+ const job = await getLocalJobRun({
202
+ serviceUrl: options.serviceUrl,
203
+ runId: options.runId,
204
+ });
205
+ options.onUpdate?.(job);
206
+ if (isTerminalJobStatus(job.status))
207
+ return job;
208
+ if (options.timeoutMs && Date.now() - startedAt > options.timeoutMs) {
209
+ throw new Error(`Timed out waiting for local job ${options.runId}.`);
210
+ }
211
+ await new Promise((resolveWait) => setTimeout(resolveWait, pollMs));
212
+ }
213
+ }
214
+ function resultError(job, defaultMessage) {
215
+ for (let index = job.events.length - 1; index >= 0; index -= 1) {
216
+ const event = job.events[index];
217
+ if (event?.type === "job.failed" && event.message)
218
+ return event.message;
219
+ }
220
+ return job.error ?? defaultMessage;
221
+ }
222
+ export async function submitReadinessCheckDraftToLocalService(options) {
223
+ const connection = await findLocalService({ projectPath: options.projectPath });
224
+ if (!connection)
225
+ return null;
226
+ const request = ReadinessCheckDraftCreateRequestSchema.parse(options.request);
227
+ const initialJob = LocalJobRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${LOCAL_SERVICE_ROUTES.readinessCheckDrafts}`, {
228
+ method: "POST",
229
+ body: JSON.stringify(request),
230
+ }));
231
+ options.onSubmitted?.({
232
+ serviceUrl: connection.serviceUrl,
233
+ job: initialJob,
234
+ });
235
+ const job = await waitForLocalJobRun({
236
+ serviceUrl: connection.serviceUrl,
237
+ runId: initialJob.run_id,
238
+ onUpdate: options.onUpdate,
239
+ });
240
+ if (job.status !== "succeeded") {
241
+ return {
242
+ serviceUrl: connection.serviceUrl,
243
+ job,
244
+ result: null,
245
+ error: resultError(job, "Readiness-check drafting failed in the local Interf service."),
246
+ };
247
+ }
248
+ const parsed = ReadinessCheckDraftResultSchema.safeParse(job.result);
249
+ if (!parsed.success) {
250
+ return {
251
+ serviceUrl: connection.serviceUrl,
252
+ job,
253
+ result: null,
254
+ error: "Readiness-check drafting finished without a valid result.",
255
+ };
256
+ }
257
+ return {
258
+ serviceUrl: connection.serviceUrl,
259
+ job,
260
+ result: parsed.data,
261
+ };
262
+ }
263
+ export async function submitWorkflowAuthoringRunToLocalService(options) {
264
+ const connection = await findLocalService({ projectPath: options.projectPath });
265
+ if (!connection)
266
+ return null;
267
+ const request = WorkflowAuthoringCreateRequestSchema.parse(options.request);
268
+ const initialJob = LocalJobRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${LOCAL_SERVICE_ROUTES.methodAuthoringRuns}`, {
269
+ method: "POST",
270
+ body: JSON.stringify(request),
271
+ }));
272
+ options.onSubmitted?.({
273
+ serviceUrl: connection.serviceUrl,
274
+ job: initialJob,
275
+ });
276
+ const job = await waitForLocalJobRun({
277
+ serviceUrl: connection.serviceUrl,
278
+ runId: initialJob.run_id,
279
+ onUpdate: options.onUpdate,
280
+ });
281
+ if (job.status !== "succeeded") {
282
+ return {
283
+ serviceUrl: connection.serviceUrl,
284
+ job,
285
+ result: null,
286
+ error: resultError(job, "Method authoring failed in the local Interf service."),
287
+ };
288
+ }
289
+ const parsed = WorkflowAuthoringResultSchema.safeParse(job.result);
290
+ if (!parsed.success) {
291
+ return {
292
+ serviceUrl: connection.serviceUrl,
293
+ job,
294
+ result: null,
295
+ error: "Method authoring finished without a valid result.",
296
+ };
297
+ }
298
+ return {
299
+ serviceUrl: connection.serviceUrl,
300
+ job,
301
+ result: parsed.data,
302
+ };
303
+ }
304
+ export async function appendLocalJobRunEvent(options) {
305
+ const connection = await findLocalService({ projectPath: options.projectPath });
306
+ if (!connection)
307
+ return null;
308
+ const event = LocalJobEventAppendRequestSchema.parse(options.event);
309
+ return LocalJobRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${LOCAL_SERVICE_ROUTES.jobs}/${encodeURIComponent(options.runId)}/events`, {
310
+ method: "POST",
311
+ body: JSON.stringify(event),
312
+ }));
313
+ }
314
+ export async function startLocalJobRun(options) {
315
+ const connection = await findLocalService({ projectPath: options.projectPath });
316
+ if (!connection)
317
+ return null;
318
+ const request = LocalJobRunCreateRequestSchema.parse(options.request);
319
+ const resource = LocalJobRunResourceSchema.parse(await fetchJson(`${connection.serviceUrl}${LOCAL_SERVICE_ROUTES.jobs}`, {
320
+ method: "POST",
321
+ body: JSON.stringify(request),
322
+ }));
323
+ const emit = (event) => {
324
+ void appendLocalJobRunEvent({
325
+ projectPath: options.projectPath,
326
+ runId: resource.run_id,
327
+ event,
328
+ }).catch(() => { });
329
+ };
330
+ return {
331
+ serviceUrl: connection.serviceUrl,
332
+ runId: resource.run_id,
333
+ resource,
334
+ emit,
335
+ complete: async (message) => {
336
+ await appendLocalJobRunEvent({
337
+ projectPath: options.projectPath,
338
+ runId: resource.run_id,
339
+ event: {
340
+ type: "job.completed",
341
+ ...(message ? { message } : {}),
342
+ },
343
+ });
344
+ },
345
+ fail: async (message) => {
346
+ await appendLocalJobRunEvent({
347
+ projectPath: options.projectPath,
348
+ runId: resource.run_id,
349
+ event: {
350
+ type: "job.failed",
351
+ message,
352
+ },
353
+ });
354
+ },
355
+ };
356
+ }
@@ -0,0 +1,15 @@
1
+ export * as schema from "./lib/schema.js";
2
+ export * as actionValues from "./action-values.js";
3
+ export * as routes from "./routes.js";
4
+ export * as client from "./client.js";
5
+ export * as runtime from "./runtime.js";
6
+ export * as server from "./server.js";
7
+ export type { CompileRunCreateRequest, CompileRunResource, CompileRunSummary, DatasetResource, LocalServiceDiscovery, PortableContextMapping, PreparationReadinessState, PreparationRunLinkage, PreparationResource, MethodResource, LocalJobAgent, LocalJobEvent, LocalJobEventAppendRequest, LocalJobEventType, LocalJobRunCreateRequest, LocalJobRunListResponse, LocalJobRunResource, LocalJobStatus, LocalRunHandlerResult, LocalJobStep, LocalJobType, LocalServiceConfig, LocalServiceHealth, LocalServiceInstancePointer, LocalServiceResource, LocalExecutorStatus, ActionProposalApproval, ActionProposalApprovalRequest, ActionProposalCreateRequest, ActionProposalListResponse, ActionProposalPlan, ActionProposalResource, ActionProposalStatus, ActionProposalType, DatasetSetupCreateRequest, PortableContextResource, ReadinessListResponse, ReadinessResource, SourceFileResource, WorkspaceFileResource, ReadinessCheckDraftCreateRequest, ReadinessCheckDraftResult, TestRunCreateRequest, TestRunResource, TestRunStatus, RunCreateRequest, RunObservabilityListResponse, RunObservabilityResource, WorkflowAuthoringCreateRequest, WorkflowAuthoringResult, WorkflowPackageResource, DatasetListResponse, PreparationListResponse, WorkflowPackageListResponse, MethodListResponse, CompileRunListResponse, TestRunListResponse, PortableContextListResponse, SourceFileListResponse, WorkspaceFileListResponse, OpenPathRequest, OpenPathResponse, } from "./lib/schema.js";
8
+ export { CompileRunCreateRequestSchema, CompileRunResourceSchema, CompileRunSummarySchema, DatasetResourceSchema, LocalServiceDiscoverySchema, PortableContextMappingSchema, PreparationReadinessStateSchema, PreparationRunLinkageSchema, PreparationResourceSchema, MethodResourceSchema, LocalJobAgentSchema, LocalJobEventAppendRequestSchema, LocalJobEventSchema, LocalJobEventTypeSchema, LocalJobRunCreateRequestSchema, LocalJobRunResourceSchema, LocalJobStatusSchema, LocalRunHandlerResultSchema, LocalJobStepSchema, LocalJobTypeSchema, LocalServiceConfigSchema, LocalServiceHealthSchema, LocalServiceInstancePointerSchema, LocalServiceResourceSchema, PortableContextResourceSchema, ReadinessResourceSchema, SourceFileResourceSchema, WorkspaceFileResourceSchema, ReadinessCheckDraftCreateRequestSchema, ReadinessCheckDraftResultSchema, TestRunCreateRequestSchema, TestRunResourceSchema, TestRunStatusSchema, RunCreateRequestSchema, RunObservabilityResourceSchema, RunObservabilityListResponseSchema, LocalExecutorStatusSchema, ActionProposalApprovalRequestSchema, ActionProposalApprovalSchema, ActionProposalCreateRequestSchema, ActionProposalListResponseSchema, ActionProposalPlanSchema, ActionProposalResourceSchema, ActionProposalStatusSchema, ActionProposalTypeSchema, DatasetSetupCreateRequestSchema, WorkflowAuthoringCreateRequestSchema, WorkflowAuthoringResultSchema, WorkflowPackageResourceSchema, DatasetListResponseSchema, PreparationListResponseSchema, WorkflowPackageListResponseSchema, MethodListResponseSchema, CompileRunListResponseSchema, LocalJobRunListResponseSchema, TestRunListResponseSchema, PortableContextListResponseSchema, ReadinessListResponseSchema, SourceFileListResponseSchema, WorkspaceFileListResponseSchema, OpenPathRequestSchema, OpenPathResponseSchema, } from "./lib/schema.js";
9
+ export { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, LOCAL_SERVICE_INSTANCE_POINTER_PATH, LOCAL_SERVICE_ROUTES, buildLocalServiceUrl, } from "./routes.js";
10
+ export type { LocalServiceJobSubmission, LocalServiceJobSubmitted, LocalServiceConnection, LocalServiceRunSnapshot, LocalJobTracker, } from "./client.js";
11
+ export { appendLocalJobRunEvent, configuredLocalServiceUrl, findLocalService, getLocalJobRun, getLocalCompileRun, getLocalTestRun, listLocalCompileRuns, listLocalJobRuns, listLocalTestRuns, readLocalServiceRunSnapshot, startLocalJobRun, submitCompileRunToLocalService, submitReadinessCheckDraftToLocalService, submitTestRunToLocalService, submitWorkflowAuthoringRunToLocalService, waitForLocalJobRun, waitForLocalCompileRun, waitForLocalTestRun, } from "./client.js";
12
+ export type { LocalServiceActionPlanningContext, LocalServiceCompileRunContext, LocalServiceJobRunContext, LocalServiceRunHandlers, LocalServiceRuntimeOptions, LocalServiceTestRunContext, } from "./runtime.js";
13
+ export { LocalServiceRuntime, createLocalServiceRuntime, } from "./runtime.js";
14
+ export type { StartedLocalService, StartLocalServiceOptions, } from "./server.js";
15
+ export { createLocalServiceServer, startLocalService, } from "./server.js";
@@ -0,0 +1,11 @@
1
+ export * as schema from "./lib/schema.js";
2
+ export * as actionValues from "./action-values.js";
3
+ export * as routes from "./routes.js";
4
+ export * as client from "./client.js";
5
+ export * as runtime from "./runtime.js";
6
+ export * as server from "./server.js";
7
+ export { CompileRunCreateRequestSchema, CompileRunResourceSchema, CompileRunSummarySchema, DatasetResourceSchema, LocalServiceDiscoverySchema, PortableContextMappingSchema, PreparationReadinessStateSchema, PreparationRunLinkageSchema, PreparationResourceSchema, MethodResourceSchema, LocalJobAgentSchema, LocalJobEventAppendRequestSchema, LocalJobEventSchema, LocalJobEventTypeSchema, LocalJobRunCreateRequestSchema, LocalJobRunResourceSchema, LocalJobStatusSchema, LocalRunHandlerResultSchema, LocalJobStepSchema, LocalJobTypeSchema, LocalServiceConfigSchema, LocalServiceHealthSchema, LocalServiceInstancePointerSchema, LocalServiceResourceSchema, PortableContextResourceSchema, ReadinessResourceSchema, SourceFileResourceSchema, WorkspaceFileResourceSchema, ReadinessCheckDraftCreateRequestSchema, ReadinessCheckDraftResultSchema, TestRunCreateRequestSchema, TestRunResourceSchema, TestRunStatusSchema, RunCreateRequestSchema, RunObservabilityResourceSchema, RunObservabilityListResponseSchema, LocalExecutorStatusSchema, ActionProposalApprovalRequestSchema, ActionProposalApprovalSchema, ActionProposalCreateRequestSchema, ActionProposalListResponseSchema, ActionProposalPlanSchema, ActionProposalResourceSchema, ActionProposalStatusSchema, ActionProposalTypeSchema, DatasetSetupCreateRequestSchema, WorkflowAuthoringCreateRequestSchema, WorkflowAuthoringResultSchema, WorkflowPackageResourceSchema, DatasetListResponseSchema, PreparationListResponseSchema, WorkflowPackageListResponseSchema, MethodListResponseSchema, CompileRunListResponseSchema, LocalJobRunListResponseSchema, TestRunListResponseSchema, PortableContextListResponseSchema, ReadinessListResponseSchema, SourceFileListResponseSchema, WorkspaceFileListResponseSchema, OpenPathRequestSchema, OpenPathResponseSchema, } from "./lib/schema.js";
8
+ export { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, LOCAL_SERVICE_INSTANCE_POINTER_PATH, LOCAL_SERVICE_ROUTES, buildLocalServiceUrl, } from "./routes.js";
9
+ export { appendLocalJobRunEvent, configuredLocalServiceUrl, findLocalService, getLocalJobRun, getLocalCompileRun, getLocalTestRun, listLocalCompileRuns, listLocalJobRuns, listLocalTestRuns, readLocalServiceRunSnapshot, startLocalJobRun, submitCompileRunToLocalService, submitReadinessCheckDraftToLocalService, submitTestRunToLocalService, submitWorkflowAuthoringRunToLocalService, waitForLocalJobRun, waitForLocalCompileRun, waitForLocalTestRun, } from "./client.js";
10
+ export { LocalServiceRuntime, createLocalServiceRuntime, } from "./runtime.js";
11
+ export { createLocalServiceServer, startLocalService, } from "./server.js";