@sapiom/tools 0.14.1 → 0.16.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/CHANGELOG.md +27 -0
- package/README.md +1 -1
- package/dist/{esm/orchestrations → cjs/agents}/index.d.ts +15 -15
- package/dist/cjs/agents/index.d.ts.map +1 -0
- package/dist/cjs/{orchestrations → agents}/index.js +21 -24
- package/dist/cjs/agents/index.js.map +1 -0
- package/dist/cjs/client.d.ts +11 -11
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +4 -4
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/content-generation/index.d.ts +37 -7
- package/dist/cjs/content-generation/index.d.ts.map +1 -1
- package/dist/cjs/content-generation/index.js +12 -0
- package/dist/cjs/content-generation/index.js.map +1 -1
- package/dist/cjs/index.d.ts +11 -11
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +21 -21
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/{agent → models}/index.d.ts +26 -26
- package/dist/cjs/models/index.d.ts.map +1 -0
- package/dist/cjs/{agent → models}/index.js +24 -23
- package/dist/cjs/models/index.js.map +1 -0
- package/dist/cjs/stub/index.d.ts.map +1 -1
- package/dist/cjs/stub/index.js +44 -26
- package/dist/cjs/stub/index.js.map +1 -1
- package/dist/{cjs/orchestrations → esm/agents}/index.d.ts +15 -15
- package/dist/esm/agents/index.d.ts.map +1 -0
- package/dist/esm/{orchestrations → agents}/index.js +19 -22
- package/dist/esm/agents/index.js.map +1 -0
- package/dist/esm/client.d.ts +11 -11
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +8 -8
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/content-generation/index.d.ts +37 -7
- package/dist/esm/content-generation/index.d.ts.map +1 -1
- package/dist/esm/content-generation/index.js +12 -0
- package/dist/esm/content-generation/index.js.map +1 -1
- package/dist/esm/index.d.ts +11 -11
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +14 -14
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/{agent → models}/index.d.ts +26 -26
- package/dist/esm/models/index.d.ts.map +1 -0
- package/dist/esm/{agent → models}/index.js +22 -21
- package/dist/esm/models/index.js.map +1 -0
- package/dist/esm/stub/index.d.ts.map +1 -1
- package/dist/esm/stub/index.js +44 -26
- package/dist/esm/stub/index.js.map +1 -1
- package/dist/tsconfig.cjs.tsbuildinfo +1 -1
- package/dist/tsconfig.esm.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/src/{orchestrations → agents}/README.md +13 -13
- package/src/content-generation/README.md +20 -14
- package/dist/cjs/agent/index.d.ts.map +0 -1
- package/dist/cjs/agent/index.js.map +0 -1
- package/dist/cjs/orchestrations/index.d.ts.map +0 -1
- package/dist/cjs/orchestrations/index.js.map +0 -1
- package/dist/esm/agent/index.d.ts.map +0 -1
- package/dist/esm/agent/index.js.map +0 -1
- package/dist/esm/orchestrations/index.d.ts.map +0 -1
- package/dist/esm/orchestrations/index.js.map +0 -1
- /package/src/{agent → models}/README.md +0 -0
package/dist/cjs/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,YAAY,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAIvE,YAAY,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAEpD,OAAO,KAAK,SAAS,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAE/C,OAAO,KAAK,YAAY,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,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,EAAE,MAAM,mBAAmB,CAAC;AAE/D,OAAO,EACL,iBAAiB,EACjB,sBAAsB,GACvB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,KAAK,iBAAiB,MAAM,+BAA+B,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGpE,YAAY,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAExE,OAAO,EAAE,oBAAoB,EAAE,MAAM,+BAA+B,CAAC;AAErE,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC"}
|
package/dist/cjs/index.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.MemoryHttpError = exports.memory = exports.DomainsHttpError = exports.domains = exports.EmailHttpError = exports.email = exports.DatabaseHttpError = exports.database = exports.SearchHttpError = exports.search = exports.toVideoResumePayload = exports.VIDEO_RESULT_SIGNAL = exports.ContentGenerationHttpError = exports.contentGeneration = exports.FileStorageHttpError = exports.fileStorage = exports.
|
|
36
|
+
exports.MemoryHttpError = exports.memory = exports.DomainsHttpError = exports.domains = exports.EmailHttpError = exports.email = exports.DatabaseHttpError = exports.database = exports.SearchHttpError = exports.search = exports.toVideoResumePayload = exports.VIDEO_RESULT_SIGNAL = exports.ContentGenerationHttpError = exports.contentGeneration = exports.FileStorageHttpError = exports.fileStorage = exports.AgentResultSchemaError = exports.agentResultSchema = exports.schedules = exports.AGENTS_RESULT_SIGNAL = exports.agents = exports.ModelRunResultSchemaError = exports.modelRunResultSchema = exports.MODEL_RUN_RESULT_SIGNAL = exports.EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX = exports.toResumePayload = exports.CodingResultSchemaError = exports.codingResultSchema = exports.CODING_RESULT_SIGNAL = exports.models = exports.Repository = exports.repositories = exports.Sandbox = exports.sandboxes = exports.createClientFromEnv = exports.createClient = void 0;
|
|
37
37
|
/**
|
|
38
38
|
* `@sapiom/tools` — the typed Sapiom capability client.
|
|
39
39
|
*
|
|
@@ -56,35 +56,35 @@ Object.defineProperty(exports, "Sandbox", { enumerable: true, get: function () {
|
|
|
56
56
|
exports.repositories = __importStar(require("./repositories/index.js"));
|
|
57
57
|
var index_js_2 = require("./repositories/index.js");
|
|
58
58
|
Object.defineProperty(exports, "Repository", { enumerable: true, get: function () { return index_js_2.Repository; } });
|
|
59
|
-
exports.
|
|
60
|
-
// Surfaced top-level for the static `pause: { signal }` decl on
|
|
61
|
-
var index_js_3 = require("./
|
|
59
|
+
exports.models = __importStar(require("./models/index.js"));
|
|
60
|
+
// Surfaced top-level for the static `pause: { signal }` decl on an agent step.
|
|
61
|
+
var index_js_3 = require("./models/index.js");
|
|
62
62
|
Object.defineProperty(exports, "CODING_RESULT_SIGNAL", { enumerable: true, get: function () { return index_js_3.CODING_RESULT_SIGNAL; } });
|
|
63
63
|
// Validate / build a `CodingResultPayload`, and the env `type` whose `id` is a
|
|
64
64
|
// sandbox name for `sandboxes.attach(id)`.
|
|
65
|
-
var index_js_4 = require("./
|
|
65
|
+
var index_js_4 = require("./models/index.js");
|
|
66
66
|
Object.defineProperty(exports, "codingResultSchema", { enumerable: true, get: function () { return index_js_4.codingResultSchema; } });
|
|
67
67
|
Object.defineProperty(exports, "CodingResultSchemaError", { enumerable: true, get: function () { return index_js_4.CodingResultSchemaError; } });
|
|
68
68
|
Object.defineProperty(exports, "toResumePayload", { enumerable: true, get: function () { return index_js_4.toResumePayload; } });
|
|
69
69
|
Object.defineProperty(exports, "EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX", { enumerable: true, get: function () { return index_js_4.EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX; } });
|
|
70
|
-
// Default (instant, in-server)
|
|
70
|
+
// Default (instant, in-server) model — `models.run` / `models.launch`. Signal const
|
|
71
71
|
// for a step's static `pause: { signal }` decl; the result payload shape + schema
|
|
72
|
-
// for a step resumed from `pauseUntilSignal(
|
|
73
|
-
var index_js_5 = require("./
|
|
74
|
-
Object.defineProperty(exports, "
|
|
75
|
-
var index_js_6 = require("./
|
|
76
|
-
Object.defineProperty(exports, "
|
|
77
|
-
Object.defineProperty(exports, "
|
|
78
|
-
exports.
|
|
79
|
-
// Surfaced top-level for the static `pause: { signal }` decl on
|
|
80
|
-
var index_js_7 = require("./
|
|
81
|
-
Object.defineProperty(exports, "
|
|
82
|
-
// schedules — create/manage cron + one-off triggers for a deployed
|
|
72
|
+
// for a step resumed from `pauseUntilSignal(modelHandle, …)`.
|
|
73
|
+
var index_js_5 = require("./models/index.js");
|
|
74
|
+
Object.defineProperty(exports, "MODEL_RUN_RESULT_SIGNAL", { enumerable: true, get: function () { return index_js_5.MODEL_RUN_RESULT_SIGNAL; } });
|
|
75
|
+
var index_js_6 = require("./models/index.js");
|
|
76
|
+
Object.defineProperty(exports, "modelRunResultSchema", { enumerable: true, get: function () { return index_js_6.modelRunResultSchema; } });
|
|
77
|
+
Object.defineProperty(exports, "ModelRunResultSchemaError", { enumerable: true, get: function () { return index_js_6.ModelRunResultSchemaError; } });
|
|
78
|
+
exports.agents = __importStar(require("./agents/index.js"));
|
|
79
|
+
// Surfaced top-level for the static `pause: { signal }` decl on an agent step.
|
|
80
|
+
var index_js_7 = require("./agents/index.js");
|
|
81
|
+
Object.defineProperty(exports, "AGENTS_RESULT_SIGNAL", { enumerable: true, get: function () { return index_js_7.AGENTS_RESULT_SIGNAL; } });
|
|
82
|
+
// schedules — create/manage cron + one-off triggers for a deployed agent.
|
|
83
83
|
exports.schedules = __importStar(require("./schedules/index.js"));
|
|
84
|
-
// Validate an
|
|
85
|
-
var index_js_8 = require("./
|
|
86
|
-
Object.defineProperty(exports, "
|
|
87
|
-
Object.defineProperty(exports, "
|
|
84
|
+
// Validate an AgentRunResultPayload at the resume boundary.
|
|
85
|
+
var index_js_8 = require("./agents/index.js");
|
|
86
|
+
Object.defineProperty(exports, "agentResultSchema", { enumerable: true, get: function () { return index_js_8.agentResultSchema; } });
|
|
87
|
+
Object.defineProperty(exports, "AgentResultSchemaError", { enumerable: true, get: function () { return index_js_8.AgentResultSchemaError; } });
|
|
88
88
|
exports.fileStorage = __importStar(require("./file-storage/index.js"));
|
|
89
89
|
var index_js_9 = require("./file-storage/index.js");
|
|
90
90
|
Object.defineProperty(exports, "FileStorageHttpError", { enumerable: true, get: function () { return index_js_9.FileStorageHttpError; } });
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;GAYG;AACH,yCAAgE;AAAvD,yGAAA,YAAY,OAAA;AAAE,gHAAA,mBAAmB,OAAA;AAQ1C,kEAAkD;AAClD,iDAA+C;AAAtC,mGAAA,OAAO,OAAA;AAEhB,wEAAwD;AACxD,oDAAqD;AAA5C,sGAAA,UA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AChD,iDAAwD;AAA/C,8GAAA,iBAAiB,OAAA;AAE1B,0DAA0C;AAC1C,8CAAkD;AAAzC,2GAAA,cAAc,OAAA;AAEvB,8DAA8C;AAC9C,gDAAsD;AAA7C,6GAAA,gBAAgB,OAAA;AAEzB,4DAA4C;AAC5C,+CAAoD;AAA3C,4GAAA,eAAe,OAAA"}
|
|
@@ -30,8 +30,8 @@ import type { Repository } from "../repositories/index.js";
|
|
|
30
30
|
* branches). A workflow step paused on a coding-run handle resumes on this; it is
|
|
31
31
|
* the value carried in the handle's `dispatch.resultSignal`.
|
|
32
32
|
*/
|
|
33
|
-
export declare const CODING_RESULT_SIGNAL = "
|
|
34
|
-
/** Run lifecycle, mirrored from the gateway's `
|
|
33
|
+
export declare const CODING_RESULT_SIGNAL = "models.coding.result";
|
|
34
|
+
/** Run lifecycle, mirrored from the gateway's `ModelsRunStatus`. */
|
|
35
35
|
export type RunStatus = "pending" | "queued" | "running" | "completed" | "failed";
|
|
36
36
|
export interface CodingRunSpec {
|
|
37
37
|
/** Natural-language instruction for the coding agent. */
|
|
@@ -160,15 +160,15 @@ export declare const coding: {
|
|
|
160
160
|
* paused on an agent-run handle resumes on this; it's the handle's
|
|
161
161
|
* `dispatch.resultSignal`.
|
|
162
162
|
*/
|
|
163
|
-
export declare const
|
|
164
|
-
/** Run lifecycle, mirrored from the gateway's `
|
|
165
|
-
export type
|
|
163
|
+
export declare const MODEL_RUN_RESULT_SIGNAL = "models.run.result";
|
|
164
|
+
/** Run lifecycle, mirrored from the gateway's `ModelRunStatus` (no `queued`). */
|
|
165
|
+
export type ModelRunStatus = "pending" | "running" | "completed" | "failed";
|
|
166
166
|
/** A remote MCP server (Streamable HTTP) the agent may call tools on. */
|
|
167
|
-
export interface
|
|
167
|
+
export interface ModelMcp {
|
|
168
168
|
url: string;
|
|
169
169
|
headers?: Record<string, string>;
|
|
170
170
|
}
|
|
171
|
-
export interface
|
|
171
|
+
export interface ModelRunSpec {
|
|
172
172
|
/** The prompt for the agent. */
|
|
173
173
|
prompt: string;
|
|
174
174
|
/** System prompt steering the agent. */
|
|
@@ -178,9 +178,9 @@ export interface AgentRunSpec {
|
|
|
178
178
|
/** Max output tokens per turn. */
|
|
179
179
|
maxTokens?: number;
|
|
180
180
|
/** Remote MCP servers the agent may call tools on (network round-trip per call). */
|
|
181
|
-
mcps?:
|
|
181
|
+
mcps?: ModelMcp[];
|
|
182
182
|
}
|
|
183
|
-
export interface
|
|
183
|
+
export interface ModelRunOutcome {
|
|
184
184
|
success: boolean;
|
|
185
185
|
stopReason: string;
|
|
186
186
|
turns: number;
|
|
@@ -189,44 +189,44 @@ export interface AgentRunOutcome {
|
|
|
189
189
|
costUsd: number;
|
|
190
190
|
usage: CodingRunUsage;
|
|
191
191
|
}
|
|
192
|
-
export interface
|
|
192
|
+
export interface ModelRunError {
|
|
193
193
|
message: string;
|
|
194
194
|
}
|
|
195
|
-
export interface
|
|
195
|
+
export interface ModelRunResult {
|
|
196
196
|
runId: string;
|
|
197
|
-
status:
|
|
197
|
+
status: ModelRunStatus;
|
|
198
198
|
/** The agent's final text output (null while non-terminal). */
|
|
199
199
|
output: string | null;
|
|
200
|
-
result:
|
|
201
|
-
error:
|
|
200
|
+
result: ModelRunOutcome | null;
|
|
201
|
+
error: ModelRunError | null;
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
204
|
* A launched-but-not-awaited instant run. Satisfies {@link DispatchHandle}, so it
|
|
205
205
|
* can be handed to `pauseUntilSignal(handle, { resumeStep })` — or `wait()`-ed
|
|
206
206
|
* inline. Unlike coding there is no `sandbox` (the loop runs in-server).
|
|
207
207
|
*/
|
|
208
|
-
export interface
|
|
208
|
+
export interface ModelRunHandle extends DispatchHandle {
|
|
209
209
|
runId: string;
|
|
210
|
-
status(): Promise<
|
|
210
|
+
status(): Promise<ModelRunStatus>;
|
|
211
211
|
wait(opts?: {
|
|
212
212
|
timeoutMs?: number;
|
|
213
213
|
pollMs?: number;
|
|
214
|
-
}): Promise<
|
|
214
|
+
}): Promise<ModelRunResult>;
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
217
|
* The instant run's terminal result as it arrives at a step resumed from
|
|
218
218
|
* `pauseUntilSignal(runHandle, { resumeStep })` — the signal payload delivered as
|
|
219
219
|
* that step's `input`. No live handles cross the wire, so it equals
|
|
220
|
-
* {@link
|
|
220
|
+
* {@link ModelRunResult}. Annotate a resumed step's input with this.
|
|
221
221
|
*/
|
|
222
|
-
export type
|
|
223
|
-
/** Thrown by {@link
|
|
224
|
-
export declare class
|
|
222
|
+
export type ModelRunResultPayload = ModelRunResult;
|
|
223
|
+
/** Thrown by {@link modelRunResultSchema}.parse on a malformed resume payload. */
|
|
224
|
+
export declare class ModelRunResultSchemaError extends Error {
|
|
225
225
|
}
|
|
226
|
-
/** Runtime validator for {@link
|
|
227
|
-
export declare const
|
|
228
|
-
parse(value: unknown):
|
|
226
|
+
/** Runtime validator for {@link ModelRunResultPayload}. */
|
|
227
|
+
export declare const modelRunResultSchema: {
|
|
228
|
+
parse(value: unknown): ModelRunResultPayload;
|
|
229
229
|
};
|
|
230
|
-
export declare function launch(spec:
|
|
231
|
-
export declare function run(spec:
|
|
230
|
+
export declare function launch(spec: ModelRunSpec, transport?: Transport, baseUrl?: string): Promise<ModelRunHandle>;
|
|
231
|
+
export declare function run(spec: ModelRunSpec, transport?: Transport, baseUrl?: string): Promise<ModelRunResult>;
|
|
232
232
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAA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AAM,EAAE,eAAe,GAAG,IAAI,CAAC;IAC/B,KAAK,EAAE,aAAa,GAAG,IAAI,CAAC;CAC7B;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAe,SAAQ,cAAc;IACpD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI,CAAC,EAAE;QAAE,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;CAC/E;AAED;;;;;GAKG;AACH,MAAM,MAAM,qBAAqB,GAAG,cAAc,CAAC;AAEnD,kFAAkF;AAClF,qBAAa,yBAA0B,SAAQ,KAAK;CAAG;AAEvD,2DAA2D;AAC3D,eAAO,MAAM,oBAAoB;iBAClB,OAAO,GAAG,qBAAqB;CAc7C,CAAC;AA6DF,wBAAsB,MAAM,CAC1B,IAAI,EAAE,YAAY,EAClB,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,cAAc,CAAC,CAyCzB;AAED,wBAAsB,GAAG,CACvB,IAAI,EAAE,YAAY,EAClB,SAAS,GAAE,SAA8B,EACzC,OAAO,SAAmB,GACzB,OAAO,CAAC,cAAc,CAAC,CAGzB"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.modelRunResultSchema = exports.ModelRunResultSchemaError = exports.MODEL_RUN_RESULT_SIGNAL = exports.coding = exports.codingResultSchema = exports.CodingResultSchemaError = exports.EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX = exports.CODING_RESULT_SIGNAL = void 0;
|
|
4
4
|
exports.toResumePayload = toResumePayload;
|
|
5
5
|
exports.codingLaunch = codingLaunch;
|
|
6
6
|
exports.codingRun = codingRun;
|
|
@@ -29,16 +29,17 @@ exports.run = run;
|
|
|
29
29
|
* wire; this module maps them to the camelCase SDK surface below.
|
|
30
30
|
*/
|
|
31
31
|
const index_js_1 = require("../_client/index.js");
|
|
32
|
-
const service_url_js_1 = require("../_client/service-url.js");
|
|
33
32
|
const index_js_2 = require("../sandboxes/index.js");
|
|
34
|
-
const DEFAULT_BASE_URL =
|
|
33
|
+
const DEFAULT_BASE_URL = process.env.SAPIOM_MODELS_URL ??
|
|
34
|
+
process.env.SAPIOM_TOOLS_BASE ??
|
|
35
|
+
"https://tools.sapiom.ai";
|
|
35
36
|
/**
|
|
36
37
|
* Capability-stable signal a coding run fires when it reaches a terminal state
|
|
37
38
|
* (completed OR failed — it carries the result either way, the resumed step
|
|
38
39
|
* branches). A workflow step paused on a coding-run handle resumes on this; it is
|
|
39
40
|
* the value carried in the handle's `dispatch.resultSignal`.
|
|
40
41
|
*/
|
|
41
|
-
exports.CODING_RESULT_SIGNAL = "
|
|
42
|
+
exports.CODING_RESULT_SIGNAL = "models.coding.result";
|
|
42
43
|
const TERMINAL = new Set(["completed", "failed"]);
|
|
43
44
|
/** Execution-environment `type` for a remote cloud sandbox; its `id` is the sandbox name. */
|
|
44
45
|
exports.EXECUTION_ENVIRONMENT_BLAXEL_SANDBOX = "blaxel_sandbox";
|
|
@@ -171,7 +172,7 @@ function buildBody(spec) {
|
|
|
171
172
|
}
|
|
172
173
|
async function codingLaunch(spec, transport = (0, index_js_1.defaultTransport)(), baseUrl = DEFAULT_BASE_URL) {
|
|
173
174
|
// 202 + a launch document; the execution_environment relationship is always present.
|
|
174
|
-
const doc = await transport.request(`${baseUrl}/v1/coding/runs`, {
|
|
175
|
+
const doc = await transport.request(`${baseUrl}/models/v1/coding/runs`, {
|
|
175
176
|
method: "POST",
|
|
176
177
|
body: JSON.stringify(buildBody(spec)),
|
|
177
178
|
headers: workflowResumeHeaders(transport.resumeToken),
|
|
@@ -182,7 +183,7 @@ async function codingLaunch(spec, transport = (0, index_js_1.defaultTransport)()
|
|
|
182
183
|
// environment the run provisioned (its id is the sandbox name) so later steps
|
|
183
184
|
// can act on it.
|
|
184
185
|
const sandbox = spec.sandbox ?? index_js_2.Sandbox.attach(envId ?? runId, {}, transport);
|
|
185
|
-
const fetchDoc = () => transport.request(`${baseUrl}/v1/coding/runs/${encodeURIComponent(runId)}`);
|
|
186
|
+
const fetchDoc = () => transport.request(`${baseUrl}/models/v1/coding/runs/${encodeURIComponent(runId)}`);
|
|
186
187
|
const toResult = (d) => ({
|
|
187
188
|
runId,
|
|
188
189
|
status: d.data.attributes.status,
|
|
@@ -236,17 +237,17 @@ exports.coding = { run: codingRun, launch: codingLaunch };
|
|
|
236
237
|
* paused on an agent-run handle resumes on this; it's the handle's
|
|
237
238
|
* `dispatch.resultSignal`.
|
|
238
239
|
*/
|
|
239
|
-
exports.
|
|
240
|
-
const
|
|
241
|
-
/** Thrown by {@link
|
|
242
|
-
class
|
|
240
|
+
exports.MODEL_RUN_RESULT_SIGNAL = "models.run.result";
|
|
241
|
+
const MODEL_TERMINAL = new Set(["completed", "failed"]);
|
|
242
|
+
/** Thrown by {@link modelRunResultSchema}.parse on a malformed resume payload. */
|
|
243
|
+
class ModelRunResultSchemaError extends Error {
|
|
243
244
|
}
|
|
244
|
-
exports.
|
|
245
|
-
/** Runtime validator for {@link
|
|
246
|
-
exports.
|
|
245
|
+
exports.ModelRunResultSchemaError = ModelRunResultSchemaError;
|
|
246
|
+
/** Runtime validator for {@link ModelRunResultPayload}. */
|
|
247
|
+
exports.modelRunResultSchema = {
|
|
247
248
|
parse(value) {
|
|
248
249
|
const fail = (msg) => {
|
|
249
|
-
throw new
|
|
250
|
+
throw new ModelRunResultSchemaError(`invalid agent run result payload: ${msg}`);
|
|
250
251
|
};
|
|
251
252
|
if (!value || typeof value !== "object")
|
|
252
253
|
fail("not an object");
|
|
@@ -254,7 +255,7 @@ exports.agentRunResultSchema = {
|
|
|
254
255
|
if (typeof v.runId !== "string")
|
|
255
256
|
fail("runId must be a string");
|
|
256
257
|
if (!["pending", "running", "completed", "failed"].includes(v.status))
|
|
257
|
-
fail("status must be a valid
|
|
258
|
+
fail("status must be a valid ModelRunStatus");
|
|
258
259
|
if (v.output !== null && typeof v.output !== "string")
|
|
259
260
|
fail("output must be a string or null");
|
|
260
261
|
if (v.result !== null && (typeof v.result !== "object" || !v.result))
|
|
@@ -264,7 +265,7 @@ exports.agentRunResultSchema = {
|
|
|
264
265
|
return value;
|
|
265
266
|
},
|
|
266
267
|
};
|
|
267
|
-
function
|
|
268
|
+
function mapModelResult(r) {
|
|
268
269
|
if (!r)
|
|
269
270
|
return null;
|
|
270
271
|
return {
|
|
@@ -283,7 +284,7 @@ function mapAgentResult(r) {
|
|
|
283
284
|
},
|
|
284
285
|
};
|
|
285
286
|
}
|
|
286
|
-
function
|
|
287
|
+
function buildModelBody(spec) {
|
|
287
288
|
return {
|
|
288
289
|
prompt: spec.prompt,
|
|
289
290
|
system: spec.system,
|
|
@@ -293,25 +294,25 @@ function buildAgentBody(spec) {
|
|
|
293
294
|
};
|
|
294
295
|
}
|
|
295
296
|
async function launch(spec, transport = (0, index_js_1.defaultTransport)(), baseUrl = DEFAULT_BASE_URL) {
|
|
296
|
-
const doc = await transport.request(`${baseUrl}/v1/
|
|
297
|
+
const doc = await transport.request(`${baseUrl}/models/v1/runs`, {
|
|
297
298
|
method: "POST",
|
|
298
|
-
body: JSON.stringify(
|
|
299
|
+
body: JSON.stringify(buildModelBody(spec)),
|
|
299
300
|
headers: workflowResumeHeaders(transport.resumeToken),
|
|
300
301
|
});
|
|
301
302
|
const runId = doc.data.id;
|
|
302
|
-
const fetchDoc = () => transport.request(`${baseUrl}/v1/
|
|
303
|
+
const fetchDoc = () => transport.request(`${baseUrl}/models/v1/runs/${encodeURIComponent(runId)}`);
|
|
303
304
|
const toResult = (d) => ({
|
|
304
305
|
runId,
|
|
305
306
|
status: d.data.attributes.status,
|
|
306
307
|
output: d.data.attributes.output ?? null,
|
|
307
|
-
result:
|
|
308
|
+
result: mapModelResult(d.data.attributes.result),
|
|
308
309
|
error: d.data.attributes.error ?? null,
|
|
309
310
|
});
|
|
310
311
|
return {
|
|
311
312
|
runId,
|
|
312
313
|
// Framework plumbing for `pauseUntilSignal` — correlationId is the run id (the
|
|
313
314
|
// join key x402 echoes back when it forwards completion).
|
|
314
|
-
dispatch: { correlationId: runId, resultSignal: exports.
|
|
315
|
+
dispatch: { correlationId: runId, resultSignal: exports.MODEL_RUN_RESULT_SIGNAL },
|
|
315
316
|
async status() {
|
|
316
317
|
return (await fetchDoc()).data.attributes.status;
|
|
317
318
|
},
|
|
@@ -320,7 +321,7 @@ async function launch(spec, transport = (0, index_js_1.defaultTransport)(), base
|
|
|
320
321
|
// eslint-disable-next-line no-constant-condition
|
|
321
322
|
while (true) {
|
|
322
323
|
const d = await fetchDoc();
|
|
323
|
-
if (
|
|
324
|
+
if (MODEL_TERMINAL.has(d.data.attributes.status))
|
|
324
325
|
return toResult(d);
|
|
325
326
|
if (Date.now() > deadline) {
|
|
326
327
|
throw new Error(`agent run ${runId} timed out after ${timeoutMs}ms (last status: ${d.data.attributes.status})`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/models/index.ts"],"names":[],"mappings":";;;AA8IA,0CAYC;AAqKD,oCAuDC;AAED,8BAOC;AAwKD,wBA6CC;AAED,kBAOC;AA7lBD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,kDAAkE;AAElE,oDAAgD;AAGhD,MAAM,gBAAgB,GACpB,OAAO,CAAC,GAAG,CAAC,iBAAiB;IAC7B,OAAO,CAAC,GAAG,CAAC,iBAAiB;IAC7B,yBAAyB,CAAC;AAE5B;;;;;GAKG;AACU,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAS3D,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAY,CAAC,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC;AAkD7D,6FAA6F;AAChF,QAAA,oCAAoC,GAAG,gBA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AC,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC;IACtD,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;AACvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stub/index.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAqD3C,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,MAAM,CAChC,MAAM,EACN,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAC5C,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAqXD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,iBAAsB,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/stub/index.ts"],"names":[],"mappings":"AAqCA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAqD3C,4EAA4E;AAC5E,MAAM,MAAM,aAAa,GAAG,MAAM,CAChC,MAAM,EACN,OAAO,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,OAAO,EAAE,KAAK,OAAO,CAAC,CAC5C,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACvB;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CACxB;AAqXD;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,iBAAsB,GAAG,MAAM,CA4vBrE"}
|
package/dist/cjs/stub/index.js
CHANGED
|
@@ -16,13 +16,13 @@ exports.createStubClient = createStubClient;
|
|
|
16
16
|
* real handle classes, so a call to a method that doesn't exist throws.
|
|
17
17
|
*
|
|
18
18
|
* Overrides are keyed by capability path — namespace methods by their dotted
|
|
19
|
-
* path (`repositories.list`, `
|
|
19
|
+
* path (`repositories.list`, `models.coding.run`), handle methods by
|
|
20
20
|
* `<handle>.<method>` (`repository.pushFromSandbox`, `sandbox.exec`). A value
|
|
21
21
|
* replaces that capability's default; a function `(…args) => value` computes it
|
|
22
22
|
* from the call arguments.
|
|
23
23
|
*/
|
|
24
|
-
const index_js_1 = require("../
|
|
25
|
-
const index_js_2 = require("../
|
|
24
|
+
const index_js_1 = require("../models/index.js");
|
|
25
|
+
const index_js_2 = require("../agents/index.js");
|
|
26
26
|
const index_js_3 = require("../repositories/index.js");
|
|
27
27
|
const index_js_4 = require("../sandboxes/index.js");
|
|
28
28
|
const index_js_5 = require("../content-generation/index.js");
|
|
@@ -88,8 +88,8 @@ function resolve(overrides, paths, args, fallback) {
|
|
|
88
88
|
* The stub keys a dispatched capability accepts, in precedence order: the
|
|
89
89
|
* method actually called (`<ns>.launch`) wins, then the shared blocking-result
|
|
90
90
|
* key (`<ns>.run`) that produces the same payload. Lets an author stub the key
|
|
91
|
-
* matching the call they wrote — `
|
|
92
|
-
* `
|
|
91
|
+
* matching the call they wrote — `models.coding.launch` — while the canonical
|
|
92
|
+
* `models.coding.run` keeps working for both `run()` and `launch()`. Uniform
|
|
93
93
|
* across the dispatchable/pause family (coding today; deep research,
|
|
94
94
|
* sub-workflows, browser sessions later).
|
|
95
95
|
*/
|
|
@@ -286,10 +286,10 @@ function stubAgentResult() {
|
|
|
286
286
|
error: null,
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function stubModelRunHandle(overrides, correlationId, result) {
|
|
290
290
|
const handle = {
|
|
291
291
|
runId: correlationId,
|
|
292
|
-
dispatch: { correlationId, resultSignal: index_js_1.
|
|
292
|
+
dispatch: { correlationId, resultSignal: index_js_1.MODEL_RUN_RESULT_SIGNAL },
|
|
293
293
|
status: () => Promise.resolve(result.status),
|
|
294
294
|
wait: () => Promise.resolve(result),
|
|
295
295
|
};
|
|
@@ -306,15 +306,15 @@ function createStubClient(opts = {}) {
|
|
|
306
306
|
const r = (paths, args, fallback) => resolve(overrides, paths, args, fallback);
|
|
307
307
|
// Resolve a coding run result, then re-wrap its `sandbox` as a handle so the
|
|
308
308
|
// blocking `run()` path keeps a method-capable Sandbox even when the result was
|
|
309
|
-
// overridden with plain JSON. `keys` lets `launch()` accept `
|
|
310
|
-
// (the call the author wrote) as well as the shared `
|
|
309
|
+
// overridden with plain JSON. `keys` lets `launch()` accept `models.coding.launch`
|
|
310
|
+
// (the call the author wrote) as well as the shared `models.coding.run`.
|
|
311
311
|
const resolveCodingResult = (spec, keys) => {
|
|
312
312
|
const res = r(keys, [spec], () => stubCodingResult(overrides));
|
|
313
313
|
return { ...res, sandbox: asSandbox(res.sandbox, overrides) };
|
|
314
314
|
};
|
|
315
315
|
// Default (instant) agent result — no sandbox to re-wrap, so it's the resolved
|
|
316
|
-
// value as-is. `keys` lets `launch()` accept `
|
|
317
|
-
const
|
|
316
|
+
// value as-is. `keys` lets `launch()` accept `models.launch` and `models.run`.
|
|
317
|
+
const resolveModelResult = (spec, keys) => r(keys, [spec], () => stubAgentResult());
|
|
318
318
|
const client = {
|
|
319
319
|
sandboxes: {
|
|
320
320
|
create: (sandboxOpts) => Promise.resolve(asSandbox(r("sandboxes.create", [sandboxOpts], () => ({
|
|
@@ -336,27 +336,27 @@ function createStubClient(opts = {}) {
|
|
|
336
336
|
cloneUrl,
|
|
337
337
|
})), overrides),
|
|
338
338
|
},
|
|
339
|
-
|
|
340
|
-
run: (spec) => Promise.resolve(
|
|
339
|
+
models: {
|
|
340
|
+
run: (spec) => Promise.resolve(resolveModelResult(spec, "models.run")),
|
|
341
341
|
launch: (spec) => {
|
|
342
342
|
const correlationId = `stub-run-${++launchSeq}`;
|
|
343
|
-
// `launch()` honors `
|
|
343
|
+
// `launch()` honors `models.launch` first, then the shared `models.run`.
|
|
344
344
|
const result = {
|
|
345
|
-
...
|
|
345
|
+
...resolveModelResult(spec, dispatchedKeys("agent")),
|
|
346
346
|
runId: correlationId,
|
|
347
347
|
};
|
|
348
348
|
// The resume payload IS the result (no live handles to strip).
|
|
349
|
-
return dispatchable(
|
|
349
|
+
return dispatchable(stubModelRunHandle(overrides, correlationId, result), opts.signals, () => result);
|
|
350
350
|
},
|
|
351
351
|
coding: {
|
|
352
|
-
run: (spec) => Promise.resolve(resolveCodingResult(spec, "
|
|
352
|
+
run: (spec) => Promise.resolve(resolveCodingResult(spec, "models.coding.run")),
|
|
353
353
|
launch: (spec) => {
|
|
354
354
|
const correlationId = `stub-run-${++launchSeq}`;
|
|
355
355
|
// `launch()` honors the key matching the call the author wrote
|
|
356
|
-
// (`
|
|
356
|
+
// (`models.coding.launch`) first, then the shared `models.coding.run`
|
|
357
357
|
// that controls both paths.
|
|
358
358
|
const result = {
|
|
359
|
-
...resolveCodingResult(spec, dispatchedKeys("
|
|
359
|
+
...resolveCodingResult(spec, dispatchedKeys("models.coding")),
|
|
360
360
|
runId: correlationId,
|
|
361
361
|
};
|
|
362
362
|
// Register for pause-resume with the wire shape a resumed step receives:
|
|
@@ -366,8 +366,8 @@ function createStubClient(opts = {}) {
|
|
|
366
366
|
},
|
|
367
367
|
},
|
|
368
368
|
},
|
|
369
|
-
|
|
370
|
-
run: (spec) => Promise.resolve(r("
|
|
369
|
+
agents: {
|
|
370
|
+
run: (spec) => Promise.resolve(r("agents.run", [spec], () => ({
|
|
371
371
|
executionId: `stub-exec-${++launchSeq}`,
|
|
372
372
|
status: "completed",
|
|
373
373
|
output: {},
|
|
@@ -385,13 +385,13 @@ function createStubClient(opts = {}) {
|
|
|
385
385
|
executionId,
|
|
386
386
|
dispatch: {
|
|
387
387
|
correlationId: executionId,
|
|
388
|
-
resultSignal: index_js_2.
|
|
388
|
+
resultSignal: index_js_2.AGENTS_RESULT_SIGNAL,
|
|
389
389
|
},
|
|
390
390
|
status: () => Promise.resolve("completed"),
|
|
391
391
|
wait: () => Promise.resolve(result),
|
|
392
392
|
};
|
|
393
393
|
// Register the resume payload so a local `pauseUntilSignal` on this handle
|
|
394
|
-
// resolves with an
|
|
394
|
+
// resolves with an AgentRunResultPayload.
|
|
395
395
|
return dispatchable(handle, opts.signals, () => ({
|
|
396
396
|
status: "completed",
|
|
397
397
|
executionId,
|
|
@@ -440,7 +440,13 @@ function createStubClient(opts = {}) {
|
|
|
440
440
|
width: 512,
|
|
441
441
|
height: 512,
|
|
442
442
|
// mirror the real behavior: a fileId only when storage was requested.
|
|
443
|
-
...(input.storage
|
|
443
|
+
...(input.storage
|
|
444
|
+
? {
|
|
445
|
+
fileId: "stub-file",
|
|
446
|
+
downloadUrl: "https://content.local/stub-download",
|
|
447
|
+
downloadUrlExpiresAt: "2026-01-01T00:00:00Z",
|
|
448
|
+
}
|
|
449
|
+
: {}),
|
|
444
450
|
},
|
|
445
451
|
],
|
|
446
452
|
}))),
|
|
@@ -451,7 +457,13 @@ function createStubClient(opts = {}) {
|
|
|
451
457
|
url: "https://content.local/stub-video.mp4",
|
|
452
458
|
contentType: "video/mp4",
|
|
453
459
|
// mirror the real behavior: a fileId only when storage was requested.
|
|
454
|
-
...(input.storage
|
|
460
|
+
...(input.storage
|
|
461
|
+
? {
|
|
462
|
+
fileId: "stub-file",
|
|
463
|
+
downloadUrl: "https://content.local/stub-download",
|
|
464
|
+
downloadUrlExpiresAt: "2026-01-01T00:00:00Z",
|
|
465
|
+
}
|
|
466
|
+
: {}),
|
|
455
467
|
},
|
|
456
468
|
}))),
|
|
457
469
|
launch: (input) => {
|
|
@@ -460,7 +472,13 @@ function createStubClient(opts = {}) {
|
|
|
460
472
|
video: {
|
|
461
473
|
url: "https://content.local/stub-video.mp4",
|
|
462
474
|
contentType: "video/mp4",
|
|
463
|
-
...(input.storage
|
|
475
|
+
...(input.storage
|
|
476
|
+
? {
|
|
477
|
+
fileId: "stub-file",
|
|
478
|
+
downloadUrl: "https://content.local/stub-download",
|
|
479
|
+
downloadUrlExpiresAt: "2026-01-01T00:00:00Z",
|
|
480
|
+
}
|
|
481
|
+
: {}),
|
|
464
482
|
},
|
|
465
483
|
}));
|
|
466
484
|
const handle = {
|