@interf/compiler 0.9.4 → 0.9.5
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.
- package/CHANGELOG.md +93 -0
- package/README.md +2 -1
- package/agent-skills/interf-actions/SKILL.md +17 -11
- package/agent-skills/interf-actions/references/cli.md +8 -22
- package/dist/cli/commands/action-input-cli.d.ts +25 -0
- package/dist/cli/commands/action-input-cli.js +73 -0
- package/dist/cli/commands/compile.d.ts +3 -8
- package/dist/cli/commands/compile.js +13 -41
- package/dist/cli/commands/create-method-wizard.d.ts +0 -12
- package/dist/cli/commands/create-method-wizard.js +95 -126
- package/dist/cli/commands/create.d.ts +0 -2
- package/dist/cli/commands/create.js +16 -22
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/executor-flow.js +1 -1
- package/dist/cli/commands/init.d.ts +16 -1
- package/dist/cli/commands/init.js +40 -53
- package/dist/cli/commands/list.js +1 -1
- package/dist/cli/commands/preparation-action.d.ts +8 -0
- package/dist/cli/commands/preparation-action.js +29 -0
- package/dist/cli/commands/preparation-picker.d.ts +5 -0
- package/dist/cli/commands/preparation-picker.js +36 -0
- package/dist/cli/commands/preparation-selection.js +2 -2
- package/dist/cli/commands/reset.js +15 -4
- package/dist/cli/commands/service-action-flow.d.ts +9 -0
- package/dist/cli/commands/service-action-flow.js +19 -0
- package/dist/cli/commands/source-config-wizard.d.ts +0 -1
- package/dist/cli/commands/source-config-wizard.js +43 -53
- package/dist/cli/commands/status.js +7 -123
- package/dist/cli/commands/test.d.ts +1 -2
- package/dist/cli/commands/test.js +40 -203
- package/dist/cli/commands/web.js +8 -262
- package/dist/compiler-ui/404.html +1 -1
- package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
- package/dist/compiler-ui/__next._full.txt +3 -3
- package/dist/compiler-ui/__next._head.txt +1 -1
- package/dist/compiler-ui/__next._index.txt +2 -2
- package/dist/compiler-ui/__next._tree.txt +2 -2
- package/dist/compiler-ui/_next/static/chunks/177mvn4rse235.js +89 -0
- package/dist/compiler-ui/_next/static/chunks/18a8f2jkv3z.c.css +3 -0
- package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
- package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
- package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
- package/dist/compiler-ui/_not-found.html +1 -1
- package/dist/compiler-ui/_not-found.txt +2 -2
- package/dist/compiler-ui/index.html +1 -1
- package/dist/compiler-ui/index.txt +3 -3
- package/dist/index.d.ts +0 -23
- package/dist/index.js +0 -16
- package/dist/packages/agents/lib/shells.js +2 -2
- package/dist/packages/compiler/lib/schema.d.ts +1 -1
- package/dist/packages/compiler/lib/schema.js +1 -1
- package/dist/packages/contracts/lib/schema.d.ts +0 -1
- package/dist/packages/contracts/lib/schema.js +0 -1
- package/dist/packages/execution/lib/schema.d.ts +0 -7
- package/dist/packages/execution/lib/schema.js +0 -1
- package/dist/packages/local-service/action-definitions.d.ts +246 -0
- package/dist/packages/local-service/action-definitions.js +1148 -0
- package/dist/packages/local-service/action-planner.d.ts +9 -0
- package/dist/packages/local-service/action-planner.js +134 -0
- package/dist/packages/local-service/action-values.d.ts +1 -23
- package/dist/packages/local-service/action-values.js +1 -31
- package/dist/packages/local-service/client.d.ts +48 -17
- package/dist/packages/local-service/client.js +95 -52
- package/dist/packages/local-service/index.d.ts +8 -5
- package/dist/packages/local-service/index.js +5 -3
- package/dist/packages/local-service/lib/schema.d.ts +301 -295
- package/dist/packages/local-service/lib/schema.js +114 -39
- package/dist/packages/local-service/native-run-handlers.d.ts +23 -0
- package/dist/{cli/commands/compile-controller.js → packages/local-service/native-run-handlers.js} +203 -19
- package/dist/{cli/commands/check-draft.d.ts → packages/local-service/readiness-check-draft.d.ts} +2 -2
- package/dist/packages/local-service/routes.d.ts +6 -1
- package/dist/packages/local-service/routes.js +7 -2
- package/dist/packages/local-service/run-observability.js +15 -17
- package/dist/packages/local-service/runtime.d.ts +10 -7
- package/dist/packages/local-service/runtime.js +427 -297
- package/dist/packages/local-service/server.js +94 -44
- package/dist/packages/method-package/method-review-paths.d.ts +1 -1
- package/dist/packages/method-package/method-review-paths.js +5 -5
- package/dist/packages/project-model/index.d.ts +1 -0
- package/dist/packages/project-model/index.js +1 -0
- package/dist/packages/project-model/preparation-entries.d.ts +11 -0
- package/dist/packages/project-model/preparation-entries.js +49 -0
- package/dist/packages/project-model/source-config.d.ts +1 -0
- package/dist/packages/project-model/source-config.js +12 -1
- package/dist/packages/testing/lib/schema.d.ts +2 -3
- package/dist/packages/testing/lib/schema.js +2 -3
- package/dist/packages/testing/readiness-check-run.d.ts +3 -3
- package/dist/packages/testing/readiness-check-run.js +12 -17
- package/package.json +5 -24
- package/dist/cli/commands/compile-controller.d.ts +0 -17
- package/dist/cli/commands/compiled-flow.d.ts +0 -25
- package/dist/cli/commands/compiled-flow.js +0 -112
- package/dist/cli/commands/test-flow.d.ts +0 -58
- package/dist/cli/commands/test-flow.js +0 -231
- package/dist/compiler-ui/_next/static/chunks/0d~8t0zm6545p.js +0 -118
- package/dist/compiler-ui/_next/static/chunks/0xnel.ax9a.2c.css +0 -3
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → 84FaeF3EzBF9kKTMjSEVN}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → 84FaeF3EzBF9kKTMjSEVN}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{j7pdoqWrl4YJrJUVnksbl → 84FaeF3EzBF9kKTMjSEVN}/_ssgManifest.js +0 -0
- /package/dist/{cli/commands/check-draft.js → packages/local-service/readiness-check-draft.js} +0 -0
|
@@ -22,7 +22,13 @@ export const LocalServiceHealthSchema = z.object({
|
|
|
22
22
|
started_at: z.string().min(1).optional(),
|
|
23
23
|
package_version: z.string().min(1).optional(),
|
|
24
24
|
}).strict();
|
|
25
|
-
export const
|
|
25
|
+
export const LocalServiceErrorSchema = z.object({
|
|
26
|
+
error: z.object({
|
|
27
|
+
message: z.string().min(1),
|
|
28
|
+
code: z.string().min(1).optional(),
|
|
29
|
+
}).strict(),
|
|
30
|
+
}).strict();
|
|
31
|
+
export const LocalServicePointerSchema = z.object({
|
|
26
32
|
service_url: z.string().min(1),
|
|
27
33
|
host: LocalServiceHostSchema,
|
|
28
34
|
port: LocalServicePortSchema,
|
|
@@ -66,6 +72,7 @@ export const MethodResourceSchema = z.object({
|
|
|
66
72
|
source_kind: z.enum(["builtin", "local"]).default("local"),
|
|
67
73
|
built_in: z.boolean().default(false),
|
|
68
74
|
active_for_preparations: z.array(PreparationNameSchema).default([]),
|
|
75
|
+
output_paths: z.array(z.string().min(1)).default([]),
|
|
69
76
|
stages: z.array(z.object({
|
|
70
77
|
id: z.string().min(1),
|
|
71
78
|
label: z.string().min(1),
|
|
@@ -99,12 +106,9 @@ export const CompileRunResourceSchema = z.object({
|
|
|
99
106
|
run: CompileRunSchema,
|
|
100
107
|
}).strict();
|
|
101
108
|
export const LocalJobTypeSchema = z.enum([
|
|
102
|
-
"preparation-setup",
|
|
103
109
|
"readiness-check-draft",
|
|
104
110
|
"method-authoring",
|
|
105
111
|
"method-improvement",
|
|
106
|
-
"compile",
|
|
107
|
-
"test",
|
|
108
112
|
]);
|
|
109
113
|
export const LocalJobStatusSchema = z.enum([
|
|
110
114
|
"queued",
|
|
@@ -116,7 +120,7 @@ export const LocalJobStatusSchema = z.enum([
|
|
|
116
120
|
export const LocalRunHandlerResultSchema = z.object({
|
|
117
121
|
ok: z.boolean(),
|
|
118
122
|
error: z.string().min(1).optional(),
|
|
119
|
-
|
|
123
|
+
readiness_run: ReadinessCheckRunSchema.nullable().optional(),
|
|
120
124
|
}).strict();
|
|
121
125
|
export const LocalJobAgentSchema = z.object({
|
|
122
126
|
name: z.string().min(1),
|
|
@@ -174,6 +178,80 @@ export const LocalJobRunCreateRequestSchema = z.object({
|
|
|
174
178
|
export const PreparationSetupCreateRequestSchema = z.object({
|
|
175
179
|
preparation: SourcePreparationConfigSchema,
|
|
176
180
|
prepare_after_setup: z.boolean().default(false),
|
|
181
|
+
setup_mode: z.enum(["create", "select-method"]).default("create"),
|
|
182
|
+
}).strict();
|
|
183
|
+
export const PreparationSetupResultSchema = z.object({
|
|
184
|
+
kind: z.literal("interf-preparation-setup-result"),
|
|
185
|
+
version: z.literal(1),
|
|
186
|
+
operation: z.enum(["create", "select-method"]),
|
|
187
|
+
preparation: PreparationNameSchema,
|
|
188
|
+
method: MethodIdSchema,
|
|
189
|
+
source_folder_path: z.string().min(1),
|
|
190
|
+
config_path: z.string().min(1),
|
|
191
|
+
portable_context_path: z.string().min(1),
|
|
192
|
+
changed: z.boolean(),
|
|
193
|
+
message: z.string().min(1),
|
|
194
|
+
submitted_run_id: z.string().min(1).nullable().optional(),
|
|
195
|
+
submitted_run_type: z.literal("compile-run").nullable().optional(),
|
|
196
|
+
}).strict();
|
|
197
|
+
export const MethodChangeCreateRequestSchema = z.discriminatedUnion("operation", [
|
|
198
|
+
z.object({
|
|
199
|
+
action_type: z.literal("method-change").optional(),
|
|
200
|
+
operation: z.literal("duplicate"),
|
|
201
|
+
method: MethodIdSchema,
|
|
202
|
+
new_method_id: MethodIdSchema,
|
|
203
|
+
label: z.string().min(1).optional(),
|
|
204
|
+
hint: z.string().min(1).optional(),
|
|
205
|
+
}).strict(),
|
|
206
|
+
z.object({
|
|
207
|
+
action_type: z.literal("method-change").optional(),
|
|
208
|
+
operation: z.literal("remove"),
|
|
209
|
+
method: MethodIdSchema,
|
|
210
|
+
confirmation: MethodIdSchema,
|
|
211
|
+
}).strict(),
|
|
212
|
+
]);
|
|
213
|
+
export const MethodChangeResultSchema = z.object({
|
|
214
|
+
kind: z.literal("interf-method-change-result"),
|
|
215
|
+
version: z.literal(1),
|
|
216
|
+
operation: z.enum(["duplicate", "remove"]),
|
|
217
|
+
method: MethodIdSchema,
|
|
218
|
+
new_method_id: MethodIdSchema.nullable().optional(),
|
|
219
|
+
updated_preparations: z.array(PreparationNameSchema).default([]),
|
|
220
|
+
method_path: z.string().min(1),
|
|
221
|
+
changed: z.boolean(),
|
|
222
|
+
message: z.string().min(1),
|
|
223
|
+
}).strict();
|
|
224
|
+
export const PreparationChangeCreateRequestSchema = z.discriminatedUnion("operation", [
|
|
225
|
+
z.object({
|
|
226
|
+
action_type: z.literal("preparation-change").optional(),
|
|
227
|
+
operation: z.literal("remove"),
|
|
228
|
+
preparation: PreparationNameSchema,
|
|
229
|
+
confirmation: PreparationNameSchema,
|
|
230
|
+
}).strict(),
|
|
231
|
+
]);
|
|
232
|
+
export const PreparationChangeResultSchema = z.object({
|
|
233
|
+
kind: z.literal("interf-preparation-change-result"),
|
|
234
|
+
version: z.literal(1),
|
|
235
|
+
operation: z.literal("remove"),
|
|
236
|
+
preparation: PreparationNameSchema,
|
|
237
|
+
config_path: z.string().min(1),
|
|
238
|
+
portable_context_path: z.string().min(1),
|
|
239
|
+
portable_context_retained: z.boolean(),
|
|
240
|
+
changed: z.boolean(),
|
|
241
|
+
message: z.string().min(1),
|
|
242
|
+
}).strict();
|
|
243
|
+
export const ResetRequestSchema = z.object({
|
|
244
|
+
preparation: PreparationNameSchema,
|
|
245
|
+
scope: z.enum(["compile", "all"]),
|
|
246
|
+
}).strict();
|
|
247
|
+
export const ResetResultSchema = z.object({
|
|
248
|
+
kind: z.literal("interf-reset-result"),
|
|
249
|
+
version: z.literal(1),
|
|
250
|
+
preparation: PreparationNameSchema,
|
|
251
|
+
scope: z.enum(["compile", "all"]),
|
|
252
|
+
portable_context_path: z.string().min(1),
|
|
253
|
+
changed: z.boolean(),
|
|
254
|
+
message: z.string().min(1),
|
|
177
255
|
}).strict();
|
|
178
256
|
export const ReadinessCheckDraftCreateRequestSchema = z.object({
|
|
179
257
|
preparation: PreparationNameSchema,
|
|
@@ -251,40 +329,12 @@ export const TestRunResourceSchema = z.object({
|
|
|
251
329
|
portable_context_path: z.string().min(1).nullable(),
|
|
252
330
|
started_at: z.string().nullable().optional(),
|
|
253
331
|
finished_at: z.string().nullable().optional(),
|
|
254
|
-
|
|
332
|
+
readiness_run: ReadinessCheckRunSchema.nullable(),
|
|
255
333
|
readiness: ReadinessStateSchema.nullable().optional(),
|
|
256
334
|
events: z.array(InterfRunEventSchema).default([]),
|
|
257
335
|
error: z.string().min(1).nullable().optional(),
|
|
258
336
|
}).strict();
|
|
259
337
|
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
338
|
export const LocalExecutorStatusSchema = z.object({
|
|
289
339
|
kind: z.literal("interf-local-executor-status"),
|
|
290
340
|
version: z.literal(1),
|
|
@@ -298,10 +348,20 @@ export const LocalExecutorSelectRequestSchema = z.object({
|
|
|
298
348
|
agent: z.string().min(1),
|
|
299
349
|
}).strict();
|
|
300
350
|
export const ActionProposalTypeSchema = z.enum([
|
|
351
|
+
"clarification",
|
|
352
|
+
"readiness-check-draft",
|
|
353
|
+
"method-authoring",
|
|
354
|
+
"method-improvement",
|
|
355
|
+
"compile",
|
|
356
|
+
"test",
|
|
357
|
+
]);
|
|
358
|
+
export const ActionProposalPlanActionTypeSchema = z.enum([
|
|
301
359
|
"clarification",
|
|
302
360
|
"preparation-setup",
|
|
361
|
+
"preparation-change",
|
|
303
362
|
"readiness-check-draft",
|
|
304
363
|
"method-authoring",
|
|
364
|
+
"method-change",
|
|
305
365
|
"method-improvement",
|
|
306
366
|
"compile",
|
|
307
367
|
"test",
|
|
@@ -314,13 +374,22 @@ export const ActionProposalStatusSchema = z.enum([
|
|
|
314
374
|
"submitted",
|
|
315
375
|
"failed",
|
|
316
376
|
]);
|
|
377
|
+
export const ActionClientOriginSchema = z.enum([
|
|
378
|
+
"ui-chat",
|
|
379
|
+
"cli",
|
|
380
|
+
"agent-cli",
|
|
381
|
+
"mcp",
|
|
382
|
+
"service",
|
|
383
|
+
"unknown",
|
|
384
|
+
]);
|
|
317
385
|
export const ActionProposalCreateRequestSchema = z.object({
|
|
318
386
|
message: z.string().min(1),
|
|
319
387
|
preparation: PreparationNameSchema.optional(),
|
|
388
|
+
client_origin: ActionClientOriginSchema.default("unknown"),
|
|
320
389
|
values: JsonObjectSchema.optional(),
|
|
321
390
|
}).strict();
|
|
322
391
|
export const ActionProposalPlanSchema = z.object({
|
|
323
|
-
action_type:
|
|
392
|
+
action_type: ActionProposalPlanActionTypeSchema,
|
|
324
393
|
preparation: PreparationNameSchema.optional(),
|
|
325
394
|
method: MethodIdSchema.optional(),
|
|
326
395
|
values: JsonObjectSchema.optional(),
|
|
@@ -350,6 +419,7 @@ const ActionProposalResourceBaseSchema = z.object({
|
|
|
350
419
|
message: z.string().min(1),
|
|
351
420
|
preparation: PreparationNameSchema.nullable().optional(),
|
|
352
421
|
method: MethodIdSchema.nullable().optional(),
|
|
422
|
+
client_origin: ActionClientOriginSchema.default("unknown"),
|
|
353
423
|
created_at: z.string().min(1),
|
|
354
424
|
updated_at: z.string().min(1),
|
|
355
425
|
proposed_by_executor: LocalJobAgentSchema.nullable().optional(),
|
|
@@ -367,10 +437,6 @@ export const ActionProposalResourceSchema = z.discriminatedUnion("action_type",
|
|
|
367
437
|
action_type: z.literal("compile"),
|
|
368
438
|
request: CompileRunCreateRequestSchema,
|
|
369
439
|
}).strict(),
|
|
370
|
-
ActionProposalResourceBaseSchema.extend({
|
|
371
|
-
action_type: z.literal("preparation-setup"),
|
|
372
|
-
request: PreparationSetupCreateRequestSchema,
|
|
373
|
-
}).strict(),
|
|
374
440
|
ActionProposalResourceBaseSchema.extend({
|
|
375
441
|
action_type: z.literal("test"),
|
|
376
442
|
request: TestRunCreateRequestSchema,
|
|
@@ -425,6 +491,15 @@ export const LocalServiceDiscoverySchema = z.object({
|
|
|
425
491
|
source_files: z.string().min(1),
|
|
426
492
|
workspace_files: z.string().min(1),
|
|
427
493
|
action_proposals: z.string().min(1),
|
|
494
|
+
preparation_setups: z.string().min(1),
|
|
495
|
+
preparation_changes: z.string().min(1),
|
|
496
|
+
method_changes: z.string().min(1),
|
|
497
|
+
readiness_check_drafts: z.string().min(1),
|
|
498
|
+
method_authoring_runs: z.string().min(1),
|
|
499
|
+
method_improvement_runs: z.string().min(1),
|
|
500
|
+
compile_runs: z.string().min(1),
|
|
501
|
+
test_runs: z.string().min(1),
|
|
502
|
+
reset: z.string().min(1),
|
|
428
503
|
executor: z.string().min(1),
|
|
429
504
|
}).strict(),
|
|
430
505
|
}).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">;
|
package/dist/{cli/commands/compile-controller.js → packages/local-service/native-run-handlers.js}
RENAMED
|
@@ -2,16 +2,22 @@ import { cpSync, existsSync, mkdirSync, mkdtempSync, rmSync } from "node:fs";
|
|
|
2
2
|
import { tmpdir } from "node:os";
|
|
3
3
|
import { dirname, join } from "node:path";
|
|
4
4
|
import chalk from "chalk";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
5
|
+
import { compileCompiled, } from "../compiler/method-runs.js";
|
|
6
|
+
import { readInterfConfig } from "../project-model/interf.js";
|
|
7
|
+
import { resolveLocalExecutor, } from "../agents/lib/executors.js";
|
|
8
|
+
import { formatMethodExecutionProfile } from "../agents/lib/execution-profile.js";
|
|
9
|
+
import { clearCompiledRuntimeDerivedArtifacts, } from "../compiler/reset.js";
|
|
10
|
+
import { formatActiveCompiledMethodStageStep, resolveRequiredCompiledMethodFromConfig, } from "../method-package/method-definitions.js";
|
|
11
|
+
import { loadCompiledPreparationConfig, resolvePreparationCompileMaxAttempts, resolvePreparationCompileMaxLoops, } from "../project-model/source-config.js";
|
|
12
|
+
import { runMethodImprovementLoop } from "../method-authoring/method-improvement.js";
|
|
13
|
+
import { stageExecutionShellsRoot, methodPackagePathForCompiled, } from "../compiler/compiled-paths.js";
|
|
14
|
+
import { readCompiledSchemaFile } from "../compiler/compiled-schema.js";
|
|
15
|
+
import { initializeCompiledRuntimeState } from "../compiler/state.js";
|
|
16
|
+
import { readinessPassRate, runReadinessChecksForExecutor, runSavedPortableContextCheck, } from "../testing/readiness-check-run.js";
|
|
17
|
+
import { runMethodAuthoringDraft, } from "../method-authoring/method-authoring.js";
|
|
18
|
+
import { draftReadinessChecks, } from "./readiness-check-draft.js";
|
|
19
|
+
import { planActionProposalWithExecutor, } from "./action-planner.js";
|
|
20
|
+
import { ActionProposalPlanSchema, } from "./lib/schema.js";
|
|
15
21
|
function printCompileFailure(compiledPath, failedStage) {
|
|
16
22
|
resolveRequiredCompiledMethodFromConfig(readInterfConfig(compiledPath), `.interf/interf.json for ${compiledPath}`);
|
|
17
23
|
let failedStageLabel = failedStage ? `Stage "${failedStage}"` : "Compile";
|
|
@@ -26,6 +32,55 @@ function printCompileFailure(compiledPath, failedStage) {
|
|
|
26
32
|
function testScore(outcome) {
|
|
27
33
|
return (outcome.result.passedCases * 1000) + outcome.result.passedChecks;
|
|
28
34
|
}
|
|
35
|
+
async function compileCompiledWithReporter(executor, compiledPath, options = {}) {
|
|
36
|
+
console.log();
|
|
37
|
+
console.log(chalk.bold(` ${options.heading ?? "Building Portable Context..."}`));
|
|
38
|
+
const profileLabel = formatMethodExecutionProfile(executor.executionProfile);
|
|
39
|
+
if (profileLabel) {
|
|
40
|
+
console.log(chalk.dim(` Execution profile: ${profileLabel}`));
|
|
41
|
+
}
|
|
42
|
+
console.log();
|
|
43
|
+
const reporter = {
|
|
44
|
+
line: (message) => console.log(chalk.dim(` ${message}`)),
|
|
45
|
+
blankLine: () => console.log(),
|
|
46
|
+
};
|
|
47
|
+
const result = await compileCompiled({
|
|
48
|
+
executor,
|
|
49
|
+
compiledPath,
|
|
50
|
+
reporter,
|
|
51
|
+
preserveStageShells: options.preserveStageShells,
|
|
52
|
+
runId: options.runId,
|
|
53
|
+
events: options.events,
|
|
54
|
+
});
|
|
55
|
+
if (!result.ok)
|
|
56
|
+
return result;
|
|
57
|
+
console.log();
|
|
58
|
+
console.log(chalk.green(` ${options.successMessage ?? "Portable Context ready."}`));
|
|
59
|
+
return result;
|
|
60
|
+
}
|
|
61
|
+
function printSavedReadinessOutcome(prefix, outcome) {
|
|
62
|
+
const color = outcome.result.ok ? chalk.green : chalk.red;
|
|
63
|
+
const status = outcome.result.ok ? chalk.green("PASS") : chalk.red("FAIL");
|
|
64
|
+
console.log(chalk.bold(` ${prefix}`));
|
|
65
|
+
console.log();
|
|
66
|
+
console.log(color(` ${status} ${outcome.result.passedCases}/${outcome.result.totalCases} readiness checks`));
|
|
67
|
+
console.log();
|
|
68
|
+
for (const [index, caseResult] of outcome.result.caseResults.entries()) {
|
|
69
|
+
const caseStatus = caseResult.ok ? chalk.green("PASS") : chalk.red("FAIL");
|
|
70
|
+
console.log(` ${caseStatus} Check ${index + 1}`);
|
|
71
|
+
console.log(chalk.dim(` ${caseResult.question}`));
|
|
72
|
+
const failedChecks = caseResult.checks.filter((entry) => !entry.ok).slice(0, 3);
|
|
73
|
+
for (const failedCheck of failedChecks) {
|
|
74
|
+
console.log(chalk.dim(` Failed criterion: ${failedCheck.label}: ${failedCheck.detail}`));
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
console.log();
|
|
78
|
+
if (outcome.result.sandbox_path) {
|
|
79
|
+
console.log(chalk.dim(` Preserved sandbox: ${outcome.result.sandbox_path}`));
|
|
80
|
+
console.log();
|
|
81
|
+
}
|
|
82
|
+
console.log(chalk.dim(` Saved run: ${outcome.displayRunPath ?? outcome.runPath}`));
|
|
83
|
+
}
|
|
29
84
|
function bestVariationRestorePaths(compiledPath) {
|
|
30
85
|
const schema = readCompiledSchemaFile(methodPackagePathForCompiled(compiledPath));
|
|
31
86
|
const zonePaths = (schema?.zones ?? [])
|
|
@@ -107,12 +162,11 @@ async function runMethodVariation(options) {
|
|
|
107
162
|
fatalError: null,
|
|
108
163
|
};
|
|
109
164
|
}
|
|
110
|
-
const outcome = await
|
|
165
|
+
const outcome = await runSavedPortableContextCheck({
|
|
111
166
|
sourcePath: options.sourcePath,
|
|
112
167
|
preparationConfig: options.compiledConfig,
|
|
113
168
|
executor: options.testExecutor,
|
|
114
|
-
|
|
115
|
-
compiledPath: options.compiledPath,
|
|
169
|
+
portableContextPath: options.compiledPath,
|
|
116
170
|
preserveSandboxes: options.preserveStageShells === "always" ? "always" : "on-failure",
|
|
117
171
|
});
|
|
118
172
|
if (!outcome) {
|
|
@@ -123,11 +177,11 @@ async function runMethodVariation(options) {
|
|
|
123
177
|
bestOutcome,
|
|
124
178
|
bestSnapshotPath,
|
|
125
179
|
bestAttempt,
|
|
126
|
-
fatalError: "Could not run the
|
|
180
|
+
fatalError: "Could not run saved readiness checks against the Portable Context after prepare.",
|
|
127
181
|
};
|
|
128
182
|
}
|
|
129
183
|
console.log();
|
|
130
|
-
|
|
184
|
+
printSavedReadinessOutcome(`${options.variationLabel} · attempt ${attempt}/${options.maxAttempts}`, outcome);
|
|
131
185
|
if (!bestOutcome || testScore(outcome) > testScore(bestOutcome)) {
|
|
132
186
|
if (bestSnapshotPath) {
|
|
133
187
|
rmSync(bestSnapshotPath, { recursive: true, force: true });
|
|
@@ -185,7 +239,7 @@ function summarizeMethodVariation(options) {
|
|
|
185
239
|
: options.result.bestOutcome
|
|
186
240
|
? `Best result: ${passedChecks}/${totalChecks} readiness checks passed.`
|
|
187
241
|
: options.result.failedStage
|
|
188
|
-
? `
|
|
242
|
+
? `Prepare failed at stage ${options.result.failedStage} before any saved readiness result.`
|
|
189
243
|
: "Method variation did not produce a passing result.";
|
|
190
244
|
return {
|
|
191
245
|
variation: options.variation,
|
|
@@ -219,10 +273,10 @@ function printPostCompileNextStep(options) {
|
|
|
219
273
|
return;
|
|
220
274
|
}
|
|
221
275
|
if (options.testedDuringCompile) {
|
|
222
|
-
console.log(chalk.dim(" Next: inspect the Portable Context agents will use, or run `interf test` if you also want
|
|
276
|
+
console.log(chalk.dim(" Next: inspect the Portable Context agents will use, or run `interf test` if you also want readiness evidence for source files and Portable Context."));
|
|
223
277
|
return;
|
|
224
278
|
}
|
|
225
|
-
console.log(chalk.dim(" Next: run `interf test` to
|
|
279
|
+
console.log(chalk.dim(" Next: run `interf test` to collect readiness evidence for source files and Portable Context."));
|
|
226
280
|
}
|
|
227
281
|
function formatVariationReadinessSummary(summary) {
|
|
228
282
|
return `${summary.passed_questions}/${summary.total_questions}`;
|
|
@@ -300,7 +354,7 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
300
354
|
const compiledConfig = options.compiledConfig
|
|
301
355
|
?? loadCompiledPreparationConfig(options.compiledPath)
|
|
302
356
|
?? {
|
|
303
|
-
name: readInterfConfig(options.compiledPath)?.name ?? "
|
|
357
|
+
name: readInterfConfig(options.compiledPath)?.name ?? "preparation",
|
|
304
358
|
path: "./source-folder",
|
|
305
359
|
checks: [],
|
|
306
360
|
};
|
|
@@ -443,3 +497,133 @@ export async function runConfiguredCompiledCompile(options) {
|
|
|
443
497
|
}
|
|
444
498
|
}
|
|
445
499
|
}
|
|
500
|
+
function resolveHandlerExecutor(configured) {
|
|
501
|
+
if (configured)
|
|
502
|
+
return configured;
|
|
503
|
+
const resolved = resolveLocalExecutor({ preflight: true });
|
|
504
|
+
if (!resolved.executor) {
|
|
505
|
+
throw new Error(resolved.error ?? "No local agent detected.");
|
|
506
|
+
}
|
|
507
|
+
return resolved.executor;
|
|
508
|
+
}
|
|
509
|
+
export function createNativeLocalServiceRunHandlers(options = {}) {
|
|
510
|
+
return {
|
|
511
|
+
async planActionProposal(request, context) {
|
|
512
|
+
const resolved = options.executor
|
|
513
|
+
? { executor: options.executor, error: null }
|
|
514
|
+
: resolveLocalExecutor({ preflight: true });
|
|
515
|
+
if (!resolved.executor) {
|
|
516
|
+
return ActionProposalPlanSchema.parse({
|
|
517
|
+
action_type: "clarification",
|
|
518
|
+
preparation: request.preparation,
|
|
519
|
+
assistant_message: resolved.error ?? "No local agent detected for action planning.",
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
return planActionProposalWithExecutor({
|
|
523
|
+
request,
|
|
524
|
+
context,
|
|
525
|
+
executor: resolved.executor,
|
|
526
|
+
});
|
|
527
|
+
},
|
|
528
|
+
async createCompileRun(request, context) {
|
|
529
|
+
const executor = resolveHandlerExecutor(options.executor);
|
|
530
|
+
const testExecutor = resolveHandlerExecutor(options.testExecutor ?? options.executor);
|
|
531
|
+
const ok = await runConfiguredCompiledCompile({
|
|
532
|
+
executor,
|
|
533
|
+
testExecutor,
|
|
534
|
+
compiledPath: context.compiledPath,
|
|
535
|
+
sourcePath: context.sourcePath,
|
|
536
|
+
compiledConfig: context.preparationConfig,
|
|
537
|
+
maxAttemptsOverride: request.max_attempts ?? null,
|
|
538
|
+
maxLoopsOverride: request.max_loops ?? null,
|
|
539
|
+
preserveStageShells: request.preserve_stage_shells,
|
|
540
|
+
runId: context.runId,
|
|
541
|
+
events: context.events,
|
|
542
|
+
});
|
|
543
|
+
return { ok };
|
|
544
|
+
},
|
|
545
|
+
async createTestRun(request, context) {
|
|
546
|
+
const executor = resolveHandlerExecutor(options.testExecutor ?? options.executor);
|
|
547
|
+
const result = await runReadinessChecksForExecutor({
|
|
548
|
+
sourcePath: context.sourcePath,
|
|
549
|
+
preparationConfig: context.preparationConfig,
|
|
550
|
+
portableContextPath: context.compiledPath,
|
|
551
|
+
mode: request.mode,
|
|
552
|
+
executor,
|
|
553
|
+
});
|
|
554
|
+
const missingSourceFiles = (request.mode === "raw" || request.mode === "both") && !result.rawOutcome;
|
|
555
|
+
const missingPortableContext = (request.mode === "compiled" || request.mode === "both") && !result.compiledOutcome;
|
|
556
|
+
if (missingSourceFiles || missingPortableContext) {
|
|
557
|
+
return {
|
|
558
|
+
ok: false,
|
|
559
|
+
readiness_run: result.readinessRun,
|
|
560
|
+
error: missingPortableContext
|
|
561
|
+
? "Portable Context is not ready for readiness checks."
|
|
562
|
+
: "Source files are not ready for readiness checks.",
|
|
563
|
+
};
|
|
564
|
+
}
|
|
565
|
+
return {
|
|
566
|
+
ok: true,
|
|
567
|
+
readiness_run: result.readinessRun,
|
|
568
|
+
};
|
|
569
|
+
},
|
|
570
|
+
async createReadinessCheckDraft(request, context) {
|
|
571
|
+
const executor = resolveHandlerExecutor(options.executor);
|
|
572
|
+
context.emit({
|
|
573
|
+
type: "log.appended",
|
|
574
|
+
step_id: "agent-draft",
|
|
575
|
+
message: `Using ${executor.displayName} to draft readiness checks.`,
|
|
576
|
+
});
|
|
577
|
+
const drafted = await draftReadinessChecks({
|
|
578
|
+
preparationName: request.preparation,
|
|
579
|
+
sourceFolderPath: request.source_folder_path,
|
|
580
|
+
about: request.about,
|
|
581
|
+
executor,
|
|
582
|
+
targetCount: request.target_count,
|
|
583
|
+
onStatus: (line) => context.emit({
|
|
584
|
+
type: "log.appended",
|
|
585
|
+
step_id: "agent-draft",
|
|
586
|
+
message: line,
|
|
587
|
+
}),
|
|
588
|
+
});
|
|
589
|
+
if (!drafted.checks) {
|
|
590
|
+
throw new Error(drafted.error ?? "Could not draft readiness checks from this Source Folder.");
|
|
591
|
+
}
|
|
592
|
+
return {
|
|
593
|
+
checks: drafted.checks,
|
|
594
|
+
};
|
|
595
|
+
},
|
|
596
|
+
async createMethodAuthoringRun(request, context) {
|
|
597
|
+
const executor = resolveHandlerExecutor(options.executor);
|
|
598
|
+
context.emit({
|
|
599
|
+
type: "log.appended",
|
|
600
|
+
step_id: "draft-package",
|
|
601
|
+
message: `Using ${executor.displayName} for Method authoring.`,
|
|
602
|
+
});
|
|
603
|
+
const result = await runMethodAuthoringDraft({
|
|
604
|
+
sourcePath: context.sourcePath,
|
|
605
|
+
sourceFolderPath: request.source_folder_path,
|
|
606
|
+
baseMethodId: request.reference_method_id ?? request.base_method_id,
|
|
607
|
+
methodId: request.method_id,
|
|
608
|
+
label: request.label,
|
|
609
|
+
hint: request.hint,
|
|
610
|
+
taskPrompt: request.task_prompt,
|
|
611
|
+
checks: request.checks,
|
|
612
|
+
executor,
|
|
613
|
+
onStatus: (line) => context.emit({
|
|
614
|
+
type: "log.appended",
|
|
615
|
+
step_id: "draft-package",
|
|
616
|
+
message: line,
|
|
617
|
+
}),
|
|
618
|
+
});
|
|
619
|
+
return {
|
|
620
|
+
status: result.status,
|
|
621
|
+
changed: result.changed,
|
|
622
|
+
summary: result.summary,
|
|
623
|
+
validation: result.validation,
|
|
624
|
+
method_path: result.methodPath,
|
|
625
|
+
shell_path: result.shellPath,
|
|
626
|
+
};
|
|
627
|
+
},
|
|
628
|
+
};
|
|
629
|
+
}
|
package/dist/{cli/commands/check-draft.d.ts → packages/local-service/readiness-check-draft.d.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MethodExecutor } from "
|
|
2
|
-
import type { SourceReadinessCheck } from "
|
|
1
|
+
import type { MethodExecutor } from "../agents/lib/executors.js";
|
|
2
|
+
import type { SourceReadinessCheck } from "../project-model/lib/schema.js";
|
|
3
3
|
export declare function buildReadinessCheckDraftPrompt(options: {
|
|
4
4
|
preparationName: string;
|
|
5
5
|
sourceFolderPath: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const LOCAL_SERVICE_DEFAULT_HOST = "127.0.0.1";
|
|
2
2
|
export declare const LOCAL_SERVICE_DEFAULT_PORT = 4873;
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const LOCAL_SERVICE_POINTER_PATH: readonly ["interf", ".service", "local-service.json"];
|
|
4
4
|
export declare const LOCAL_SERVICE_ROUTES: {
|
|
5
5
|
readonly root: "/";
|
|
6
6
|
readonly api: "/v1";
|
|
@@ -9,10 +9,15 @@ export declare const LOCAL_SERVICE_ROUTES: {
|
|
|
9
9
|
readonly workspaceFiles: "/v1/workspace-files";
|
|
10
10
|
readonly sourceFiles: "/v1/source-files";
|
|
11
11
|
readonly methods: "/v1/methods";
|
|
12
|
+
readonly preparationSetups: "/v1/preparation-setups";
|
|
13
|
+
readonly preparationChanges: "/v1/preparation-changes";
|
|
14
|
+
readonly methodChanges: "/v1/method-changes";
|
|
12
15
|
readonly jobs: "/v1/jobs";
|
|
13
16
|
readonly readinessCheckDrafts: "/v1/readiness-check-drafts";
|
|
14
17
|
readonly methodAuthoringRuns: "/v1/method-authoring-runs";
|
|
18
|
+
readonly methodImprovementRuns: "/v1/method-improvement-runs";
|
|
15
19
|
readonly runs: "/v1/runs";
|
|
20
|
+
readonly reset: "/v1/reset";
|
|
16
21
|
readonly executor: "/v1/executor";
|
|
17
22
|
readonly actionProposals: "/v1/action-proposals";
|
|
18
23
|
readonly compileRuns: "/v1/compile-runs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const LOCAL_SERVICE_DEFAULT_HOST = "127.0.0.1";
|
|
2
2
|
export const LOCAL_SERVICE_DEFAULT_PORT = 4873;
|
|
3
|
-
export const
|
|
3
|
+
export const LOCAL_SERVICE_POINTER_PATH = [
|
|
4
4
|
"interf",
|
|
5
5
|
".service",
|
|
6
|
-
"local-
|
|
6
|
+
"local-service.json",
|
|
7
7
|
];
|
|
8
8
|
export const LOCAL_SERVICE_ROUTES = {
|
|
9
9
|
root: "/",
|
|
@@ -13,10 +13,15 @@ export const LOCAL_SERVICE_ROUTES = {
|
|
|
13
13
|
workspaceFiles: "/v1/workspace-files",
|
|
14
14
|
sourceFiles: "/v1/source-files",
|
|
15
15
|
methods: "/v1/methods",
|
|
16
|
+
preparationSetups: "/v1/preparation-setups",
|
|
17
|
+
preparationChanges: "/v1/preparation-changes",
|
|
18
|
+
methodChanges: "/v1/method-changes",
|
|
16
19
|
jobs: "/v1/jobs",
|
|
17
20
|
readinessCheckDrafts: "/v1/readiness-check-drafts",
|
|
18
21
|
methodAuthoringRuns: "/v1/method-authoring-runs",
|
|
22
|
+
methodImprovementRuns: "/v1/method-improvement-runs",
|
|
19
23
|
runs: "/v1/runs",
|
|
24
|
+
reset: "/v1/reset",
|
|
20
25
|
executor: "/v1/executor",
|
|
21
26
|
actionProposals: "/v1/action-proposals",
|
|
22
27
|
compileRuns: "/v1/compile-runs",
|