mthds 0.9.0 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/README.md +43 -21
  2. package/dist/agent/binaries.js +2 -2
  3. package/dist/agent/commands/api-commands.d.ts +8 -0
  4. package/dist/agent/commands/api-commands.js +310 -93
  5. package/dist/agent/commands/api-commands.js.map +1 -1
  6. package/dist/agent/commands/codex-hook.d.ts +20 -0
  7. package/dist/agent/commands/codex-hook.js +25 -9
  8. package/dist/agent/commands/codex-hook.js.map +1 -1
  9. package/dist/agent/commands/config.js +2 -2
  10. package/dist/agent/commands/config.js.map +1 -1
  11. package/dist/agent/output.d.ts +4 -0
  12. package/dist/agent/output.js +7 -0
  13. package/dist/agent/output.js.map +1 -1
  14. package/dist/agent/plugin-version.d.ts +1 -1
  15. package/dist/agent/plugin-version.js +1 -1
  16. package/dist/agent-cli.js +5 -5
  17. package/dist/agent-cli.js.map +1 -1
  18. package/dist/cli/commands/config.js +2 -2
  19. package/dist/cli/commands/config.js.map +1 -1
  20. package/dist/cli/commands/install.js +29 -37
  21. package/dist/cli/commands/install.js.map +1 -1
  22. package/dist/cli/commands/run.js +82 -69
  23. package/dist/cli/commands/run.js.map +1 -1
  24. package/dist/cli/commands/setup.js +22 -23
  25. package/dist/cli/commands/setup.js.map +1 -1
  26. package/dist/cli/commands/utils.d.ts +9 -1
  27. package/dist/cli/commands/utils.js +9 -0
  28. package/dist/cli/commands/utils.js.map +1 -1
  29. package/dist/cli/commands/validate.js +29 -13
  30. package/dist/cli/commands/validate.js.map +1 -1
  31. package/dist/cli.js +2 -2
  32. package/dist/cli.js.map +1 -1
  33. package/dist/config/config.d.ts +14 -1
  34. package/dist/config/config.js +31 -6
  35. package/dist/config/config.js.map +1 -1
  36. package/dist/index.d.ts +27 -1
  37. package/dist/index.js +22 -1
  38. package/dist/index.js.map +1 -1
  39. package/dist/protocol/concept.d.ts +14 -0
  40. package/dist/protocol/concept.js +10 -0
  41. package/dist/protocol/concept.js.map +1 -0
  42. package/dist/protocol/exceptions.d.ts +10 -0
  43. package/dist/protocol/exceptions.js +12 -0
  44. package/dist/protocol/exceptions.js.map +1 -0
  45. package/dist/protocol/models.d.ts +150 -0
  46. package/dist/protocol/models.js +24 -0
  47. package/dist/protocol/models.js.map +1 -0
  48. package/dist/protocol/options.d.ts +60 -0
  49. package/dist/protocol/options.js +11 -0
  50. package/dist/protocol/options.js.map +1 -0
  51. package/dist/protocol/pipe_output.d.ts +11 -0
  52. package/dist/protocol/pipe_output.js +7 -0
  53. package/dist/protocol/pipe_output.js.map +1 -0
  54. package/dist/protocol/pipeline_inputs.d.ts +8 -0
  55. package/dist/protocol/pipeline_inputs.js +7 -0
  56. package/dist/protocol/pipeline_inputs.js.map +1 -0
  57. package/dist/protocol/protocol.d.ts +55 -0
  58. package/dist/{client → protocol}/protocol.js.map +1 -1
  59. package/dist/protocol/stuff.d.ts +16 -0
  60. package/dist/protocol/stuff.js +8 -0
  61. package/dist/{client/models → protocol}/stuff.js.map +1 -1
  62. package/dist/protocol/working_memory.d.ts +10 -0
  63. package/dist/protocol/working_memory.js +7 -0
  64. package/dist/protocol/working_memory.js.map +1 -0
  65. package/dist/runners/api/client.d.ts +181 -0
  66. package/dist/runners/api/client.js +679 -0
  67. package/dist/runners/api/client.js.map +1 -0
  68. package/dist/runners/api/exceptions.d.ts +121 -0
  69. package/dist/runners/api/exceptions.js +156 -0
  70. package/dist/runners/api/exceptions.js.map +1 -0
  71. package/dist/runners/api/models.d.ts +131 -0
  72. package/dist/runners/api/models.js +13 -0
  73. package/dist/runners/api/models.js.map +1 -0
  74. package/dist/runners/api/runs.d.ts +130 -0
  75. package/dist/runners/api/runs.js +93 -0
  76. package/dist/runners/api/runs.js.map +1 -0
  77. package/dist/runners/base-runner.d.ts +27 -0
  78. package/dist/runners/base-runner.js +25 -0
  79. package/dist/runners/base-runner.js.map +1 -0
  80. package/dist/runners/pipelex/runner.d.ts +38 -0
  81. package/dist/runners/{pipelex-runner.js → pipelex/runner.js} +171 -83
  82. package/dist/runners/pipelex/runner.js.map +1 -0
  83. package/dist/runners/registry.js +10 -4
  84. package/dist/runners/registry.js.map +1 -1
  85. package/dist/runners/types.d.ts +13 -71
  86. package/dist/runners/types.js.map +1 -1
  87. package/package.json +6 -3
  88. package/dist/agent/commands/validate.d.ts +0 -18
  89. package/dist/agent/commands/validate.js +0 -126
  90. package/dist/agent/commands/validate.js.map +0 -1
  91. package/dist/client/client.d.ts +0 -15
  92. package/dist/client/client.js +0 -127
  93. package/dist/client/client.js.map +0 -1
  94. package/dist/client/exceptions.d.ts +0 -46
  95. package/dist/client/exceptions.js +0 -61
  96. package/dist/client/exceptions.js.map +0 -1
  97. package/dist/client/index.d.ts +0 -5
  98. package/dist/client/index.js +0 -3
  99. package/dist/client/index.js.map +0 -1
  100. package/dist/client/models/index.d.ts +0 -4
  101. package/dist/client/models/index.js +0 -2
  102. package/dist/client/models/index.js.map +0 -1
  103. package/dist/client/models/pipe_output.d.ts +0 -2
  104. package/dist/client/models/pipe_output.js +0 -2
  105. package/dist/client/models/pipe_output.js.map +0 -1
  106. package/dist/client/models/pipeline_inputs.d.ts +0 -3
  107. package/dist/client/models/pipeline_inputs.js +0 -2
  108. package/dist/client/models/pipeline_inputs.js.map +0 -1
  109. package/dist/client/models/stuff.d.ts +0 -1
  110. package/dist/client/models/stuff.js +0 -2
  111. package/dist/client/models/working_memory.d.ts +0 -1
  112. package/dist/client/models/working_memory.js +0 -2
  113. package/dist/client/models/working_memory.js.map +0 -1
  114. package/dist/client/pipeline.d.ts +0 -36
  115. package/dist/client/pipeline.js +0 -2
  116. package/dist/client/pipeline.js.map +0 -1
  117. package/dist/client/protocol.d.ts +0 -5
  118. package/dist/runners/api-runner.d.ts +0 -24
  119. package/dist/runners/api-runner.js +0 -91
  120. package/dist/runners/api-runner.js.map +0 -1
  121. package/dist/runners/pipelex-runner.d.ts +0 -30
  122. package/dist/runners/pipelex-runner.js.map +0 -1
  123. /package/dist/{client → protocol}/protocol.js +0 -0
