@interf/compiler 0.16.0 → 0.18.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.
- package/LICENSE.md +1 -0
- package/README.md +10 -7
- package/TRADEMARKS.md +4 -4
- package/builtin-methods/interf-default/README.md +6 -7
- package/builtin-methods/interf-default/method.json +7 -68
- package/builtin-methods/interf-default/method.schema.json +52 -50
- package/dist/cli/commands/prep.js +58 -2
- package/dist/cli/commands/verify.d.ts +2 -0
- package/dist/cli/commands/verify.js +17 -8
- package/dist/cli/commands/wizard.js +122 -14
- 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/{13awzu4tooflw.css → 0_c_tvh-cukjz.css} +1 -1
- package/dist/compiler-ui/_next/static/chunks/{0jipmpez3_ehh.js → 0f_geuwdesg_c.js} +42 -17
- 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/packages/contracts/index.d.ts +2 -2
- package/dist/packages/contracts/index.js +1 -1
- package/dist/packages/contracts/lib/schema.d.ts +271 -72
- package/dist/packages/contracts/lib/schema.js +243 -83
- package/dist/packages/engine/action-definitions.js +1 -1
- package/dist/packages/engine/agents/lib/shells.d.ts +12 -4
- package/dist/packages/engine/agents/lib/shells.js +127 -120
- package/dist/packages/engine/cloud-seams.d.ts +115 -0
- package/dist/packages/engine/cloud-seams.js +84 -0
- package/dist/packages/engine/compile/artifact-counts.d.ts +1 -1
- package/dist/packages/engine/compile/artifact-counts.js +3 -3
- package/dist/packages/engine/compile/artifact-status.d.ts +41 -0
- package/dist/packages/engine/compile/artifact-status.js +166 -0
- package/dist/packages/engine/compile/billing-events.d.ts +89 -0
- package/dist/packages/engine/compile/billing-events.js +74 -0
- package/dist/packages/engine/compile/check-evaluator.d.ts +66 -0
- package/dist/packages/engine/compile/check-evaluator.js +298 -0
- package/dist/packages/engine/compile/compiled-schema.d.ts +7 -17
- package/dist/packages/engine/compile/compiled-schema.js +55 -70
- package/dist/packages/engine/compile/compiled-stage-plan.d.ts +1 -0
- package/dist/packages/engine/compile/compiled-stage-plan.js +32 -15
- package/dist/packages/engine/compile/compiled-stage-runner.js +1 -1
- package/dist/packages/engine/compile/index.d.ts +0 -1
- package/dist/packages/engine/compile/index.js +0 -1
- package/dist/packages/engine/compile/lib/schema.d.ts +111 -92
- package/dist/packages/engine/compile/lib/schema.js +35 -39
- package/dist/packages/engine/compile/method-primitives.d.ts +2 -2
- package/dist/packages/engine/compile/method-primitives.js +1 -1
- package/dist/packages/engine/compile/reset.js +4 -4
- package/dist/packages/engine/compile/runtime-contracts.js +2 -1
- package/dist/packages/engine/compile/runtime-prompt.js +3 -2
- package/dist/packages/engine/compile/runtime-reconcile.js +35 -35
- package/dist/packages/engine/compile/runtime-runs.js +0 -1
- package/dist/packages/engine/compile/runtime-types.d.ts +7 -8
- package/dist/packages/engine/compile/runtime.d.ts +1 -2
- package/dist/packages/engine/compile/runtime.js +0 -1
- package/dist/packages/engine/compile/state-health.js +6 -6
- package/dist/packages/engine/compile/state-view.js +7 -6
- package/dist/packages/engine/compile/validate-compiled.js +61 -30
- package/dist/packages/engine/compile/validate.js +26 -24
- package/dist/packages/engine/execution/lib/schema.d.ts +79 -33
- package/dist/packages/engine/execution/lib/schema.js +13 -5
- package/dist/packages/engine/index.d.ts +2 -2
- package/dist/packages/engine/index.js +1 -1
- package/dist/packages/engine/lib/schema.d.ts +551 -242
- package/dist/packages/engine/lib/schema.js +53 -17
- package/dist/packages/engine/native-run-handlers.js +15 -7
- package/dist/packages/engine/preparation-store.d.ts +6 -0
- package/dist/packages/engine/preparation-store.js +8 -0
- package/dist/packages/engine/routes.d.ts +6 -0
- package/dist/packages/engine/routes.js +6 -0
- package/dist/packages/engine/run-observability.js +1 -2
- package/dist/packages/engine/runtime-event-applier.js +7 -0
- package/dist/packages/engine/runtime-proposal-helpers.js +1 -1
- package/dist/packages/engine/runtime-resource-builders.d.ts +6 -6
- package/dist/packages/engine/runtime-resource-builders.js +5 -4
- package/dist/packages/engine/runtime.d.ts +67 -7
- package/dist/packages/engine/runtime.js +159 -29
- package/dist/packages/engine/server.d.ts +25 -0
- package/dist/packages/engine/server.js +62 -3
- package/dist/packages/engine/verify/index.d.ts +10 -10
- package/dist/packages/engine/verify/index.js +8 -8
- package/dist/packages/engine/verify/readiness-check-run.d.ts +27 -4
- package/dist/packages/engine/verify/readiness-check-run.js +92 -24
- package/dist/packages/engine/verify/{test-execution.d.ts → verify-execution.d.ts} +2 -2
- package/dist/packages/engine/verify/{test-execution.js → verify-execution.js} +2 -2
- package/dist/packages/engine/verify/{test-paths.d.ts → verify-paths.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-sandbox.d.ts → verify-sandbox.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-specs.d.ts → verify-specs.d.ts} +1 -1
- package/dist/packages/engine/verify/{test-specs.js → verify-specs.js} +1 -1
- package/dist/packages/engine/verify/{test-targets.d.ts → verify-targets.d.ts} +1 -1
- package/dist/packages/engine/verify/{test.d.ts → verify.d.ts} +4 -4
- package/dist/packages/engine/verify/{test.js → verify.js} +3 -3
- package/dist/packages/engine/wire-schemas.d.ts +545 -0
- package/dist/packages/engine/wire-schemas.js +59 -0
- package/dist/packages/methods/authoring/method-authoring.d.ts +2 -0
- package/dist/packages/methods/authoring/method-authoring.js +99 -18
- package/dist/packages/methods/authoring/method-edit-session.js +5 -5
- package/dist/packages/methods/authoring/method-improvement.js +1 -1
- package/dist/packages/methods/package/builtin-compiled-method.d.ts +12 -12
- package/dist/packages/methods/package/builtin-compiled-method.js +25 -22
- package/dist/packages/methods/package/context-interface.d.ts +39 -26
- package/dist/packages/methods/package/context-interface.js +48 -39
- package/dist/packages/methods/package/interf-method-package.js +28 -47
- package/dist/packages/methods/package/local-methods.d.ts +3 -4
- package/dist/packages/methods/package/local-methods.js +34 -62
- package/dist/packages/methods/package/method-definitions.d.ts +4 -6
- package/dist/packages/methods/package/method-definitions.js +0 -4
- package/dist/packages/methods/package/method-helpers.d.ts +0 -2
- package/dist/packages/methods/package/method-helpers.js +0 -4
- package/dist/packages/project/interf-scaffold.js +12 -12
- package/dist/packages/project/source-config.js +2 -1
- package/package.json +6 -16
- package/dist/packages/engine/compile/runtime-acceptance.d.ts +0 -9
- package/dist/packages/engine/compile/runtime-acceptance.js +0 -265
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → 6qyE1u9m_oBUkvAhhoCmO}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → 6qyE1u9m_oBUkvAhhoCmO}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{a3UiUF0DiMEbfWy_0gihg → 6qyE1u9m_oBUkvAhhoCmO}/_ssgManifest.js +0 -0
- /package/dist/packages/engine/verify/{test-paths.js → verify-paths.js} +0 -0
- /package/dist/packages/engine/verify/{test-profile-presets.d.ts → verify-profile-presets.d.ts} +0 -0
- /package/dist/packages/engine/verify/{test-profile-presets.js → verify-profile-presets.js} +0 -0
- /package/dist/packages/engine/verify/{test-sandbox.js → verify-sandbox.js} +0 -0
- /package/dist/packages/engine/verify/{test-targets.js → verify-targets.js} +0 -0
- /package/dist/packages/engine/verify/{test-types.d.ts → verify-types.d.ts} +0 -0
- /package/dist/packages/engine/verify/{test-types.js → verify-types.js} +0 -0
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { ArtifactRefSchema, CompileRunSchema, CompileRunStatusSchema, InterfRunEventSchema, ProofRecordSchema, RunObservabilitySchema, } from "../execution/lib/schema.js";
|
|
3
3
|
import { SourcePreparationConfigSchema, SourceReadinessCheckSchema, } from "../../project/lib/schema.js";
|
|
4
|
-
import { LocatorSchema, PreparationNameSchema,
|
|
4
|
+
import { ArtifactSchema, ArtifactIdSchema, ArtifactPathShapeSchema, ArtifactStatusSchema, CheckSchema, LocatorSchema, PreparationNameSchema, ReadinessSchema, SourceCompiledMaxAttemptsSchema, SourceCompiledMaxLoopsSchema, MethodIdSchema, TestTargetTypeSchema, } from "../../contracts/lib/schema.js";
|
|
5
5
|
import { ReadinessCheckRunSchema, } from "../verify/lib/schema.js";
|
|
6
6
|
const JsonObjectSchema = z.record(z.string(), z.unknown());
|
|
7
7
|
// ───────────────────────────────────────────────────────────────────────────
|
|
8
8
|
// 0.13 — preparation-first additions
|
|
9
9
|
// ───────────────────────────────────────────────────────────────────────────
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Source binding shape on the API. `local-folder` is the only kind the
|
|
12
|
+
* local binary accepts in 0.17; `remote-folder` rides in the type
|
|
13
|
+
* plumbing for the future cloud variant (B4.4 cloud-variant seam) and
|
|
14
|
+
* is rejected at the validator branch in server.ts. See `TODO(cloud)`
|
|
15
|
+
* marker there.
|
|
16
|
+
*/
|
|
11
17
|
export const SourceBindingSchema = z.object({
|
|
12
|
-
kind: z.enum(["local-folder"]),
|
|
18
|
+
kind: z.enum(["local-folder", "remote-folder"]),
|
|
13
19
|
locator: z.string().min(1),
|
|
14
20
|
}).strict();
|
|
15
21
|
/**
|
|
@@ -59,6 +65,12 @@ export const PreparationCreateRequestSchema = z.object({
|
|
|
59
65
|
export const PreparationUpdateRequestSchema = z.object({
|
|
60
66
|
method_id: MethodIdSchema.nullable().optional(),
|
|
61
67
|
about: z.string().nullable().optional(),
|
|
68
|
+
/**
|
|
69
|
+
* Replace the full quality-check list. Use the empty array to clear
|
|
70
|
+
* every check. Each item is a `SourceReadinessCheck`
|
|
71
|
+
* (`{ question, answer?, strictness?, expect? }`).
|
|
72
|
+
*/
|
|
73
|
+
checks: z.array(SourceReadinessCheckSchema).optional(),
|
|
62
74
|
}).strict();
|
|
63
75
|
/** Body of `POST /v1/methods` — install a Method package by path. */
|
|
64
76
|
export const MethodInstallRequestSchema = z.object({
|
|
@@ -74,6 +86,15 @@ export const PreparationDeleteResponseSchema = z.object({
|
|
|
74
86
|
deleted: z.boolean(),
|
|
75
87
|
id: PreparationNameSchema,
|
|
76
88
|
}).strict();
|
|
89
|
+
export const PreparationWireShapeSchema = z.object({
|
|
90
|
+
id: PreparationNameSchema,
|
|
91
|
+
source: SourceBindingSchema,
|
|
92
|
+
method_id: MethodIdSchema.nullable(),
|
|
93
|
+
about: z.string().min(1).nullable(),
|
|
94
|
+
config_path: z.string().min(1),
|
|
95
|
+
portable_context: ArtifactLocatorSchema,
|
|
96
|
+
checks: z.array(SourceReadinessCheckSchema).default([]),
|
|
97
|
+
}).strict();
|
|
77
98
|
/**
|
|
78
99
|
* The local service must only ever bind to a loopback interface. Any other
|
|
79
100
|
* host (LAN IP, 0.0.0.0, public address) lets a remote browser tab POST at
|
|
@@ -180,10 +201,15 @@ export const PreparationResourceSchema = z.object({
|
|
|
180
201
|
checks: z.array(SourceReadinessCheckSchema).default([]),
|
|
181
202
|
portable_context: PortableContextMappingSchema,
|
|
182
203
|
portable_context_path: z.string().min(1).nullable(),
|
|
183
|
-
readiness:
|
|
204
|
+
readiness: ReadinessSchema,
|
|
184
205
|
runs: PreparationRunLinkageSchema,
|
|
185
206
|
latest_compile_run_id: z.string().min(1).nullable().optional(),
|
|
186
207
|
latest_test_run_id: z.string().min(1).nullable().optional(),
|
|
208
|
+
// 0.17 — per-Artifact status from the latest compile run, mirrored
|
|
209
|
+
// here so the UI/CLI can render artifact rows without a separate
|
|
210
|
+
// GET /v1/preparations/<id>/runs fetch. Empty when the Method
|
|
211
|
+
// no compile run has produced artifacts yet.
|
|
212
|
+
artifacts: z.array(ArtifactStatusSchema).default([]),
|
|
187
213
|
}).strict();
|
|
188
214
|
export const MethodResourceSchema = z.object({
|
|
189
215
|
id: MethodIdSchema,
|
|
@@ -194,7 +220,7 @@ export const MethodResourceSchema = z.object({
|
|
|
194
220
|
source_kind: z.enum(["builtin", "local"]).default("local"),
|
|
195
221
|
built_in: z.boolean().default(false),
|
|
196
222
|
active_for_preparations: z.array(PreparationNameSchema).default([]),
|
|
197
|
-
|
|
223
|
+
artifacts: z.array(ArtifactSchema).default([]),
|
|
198
224
|
stages: z.array(z.object({
|
|
199
225
|
id: z.string().min(1),
|
|
200
226
|
label: z.string().min(1),
|
|
@@ -209,7 +235,6 @@ export const MethodResourceSchema = z.object({
|
|
|
209
235
|
role: z.string().min(1).default("general"),
|
|
210
236
|
reads: z.array(z.string().min(1)).default([]),
|
|
211
237
|
writes: z.array(z.string().min(1)).default([]),
|
|
212
|
-
acceptance: z.record(z.string(), z.unknown()).optional(),
|
|
213
238
|
}).strict()).default([]),
|
|
214
239
|
}).strict();
|
|
215
240
|
export const CompileRunCreateRequestSchema = z.object({
|
|
@@ -391,6 +416,13 @@ export const ReadinessCheckDraftCreateRequestSchema = z.object({
|
|
|
391
416
|
export const ReadinessCheckDraftResultSchema = z.object({
|
|
392
417
|
checks: z.array(SourceReadinessCheckSchema).default([]),
|
|
393
418
|
}).strict();
|
|
419
|
+
export const MethodAuthoringArtifactRequirementSchema = z.object({
|
|
420
|
+
id: ArtifactIdSchema,
|
|
421
|
+
description: z.string().min(1).optional(),
|
|
422
|
+
shape: ArtifactPathShapeSchema,
|
|
423
|
+
checks: z.array(CheckSchema).default([]),
|
|
424
|
+
stage_hint: z.string().min(1).optional(),
|
|
425
|
+
}).strict();
|
|
394
426
|
export const MethodAuthoringCreateRequestSchema = z.object({
|
|
395
427
|
preparation: PreparationNameSchema.nullable().optional(),
|
|
396
428
|
source_folder_path: z.string().min(1),
|
|
@@ -401,6 +433,7 @@ export const MethodAuthoringCreateRequestSchema = z.object({
|
|
|
401
433
|
hint: z.string().min(1),
|
|
402
434
|
task_prompt: z.string().min(1),
|
|
403
435
|
checks: z.array(SourceReadinessCheckSchema).default([]),
|
|
436
|
+
artifact_requirements: z.array(MethodAuthoringArtifactRequirementSchema).default([]),
|
|
404
437
|
}).strict();
|
|
405
438
|
export const MethodAuthoringResultSchema = z.object({
|
|
406
439
|
status: z.enum(["updated", "no-change", "invalid", "executor-failed"]),
|
|
@@ -440,16 +473,19 @@ export const LocalJobRunResourceSchema = z.object({
|
|
|
440
473
|
}).strict();
|
|
441
474
|
export const VerifyRunStatusSchema = RunStatusSchema;
|
|
442
475
|
/**
|
|
443
|
-
* 0.
|
|
444
|
-
*
|
|
445
|
-
*
|
|
446
|
-
*
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
476
|
+
* 0.17 — verify runs choose their judge target. `compiled` (default)
|
|
477
|
+
* judges against the latest portable-context output; `source-files`
|
|
478
|
+
* judges against the raw source folder for a baseline that reveals
|
|
479
|
+
* how much value the Method actually adds. The 0.15 cleanup made
|
|
480
|
+
* verify compiled-only on the wire because the source-files branch
|
|
481
|
+
* had been retired in 0.13.1; 0.17 restores it because the QA tab and
|
|
482
|
+
* `verify/README.md` have always claimed the option exists, and the
|
|
483
|
+
* sandbox + spec builders for source-files have remained in tree
|
|
484
|
+
* since 0.13.
|
|
450
485
|
*/
|
|
451
486
|
export const VerifyRunCreateRequestSchema = z.object({
|
|
452
487
|
preparation: PreparationNameSchema,
|
|
488
|
+
target: TestTargetTypeSchema.default("compiled"),
|
|
453
489
|
}).strict();
|
|
454
490
|
export const VerifyRunResourceSchema = z.object({
|
|
455
491
|
run_id: z.string().min(1),
|
|
@@ -460,7 +496,7 @@ export const VerifyRunResourceSchema = z.object({
|
|
|
460
496
|
started_at: z.string().nullable().optional(),
|
|
461
497
|
finished_at: z.string().nullable().optional(),
|
|
462
498
|
readiness_run: ReadinessCheckRunSchema.nullable(),
|
|
463
|
-
readiness:
|
|
499
|
+
readiness: ReadinessSchema.nullable().optional(),
|
|
464
500
|
events: z.array(InterfRunEventSchema).default([]),
|
|
465
501
|
error: z.string().min(1).nullable().optional(),
|
|
466
502
|
}).strict();
|
|
@@ -588,13 +624,13 @@ export const PortableContextResourceSchema = z.object({
|
|
|
588
624
|
preparation: PreparationNameSchema,
|
|
589
625
|
path: z.string().min(1),
|
|
590
626
|
exists: z.boolean(),
|
|
591
|
-
readiness:
|
|
627
|
+
readiness: ReadinessSchema,
|
|
592
628
|
method: MethodIdSchema.nullable().optional(),
|
|
593
629
|
latest_compile_run_id: z.string().min(1).nullable().optional(),
|
|
594
630
|
latest_test_run_id: z.string().min(1).nullable().optional(),
|
|
595
631
|
artifacts: z.array(ArtifactRefSchema).default([]),
|
|
596
632
|
}).strict();
|
|
597
|
-
export const ReadinessResourceSchema =
|
|
633
|
+
export const ReadinessResourceSchema = ReadinessSchema;
|
|
598
634
|
export const SourceFileResourceSchema = z.object({
|
|
599
635
|
preparation: PreparationNameSchema,
|
|
600
636
|
path: z.string().min(1),
|
|
@@ -649,7 +685,7 @@ export const OpenPathResponseSchema = z.object({
|
|
|
649
685
|
path: z.string().min(1),
|
|
650
686
|
}).strict();
|
|
651
687
|
export const PreparationListResponseSchema = z.object({
|
|
652
|
-
preparations: z.array(
|
|
688
|
+
preparations: z.array(PreparationWireShapeSchema),
|
|
653
689
|
}).strict();
|
|
654
690
|
export const MethodListResponseSchema = z.object({
|
|
655
691
|
methods: z.array(MethodResourceSchema),
|
|
@@ -14,7 +14,7 @@ import { createRunEventId, createRunEventTimestamp, } from "./execution/events.j
|
|
|
14
14
|
import { loadCompiledPreparationConfig, resolvePreparationCompileMaxAttempts, resolvePreparationCompileMaxLoops, } from "../project/source-config.js";
|
|
15
15
|
import { runMethodImprovementLoop } from "../methods/authoring/method-improvement.js";
|
|
16
16
|
import { stageExecutionShellsRoot, methodPackagePathForCompiled, } from "./compile/compiled-paths.js";
|
|
17
|
-
import { readCompiledSchemaFile } from "./compile/compiled-schema.js";
|
|
17
|
+
import { listCompiledSchemaArtifacts, readCompiledSchemaFile } from "./compile/compiled-schema.js";
|
|
18
18
|
import { initializeCompiledRuntimeState } from "./compile/state.js";
|
|
19
19
|
import { readinessPassRate, runReadinessChecksForExecutor, runSavedPortableContextCheck, } from "./verify/readiness-check-run.js";
|
|
20
20
|
import { runMethodAuthoringDraft, } from "../methods/authoring/method-authoring.js";
|
|
@@ -87,9 +87,9 @@ function printSavedReadinessOutcome(prefix, outcome) {
|
|
|
87
87
|
}
|
|
88
88
|
function bestVariationRestorePaths(compiledPath) {
|
|
89
89
|
const schema = readCompiledSchemaFile(methodPackagePathForCompiled(compiledPath));
|
|
90
|
-
const
|
|
91
|
-
.filter((
|
|
92
|
-
.map((
|
|
90
|
+
const artifactPaths = (schema ? listCompiledSchemaArtifacts(schema) : [])
|
|
91
|
+
.filter((artifact) => artifact.kind !== "runtime")
|
|
92
|
+
.map((artifact) => artifact.path);
|
|
93
93
|
return [
|
|
94
94
|
"AGENTS.md",
|
|
95
95
|
"CLAUDE.md",
|
|
@@ -99,7 +99,7 @@ function bestVariationRestorePaths(compiledPath) {
|
|
|
99
99
|
".cursor",
|
|
100
100
|
".interf/interf.json",
|
|
101
101
|
".interf/method",
|
|
102
|
-
...
|
|
102
|
+
...artifactPaths,
|
|
103
103
|
];
|
|
104
104
|
}
|
|
105
105
|
function copyRelativePathIfPresent(sourceRoot, targetRoot, relativePath) {
|
|
@@ -598,12 +598,19 @@ export function createNativeLocalServiceRunHandlers(options = {}) {
|
|
|
598
598
|
preparationConfig: context.preparationConfig,
|
|
599
599
|
portableContextPath: context.compiledPath,
|
|
600
600
|
executor,
|
|
601
|
+
target: request.target,
|
|
601
602
|
});
|
|
602
|
-
|
|
603
|
+
const outcome = request.target === "source-files"
|
|
604
|
+
? result.sourceFilesOutcome
|
|
605
|
+
: result.compiledOutcome;
|
|
606
|
+
if (!outcome) {
|
|
607
|
+
const targetLabel = request.target === "source-files"
|
|
608
|
+
? "Source files"
|
|
609
|
+
: "Portable Context";
|
|
603
610
|
return {
|
|
604
611
|
ok: false,
|
|
605
612
|
readiness_run: result.readinessRun,
|
|
606
|
-
error:
|
|
613
|
+
error: `${targetLabel} is not ready for readiness checks.`,
|
|
607
614
|
};
|
|
608
615
|
}
|
|
609
616
|
return {
|
|
@@ -653,6 +660,7 @@ export function createNativeLocalServiceRunHandlers(options = {}) {
|
|
|
653
660
|
hint: request.hint,
|
|
654
661
|
taskPrompt: request.task_prompt,
|
|
655
662
|
checks: request.checks,
|
|
663
|
+
artifactRequirements: request.artifact_requirements,
|
|
656
664
|
executor,
|
|
657
665
|
onStatus: (line) => context.emit({
|
|
658
666
|
type: "log.appended",
|
|
@@ -42,6 +42,12 @@ export interface PreparationCreateInput {
|
|
|
42
42
|
export interface PreparationUpdateInput {
|
|
43
43
|
method_id?: string | null;
|
|
44
44
|
about?: string | null;
|
|
45
|
+
checks?: Array<{
|
|
46
|
+
question: string;
|
|
47
|
+
answer?: string;
|
|
48
|
+
strictness?: string;
|
|
49
|
+
expect?: string;
|
|
50
|
+
}>;
|
|
45
51
|
}
|
|
46
52
|
export interface StoredPreparation {
|
|
47
53
|
id: string;
|
|
@@ -154,6 +154,14 @@ export function updateStoredPreparation(prepId, patch) {
|
|
|
154
154
|
: patch.method_id !== undefined
|
|
155
155
|
? { method: patch.method_id }
|
|
156
156
|
: {}),
|
|
157
|
+
...(patch.checks !== undefined
|
|
158
|
+
? { checks: patch.checks.map((check) => ({
|
|
159
|
+
question: check.question,
|
|
160
|
+
...(check.answer ? { answer: check.answer } : {}),
|
|
161
|
+
...(check.strictness ? { strictness: check.strictness } : {}),
|
|
162
|
+
...(check.expect ? { expect: check.expect } : {}),
|
|
163
|
+
})) }
|
|
164
|
+
: {}),
|
|
157
165
|
};
|
|
158
166
|
const aboutPatch = patch.about === undefined ? stored.about : patch.about;
|
|
159
167
|
const preparationWithAbout = aboutPatch
|
|
@@ -42,6 +42,12 @@ export declare const PREPARATION_SUBRESOURCES: {
|
|
|
42
42
|
* GET /v1/preparations/<id>/files/<relpath>
|
|
43
43
|
*/
|
|
44
44
|
readonly files: "files";
|
|
45
|
+
/**
|
|
46
|
+
* 0.17 — per-Artifact detail. Returns the latest status, contributing
|
|
47
|
+
* stages, and proof refs for a Method-declared Artifact:
|
|
48
|
+
* GET /v1/preparations/<id>/artifacts/<artifact-id>
|
|
49
|
+
*/
|
|
50
|
+
readonly artifacts: "artifacts";
|
|
45
51
|
};
|
|
46
52
|
/** Method-scoped sub-resources (relative to /v1/methods/<id>/). */
|
|
47
53
|
export declare const METHOD_SUBRESOURCES: {
|
|
@@ -43,6 +43,12 @@ export const PREPARATION_SUBRESOURCES = {
|
|
|
43
43
|
* GET /v1/preparations/<id>/files/<relpath>
|
|
44
44
|
*/
|
|
45
45
|
files: "files",
|
|
46
|
+
/**
|
|
47
|
+
* 0.17 — per-Artifact detail. Returns the latest status, contributing
|
|
48
|
+
* stages, and proof refs for a Method-declared Artifact:
|
|
49
|
+
* GET /v1/preparations/<id>/artifacts/<artifact-id>
|
|
50
|
+
*/
|
|
51
|
+
artifacts: "artifacts",
|
|
46
52
|
};
|
|
47
53
|
/** Method-scoped sub-resources (relative to /v1/methods/<id>/). */
|
|
48
54
|
export const METHOD_SUBRESOURCES = {
|
|
@@ -79,7 +79,7 @@ function buildTraceStreamChunks(runId, events) {
|
|
|
79
79
|
time: event.timestamp ?? null,
|
|
80
80
|
type: event.type,
|
|
81
81
|
scope: event.stage_id ?? event.step_id ?? event.type,
|
|
82
|
-
message: event.message ?? event.summary ?? event.error ?? event.type,
|
|
82
|
+
message: event.message ?? event.summary ?? event.error ?? event.reason ?? event.type,
|
|
83
83
|
}), event));
|
|
84
84
|
}
|
|
85
85
|
function proofChecksForCompileRun(run) {
|
|
@@ -164,7 +164,6 @@ export function compileRunToObservability(run) {
|
|
|
164
164
|
stage_total: stage.stage_total ?? null,
|
|
165
165
|
reads: stage.contract?.reads ?? [],
|
|
166
166
|
writes: stage.contract?.writes ?? [],
|
|
167
|
-
acceptance: stage.contract?.acceptance ?? null,
|
|
168
167
|
executor: stage.executor ?? null,
|
|
169
168
|
},
|
|
170
169
|
}, stage.stage_id));
|
|
@@ -86,6 +86,13 @@ export function applyEventToCompileRun(run, event) {
|
|
|
86
86
|
finished_at: run.finished_at ?? now,
|
|
87
87
|
events: [...run.events, event],
|
|
88
88
|
};
|
|
89
|
+
case "run.cancelled":
|
|
90
|
+
return {
|
|
91
|
+
...run,
|
|
92
|
+
status: "cancelled",
|
|
93
|
+
finished_at: run.finished_at ?? now,
|
|
94
|
+
events: [...run.events, event],
|
|
95
|
+
};
|
|
89
96
|
case "readiness.updated":
|
|
90
97
|
return {
|
|
91
98
|
...run,
|
|
@@ -11,7 +11,7 @@ import { detectAgents, supportsAutomatedRuns, } from "./agents/lib/detection.js"
|
|
|
11
11
|
import { loadUserConfig, } from "./agents/lib/user-config.js";
|
|
12
12
|
import { asPreparationDataDir, preparationPortableContextPath, } from "../contracts/lib/preparation-paths.js";
|
|
13
13
|
import { DEFAULT_METHOD_ID, methodIdForSourcePreparationConfig, } from "../project/source-config.js";
|
|
14
|
-
import { createCompiledTestTarget, } from "./verify/
|
|
14
|
+
import { createCompiledTestTarget, } from "./verify/verify-targets.js";
|
|
15
15
|
import { methodAuthoringTaskPrompt, MethodAuthoringActionValuesSchema, } from "./action-values.js";
|
|
16
16
|
import { ActionProposalPlanActionTypeSchema, } from "./lib/schema.js";
|
|
17
17
|
export const ACTION_PLANNER_CLARIFICATION_MESSAGE = "I can help with this Interf Workspace. Ask a question about Interf, or ask me to create a Preparation, prepare, check readiness, improve, or draft a Method and I will prepare an approval proposal.";
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
import { type ArtifactRef, type ProofRecord } from "./execution/lib/schema.js";
|
|
10
10
|
import { type CompiledState } from "./compile/state.js";
|
|
11
11
|
import { type RuntimeRun } from "./compile/lib/schema.js";
|
|
12
|
-
import { type
|
|
12
|
+
import { type Artifact, type Readiness, type VerifyTargetResult } from "../contracts/lib/schema.js";
|
|
13
13
|
import { type TestRunTargetSummary } from "./verify/lib/schema.js";
|
|
14
14
|
import { type SourcePreparationConfig } from "../project/lib/schema.js";
|
|
15
15
|
import { type MethodResource, type PreparationResource } from "./lib/schema.js";
|
|
@@ -35,10 +35,10 @@ export declare function logsForRuntimeRun(run: RuntimeRun | undefined): {
|
|
|
35
35
|
prompt_path?: string | undefined;
|
|
36
36
|
} | undefined;
|
|
37
37
|
export declare function passRate(passed: number, total: number): number | null;
|
|
38
|
-
export declare function readinessTargetResult(summary: TestRunTargetSummary | null | undefined, currentFingerprint: string | null, readinessRunFingerprint: string | null | undefined):
|
|
39
|
-
export declare function readinessSummaryForStatus(status:
|
|
40
|
-
export declare function readinessStateToPreparationReadiness(readiness:
|
|
41
|
-
export declare function buildPreparationResource(rootPath: string, preparation: SourcePreparationConfig, readiness:
|
|
38
|
+
export declare function readinessTargetResult(summary: TestRunTargetSummary | null | undefined, currentFingerprint: string | null, readinessRunFingerprint: string | null | undefined): VerifyTargetResult | null;
|
|
39
|
+
export declare function readinessSummaryForStatus(status: Readiness["status"]): string;
|
|
40
|
+
export declare function readinessStateToPreparationReadiness(readiness: Readiness): Readiness;
|
|
41
|
+
export declare function buildPreparationResource(rootPath: string, preparation: SourcePreparationConfig, readiness: Readiness, latestCompileRunId: string | null, latestTestRunId: string | null, artifacts?: PreparationResource["artifacts"]): PreparationResource;
|
|
42
42
|
export declare function buildMethodResource(resource: {
|
|
43
43
|
id: string;
|
|
44
44
|
path: string;
|
|
@@ -47,6 +47,6 @@ export declare function buildMethodResource(resource: {
|
|
|
47
47
|
source_kind: "builtin" | "local";
|
|
48
48
|
built_in: boolean;
|
|
49
49
|
active_for_preparations: string[];
|
|
50
|
-
|
|
50
|
+
artifacts: Artifact[];
|
|
51
51
|
stages: MethodResource["stages"];
|
|
52
52
|
}): MethodResource;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ReadinessSchema, } from "../contracts/lib/schema.js";
|
|
2
2
|
import { methodIdForSourcePreparationConfig, resolveSourcePreparationPath, } from "../project/source-config.js";
|
|
3
3
|
import { MethodResourceSchema, PreparationResourceSchema, } from "./lib/schema.js";
|
|
4
4
|
export function createRunId(prefix) {
|
|
@@ -101,12 +101,12 @@ export function readinessSummaryForStatus(status) {
|
|
|
101
101
|
return "Latest preparation failed.";
|
|
102
102
|
}
|
|
103
103
|
export function readinessStateToPreparationReadiness(readiness) {
|
|
104
|
-
return
|
|
104
|
+
return ReadinessSchema.parse({
|
|
105
105
|
...readiness,
|
|
106
106
|
checks: readiness.checks.map((check) => ({ ...check })),
|
|
107
107
|
});
|
|
108
108
|
}
|
|
109
|
-
export function buildPreparationResource(rootPath, preparation, readiness, latestCompileRunId, latestTestRunId) {
|
|
109
|
+
export function buildPreparationResource(rootPath, preparation, readiness, latestCompileRunId, latestTestRunId, artifacts = []) {
|
|
110
110
|
const methodId = methodIdForSourcePreparationConfig(preparation);
|
|
111
111
|
return PreparationResourceSchema.parse({
|
|
112
112
|
id: preparation.name,
|
|
@@ -131,6 +131,7 @@ export function buildPreparationResource(rootPath, preparation, readiness, lates
|
|
|
131
131
|
},
|
|
132
132
|
latest_compile_run_id: latestCompileRunId,
|
|
133
133
|
latest_test_run_id: latestTestRunId,
|
|
134
|
+
artifacts,
|
|
134
135
|
});
|
|
135
136
|
}
|
|
136
137
|
export function buildMethodResource(resource) {
|
|
@@ -143,7 +144,7 @@ export function buildMethodResource(resource) {
|
|
|
143
144
|
source_kind: resource.source_kind,
|
|
144
145
|
built_in: resource.built_in,
|
|
145
146
|
active_for_preparations: resource.active_for_preparations,
|
|
146
|
-
|
|
147
|
+
artifacts: resource.artifacts,
|
|
147
148
|
stages: resource.stages,
|
|
148
149
|
});
|
|
149
150
|
}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ArtifactRef, type CompileRun, type InterfRunEvent, type ProofRecord } from "./execution/lib/schema.js";
|
|
2
2
|
import { type RunEventSink } from "./execution/events.js";
|
|
3
|
-
import { type
|
|
3
|
+
import { type Readiness } from "../contracts/lib/schema.js";
|
|
4
4
|
import type { SourcePreparationConfig } from "../project/lib/schema.js";
|
|
5
|
+
import { type BillingEventSink } from "./compile/billing-events.js";
|
|
6
|
+
import type { IdempotencyStore, RunLeaseStore, TokenValidator } from "./cloud-seams.js";
|
|
5
7
|
import { type ActionProposalCreateRequest, type ActionProposalPlan, type ActionProposalResource, type CompileRunCreateRequest, type CompileRunResource, type MethodResource, type LocalServiceHealth, type LocalJobEvent, type LocalJobEventAppendRequest, type LocalExecutorStatus, type LocalJobRunResource, type LocalRunHandlerResult, type PortableContextResource, type PreparationResource, type ReadinessCheckDraftCreateRequest, type ReadinessCheckDraftResult, type RunObservabilityResource, type ServiceRegistryWorkspace, type SourceFileResource, type WorkspaceFileResource, type VerifyRunCreateRequest, type VerifyRunResource, type MethodAuthoringCreateRequest, type MethodAuthoringResult, type MethodChangeResult, type PreparationChangeResult, type PreparationSetupResult, type ResetResult } from "./lib/schema.js";
|
|
6
8
|
export interface LocalServiceCompileRunContext {
|
|
7
9
|
runId: string;
|
|
@@ -58,6 +60,21 @@ export interface LocalServiceRuntimeOptions {
|
|
|
58
60
|
* skip generating one; production startup always provides a token.
|
|
59
61
|
*/
|
|
60
62
|
authToken?: string;
|
|
63
|
+
/**
|
|
64
|
+
* 0.17 — optional injection point for the per-Artifact billing event
|
|
65
|
+
* sink. Local default writes a JSONL file alongside the run record;
|
|
66
|
+
* cloud variants will inject a Metronome HTTP sender once the
|
|
67
|
+
* Stripe/Metronome integration ships in 0.18+.
|
|
68
|
+
*/
|
|
69
|
+
billingEventSink?: BillingEventSink;
|
|
70
|
+
/**
|
|
71
|
+
* 0.17 — cloud-variant interface seams. Local default: in-process
|
|
72
|
+
* Maps on the runtime (current behavior). Cloud variants pass shared
|
|
73
|
+
* implementations so multi-replica engines coordinate. See
|
|
74
|
+
* `cloud-seams.ts` for the contract.
|
|
75
|
+
*/
|
|
76
|
+
idempotencyStore?: IdempotencyStore;
|
|
77
|
+
runLeaseStore?: RunLeaseStore;
|
|
61
78
|
}
|
|
62
79
|
/**
|
|
63
80
|
* Per-preparation context tracked by the runtime. Multiple preparations can
|
|
@@ -99,6 +116,11 @@ export declare class LocalServiceRuntime {
|
|
|
99
116
|
* when a compile run is launched and cleared once the run reaches a
|
|
100
117
|
* terminal state. Each entry remembers where the persisted record lives
|
|
101
118
|
* so cancel can mark it without re-resolving the Preparation.
|
|
119
|
+
*
|
|
120
|
+
* TODO(cloud): when the cloud variant lands, wire `RunLeaseStore`
|
|
121
|
+
* (see `cloud-seams.ts` B4.2) through this map. Multi-replica engines
|
|
122
|
+
* need a shared lease store so a replica can take over a run whose
|
|
123
|
+
* owning replica died.
|
|
102
124
|
*/
|
|
103
125
|
private activeCompileRuns;
|
|
104
126
|
/**
|
|
@@ -108,6 +130,11 @@ export declare class LocalServiceRuntime {
|
|
|
108
130
|
* tenants on the same engine (CSO finding: a malicious preparation could
|
|
109
131
|
* otherwise hijack another preparation's run id by reusing its key).
|
|
110
132
|
* Entries expire after `IDEMPOTENCY_TTL_MS`.
|
|
133
|
+
*
|
|
134
|
+
* TODO(cloud): when the cloud variant lands, wire `IdempotencyStore`
|
|
135
|
+
* (see `cloud-seams.ts` B4.1) through this map. Multi-replica engines
|
|
136
|
+
* need a shared store so retries that land on a different replica
|
|
137
|
+
* still hit the same dedupe entry.
|
|
111
138
|
*/
|
|
112
139
|
private idempotencyKeyCache;
|
|
113
140
|
/**
|
|
@@ -122,8 +149,32 @@ export declare class LocalServiceRuntime {
|
|
|
122
149
|
private readonly readinessCache;
|
|
123
150
|
private readonly sourceFilesCache;
|
|
124
151
|
private readonly methodListingCache;
|
|
152
|
+
/**
|
|
153
|
+
* 0.17 — sink for per-Artifact billing events. Set once at construction.
|
|
154
|
+
* Lazy-defaults to a per-run JSONL writer when no override was injected.
|
|
155
|
+
*/
|
|
156
|
+
private readonly billingEventSink;
|
|
157
|
+
/**
|
|
158
|
+
* 0.17 — cloud-variant injection points. The local engine accepts
|
|
159
|
+
* these on the options surface but does not consume them yet — the
|
|
160
|
+
* in-process Maps remain authoritative for idempotency and
|
|
161
|
+
* run-lease state. The cloud variant fork will swap to these stores;
|
|
162
|
+
* the option-fields are documented here so the cloud build has a
|
|
163
|
+
* stable target. See `cloud-seams.ts` for the contracts.
|
|
164
|
+
*/
|
|
165
|
+
readonly cloudIdempotencyStore: IdempotencyStore | null;
|
|
166
|
+
readonly cloudRunLeaseStore: RunLeaseStore | null;
|
|
167
|
+
private cloudTokenValidator;
|
|
125
168
|
constructor(options: LocalServiceRuntimeOptions);
|
|
126
169
|
setBoundPort(port: number): void;
|
|
170
|
+
/**
|
|
171
|
+
* 0.17 — token validator setter for cloud variants. Stored on the
|
|
172
|
+
* runtime so `isAuthorizedMutation` in `server.ts` can opt into the
|
|
173
|
+
* async per-account check when present. Local default: never set —
|
|
174
|
+
* the static bearer-token check runs.
|
|
175
|
+
*/
|
|
176
|
+
setTokenValidator(validator: TokenValidator | null): void;
|
|
177
|
+
getTokenValidator(): TokenValidator | null;
|
|
127
178
|
/** Set a hook that fires whenever the registered preparations change. */
|
|
128
179
|
setOnRegistryChanged(handler: (() => void) | null): void;
|
|
129
180
|
/**
|
|
@@ -175,11 +226,11 @@ export declare class LocalServiceRuntime {
|
|
|
175
226
|
health(prepDataDir?: string): LocalServiceHealth;
|
|
176
227
|
listPreparations(prepDataDir: string): PreparationResource[];
|
|
177
228
|
getPreparation(prepDataDir: string, preparationName: string): PreparationResource | null;
|
|
178
|
-
listPreparationReadiness(prepDataDir: string):
|
|
179
|
-
getPreparationReadiness(prepDataDir: string, preparationName: string):
|
|
180
|
-
listReadiness(prepDataDir: string):
|
|
181
|
-
getReadiness(prepDataDir: string, preparationName: string):
|
|
182
|
-
computePreparationReadiness(prepDataDir: string, preparation: SourcePreparationConfig):
|
|
229
|
+
listPreparationReadiness(prepDataDir: string): Readiness[];
|
|
230
|
+
getPreparationReadiness(prepDataDir: string, preparationName: string): Readiness | null;
|
|
231
|
+
listReadiness(prepDataDir: string): Readiness[];
|
|
232
|
+
getReadiness(prepDataDir: string, preparationName: string): Readiness | null;
|
|
233
|
+
computePreparationReadiness(prepDataDir: string, preparation: SourcePreparationConfig): Readiness;
|
|
183
234
|
private computePreparationReadinessUncached;
|
|
184
235
|
listSourceFiles(prepDataDir: string, preparationName?: string | null): SourceFileResource[];
|
|
185
236
|
listWorkspaceFiles(prepDataDir: string): WorkspaceFileResource[];
|
|
@@ -249,7 +300,7 @@ export declare class LocalServiceRuntime {
|
|
|
249
300
|
createCompileRun(prepDataDir: string, requestValue: unknown): Promise<CompileRunResource>;
|
|
250
301
|
/**
|
|
251
302
|
* Cancel an in-flight compile run. Marks the persisted record as
|
|
252
|
-
* `cancelled`, emits a `run.
|
|
303
|
+
* `cancelled`, emits a `run.cancelled` event to capture the cancellation in
|
|
253
304
|
* the run timeline, and clears the active handle so retries may start a
|
|
254
305
|
* fresh run. If the run already finished, returns
|
|
255
306
|
* `{ cancelled: false, reason: "already finished" }` and persists nothing.
|
|
@@ -303,6 +354,15 @@ export declare class LocalServiceRuntime {
|
|
|
303
354
|
private resolvePreparationConfig;
|
|
304
355
|
private ensureCompiledForRun;
|
|
305
356
|
private readCompileRun;
|
|
357
|
+
private finalizeInterruptedCompileRuns;
|
|
358
|
+
/**
|
|
359
|
+
* 0.17 — emit per-Artifact billing events when a compile run reaches
|
|
360
|
+
* a terminal state. STUB FORM: writes a JSONL file alongside the run
|
|
361
|
+
* record by default. Production sink (Metronome HTTP) wires in 0.18+.
|
|
362
|
+
* The JSONL output is observability/dev fixture, NOT production
|
|
363
|
+
* billing data.
|
|
364
|
+
*/
|
|
365
|
+
private emitBillingEventsForRun;
|
|
306
366
|
private writeCompileRun;
|
|
307
367
|
private writeJobRun;
|
|
308
368
|
private writeActionProposal;
|