@interf/compiler 0.9.3 → 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.
Files changed (103) hide show
  1. package/CHANGELOG.md +93 -0
  2. package/README.md +2 -1
  3. package/agent-skills/interf-actions/SKILL.md +17 -11
  4. package/agent-skills/interf-actions/references/cli.md +8 -22
  5. package/dist/cli/commands/action-input-cli.d.ts +25 -0
  6. package/dist/cli/commands/action-input-cli.js +73 -0
  7. package/dist/cli/commands/compile.d.ts +3 -8
  8. package/dist/cli/commands/compile.js +13 -41
  9. package/dist/cli/commands/create-method-wizard.d.ts +0 -12
  10. package/dist/cli/commands/create-method-wizard.js +95 -126
  11. package/dist/cli/commands/create.d.ts +0 -2
  12. package/dist/cli/commands/create.js +16 -22
  13. package/dist/cli/commands/doctor.js +1 -1
  14. package/dist/cli/commands/executor-flow.js +1 -1
  15. package/dist/cli/commands/init.d.ts +16 -1
  16. package/dist/cli/commands/init.js +40 -53
  17. package/dist/cli/commands/list.js +1 -1
  18. package/dist/cli/commands/preparation-action.d.ts +8 -0
  19. package/dist/cli/commands/preparation-action.js +29 -0
  20. package/dist/cli/commands/preparation-picker.d.ts +5 -0
  21. package/dist/cli/commands/preparation-picker.js +36 -0
  22. package/dist/cli/commands/preparation-selection.js +2 -2
  23. package/dist/cli/commands/reset.js +15 -4
  24. package/dist/cli/commands/service-action-flow.d.ts +9 -0
  25. package/dist/cli/commands/service-action-flow.js +19 -0
  26. package/dist/cli/commands/source-config-wizard.d.ts +0 -1
  27. package/dist/cli/commands/source-config-wizard.js +43 -53
  28. package/dist/cli/commands/status.js +7 -123
  29. package/dist/cli/commands/test.d.ts +1 -2
  30. package/dist/cli/commands/test.js +40 -203
  31. package/dist/cli/commands/web.js +8 -262
  32. package/dist/compiler-ui/404.html +1 -1
  33. package/dist/compiler-ui/__next.__PAGE__.txt +2 -2
  34. package/dist/compiler-ui/__next._full.txt +3 -3
  35. package/dist/compiler-ui/__next._head.txt +1 -1
  36. package/dist/compiler-ui/__next._index.txt +2 -2
  37. package/dist/compiler-ui/__next._tree.txt +2 -2
  38. package/dist/compiler-ui/_next/static/chunks/177mvn4rse235.js +89 -0
  39. package/dist/compiler-ui/_next/static/chunks/18a8f2jkv3z.c.css +3 -0
  40. package/dist/compiler-ui/_not-found/__next._full.txt +2 -2
  41. package/dist/compiler-ui/_not-found/__next._head.txt +1 -1
  42. package/dist/compiler-ui/_not-found/__next._index.txt +2 -2
  43. package/dist/compiler-ui/_not-found/__next._not-found.__PAGE__.txt +1 -1
  44. package/dist/compiler-ui/_not-found/__next._not-found.txt +1 -1
  45. package/dist/compiler-ui/_not-found/__next._tree.txt +2 -2
  46. package/dist/compiler-ui/_not-found.html +1 -1
  47. package/dist/compiler-ui/_not-found.txt +2 -2
  48. package/dist/compiler-ui/index.html +1 -1
  49. package/dist/compiler-ui/index.txt +3 -3
  50. package/dist/index.d.ts +0 -23
  51. package/dist/index.js +0 -16
  52. package/dist/packages/agents/lib/shells.js +2 -2
  53. package/dist/packages/compiler/lib/schema.d.ts +1 -1
  54. package/dist/packages/compiler/lib/schema.js +1 -1
  55. package/dist/packages/contracts/lib/schema.d.ts +0 -1
  56. package/dist/packages/contracts/lib/schema.js +0 -1
  57. package/dist/packages/execution/lib/schema.d.ts +0 -7
  58. package/dist/packages/execution/lib/schema.js +0 -1
  59. package/dist/packages/local-service/action-definitions.d.ts +246 -0
  60. package/dist/packages/local-service/action-definitions.js +1148 -0
  61. package/dist/packages/local-service/action-planner.d.ts +9 -0
  62. package/dist/packages/local-service/action-planner.js +134 -0
  63. package/dist/packages/local-service/action-values.d.ts +1 -22
  64. package/dist/packages/local-service/action-values.js +1 -30
  65. package/dist/packages/local-service/client.d.ts +48 -17
  66. package/dist/packages/local-service/client.js +95 -52
  67. package/dist/packages/local-service/index.d.ts +8 -5
  68. package/dist/packages/local-service/index.js +5 -3
  69. package/dist/packages/local-service/lib/schema.d.ts +302 -292
  70. package/dist/packages/local-service/lib/schema.js +115 -39
  71. package/dist/packages/local-service/native-run-handlers.d.ts +23 -0
  72. package/dist/{cli/commands/compile-controller.js → packages/local-service/native-run-handlers.js} +203 -19
  73. package/dist/{cli/commands/check-draft.d.ts → packages/local-service/readiness-check-draft.d.ts} +2 -2
  74. package/dist/packages/local-service/routes.d.ts +6 -1
  75. package/dist/packages/local-service/routes.js +7 -2
  76. package/dist/packages/local-service/run-observability.js +15 -17
  77. package/dist/packages/local-service/runtime.d.ts +10 -7
  78. package/dist/packages/local-service/runtime.js +430 -286
  79. package/dist/packages/local-service/server.js +94 -44
  80. package/dist/packages/method-package/method-review-paths.d.ts +1 -1
  81. package/dist/packages/method-package/method-review-paths.js +5 -5
  82. package/dist/packages/project-model/index.d.ts +1 -0
  83. package/dist/packages/project-model/index.js +1 -0
  84. package/dist/packages/project-model/preparation-entries.d.ts +11 -0
  85. package/dist/packages/project-model/preparation-entries.js +49 -0
  86. package/dist/packages/project-model/source-config.d.ts +1 -0
  87. package/dist/packages/project-model/source-config.js +12 -1
  88. package/dist/packages/testing/lib/schema.d.ts +2 -3
  89. package/dist/packages/testing/lib/schema.js +2 -3
  90. package/dist/packages/testing/readiness-check-run.d.ts +3 -3
  91. package/dist/packages/testing/readiness-check-run.js +12 -17
  92. package/package.json +5 -24
  93. package/dist/cli/commands/compile-controller.d.ts +0 -17
  94. package/dist/cli/commands/compiled-flow.d.ts +0 -25
  95. package/dist/cli/commands/compiled-flow.js +0 -112
  96. package/dist/cli/commands/test-flow.d.ts +0 -58
  97. package/dist/cli/commands/test-flow.js +0 -231
  98. package/dist/compiler-ui/_next/static/chunks/0c9mu7yldxyyg.css +0 -3
  99. package/dist/compiler-ui/_next/static/chunks/15mks7ry_cupt.js +0 -118
  100. /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_buildManifest.js +0 -0
  101. /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_clientMiddlewareManifest.js +0 -0
  102. /package/dist/compiler-ui/_next/static/{pIZnDsV3Je6hdC3cOsGdK → 84FaeF3EzBF9kKTMjSEVN}/_ssgManifest.js +0 -0
  103. /package/dist/{cli/commands/check-draft.js → packages/local-service/readiness-check-draft.js} +0 -0
