@interf/compiler 0.9.4 → 0.13.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 (222) hide show
  1. package/README.md +96 -91
  2. package/TRADEMARKS.md +2 -13
  3. package/agent-skills/interf-actions/SKILL.md +97 -32
  4. package/agent-skills/interf-actions/references/cli.md +124 -71
  5. package/builtin-methods/interf-default/README.md +3 -4
  6. package/builtin-methods/interf-default/compile/stages/shape/SKILL.md +2 -2
  7. package/builtin-methods/interf-default/compile/stages/summarize/SKILL.md +2 -1
  8. package/builtin-methods/interf-default/improve/SKILL.md +1 -1
  9. package/builtin-methods/interf-default/method.json +10 -4
  10. package/builtin-methods/interf-default/method.schema.json +0 -9
  11. package/builtin-methods/interf-default/use/query/SKILL.md +5 -5
  12. package/dist/cli/commands/compile.d.ts +9 -31
  13. package/dist/cli/commands/compile.js +75 -388
  14. package/dist/cli/commands/doctor.js +1 -1
  15. package/dist/cli/commands/login.d.ts +7 -0
  16. package/dist/cli/commands/login.js +39 -0
  17. package/dist/cli/commands/logout.d.ts +2 -0
  18. package/dist/cli/commands/logout.js +16 -0
  19. package/dist/cli/commands/method.d.ts +2 -0
  20. package/dist/cli/commands/method.js +113 -0
  21. package/dist/cli/commands/prep.d.ts +2 -0
  22. package/dist/cli/commands/prep.js +134 -0
  23. package/dist/cli/commands/reset.d.ts +8 -1
  24. package/dist/cli/commands/reset.js +47 -15
  25. package/dist/cli/commands/runs.d.ts +2 -0
  26. package/dist/cli/commands/runs.js +120 -0
  27. package/dist/cli/commands/status.d.ts +6 -1
  28. package/dist/cli/commands/status.js +61 -220
  29. package/dist/cli/commands/test.d.ts +6 -15
  30. package/dist/cli/commands/test.js +63 -342
  31. package/dist/cli/commands/web.d.ts +0 -9
  32. package/dist/cli/commands/web.js +140 -367
  33. package/dist/cli/commands/wizard.d.ts +9 -0
  34. package/dist/cli/commands/wizard.js +442 -0
  35. package/dist/cli/index.d.ts +7 -6
  36. package/dist/cli/index.js +13 -10
  37. package/dist/compiler-ui/404.html +1 -1
  38. package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
  39. package/dist/compiler-ui/__next._full.txt +3 -3
  40. package/dist/compiler-ui/__next._head.txt +1 -1
  41. package/dist/compiler-ui/__next._index.txt +2 -2
  42. package/dist/compiler-ui/__next._tree.txt +2 -2
  43. package/dist/compiler-ui/_next/static/chunks/045gole2ojo3g.css +3 -0
  44. package/dist/compiler-ui/_next/static/chunks/17t-lulmyawg5.js +89 -0
  45. package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
  46. package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
  47. package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
  48. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
  49. package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
  50. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
  51. package/dist/compiler-ui/_not-found.html +1 -1
  52. package/dist/compiler-ui/_not-found.txt +2 -2
  53. package/dist/compiler-ui/index.html +1 -1
  54. package/dist/compiler-ui/index.txt +3 -3
  55. package/dist/index.d.ts +0 -23
  56. package/dist/index.js +0 -16
  57. package/dist/packages/agents/lib/shells.d.ts +1 -1
  58. package/dist/packages/agents/lib/shells.js +113 -54
  59. package/dist/packages/agents/lib/user-config.d.ts +4 -2
  60. package/dist/packages/agents/lib/user-config.js +15 -7
  61. package/dist/packages/compiler/compiled-paths.d.ts +9 -2
  62. package/dist/packages/compiler/compiled-paths.js +30 -15
  63. package/dist/packages/compiler/compiled-pipeline.js +23 -3
  64. package/dist/packages/compiler/compiled-stage-plan.js +4 -0
  65. package/dist/packages/compiler/compiled-target.d.ts +1 -1
  66. package/dist/packages/compiler/compiled-target.js +1 -1
  67. package/dist/packages/compiler/index.d.ts +1 -0
  68. package/dist/packages/compiler/index.js +1 -0
  69. package/dist/packages/compiler/lib/schema.d.ts +27 -32
  70. package/dist/packages/compiler/lib/schema.js +2 -13
  71. package/dist/packages/compiler/method-runs.d.ts +2 -3
  72. package/dist/packages/compiler/method-runs.js +2 -3
  73. package/dist/packages/compiler/reset.js +3 -1
  74. package/dist/packages/compiler/runtime-contracts.js +0 -3
  75. package/dist/packages/compiler/runtime-prompt.js +1 -1
  76. package/dist/packages/compiler/source-files.d.ts +46 -0
  77. package/dist/packages/compiler/source-files.js +149 -0
  78. package/dist/packages/compiler/state-artifacts.d.ts +3 -2
  79. package/dist/packages/compiler/state-artifacts.js +4 -3
  80. package/dist/packages/compiler/state-io.d.ts +3 -2
  81. package/dist/packages/compiler/state-io.js +11 -5
  82. package/dist/packages/compiler/state-paths.d.ts +2 -1
  83. package/dist/packages/compiler/state-paths.js +6 -3
  84. package/dist/packages/compiler/state-view.d.ts +3 -2
  85. package/dist/packages/compiler/state-view.js +18 -28
  86. package/dist/packages/compiler/state.d.ts +4 -4
  87. package/dist/packages/compiler/state.js +3 -3
  88. package/dist/packages/contracts/index.d.ts +1 -1
  89. package/dist/packages/contracts/lib/preparation-paths.d.ts +117 -0
  90. package/dist/packages/contracts/lib/preparation-paths.js +177 -0
  91. package/dist/packages/contracts/lib/schema.d.ts +85 -6
  92. package/dist/packages/contracts/lib/schema.js +46 -2
  93. package/dist/packages/execution/lib/schema.d.ts +50 -57
  94. package/dist/packages/execution/lib/schema.js +1 -2
  95. package/dist/packages/local-service/action-definitions.d.ts +246 -0
  96. package/dist/packages/local-service/action-definitions.js +1147 -0
  97. package/dist/packages/local-service/action-planner.d.ts +9 -0
  98. package/dist/packages/local-service/action-planner.js +135 -0
  99. package/dist/packages/local-service/action-values.d.ts +1 -23
  100. package/dist/packages/local-service/action-values.js +1 -31
  101. package/dist/packages/local-service/client.d.ts +76 -46
  102. package/dist/packages/local-service/client.js +184 -149
  103. package/dist/packages/local-service/connection-config.d.ts +38 -0
  104. package/dist/packages/local-service/connection-config.js +75 -0
  105. package/dist/packages/local-service/index.d.ts +14 -7
  106. package/dist/packages/local-service/index.js +8 -4
  107. package/dist/packages/local-service/instance-paths.d.ts +100 -0
  108. package/dist/packages/local-service/instance-paths.js +165 -0
  109. package/dist/packages/local-service/lib/schema.d.ts +689 -2575
  110. package/dist/packages/local-service/lib/schema.js +260 -101
  111. package/dist/packages/local-service/native-run-handlers.d.ts +23 -0
  112. package/dist/{cli/commands/compile-controller.js → packages/local-service/native-run-handlers.js} +204 -20
  113. package/dist/packages/local-service/preparation-store.d.ts +92 -0
  114. package/dist/packages/local-service/preparation-store.js +171 -0
  115. package/dist/{cli/commands/check-draft.d.ts → packages/local-service/readiness-check-draft.d.ts} +2 -2
  116. package/dist/packages/local-service/routes.d.ts +33 -11
  117. package/dist/packages/local-service/routes.js +44 -15
  118. package/dist/packages/local-service/run-observability.js +25 -27
  119. package/dist/packages/local-service/runtime-caches.d.ts +76 -0
  120. package/dist/packages/local-service/runtime-caches.js +191 -0
  121. package/dist/packages/local-service/runtime-event-applier.d.ts +12 -0
  122. package/dist/packages/local-service/runtime-event-applier.js +177 -0
  123. package/dist/packages/local-service/runtime-persistence.d.ts +47 -0
  124. package/dist/packages/local-service/runtime-persistence.js +137 -0
  125. package/dist/packages/local-service/runtime-proposal-helpers.d.ts +35 -0
  126. package/dist/packages/local-service/runtime-proposal-helpers.js +251 -0
  127. package/dist/packages/local-service/runtime-resource-builders.d.ts +52 -0
  128. package/dist/packages/local-service/runtime-resource-builders.js +149 -0
  129. package/dist/packages/local-service/runtime.d.ts +201 -44
  130. package/dist/packages/local-service/runtime.js +1062 -1106
  131. package/dist/packages/local-service/server.d.ts +15 -0
  132. package/dist/packages/local-service/server.js +651 -233
  133. package/dist/packages/local-service/service-registry.d.ts +47 -0
  134. package/dist/packages/local-service/service-registry.js +137 -0
  135. package/dist/packages/method-authoring/method-authoring.d.ts +1 -1
  136. package/dist/packages/method-authoring/method-authoring.js +2 -2
  137. package/dist/packages/method-authoring/method-improvement.js +1 -1
  138. package/dist/packages/method-package/builtin-compiled-method.d.ts +4 -5
  139. package/dist/packages/method-package/builtin-compiled-method.js +8 -14
  140. package/dist/packages/method-package/context-interface.d.ts +4 -40
  141. package/dist/packages/method-package/context-interface.js +1 -23
  142. package/dist/packages/method-package/interf-method-package.d.ts +4 -4
  143. package/dist/packages/method-package/interf-method-package.js +21 -33
  144. package/dist/packages/method-package/local-methods.d.ts +10 -6
  145. package/dist/packages/method-package/local-methods.js +57 -39
  146. package/dist/packages/method-package/method-definitions.d.ts +8 -34
  147. package/dist/packages/method-package/method-definitions.js +49 -37
  148. package/dist/packages/method-package/method-helpers.d.ts +1 -13
  149. package/dist/packages/method-package/method-helpers.js +8 -42
  150. package/dist/packages/method-package/method-review-paths.d.ts +1 -1
  151. package/dist/packages/method-package/method-review-paths.js +5 -5
  152. package/dist/packages/method-package/method-stage-runner.js +2 -2
  153. package/dist/packages/method-package/user-methods.d.ts +17 -0
  154. package/dist/packages/method-package/user-methods.js +77 -0
  155. package/dist/packages/project-model/index.d.ts +1 -1
  156. package/dist/packages/project-model/index.js +1 -1
  157. package/dist/packages/project-model/interf-detect.d.ts +8 -3
  158. package/dist/packages/project-model/interf-detect.js +34 -34
  159. package/dist/packages/project-model/interf-scaffold.d.ts +3 -3
  160. package/dist/packages/project-model/interf-scaffold.js +23 -32
  161. package/dist/packages/project-model/lib/schema.js +38 -1
  162. package/dist/packages/project-model/preparation-entries.d.ts +11 -0
  163. package/dist/packages/project-model/preparation-entries.js +49 -0
  164. package/dist/packages/project-model/source-config.d.ts +11 -10
  165. package/dist/packages/project-model/source-config.js +83 -44
  166. package/dist/packages/project-model/source-folders.d.ts +5 -5
  167. package/dist/packages/project-model/source-folders.js +14 -14
  168. package/dist/packages/shared/filesystem.d.ts +7 -0
  169. package/dist/packages/shared/filesystem.js +97 -10
  170. package/dist/packages/testing/lib/schema.d.ts +12 -13
  171. package/dist/packages/testing/lib/schema.js +4 -5
  172. package/dist/packages/testing/readiness-check-run.d.ts +7 -7
  173. package/dist/packages/testing/readiness-check-run.js +46 -51
  174. package/dist/packages/testing/test-execution.js +6 -6
  175. package/dist/packages/testing/test-paths.js +4 -3
  176. package/dist/packages/testing/test-sandbox.d.ts +0 -1
  177. package/dist/packages/testing/test-sandbox.js +14 -30
  178. package/dist/packages/testing/test-targets.d.ts +1 -1
  179. package/dist/packages/testing/test-targets.js +6 -6
  180. package/dist/packages/testing/test.d.ts +1 -1
  181. package/dist/packages/testing/test.js +1 -1
  182. package/package.json +6 -26
  183. package/LICENSE +0 -183
  184. package/dist/cli/commands/compile-controller.d.ts +0 -17
  185. package/dist/cli/commands/compiled-flow.d.ts +0 -25
  186. package/dist/cli/commands/compiled-flow.js +0 -112
  187. package/dist/cli/commands/control-path.d.ts +0 -11
  188. package/dist/cli/commands/control-path.js +0 -72
  189. package/dist/cli/commands/create-method-wizard.d.ts +0 -76
  190. package/dist/cli/commands/create-method-wizard.js +0 -465
  191. package/dist/cli/commands/create.d.ts +0 -8
  192. package/dist/cli/commands/create.js +0 -189
  193. package/dist/cli/commands/default.d.ts +0 -2
  194. package/dist/cli/commands/default.js +0 -39
  195. package/dist/cli/commands/executor-flow.d.ts +0 -29
  196. package/dist/cli/commands/executor-flow.js +0 -163
  197. package/dist/cli/commands/init.d.ts +0 -11
  198. package/dist/cli/commands/init.js +0 -784
  199. package/dist/cli/commands/list.d.ts +0 -2
  200. package/dist/cli/commands/list.js +0 -30
  201. package/dist/cli/commands/preparation-selection.d.ts +0 -6
  202. package/dist/cli/commands/preparation-selection.js +0 -11
  203. package/dist/cli/commands/source-config-wizard.d.ts +0 -52
  204. package/dist/cli/commands/source-config-wizard.js +0 -680
  205. package/dist/cli/commands/test-flow.d.ts +0 -58
  206. package/dist/cli/commands/test-flow.js +0 -231
  207. package/dist/cli/commands/verify.d.ts +0 -2
  208. package/dist/cli/commands/verify.js +0 -94
  209. package/dist/compiler-ui/_next/static/chunks/0d~8t0zm6545p.js +0 -118
  210. package/dist/compiler-ui/_next/static/chunks/0xnel.ax9a.2c.css +0 -3
  211. package/dist/packages/compiler/raw-snapshot.d.ts +0 -49
  212. package/dist/packages/compiler/raw-snapshot.js +0 -101
  213. package/dist/packages/method-package/index.d.ts +0 -11
  214. package/dist/packages/method-package/index.js +0 -11
  215. package/dist/packages/method-package/method-stage-policy.d.ts +0 -5
  216. package/dist/packages/method-package/method-stage-policy.js +0 -31
  217. package/dist/packages/project-model/project-paths.d.ts +0 -12
  218. package/dist/packages/project-model/project-paths.js +0 -33
  219. /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → C6vVfy3aeYuIO3d2AoNvC}/_buildManifest.js +0 -0
  220. /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → C6vVfy3aeYuIO3d2AoNvC}/_clientMiddlewareManifest.js +0 -0
  221. /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → C6vVfy3aeYuIO3d2AoNvC}/_ssgManifest.js +0 -0
  222. /package/dist/{cli/commands/check-draft.js → packages/local-service/readiness-check-draft.js} +0 -0
