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.
- package/README.md +43 -21
- package/dist/agent/binaries.js +2 -2
- package/dist/agent/commands/api-commands.d.ts +8 -0
- package/dist/agent/commands/api-commands.js +310 -93
- package/dist/agent/commands/api-commands.js.map +1 -1
- package/dist/agent/commands/codex-hook.d.ts +20 -0
- package/dist/agent/commands/codex-hook.js +25 -9
- package/dist/agent/commands/codex-hook.js.map +1 -1
- package/dist/agent/commands/config.js +2 -2
- package/dist/agent/commands/config.js.map +1 -1
- package/dist/agent/output.d.ts +4 -0
- package/dist/agent/output.js +7 -0
- package/dist/agent/output.js.map +1 -1
- package/dist/agent/plugin-version.d.ts +1 -1
- package/dist/agent/plugin-version.js +1 -1
- package/dist/agent-cli.js +5 -5
- package/dist/agent-cli.js.map +1 -1
- package/dist/cli/commands/config.js +2 -2
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/install.js +29 -37
- package/dist/cli/commands/install.js.map +1 -1
- package/dist/cli/commands/run.js +82 -69
- package/dist/cli/commands/run.js.map +1 -1
- package/dist/cli/commands/setup.js +22 -23
- package/dist/cli/commands/setup.js.map +1 -1
- package/dist/cli/commands/utils.d.ts +9 -1
- package/dist/cli/commands/utils.js +9 -0
- package/dist/cli/commands/utils.js.map +1 -1
- package/dist/cli/commands/validate.js +29 -13
- package/dist/cli/commands/validate.js.map +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/config/config.d.ts +14 -1
- package/dist/config/config.js +31 -6
- package/dist/config/config.js.map +1 -1
- package/dist/index.d.ts +27 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/dist/protocol/concept.d.ts +14 -0
- package/dist/protocol/concept.js +10 -0
- package/dist/protocol/concept.js.map +1 -0
- package/dist/protocol/exceptions.d.ts +10 -0
- package/dist/protocol/exceptions.js +12 -0
- package/dist/protocol/exceptions.js.map +1 -0
- package/dist/protocol/models.d.ts +150 -0
- package/dist/protocol/models.js +24 -0
- package/dist/protocol/models.js.map +1 -0
- package/dist/protocol/options.d.ts +60 -0
- package/dist/protocol/options.js +11 -0
- package/dist/protocol/options.js.map +1 -0
- package/dist/protocol/pipe_output.d.ts +11 -0
- package/dist/protocol/pipe_output.js +7 -0
- package/dist/protocol/pipe_output.js.map +1 -0
- package/dist/protocol/pipeline_inputs.d.ts +8 -0
- package/dist/protocol/pipeline_inputs.js +7 -0
- package/dist/protocol/pipeline_inputs.js.map +1 -0
- package/dist/protocol/protocol.d.ts +55 -0
- package/dist/{client → protocol}/protocol.js.map +1 -1
- package/dist/protocol/stuff.d.ts +16 -0
- package/dist/protocol/stuff.js +8 -0
- package/dist/{client/models → protocol}/stuff.js.map +1 -1
- package/dist/protocol/working_memory.d.ts +10 -0
- package/dist/protocol/working_memory.js +7 -0
- package/dist/protocol/working_memory.js.map +1 -0
- package/dist/runners/api/client.d.ts +181 -0
- package/dist/runners/api/client.js +679 -0
- package/dist/runners/api/client.js.map +1 -0
- package/dist/runners/api/exceptions.d.ts +121 -0
- package/dist/runners/api/exceptions.js +156 -0
- package/dist/runners/api/exceptions.js.map +1 -0
- package/dist/runners/api/models.d.ts +131 -0
- package/dist/runners/api/models.js +13 -0
- package/dist/runners/api/models.js.map +1 -0
- package/dist/runners/api/runs.d.ts +130 -0
- package/dist/runners/api/runs.js +93 -0
- package/dist/runners/api/runs.js.map +1 -0
- package/dist/runners/base-runner.d.ts +27 -0
- package/dist/runners/base-runner.js +25 -0
- package/dist/runners/base-runner.js.map +1 -0
- package/dist/runners/pipelex/runner.d.ts +38 -0
- package/dist/runners/{pipelex-runner.js → pipelex/runner.js} +171 -83
- package/dist/runners/pipelex/runner.js.map +1 -0
- package/dist/runners/registry.js +10 -4
- package/dist/runners/registry.js.map +1 -1
- package/dist/runners/types.d.ts +13 -71
- package/dist/runners/types.js.map +1 -1
- package/package.json +6 -3
- package/dist/agent/commands/validate.d.ts +0 -18
- package/dist/agent/commands/validate.js +0 -126
- package/dist/agent/commands/validate.js.map +0 -1
- package/dist/client/client.d.ts +0 -15
- package/dist/client/client.js +0 -127
- package/dist/client/client.js.map +0 -1
- package/dist/client/exceptions.d.ts +0 -46
- package/dist/client/exceptions.js +0 -61
- package/dist/client/exceptions.js.map +0 -1
- package/dist/client/index.d.ts +0 -5
- package/dist/client/index.js +0 -3
- package/dist/client/index.js.map +0 -1
- package/dist/client/models/index.d.ts +0 -4
- package/dist/client/models/index.js +0 -2
- package/dist/client/models/index.js.map +0 -1
- package/dist/client/models/pipe_output.d.ts +0 -2
- package/dist/client/models/pipe_output.js +0 -2
- package/dist/client/models/pipe_output.js.map +0 -1
- package/dist/client/models/pipeline_inputs.d.ts +0 -3
- package/dist/client/models/pipeline_inputs.js +0 -2
- package/dist/client/models/pipeline_inputs.js.map +0 -1
- package/dist/client/models/stuff.d.ts +0 -1
- package/dist/client/models/stuff.js +0 -2
- package/dist/client/models/working_memory.d.ts +0 -1
- package/dist/client/models/working_memory.js +0 -2
- package/dist/client/models/working_memory.js.map +0 -1
- package/dist/client/pipeline.d.ts +0 -36
- package/dist/client/pipeline.js +0 -2
- package/dist/client/pipeline.js.map +0 -1
- package/dist/client/protocol.d.ts +0 -5
- package/dist/runners/api-runner.d.ts +0 -24
- package/dist/runners/api-runner.js +0 -91
- package/dist/runners/api-runner.js.map +0 -1
- package/dist/runners/pipelex-runner.d.ts +0 -30
- package/dist/runners/pipelex-runner.js.map +0 -1
- /package/dist/{client → protocol}/protocol.js +0 -0
package/dist/config/config.js
CHANGED
|
@@ -8,8 +8,8 @@ const CONFIG_PATH = join(CONFIG_DIR, "config");
|
|
|
8
8
|
// ── Config keys ───────────────────────────────────────────────────
|
|
9
9
|
/** Map from config key to env var name */
|
|
10
10
|
const ENV_NAMES = {
|
|
11
|
-
|
|
12
|
-
apiKey: "
|
|
11
|
+
baseUrl: "MTHDS_API_URL",
|
|
12
|
+
apiKey: "MTHDS_API_KEY",
|
|
13
13
|
runner: "MTHDS_RUNNER",
|
|
14
14
|
telemetry: "DISABLE_TELEMETRY",
|
|
15
15
|
autoUpgrade: "MTHDS_AUTO_UPGRADE",
|
|
@@ -17,17 +17,19 @@ const ENV_NAMES = {
|
|
|
17
17
|
};
|
|
18
18
|
/** Map from config key to file key (used in ~/.mthds/config) */
|
|
19
19
|
const FILE_KEYS = {
|
|
20
|
-
|
|
21
|
-
apiKey: "
|
|
20
|
+
baseUrl: "MTHDS_API_URL",
|
|
21
|
+
apiKey: "MTHDS_API_KEY",
|
|
22
22
|
runner: "MTHDS_RUNNER",
|
|
23
23
|
telemetry: "DISABLE_TELEMETRY",
|
|
24
24
|
autoUpgrade: "MTHDS_AUTO_UPGRADE",
|
|
25
25
|
updateCheck: "MTHDS_UPDATE_CHECK",
|
|
26
26
|
};
|
|
27
|
+
/** Hosted default — host only; endpoints compose as `{base}/v1/{endpoint}`. */
|
|
28
|
+
export const DEFAULT_BASE_URL = "https://api.pipelex.com";
|
|
27
29
|
/** Defaults */
|
|
28
30
|
const DEFAULTS = {
|
|
29
31
|
runner: Runners.PIPELEX,
|
|
30
|
-
|
|
32
|
+
baseUrl: DEFAULT_BASE_URL,
|
|
31
33
|
apiKey: "",
|
|
32
34
|
telemetry: true,
|
|
33
35
|
autoUpgrade: false,
|
|
@@ -36,7 +38,7 @@ const DEFAULTS = {
|
|
|
36
38
|
/** Map from CLI flag names (kebab-case) to config keys */
|
|
37
39
|
const KEY_ALIASES = {
|
|
38
40
|
runner: "runner",
|
|
39
|
-
"
|
|
41
|
+
"base-url": "baseUrl",
|
|
40
42
|
"api-key": "apiKey",
|
|
41
43
|
telemetry: "telemetry",
|
|
42
44
|
"auto-upgrade": "autoUpgrade",
|
|
@@ -56,6 +58,29 @@ const INVERTED_BOOLEAN_KEYS = new Set([
|
|
|
56
58
|
/** Strings treated as truthy for boolean keys — used in both load and set paths */
|
|
57
59
|
const TRUTHY_STRINGS = new Set(["true", "1", "yes", "on"]);
|
|
58
60
|
export const VALID_KEYS = Object.keys(KEY_ALIASES);
|
|
61
|
+
/**
|
|
62
|
+
* A base URL must be HOST ONLY — http/https, no path, query, or fragment.
|
|
63
|
+
* The client composes `{base}/v1/{endpoint}`; a path-prefixed value (e.g. a
|
|
64
|
+
* leftover `.../runner/v1`) would produce malformed `/v1/v1/...` endpoints.
|
|
65
|
+
*/
|
|
66
|
+
export function isValidBaseUrl(value) {
|
|
67
|
+
let parsed;
|
|
68
|
+
try {
|
|
69
|
+
parsed = new URL(value);
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
if (parsed.protocol !== "http:" && parsed.protocol !== "https:")
|
|
75
|
+
return false;
|
|
76
|
+
if (parsed.pathname !== "/" && parsed.pathname !== "")
|
|
77
|
+
return false;
|
|
78
|
+
// Host only also means no embedded credentials — auth travels in the
|
|
79
|
+
// Authorization header (MTHDS_API_KEY), never in the URL.
|
|
80
|
+
if (parsed.username || parsed.password)
|
|
81
|
+
return false;
|
|
82
|
+
return !parsed.search && !parsed.hash;
|
|
83
|
+
}
|
|
59
84
|
export function resolveKey(cliKey) {
|
|
60
85
|
return KEY_ALIASES[cliKey];
|
|
61
86
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,OA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CAAC,SAAS,CAAC,CAAC;QACpD,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IACzD,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,sEAAsE;AAEtE,MAAM,UAAU,kBAAkB;IAChC,OAAO,UAAU,EAAE,CAAC,SAAS,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,OAAgB;IAClD,cAAc,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,kBAAkB;IAChC,OAAO,cAAc,CAAC,WAAW,CAAC,CAAC,MAAM,CAAC;AAC5C,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1 +1,27 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public SDK barrel — re-exports the MTHDS Protocol surface (`protocol/`) and
|
|
3
|
+
* the API runner + run-lifecycle extension (`runners/api/`).
|
|
4
|
+
*
|
|
5
|
+
* Structural split (protocol ⊥ runners) parity with `mthds-python`:
|
|
6
|
+
* - `mthds/client/*` is gone. The protocol interface + wire models live in
|
|
7
|
+
* `protocol/`; the API client/runner, lifecycle polling, and Dict-serialized
|
|
8
|
+
* concretes live in `runners/api/`.
|
|
9
|
+
* - The single run response `RunResult` is split into `RunResultExecute<T>`
|
|
10
|
+
* (execute — has `pipe_output`) and `RunResultStart` (start — id only).
|
|
11
|
+
*/
|
|
12
|
+
export { MthdsApiClient, DEFAULT_API_BASE_URL } from "./runners/api/client.js";
|
|
13
|
+
export type { MTHDSProtocol } from "./protocol/protocol.js";
|
|
14
|
+
export { PipelineRequestError } from "./protocol/exceptions.js";
|
|
15
|
+
export { ApiResponseError, ApiUnreachableError, ClientAuthenticationError, PipelineExecuteTimeoutError, RunFailedError, RunTimeoutError, RunStillRunningError, RunLifecycleUnavailableError, } from "./runners/api/exceptions.js";
|
|
16
|
+
export type { RunRequest, StartRequest, RunOptions, StartOptions, ExtensionOptions, } from "./protocol/options.js";
|
|
17
|
+
export { MTHDS_PROTOCOL_VERSION, MODEL_CATEGORIES } from "./protocol/models.js";
|
|
18
|
+
export type { RunResultExecute, RunResultStart, ModelCategory, ModelInfo, ModelDeck, ValidationReport, ValidationError, InvalidValidationReport, ValidationResult, VersionInfo, } from "./protocol/models.js";
|
|
19
|
+
export type { VariableMultiplicity, PipeOutputAbstract } from "./protocol/pipe_output.js";
|
|
20
|
+
export type { StuffContentOrData, PipelineInputs } from "./protocol/pipeline_inputs.js";
|
|
21
|
+
export { conceptRef } from "./protocol/concept.js";
|
|
22
|
+
export type { ConceptAbstract } from "./protocol/concept.js";
|
|
23
|
+
export type { StuffAbstract, StuffContentAbstract } from "./protocol/stuff.js";
|
|
24
|
+
export type { WorkingMemoryAbstract } from "./protocol/working_memory.js";
|
|
25
|
+
export { isTerminalRunStatus, isSuccessRunStatus } from "./runners/api/runs.js";
|
|
26
|
+
export type { RunStatus, RunPublic, RunRead, RunResults, RunResultState, WaitForResultOptions, } from "./runners/api/runs.js";
|
|
27
|
+
export type { DictStuff, DictWorkingMemory, DictPipeOutput, DictRunResultExecute, PipelexValidationReport, PipelexInvalidReport, PipelexValidationResult, ValidatedPipeEntry, DryRunStatus, ValidationErrorItem, ValidationErrorCategory, } from "./runners/api/models.js";
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Public SDK barrel — re-exports the MTHDS Protocol surface (`protocol/`) and
|
|
3
|
+
* the API runner + run-lifecycle extension (`runners/api/`).
|
|
4
|
+
*
|
|
5
|
+
* Structural split (protocol ⊥ runners) parity with `mthds-python`:
|
|
6
|
+
* - `mthds/client/*` is gone. The protocol interface + wire models live in
|
|
7
|
+
* `protocol/`; the API client/runner, lifecycle polling, and Dict-serialized
|
|
8
|
+
* concretes live in `runners/api/`.
|
|
9
|
+
* - The single run response `RunResult` is split into `RunResultExecute<T>`
|
|
10
|
+
* (execute — has `pipe_output`) and `RunResultStart` (start — id only).
|
|
11
|
+
*/
|
|
12
|
+
// ── API runner / client (runners/api) ────────────────────────────────
|
|
13
|
+
export { MthdsApiClient, DEFAULT_API_BASE_URL } from "./runners/api/client.js";
|
|
14
|
+
// ── Exceptions (protocol base + api-runner errors) ───────────────────
|
|
15
|
+
export { PipelineRequestError } from "./protocol/exceptions.js";
|
|
16
|
+
export { ApiResponseError, ApiUnreachableError, ClientAuthenticationError, PipelineExecuteTimeoutError, RunFailedError, RunTimeoutError, RunStillRunningError, RunLifecycleUnavailableError, } from "./runners/api/exceptions.js";
|
|
17
|
+
// ── Wire models (protocol) ───────────────────────────────────────────
|
|
18
|
+
export { MTHDS_PROTOCOL_VERSION, MODEL_CATEGORIES } from "./protocol/models.js";
|
|
19
|
+
// ── Abstract domain shapes (protocol — exact mirror of mthds-python) ──
|
|
20
|
+
export { conceptRef } from "./protocol/concept.js";
|
|
21
|
+
// ── Run lifecycle (runners/api — hosted extension, NOT protocol) ──────
|
|
22
|
+
export { isTerminalRunStatus, isSuccessRunStatus } from "./runners/api/runs.js";
|
|
2
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,wEAAwE;AACxE,OAAO,EAAE,cAAc,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAK/E,wEAAwE;AACxE,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,yBAAyB,EACzB,2BAA2B,EAC3B,cAAc,EACd,eAAe,EACf,oBAAoB,EACpB,4BAA4B,GAC7B,MAAM,6BAA6B,CAAC;AAWrC,wEAAwE;AACxE,OAAO,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAgBhF,yEAAyE;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAKnD,yEAAyE;AACzE,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Concept domain shape — exact mirror of `mthds/protocol/concept.py`
|
|
3
|
+
* (`ConceptAbstract`). The protocol-level abstract concept; runners deal in the
|
|
4
|
+
* Dict-serialized `concept` ref string (`runners/api/models.ts`).
|
|
5
|
+
*/
|
|
6
|
+
export interface ConceptAbstract {
|
|
7
|
+
code: string;
|
|
8
|
+
domain_code: string;
|
|
9
|
+
description: string;
|
|
10
|
+
structure_class_name: string;
|
|
11
|
+
refines?: string | null;
|
|
12
|
+
}
|
|
13
|
+
/** `{domain_code}.{code}` — python's `ConceptAbstract.concept_ref` derived property. */
|
|
14
|
+
export declare function conceptRef(concept: Pick<ConceptAbstract, "domain_code" | "code">): string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Concept domain shape — exact mirror of `mthds/protocol/concept.py`
|
|
3
|
+
* (`ConceptAbstract`). The protocol-level abstract concept; runners deal in the
|
|
4
|
+
* Dict-serialized `concept` ref string (`runners/api/models.ts`).
|
|
5
|
+
*/
|
|
6
|
+
/** `{domain_code}.{code}` — python's `ConceptAbstract.concept_ref` derived property. */
|
|
7
|
+
export function conceptRef(concept) {
|
|
8
|
+
return `${concept.domain_code}.${concept.code}`;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=concept.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"concept.js","sourceRoot":"","sources":["../../src/protocol/concept.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAUH,wFAAwF;AACxF,MAAM,UAAU,UAAU,CAAC,OAAsD;IAC/E,OAAO,GAAG,OAAO,CAAC,WAAW,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol-level exceptions — the base error every MTHDS runner error derives
|
|
3
|
+
* from. Mirrors `mthds/protocol/exceptions.py`. Runner-specific errors (API
|
|
4
|
+
* transport, run lifecycle) live in `runners/api/exceptions.ts`.
|
|
5
|
+
*/
|
|
6
|
+
export declare class PipelineRequestError extends Error {
|
|
7
|
+
constructor(message: string, options?: {
|
|
8
|
+
cause?: unknown;
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Protocol-level exceptions — the base error every MTHDS runner error derives
|
|
3
|
+
* from. Mirrors `mthds/protocol/exceptions.py`. Runner-specific errors (API
|
|
4
|
+
* transport, run lifecycle) live in `runners/api/exceptions.ts`.
|
|
5
|
+
*/
|
|
6
|
+
export class PipelineRequestError extends Error {
|
|
7
|
+
constructor(message, options) {
|
|
8
|
+
super(message, options);
|
|
9
|
+
this.name = "PipelineRequestError";
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../src/protocol/exceptions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IAC7C,YAAY,OAAe,EAAE,OAA6B;QACxD,KAAK,CAAC,OAAO,EAAE,OAAmC,CAAC,CAAC;QACpD,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAC;IACrC,CAAC;CACF"}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire models for the MTHDS Protocol — exact mirror of `mthds/protocol/models.py`
|
|
3
|
+
* (which mirrors `mthds-protocol.openapi.yaml`, the standard's normative artifact).
|
|
4
|
+
*
|
|
5
|
+
* POST /execute : -> RunResultExecute (200: pipeline_run_id + pipe_output)
|
|
6
|
+
* POST /start : -> RunResultStart (202: pipeline_run_id only)
|
|
7
|
+
* POST /validate : -> ValidationResult (200: discriminated on `is_valid`)
|
|
8
|
+
* GET /models : -> ModelDeck
|
|
9
|
+
* GET /version : -> VersionInfo
|
|
10
|
+
*
|
|
11
|
+
* Response models declare the protocol's BASE fields only and are
|
|
12
|
+
* extension-open: an implementation may return more, and those server-specific
|
|
13
|
+
* fields are preserved (via the index signature) — the response side of the
|
|
14
|
+
* same passthrough principle as the request-side `extra`.
|
|
15
|
+
*/
|
|
16
|
+
/** The MTHDS Protocol version this SDK implements (the MTHDS standard version). */
|
|
17
|
+
export declare const MTHDS_PROTOCOL_VERSION = "0.6.0";
|
|
18
|
+
/**
|
|
19
|
+
* `POST /execute` 200 — the completed run.
|
|
20
|
+
*
|
|
21
|
+
* Two base fields: the authoritative server-generated `pipeline_run_id` and
|
|
22
|
+
* the method's `pipe_output` (always present — a completed run has output).
|
|
23
|
+
* Generic in the output type so `protocol/` never names a runner-side concrete:
|
|
24
|
+
* the default `DictPipeOutput` binding (`DictRunResultExecute`) lives in
|
|
25
|
+
* `runners/api/models.ts`. Extension-open: anything more an implementation
|
|
26
|
+
* returns (a run state, timestamps, output naming) rides the index signature,
|
|
27
|
+
* never named by this SDK.
|
|
28
|
+
*/
|
|
29
|
+
export interface RunResultExecute<TPipeOutput = unknown> {
|
|
30
|
+
pipeline_run_id: string;
|
|
31
|
+
pipe_output: TPipeOutput;
|
|
32
|
+
/** Implementation extension fields — defined and documented by the server. */
|
|
33
|
+
[extension: string]: unknown;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* `POST /start` 202 (and the optional `/execute` 202 degrade) — the started
|
|
37
|
+
* run's authoritative `pipeline_run_id`, nothing else.
|
|
38
|
+
*
|
|
39
|
+
* A started run has no output yet; how it is delivered later (polling,
|
|
40
|
+
* callbacks, anything else) is implementation-defined and outside the
|
|
41
|
+
* protocol. Extension-open: an implementation may add its own fields (a
|
|
42
|
+
* workflow id, a created-at timestamp), preserved via the index signature.
|
|
43
|
+
*/
|
|
44
|
+
export interface RunResultStart {
|
|
45
|
+
pipeline_run_id: string;
|
|
46
|
+
/** Implementation extension fields — defined and documented by the server. */
|
|
47
|
+
[extension: string]: unknown;
|
|
48
|
+
}
|
|
49
|
+
/** Model categories accepted by the protocol's `GET /models?type=` filter. */
|
|
50
|
+
export type ModelCategory = "llm" | "extract" | "img_gen" | "search";
|
|
51
|
+
export declare const MODEL_CATEGORIES: readonly ModelCategory[];
|
|
52
|
+
/** One entry of the model deck (`ModelDeck.models[]`) — base fields + extensions. */
|
|
53
|
+
export interface ModelInfo {
|
|
54
|
+
name: string;
|
|
55
|
+
type?: ModelCategory | null;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The model deck a runner can route to — `GET /models`.
|
|
59
|
+
*
|
|
60
|
+
* The protocol's base is the `models` list; implementations may add their own
|
|
61
|
+
* routing metadata (aliases, fallback chains, anything else) as extensions,
|
|
62
|
+
* preserved via the index signature.
|
|
63
|
+
*/
|
|
64
|
+
export interface ModelDeck {
|
|
65
|
+
models: ModelInfo[];
|
|
66
|
+
/** Implementation extension fields (e.g. `aliases`, `waterfalls`). */
|
|
67
|
+
[extension: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Verdict of `POST /validate` for a VALID bundle — the `is_valid: true` arm of
|
|
71
|
+
* the 200-diagnostic response union ({@link ValidationResult}).
|
|
72
|
+
*
|
|
73
|
+
* `/validate` is a diagnostic endpoint: every verdict it can produce — valid,
|
|
74
|
+
* invalid, or valid-but-not-runnable — rides a **200**, discriminated in the
|
|
75
|
+
* body on `is_valid`. Non-2xx is reserved for the cases where *no verdict could
|
|
76
|
+
* be produced* (a malformed request body, an `mthds_sources` length mismatch,
|
|
77
|
+
* auth, a server fault) — those surface as `ApiResponseError`. The protocol
|
|
78
|
+
* declares no further body fields; implementations may include their own
|
|
79
|
+
* artifacts (parsed structures, graphs, anything else), preserved here as
|
|
80
|
+
* extension fields.
|
|
81
|
+
*/
|
|
82
|
+
export interface ValidationReport {
|
|
83
|
+
/** Discriminant of the valid arm of the 200 response union. */
|
|
84
|
+
is_valid: true;
|
|
85
|
+
/** Implementation extension fields (e.g. `bundle_blueprint`, `graph_spec`, `pipe_io_contracts`, `validated_pipes`, `pending_signatures`, `is_runnable`). */
|
|
86
|
+
[extension: string]: unknown;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* One structured diagnostic on an invalid verdict. The protocol fixes only the
|
|
90
|
+
* neutral `category` + `message`; an implementation narrows `category` to its own
|
|
91
|
+
* closed vocabulary and adds locators (see the Pipelex `ValidationErrorItem`,
|
|
92
|
+
* which extends this with `source`, `pipe_code`, `field_name`, and friends).
|
|
93
|
+
*/
|
|
94
|
+
export interface ValidationError {
|
|
95
|
+
category: string;
|
|
96
|
+
message: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Verdict of `POST /validate` for an INVALID bundle — the `is_valid: false` arm
|
|
100
|
+
* of the 200 response union.
|
|
101
|
+
*
|
|
102
|
+
* An invalid bundle is the *successful product* of a diagnostic call, not a
|
|
103
|
+
* transport failure (the request was well-formed; the bundle was not), so it
|
|
104
|
+
* rides a **200**. The structural artifacts of a valid report do not exist when
|
|
105
|
+
* load/parse/wiring failed, so this arm carries only the per-error diagnostics
|
|
106
|
+
* plus the runnability facts.
|
|
107
|
+
*/
|
|
108
|
+
export interface InvalidValidationReport {
|
|
109
|
+
/** Discriminant of the invalid arm. */
|
|
110
|
+
is_valid: false;
|
|
111
|
+
/** Per-error diagnostics — non-empty on every invalid verdict (even a parse-level failure yields one residual item). */
|
|
112
|
+
validation_errors: ValidationError[];
|
|
113
|
+
/** Outstanding signatures (best-effort; empty when no library could be assembled). */
|
|
114
|
+
pending_signatures: string[];
|
|
115
|
+
/** An invalid bundle is never runnable. */
|
|
116
|
+
is_runnable: false;
|
|
117
|
+
/** Human-readable summary of the verdict. */
|
|
118
|
+
message: string;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The discriminated 200 response of `POST /validate`, keyed on the mandatory
|
|
122
|
+
* `is_valid` field. A consumer pattern-matches that one field to learn the
|
|
123
|
+
* verdict — never inspecting a status code or catching an exception body. Only a
|
|
124
|
+
* *no-verdict* condition (non-2xx) throws.
|
|
125
|
+
*/
|
|
126
|
+
export type ValidationResult = ValidationReport | InvalidValidationReport;
|
|
127
|
+
/**
|
|
128
|
+
* Protocol + runner versions — `GET /version` (always public).
|
|
129
|
+
*
|
|
130
|
+
* The handshake clients use for feature detection. The protocol defines two
|
|
131
|
+
* base fields (`protocol_version`, optional `runner_version`); implementations
|
|
132
|
+
* may add their own identification (an `implementation` name, an underlying
|
|
133
|
+
* runtime version, anything else) as extensions, preserved via the index
|
|
134
|
+
* signature and read by the api runner's bare-runner detection.
|
|
135
|
+
*/
|
|
136
|
+
export interface VersionInfo {
|
|
137
|
+
protocol_version: string;
|
|
138
|
+
runner_version?: string | null;
|
|
139
|
+
/**
|
|
140
|
+
* Implementation package version — the field clients gate capabilities on
|
|
141
|
+
* (e.g. the VS Code extension's `MIN_API_IMPLEMENTATION_VERSION`). An
|
|
142
|
+
* extension field (the protocol declares only `protocol_version` /
|
|
143
|
+
* `runner_version`), typed here as the one well-known extension so consumers
|
|
144
|
+
* gate on it without reaching through the untyped index signature. Absent on
|
|
145
|
+
* a runner that does not advertise it.
|
|
146
|
+
*/
|
|
147
|
+
implementation_version?: string;
|
|
148
|
+
/** Further implementation extension fields (e.g. `implementation`, `runtime_version`). */
|
|
149
|
+
[extension: string]: unknown;
|
|
150
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Wire models for the MTHDS Protocol — exact mirror of `mthds/protocol/models.py`
|
|
3
|
+
* (which mirrors `mthds-protocol.openapi.yaml`, the standard's normative artifact).
|
|
4
|
+
*
|
|
5
|
+
* POST /execute : -> RunResultExecute (200: pipeline_run_id + pipe_output)
|
|
6
|
+
* POST /start : -> RunResultStart (202: pipeline_run_id only)
|
|
7
|
+
* POST /validate : -> ValidationResult (200: discriminated on `is_valid`)
|
|
8
|
+
* GET /models : -> ModelDeck
|
|
9
|
+
* GET /version : -> VersionInfo
|
|
10
|
+
*
|
|
11
|
+
* Response models declare the protocol's BASE fields only and are
|
|
12
|
+
* extension-open: an implementation may return more, and those server-specific
|
|
13
|
+
* fields are preserved (via the index signature) — the response side of the
|
|
14
|
+
* same passthrough principle as the request-side `extra`.
|
|
15
|
+
*/
|
|
16
|
+
/** The MTHDS Protocol version this SDK implements (the MTHDS standard version). */
|
|
17
|
+
export const MTHDS_PROTOCOL_VERSION = "0.6.0";
|
|
18
|
+
export const MODEL_CATEGORIES = [
|
|
19
|
+
"llm",
|
|
20
|
+
"extract",
|
|
21
|
+
"img_gen",
|
|
22
|
+
"search",
|
|
23
|
+
];
|
|
24
|
+
//# sourceMappingURL=models.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"models.js","sourceRoot":"","sources":["../../src/protocol/models.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,mFAAmF;AACnF,MAAM,CAAC,MAAM,sBAAsB,GAAG,OAAO,CAAC;AA0C9C,MAAM,CAAC,MAAM,gBAAgB,GAA6B;IACxD,KAAK;IACL,SAAS;IACT,SAAS;IACT,QAAQ;CACT,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MTHDS Protocol's request-argument surface — the named arguments of
|
|
3
|
+
* `execute` / `start`.
|
|
4
|
+
*
|
|
5
|
+
* The protocol has no request *model*: a runner takes the request's basic
|
|
6
|
+
* arguments as named parameters and serializes the wire body directly, merging
|
|
7
|
+
* any server-specific extension args (`extra`) as top-level properties. These
|
|
8
|
+
* option/request shapes are the TS expression of that argument surface.
|
|
9
|
+
*/
|
|
10
|
+
import type { VariableMultiplicity } from "./pipe_output.js";
|
|
11
|
+
import type { PipelineInputs } from "./pipeline_inputs.js";
|
|
12
|
+
/**
|
|
13
|
+
* Body of the protocol's `POST /execute` — mirrors `RunRequest` in
|
|
14
|
+
* `mthds-protocol.openapi.yaml`. At least one of `pipe_code` /
|
|
15
|
+
* `mthds_contents` is required.
|
|
16
|
+
*/
|
|
17
|
+
export interface RunRequest {
|
|
18
|
+
/** Code of the pipe to execute (registered, or defined in `mthds_contents`). */
|
|
19
|
+
pipe_code?: string | null;
|
|
20
|
+
/** MTHDS bundle contents to load (always an array, even for one file). */
|
|
21
|
+
mthds_contents?: string[] | null;
|
|
22
|
+
/** Method inputs: map of input name to content (loose here, strict in the runtime). */
|
|
23
|
+
inputs?: PipelineInputs | Record<string, unknown> | null;
|
|
24
|
+
/** Name of the output slot to return as the main output. */
|
|
25
|
+
output_name?: string | null;
|
|
26
|
+
/** Output multiplicity override (`false`/`true` or an exact count). */
|
|
27
|
+
output_multiplicity?: VariableMultiplicity | null;
|
|
28
|
+
/** Override for the dynamic output concept reference. */
|
|
29
|
+
dynamic_output_concept_ref?: string | null;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Body of the protocol's `POST /start` — the same basic arguments as `RunRequest`.
|
|
33
|
+
*
|
|
34
|
+
* The protocol declares no start-only request fields. Anything an
|
|
35
|
+
* implementation accepts on top (a client-supplied run id, anything else) is
|
|
36
|
+
* an extension arg — the server that defines it is the one that handles it;
|
|
37
|
+
* callers pass it through the generic `extra` option.
|
|
38
|
+
*/
|
|
39
|
+
export type StartRequest = RunRequest;
|
|
40
|
+
/**
|
|
41
|
+
* The generic extension passthrough: server-specific args merged into the
|
|
42
|
+
* request body as top-level properties — the server you call defines and
|
|
43
|
+
* handles them; this SDK only passes them through. Protocol args inside
|
|
44
|
+
* `extra` are rejected client-side.
|
|
45
|
+
*/
|
|
46
|
+
export interface ExtensionOptions {
|
|
47
|
+
extra?: Record<string, unknown> | null;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Options for `MTHDSProtocol.execute` — the `RunRequest` fields plus the
|
|
51
|
+
* generic `extra` extension passthrough. (The options surface and the wire
|
|
52
|
+
* body are intentionally the same shape.)
|
|
53
|
+
*/
|
|
54
|
+
export type RunOptions = RunRequest & ExtensionOptions;
|
|
55
|
+
/**
|
|
56
|
+
* Options for `MTHDSProtocol.start` — the `StartRequest` wire fields (the
|
|
57
|
+
* protocol's basic execution arguments) plus the generic `extra` extension
|
|
58
|
+
* passthrough (server-specific args, merged into the body).
|
|
59
|
+
*/
|
|
60
|
+
export type StartOptions = StartRequest & ExtensionOptions;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The MTHDS Protocol's request-argument surface — the named arguments of
|
|
3
|
+
* `execute` / `start`.
|
|
4
|
+
*
|
|
5
|
+
* The protocol has no request *model*: a runner takes the request's basic
|
|
6
|
+
* arguments as named parameters and serializes the wire body directly, merging
|
|
7
|
+
* any server-specific extension args (`extra`) as top-level properties. These
|
|
8
|
+
* option/request shapes are the TS expression of that argument surface.
|
|
9
|
+
*/
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/protocol/options.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipe-output domain shapes — exact mirror of `mthds/protocol/pipe_output.py`
|
|
3
|
+
* (`VariableMultiplicity`, `PipeOutputAbstract`). The Dict-serialized concrete
|
|
4
|
+
* (`DictPipeOutput`) is runner-side (`runners/api/models.ts`).
|
|
5
|
+
*/
|
|
6
|
+
import type { WorkingMemoryAbstract } from "./working_memory.js";
|
|
7
|
+
export type VariableMultiplicity = boolean | number;
|
|
8
|
+
export interface PipeOutputAbstract<TWorkingMemory extends WorkingMemoryAbstract = WorkingMemoryAbstract> {
|
|
9
|
+
working_memory: TWorkingMemory;
|
|
10
|
+
pipeline_run_id: string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipe-output domain shapes — exact mirror of `mthds/protocol/pipe_output.py`
|
|
3
|
+
* (`VariableMultiplicity`, `PipeOutputAbstract`). The Dict-serialized concrete
|
|
4
|
+
* (`DictPipeOutput`) is runner-side (`runners/api/models.ts`).
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=pipe_output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe_output.js","sourceRoot":"","sources":["../../src/protocol/pipe_output.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline input value shapes — exact mirror of `mthds/protocol/pipeline_inputs.py`
|
|
3
|
+
* (`StuffContentOrData`, `PipelineInputs`). The abstract input shapes only; the
|
|
4
|
+
* Dict-serialized concrete (`DictStuff`) is runner-side (`runners/api/models.ts`).
|
|
5
|
+
*/
|
|
6
|
+
import type { StuffContentAbstract } from "./stuff.js";
|
|
7
|
+
export type StuffContentOrData = string | string[] | StuffContentAbstract | StuffContentAbstract[] | Record<string, unknown>;
|
|
8
|
+
export type PipelineInputs = Record<string, StuffContentOrData>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pipeline input value shapes — exact mirror of `mthds/protocol/pipeline_inputs.py`
|
|
3
|
+
* (`StuffContentOrData`, `PipelineInputs`). The abstract input shapes only; the
|
|
4
|
+
* Dict-serialized concrete (`DictStuff`) is runner-side (`runners/api/models.ts`).
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=pipeline_inputs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipeline_inputs.js","sourceRoot":"","sources":["../../src/protocol/pipeline_inputs.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { RunOptions, StartOptions } from "./options.js";
|
|
2
|
+
import type { ModelCategory, ModelDeck, RunResultExecute, RunResultStart, ValidationResult, VersionInfo } from "./models.js";
|
|
3
|
+
/**
|
|
4
|
+
* The MTHDS Protocol — the contract every MTHDS runner implements. Exact
|
|
5
|
+
* mirror of `mthds/protocol/protocol.py` (`MTHDSProtocol`, generic in the
|
|
6
|
+
* pipe-output type).
|
|
7
|
+
*
|
|
8
|
+
* Mirrors the standard's five routes (`mthds-protocol.openapi.yaml`):
|
|
9
|
+
* `execute`, `start`, `validate`, `models`, `version`. A runner is just a
|
|
10
|
+
* runner: it executes and validates methods, and reports its model deck and
|
|
11
|
+
* version. Run polling is NOT part of the protocol — it is a hosted-API
|
|
12
|
+
* extension carried by `MthdsApiClient` and the `Runner` interface only.
|
|
13
|
+
*
|
|
14
|
+
* Generic in `PipeOutputT` (mirroring python's `Generic[PipeOutputT]`): the
|
|
15
|
+
* generic is the mechanism that keeps `protocol/` pure — `execute` returns
|
|
16
|
+
* `RunResultExecute<PipeOutputT>` without the protocol ever naming the
|
|
17
|
+
* runner-side `DictPipeOutput` concrete.
|
|
18
|
+
*/
|
|
19
|
+
export interface MTHDSProtocol<PipeOutputT = unknown> {
|
|
20
|
+
/**
|
|
21
|
+
* Execute a method synchronously and wait for its completion.
|
|
22
|
+
*
|
|
23
|
+
* Throws `RunStillRunningError` if the server answers 202 (the
|
|
24
|
+
* protocol's optional async degrade) instead of a final result.
|
|
25
|
+
*/
|
|
26
|
+
execute(options: RunOptions): Promise<RunResultExecute<PipeOutputT>>;
|
|
27
|
+
/**
|
|
28
|
+
* Start a method asynchronously without waiting for completion.
|
|
29
|
+
*
|
|
30
|
+
* Carries the protocol's basic arguments only; server-specific extension
|
|
31
|
+
* args ride `options.extra`. Returns `RunResultStart` — the authoritative
|
|
32
|
+
* server-generated `pipeline_run_id`, no output yet.
|
|
33
|
+
*/
|
|
34
|
+
start(options: StartOptions): Promise<RunResultStart>;
|
|
35
|
+
/**
|
|
36
|
+
* Parse, validate, and dry-run an MTHDS bundle.
|
|
37
|
+
*
|
|
38
|
+
* `/validate` is a diagnostic endpoint: it returns a {@link ValidationResult}
|
|
39
|
+
* discriminated on `is_valid` — the structural artifacts of a VALID bundle, or
|
|
40
|
+
* the `validation_errors[]` of an INVALID one. An invalid bundle is a produced
|
|
41
|
+
* verdict (a 200 on API runners), NOT a thrown error; only a *no-verdict*
|
|
42
|
+
* condition (a malformed request, auth, a server fault) throws. `allowSignatures`
|
|
43
|
+
* tolerates unimplemented pipe signatures (strict by default) — they surface as
|
|
44
|
+
* `pending_signatures` + `is_runnable`, never as an error.
|
|
45
|
+
*
|
|
46
|
+
* (A local CLI runner may instead raise on an invalid bundle rather than
|
|
47
|
+
* materialize the invalid arm — the union is the wire shape, not a guarantee
|
|
48
|
+
* that every runtime returns both arms.)
|
|
49
|
+
*/
|
|
50
|
+
validate(mthdsContents: string[], allowSignatures?: boolean): Promise<ValidationResult>;
|
|
51
|
+
/** The model deck this runner can route to, optionally filtered by category. */
|
|
52
|
+
models(category?: ModelCategory): Promise<ModelDeck>;
|
|
53
|
+
/** Protocol + implementation versions — the handshake for feature detection. */
|
|
54
|
+
version(): Promise<VersionInfo>;
|
|
55
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/
|
|
1
|
+
{"version":3,"file":"protocol.js","sourceRoot":"","sources":["../../src/protocol/protocol.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stuff domain shapes — exact mirror of `mthds/protocol/stuff.py`
|
|
3
|
+
* (`StuffAbstract`, `StuffContentAbstract`). The protocol-level abstract stuff;
|
|
4
|
+
* the Dict-serialized concrete (`DictStuff`) is runner-side
|
|
5
|
+
* (`runners/api/models.ts`).
|
|
6
|
+
*/
|
|
7
|
+
import type { ConceptAbstract } from "./concept.js";
|
|
8
|
+
/** Marker base for a stuff's content payload (mirrors python `StuffContentAbstract`). */
|
|
9
|
+
export interface StuffContentAbstract {
|
|
10
|
+
}
|
|
11
|
+
export interface StuffAbstract<TConcept extends ConceptAbstract = ConceptAbstract, TContent extends StuffContentAbstract = StuffContentAbstract> {
|
|
12
|
+
stuff_code: string;
|
|
13
|
+
stuff_name?: string | null;
|
|
14
|
+
concept: TConcept;
|
|
15
|
+
content: TContent;
|
|
16
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stuff domain shapes — exact mirror of `mthds/protocol/stuff.py`
|
|
3
|
+
* (`StuffAbstract`, `StuffContentAbstract`). The protocol-level abstract stuff;
|
|
4
|
+
* the Dict-serialized concrete (`DictStuff`) is runner-side
|
|
5
|
+
* (`runners/api/models.ts`).
|
|
6
|
+
*/
|
|
7
|
+
export {};
|
|
8
|
+
//# sourceMappingURL=stuff.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stuff.js","sourceRoot":"","sources":["
|
|
1
|
+
{"version":3,"file":"stuff.js","sourceRoot":"","sources":["../../src/protocol/stuff.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Working-memory domain shape — exact mirror of `mthds/protocol/working_memory.py`
|
|
3
|
+
* (`WorkingMemoryAbstract`). The Dict-serialized concrete (`DictWorkingMemory`)
|
|
4
|
+
* is runner-side (`runners/api/models.ts`).
|
|
5
|
+
*/
|
|
6
|
+
import type { StuffAbstract } from "./stuff.js";
|
|
7
|
+
export interface WorkingMemoryAbstract<TStuff extends StuffAbstract = StuffAbstract> {
|
|
8
|
+
root: Record<string, TStuff>;
|
|
9
|
+
aliases: Record<string, string>;
|
|
10
|
+
}
|