@@ -3,10 +3,10 @@ import { spawn } from "node:child_process";
3
3
  import { existsSync, mkdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
4
4
  import { dirname, extname, join, normalize, resolve, sep } from "node:path";
5
5
  import { fileURLToPath } from "node:url";
6
- import { LocalServiceConfigSchema, LocalServiceDiscoverySchema, LocalServiceInstancePointerSchema, OpenPathRequestSchema, RunCreateRequestSchema, } from "./lib/schema.js";
6
+ import { LocalServiceConfigSchema, LocalServiceDiscoverySchema, LocalServiceErrorSchema, LocalServicePointerSchema, OpenPathRequestSchema, PreparationSetupCreateRequestSchema, } from "./lib/schema.js";
7
7
  import { assertPathWithinRoot, } from "../shared/path-guards.js";
8
8
  import { createLocalServiceRuntime, } from "./runtime.js";
9
- import { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, LOCAL_SERVICE_INSTANCE_POINTER_PATH, LOCAL_SERVICE_ROUTES, } from "./routes.js";
9
+ import { LOCAL_SERVICE_DEFAULT_HOST, LOCAL_SERVICE_DEFAULT_PORT, LOCAL_SERVICE_POINTER_PATH, LOCAL_SERVICE_ROUTES, } from "./routes.js";
10
10
  function packageRoot() {
11
11
  return resolve(dirname(fileURLToPath(import.meta.url)), "..", "..", "..");
12
12
  }
@@ -25,21 +25,21 @@ function compilerUiStaticRoot() {
25
25
  return resolve(explicit);
26
26
  return resolveCompilerUiStaticRoot();
27
27
  }
28
- function localInstancePointerPath(rootPath) {
29
- return join(rootPath, ...LOCAL_SERVICE_INSTANCE_POINTER_PATH);
28
+ function localServicePointerPath(rootPath) {
29
+ return join(rootPath, ...LOCAL_SERVICE_POINTER_PATH);
30
30
  }
31
- function writeLocalInstancePointer(rootPath, pointer) {
32
- const pointerPath = localInstancePointerPath(rootPath);
31
+ function writeLocalServicePointer(rootPath, pointer) {
32
+ const pointerPath = localServicePointerPath(rootPath);
33
33
  mkdirSync(dirname(pointerPath), { recursive: true });
34
- const parsed = LocalServiceInstancePointerSchema.parse(pointer);
34
+ const parsed = LocalServicePointerSchema.parse(pointer);
35
35
  writeFileSync(pointerPath, `${JSON.stringify(parsed, null, 2)}\n`);
36
36
  }
37
- function removeLocalInstancePointer(rootPath, serviceUrl) {
38
- const pointerPath = localInstancePointerPath(rootPath);
37
+ function removeLocalServicePointer(rootPath, serviceUrl) {
38
+ const pointerPath = localServicePointerPath(rootPath);
39
39
  if (!existsSync(pointerPath))
40
40
  return;
41
41
  try {
42
- const pointer = LocalServiceInstancePointerSchema.parse(JSON.parse(readFileSync(pointerPath, "utf8")));
42
+ const pointer = LocalServicePointerSchema.parse(JSON.parse(readFileSync(pointerPath, "utf8")));
43
43
  if (pointer.service_url !== serviceUrl || pointer.pid !== process.pid)
44
44
  return;
45
45
  rmSync(pointerPath, { force: true });
@@ -97,11 +97,11 @@ function sendText(res, statusCode, value) {
97
97
  res.end(value);
98
98
  }
99
99
  function sendError(res, statusCode, message) {
100
- sendJson(res, statusCode, {
100
+ sendJson(res, statusCode, LocalServiceErrorSchema.parse({
101
101
  error: {
102
102
  message,
103
103
  },
104
- });
104
+ }));
105
105
  }
106
106
  function resolveOpenPath(allowedRoots, pathValue) {
107
107
  const roots = allowedRoots.map((root) => resolve(root));
@@ -233,6 +233,15 @@ async function routeApi(req, res, runtime) {
233
233
  source_files: LOCAL_SERVICE_ROUTES.sourceFiles,
234
234
  workspace_files: LOCAL_SERVICE_ROUTES.workspaceFiles,
235
235
  action_proposals: LOCAL_SERVICE_ROUTES.actionProposals,
236
+ preparation_setups: LOCAL_SERVICE_ROUTES.preparationSetups,
237
+ preparation_changes: LOCAL_SERVICE_ROUTES.preparationChanges,
238
+ method_changes: LOCAL_SERVICE_ROUTES.methodChanges,
239
+ readiness_check_drafts: LOCAL_SERVICE_ROUTES.readinessCheckDrafts,
240
+ method_authoring_runs: LOCAL_SERVICE_ROUTES.methodAuthoringRuns,
241
+ method_improvement_runs: LOCAL_SERVICE_ROUTES.methodImprovementRuns,
242
+ compile_runs: LOCAL_SERVICE_ROUTES.compileRuns,
243
+ test_runs: LOCAL_SERVICE_ROUTES.testRuns,
244
+ reset: LOCAL_SERVICE_ROUTES.reset,
236
245
  executor: LOCAL_SERVICE_ROUTES.executor,
237
246
  },
238
247
  }));
@@ -242,6 +251,52 @@ async function routeApi(req, res, runtime) {
242
251
  sendJson(res, 200, { preparations: runtime.listPreparations() });
243
252
  return true;
244
253
  }
254
+ if (method === "POST" && path === LOCAL_SERVICE_ROUTES.preparationSetups) {
255
+ try {
256
+ const body = await readJsonBody(req);
257
+ const request = PreparationSetupCreateRequestSchema.parse(body);
258
+ const result = runtime.applyPreparationSetup(request);
259
+ if (request.prepare_after_setup) {
260
+ const resource = await runtime.createCompileRun({
261
+ preparation: result.preparation,
262
+ method: result.method,
263
+ });
264
+ sendJson(res, 202, {
265
+ ...result,
266
+ submitted_run_id: resource.run.run_id,
267
+ submitted_run_type: "compile-run",
268
+ message: `${result.message} Prepare run started.`,
269
+ });
270
+ }
271
+ else {
272
+ sendJson(res, 202, result);
273
+ }
274
+ }
275
+ catch (error) {
276
+ sendError(res, 409, error instanceof Error ? error.message : String(error));
277
+ }
278
+ return true;
279
+ }
280
+ if (method === "POST" && path === LOCAL_SERVICE_ROUTES.reset) {
281
+ try {
282
+ const body = await readJsonBody(req);
283
+ sendJson(res, 202, runtime.applyReset(body));
284
+ }
285
+ catch (error) {
286
+ sendError(res, 409, error instanceof Error ? error.message : String(error));
287
+ }
288
+ return true;
289
+ }
290
+ if (method === "POST" && path === LOCAL_SERVICE_ROUTES.preparationChanges) {
291
+ try {
292
+ const body = await readJsonBody(req);
293
+ sendJson(res, 202, runtime.applyPreparationChange(body));
294
+ }
295
+ catch (error) {
296
+ sendError(res, 409, error instanceof Error ? error.message : String(error));
297
+ }
298
+ return true;
299
+ }
245
300
  if (method === "GET" && path === LOCAL_SERVICE_ROUTES.workspaceFiles) {
246
301
  sendJson(res, 200, { workspace_files: runtime.listWorkspaceFiles() });
247
302
  return true;
@@ -288,6 +343,16 @@ async function routeApi(req, res, runtime) {
288
343
  sendJson(res, 200, { methods: runtime.listMethods() });
289
344
  return true;
290
345
  }
346
+ if (method === "POST" && path === LOCAL_SERVICE_ROUTES.methodChanges) {
347
+ try {
348
+ const body = await readJsonBody(req);
349
+ sendJson(res, 202, runtime.applyMethodChange(body));
350
+ }
351
+ catch (error) {
352
+ sendError(res, 409, error instanceof Error ? error.message : String(error));
353
+ }
354
+ return true;
355
+ }
291
356
  const methodMatch = path.match(/^\/v1\/methods\/([^/]+)$/);
292
357
  if (method === "GET" && methodMatch?.[1]) {
293
358
  const methodResource = runtime.getMethod(decodeURIComponent(methodMatch[1]));
@@ -345,19 +410,6 @@ async function routeApi(req, res, runtime) {
345
410
  sendJson(res, 200, { runs: runtime.listRunObservability() });
346
411
  return true;
347
412
  }
348
- if (method === "POST" && path === LOCAL_SERVICE_ROUTES.runs) {
349
- const request = RunCreateRequestSchema.parse(await readJsonBody(req));
350
- if (request.run_type === "compile" || request.run_type === "prepare") {
351
- const { run_type: _ignoredRunType, ...compileRequest } = request;
352
- const resource = await runtime.createCompileRun(compileRequest);
353
- sendJson(res, 202, runtime.getRunObservability(resource.run.run_id) ?? resource);
354
- return true;
355
- }
356
- const { run_type: _ignoredRunType, ...testRequest } = request;
357
- const resource = await runtime.createTestRun(testRequest);
358
- sendJson(res, 202, runtime.getRunObservability(resource.run_id) ?? resource);
359
- return true;
360
- }
361
413
  const observableRunMatch = path.match(/^\/v1\/runs\/([^/]+)$/);
362
414
  if (method === "GET" && observableRunMatch?.[1]) {
363
415
  const run = runtime.getRunObservability(decodeURIComponent(observableRunMatch[1]));
@@ -367,11 +419,6 @@ async function routeApi(req, res, runtime) {
367
419
  sendJson(res, 200, run);
368
420
  return true;
369
421
  }
370
- if (method === "POST" && path === "/v1/jobs") {
371
- const body = await readJsonBody(req);
372
- sendJson(res, 202, runtime.createJobRun(body));
373
- return true;
374
- }
375
422
  const jobMatch = path.match(/^\/v1\/jobs\/([^/]+)(?:\/([^/]+))?$/);
376
423
  if (jobMatch?.[1]) {
377
424
  const runId = decodeURIComponent(jobMatch[1]);
@@ -392,15 +439,6 @@ async function routeApi(req, res, runtime) {
392
439
  sendJson(res, 200, { events });
393
440
  return true;
394
441
  }
395
- if (method === "POST" && child === "events") {
396
- const body = await readJsonBody(req);
397
- const job = runtime.appendJobRunEvent(runId, body);
398
- if (!job)
399
- sendError(res, 404, "Job run not found.");
400
- else
401
- sendJson(res, 202, job);
402
- return true;
403
- }
404
442
  }
405
443
  if (method === "POST" && path === "/v1/readiness-check-drafts") {
406
444
  const body = await readJsonBody(req);
@@ -415,14 +453,26 @@ async function routeApi(req, res, runtime) {
415
453
  sendJson(res, 202, job);
416
454
  return true;
417
455
  }
456
+ if (method === "POST" &&
457
+ path === LOCAL_SERVICE_ROUTES.methodImprovementRuns) {
458
+ const body = await readJsonBody(req);
459
+ const job = await runtime.createMethodAuthoringRun(body, "method-improvement");
460
+ sendJson(res, 202, job);
461
+ return true;
462
+ }
418
463
  if (method === "GET" && path === "/v1/compile-runs") {
419
464
  sendJson(res, 200, { compile_runs: runtime.listCompileRuns() });
420
465
  return true;
421
466
  }
422
467
  if (method === "POST" && path === "/v1/compile-runs") {
423
- const body = await readJsonBody(req);
424
- const resource = await runtime.createCompileRun(body);
425
- sendJson(res, 202, resource);
468
+ try {
469
+ const body = await readJsonBody(req);
470
+ const resource = await runtime.createCompileRun(body);
471
+ sendJson(res, 202, resource);
472
+ }
473
+ catch (error) {
474
+ sendError(res, 409, error instanceof Error ? error.message : String(error));
475
+ }
426
476
  return true;
427
477
  }
428
478
  const compileRunMatch = path.match(/^\/v1\/compile-runs\/([^/]+)(?:\/([^/]+))?$/);
@@ -551,7 +601,7 @@ export async function startLocalService(options = {}) {
551
601
  server.listen(config.port, config.host);
552
602
  });
553
603
  const url = runtime.health().service_url;
554
- writeLocalInstancePointer(rootPath, {
604
+ writeLocalServicePointer(rootPath, {
555
605
  service_url: url,
556
606
  host: config.host,
557
607
  port: config.port,
@@ -569,7 +619,7 @@ export async function startLocalService(options = {}) {
569
619
  rejectClose(error);
570
620
  return;
571
621
  }
572
- removeLocalInstancePointer(rootPath, url);
622
+ removeLocalServicePointer(rootPath, url);
573
623
  resolveClose();
574
624
  });
575
625
  }),
@@ -1,7 +1,7 @@
1
1
  import type { MethodImprovementContext } from "../compiler/lib/schema.js";
2
2
  export interface MethodImprovementReviewSourcePaths {
3
3
  compiledRuntime: string | null;
4
- testComparisons: string | null;
4
+ readinessRuns: string | null;
5
5
  executionShells: string | null;
6
6
  targetTestRuns: string | null;
7
7
  targetTestSandboxes: string | null;
@@ -3,15 +3,15 @@ import { join } from "node:path";
3
3
  import { testRootForCompiled, targetTestRunsRootForCompiled, targetTestSandboxesRootForCompiled, stageExecutionShellsRoot, compiledRuntimeRoot, } from "../compiler/compiled-paths.js";
4
4
  export function resolveMethodImprovementReviewSourcePaths(compiledPath) {
5
5
  const compiledRuntime = compiledRuntimeRoot(compiledPath);
6
- const testComparisons = testRootForCompiled(compiledPath);
6
+ const readinessRuns = testRootForCompiled(compiledPath);
7
7
  const executionShells = stageExecutionShellsRoot(compiledPath);
8
8
  const targetTestRuns = targetTestRunsRootForCompiled(compiledPath);
9
9
  const targetTestSandboxes = targetTestSandboxesRootForCompiled(compiledPath);
10
10
  return {
11
11
  compiledRuntime: existsSync(compiledRuntime) ? compiledRuntime : null,
12
- testComparisons: existsSync(join(testComparisons, "latest.json")) ||
13
- existsSync(join(testComparisons, "latest.md"))
14
- ? testComparisons
12
+ readinessRuns: existsSync(join(readinessRuns, "latest.json")) ||
13
+ existsSync(join(readinessRuns, "latest.md"))
14
+ ? readinessRuns
15
15
  : null,
16
16
  executionShells: existsSync(executionShells) ? executionShells : null,
17
17
  targetTestRuns: existsSync(targetTestRuns) ? targetTestRuns : null,
@@ -23,7 +23,7 @@ export function resolveMethodImprovementReviewPaths(compiledPath) {
23
23
  return {
24
24
  method_root: "method",
25
25
  compiled_runtime: sources.compiledRuntime ? "artifacts/compiled-runtime" : null,
26
- test_comparisons: sources.testComparisons ? "artifacts/test-comparisons" : null,
26
+ readiness_runs: sources.readinessRuns ? "artifacts/readiness-runs" : null,
27
27
  execution_shells: sources.executionShells ? "artifacts/execution-shells" : null,
28
28
  test_runs: sources.targetTestRuns ? "artifacts/test-runs" : null,
29
29
  test_sandboxes: sources.targetTestSandboxes ? "artifacts/test-sandboxes" : null,
@@ -6,4 +6,5 @@ export * as detect from "./interf-detect.js";
6
6
  export * as bootstrap from "./interf-bootstrap.js";
7
7
  export * as scaffold from "./interf-scaffold.js";
8
8
  export * as projectPaths from "./project-paths.js";
9
+ export * as preparationEntries from "./preparation-entries.js";
9
10
  export type { InterfConfig, MethodId, PreparationName, SourceFolderBinding, SourcePreparationConfig, SourceReadinessCheck, SourceFolderConfig, } from "./lib/schema.js";
@@ -6,3 +6,4 @@ export * as detect from "./interf-detect.js";
6
6
  export * as bootstrap from "./interf-bootstrap.js";
7
7
  export * as scaffold from "./interf-scaffold.js";
8
8
  export * as projectPaths from "./project-paths.js";
9
+ export * as preparationEntries from "./preparation-entries.js";
@@ -0,0 +1,11 @@
1
+ import type { SourcePreparationConfig } from "./lib/schema.js";
2
+ export interface SavedPreparationEntry {
3
+ config: SourcePreparationConfig;
4
+ path: string | null;
5
+ localDraft: boolean;
6
+ }
7
+ export declare function listSavedPreparationEntries(sourcePath: string): SavedPreparationEntry[];
8
+ export declare function findBuiltPortableContextPath(sourcePath: string, preparationName: string): string | null;
9
+ export declare function findSavedPreparationConfig(sourcePath: string, preparationName: string): SourcePreparationConfig | null;
10
+ export declare function createPortableContextFromConfig(sourcePath: string, preparationConfig: SourcePreparationConfig): string;
11
+ export declare function ensurePortableContextFromConfig(sourcePath: string, preparationConfig: SourcePreparationConfig): string;
@@ -0,0 +1,49 @@
1
+ import { listPortableContextsForSourceFolder, } from "./interf-detect.js";
2
+ import { createCompiled, ensurePortableContextScaffold, } from "./interf-scaffold.js";
3
+ import { listSourcePreparationConfigs, loadCompiledPreparationConfig, loadSourceFolderConfig, resolveSourcePreparationPath, sourcePreparationConfigFromInterfConfig, syncCompiledInterfConfigFromSourcePreparationConfig, } from "./source-config.js";
4
+ import { DEFAULT_METHOD_ID, methodIdForSourcePreparationConfig, } from "../methods/method-resolution.js";
5
+ export function listSavedPreparationEntries(sourcePath) {
6
+ const builtEntries = new Map();
7
+ for (const builtContext of listPortableContextsForSourceFolder(sourcePath)) {
8
+ const preparationConfig = loadCompiledPreparationConfig(builtContext.path)
9
+ ?? sourcePreparationConfigFromInterfConfig(builtContext.config);
10
+ builtEntries.set(builtContext.config.name, {
11
+ config: preparationConfig,
12
+ path: builtContext.path,
13
+ localDraft: builtContext.config.method_origin?.local_draft === true,
14
+ });
15
+ }
16
+ const entries = new Map();
17
+ for (const config of listSourcePreparationConfigs(loadSourceFolderConfig(sourcePath))) {
18
+ const built = builtEntries.get(config.name);
19
+ entries.set(config.name, {
20
+ config,
21
+ path: built?.path ?? null,
22
+ localDraft: built?.localDraft ?? false,
23
+ });
24
+ }
25
+ return Array.from(entries.values()).sort((left, right) => left.config.name.localeCompare(right.config.name));
26
+ }
27
+ export function findBuiltPortableContextPath(sourcePath, preparationName) {
28
+ return listSavedPreparationEntries(sourcePath).find((entry) => entry.config.name === preparationName)?.path ?? null;
29
+ }
30
+ export function findSavedPreparationConfig(sourcePath, preparationName) {
31
+ return listSavedPreparationEntries(sourcePath).find((entry) => entry.config.name === preparationName)?.config ?? null;
32
+ }
33
+ export function createPortableContextFromConfig(sourcePath, preparationConfig) {
34
+ const methodId = methodIdForSourcePreparationConfig(preparationConfig) ?? DEFAULT_METHOD_ID;
35
+ const sourceFolderPath = resolveSourcePreparationPath(sourcePath, preparationConfig);
36
+ const compiledPath = createCompiled(preparationConfig.name, sourcePath, methodId, preparationConfig.about, sourceFolderPath);
37
+ syncCompiledInterfConfigFromSourcePreparationConfig(compiledPath, preparationConfig);
38
+ return compiledPath;
39
+ }
40
+ export function ensurePortableContextFromConfig(sourcePath, preparationConfig) {
41
+ const methodId = methodIdForSourcePreparationConfig(preparationConfig) ?? DEFAULT_METHOD_ID;
42
+ const existingPath = findBuiltPortableContextPath(sourcePath, preparationConfig.name);
43
+ if (existingPath) {
44
+ ensurePortableContextScaffold(sourcePath, preparationConfig.name, methodId);
45
+ syncCompiledInterfConfigFromSourcePreparationConfig(existingPath, preparationConfig);
46
+ return existingPath;
47
+ }
48
+ return createPortableContextFromConfig(sourcePath, preparationConfig);
49
+ }
@@ -27,6 +27,7 @@ export declare function appendSourcePreparationChecks(sourcePath: string, prepar
27
27
  export declare function upsertSourcePreparationConfig(sourcePath: string, preparationConfig: SourcePreparationConfig, options?: {
28
28
  matchName?: string;
29
29
  }): void;
30
+ export declare function removeSourcePreparationConfig(sourcePath: string, preparationName: string): boolean;
30
31
  export declare function compiledMaxAttempts(maxAttempts: number | null | undefined): number | undefined;
31
32
  export declare function compiledMaxLoops(maxLoops: number | null | undefined): number | undefined;
32
33
  export declare function sourcePreparationConfigFromInterfConfig(config: InterfConfig, preparationPath?: string): SourcePreparationConfig;
@@ -124,7 +124,7 @@ function toWritableSourcePreparationConfig(preparation) {
124
124
  name: preparation.name,
125
125
  path: preparation.path,
126
126
  ...(preparation.about ? { about: preparation.about } : {}),
127
- method: method ?? DEFAULT_METHOD_ID,
127
+ ...(method ? { method } : {}),
128
128
  ...(typeof preparation.max_attempts === "number" ? { max_attempts: preparation.max_attempts } : {}),
129
129
  ...(typeof preparation.max_loops === "number" ? { max_loops: preparation.max_loops } : {}),
130
130
  checks: preparation.checks,
@@ -174,6 +174,17 @@ export function upsertSourcePreparationConfig(sourcePath, preparationConfig, opt
174
174
  preparations,
175
175
  });
176
176
  }
177
+ export function removeSourcePreparationConfig(sourcePath, preparationName) {
178
+ const existing = loadSourceFolderConfig(sourcePath);
179
+ const preparations = listSourcePreparationConfigs(existing);
180
+ const nextPreparations = preparations.filter((entry) => entry.name !== preparationName);
181
+ if (nextPreparations.length === preparations.length)
182
+ return false;
183
+ saveSourceFolderConfig(sourcePath, {
184
+ preparations: nextPreparations,
185
+ });
186
+ return true;
187
+ }
177
188
  export function compiledMaxAttempts(maxAttempts) {
178
189
  if (maxAttempts == null)
179
190
  return undefined;
@@ -244,9 +244,8 @@ export declare const ReadinessCheckRunSchema: z.ZodObject<{
244
244
  }, z.core.$strip>;
245
245
  }, z.core.$strip>>;
246
246
  summary: z.ZodObject<{
247
- raw_pass_rate: z.ZodNullable<z.ZodNumber>;
248
- compiled_pass_rate: z.ZodNullable<z.ZodNumber>;
249
- pass_rate_delta: z.ZodNullable<z.ZodNumber>;
247
+ source_files_pass_rate: z.ZodNullable<z.ZodNumber>;
248
+ portable_context_pass_rate: z.ZodNullable<z.ZodNumber>;
250
249
  }, z.core.$strip>;
251
250
  }, z.core.$strip>;
252
251
  export type { TestCaseExpect, TestTargetType };
@@ -111,8 +111,7 @@ export const ReadinessCheckRunSchema = z.object({
111
111
  raw: TestRunTargetSummarySchema.nullable(),
112
112
  compiled: TestRunTargetSummarySchema.nullable(),
113
113
  summary: z.object({
114
- raw_pass_rate: z.number().nullable(),
115
- compiled_pass_rate: z.number().nullable(),
116
- pass_rate_delta: z.number().nullable(),
114
+ source_files_pass_rate: z.number().nullable(),
115
+ portable_context_pass_rate: z.number().nullable(),
117
116
  }),
118
117
  });
@@ -16,8 +16,8 @@ export interface ReadinessCheckRunResult {
16
16
  mode: TestRunMode;
17
17
  rawOutcome: SavedReadinessCheckOutcome | null;
18
18
  compiledOutcome: SavedReadinessCheckOutcome | null;
19
- comparisonRunPath: string | null;
20
- comparison: ReadinessCheckRun | null;
19
+ readinessRunPath: string | null;
20
+ readinessRun: ReadinessCheckRun | null;
21
21
  }
22
22
  export declare function readinessPassRate(outcome: SavedReadinessCheckOutcome): number;
23
23
  export declare function readSavedReadinessCheckRun(projectPath: string, preparationName: string): ReadinessCheckRun | null;
@@ -28,7 +28,7 @@ export declare function readCurrentSavedReadinessCheckRun(options: {
28
28
  preparationName: string;
29
29
  checks: SourcePreparationConfig["checks"];
30
30
  }): {
31
- comparison: ReadinessCheckRun | null;
31
+ readinessRun: ReadinessCheckRun | null;
32
32
  stale: boolean;
33
33
  };
34
34
  export declare function saveReadinessCheckRun(options: {
@@ -48,10 +48,6 @@ function renderLatestSummaryMarkdown(payload) {
48
48
  lines.push(`| Portable Context | \`${payload.compiled.passed_cases}/${payload.compiled.total_cases}\` |`);
49
49
  }
50
50
  lines.push("");
51
- if (payload.summary.raw_pass_rate != null && payload.summary.compiled_pass_rate != null) {
52
- const direction = (payload.summary.pass_rate_delta ?? 0) >= 0 ? "improved" : "decreased";
53
- lines.push(`Readiness-check pass rate ${direction} from ${payload.summary.raw_pass_rate}% to ${payload.summary.compiled_pass_rate}%.`, "");
54
- }
55
51
  if (payload.raw) {
56
52
  lines.push(`- Latest source-files run: ${payload.raw.run_path}`);
57
53
  }
@@ -74,15 +70,15 @@ export function readReadinessCheckRunAtPath(filePath, label = "readiness-check r
74
70
  return readJsonFileWithSchema(filePath, label, ReadinessCheckRunSchema);
75
71
  }
76
72
  export function readCurrentSavedReadinessCheckRun(options) {
77
- const latestComparison = readSavedReadinessCheckRun(options.projectPath, options.preparationName);
78
- if (!latestComparison) {
79
- return { comparison: null, stale: false };
73
+ const latestRun = readSavedReadinessCheckRun(options.projectPath, options.preparationName);
74
+ if (!latestRun) {
75
+ return { readinessRun: null, stale: false };
80
76
  }
81
77
  const currentFingerprint = fingerprintReadinessChecks(options.checks);
82
- if (!latestComparison.checks_fingerprint || latestComparison.checks_fingerprint !== currentFingerprint) {
83
- return { comparison: null, stale: true };
78
+ if (!latestRun.checks_fingerprint || latestRun.checks_fingerprint !== currentFingerprint) {
79
+ return { readinessRun: null, stale: true };
84
80
  }
85
- return { comparison: latestComparison, stale: false };
81
+ return { readinessRun: latestRun, stale: false };
86
82
  }
87
83
  export function saveReadinessCheckRun(options) {
88
84
  const generatedAt = new Date().toISOString();
@@ -117,9 +113,8 @@ export function saveReadinessCheckRun(options) {
117
113
  raw: rawSummary,
118
114
  compiled: compiledSummary,
119
115
  summary: {
120
- raw_pass_rate: rawPassRate,
121
- compiled_pass_rate: compiledPassRate,
122
- pass_rate_delta: rawPassRate !== null && compiledPassRate !== null ? compiledPassRate - rawPassRate : null,
116
+ source_files_pass_rate: rawPassRate,
117
+ portable_context_pass_rate: compiledPassRate,
123
118
  },
124
119
  };
125
120
  const latestStatePath = preparationLatestReadinessRunPath(options.sourcePath, options.preparationName);
@@ -228,7 +223,7 @@ export async function runReadinessChecksForExecutor(options) {
228
223
  (options.mode !== "compiled" || Boolean(compiledOutcome)) &&
229
224
  (options.mode !== "both" || (Boolean(rawOutcome) && Boolean(compiledOutcome)));
230
225
  const shouldSave = options.saveLatest !== false;
231
- const comparisonRunPath = shouldSave && modeSatisfied
226
+ const readinessRunPath = shouldSave && modeSatisfied
232
227
  ? saveReadinessCheckRun({
233
228
  sourcePath: options.sourcePath,
234
229
  portableContextPath: options.portableContextPath,
@@ -239,7 +234,7 @@ export async function runReadinessChecksForExecutor(options) {
239
234
  compiledOutcome,
240
235
  })
241
236
  : null;
242
- const comparison = shouldSave && modeSatisfied
237
+ const readinessRun = shouldSave && modeSatisfied
243
238
  ? readSavedReadinessCheckRun(options.sourcePath, options.preparationConfig.name)
244
239
  : null;
245
240
  return {
@@ -249,8 +244,8 @@ export async function runReadinessChecksForExecutor(options) {
249
244
  mode: options.mode,
250
245
  rawOutcome,
251
246
  compiledOutcome,
252
- comparisonRunPath,
253
- comparison,
247
+ readinessRunPath,
248
+ readinessRun,
254
249
  };
255
250
  }
256
251
  function portableContextPathForPreparation(sourcePath, preparationName) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@interf/compiler",
3
- "version": "0.9.3",
3
+ "version": "0.9.5",
4
4
  "description": "Interf prepares data for agent work. It runs locally, processes your files, shows evidence that your data is ready, and writes portable context: a local folder with verifiable outputs agents can use.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -14,17 +14,9 @@
14
14
  "types": "./dist/index.d.ts",
15
15
  "import": "./dist/index.js"
16
16
  },
17
- "./compiler": {
18
- "types": "./dist/packages/compiler/index.d.ts",
19
- "import": "./dist/packages/compiler/index.js"
20
- },
21
- "./method-package": {
22
- "types": "./dist/packages/method-package/index.d.ts",
23
- "import": "./dist/packages/method-package/index.js"
24
- },
25
- "./method-authoring": {
26
- "types": "./dist/packages/method-authoring/index.d.ts",
27
- "import": "./dist/packages/method-authoring/index.js"
17
+ "./contracts": {
18
+ "types": "./dist/packages/contracts/index.d.ts",
19
+ "import": "./dist/packages/contracts/index.js"
28
20
  },
29
21
  "./execution": {
30
22
  "types": "./dist/packages/execution/index.d.ts",
@@ -34,18 +26,6 @@
34
26
  "types": "./dist/packages/local-service/index.d.ts",
35
27
  "import": "./dist/packages/local-service/index.js"
36
28
  },
37
- "./project-model": {
38
- "types": "./dist/packages/project-model/index.d.ts",
39
- "import": "./dist/packages/project-model/index.js"
40
- },
41
- "./agents": {
42
- "types": "./dist/packages/agents/index.d.ts",
43
- "import": "./dist/packages/agents/index.js"
44
- },
45
- "./testing": {
46
- "types": "./dist/packages/testing/index.d.ts",
47
- "import": "./dist/packages/testing/index.js"
48
- },
49
29
  "./package.json": "./package.json"
50
30
  },
51
31
  "scripts": {
@@ -74,6 +54,7 @@
74
54
  "dist",
75
55
  "builtin-methods",
76
56
  "agent-skills",
57
+ "CHANGELOG.md",
77
58
  "TRADEMARKS.md"
78
59
  ],
79
60
  "publishConfig": {
@@ -1,17 +0,0 @@
1
- import type { MethodExecutionProfile, MethodExecutor } from "../../packages/agents/lib/executors.js";
2
- import type { SourcePreparationConfig } from "../../packages/project-model/lib/schema.js";
3
- import type { StageShellRetentionMode } from "../../packages/compiler/method-runs.js";
4
- import type { RunEventSink } from "../../packages/execution/events.js";
5
- export declare function runConfiguredCompiledCompile(options: {
6
- executor: MethodExecutor;
7
- testExecutor?: MethodExecutor | null;
8
- compiledPath: string;
9
- sourcePath: string;
10
- compiledConfig: SourcePreparationConfig | null;
11
- executionProfile?: MethodExecutionProfile;
12
- maxAttemptsOverride: number | null;
13
- maxLoopsOverride: number | null;
14
- preserveStageShells?: StageShellRetentionMode;
15
- runId?: string;
16
- events?: RunEventSink;
17
- }): Promise<boolean>;
@@ -1,25 +0,0 @@
1
- import type { SourcePreparationConfig } from "../../packages/project-model/lib/schema.js";
2
- import { type StageShellRetentionMode, type CompiledCompileResult } from "../../packages/compiler/method-runs.js";
3
- import type { MethodExecutor } from "../../packages/agents/lib/executors.js";
4
- import type { RunEventSink } from "../../packages/execution/events.js";
5
- export interface SavedPreparationEntry {
6
- config: SourcePreparationConfig;
7
- path: string | null;
8
- localDraft: boolean;
9
- }
10
- export declare function listSavedPreparationEntries(sourcePath: string): SavedPreparationEntry[];
11
- export declare function findBuiltCompiledPath(sourcePath: string, compiledName: string): string | null;
12
- export declare function findSavedCompiledConfig(sourcePath: string, compiledName: string): SourcePreparationConfig | null;
13
- export declare function chooseCompiledConfigToBuild(options: {
14
- sourcePath: string;
15
- selectMessage: string;
16
- }): Promise<SourcePreparationConfig | null | undefined>;
17
- export declare function createCompiledFromConfig(sourcePath: string, preparationConfig: SourcePreparationConfig): string;
18
- export declare function ensureCompiledFromConfig(sourcePath: string, preparationConfig: SourcePreparationConfig): string;
19
- export declare function compileCompiledWithReporter(executor: MethodExecutor, compiledPath: string, options?: {
20
- heading?: string;
21
- successMessage?: string;
22
- preserveStageShells?: StageShellRetentionMode;
23
- runId?: string;
24
- events?: RunEventSink;
25
- }): Promise<CompiledCompileResult>;