@@ -4,12 +4,122 @@ import { SourcePreparationConfigSchema, SourceReadinessCheckSchema, } from "../.
4
4
  import { PreparationNameSchema, ReadinessStateSchema, SourceCompiledMaxAttemptsSchema, SourceCompiledMaxLoopsSchema, MethodIdSchema, } from "../../contracts/lib/schema.js";
5
5
  import { ReadinessCheckRunSchema, TestRunModeSchema, } from "../../testing/lib/schema.js";
6
6
  const JsonObjectSchema = z.record(z.string(), z.unknown());
7
- export const LocalServiceHostSchema = z.string().min(1);
7
+ // ───────────────────────────────────────────────────────────────────────────
8
+ // 0.13 — preparation-first additions
9
+ // ───────────────────────────────────────────────────────────────────────────
10
+ /** Source binding shape on the API (only `local-folder` ships in 0.13). */
11
+ export const SourceBindingSchema = z.object({
12
+ kind: z.enum(["local-folder"]),
13
+ locator: z.string().min(1),
14
+ }).strict();
15
+ /** Discriminated locator for an artifact returned by the API. */
16
+ export const ArtifactLocatorSchema = z.object({
17
+ kind: z.enum(["local-path", "remote-url"]),
18
+ value: z.string().min(1),
19
+ }).strict();
20
+ /** Per-instance metadata from `GET /v1/instance` (replaces /v1/status). */
21
+ export const InstanceResourceSchema = z.object({
22
+ kind: z.literal("interf-instance"),
23
+ version: z.literal(1),
24
+ url: z.string().min(1),
25
+ host: z.string().min(1),
26
+ port: z.number().int().min(1).max(65535),
27
+ started_at: z.string().min(1),
28
+ package_version: z.string().min(1).optional(),
29
+ preparation_count: z.number().int().min(0),
30
+ active_run_count: z.number().int().min(0),
31
+ idle_for_seconds: z.number().int().min(0),
32
+ auth_required: z.boolean(),
33
+ }).strict();
34
+ /** Body of `POST /v1/preparations` — the 0.13 preparation create request. */
35
+ export const PreparationCreateRequestSchema = z.object({
36
+ id: PreparationNameSchema,
37
+ source: SourceBindingSchema,
38
+ method_id: MethodIdSchema,
39
+ about: z.string().min(1).optional(),
40
+ checks: z.array(SourceReadinessCheckSchema).default([]),
41
+ max_attempts: SourceCompiledMaxAttemptsSchema.optional(),
42
+ max_loops: SourceCompiledMaxLoopsSchema.optional(),
43
+ }).strict();
44
+ /** Body of `POST /v1/methods` — install a Method package by path. */
45
+ export const MethodInstallRequestSchema = z.object({
46
+ source_path: z.string().min(1),
47
+ overwrite: z.boolean().default(false),
48
+ }).strict();
49
+ export const MethodInstallResultSchema = z.object({
50
+ method_id: MethodIdSchema,
51
+ installed: z.boolean(),
52
+ path: z.string().min(1),
53
+ }).strict();
54
+ export const PreparationDeleteResponseSchema = z.object({
55
+ deleted: z.boolean(),
56
+ id: PreparationNameSchema,
57
+ }).strict();
58
+ /**
59
+ * The local service must only ever bind to a loopback interface. Any other
60
+ * host (LAN IP, 0.0.0.0, public address) lets a remote browser tab POST at
61
+ * the service, which is the CSRF model we are explicitly rejecting. Keep
62
+ * the allowlist literal — refactoring to a `.refine()` over `z.string()`
63
+ * would lose the static type narrowing.
64
+ */
65
+ export const LOCAL_SERVICE_LOOPBACK_HOSTS = ["127.0.0.1", "localhost", "::1"];
66
+ export const LocalServiceHostSchema = z
67
+ .string()
68
+ .min(1)
69
+ .refine((value) => LOCAL_SERVICE_LOOPBACK_HOSTS.includes(value), {
70
+ message: `Local service host must be one of: ${LOCAL_SERVICE_LOOPBACK_HOSTS.join(", ")}.`,
71
+ });
8
72
  export const LocalServicePortSchema = z.number().int().min(1).max(65535);