@@ -0,0 +1,93 @@
1
+ import { RunFailedError, RunTimeoutError } from "./exceptions.js";
2
+ const TERMINAL_RUN_STATUSES = new Set([
3
+ "COMPLETED",
4
+ "FAILED",
5
+ "CANCELLED",
6
+ "TERMINATED",
7
+ "TIMED_OUT",
8
+ ]);
9
+ /** A terminal status means the run is done and will not transition again. */
10
+ export function isTerminalRunStatus(status) {
11
+ return TERMINAL_RUN_STATUSES.has(status);
12
+ }
13
+ /** Only `COMPLETED` has a result; every other terminal status is a failure. */
14
+ export function isSuccessRunStatus(status) {
15
+ return status === "COMPLETED";
16
+ }
17
+ // ── Poll loop ───────────────────────────────────────────────────────
18
+ export const DEFAULT_POLL_INTERVAL_MS = 2_000;
19
+ export const DEFAULT_WAIT_TIMEOUT_MS = 1_200_000; // 20 min — matches the runner's blocking execute ceiling.
20
+ /**
21
+ * Poll a single-shot result lookup (`fetchOnce`) until the run reaches a
22
+ * terminal state. Returns the artifacts on `COMPLETED`, throws `RunFailedError`
23
+ * on any other terminal status, and throws `RunTimeoutError` if `timeoutMs`
24
+ * elapses first (the run keeps executing server-side — re-poll by id later).
25
+ *
26
+ * The single owner of the wait/poll/Retry-After/abort logic. Both
27
+ * `MthdsApiClient.waitForResult` and `BaseRunner.waitForResult` delegate here,
28
+ * so the behavior can never drift between the wire client and the runner layer.
29
+ */
30
+ export async function pollUntilResult(fetchOnce, runId, options = {}) {
31
+ const intervalMs = options.intervalMs ?? DEFAULT_POLL_INTERVAL_MS;
32
+ const timeoutMs = options.timeoutMs ?? DEFAULT_WAIT_TIMEOUT_MS;
33
+ const startedAt = Date.now();
34
+ let attempt = 0;
35
+ for (;;) {
36
+ throwIfAborted(options.signal);
37
+ // Enforce the deadline BEFORE each lookup, so a poll is never issued past the
38
+ // timeout (the previous wait is clamped to the deadline, so the next loop
39
+ // would otherwise fire one extra fetch right at it).
40
+ const elapsedMs = Date.now() - startedAt;
41
+ if (elapsedMs >= timeoutMs) {
42
+ throw new RunTimeoutError(`Run ${runId} did not reach a terminal state within ${timeoutMs}ms.`, runId, timeoutMs);
43
+ }
44
+ const state = await fetchOnce(runId, { signal: options.signal });
45
+ if (state.state === "completed") {
46
+ return state.result;
47
+ }
48
+ if (state.state === "failed") {
49
+ throw new RunFailedError(state.message, runId, state.status);
50
+ }
51
+ attempt += 1;
52
+ options.onPoll?.({ attempt, elapsedMs });
53
+ const retryMs = state.retry_after_seconds != null ? state.retry_after_seconds * 1000 : 0;
54
+ const waitMs = Math.min(Math.max(intervalMs, retryMs), timeoutMs - elapsedMs);
55
+ await sleep(waitMs, options.signal);
56
+ }
57
+ }
58
+ function throwIfAborted(signal) {
59
+ if (signal?.aborted)
60
+ throw abortError(signal);
61
+ }
62
+ function abortError(signal) {
63
+ const reason = signal?.reason;
64
+ if (reason instanceof Error)
65
+ return reason;
66
+ return new DOMException("The run poll was aborted.", "AbortError");
67
+ }
68
+ /** Sleep that resolves after `ms`, or rejects immediately if `signal` aborts. */
69
+ function sleep(ms, signal) {
70
+ if (ms <= 0) {
71
+ throwIfAborted(signal);
72
+ return Promise.resolve();
73
+ }
74
+ return new Promise((resolve, reject) => {
75
+ const onAbort = () => {
76
+ clearTimeout(timer);
77
+ reject(abortError(signal));
78
+ };
79
+ const timer = setTimeout(() => {
80
+ signal?.removeEventListener("abort", onAbort);
81
+ resolve();
82
+ }, ms);
83
+ if (signal) {
84
+ if (signal.aborted) {
85
+ clearTimeout(timer);
86
+ reject(abortError(signal));
87
+ return;
88
+ }
89
+ signal.addEventListener("abort", onAbort, { once: true });
90
+ }
91
+ });
92
+ }
93
+ //# sourceMappingURL=runs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runs.js","sourceRoot":"","sources":["../../../src/runners/api/runs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAwClE,MAAM,qBAAqB,GAA2B,IAAI,GAAG,CAAY;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AAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC3C,MAAM,OAAO,GAAG,GAAS,EAAE;YACzB,YAAY,CAAC,KAAK,CAAC,CAAC;YACpB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7B,CAAC,CAAC;QACF,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE;YAC5B,MAAM,EAAE,mBAAmB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;YAC9C,OAAO,EAAE,CAAC;QACZ,CAAC,EAAE,EAAE,CAAC,CAAC;QACP,IAAI,MAAM,EAAE,CAAC;YACX,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,YAAY,CAAC,KAAK,CAAC,CAAC;gBACpB,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC,CAAC;gBAC3B,OAAO;YACT,CAAC;YACD,MAAM,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC5D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { type RunResults, type RunResultState, type WaitForResultOptions } from "./api/runs.js";
2
+ import type { StartOptions } from "../protocol/options.js";
3
+ import type { RunResultStart } from "../protocol/models.js";
4
+ /**
5
+ * Shared base for every runner. Provides the two run-lifecycle COMPOSITES —
6
+ * `waitForResult` (poll an existing run to completion) and
7
+ * `startAndWaitForResult` (start a run, then wait for its result) — implemented
8
+ * once over the abstract primitives `start` / `getRunResult`. Concrete runners
9
+ * implement the primitives; a runtime with a faster blocking path (a bare
10
+ * runner, the local pipelex CLI) overrides `startAndWaitForResult`.
11
+ *
12
+ * The composites are deliberately NOT part of the `Runner` contract's "must
13
+ * implement" surface — every runner gets them for free here, so they can never
14
+ * drift between runtimes.
15
+ */
16
+ export declare abstract class BaseRunner {
17
+ /** Start a run and return its 202 ack immediately (no waiting; no output yet). The returned `pipeline_run_id` is authoritative. */
18
+ abstract start(options: StartOptions): Promise<RunResultStart>;
19
+ /** Single-shot result lookup: running (202) / completed (200) / failed (409). */
20
+ abstract getRunResult(runId: string, options?: {
21
+ signal?: AbortSignal;
22
+ }): Promise<RunResultState>;
23
+ /** Poll an already-started run (by id) until it reaches a terminal state. */
24
+ waitForResult(runId: string, options?: WaitForResultOptions): Promise<RunResults>;
25
+ /** Start a run, then wait for its result — the one-call convenience. */
26
+ startAndWaitForResult(options: StartOptions, pollOptions?: WaitForResultOptions): Promise<RunResults>;
27
+ }
@@ -0,0 +1,25 @@
1
+ import { pollUntilResult, } from "./api/runs.js";
2
+ /**
3
+ * Shared base for every runner. Provides the two run-lifecycle COMPOSITES —
4
+ * `waitForResult` (poll an existing run to completion) and
5
+ * `startAndWaitForResult` (start a run, then wait for its result) — implemented
6
+ * once over the abstract primitives `start` / `getRunResult`. Concrete runners
7
+ * implement the primitives; a runtime with a faster blocking path (a bare
8
+ * runner, the local pipelex CLI) overrides `startAndWaitForResult`.
9
+ *
10
+ * The composites are deliberately NOT part of the `Runner` contract's "must
11
+ * implement" surface — every runner gets them for free here, so they can never
12
+ * drift between runtimes.
13
+ */
14
+ export class BaseRunner {
15
+ /** Poll an already-started run (by id) until it reaches a terminal state. */
16
+ async waitForResult(runId, options) {
17
+ return pollUntilResult((id, opts) => this.getRunResult(id, opts), runId, options);
18
+ }
19
+ /** Start a run, then wait for its result — the one-call convenience. */
20
+ async startAndWaitForResult(options, pollOptions) {
21
+ const ack = await this.start(options);
22
+ return this.waitForResult(ack.pipeline_run_id, pollOptions);
23
+ }
24
+ }
25
+ //# sourceMappingURL=base-runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base-runner.js","sourceRoot":"","sources":["../../src/runners/base-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,GAIhB,MAAM,eAAe,CAAC;AAIvB;;;;;;;;;;;GAWG;AACH,MAAM,OAAgB,UAAU;IAU9B,6EAA6E;IAC7E,KAAK,CAAC,aAAa,CACjB,KAAa,EACb,OAA8B;QAE9B,OAAO,eAAe,CAAC,CAAC,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IACpF,CAAC;IAED,wEAAwE;IACxE,KAAK,CAAC,qBAAqB,CACzB,OAAqB,EACrB,WAAkC;QAElC,MAAM,GAAG,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;QACtC,OAAO,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAC9D,CAAC;CACF"}
@@ -0,0 +1,38 @@
1
+ import type { Runner, RunnerType, BuildInputsRequest, BuildOutputRequest, BuildRunnerRequest, BuildRunnerResponse, ConceptRequest, ConceptResponse, PipeSpecRequest, PipeSpecResponse, CheckModelRequest, CheckModelResponse } from "../types.js";
2
+ import type { RunOptions, StartOptions } from "../../protocol/options.js";
3
+ import type { ModelCategory, ModelDeck, ValidationResult, VersionInfo } from "../../protocol/models.js";
4
+ import type { DictRunResultExecute } from "../api/models.js";
5
+ import type { RunRead, RunResults, RunResultState, WaitForResultOptions } from "../api/runs.js";
6
+ import { BaseRunner } from "../base-runner.js";
7
+ export declare class PipelexRunner extends BaseRunner implements Runner {
8
+ readonly type: RunnerType;
9
+ private readonly libraryDirs;
10
+ constructor(libraryDirs?: string[]);
11
+ private libraryArgs;
12
+ private exec;
13
+ /**
14
+ * Run pipelex with stdout and stderr inherited (streamed to the terminal).
15
+ * Use this for long-running or interactive commands.
16
+ */
17
+ private execStreaming;
18
+ buildPassthrough(subcommand: string, rawArgs: string[]): Promise<void>;
19
+ runPassthrough(rawArgs: string[]): Promise<void>;
20
+ validatePassthrough(rawArgs: string[]): Promise<void>;
21
+ health(): Promise<Record<string, unknown>>;
22
+ version(): Promise<VersionInfo>;
23
+ buildInputs(request: BuildInputsRequest): Promise<unknown>;
24
+ buildOutput(request: BuildOutputRequest): Promise<unknown>;
25
+ buildRunner(request: BuildRunnerRequest): Promise<BuildRunnerResponse>;
26
+ concept(request: ConceptRequest): Promise<ConceptResponse>;
27
+ pipeSpec(request: PipeSpecRequest): Promise<PipeSpecResponse>;
28
+ checkModel(request: CheckModelRequest): Promise<CheckModelResponse>;
29
+ models(category?: ModelCategory): Promise<ModelDeck>;
30
+ execute(options: RunOptions): Promise<DictRunResultExecute>;
31
+ validate(mthdsContents: string[], allowSignatures?: boolean): Promise<ValidationResult>;
32
+ startAndWaitForResult(options: StartOptions, _pollOptions?: WaitForResultOptions): Promise<RunResults>;
33
+ start(_options: StartOptions): Promise<never>;
34
+ getRunStatus(_runId: string): Promise<RunRead>;
35
+ getRunResult(_runId: string, _options?: {
36
+ signal?: AbortSignal;
37
+ }): Promise<RunResultState>;
38
+ }
@@ -3,7 +3,10 @@ import { promisify } from "node:util";
3
3
  import { existsSync, writeFileSync, readFileSync, mkdtempSync, rmSync, } from "node:fs";
