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
@@ -1,11 +1,13 @@
1
- import type { RunnerProtocol } from "../client/protocol.js";
1
+ import type { MTHDSProtocol } from "../protocol/protocol.js";
2
+ import type { StartOptions } from "../protocol/options.js";
3
+ import type { RunRead, RunResultState, RunResults, WaitForResultOptions } from "./api/runs.js";
4
+ import type { DictPipeOutput } from "./api/models.js";
2
5
  export declare const Runners: {
3
6
  readonly API: "api";
4
7
  readonly PIPELEX: "pipelex";
5
8
  };
6
9
  export type RunnerType = (typeof Runners)[keyof typeof Runners];
7
10
  export declare const RUNNER_NAMES: RunnerType[];
8
- export type PipelineState = "RUNNING" | "COMPLETED" | "FAILED" | "CANCELLED" | "ERROR" | "STARTED";
9
11
  export type ConceptRepresentationFormat = "json" | "python" | "schema";
10
12
  export interface BuildInputsRequest {
11
13
  mthds_contents: string[];
@@ -20,20 +22,6 @@ export interface BuildRunnerRequest {
20
22
  mthds_contents: string[];
21
23
  pipe_code: string;
22
24
  }
23
- export interface ExecuteRequest {
24
- /** MTHDS bundle content(s) to validate, load, and execute. Omit to run an already-loaded pipe. */
25
- mthds_contents?: string[];
26
- pipe_code?: string;
27
- inputs?: Record<string, unknown>;
28
- }
29
- export interface ValidateRequest {
30
- /** GitHub URL or local path to the method directory (preferred). */
31
- method_url?: string;
32
- /** Pipe code to validate (optional — validates a specific pipe). */
33
- pipe_code?: string;
34
- /** Raw .mthds file content(s). */
35
- mthds_contents?: string[];
36
- }
37
25
  export interface ConceptRequest {
38
26
  spec: Record<string, unknown>;
39
27
  }
@@ -41,6 +29,7 @@ export interface PipeSpecRequest {
41
29
  pipe_type: string;
42
30
  spec: Record<string, unknown>;
43
31
  }
32
+ /** Request for `PipelexRunner.checkModel` — a LOCAL CLI capability only (no API route). */
44
33
  export interface CheckModelRequest {
45
34
  reference: string;
46
35
  type: string;
@@ -52,42 +41,6 @@ export interface BuildRunnerResponse {
52
41
  success: boolean;
53
42
  message: string;
54
43
  }
55
- export interface DictStuff {
56
- concept: string;
57
- content: unknown;
58
- }
59
- export interface DictWorkingMemory {
60
- root: Record<string, DictStuff>;
61
- aliases: Record<string, string>;
62
- }
63
- export interface DictPipeOutput {
64
- working_memory: DictWorkingMemory;
65
- graph_spec?: unknown;
66
- pipeline_run_id: string;
67
- }
68
- export interface PipelineResponse {
69
- pipeline_run_id: string;
70
- created_at: string;
71
- pipeline_state: PipelineState;
72
- finished_at?: string | null;
73
- pipe_output?: DictPipeOutput | null;
74
- main_stuff_name?: string | null;
75
- }
76
- export interface PipelexBundleBlueprint {
77
- source?: string | null;
78
- domain: string;
79
- description?: string | null;
80
- system_prompt?: string | null;
81
- main_pipe?: string | null;
82
- concept?: Record<string, unknown> | null;
83
- pipe?: Record<string, unknown> | null;
84
- }
85
- export interface ValidateResponse {
86
- mthds_contents: string[];
87
- pipelex_bundle_blueprint: PipelexBundleBlueprint;
88
- success: boolean;
89
- message: string;
90
- }
91
44
  export interface ConceptResponse {
92
45
  success: boolean;
93
46
  concept_code: string;
@@ -99,6 +52,7 @@ export interface PipeSpecResponse {
99
52
  pipe_type: string;
100
53
  toml: string;
101
54
  }
55
+ /** Response of `PipelexRunner.checkModel` — a LOCAL CLI capability only (no API route). */
102
56
  export interface CheckModelResponse {
103
57
  success: boolean;
104
58
  valid: boolean;
@@ -106,30 +60,18 @@ export interface CheckModelResponse {
106
60
  suggestions?: string[];
107
61
  [key: string]: unknown;
108
62
  }
109
- export interface ModelsRequest {
110
- type?: string[];
111
- }
112
- export interface ModelsResponse {
113
- success: boolean;
114
- presets: Record<string, Array<{
115
- name: string;
116
- description?: string;
117
- }>>;
118
- aliases: Record<string, Record<string, string>>;
119
- waterfalls: Record<string, Record<string, string[]>>;
120
- talent_mappings: Record<string, Record<string, string>>;
121
- }
122
- export interface Runner extends RunnerProtocol {
63
+ export interface Runner extends MTHDSProtocol<DictPipeOutput> {
123
64
  readonly type: RunnerType;
124
65
  health(): Promise<Record<string, unknown>>;
125
- version(): Promise<Record<string, string>>;
126
66
  buildInputs(request: BuildInputsRequest): Promise<unknown>;
127
67
  buildOutput(request: BuildOutputRequest): Promise<unknown>;
128
68
  buildRunner(request: BuildRunnerRequest): Promise<BuildRunnerResponse>;
129
- execute(request: ExecuteRequest): Promise<PipelineResponse>;
130
- validate(request: ValidateRequest): Promise<ValidateResponse>;
131
69
  concept(request: ConceptRequest): Promise<ConceptResponse>;
132
70
  pipeSpec(request: PipeSpecRequest): Promise<PipeSpecResponse>;
133
- models(request?: ModelsRequest): Promise<ModelsResponse>;
134
- checkModel(request: CheckModelRequest): Promise<CheckModelResponse>;
71
+ getRunStatus(runId: string): Promise<RunRead>;
72
+ getRunResult(runId: string, options?: {
73
+ signal?: AbortSignal;
74
+ }): Promise<RunResultState>;
75
+ waitForResult(runId: string, options?: WaitForResultOptions): Promise<RunResults>;
76
+ startAndWaitForResult(options: StartOptions, pollOptions?: WaitForResultOptions): Promise<RunResults>;
135
77
  }
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runners/types.ts"],"names":[],"mappings":"AAEA,uEAAuE;AAEvE,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;CACV,CAAC;AAIX,MAAM,CAAC,MAAM,YAAY,GAAiB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/runners/types.ts"],"names":[],"mappings":"AAUA,uEAAuE;AAEvE,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;CACV,CAAC;AAIX,MAAM,CAAC,MAAM,YAAY,GAAiB,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mthds",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "description": "CLI and SDK for MTHDS — the open standard for executable AI methods. Install, execute, and manage methods.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -23,7 +23,9 @@
23
23
  "scripts": {
24
24
  "build": "tsc",
25
25
  "test": "vitest run",
26
- "example": "npx tsx examples/call_api.ts"
26
+ "depcruise": "depcruise --config .dependency-cruiser.cjs src",
27
+ "example": "npx tsx examples/call_api.ts",
28
+ "prepare": "tsc"
27
29
  },
28
30
  "files": [
29
31
  "dist/"
@@ -44,8 +46,9 @@
44
46
  "devDependencies": {
45
47
  "@types/node": "^22.12.0",
46
48
  "@types/semver": "^7.7.1",
49
+ "dependency-cruiser": "^17.4.3",
47
50
  "tsx": "^4.19.0",
48
51
  "typescript": "^5.7.3",
49
52
  "vitest": "^4.0.18"
50
53
  }
51
- }
54
+ }
@@ -1,18 +0,0 @@
1
- /**
2
- * Agent validate command — validates a .mthds bundle and outputs JSON.
3
- */
4
- import type { RunnerType } from "../../runners/types.js";
5
- interface AgentValidateOptions {
6
- pipe?: string;
7
- runner?: RunnerType;
8
- libraryDir?: string[];
9
- }
10
- export declare function agentValidateMethod(_target: string, options: AgentValidateOptions): Promise<void>;
11
- export declare function agentValidateBundle(_target: string, options: AgentValidateOptions): Promise<void>;
12
- export declare function agentValidatePipe(target: string, options: {
13
- pipe?: string;
14
- bundle?: string;
15
- runner?: RunnerType;
16
- libraryDir?: string[];
17
- }): Promise<void>;
18
- export {};
@@ -1,126 +0,0 @@
1
- /**
2
- * Agent validate command — validates a .mthds bundle and outputs JSON.
3
- */
4
- import { readFileSync } from "node:fs";
5
- import { agentSuccess, agentError, AGENT_ERROR_DOMAINS } from "../output.js";
6
- import { createRunner } from "../../runners/registry.js";
7
- import { isPipelexRunner } from "../../cli/commands/utils.js";
8
- /** Extract raw args after `validate`, filtering out --runner, -L/--library-dir, and --log-level */
9
- function extractPassthroughArgs() {
10
- const argv = process.argv;
11
- const idx = argv.indexOf("validate");
12
- if (idx === -1)
13
- return [];
14
- const raw = argv.slice(idx + 1);
15
- const result = [];
16
- let i = 0;
17
- while (i < raw.length) {
18
- if (raw[i] === "--runner" ||
19
- raw[i] === "-L" ||
20
- raw[i] === "--library-dir" ||
21
- raw[i] === "--log-level") {
22
- i += 2;
23
- }
24
- else if (raw[i].startsWith("--runner=") ||
25
- raw[i].startsWith("--library-dir=") ||
26
- raw[i].startsWith("--log-level=")) {
27
- i += 1;
28
- }
29
- else {
30
- result.push(raw[i]);
31
- i++;
32
- }
33
- }
34
- return result;
35
- }
36
- async function agentValidateTarget(options, fallbackMsg) {
37
- const libraryDirs = options.libraryDir?.length
38
- ? options.libraryDir
39
- : undefined;
40
- let runner;
41
- try {
42
- runner = createRunner(options.runner, libraryDirs);
43
- }
44
- catch (err) {
45
- agentError(err.message, "RunnerError", {
46
- error_domain: AGENT_ERROR_DOMAINS.RUNNER,
47
- });
48
- }
49
- if (isPipelexRunner(runner)) {
50
- try {
51
- await runner.validatePassthrough(extractPassthroughArgs());
52
- }
53
- catch (err) {
54
- agentError(err.message, "ValidationError", {
55
- error_domain: AGENT_ERROR_DOMAINS.VALIDATION,
56
- });
57
- }
58
- return;
59
- }
60
- agentError(fallbackMsg, "ArgumentError", {
61
- error_domain: AGENT_ERROR_DOMAINS.ARGUMENT,
62
- });
63
- }
64
- export async function agentValidateMethod(_target, options) {
65
- return agentValidateTarget(options, "Method target is not yet supported for the API runner. Use 'mthds-agent validate pipe <target>' instead, or specify a different runner with --runner <name>.");
66
- }
67
- export async function agentValidateBundle(_target, options) {
68
- return agentValidateTarget(options, "Bundle target is only supported with the pipelex runner. Specify --runner pipelex.");
69
- }
70
- export async function agentValidatePipe(target, options) {
71
- const libraryDirs = options.libraryDir?.length
72
- ? options.libraryDir
73
- : undefined;
74
- let runner;
75
- try {
76
- runner = createRunner(options.runner, libraryDirs);
77
- }
78
- catch (err) {
79
- agentError(err.message, "RunnerError", {
80
- error_domain: AGENT_ERROR_DOMAINS.RUNNER,
81
- });
82
- }
83
- if (isPipelexRunner(runner)) {
84
- try {
85
- await runner.validatePassthrough(extractPassthroughArgs());
86
- }
87
- catch (err) {
88
- agentError(err.message, "ValidationError", {
89
- error_domain: AGENT_ERROR_DOMAINS.VALIDATION,
90
- });
91
- }
92
- return;
93
- }
94
- const bundlePath = options.bundle ?? (target.endsWith(".mthds") ? target : undefined);
95
- if (!bundlePath) {
96
- agentError("Provide a .mthds bundle file to validate (positional or --bundle).", "ArgumentError", { error_domain: AGENT_ERROR_DOMAINS.ARGUMENT });
97
- }
98
- let mthdsContent;
99
- try {
100
- mthdsContent = readFileSync(bundlePath, "utf-8");
101
- }
102
- catch (err) {
103
- agentError(`Cannot read bundle: ${err.message}`, "IOError", { error_domain: AGENT_ERROR_DOMAINS.IO });
104
- }
105
- try {
106
- const result = await runner.validate({ mthds_contents: [mthdsContent] });
107
- if (result.success) {
108
- agentSuccess({
109
- success: true,
110
- message: result.message,
111
- pipelex_bundle_blueprint: result.pipelex_bundle_blueprint,
112
- });
113
- }
114
- else {
115
- agentError(result.message, "ValidationError", {
116
- error_domain: AGENT_ERROR_DOMAINS.VALIDATION,
117
- });
118
- }
119
- }
120
- catch (err) {
121
- agentError(err.message, "ValidationError", {
122
- error_domain: AGENT_ERROR_DOMAINS.VALIDATION,
123
- });
124
- }
125
- }
126
- //# sourceMappingURL=validate.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.js","sourceRoot":"","sources":["../../../src/agent/commands/validate.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,mGAAmG;AACnG,SAAS,sBAAsB;IAC7B,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAC1B,MAAM,GAAG,GAAG,IAA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MAAM,CAAC,wBAAwB;aAC1D,CAAC,CAAC;QACL,CAAC;aAAM,CAAC;YACN,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,iBAAiB,EAAE;gBAC5C,YAAY,EAAE,mBAAmB,CAAC,UAAU;aAC7C,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,UAAU,CAAE,GAAa,CAAC,OAAO,EAAE,iBAAiB,EAAE;YACpD,YAAY,EAAE,mBAAmB,CAAC,UAAU;SAC7C,CAAC,CAAC;IACL,CAAC;AACH,CAAC"}
@@ -1,15 +0,0 @@
1
- import type { RunnerProtocol } from "./protocol.js";
2
- import type { ExecutePipelineOptions, PipelineExecuteResponse, PipelineStartResponse } from "./pipeline.js";
3
- interface MthdsApiClientOptions {
4
- apiToken?: string;
5
- apiBaseUrl?: string;
6
- }
7
- export declare class MthdsApiClient implements RunnerProtocol {
8
- private readonly apiToken;
9
- private readonly apiBaseUrl;
10
- constructor(options?: MthdsApiClientOptions);
11
- private makeApiCall;
12
- executePipeline(options: ExecutePipelineOptions): Promise<PipelineExecuteResponse>;
13
- startPipeline(options: ExecutePipelineOptions): Promise<PipelineStartResponse>;
14
- }
15
- export {};
@@ -1,127 +0,0 @@
1
- import { ApiResponseError, ApiUnreachableError, ClientAuthenticationError, PipelineRequestError, } from "./exceptions.js";
2
- export class MthdsApiClient {
3
- apiToken;
4
- apiBaseUrl;
5
- constructor(options = {}) {
6
- this.apiToken = options.apiToken ?? process.env.PIPELEX_API_KEY;
7
- const resolvedBaseUrl = options.apiBaseUrl ?? process.env.PIPELEX_API_URL;
8
- if (!resolvedBaseUrl) {
9
- throw new ClientAuthenticationError("API base URL is required for API execution");
10
- }
11
- this.apiBaseUrl = resolvedBaseUrl.replace(/\/+$/, "");
12
- }
13
- async makeApiCall(endpoint, pipelineRequest) {
14
- const url = `${this.apiBaseUrl}/${endpoint}`;
15
- const headers = {
16
- "Content-Type": "application/json",
17
- };
18
- if (this.apiToken) {
19
- headers["Authorization"] = `Bearer ${this.apiToken}`;
20
- }
21
- let response;
22
- try {
23
- response = await fetch(url, {
24
- method: "POST",
25
- headers,
26
- body: JSON.stringify(pipelineRequest),
27
- signal: AbortSignal.timeout(1_200_000),
28
- });
29
- }
30
- catch (err) {
31
- // undici (Node fetch) wraps DNS/connect/TLS failures as
32
- // `TypeError("fetch failed")` with the system error attached as `cause`.
33
- // `AbortSignal.timeout` rejects with a DOMException named "TimeoutError".
34
- const code = extractNetworkErrorCode(err);
35
- throw new ApiUnreachableError(`Could not reach Pipelex API at ${this.apiBaseUrl} (${code ?? "network error"})`, this.apiBaseUrl, code, { cause: err });
36
- }
37
- if (!response.ok) {
38
- const body = await response.text().catch(() => "");
39
- const { errorType, serverMessage } = parseErrorBody(body);
40
- throw new ApiResponseError(`API POST /${endpoint} failed (${response.status}): ${serverMessage ?? (body || response.statusText)}`, this.apiBaseUrl, response.status, response.statusText, body, errorType, serverMessage);
41
- }
42
- return response.json();
43
- }
44
- async executePipeline(options) {
45
- if (!options.pipe_code && (!options.mthds_contents || options.mthds_contents.length === 0)) {
46
- throw new PipelineRequestError("Either pipe_code or mthds_contents must be provided to executePipeline.");
47
- }
48
- const request = {
49
- pipe_code: options.pipe_code,
50
- mthds_contents: options.mthds_contents,
51
- inputs: options.inputs,
52
- output_name: options.output_name,
53
- output_multiplicity: options.output_multiplicity,
54
- dynamic_output_concept_code: options.dynamic_output_concept_code,
55
- };
56
- const data = await this.makeApiCall("api/v1/pipeline/execute", request);
57
- return data;
58
- }
59
- async startPipeline(options) {
60
- if (!options.pipe_code && (!options.mthds_contents || options.mthds_contents.length === 0)) {
61
- throw new PipelineRequestError("Either pipe_code or mthds_contents must be provided to startPipeline.");
62
- }
63
- const request = {
64
- pipe_code: options.pipe_code,
65
- mthds_contents: options.mthds_contents,
66
- inputs: options.inputs,
67
- output_name: options.output_name,
68
- output_multiplicity: options.output_multiplicity,
69
- dynamic_output_concept_code: options.dynamic_output_concept_code,
70
- };
71
- const data = await this.makeApiCall("api/v1/pipeline/start", request);
72
- return data;
73
- }
74
- }
75
- function extractNetworkErrorCode(err) {
76
- if (err instanceof DOMException && err.name === "TimeoutError") {
77
- return "ABORT_TIMEOUT";
78
- }
79
- if (err instanceof Error) {
80
- const cause = err.cause;
81
- if (cause && typeof cause === "object" && "code" in cause) {
82
- const code = cause.code;
83
- if (typeof code === "string")
84
- return code;
85
- }
86
- }
87
- return undefined;
88
- }
89
- /**
90
- * Pipelex API serializes errors as `{"detail": {"error_type": ..., "message": ...}}`
91
- * (HTTPException with dict detail) or `{"detail": "..."}` (auth 401s).
92
- * Both shapes are extracted here. Falls through silently on non-JSON bodies.
93
- */
94
- function parseErrorBody(body) {
95
- if (!body)
96
- return { errorType: undefined, serverMessage: undefined };
97
- let parsed;
98
- try {
99
- parsed = JSON.parse(body);
100
- }
101
- catch {
102
- return { errorType: undefined, serverMessage: undefined };
103
- }
104
- if (!parsed || typeof parsed !== "object") {
105
- return { errorType: undefined, serverMessage: undefined };
106
- }
107
- const root = parsed;
108
- const detail = root.detail;
109
- let errorType;
110
- let serverMessage;
111
- if (detail && typeof detail === "object") {
112
- const d = detail;
113
- if (typeof d.error_type === "string")
114
- errorType = d.error_type;
115
- if (typeof d.message === "string")
116
- serverMessage = d.message;
117
- }
118
- else if (typeof detail === "string") {
119
- serverMessage = detail;
120
- }
121
- if (errorType === undefined && typeof root.error_type === "string")
122
- errorType = root.error_type;
123
- if (serverMessage === undefined && typeof root.message === "string")
124
- serverMessage = root.message;
125
- return { errorType, serverMessage };
126
- }
127
- //# sourceMappingURL=client.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC;AAOzB,MAAM,OAAO,cAAc;IACR,QAAQ,CAAqB;IAC7B,UAAU,CAAS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,EAAE,CAAC;AACtC,CAAC"}
@@ -1,46 +0,0 @@
1
- export declare class ClientAuthenticationError extends Error {
2
- constructor(message: string);
3
- }
4
- export declare class PipelineRequestError extends Error {
5
- constructor(message: string, options?: {
6
- cause?: unknown;
7
- });
8
- }
9
- /**
10
- * Thrown when the Pipelex API host cannot be reached at all (DNS failure,
11
- * connection refused, TLS handshake failure, request timeout). The HTTP
12
- * exchange never produced a response — distinguish from `ApiResponseError`,
13
- * which represents a non-2xx response that did come back.
14
- *
15
- * `code` is the underlying network error code when available
16
- * (`ECONNREFUSED`, `ENOTFOUND`, `ETIMEDOUT`, `EAI_AGAIN`, `ABORT_TIMEOUT`).
17
- */
18
- export declare class ApiUnreachableError extends PipelineRequestError {
19
- readonly apiUrl: string;
20
- readonly code: string | undefined;
21
- constructor(message: string, apiUrl: string, code: string | undefined, options?: {
22
- cause?: unknown;
23
- });
24
- }
25
- /**
26
- * Thrown when the API returned a non-2xx HTTP response. Carries structured
27
- * fields so callers can render meaningful UI without parsing the message:
28
- * - `status` / `statusText` — HTTP status from the response
29
- * - `responseBody` — raw response body (always retained)
30
- * - `errorType` / `serverMessage` — parsed from the JSON body when present
31
- *
32
- * Pipelex API serializes errors as `{"detail": {"error_type", "message"}}`
33
- * (HTTPException with dict detail) or `{"detail": "..."}` (auth 401s).
34
- * Both shapes are extracted here.
35
- */
36
- export declare class ApiResponseError extends PipelineRequestError {
37
- readonly apiUrl: string;
38
- readonly status: number;
39
- readonly statusText: string;
40
- readonly responseBody: string;
41
- readonly errorType: string | undefined;
42
- readonly serverMessage: string | undefined;
43
- constructor(message: string, apiUrl: string, status: number, statusText: string, responseBody: string, errorType: string | undefined, serverMessage: string | undefined, options?: {
44
- cause?: unknown;
45
- });
46
- }
@@ -1,61 +0,0 @@
1
- export class ClientAuthenticationError extends Error {
2
- constructor(message) {
3
- super(message);
4
- this.name = "ClientAuthenticationError";
5
- }
6
- }
7
- export class PipelineRequestError extends Error {
8
- constructor(message, options) {
9
- super(message, options);
10
- this.name = "PipelineRequestError";
11
- }
12
- }
13
- /**
14
- * Thrown when the Pipelex API host cannot be reached at all (DNS failure,
15
- * connection refused, TLS handshake failure, request timeout). The HTTP
16
- * exchange never produced a response — distinguish from `ApiResponseError`,
17
- * which represents a non-2xx response that did come back.
18
- *
19
- * `code` is the underlying network error code when available
20
- * (`ECONNREFUSED`, `ENOTFOUND`, `ETIMEDOUT`, `EAI_AGAIN`, `ABORT_TIMEOUT`).
21
- */
22
- export class ApiUnreachableError extends PipelineRequestError {
23
- apiUrl;
24
- code;
25
- constructor(message, apiUrl, code, options) {
26
- super(message, options);
27
- this.name = "ApiUnreachableError";
28
- this.apiUrl = apiUrl;
29
- this.code = code;
30
- }
31
- }
32
- /**
33
- * Thrown when the API returned a non-2xx HTTP response. Carries structured
34
- * fields so callers can render meaningful UI without parsing the message:
35
- * - `status` / `statusText` — HTTP status from the response
36
- * - `responseBody` — raw response body (always retained)
37
- * - `errorType` / `serverMessage` — parsed from the JSON body when present
38
- *
39
- * Pipelex API serializes errors as `{"detail": {"error_type", "message"}}`
40
- * (HTTPException with dict detail) or `{"detail": "..."}` (auth 401s).
41
- * Both shapes are extracted here.
42
- */
43
- export class ApiResponseError extends PipelineRequestError {
44
- apiUrl;
45
- status;
46
- statusText;
47
- responseBody;
48
- errorType;
49
- serverMessage;
50
- constructor(message, apiUrl, status, statusText, responseBody, errorType, serverMessage, options) {
51
- super(message, options);
52
- this.name = "ApiResponseError";
53
- this.apiUrl = apiUrl;
54
- this.status = status;
55
- this.statusText = statusText;
56
- this.responseBody = responseBody;
57
- this.errorType = errorType;
58
- this.serverMessage = serverMessage;
59
- }
60
- }
61
- //# sourceMappingURL=exceptions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../src/client/exceptions.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,yBAA0B,SAAQ,KAAK;IAClD,YAAY,OAAe;QACzB,KAAK,CAAC,OAAO,CAAC,CAA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ACF"}
@@ -1,5 +0,0 @@
1
- export { MthdsApiClient } from "./client.js";
2
- export type { RunnerProtocol } from "./protocol.js";
3
- export { ApiResponseError, ApiUnreachableError, ClientAuthenticationError, PipelineRequestError, } from "./exceptions.js";
4
- export type { PipelineState, PipelineRequest, PipelineExecuteResponse, PipelineStartResponse, ExecutePipelineOptions, } from "./pipeline.js";
5
- export type { DictStuff, DictWorkingMemory, DictPipeOutput, VariableMultiplicity, StuffContentOrData, PipelineInputs, } from "./models/index.js";
@@ -1,3 +0,0 @@
1
- export { MthdsApiClient } from "./client.js";
2
- export { ApiResponseError, ApiUnreachableError, ClientAuthenticationError, PipelineRequestError, } from "./exceptions.js";
3
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,oBAAoB,GACrB,MAAM,iBAAiB,CAAC"}
@@ -1,4 +0,0 @@
1
- export type { DictStuff } from "./stuff.js";
2
- export type { DictWorkingMemory } from "./working_memory.js";
3
- export type { DictPipeOutput, VariableMultiplicity } from "./pipe_output.js";
4
- export type { StuffContentOrData, PipelineInputs } from "./pipeline_inputs.js";
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/client/models/index.ts"],"names":[],"mappings":""}
@@ -1,2 +0,0 @@
1
- export type { DictPipeOutput } from "../../runners/types.js";
2
- export type VariableMultiplicity = boolean | number;
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=pipe_output.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipe_output.js","sourceRoot":"","sources":["../../../src/client/models/pipe_output.ts"],"names":[],"mappings":""}
@@ -1,3 +0,0 @@
1
- import type { DictStuff } from "./stuff.js";
2
- export type StuffContentOrData = string | string[] | Record<string, unknown> | DictStuff;
3
- export type PipelineInputs = Record<string, StuffContentOrData>;
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=pipeline_inputs.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pipeline_inputs.js","sourceRoot":"","sources":["../../../src/client/models/pipeline_inputs.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- export type { DictStuff } from "../../runners/types.js";
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=stuff.js.map
@@ -1 +0,0 @@
1
- export type { DictWorkingMemory } from "../../runners/types.js";