73
+ /**
74
+ * Per-instance bearer token. Generated at startup with crypto.randomBytes(32)
75
+ * and rendered as a 64-char hex string. Any deviation should fail validation
76
+ * loud and early.
77
+ */
78
+ export const LocalServiceAuthTokenSchema = z
79
+ .string()
80
+ .regex(/^[0-9a-f]{64}$/i, "Auth token must be a 64-character hex string.");
9
81
  export const LocalServiceConfigSchema = z.object({
10
82
  host: LocalServiceHostSchema.default("127.0.0.1"),
11
83
  port: LocalServicePortSchema.default(4873),
12
84
  }).strict();
85
+ export const ServiceRegistryWorkspaceSchema = z.object({
86
+ control_path: z.string().min(1),
87
+ registered_at: z.string().min(1),
88
+ last_activity: z.string().min(1),
89
+ }).strict();
90
+ export const ServiceRegistryEntrySchema = z.object({
91
+ pid: z.number().int().positive(),
92
+ host: LocalServiceHostSchema,
93
+ port: LocalServicePortSchema,
94
+ url: z.string().min(1),
95
+ started_at: z.string().min(1),
96
+ /**
97
+ * Bearer token mutating clients must send. Optional in the schema so
98
+ * older registry files (pre-0.12.1) keep parsing; the runtime treats a
99
+ * missing token as "open" only when the entry already exists on disk —
100
+ * fresh entries always have one.
101
+ */
102
+ auth_token: LocalServiceAuthTokenSchema.optional(),
103
+ workspaces: z.array(ServiceRegistryWorkspaceSchema).default([]),
104
+ }).strict();
105
+ export const ServiceRegistrySchema = z.object({
106
+ services: z.array(ServiceRegistryEntrySchema).default([]),
107
+ }).strict();
108
+ export const WorkspaceRegistrationRequestSchema = z.object({
109
+ control_path: z.string().min(1),
110
+ }).strict();
111
+ export const WorkspaceRegistrationResponseSchema = z.object({
112
+ workspace: ServiceRegistryWorkspaceSchema,
113
+ service: ServiceRegistryEntrySchema,
114
+ }).strict();
115
+ export const WorkspaceListResponseSchema = z.object({
116
+ workspaces: z.array(ServiceRegistryWorkspaceSchema),
117
+ }).strict();
118
+ export const WorkspaceDeregisterResponseSchema = z.object({
119
+ deregistered: z.boolean(),
120
+ control_path: z.string().min(1),
121
+ remaining_workspaces: z.number().int().min(0),
122
+ }).strict();
13
123
  export const LocalServiceHealthSchema = z.object({
14
124
  kind: z.literal("interf-local-service-health"),
15
125
  version: z.literal(1),
@@ -21,16 +131,30 @@ export const LocalServiceHealthSchema = z.object({
21
131
  source_folder_path: z.string().min(1).nullable().optional(),
22
132
  started_at: z.string().min(1).optional(),
23
133
  package_version: z.string().min(1).optional(),
134
+ instance_started_at: z.string().min(1).optional(),
135
+ registered_workspaces: z.array(ServiceRegistryWorkspaceSchema).default([]),
136
+ active_runs: z.number().int().min(0).default(0),
137
+ idle_for_seconds: z.number().int().min(0).default(0),
138
+ }).strict();
139
+ export const LocalServiceErrorSchema = z.object({
140
+ error: z.object({
141
+ message: z.string().min(1),
142
+ code: z.string().min(1).optional(),
143
+ }).strict(),
24
144
  }).strict();
25
- export const LocalServiceInstancePointerSchema = z.object({
145
+ export const LocalServicePointerSchema = z.object({
26
146
  service_url: z.string().min(1),
27
147
  host: LocalServiceHostSchema,
28
148
  port: LocalServicePortSchema,
29
149
  pid: z.number().int().positive(),
30
150
  control_path: z.string().min(1),
31
151
  started_at: z.string().min(1),
152
+ /**
153
+ * Per-workspace copy of the bearer token. Optional so legacy pointer
154
+ * files keep parsing during upgrades; new pointers always include it.
155
+ */
156
+ auth_token: LocalServiceAuthTokenSchema.optional(),
32
157
  }).strict();
33
- export const PreparationReadinessStateSchema = ReadinessStateSchema;
34
158
  export const PortableContextMappingSchema = z.object({
35
159
  preparation: PreparationNameSchema,
36
160
  path: z.string().min(1).nullable(),
@@ -52,7 +176,7 @@ export const PreparationResourceSchema = z.object({
52
176
  checks: z.array(SourceReadinessCheckSchema).default([]),
53
177
  portable_context: PortableContextMappingSchema,
54
178
  portable_context_path: z.string().min(1).nullable(),
55
- readiness: PreparationReadinessStateSchema,
179
+ readiness: ReadinessStateSchema,
56
180
  runs: PreparationRunLinkageSchema,
57
181
  latest_compile_run_id: z.string().min(1).nullable().optional(),
58
182
  latest_test_run_id: z.string().min(1).nullable().optional(),
@@ -66,6 +190,7 @@ export const MethodResourceSchema = z.object({
66
190
  source_kind: z.enum(["builtin", "local"]).default("local"),
67
191
  built_in: z.boolean().default(false),
68
192
  active_for_preparations: z.array(PreparationNameSchema).default([]),
193
+ output_paths: z.array(z.string().min(1)).default([]),
69
194
  stages: z.array(z.object({
70
195
  id: z.string().min(1),
71
196
  label: z.string().min(1),
@@ -99,24 +224,22 @@ export const CompileRunResourceSchema = z.object({
99
224
  run: CompileRunSchema,
100
225
  }).strict();
101
226
  export const LocalJobTypeSchema = z.enum([
102
- "preparation-setup",
103
227
  "readiness-check-draft",
104
228
  "method-authoring",
105
229
  "method-improvement",
106
- "compile",
107
- "test",
108
230
  ]);
109
- export const LocalJobStatusSchema = z.enum([
231
+ export const RunStatusSchema = z.enum([
110
232
  "queued",
111
233
  "running",
112
234
  "succeeded",
113
235
  "failed",
114
236
  "cancelled",
115
237
  ]);
238
+ export const LocalJobStatusSchema = RunStatusSchema;
116
239
  export const LocalRunHandlerResultSchema = z.object({
117
240
  ok: z.boolean(),
118
241
  error: z.string().min(1).optional(),
119
- comparison: ReadinessCheckRunSchema.nullable().optional(),
242
+ readiness_run: ReadinessCheckRunSchema.nullable().optional(),
120
243
  }).strict();
121
244
  export const LocalJobAgentSchema = z.object({
122
245
  name: z.string().min(1),
@@ -174,6 +297,98 @@ export const LocalJobRunCreateRequestSchema = z.object({
174
297
  export const PreparationSetupCreateRequestSchema = z.object({
175
298
  preparation: SourcePreparationConfigSchema,
176
299
  prepare_after_setup: z.boolean().default(false),
300
+ setup_mode: z.enum(["create", "select-method"]).default("create"),
301
+ }).strict();
302
+ export const PreparationSetupResultSchema = z.object({
303
+ kind: z.literal("interf-preparation-setup-result"),
304
+ version: z.literal(1),
305
+ operation: z.enum(["create", "select-method"]),
306
+ preparation: PreparationNameSchema,
307
+ method: MethodIdSchema,
308
+ source_folder_path: z.string().min(1),
309
+ config_path: z.string().min(1),
310
+ portable_context_path: z.string().min(1),
311
+ changed: z.boolean(),
312
+ message: z.string().min(1),
313
+ submitted_run_id: z.string().min(1).nullable().optional(),
314
+ submitted_run_type: z.literal("compile-run").nullable().optional(),
315
+ }).strict();
316
+ export const WorkspaceBootstrapCreateRequestSchema = z.object({
317
+ source_folder: z.object({
318
+ path: z.string().min(1),
319
+ }).strict().optional(),
320
+ seed_default_method: z.boolean().default(true),
321
+ }).strict();
322
+ export const WorkspaceBootstrapResultSchema = z.object({
323
+ kind: z.literal("interf-workspace-bootstrap-result"),
324
+ version: z.literal(1),
325
+ control_path: z.string().min(1),
326
+ config_path: z.string().min(1),
327
+ source_folder_path: z.string().min(1).nullable(),
328
+ preparations: z.number().int().min(0),
329
+ seeded_default_method: z.boolean(),
330
+ default_method_id: MethodIdSchema.nullable(),
331
+ changed: z.boolean(),
332
+ message: z.string().min(1),
333
+ }).strict();
334
+ export const MethodChangeCreateRequestSchema = z.discriminatedUnion("operation", [
335
+ z.object({
336
+ action_type: z.literal("method-change").optional(),
337
+ operation: z.literal("duplicate"),
338
+ method: MethodIdSchema,
339
+ new_method_id: MethodIdSchema,
340
+ label: z.string().min(1).optional(),
341
+ hint: z.string().min(1).optional(),
342
+ }).strict(),
343
+ z.object({
344
+ action_type: z.literal("method-change").optional(),
345
+ operation: z.literal("remove"),
346
+ method: MethodIdSchema,
347
+ confirmation: MethodIdSchema,
348
+ }).strict(),
349
+ ]);
350
+ export const MethodChangeResultSchema = z.object({
351
+ kind: z.literal("interf-method-change-result"),
352
+ version: z.literal(1),
353
+ operation: z.enum(["duplicate", "remove"]),
354
+ method: MethodIdSchema,
355
+ new_method_id: MethodIdSchema.nullable().optional(),
356
+ updated_preparations: z.array(PreparationNameSchema).default([]),
357
+ method_path: z.string().min(1),
358
+ changed: z.boolean(),
359
+ message: z.string().min(1),
360
+ }).strict();
361
+ export const PreparationChangeCreateRequestSchema = z.discriminatedUnion("operation", [
362
+ z.object({
363
+ action_type: z.literal("preparation-change").optional(),
364
+ operation: z.literal("remove"),
365
+ preparation: PreparationNameSchema,
366
+ confirmation: PreparationNameSchema,
367
+ }).strict(),
368
+ ]);
369
+ export const PreparationChangeResultSchema = z.object({
370
+ kind: z.literal("interf-preparation-change-result"),
371
+ version: z.literal(1),
372
+ operation: z.literal("remove"),
373
+ preparation: PreparationNameSchema,
374
+ config_path: z.string().min(1),
375
+ portable_context_path: z.string().min(1),
376
+ portable_context_retained: z.boolean(),
377
+ changed: z.boolean(),
378
+ message: z.string().min(1),
379
+ }).strict();
380
+ export const ResetRequestSchema = z.object({
381
+ preparation: PreparationNameSchema,
382
+ scope: z.enum(["compile", "all"]),
383
+ }).strict();
384
+ export const ResetResultSchema = z.object({
385
+ kind: z.literal("interf-reset-result"),
386
+ version: z.literal(1),
387
+ preparation: PreparationNameSchema,
388
+ scope: z.enum(["compile", "all"]),
389
+ portable_context_path: z.string().min(1),
390
+ changed: z.boolean(),
391
+ message: z.string().min(1),
177
392
  }).strict();
178
393
  export const ReadinessCheckDraftCreateRequestSchema = z.object({
179
394
  preparation: PreparationNameSchema,
@@ -231,13 +446,7 @@ export const LocalJobRunResourceSchema = z.object({
231
446
  result: z.record(z.string(), z.unknown()).nullable().optional(),
232
447
  error: z.string().min(1).nullable().optional(),
233
448
  }).strict();
234
- export const TestRunStatusSchema = z.enum([
235
- "queued",
236
- "running",
237
- "succeeded",
238
- "failed",
239
- "cancelled",
240
- ]);
449
+ export const TestRunStatusSchema = RunStatusSchema;
241
450
  export const TestRunCreateRequestSchema = z.object({
242
451
  preparation: PreparationNameSchema,
243
452
  mode: TestRunModeSchema.default("both"),
@@ -251,40 +460,12 @@ export const TestRunResourceSchema = z.object({
251
460
  portable_context_path: z.string().min(1).nullable(),
252
461
  started_at: z.string().nullable().optional(),
253
462
  finished_at: z.string().nullable().optional(),
254
- comparison: ReadinessCheckRunSchema.nullable(),
463
+ readiness_run: ReadinessCheckRunSchema.nullable(),
255
464
  readiness: ReadinessStateSchema.nullable().optional(),
256
465
  events: z.array(InterfRunEventSchema).default([]),
257
466
  error: z.string().min(1).nullable().optional(),
258
467
  }).strict();
259
468
  export const RunObservabilityResourceSchema = RunObservabilitySchema;
260
- export const RunCreateRequestSchema = z.discriminatedUnion("run_type", [
261
- z.object({
262
- run_type: z.literal("compile"),
263
- preparation: PreparationNameSchema,
264
- method: MethodIdSchema.optional(),
265
- max_attempts: SourceCompiledMaxAttemptsSchema.optional(),
266
- max_loops: SourceCompiledMaxLoopsSchema.optional(),
267
- preserve_stage_shells: z.enum(["on-failure", "always"]).optional(),
268
- }).strict(),
269
- z.object({
270
- run_type: z.literal("prepare"),
271
- preparation: PreparationNameSchema,
272
- method: MethodIdSchema.optional(),
273
- max_attempts: SourceCompiledMaxAttemptsSchema.optional(),
274
- max_loops: SourceCompiledMaxLoopsSchema.optional(),
275
- preserve_stage_shells: z.enum(["on-failure", "always"]).optional(),
276
- }).strict(),
277
- z.object({
278
- run_type: z.literal("test"),
279
- preparation: PreparationNameSchema,
280
- mode: TestRunModeSchema.default("both"),
281
- }).strict(),
282
- z.object({
283
- run_type: z.literal("check"),
284
- preparation: PreparationNameSchema,
285
- mode: TestRunModeSchema.default("both"),
286
- }).strict(),
287
- ]);
288
469
  export const LocalExecutorStatusSchema = z.object({
289
470
  kind: z.literal("interf-local-executor-status"),
290
471
  version: z.literal(1),
@@ -298,10 +479,20 @@ export const LocalExecutorSelectRequestSchema = z.object({
298
479
  agent: z.string().min(1),
299
480
  }).strict();
300
481
  export const ActionProposalTypeSchema = z.enum([
482
+ "clarification",
483
+ "readiness-check-draft",
484
+ "method-authoring",
485
+ "method-improvement",
486
+ "compile",
487
+ "test",
488
+ ]);
489
+ export const ActionProposalPlanActionTypeSchema = z.enum([
301
490
  "clarification",
302
491
  "preparation-setup",
492
+ "preparation-change",
303
493
  "readiness-check-draft",
304
494
  "method-authoring",
495
+ "method-change",
305
496
  "method-improvement",
306
497
  "compile",
307
498
  "test",
@@ -314,13 +505,22 @@ export const ActionProposalStatusSchema = z.enum([
314
505
  "submitted",
315
506
  "failed",
316
507
  ]);
508
+ export const ActionClientOriginSchema = z.enum([
509
+ "ui-chat",
510
+ "cli",
511
+ "agent-cli",
512
+ "mcp",
513
+ "service",
514
+ "unknown",
515
+ ]);
317
516
  export const ActionProposalCreateRequestSchema = z.object({
318
517
  message: z.string().min(1),
319
518
  preparation: PreparationNameSchema.optional(),
519
+ client_origin: ActionClientOriginSchema.default("unknown"),
320
520
  values: JsonObjectSchema.optional(),
321
521
  }).strict();
322
522
  export const ActionProposalPlanSchema = z.object({
323
- action_type: ActionProposalTypeSchema,
523
+ action_type: ActionProposalPlanActionTypeSchema,
324
524
  preparation: PreparationNameSchema.optional(),
325
525
  method: MethodIdSchema.optional(),
326
526
  values: JsonObjectSchema.optional(),
@@ -350,6 +550,7 @@ const ActionProposalResourceBaseSchema = z.object({
350
550
  message: z.string().min(1),
351
551
  preparation: PreparationNameSchema.nullable().optional(),
352
552
  method: MethodIdSchema.nullable().optional(),
553
+ client_origin: ActionClientOriginSchema.default("unknown"),
353
554
  created_at: z.string().min(1),
354
555
  updated_at: z.string().min(1),
355
556
  proposed_by_executor: LocalJobAgentSchema.nullable().optional(),
@@ -367,10 +568,6 @@ export const ActionProposalResourceSchema = z.discriminatedUnion("action_type",
367
568
  action_type: z.literal("compile"),
368
569
  request: CompileRunCreateRequestSchema,
369
570
  }).strict(),
370
- ActionProposalResourceBaseSchema.extend({
371
- action_type: z.literal("preparation-setup"),
372
- request: PreparationSetupCreateRequestSchema,
373
- }).strict(),
374
571
  ActionProposalResourceBaseSchema.extend({
375
572
  action_type: z.literal("test"),
376
573
  request: TestRunCreateRequestSchema,
@@ -398,7 +595,7 @@ export const PortableContextResourceSchema = z.object({
398
595
  latest_test_run_id: z.string().min(1).nullable().optional(),
399
596
  artifacts: z.array(ArtifactRefSchema).default([]),
400
597
  }).strict();
401
- export const ReadinessResourceSchema = PreparationReadinessStateSchema;
598
+ export const ReadinessResourceSchema = ReadinessStateSchema;
402
599
  export const SourceFileResourceSchema = z.object({
403
600
  preparation: PreparationNameSchema,
404
601
  path: z.string().min(1),
@@ -425,7 +622,19 @@ export const LocalServiceDiscoverySchema = z.object({
425
622
  source_files: z.string().min(1),
426
623
  workspace_files: z.string().min(1),
427
624
  action_proposals: z.string().min(1),
625
+ preparation_setups: z.string().min(1),
626
+ preparation_changes: z.string().min(1),
627
+ method_changes: z.string().min(1),
628
+ workspace_bootstraps: z.string().min(1).optional(),
629
+ readiness_check_drafts: z.string().min(1),
630
+ method_authoring_runs: z.string().min(1),
631
+ method_improvement_runs: z.string().min(1),
632
+ compile_runs: z.string().min(1),
633
+ test_runs: z.string().min(1),
634
+ reset: z.string().min(1),
428
635
  executor: z.string().min(1),
636
+ workspaces: z.string().min(1).optional(),
637
+ status: z.string().min(1).optional(),
429
638
  }).strict(),
430
639
  }).strict();
431
640
  export const OpenPathRequestSchema = z.object({
@@ -435,56 +644,6 @@ export const OpenPathResponseSchema = z.object({
435
644
  opened: z.boolean(),
436
645
  path: z.string().min(1),
437
646
  }).strict();
438
- export const LocalServiceResourceSchema = z.discriminatedUnion("kind", [
439
- z.object({
440
- kind: z.literal("preparation"),
441
- value: PreparationResourceSchema,
442
- }).strict(),
443
- z.object({
444
- kind: z.literal("method"),
445
- value: MethodResourceSchema,
446
- }).strict(),
447
- z.object({
448
- kind: z.literal("compile-run"),
449
- value: CompileRunResourceSchema,
450
- }).strict(),
451
- z.object({
452
- kind: z.literal("job-run"),
453
- value: LocalJobRunResourceSchema,
454
- }).strict(),
455
- z.object({
456
- kind: z.literal("test-run"),
457
- value: TestRunResourceSchema,
458
- }).strict(),
459
- z.object({
460
- kind: z.literal("run-observability"),
461
- value: RunObservabilityResourceSchema,
462
- }).strict(),
463
- z.object({
464
- kind: z.literal("executor-status"),
465
- value: LocalExecutorStatusSchema,
466
- }).strict(),
467
- z.object({
468
- kind: z.literal("action-proposal"),
469
- value: ActionProposalResourceSchema,
470
- }).strict(),
471
- z.object({
472
- kind: z.literal("portable-context"),
473
- value: PortableContextResourceSchema,
474
- }).strict(),
475
- z.object({
476
- kind: z.literal("readiness"),
477
- value: ReadinessResourceSchema,
478
- }).strict(),
479
- z.object({
480
- kind: z.literal("source-file"),
481
- value: SourceFileResourceSchema,
482
- }).strict(),
483
- z.object({
484
- kind: z.literal("workspace-file"),
485
- value: WorkspaceFileResourceSchema,
486
- }).strict(),
487
- ]);
488
647
  export const PreparationListResponseSchema = z.object({
489
648
  preparations: z.array(PreparationResourceSchema),
490
649
  }).strict();
@@ -0,0 +1,23 @@
1
+ import type { MethodExecutionProfile, MethodExecutor } from "../agents/lib/executors.js";
2
+ import type { SourcePreparationConfig } from "../project-model/lib/schema.js";
3
+ import type { StageShellRetentionMode } from "../compiler/method-runs.js";
4
+ import type { RunEventSink } from "../execution/events.js";
5
+ import type { LocalServiceRunHandlers } from "./runtime.js";
6
+ export interface NativeLocalServiceRunHandlerOptions {
7
+ executor?: MethodExecutor;
8
+ testExecutor?: MethodExecutor;
9
+ }
10
+ export declare function runConfiguredCompiledCompile(options: {
11
+ executor: MethodExecutor;
12
+ testExecutor?: MethodExecutor | null;
13
+ compiledPath: string;
14
+ sourcePath: string;
15
+ compiledConfig: SourcePreparationConfig | null;
16
+ executionProfile?: MethodExecutionProfile;
17
+ maxAttemptsOverride: number | null;
18
+ maxLoopsOverride: number | null;
19
+ preserveStageShells?: StageShellRetentionMode;
20
+ runId?: string;
21
+ events?: RunEventSink;
22
+ }): Promise<boolean>;
23
+ export declare function createNativeLocalServiceRunHandlers(options?: NativeLocalServiceRunHandlerOptions): Pick<LocalServiceRunHandlers, "planActionProposal" | "createCompileRun" | "createTestRun" | "createReadinessCheckDraft" | "createMethodAuthoringRun">;