@interf/compiler 0.9.5 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -92
- package/TRADEMARKS.md +2 -13
- package/agent-skills/interf-actions/SKILL.md +95 -36
- package/agent-skills/interf-actions/references/cli.md +118 -51
- package/builtin-methods/interf-default/README.md +3 -4
- package/builtin-methods/interf-default/compile/stages/shape/SKILL.md +2 -2
- package/builtin-methods/interf-default/compile/stages/summarize/SKILL.md +2 -1
- package/builtin-methods/interf-default/improve/SKILL.md +1 -1
- package/builtin-methods/interf-default/method.json +10 -4
- package/builtin-methods/interf-default/method.schema.json +0 -9
- package/builtin-methods/interf-default/use/query/SKILL.md +5 -5
- package/dist/cli/commands/compile.d.ts +8 -25
- package/dist/cli/commands/compile.js +75 -360
- package/dist/cli/commands/doctor.js +1 -1
- package/dist/cli/commands/login.d.ts +7 -0
- package/dist/cli/commands/login.js +39 -0
- package/dist/cli/commands/logout.d.ts +2 -0
- package/dist/cli/commands/logout.js +16 -0
- package/dist/cli/commands/method.d.ts +2 -0
- package/dist/cli/commands/method.js +113 -0
- package/dist/cli/commands/prep.d.ts +2 -0
- package/dist/cli/commands/prep.js +134 -0
- package/dist/cli/commands/reset.d.ts +8 -1
- package/dist/cli/commands/reset.js +47 -26
- package/dist/cli/commands/runs.d.ts +2 -0
- package/dist/cli/commands/runs.js +120 -0
- package/dist/cli/commands/status.d.ts +6 -1
- package/dist/cli/commands/status.js +68 -111
- package/dist/cli/commands/test.d.ts +6 -14
- package/dist/cli/commands/test.js +65 -181
- package/dist/cli/commands/web.d.ts +0 -9
- package/dist/cli/commands/web.js +147 -120
- package/dist/cli/commands/wizard.d.ts +9 -0
- package/dist/cli/commands/wizard.js +442 -0
- package/dist/cli/index.d.ts +7 -6
- package/dist/cli/index.js +13 -10
- 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/{18a8f2jkv3z.c.css → 045gole2ojo3g.css} +1 -1
- package/dist/compiler-ui/_next/static/chunks/{177mvn4rse235.js → 17t-lulmyawg5.js} +9 -9
- 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/agents/lib/shells.d.ts +1 -1
- package/dist/packages/agents/lib/shells.js +111 -52
- package/dist/packages/agents/lib/user-config.d.ts +4 -2
- package/dist/packages/agents/lib/user-config.js +15 -7
- package/dist/packages/compiler/compiled-paths.d.ts +9 -2
- package/dist/packages/compiler/compiled-paths.js +30 -15
- package/dist/packages/compiler/compiled-pipeline.js +23 -3
- package/dist/packages/compiler/compiled-stage-plan.js +4 -0
- package/dist/packages/compiler/compiled-target.d.ts +1 -1
- package/dist/packages/compiler/compiled-target.js +1 -1
- package/dist/packages/compiler/index.d.ts +1 -0
- package/dist/packages/compiler/index.js +1 -0
- package/dist/packages/compiler/lib/schema.d.ts +26 -31
- package/dist/packages/compiler/lib/schema.js +1 -12
- package/dist/packages/compiler/method-runs.d.ts +2 -3
- package/dist/packages/compiler/method-runs.js +2 -3
- package/dist/packages/compiler/reset.js +3 -1
- package/dist/packages/compiler/runtime-contracts.js +0 -3
- package/dist/packages/compiler/runtime-prompt.js +1 -1
- package/dist/packages/compiler/source-files.d.ts +46 -0
- package/dist/packages/compiler/source-files.js +149 -0
- package/dist/packages/compiler/state-artifacts.d.ts +3 -2
- package/dist/packages/compiler/state-artifacts.js +4 -3
- package/dist/packages/compiler/state-io.d.ts +3 -2
- package/dist/packages/compiler/state-io.js +11 -5
- package/dist/packages/compiler/state-paths.d.ts +2 -1
- package/dist/packages/compiler/state-paths.js +6 -3
- package/dist/packages/compiler/state-view.d.ts +3 -2
- package/dist/packages/compiler/state-view.js +18 -28
- package/dist/packages/compiler/state.d.ts +4 -4
- package/dist/packages/compiler/state.js +3 -3
- package/dist/packages/contracts/index.d.ts +1 -1
- package/dist/packages/contracts/lib/preparation-paths.d.ts +117 -0
- package/dist/packages/contracts/lib/preparation-paths.js +177 -0
- package/dist/packages/contracts/lib/schema.d.ts +85 -5
- package/dist/packages/contracts/lib/schema.js +46 -1
- package/dist/packages/execution/lib/schema.d.ts +50 -50
- package/dist/packages/execution/lib/schema.js +1 -1
- package/dist/packages/local-service/action-definitions.d.ts +14 -14
- package/dist/packages/local-service/action-definitions.js +27 -28
- package/dist/packages/local-service/action-planner.js +2 -1
- package/dist/packages/local-service/client.d.ts +51 -52
- package/dist/packages/local-service/client.js +132 -140
- package/dist/packages/local-service/connection-config.d.ts +38 -0
- package/dist/packages/local-service/connection-config.js +75 -0
- package/dist/packages/local-service/index.d.ts +11 -7
- package/dist/packages/local-service/index.js +6 -4
- package/dist/packages/local-service/instance-paths.d.ts +100 -0
- package/dist/packages/local-service/instance-paths.js +165 -0
- package/dist/packages/local-service/lib/schema.d.ts +405 -2297
- package/dist/packages/local-service/lib/schema.js +146 -62
- package/dist/packages/local-service/native-run-handlers.js +3 -3
- package/dist/packages/local-service/preparation-store.d.ts +92 -0
- package/dist/packages/local-service/preparation-store.js +171 -0
- package/dist/packages/local-service/routes.d.ts +33 -16
- package/dist/packages/local-service/routes.js +44 -20
- package/dist/packages/local-service/run-observability.js +11 -11
- package/dist/packages/local-service/runtime-caches.d.ts +76 -0
- package/dist/packages/local-service/runtime-caches.js +191 -0
- package/dist/packages/local-service/runtime-event-applier.d.ts +12 -0
- package/dist/packages/local-service/runtime-event-applier.js +177 -0
- package/dist/packages/local-service/runtime-persistence.d.ts +47 -0
- package/dist/packages/local-service/runtime-persistence.js +137 -0
- package/dist/packages/local-service/runtime-proposal-helpers.d.ts +35 -0
- package/dist/packages/local-service/runtime-proposal-helpers.js +251 -0
- package/dist/packages/local-service/runtime-resource-builders.d.ts +52 -0
- package/dist/packages/local-service/runtime-resource-builders.js +149 -0
- package/dist/packages/local-service/runtime.d.ts +197 -43
- package/dist/packages/local-service/runtime.js +800 -974
- package/dist/packages/local-service/server.d.ts +15 -0
- package/dist/packages/local-service/server.js +641 -273
- package/dist/packages/local-service/service-registry.d.ts +47 -0
- package/dist/packages/local-service/service-registry.js +137 -0
- package/dist/packages/method-authoring/method-authoring.d.ts +1 -1
- package/dist/packages/method-authoring/method-authoring.js +2 -2
- package/dist/packages/method-authoring/method-improvement.js +1 -1
- package/dist/packages/method-package/builtin-compiled-method.d.ts +4 -5
- package/dist/packages/method-package/builtin-compiled-method.js +8 -14
- package/dist/packages/method-package/context-interface.d.ts +4 -40
- package/dist/packages/method-package/context-interface.js +1 -23
- package/dist/packages/method-package/interf-method-package.d.ts +4 -4
- package/dist/packages/method-package/interf-method-package.js +21 -33
- package/dist/packages/method-package/local-methods.d.ts +10 -6
- package/dist/packages/method-package/local-methods.js +57 -39
- package/dist/packages/method-package/method-definitions.d.ts +8 -34
- package/dist/packages/method-package/method-definitions.js +49 -37
- package/dist/packages/method-package/method-helpers.d.ts +1 -13
- package/dist/packages/method-package/method-helpers.js +8 -42
- package/dist/packages/method-package/method-stage-runner.js +2 -2
- package/dist/packages/method-package/user-methods.d.ts +17 -0
- package/dist/packages/method-package/user-methods.js +77 -0
- package/dist/packages/project-model/index.d.ts +0 -1
- package/dist/packages/project-model/index.js +0 -1
- package/dist/packages/project-model/interf-detect.d.ts +8 -3
- package/dist/packages/project-model/interf-detect.js +34 -34
- package/dist/packages/project-model/interf-scaffold.d.ts +3 -3
- package/dist/packages/project-model/interf-scaffold.js +23 -32
- package/dist/packages/project-model/lib/schema.js +38 -1
- package/dist/packages/project-model/preparation-entries.d.ts +5 -5
- package/dist/packages/project-model/preparation-entries.js +14 -14
- package/dist/packages/project-model/source-config.d.ts +11 -11
- package/dist/packages/project-model/source-config.js +74 -46
- package/dist/packages/project-model/source-folders.d.ts +5 -5
- package/dist/packages/project-model/source-folders.js +14 -14
- package/dist/packages/shared/filesystem.d.ts +7 -0
- package/dist/packages/shared/filesystem.js +97 -10
- package/dist/packages/testing/lib/schema.d.ts +10 -10
- package/dist/packages/testing/lib/schema.js +2 -2
- package/dist/packages/testing/readiness-check-run.d.ts +4 -4
- package/dist/packages/testing/readiness-check-run.js +36 -36
- package/dist/packages/testing/test-execution.js +6 -6
- package/dist/packages/testing/test-paths.js +4 -3
- package/dist/packages/testing/test-sandbox.d.ts +0 -1
- package/dist/packages/testing/test-sandbox.js +14 -30
- package/dist/packages/testing/test-targets.d.ts +1 -1
- package/dist/packages/testing/test-targets.js +6 -6
- package/dist/packages/testing/test.d.ts +1 -1
- package/dist/packages/testing/test.js +1 -1
- package/package.json +3 -4
- package/CHANGELOG.md +0 -93
- package/LICENSE +0 -183
- package/dist/cli/commands/action-input-cli.d.ts +0 -25
- package/dist/cli/commands/action-input-cli.js +0 -73
- package/dist/cli/commands/control-path.d.ts +0 -11
- package/dist/cli/commands/control-path.js +0 -72
- package/dist/cli/commands/create-method-wizard.d.ts +0 -64
- package/dist/cli/commands/create-method-wizard.js +0 -434
- package/dist/cli/commands/create.d.ts +0 -6
- package/dist/cli/commands/create.js +0 -183
- package/dist/cli/commands/default.d.ts +0 -2
- package/dist/cli/commands/default.js +0 -39
- package/dist/cli/commands/executor-flow.d.ts +0 -29
- package/dist/cli/commands/executor-flow.js +0 -163
- package/dist/cli/commands/init.d.ts +0 -26
- package/dist/cli/commands/init.js +0 -771
- package/dist/cli/commands/list.d.ts +0 -2
- package/dist/cli/commands/list.js +0 -30
- package/dist/cli/commands/preparation-action.d.ts +0 -8
- package/dist/cli/commands/preparation-action.js +0 -29
- package/dist/cli/commands/preparation-picker.d.ts +0 -5
- package/dist/cli/commands/preparation-picker.js +0 -36
- package/dist/cli/commands/preparation-selection.d.ts +0 -6
- package/dist/cli/commands/preparation-selection.js +0 -11
- package/dist/cli/commands/service-action-flow.d.ts +0 -9
- package/dist/cli/commands/service-action-flow.js +0 -19
- package/dist/cli/commands/source-config-wizard.d.ts +0 -51
- package/dist/cli/commands/source-config-wizard.js +0 -670
- package/dist/cli/commands/verify.d.ts +0 -2
- package/dist/cli/commands/verify.js +0 -94
- package/dist/packages/compiler/raw-snapshot.d.ts +0 -49
- package/dist/packages/compiler/raw-snapshot.js +0 -101
- package/dist/packages/method-package/index.d.ts +0 -11
- package/dist/packages/method-package/index.js +0 -11
- package/dist/packages/method-package/method-stage-policy.d.ts +0 -5
- package/dist/packages/method-package/method-stage-policy.js +0 -31
- package/dist/packages/project-model/project-paths.d.ts +0 -12
- package/dist/packages/project-model/project-paths.js +0 -33
- /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → C6vVfy3aeYuIO3d2AoNvC}/_buildManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → C6vVfy3aeYuIO3d2AoNvC}/_clientMiddlewareManifest.js +0 -0
- /package/dist/compiler-ui/_next/static/{84FaeF3EzBF9kKTMjSEVN → C6vVfy3aeYuIO3d2AoNvC}/_ssgManifest.js +0 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central service registry at `~/.interf/services.json`.
|
|
3
|
+
*
|
|
4
|
+
* One running `interf web` instance can serve N workspaces. Every running
|
|
5
|
+
* instance writes an entry here on start and removes it on close. CLI/UX
|
|
6
|
+
* code consults this registry to decide whether a fresh `interf web` should
|
|
7
|
+
* register a workspace with an existing instance instead of starting a
|
|
8
|
+
* second engine.
|
|
9
|
+
*
|
|
10
|
+
* Entry shape:
|
|
11
|
+
* {
|
|
12
|
+
* pid, host, port, url, started_at,
|
|
13
|
+
* workspaces: [{ control_path, registered_at, last_activity }],
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* Atomic write: write to a sibling tmp file, then rename. Concurrent
|
|
17
|
+
* `interf web` invocations get last-writer-wins semantics; pruning of
|
|
18
|
+
* stale entries makes that self-healing.
|
|
19
|
+
*/
|
|
20
|
+
import { interfHomeRoot, serviceRegistryPath } from "../contracts/lib/preparation-paths.js";
|
|
21
|
+
import { type ServiceRegistryEntry, type ServiceRegistryWorkspace } from "./lib/schema.js";
|
|
22
|
+
/**
|
|
23
|
+
* Read the service registry. Removes entries whose pid is no longer alive
|
|
24
|
+
* before returning. Does not health-check the HTTP endpoint — that is too
|
|
25
|
+
* expensive for the synchronous read path; callers that care can verify
|
|
26
|
+
* with a fetch.
|
|
27
|
+
*/
|
|
28
|
+
export declare function readServiceRegistry(): ServiceRegistryEntry[];
|
|
29
|
+
/** Overwrite the registry with the given list of services. */
|
|
30
|
+
export declare function writeServiceRegistry(services: ServiceRegistryEntry[]): void;
|
|
31
|
+
/**
|
|
32
|
+
* Insert or update the entry for this process's pid. If the pid was
|
|
33
|
+
* already registered, replaces it (so callers can use this to update the
|
|
34
|
+
* workspace list).
|
|
35
|
+
*/
|
|
36
|
+
export declare function registerServiceLocally(entry: ServiceRegistryEntry): ServiceRegistryEntry;
|
|
37
|
+
/** Remove the registry entry for the given pid. */
|
|
38
|
+
export declare function unregisterService(pid: number): void;
|
|
39
|
+
/** Update the workspaces array on the entry for this process's pid. */
|
|
40
|
+
export declare function updateLocalServiceWorkspaces(pid: number, options: {
|
|
41
|
+
host: string;
|
|
42
|
+
port: number;
|
|
43
|
+
url: string;
|
|
44
|
+
started_at: string;
|
|
45
|
+
workspaces: ServiceRegistryWorkspace[];
|
|
46
|
+
}): ServiceRegistryEntry;
|
|
47
|
+
export { interfHomeRoot, serviceRegistryPath };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Central service registry at `~/.interf/services.json`.
|
|
3
|
+
*
|
|
4
|
+
* One running `interf web` instance can serve N workspaces. Every running
|
|
5
|
+
* instance writes an entry here on start and removes it on close. CLI/UX
|
|
6
|
+
* code consults this registry to decide whether a fresh `interf web` should
|
|
7
|
+
* register a workspace with an existing instance instead of starting a
|
|
8
|
+
* second engine.
|
|
9
|
+
*
|
|
10
|
+
* Entry shape:
|
|
11
|
+
* {
|
|
12
|
+
* pid, host, port, url, started_at,
|
|
13
|
+
* workspaces: [{ control_path, registered_at, last_activity }],
|
|
14
|
+
* }
|
|
15
|
+
*
|
|
16
|
+
* Atomic write: write to a sibling tmp file, then rename. Concurrent
|
|
17
|
+
* `interf web` invocations get last-writer-wins semantics; pruning of
|
|
18
|
+
* stale entries makes that self-healing.
|
|
19
|
+
*/
|
|
20
|
+
import { existsSync, mkdirSync, readFileSync, renameSync, rmSync, writeFileSync, } from "node:fs";
|
|
21
|
+
import { dirname } from "node:path";
|
|
22
|
+
import { interfHomeRoot, serviceRegistryPath, } from "../contracts/lib/preparation-paths.js";
|
|
23
|
+
import { ServiceRegistrySchema, ServiceRegistryEntrySchema, ServiceRegistryWorkspaceSchema, } from "./lib/schema.js";
|
|
24
|
+
/** Returns true when the OS still has a process with this pid. */
|
|
25
|
+
function isProcessAlive(pid) {
|
|
26
|
+
if (!Number.isInteger(pid) || pid <= 0)
|
|
27
|
+
return false;
|
|
28
|
+
if (pid === process.pid)
|
|
29
|
+
return true;
|
|
30
|
+
try {
|
|
31
|
+
process.kill(pid, 0);
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
const code = error?.code;
|
|
36
|
+
// EPERM means the process exists but we can't signal it — still alive.
|
|
37
|
+
return code === "EPERM";
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
function readRegistryRaw() {
|
|
41
|
+
const path = serviceRegistryPath();
|
|
42
|
+
if (!existsSync(path))
|
|
43
|
+
return { services: [] };
|
|
44
|
+
try {
|
|
45
|
+
const raw = readFileSync(path, "utf8");
|
|
46
|
+
if (!raw.trim())
|
|
47
|
+
return { services: [] };
|
|
48
|
+
const parsed = ServiceRegistrySchema.safeParse(JSON.parse(raw));
|
|
49
|
+
if (parsed.success)
|
|
50
|
+
return parsed.data;
|
|
51
|
+
return { services: [] };
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return { services: [] };
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
function writeRegistryRaw(registry) {
|
|
58
|
+
const path = serviceRegistryPath();
|
|
59
|
+
const dir = dirname(path);
|
|
60
|
+
mkdirSync(dir, { recursive: true });
|
|
61
|
+
const tmpPath = `${path}.${process.pid}.${Date.now()}.tmp`;
|
|
62
|
+
const parsed = ServiceRegistrySchema.parse(registry);
|
|
63
|
+
writeFileSync(tmpPath, `${JSON.stringify(parsed, null, 2)}\n`);
|
|
64
|
+
try {
|
|
65
|
+
renameSync(tmpPath, path);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
try {
|
|
69
|
+
rmSync(tmpPath, { force: true });
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
// ignore
|
|
73
|
+
}
|
|
74
|
+
throw error;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Read the service registry. Removes entries whose pid is no longer alive
|
|
79
|
+
* before returning. Does not health-check the HTTP endpoint — that is too
|
|
80
|
+
* expensive for the synchronous read path; callers that care can verify
|
|
81
|
+
* with a fetch.
|
|
82
|
+
*/
|
|
83
|
+
export function readServiceRegistry() {
|
|
84
|
+
const raw = readRegistryRaw();
|
|
85
|
+
const live = [];
|
|
86
|
+
let pruned = false;
|
|
87
|
+
for (const service of raw.services) {
|
|
88
|
+
if (isProcessAlive(service.pid)) {
|
|
89
|
+
live.push(service);
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
pruned = true;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
if (pruned) {
|
|
96
|
+
try {
|
|
97
|
+
writeRegistryRaw({ services: live });
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
// best effort; another writer may have raced us
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
return live;
|
|
104
|
+
}
|
|
105
|
+
/** Overwrite the registry with the given list of services. */
|
|
106
|
+
export function writeServiceRegistry(services) {
|
|
107
|
+
writeRegistryRaw({ services });
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Insert or update the entry for this process's pid. If the pid was
|
|
111
|
+
* already registered, replaces it (so callers can use this to update the
|
|
112
|
+
* workspace list).
|
|
113
|
+
*/
|
|
114
|
+
export function registerServiceLocally(entry) {
|
|
115
|
+
const parsed = ServiceRegistryEntrySchema.parse(entry);
|
|
116
|
+
const existing = readServiceRegistry().filter((service) => service.pid !== parsed.pid);
|
|
117
|
+
const next = [...existing, parsed];
|
|
118
|
+
writeServiceRegistry(next);
|
|
119
|
+
return parsed;
|
|
120
|
+
}
|
|
121
|
+
/** Remove the registry entry for the given pid. */
|
|
122
|
+
export function unregisterService(pid) {
|
|
123
|
+
const remaining = readServiceRegistry().filter((service) => service.pid !== pid);
|
|
124
|
+
writeServiceRegistry(remaining);
|
|
125
|
+
}
|
|
126
|
+
/** Update the workspaces array on the entry for this process's pid. */
|
|
127
|
+
export function updateLocalServiceWorkspaces(pid, options) {
|
|
128
|
+
return registerServiceLocally(ServiceRegistryEntrySchema.parse({
|
|
129
|
+
pid,
|
|
130
|
+
host: options.host,
|
|
131
|
+
port: options.port,
|
|
132
|
+
url: options.url,
|
|
133
|
+
started_at: options.started_at,
|
|
134
|
+
workspaces: options.workspaces.map((workspace) => ServiceRegistryWorkspaceSchema.parse(workspace)),
|
|
135
|
+
}));
|
|
136
|
+
}
|
|
137
|
+
export { interfHomeRoot, serviceRegistryPath };
|
|
@@ -14,7 +14,7 @@ function buildMethodAuthoringPrompt() {
|
|
|
14
14
|
`Then read \`method/README.md\`, \`method/method.json\`, and \`method/${CONTEXT_INTERFACE_FILE}\`.`,
|
|
15
15
|
"The `method/` directory starts as a neutral Method package scaffold, not as a suggested Method.",
|
|
16
16
|
"Replace the scaffold purpose, inputs, context interface, stages, stage docs, proof rules, and query guidance with the Method this agent work actually needs.",
|
|
17
|
-
"
|
|
17
|
+
"Read `runtime/source-files.json` and inspect the listed source locators before editing the package.",
|
|
18
18
|
"Prefer direct file-reading and search tools over shell commands for routine file inspection.",
|
|
19
19
|
"Do not use shell helpers like `cat`, `sed`, `ls`, or `find` when a native read/search tool can inspect the same files.",
|
|
20
20
|
"Edit only files under `method/`.",
|
|
@@ -76,7 +76,7 @@ function validateAuthoredMethodPackage(methodPath) {
|
|
|
76
76
|
}
|
|
77
77
|
export async function runMethodAuthoringDraft(options) {
|
|
78
78
|
const methodPath = createScratchLocalMethodPackage({
|
|
79
|
-
|
|
79
|
+
prepDataDir: options.prepDataDir,
|
|
80
80
|
methodId: options.methodId,
|
|
81
81
|
label: options.label,
|
|
82
82
|
hint: options.hint,
|
|
@@ -64,7 +64,7 @@ function buildMethodImprovementPrompt() {
|
|
|
64
64
|
"Treat the Method package as four aligned layers: purpose, inputs, context interface, and stages.",
|
|
65
65
|
"Prefer editing the stage docs, Method contract, input contract, or schema ownership that actually change portable-context outputs.",
|
|
66
66
|
"Edit only files under `method/`.",
|
|
67
|
-
"Do not edit checks, test specs,
|
|
67
|
+
"Do not edit checks, test specs, source files, or generated portable-context outputs.",
|
|
68
68
|
"Keep the Method package valid for the current compiler API and `method.schema.json`.",
|
|
69
69
|
"Respect stage boundaries: a stage may only introduce links that resolve within that stage's declared writes or already-existing read zones.",
|
|
70
70
|
"Do not make one stage point at files or notes that are only created later by another stage.",
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { type CompiledZoneKind } from "../compiler/method-primitives.js";
|
|
2
|
+
declare const BUILTIN_COMPILED_STAGE_IDS: {
|
|
3
3
|
readonly SUMMARIZE: "summarize";
|
|
4
4
|
readonly STRUCTURE: "structure";
|
|
5
5
|
readonly SHAPE: "shape";
|
|
6
6
|
};
|
|
7
|
-
|
|
7
|
+
type BuiltinCompiledStageId = typeof BUILTIN_COMPILED_STAGE_IDS[keyof typeof BUILTIN_COMPILED_STAGE_IDS];
|
|
8
8
|
export declare const BUILTIN_COMPILED_ZONE_IDS: {
|
|
9
|
-
readonly RAW: "raw";
|
|
10
9
|
readonly SUMMARIES: "summaries";
|
|
11
10
|
readonly KNOWLEDGE_ENTITIES: "knowledge-entities";
|
|
12
11
|
readonly KNOWLEDGE_CLAIMS: "knowledge-claims";
|
|
@@ -35,4 +34,4 @@ export declare function requiredCompiledZoneOwners<TStage extends {
|
|
|
35
34
|
id: string;
|
|
36
35
|
writes: readonly string[];
|
|
37
36
|
}>(stages: readonly TStage[], zoneId: BuiltinCompiledZoneId): string[];
|
|
38
|
-
export {
|
|
37
|
+
export {};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { join } from "node:path";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { readJsonFileWithSchema } from "../shared/parse.js";
|
|
4
|
-
import { COMPILED_ZONE_KINDS } from "../compiler/method-primitives.js";
|
|
5
4
|
import { MethodCompiledSchemaSchema } from "../compiler/lib/schema.js";
|
|
6
5
|
import { PACKAGE_ROOT } from "./lib/package-root.js";
|
|
7
|
-
|
|
6
|
+
const BUILTIN_COMPILED_STAGE_IDS = {
|
|
8
7
|
SUMMARIZE: "summarize",
|
|
9
8
|
STRUCTURE: "structure",
|
|
10
9
|
SHAPE: "shape",
|
|
11
10
|
};
|
|
12
11
|
export const BUILTIN_COMPILED_ZONE_IDS = {
|
|
13
|
-
RAW: "raw",
|
|
14
12
|
SUMMARIES: "summaries",
|
|
15
13
|
KNOWLEDGE_ENTITIES: "knowledge-entities",
|
|
16
14
|
KNOWLEDGE_CLAIMS: "knowledge-claims",
|
|
@@ -30,12 +28,7 @@ const BuiltinMethodPackageSchema = z.object({
|
|
|
30
28
|
stages: z.array(BuiltinMethodStageSchema).min(1),
|
|
31
29
|
});
|
|
32
30
|
let builtinCompiledContractCache = null;
|
|
33
|
-
|
|
34
|
-
return join(PACKAGE_ROOT, "builtin-methods", "interf-default");
|
|
35
|
-
}
|
|
36
|
-
function builtinMethodPath(relativePath) {
|
|
37
|
-
return join(builtinMethodRootPath(), relativePath);
|
|
38
|
-
}
|
|
31
|
+
const BUILTIN_DEFAULT_METHOD_ROOT = join(PACKAGE_ROOT, "builtin-methods", "interf-default");
|
|
39
32
|
function assertBuiltinZoneId(value) {
|
|
40
33
|
if (!BUILTIN_ZONE_ID_SET.has(value)) {
|
|
41
34
|
throw new Error(`Built-in Interf Method schema declares unsupported zone id "${value}".`);
|
|
@@ -51,13 +44,15 @@ function assertBuiltinStageId(value) {
|
|
|
51
44
|
function loadBuiltinCompiledContract() {
|
|
52
45
|
if (builtinCompiledContractCache)
|
|
53
46
|
return builtinCompiledContractCache;
|
|
54
|
-
const
|
|
47
|
+
const schemaPath = join(BUILTIN_DEFAULT_METHOD_ROOT, "method.schema.json");
|
|
48
|
+
const methodPath = join(BUILTIN_DEFAULT_METHOD_ROOT, "method.json");
|
|
49
|
+
const schema = readJsonFileWithSchema(schemaPath, "built-in Interf Method schema", MethodCompiledSchemaSchema);
|
|
55
50
|
if (!schema) {
|
|
56
|
-
throw new Error(`Missing or invalid built-in Method schema at ${
|
|
51
|
+
throw new Error(`Missing or invalid built-in Method schema at ${schemaPath}.`);
|
|
57
52
|
}
|
|
58
|
-
const method = readJsonFileWithSchema(
|
|
53
|
+
const method = readJsonFileWithSchema(methodPath, "built-in Interf Method package", BuiltinMethodPackageSchema);
|
|
59
54
|
if (!method) {
|
|
60
|
-
throw new Error(`Missing or invalid built-in Method package at ${
|
|
55
|
+
throw new Error(`Missing or invalid built-in Method package at ${methodPath}.`);
|
|
61
56
|
}
|
|
62
57
|
const zones = schema.zones.map((zone) => ({
|
|
63
58
|
id: assertBuiltinZoneId(zone.id),
|
|
@@ -91,4 +86,3 @@ export function requiredCompiledZoneOwners(stages, zoneId) {
|
|
|
91
86
|
.filter((stage) => stage.writes.includes(zoneId))
|
|
92
87
|
.map((stage) => stage.id)));
|
|
93
88
|
}
|
|
94
|
-
export { COMPILED_ZONE_KINDS };
|
|
@@ -9,8 +9,8 @@ export declare const ContextInterfaceSchema: z.ZodObject<{
|
|
|
9
9
|
zones: z.ZodArray<z.ZodObject<{
|
|
10
10
|
id: z.ZodString;
|
|
11
11
|
role: z.ZodEnum<{
|
|
12
|
-
output: "output";
|
|
13
12
|
runtime: "runtime";
|
|
13
|
+
output: "output";
|
|
14
14
|
input: "input";
|
|
15
15
|
working: "working";
|
|
16
16
|
}>;
|
|
@@ -25,31 +25,6 @@ export declare const ContextInterfaceSchema: z.ZodObject<{
|
|
|
25
25
|
description: z.ZodString;
|
|
26
26
|
}, z.core.$strip>>;
|
|
27
27
|
}, z.core.$strip>;
|
|
28
|
-
export declare const ContextInterfaceZoneSchema: z.ZodObject<{
|
|
29
|
-
id: z.ZodString;
|
|
30
|
-
role: z.ZodEnum<{
|
|
31
|
-
output: "output";
|
|
32
|
-
runtime: "runtime";
|
|
33
|
-
input: "input";
|
|
34
|
-
working: "working";
|
|
35
|
-
}>;
|
|
36
|
-
path: z.ZodString;
|
|
37
|
-
kind: z.ZodEnum<{
|
|
38
|
-
runtime: "runtime";
|
|
39
|
-
file: "file";
|
|
40
|
-
directory: "directory";
|
|
41
|
-
}>;
|
|
42
|
-
required: z.ZodBoolean;
|
|
43
|
-
owned_by: z.ZodArray<z.ZodString>;
|
|
44
|
-
description: z.ZodString;
|
|
45
|
-
}, z.core.$strip>;
|
|
46
|
-
export declare const ContextInterfaceZoneIdSchema: z.ZodString;
|
|
47
|
-
export declare const ContextInterfaceZoneRoleSchema: z.ZodEnum<{
|
|
48
|
-
output: "output";
|
|
49
|
-
runtime: "runtime";
|
|
50
|
-
input: "input";
|
|
51
|
-
working: "working";
|
|
52
|
-
}>;
|
|
53
28
|
export declare const MethodInputSpecSchema: z.ZodObject<{
|
|
54
29
|
id: z.ZodString;
|
|
55
30
|
label: z.ZodString;
|
|
@@ -57,23 +32,15 @@ export declare const MethodInputSpecSchema: z.ZodObject<{
|
|
|
57
32
|
required: z.ZodDefault<z.ZodBoolean>;
|
|
58
33
|
examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
59
34
|
}, z.core.$strict>;
|
|
60
|
-
export declare const MethodInputContractSchema: z.ZodArray<z.ZodObject<{
|
|
61
|
-
id: z.ZodString;
|
|
62
|
-
label: z.ZodString;
|
|
63
|
-
description: z.ZodString;
|
|
64
|
-
required: z.ZodDefault<z.ZodBoolean>;
|
|
65
|
-
examples: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
66
|
-
}, z.core.$strict>>;
|
|
67
35
|
export type ContextInterface = MethodCompiledSchema;
|
|
68
36
|
export type ContextInterfaceZone = MethodCompiledZone;
|
|
69
37
|
export type ContextInterfaceZoneId = MethodZoneId;
|
|
70
|
-
export type ContextInterfaceZoneRole = z.infer<typeof ContextInterfaceZoneRoleSchema>;
|
|
71
38
|
export type MethodInputSpec = z.infer<typeof MethodInputSpecSchema>;
|
|
72
|
-
|
|
39
|
+
interface ContextInterfaceStageLike {
|
|
73
40
|
id: string;
|
|
74
41
|
writes: readonly string[];
|
|
75
42
|
}
|
|
76
|
-
|
|
43
|
+
interface ContextInterfaceSummary {
|
|
77
44
|
inputZones: ContextInterfaceZone[];
|
|
78
45
|
workingZones: ContextInterfaceZone[];
|
|
79
46
|
outputZones: ContextInterfaceZone[];
|
|
@@ -82,15 +49,12 @@ export interface ContextInterfaceSummary {
|
|
|
82
49
|
export declare function contextInterfaceFilePath(rootPath: string): string;
|
|
83
50
|
export declare function resolveContextInterfacePath(rootPath: string): string | null;
|
|
84
51
|
export declare function contextInterfaceExists(rootPath: string): boolean;
|
|
85
|
-
export declare function contextInterfaceRelativePath(): string;
|
|
86
|
-
export declare function listContextInterfaceZones(contextInterface: ContextInterface): ContextInterfaceZone[];
|
|
87
|
-
export declare function findContextInterfaceZone(contextInterface: ContextInterface, zoneId: ContextInterfaceZoneId): ContextInterfaceZone | null;
|
|
88
52
|
export declare function contextInterfaceZoneAbsolutePath(compiledPath: string, zone: Pick<ContextInterfaceZone, "path">): string;
|
|
89
53
|
export declare function contextInterfaceArtifactPath(zone: Pick<ContextInterfaceZone, "path" | "kind">): string;
|
|
90
|
-
export declare function contextInterfaceArtifactPathsForZoneIds(contextInterface: ContextInterface, zoneIds: readonly ContextInterfaceZoneId[]): string[];
|
|
91
54
|
export declare function summarizeContextInterface(contextInterface: ContextInterface): ContextInterfaceSummary;
|
|
92
55
|
export declare function deriveMethodInputsFromContextInterface(contextInterface: ContextInterface | null | undefined): MethodInputSpec[];
|
|
93
56
|
export declare function buildContextInterface(stages: ContextInterfaceStageLike[], label?: string): ContextInterface;
|
|
94
57
|
export declare function writeContextInterfaceFile(rootPath: string, stages: ContextInterfaceStageLike[], label?: string): ContextInterface;
|
|
95
58
|
export declare function writeContextInterface(rootPath: string, contextInterface: ContextInterface): ContextInterface;
|
|
96
59
|
export declare function readContextInterface(rootPath: string): ContextInterface | null;
|
|
60
|
+
export {};
|
|
@@ -3,16 +3,13 @@ import { join } from "node:path";
|
|
|
3
3
|
import { z } from "zod";
|
|
4
4
|
import { warnInterf } from "../shared/logger.js";
|
|
5
5
|
import { readJsonFileUnchecked } from "../shared/parse.js";
|
|
6
|
-
import { MethodCompiledSchemaSchema,
|
|
6
|
+
import { MethodCompiledSchemaSchema, MethodZoneIdSchema, } from "../compiler/lib/schema.js";
|
|
7
7
|
import { listBuiltinCompiledZoneSpecs, requiredCompiledZoneOwners, } from "./builtin-compiled-method.js";
|
|
8
8
|
// Method packages define the context interface. The compiler persists the
|
|
9
9
|
// same schema on disk, but higher layers should prefer this boundary when they
|
|
10
10
|
// mean "the Method-declared shape a portable context must implement."
|
|
11
11
|
export const CONTEXT_INTERFACE_FILE = "method.schema.json";
|
|
12
12
|
export const ContextInterfaceSchema = MethodCompiledSchemaSchema;
|
|
13
|
-
export const ContextInterfaceZoneSchema = MethodCompiledZoneSchema;
|
|
14
|
-
export const ContextInterfaceZoneIdSchema = MethodZoneIdSchema;
|
|
15
|
-
export const ContextInterfaceZoneRoleSchema = MethodZoneRoleSchema;
|
|
16
13
|
// Package-owned input contract for authoring, review, and future authoring flows.
|
|
17
14
|
// This does not change compiler execution semantics; it describes what data a
|
|
18
15
|
// Method expects to organize before the compiler materializes the context
|
|
@@ -24,7 +21,6 @@ export const MethodInputSpecSchema = z.object({
|
|
|
24
21
|
required: z.boolean().default(false),
|
|
25
22
|
examples: z.array(z.string().min(1)).optional(),
|
|
26
23
|
}).strict();
|
|
27
|
-
export const MethodInputContractSchema = z.array(MethodInputSpecSchema);
|
|
28
24
|
function normalizeContextInterface(contextInterface) {
|
|
29
25
|
return {
|
|
30
26
|
...contextInterface,
|
|
@@ -53,15 +49,6 @@ export function resolveContextInterfacePath(rootPath) {
|
|
|
53
49
|
export function contextInterfaceExists(rootPath) {
|
|
54
50
|
return existsSync(contextInterfaceFilePath(rootPath));
|
|
55
51
|
}
|
|
56
|
-
export function contextInterfaceRelativePath() {
|
|
57
|
-
return `method/${CONTEXT_INTERFACE_FILE}`;
|
|
58
|
-
}
|
|
59
|
-
export function listContextInterfaceZones(contextInterface) {
|
|
60
|
-
return [...contextInterface.zones];
|
|
61
|
-
}
|
|
62
|
-
export function findContextInterfaceZone(contextInterface, zoneId) {
|
|
63
|
-
return contextInterface.zones.find((zone) => zone.id === zoneId) ?? null;
|
|
64
|
-
}
|
|
65
52
|
export function contextInterfaceZoneAbsolutePath(compiledPath, zone) {
|
|
66
53
|
return join(compiledPath, zone.path);
|
|
67
54
|
}
|
|
@@ -70,15 +57,6 @@ export function contextInterfaceArtifactPath(zone) {
|
|
|
70
57
|
return zone.path;
|
|
71
58
|
return zone.path.endsWith("/") ? zone.path : `${zone.path}/`;
|
|
72
59
|
}
|
|
73
|
-
export function contextInterfaceArtifactPathsForZoneIds(contextInterface, zoneIds) {
|
|
74
|
-
return zoneIds.map((zoneId) => {
|
|
75
|
-
const zone = findContextInterfaceZone(contextInterface, zoneId);
|
|
76
|
-
if (!zone) {
|
|
77
|
-
throw new Error(`Context interface is missing declared zone "${zoneId}".`);
|
|
78
|
-
}
|
|
79
|
-
return contextInterfaceArtifactPath(zone);
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
60
|
export function summarizeContextInterface(contextInterface) {
|
|
83
61
|
return {
|
|
84
62
|
inputZones: contextInterface.zones.filter((zone) => zone.role === "input"),
|
|
@@ -5,11 +5,11 @@ export declare function writeMethodPackageToDir(methodDir: string, method: Metho
|
|
|
5
5
|
}): void;
|
|
6
6
|
export declare function seedCompiledMethodPackage(options: {
|
|
7
7
|
compiledPath: string;
|
|
8
|
-
|
|
8
|
+
prepDataDir: string;
|
|
9
9
|
methodId: string;
|
|
10
10
|
}): void;
|
|
11
11
|
export declare function createLocalMethodPackageFromTemplate(options: {
|
|
12
|
-
|
|
12
|
+
prepDataDir: string;
|
|
13
13
|
baseMethodId: string;
|
|
14
14
|
methodId: string;
|
|
15
15
|
label: string;
|
|
@@ -17,14 +17,14 @@ export declare function createLocalMethodPackageFromTemplate(options: {
|
|
|
17
17
|
stagePolicyNotes: Record<string, string[]>;
|
|
18
18
|
}): string;
|
|
19
19
|
export declare function seedLocalMethodPackageFromBase(options: {
|
|
20
|
-
|
|
20
|
+
prepDataDir: string;
|
|
21
21
|
baseMethodId: string;
|
|
22
22
|
methodId: string;
|
|
23
23
|
label: string;
|
|
24
24
|
hint: string;
|
|
25
25
|
}): string;
|
|
26
26
|
export declare function createScratchLocalMethodPackage(options: {
|
|
27
|
-
|
|
27
|
+
prepDataDir: string;
|
|
28
28
|
methodId: string;
|
|
29
29
|
label: string;
|
|
30
30
|
hint: string;
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { existsSync, mkdirSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { dirname, join } from "node:path";
|
|
3
3
|
import { renderCompiledQuerySkill } from "../agents/lib/shells.js";
|
|
4
|
-
import { copyMethodPackageDirectory, isPortableMethodPackage, patchMethodPackageMetadata, resolveMethodPackageSourcePath, methodDefinitionPath, } from "./local-methods.js";
|
|
4
|
+
import { copyMethodPackageDirectory, isPortableMethodPackage, patchMethodPackageMetadata, resolveMethodPackageSourcePath, methodDefinitionPath, mergeStagePolicyNotesForStages, } from "./local-methods.js";
|
|
5
5
|
import { getCompiledMethod, } from "./method-definitions.js";
|
|
6
6
|
import { CONTEXT_INTERFACE_FILE, deriveMethodInputsFromContextInterface, summarizeContextInterface, writeContextInterface, writeContextInterfaceFile, } from "./context-interface.js";
|
|
7
7
|
import { methodPackagePathForCompiled } from "../compiler/compiled-paths.js";
|
|
8
|
-
import { mergeStagePolicyNotesForStages } from "./method-stage-policy.js";
|
|
9
|
-
function methodPackagePath(dirPath) {
|
|
10
|
-
return methodPackagePathForCompiled(dirPath);
|
|
11
|
-
}
|
|
12
8
|
function writeMethodStarterDocs(dirPath, docs, options) {
|
|
13
9
|
for (const doc of docs ?? []) {
|
|
14
10
|
const targetPath = join(dirPath, doc.relativePath);
|
|
@@ -200,7 +196,7 @@ function renderImproveSkill(method) {
|
|
|
200
196
|
`4. Keep purpose, inputs, \`method.json\`, \`${CONTEXT_INTERFACE_FILE}\`, and any changed stage docs aligned.`,
|
|
201
197
|
"",
|
|
202
198
|
"Guardrails:",
|
|
203
|
-
"- do not edit checks, test specs, or
|
|
199
|
+
"- do not edit checks, test specs, or source artifacts",
|
|
204
200
|
"- do not hardcode expected answers into Method docs",
|
|
205
201
|
"- keep this package standalone; do not rely on runtime inheritance",
|
|
206
202
|
"- keep the Method stack coherent: purpose, inputs, context interface, and stages should describe the same job",
|
|
@@ -259,7 +255,7 @@ function renderStageSkill(method, stage) {
|
|
|
259
255
|
].join("\n");
|
|
260
256
|
}
|
|
261
257
|
export function writeCompiledMethodPackage(compiledPath, method) {
|
|
262
|
-
writeMethodPackageToDir(
|
|
258
|
+
writeMethodPackageToDir(methodPackagePathForCompiled(compiledPath), method);
|
|
263
259
|
}
|
|
264
260
|
export function writeMethodPackageToDir(methodDir, method, options = {}) {
|
|
265
261
|
const overwrite = options.overwrite ?? true;
|
|
@@ -301,23 +297,24 @@ export function writeMethodPackageToDir(methodDir, method, options = {}) {
|
|
|
301
297
|
}
|
|
302
298
|
export function seedCompiledMethodPackage(options) {
|
|
303
299
|
const resolvedMethod = getCompiledMethod(options.methodId, {
|
|
304
|
-
|
|
300
|
+
prepDataDir: options.prepDataDir,
|
|
305
301
|
});
|
|
306
|
-
const sourceMethodPath = resolveMethodPackageSourcePath(options.
|
|
302
|
+
const sourceMethodPath = resolveMethodPackageSourcePath(options.prepDataDir, resolvedMethod.id);
|
|
307
303
|
if (sourceMethodPath && isPortableMethodPackage(sourceMethodPath)) {
|
|
308
304
|
// Portable seed packages can be copied directly because compile runs the
|
|
309
305
|
// local package folder without reading source-root Method packages.
|
|
310
|
-
copyMethodPackageDirectory(sourceMethodPath,
|
|
311
|
-
patchMethodPackageMetadata(
|
|
306
|
+
copyMethodPackageDirectory(sourceMethodPath, methodPackagePathForCompiled(options.compiledPath));
|
|
307
|
+
patchMethodPackageMetadata(methodPackagePathForCompiled(options.compiledPath), {
|
|
312
308
|
id: resolvedMethod.id,
|
|
313
309
|
inputs: resolvedMethod.inputs,
|
|
314
310
|
label: resolvedMethod.label,
|
|
315
311
|
hint: resolvedMethod.hint,
|
|
316
312
|
stagePolicyNotes: resolvedMethod.stagePolicyNotes,
|
|
317
313
|
});
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
314
|
+
// The portable-context README is always derived from the resolved Method;
|
|
315
|
+
// any hand-authored README belongs in the workspace draft at
|
|
316
|
+
// <workspace>/methods/<id>/, not in the compiled copy.
|
|
317
|
+
writeFileSync(join(methodPackagePathForCompiled(options.compiledPath), "README.md"), renderMethodReadme(resolvedMethod));
|
|
321
318
|
return;
|
|
322
319
|
}
|
|
323
320
|
// Legacy or partially-defined seed packages are resolved once and
|
|
@@ -326,14 +323,14 @@ export function seedCompiledMethodPackage(options) {
|
|
|
326
323
|
}
|
|
327
324
|
export function createLocalMethodPackageFromTemplate(options) {
|
|
328
325
|
const targetPath = seedLocalMethodPackageFromBase({
|
|
329
|
-
|
|
326
|
+
prepDataDir: options.prepDataDir,
|
|
330
327
|
baseMethodId: options.baseMethodId,
|
|
331
328
|
methodId: options.methodId,
|
|
332
329
|
label: options.label,
|
|
333
330
|
hint: options.hint,
|
|
334
331
|
});
|
|
335
332
|
const baseMethod = getCompiledMethod(options.baseMethodId, {
|
|
336
|
-
|
|
333
|
+
prepDataDir: options.prepDataDir,
|
|
337
334
|
});
|
|
338
335
|
const stagePolicyNotes = mergeStagePolicyNotesForStages(baseMethod.stages, baseMethod.stagePolicyNotes, options.stagePolicyNotes);
|
|
339
336
|
patchMethodPackageMetadata(targetPath, {
|
|
@@ -358,10 +355,10 @@ export function createLocalMethodPackageFromTemplate(options) {
|
|
|
358
355
|
}
|
|
359
356
|
export function seedLocalMethodPackageFromBase(options) {
|
|
360
357
|
const baseMethod = getCompiledMethod(options.baseMethodId, {
|
|
361
|
-
|
|
358
|
+
prepDataDir: options.prepDataDir,
|
|
362
359
|
});
|
|
363
|
-
const sourceMethodPath = resolveMethodPackageSourcePath(options.
|
|
364
|
-
const targetPath = methodDefinitionPath(options.
|
|
360
|
+
const sourceMethodPath = resolveMethodPackageSourcePath(options.prepDataDir, options.baseMethodId);
|
|
361
|
+
const targetPath = methodDefinitionPath(options.prepDataDir, options.methodId);
|
|
365
362
|
if (sourceMethodPath && isPortableMethodPackage(sourceMethodPath)) {
|
|
366
363
|
// Copy directly when the base package is already portable and standalone.
|
|
367
364
|
copyMethodPackageDirectory(sourceMethodPath, targetPath);
|
|
@@ -403,7 +400,7 @@ export function seedLocalMethodPackageFromBase(options) {
|
|
|
403
400
|
return targetPath;
|
|
404
401
|
}
|
|
405
402
|
export function createScratchLocalMethodPackage(options) {
|
|
406
|
-
const targetPath = methodDefinitionPath(options.
|
|
403
|
+
const targetPath = methodDefinitionPath(options.prepDataDir, options.methodId);
|
|
407
404
|
const method = {
|
|
408
405
|
id: options.methodId,
|
|
409
406
|
compilerApi: {
|
|
@@ -416,9 +413,9 @@ export function createScratchLocalMethodPackage(options) {
|
|
|
416
413
|
},
|
|
417
414
|
inputs: [
|
|
418
415
|
{
|
|
419
|
-
id: "
|
|
420
|
-
label: "
|
|
421
|
-
description: "Source
|
|
416
|
+
id: "source",
|
|
417
|
+
label: "Source",
|
|
418
|
+
description: "Source references assigned to each stage by Interf runtime.",
|
|
422
419
|
required: true,
|
|
423
420
|
},
|
|
424
421
|
],
|
|
@@ -432,15 +429,6 @@ export function createScratchLocalMethodPackage(options) {
|
|
|
432
429
|
target_type: "compiled",
|
|
433
430
|
label: `${options.label} Method schema`,
|
|
434
431
|
zones: [
|
|
435
|
-
{
|
|
436
|
-
id: "raw",
|
|
437
|
-
role: "input",
|
|
438
|
-
path: "raw",
|
|
439
|
-
kind: "directory",
|
|
440
|
-
required: true,
|
|
441
|
-
owned_by: [],
|
|
442
|
-
description: "Source-folder raw snapshot copied into the Preparation for direct evidence and verification.",
|
|
443
|
-
},
|
|
444
432
|
{
|
|
445
433
|
id: "draft-context",
|
|
446
434
|
role: "output",
|
|
@@ -468,7 +456,7 @@ export function createScratchLocalMethodPackage(options) {
|
|
|
468
456
|
description: "Neutral placeholder stage for Method authoring. Replace this stage with the topology this agent work needs.",
|
|
469
457
|
contractType: "method-draft-stage",
|
|
470
458
|
skillDir: "prepare",
|
|
471
|
-
reads: ["
|
|
459
|
+
reads: ["runtime"],
|
|
472
460
|
writes: ["draft-context"],
|
|
473
461
|
acceptance: {
|
|
474
462
|
stage_truthy: ["finished_at"],
|
|
@@ -32,20 +32,24 @@ export interface LocalMethodDefinition {
|
|
|
32
32
|
methodPath: string;
|
|
33
33
|
methodSchemaPath: string;
|
|
34
34
|
}
|
|
35
|
-
export declare function
|
|
35
|
+
export declare function mergeStagePolicyNotesForStages(stages: readonly {
|
|
36
|
+
id: string;
|
|
37
|
+
}[], baseNotes: unknown, overrideNotes: Record<string, string[]> | undefined): Record<string, string[]> | undefined;
|
|
38
|
+
export declare function builtinMethodPackagePath(methodId: string): string;
|
|
39
|
+
export declare function methodDefinitionPath(prepDataDir: string, id: string): string;
|
|
36
40
|
export declare function loadMethodDefinitionFromDir(dirPath: string): LocalMethodDefinition | null;
|
|
37
|
-
export declare function listLocalMethodDefinitions(
|
|
38
|
-
export declare function loadLocalMethodDefinition(
|
|
39
|
-
export declare function resolveMethodPackageSourcePath(
|
|
41
|
+
export declare function listLocalMethodDefinitions(prepDataDir: string): LocalMethodDefinition[];
|
|
42
|
+
export declare function loadLocalMethodDefinition(prepDataDir: string, id: string): LocalMethodDefinition | null;
|
|
43
|
+
export declare function resolveMethodPackageSourcePath(prepDataDir: string, methodId: string): string | null;
|
|
40
44
|
export declare function seedLocalDefaultMethod(options: {
|
|
41
|
-
|
|
45
|
+
prepDataDir: string;
|
|
42
46
|
}): {
|
|
43
47
|
methodId: string;
|
|
44
48
|
targetPath: string;
|
|
45
49
|
alreadyExisted: boolean;
|
|
46
50
|
};
|
|
47
51
|
export declare function isMethodId(value: string): boolean;
|
|
48
|
-
export declare function patchMethodPackageMetadata(dirPath: string, options
|
|
52
|
+
export declare function patchMethodPackageMetadata(dirPath: string, options: {
|
|
49
53
|
id?: string;
|
|
50
54
|
inputs?: MethodInputSpec[];
|
|
51
55
|
label?: string;
|