4
4
  import { join } from "node:path";
5
5
  import { tmpdir } from "node:os";
6
- import { Runners } from "./types.js";
6
+ import { Runners } from "../types.js";
7
+ import { MTHDS_PROTOCOL_VERSION } from "../../protocol/models.js";
8
+ import { conceptRef } from "../../protocol/concept.js";
9
+ import { BaseRunner } from "../base-runner.js";
7
10
  const execFileAsync = promisify(execFile);
8
11
  function makeTmpDir() {
9
12
  return mkdtempSync(join(tmpdir(), "mthds-"));
@@ -31,10 +34,11 @@ function writeMthdsContents(tmp, contents) {
31
34
  }
32
35
  return bundlePath;
33
36
  }
34
- export class PipelexRunner {
37
+ export class PipelexRunner extends BaseRunner {
35
38
  type = Runners.PIPELEX;
36
39
  libraryDirs;
37
40
  constructor(libraryDirs) {
41
+ super();
38
42
  this.libraryDirs = libraryDirs ?? [];
39
43
  }
40
44
  libraryArgs() {
@@ -88,10 +92,17 @@ export class PipelexRunner {
88
92
  }
89
93
  async version() {
90
94
  const { stdout } = await this.exec(["--version"]);
91
- return { pipelex: stdout.trim() };
95
+ const pipelexVersion = stdout.trim();
96
+ return {
97
+ protocol_version: MTHDS_PROTOCOL_VERSION,
98
+ runner_version: pipelexVersion,
99
+ // Implementation identity rides the protocol's extension-open VersionInfo.
100
+ implementation: "pipelex",
101
+ implementation_version: pipelexVersion,
102
+ runtime_version: pipelexVersion,
103
+ };
92
104
  }
93
105
  // ── Build ───────────────────────────────────────────────────────
94
- // buildInputs and buildOutput have no CLI equivalent.
95
106
  // pipelex-agent inputs bundle <bundle.mthds> --pipe <pipe_code>
96
107
  async buildInputs(request) {
97
108
  const tmp = makeTmpDir();
@@ -210,11 +221,13 @@ export class PipelexRunner {
210
221
  };
211
222
  }
212
223
  // pipelex-agent check-model <reference> --type <type> --format json
213
- // The local runner always forces --format json: pipelex-agent's markdown output is plain
214
- // text (via print()), which can't satisfy the CheckModelResponse contract. The request's
215
- // `format` field is intentionally ignored here.
216
- // pipelex-agent declares --type as a required typer option (no default), so we guard
217
- // here for SDK consumers that bypass the agent CLI's parser.
224
+ // check-model is a LOCAL CLI capability of this runner only the MTHDS API
225
+ // has no check-model route, so this method is NOT on the shared `Runner`
226
+ // interface. The local runner always forces --format json: pipelex-agent's
227
+ // markdown output is plain text (via print()), which can't satisfy the
228
+ // CheckModelResponse contract. The request's `format` field is intentionally
229
+ // ignored here. pipelex-agent declares --type as a required typer option (no
230
+ // default), so we guard here for SDK consumers that bypass the agent CLI's parser.
218
231
  async checkModel(request) {
219
232
  if (!request.type) {
220
233
  throw new Error("checkModel requires `type` (one of: llm, extract, img_gen, search)");
@@ -225,58 +238,87 @@ export class PipelexRunner {
225
238
  });
226
239
  return JSON.parse(stdout);
227
240
  }
228
- // pipelex-agent models [--type <type>...] --format json
229
- async models(request) {
241
+ // pipelex-agent models [--type <type>] --format json
242
+ async models(category) {
230
243
  const args = ["models"];
231
- if (request?.type) {
232
- for (const t of request.type) {
233
- args.push("--type", t);
234
- }
244
+ if (category) {
245
+ args.push("--type", category);
235
246
  }
236
247
  args.push("--format", "json");
237
248
  const { stdout } = await execFileAsync("pipelex-agent", args, {
238
249
  encoding: "utf-8",
239
250
  });
240
- return JSON.parse(stdout);
251
+ return toModelDeck(JSON.parse(stdout));
241
252
  }
242
- // ── Pipeline execution ──────────────────────────────────────────
253
+ // ── Method execution ────────────────────────────────────────────
243
254
  // pipelex run <target> [--pipe code] [--inputs file] [--output-dir dir]
244
- async execute(request) {
255
+ // Local, blocking, in-process — there is no durable run to poll by id, so
256
+ // `execute` / `startAndWaitForResult` run through here and the async
257
+ // primitives (start / getRunStatus / getRunResult / waitForResult) are
258
+ // unsupported.
259
+ async execute(options) {
245
260
  const tmp = makeTmpDir();
246
261
  try {
262
+ // The pipelex CLI dispatches through `run bundle <path>` / `run pipe <code>`.
247
263
  const args = ["run"];
248
- if (request.mthds_contents?.length) {
249
- const bundlePath = writeMthdsContents(tmp, request.mthds_contents);
250
- args.push(bundlePath);
264
+ if (options.mthds_contents?.length) {
265
+ const bundlePath = writeMthdsContents(tmp, options.mthds_contents);
266
+ args.push("bundle", bundlePath);
251
267
  args.push("-L", tmp);
252
- if (request.pipe_code) {
253
- args.push("--pipe", request.pipe_code);
268
+ if (options.pipe_code) {
269
+ args.push("--pipe", options.pipe_code);
254
270
  }
255
271
  }
256
- else if (request.pipe_code) {
257
- args.push(request.pipe_code);
272
+ else if (options.pipe_code) {
273
+ args.push("pipe", options.pipe_code);
258
274
  }
259
- if (request.inputs) {
275
+ if (options.inputs) {
260
276
  const inputsPath = join(tmp, "inputs.json");
261
- writeFileSync(inputsPath, JSON.stringify(request.inputs), "utf-8");
277
+ writeFileSync(inputsPath, JSON.stringify(options.inputs), "utf-8");
262
278
  args.push("--inputs", inputsPath);
263
279
  }
264
- args.push("--output-dir", tmp);
265
- await this.execStreaming(args);
280
+ // Pin the working-memory artifact to a known path; other outputs go to
281
+ // an incremental directory under --output-dir which we don't need.
266
282
  const wmPath = join(tmp, "working_memory.json");
283
+ args.push("--working-memory-path", wmPath);
284
+ args.push("--output-dir", join(tmp, "results"));
285
+ args.push("--no-pretty-print");
286
+ await this.execStreaming(args);
267
287
  const raw = existsSync(wmPath)
268
288
  ? JSON.parse(readFileSync(wmPath, "utf-8"))
269
289
  : {};
270
- // The CLI output is working memory JSON. Wrap it in PipelineResponse shape.
290
+ // The CLI writes the runtime's FULL working memory
291
+ // (`{root: {name: {stuff_code, stuff_name, concept: {...}, content}}, aliases}`).
292
+ // Reduce each stuff to the SDK wire shape `{concept: <ref string>, content}` —
293
+ // the same reduction the API runner performs server-side. The runtime-internal
294
+ // id keeps its `pipeline_run_id` name (D1: internals are out of the rename scope).
295
+ const rawRoot = (raw["root"] ?? {});
296
+ const aliases = (raw["aliases"] ?? {});
297
+ const reducedRoot = {};
298
+ for (const [stuffName, stuff] of Object.entries(rawRoot)) {
299
+ const conceptRaw = stuff["concept"];
300
+ let conceptRefStr;
301
+ if (conceptRaw && typeof conceptRaw === "object") {
302
+ const conceptObj = conceptRaw;
303
+ const code = typeof conceptObj["code"] === "string" ? conceptObj["code"] : "";
304
+ const domainCode = typeof conceptObj["domain_code"] === "string" ? conceptObj["domain_code"] : "";
305
+ // A missing domain_code falls back to the bare code (no leading dot).
306
+ conceptRefStr = domainCode ? conceptRef({ domain_code: domainCode, code }) : code;
307
+ }
308
+ else {
309
+ conceptRefStr = String(conceptRaw ?? "");
310
+ }
311
+ reducedRoot[stuffName] = { concept: conceptRefStr, content: stuff["content"] };
312
+ }
313
+ // `main_stuff_name` is a pipelex extension field riding the protocol's
314
+ // extension-open response — not a protocol field.
271
315
  return {
272
- pipeline_run_id: raw["pipeline_run_id"] ?? "local",
273
- created_at: new Date().toISOString(),
274
- pipeline_state: "COMPLETED",
275
- finished_at: new Date().toISOString(),
276
- pipe_output: raw["pipe_output"]
277
- ? raw["pipe_output"]
278
- : null,
279
- main_stuff_name: raw["main_stuff_name"] ?? null,
316
+ pipeline_run_id: "",
317
+ pipe_output: {
318
+ working_memory: { root: reducedRoot, aliases },
319
+ pipeline_run_id: "",
320
+ },
321
+ main_stuff_name: aliases["main_stuff"] ?? "main_stuff",
280
322
  };
281
323
  }
282
324
  finally {
@@ -284,61 +326,107 @@ export class PipelexRunner {
284
326
  }
285
327
  }
286
328
  // ── Validation ──────────────────────────────────────────────────
287
- // pipelex validate method <github-url-or-local-path>
288
- async validate(request) {
289
- const url = request.method_url;
290
- if (!url) {
291
- return {
292
- mthds_contents: request.mthds_contents ?? [],
293
- pipelex_bundle_blueprint: { domain: "local" },
294
- success: false,
295
- message: "method_url is required for pipelex validation",
296
- };
297
- }
329
+ // pipelex validate bundle <bundle.mthds> [--allow-signatures]
330
+ async validate(mthdsContents, allowSignatures = false) {
331
+ const tmp = makeTmpDir();
298
332
  try {
299
- const args = ["validate", "method", url];
300
- if (request.pipe_code) {
301
- args.push("--pipe", request.pipe_code);
333
+ const bundlePath = writeMthdsContents(tmp, mthdsContents);
334
+ const args = ["validate", "bundle", bundlePath, "-L", tmp];
335
+ if (allowSignatures) {
336
+ args.push("--allow-signatures");
302
337
  }
303
- await this.execStreaming(args);
304
- return {
305
- mthds_contents: request.mthds_contents ?? [],
306
- pipelex_bundle_blueprint: { domain: "local" },
307
- success: true,
308
- message: "Method validated via local CLI",
309
- };
338
+ try {
339
+ await this.exec(args);
340
+ }
341
+ catch (err) {
342
+ const execError = err;
343
+ const detail = execError.stderr?.trim() || execError.stdout?.trim() || execError.message;
344
+ throw new Error(`Bundle validation failed:\n${detail}`);
345
+ }
346
+ // The local CLI raises on an invalid bundle (caught above), so reaching
347
+ // here means the verdict is valid. It emits human-readable output, not the
348
+ // structural artifacts — return the minimal valid arm (the `is_valid: true`
349
+ // discriminant), not the full report. (Per the protocol contract, a CLI
350
+ // runner may raise instead of materializing the invalid arm.)
351
+ return { is_valid: true };
310
352
  }
311
- catch (err) {
312
- const message = err instanceof Error ? err.message : "Validation failed";
313
- return {
314
- mthds_contents: request.mthds_contents ?? [],
315
- pipelex_bundle_blueprint: { domain: "local" },
316
- success: false,
317
- message,
318
- };
353
+ finally {
354
+ rmSync(tmp, { recursive: true, force: true });
319
355
  }
320
356
  }
321
- // ── RunnerProtocol implementation ─────────────────────────────────
322
- async executePipeline(options) {
323
- const request = {
357
+ // ── Run lifecycle ──────────────────────────────────────────────────
358
+ // The local pipelex CLI runs methods in-process; there is no durable run
359
+ // to poll by id, so the async primitives belong to the hosted API (use
360
+ // --runner api). `startAndWaitForResult` is supported — it runs the CLI
361
+ // blocking and returns the result directly.
362
+ async startAndWaitForResult(options, _pollOptions) {
363
+ const response = await this.execute({
324
364
  mthds_contents: options.mthds_contents ?? undefined,
325
365
  pipe_code: options.pipe_code ?? undefined,
326
- inputs: options.inputs
327
- ? Object.fromEntries(Object.entries(options.inputs).map(([k, v]) => [k, v]))
328
- : undefined,
329
- };
330
- const response = await this.execute(request);
366
+ inputs: options.inputs ?? undefined,
367
+ output_name: options.output_name ?? undefined,
368
+ output_multiplicity: options.output_multiplicity ?? undefined,
369
+ dynamic_output_concept_ref: options.dynamic_output_concept_ref ?? undefined,
370
+ });
371
+ const pipeOutput = response.pipe_output;
331
372
  return {
332
373
  pipeline_run_id: response.pipeline_run_id,
333
- created_at: response.created_at,
334
- pipeline_state: response.pipeline_state,
335
- finished_at: response.finished_at,
336
- main_stuff_name: response.main_stuff_name,
337
- pipe_output: response.pipe_output,
374
+ main_stuff: null,
375
+ // The local CLI blocking `pipe_output` carries no graph artifact.
376
+ graph_spec: null,
377
+ pipe_output: pipeOutput ?? null,
338
378
  };
339
379
  }
340
- async startPipeline(_options) {
341
- throw new Error("startPipeline is not supported by the pipelex CLI runner. Use the API runner instead.");
380
+ async start(_options) {
381
+ throw new Error(RUN_LIFECYCLE_UNSUPPORTED);
382
+ }
383
+ async getRunStatus(_runId) {
384
+ throw new Error(RUN_LIFECYCLE_UNSUPPORTED);
385
+ }
386
+ async getRunResult(_runId, _options) {
387
+ throw new Error(RUN_LIFECYCLE_UNSUPPORTED);
388
+ }
389
+ }
390
+ const RUN_LIFECYCLE_UNSUPPORTED = "Run lifecycle (start/status/result/poll) is not supported by the pipelex CLI runner. Use the API runner instead (--runner api).";
391
+ /**
392
+ * Normalize the local CLI's models output into the protocol `ModelDeck`.
393
+ *
394
+ * Accepts the deck shape verbatim (`{ models, aliases, waterfalls }`) and maps
395
+ * the legacy `pipelex-agent models` shape (`presets` / nested `aliases` /
396
+ * nested `waterfalls`, keyed by category) by flattening it.
397
+ */
398
+ function toModelDeck(parsed) {
399
+ const root = (parsed && typeof parsed === "object" ? parsed : {});
400
+ if (Array.isArray(root.models)) {
401
+ return {
402
+ models: root.models,
403
+ aliases: root.aliases ?? {},
404
+ waterfalls: root.waterfalls ?? {},
405
+ };
406
+ }
407
+ const models = [];
408
+ const presets = (root.presets ?? {});
409
+ for (const [category, entries] of Object.entries(presets)) {
410
+ if (!Array.isArray(entries))
411
+ continue;
412
+ for (const entry of entries) {
413
+ if (entry && typeof entry.name === "string") {
414
+ models.push({ name: entry.name, type: category });
415
+ }
416
+ }
417
+ }
418
+ const aliases = {};
419
+ const rawAliases = (root.aliases ?? {});
420
+ for (const group of Object.values(rawAliases)) {
421
+ if (group && typeof group === "object")
422
+ Object.assign(aliases, group);
423
+ }
424
+ const waterfalls = {};
425
+ const rawWaterfalls = (root.waterfalls ?? {});
426
+ for (const group of Object.values(rawWaterfalls)) {
427
+ if (group && typeof group === "object")
428
+ Object.assign(waterfalls, group);
342
429
  }
430
+ return { models, aliases, waterfalls };
343
431
  }
344
- //# sourceMappingURL=pipelex-runner.js.map
432
+ //# sourceMappingURL=runner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner.js","sourceRoot":"","sources":["../../../src/runners/pipelex/runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,UAAU,EACV,aAAa,EACb,YAAY,EACZ,WAAW,EACX,MAA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EAAE,UAAU,EAAE,CAAC;AACzC,CAAC"}
@@ -1,12 +1,18 @@
1
1
  import { loadConfig } from "../config/config.js";
2
2
  import { Runners } from "./types.js";
3
- import { ApiRunner } from "./api-runner.js";
4
- import { PipelexRunner } from "./pipelex-runner.js";
3
+ import { MthdsApiClient } from "./api/client.js";
4
+ import { PipelexRunner } from "./pipelex/runner.js";
5
5
  export function createRunner(type, libraryDirs) {
6
- const runnerType = type ?? loadConfig().runner;
6
+ const config = loadConfig();
7
+ const runnerType = type ?? config.runner;
7
8
  switch (runnerType) {
8
9
  case Runners.API:
9
- return new ApiRunner();
10
+ // The API client IS the API runner (parity D8). Defaults flow from the
11
+ // resolved config (file + env), so the CLI honors `~/.mthds/config`.
12
+ return new MthdsApiClient({
13
+ baseUrl: config.baseUrl,
14
+ apiToken: config.apiKey || undefined,
15
+ });
10
16
  case Runners.PIPELEX:
11
17
  return new PipelexRunner(libraryDirs);
12
18
  default:
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/runners/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,UAAU,YAAY,CAC1B,IAAiB,EACjB,WAAsB;IAEtB,MAAM,UAAU,GAAG,IAAI,IAAI,UAAU,EAAE,CAAC,MAAM,CAAC;IAE/C,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,OAAO,CAAC,GAAG;YACd,OAAO,IAAI,SAAS,EAAE,CAAC;QACzB,KAAK,OAAO,CAAC,OAAO;YAClB,OAAO,IAAI,aAAa,CAAC,WAAW,CAAC,CAAC;QACxC;YACE,MAAM,IAAI,KAAK,CAAC,wBAAwB,UAAoB,EAAE,CAAC,CAAC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