@sapiom/tools 0.6.2 → 0.8.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 +35 -0
- package/README.md +17 -11
- package/dist/cjs/_client/index.d.ts +22 -2
- package/dist/cjs/_client/index.d.ts.map +1 -1
- package/dist/cjs/_client/index.js +16 -6
- package/dist/cjs/_client/index.js.map +1 -1
- package/dist/cjs/client.d.ts +46 -1
- package/dist/cjs/client.d.ts.map +1 -1
- package/dist/cjs/client.js +20 -0
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/content-generation/index.d.ts +118 -3
- package/dist/cjs/content-generation/index.d.ts.map +1 -1
- package/dist/cjs/content-generation/index.js +200 -4
- package/dist/cjs/content-generation/index.js.map +1 -1
- package/dist/cjs/database/errors.d.ts +16 -0
- package/dist/cjs/database/errors.d.ts.map +1 -0
- package/dist/cjs/database/errors.js +36 -0
- package/dist/cjs/database/errors.js.map +1 -0
- package/dist/cjs/database/index.d.ts +101 -0
- package/dist/cjs/database/index.d.ts.map +1 -0
- package/dist/cjs/database/index.js +118 -0
- package/dist/cjs/database/index.js.map +1 -0
- package/dist/cjs/index.d.ts +8 -1
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +13 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/search/errors.d.ts +16 -0
- package/dist/cjs/search/errors.d.ts.map +1 -0
- package/dist/cjs/search/errors.js +36 -0
- package/dist/cjs/search/errors.js.map +1 -0
- package/dist/cjs/search/index.d.ts +234 -0
- package/dist/cjs/search/index.d.ts.map +1 -0
- package/dist/cjs/search/index.js +286 -0
- package/dist/cjs/search/index.js.map +1 -0
- package/dist/cjs/stub/index.d.ts.map +1 -1
- package/dist/cjs/stub/index.js +150 -2
- package/dist/cjs/stub/index.js.map +1 -1
- package/dist/esm/_client/index.d.ts +22 -2
- package/dist/esm/_client/index.d.ts.map +1 -1
- package/dist/esm/_client/index.js +16 -6
- package/dist/esm/_client/index.js.map +1 -1
- package/dist/esm/client.d.ts +46 -1
- package/dist/esm/client.d.ts.map +1 -1
- package/dist/esm/client.js +20 -0
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/content-generation/index.d.ts +118 -3
- package/dist/esm/content-generation/index.d.ts.map +1 -1
- package/dist/esm/content-generation/index.js +196 -3
- package/dist/esm/content-generation/index.js.map +1 -1
- package/dist/esm/database/errors.d.ts +16 -0
- package/dist/esm/database/errors.d.ts.map +1 -0
- package/dist/esm/database/errors.js +31 -0
- package/dist/esm/database/errors.js.map +1 -0
- package/dist/esm/database/index.d.ts +101 -0
- package/dist/esm/database/index.d.ts.map +1 -0
- package/dist/esm/database/index.js +113 -0
- package/dist/esm/database/index.js.map +1 -0
- package/dist/esm/index.d.ts +8 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +9 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/search/errors.d.ts +16 -0
- package/dist/esm/search/errors.d.ts.map +1 -0
- package/dist/esm/search/errors.js +31 -0
- package/dist/esm/search/errors.js.map +1 -0
- package/dist/esm/search/index.d.ts +234 -0
- package/dist/esm/search/index.d.ts.map +1 -0
- package/dist/esm/search/index.js +278 -0
- package/dist/esm/search/index.js.map +1 -0
- package/dist/esm/stub/index.d.ts.map +1 -1
- package/dist/esm/stub/index.js +150 -2
- 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 +11 -1
- package/src/content-generation/README.md +90 -2
- package/src/database/README.md +62 -0
- package/src/search/README.md +255 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,40 @@
|
|
|
1
1
|
# @sapiom/tools
|
|
2
2
|
|
|
3
|
+
## 0.8.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 2b94dff: Add the `database` namespace for on-demand Postgres databases:
|
|
8
|
+
|
|
9
|
+
- `database.create` — provision a database for a chosen `duration`, returned with direct connection credentials (`connection.connectionString`, `host`, `port`, `username`, `password`, `databaseName`).
|
|
10
|
+
- `database.get` — retrieve a database by its id or handle.
|
|
11
|
+
- `database.delete` — delete a database by its id or handle.
|
|
12
|
+
|
|
13
|
+
Results use normalized camelCase types, and a typed `DatabaseHttpError` (`{ status, body }`) is thrown on non-2xx responses.
|
|
14
|
+
|
|
15
|
+
- ac71754: Add the `search` namespace with provider-agnostic operations:
|
|
16
|
+
|
|
17
|
+
- `search.webSearch` — web search returning normalized `{ query, answer?, results }`.
|
|
18
|
+
- `search.scrape` — fetch a URL as clean Markdown/HTML with page metadata.
|
|
19
|
+
- `search.emailSearch.findEmail` / `verifyEmail` / `domainSearch` — find, verify, and discover professional email addresses for a domain.
|
|
20
|
+
|
|
21
|
+
Results use normalized camelCase types, and a typed `SearchHttpError` (`{ status, body }`) is thrown on non-2xx responses.
|
|
22
|
+
|
|
23
|
+
- f078ed5: Add `contentGeneration.video.launch()` — the dispatchable surface for video generation.
|
|
24
|
+
|
|
25
|
+
- `contentGeneration.video.launch(input)` submits a video generation job and returns a `VideoLaunchHandle` immediately. Pass the handle to `pauseUntilSignal(handle, { resumeStep })` to suspend a workflow step until the video is ready, or call `handle.wait()` to block inline.
|
|
26
|
+
- `VideoLaunchHandle` satisfies `DispatchHandle` — `dispatch.correlationId` and `dispatch.resultSignal` are the join keys the orchestration engine uses to resume a paused step.
|
|
27
|
+
- `VIDEO_RESULT_SIGNAL` (`"contentGeneration.video.result"`) is the capability-stable signal constant; use it in the static `pause: { signal }` declaration of a workflow step.
|
|
28
|
+
- `VideoResultPayload` and `toVideoResumePayload` describe the payload a resumed step receives across the wire boundary (plain JSON with `outputs[].fileId` / `outputs[].storageError`).
|
|
29
|
+
- Prompt-guard hardening: `images.create`, `video.create`, and `video.launch` now throw a typed error immediately when `prompt` is null, empty, or not a string — before any network request is made.
|
|
30
|
+
- `createStubClient()` wires `contentGeneration.video.launch` as a dispatchable stub that auto-registers a resume payload when `signals` is provided, enabling local workflow testing.
|
|
31
|
+
|
|
32
|
+
## 0.7.0
|
|
33
|
+
|
|
34
|
+
### Minor Changes
|
|
35
|
+
|
|
36
|
+
- a3cc368: Add `contentGeneration.video.create` — generate a video from a prompt, with an optional `storage` param. Video generation is asynchronous: `create` submits the job and polls until the result is ready (configurable `pollIntervalMs` / `timeoutMs`), then resolves — so you `await` it just like `images.create`. When `storage` is passed, the output is persisted and the returned `video` carries a `fileId`. camelCase surface, mapped from the wire.
|
|
37
|
+
|
|
3
38
|
## 0.6.2
|
|
4
39
|
|
|
5
40
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @sapiom/tools
|
|
2
2
|
|
|
3
|
-
A typed TypeScript client for Sapiom capabilities — sandboxes, git repositories, coding agents, file storage, content generation, and orchestrations — authenticated to your tenant.
|
|
3
|
+
A typed TypeScript client for Sapiom capabilities — sandboxes, git repositories, coding agents, file storage, content generation, search, and orchestrations — authenticated to your tenant.
|
|
4
4
|
|
|
5
5
|
These are the same capabilities your Sapiom agents call as tools; this package makes them callable directly from your own code.
|
|
6
6
|
|
|
@@ -25,7 +25,9 @@ const run = await sapiom.agent.coding.run({
|
|
|
25
25
|
});
|
|
26
26
|
|
|
27
27
|
if (run.result?.success) {
|
|
28
|
-
const { sha } = await repo.pushFromSandbox(run.sandbox, {
|
|
28
|
+
const { sha } = await repo.pushFromSandbox(run.sandbox, {
|
|
29
|
+
message: "build: landing",
|
|
30
|
+
});
|
|
29
31
|
console.log("published", sha);
|
|
30
32
|
}
|
|
31
33
|
```
|
|
@@ -65,14 +67,16 @@ If a single process makes calls on behalf of more than one agent or trace, deriv
|
|
|
65
67
|
|
|
66
68
|
Each capability is a namespace, importable from the barrel or its own subpath (e.g. `@sapiom/tools/sandboxes`). Every capability has its own README with usage details, preconditions, and gotchas the type signatures can't express — read it before first use.
|
|
67
69
|
|
|
68
|
-
| Namespace
|
|
69
|
-
|
|
70
|
-
| `sandboxes`
|
|
71
|
-
| `repositories`
|
|
72
|
-
| `agent`
|
|
73
|
-
| `fileStorage`
|
|
74
|
-
| `contentGeneration` | Media generation (images;
|
|
75
|
-
| `
|
|
70
|
+
| Namespace | What it is | Docs |
|
|
71
|
+
| ------------------- | ----------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
72
|
+
| `sandboxes` | Isolated, ephemeral compute | [src/sandboxes](./src/sandboxes/README.md) |
|
|
73
|
+
| `repositories` | Private, in-network git repos | [src/repositories](./src/repositories/README.md) |
|
|
74
|
+
| `agent` | Coding agents (LLM execution) | [src/agent](./src/agent/README.md) |
|
|
75
|
+
| `fileStorage` | Tenant-scoped object storage (presigned URLs) | [src/file-storage](./src/file-storage/README.md) |
|
|
76
|
+
| `contentGeneration` | Media generation (images + video; audio soon), with optional `storage` | [src/content-generation](./src/content-generation/README.md) |
|
|
77
|
+
| `search` | Search the web (`webSearch`), read a page (`scrape`), and look up professional emails (`emailSearch`) | [src/search](./src/search/README.md) |
|
|
78
|
+
| `orchestrations` | Run a deployed orchestration, or dispatch one from a step and await its result | [src/orchestrations](./src/orchestrations/README.md) |
|
|
79
|
+
| `database` | On-demand Postgres databases, returned with direct connection credentials | [src/database](./src/database/README.md) |
|
|
76
80
|
|
|
77
81
|
## Composing capabilities
|
|
78
82
|
|
|
@@ -92,7 +96,9 @@ const out = await contentGeneration.images.create({
|
|
|
92
96
|
prompt: "a logo",
|
|
93
97
|
storage: { visibility: "private" },
|
|
94
98
|
});
|
|
95
|
-
const { downloadUrl } = await fileStorage.getDownloadUrl(
|
|
99
|
+
const { downloadUrl } = await fileStorage.getDownloadUrl(
|
|
100
|
+
out.images![0].fileId!,
|
|
101
|
+
);
|
|
96
102
|
```
|
|
97
103
|
|
|
98
104
|
## License
|
|
@@ -51,6 +51,22 @@ export interface TransportConfig {
|
|
|
51
51
|
*/
|
|
52
52
|
resumeToken?: string;
|
|
53
53
|
}
|
|
54
|
+
/**
|
|
55
|
+
* Which header carries the tenant credential. Sapiom has two authenticated
|
|
56
|
+
* surfaces with different conventions: most operations send `x-sapiom-api-key`
|
|
57
|
+
* (the default), while a few send `x-api-key`. A capability that targets the
|
|
58
|
+
* latter passes `authHeader: "x-api-key"`; everything else uses the default.
|
|
59
|
+
* The credential value is the same — the Transport holds it; callers never do.
|
|
60
|
+
*/
|
|
61
|
+
export type AuthHeader = "x-sapiom-api-key" | "x-api-key";
|
|
62
|
+
/** Per-request options the Transport understands, layered over a normal `RequestInit`. */
|
|
63
|
+
export interface TransportRequestOptions {
|
|
64
|
+
/**
|
|
65
|
+
* Which header carries the tenant credential. Defaults to `x-sapiom-api-key`.
|
|
66
|
+
* A capability sets this only when its destination expects a different header.
|
|
67
|
+
*/
|
|
68
|
+
authHeader?: AuthHeader;
|
|
69
|
+
}
|
|
54
70
|
/**
|
|
55
71
|
* Standalone-only ambient attribution. Read once for the process-global default
|
|
56
72
|
* transport. NOT the engine's injection channel — `process.env` is process-wide,
|
|
@@ -82,10 +98,14 @@ export declare class Transport {
|
|
|
82
98
|
* response handling (filesystem, log streams) use this and inspect the
|
|
83
99
|
* `Response` themselves. Injects the tenant credential + attribution headers;
|
|
84
100
|
* sets no content-type.
|
|
101
|
+
*
|
|
102
|
+
* The credential rides `x-sapiom-api-key` by default; pass
|
|
103
|
+
* `{ authHeader: "x-api-key" }` for a destination that expects that header
|
|
104
|
+
* instead (the value is identical — the Transport owns the key either way).
|
|
85
105
|
*/
|
|
86
|
-
fetch(url: string, init?: RequestInit): Promise<Response>;
|
|
106
|
+
fetch(url: string, init?: RequestInit, options?: TransportRequestOptions): Promise<Response>;
|
|
87
107
|
/** Authenticated JSON request — parses the body and throws on a non-2xx status. */
|
|
88
|
-
request<T>(url: string, init?: RequestInit): Promise<T>;
|
|
108
|
+
request<T>(url: string, init?: RequestInit, options?: TransportRequestOptions): Promise<T>;
|
|
89
109
|
}
|
|
90
110
|
export declare function defaultTransport(): Transport;
|
|
91
111
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,uFAAuF;IACvF,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CACpC;AAED,MAAM,WAAW,eAAe;IAC9B,8FAA8F;IAC9F,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gFAAgF;IAChF,KAAK,CAAC,EAAE,OAAO,UAAU,CAAC,KAAK,CAAC;IAChC,yFAAyF;IACzF,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAYD;;;;;;GAMG;AACH,wBAAgB,kBAAkB,IAAI,WAAW,CAShD;AAED,qBAAa,SAAS;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAqB;IAC5C,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA0B;IACpD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C;;;;OAIG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,CAAC;gBAE7B,MAAM,GAAE,eAAoB;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/_client/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B,uFAAuF;IACvF,SAAS,C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AAC,CAAC,EACb,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,WAAgB,EACtB,OAAO,GAAE,uBAA4B,GACpC,OAAO,CAAC,CAAC,CAAC;CAmBd;AAID,wBAAgB,gBAAgB,IAAI,SAAS,CAE5C"}
|
|
@@ -23,6 +23,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
23
23
|
exports.Transport = void 0;
|
|
24
24
|
exports.attributionFromEnv = attributionFromEnv;
|
|
25
25
|
exports.defaultTransport = defaultTransport;
|
|
26
|
+
const DEFAULT_AUTH_HEADER = "x-sapiom-api-key";
|
|
26
27
|
function attributionToHeaders(a) {
|
|
27
28
|
const h = {};
|
|
28
29
|
if (a.agentName)
|
|
@@ -62,7 +63,9 @@ class Transport {
|
|
|
62
63
|
this.fetchImpl = config.fetch ?? globalThis.fetch;
|
|
63
64
|
this.attribution = config.attribution ?? {};
|
|
64
65
|
this.resumeToken =
|
|
65
|
-
config.resumeToken ??
|
|
66
|
+
config.resumeToken ??
|
|
67
|
+
process.env.SAPIOM_CAPABILITY_RESUME_TOKEN ??
|
|
68
|
+
undefined;
|
|
66
69
|
}
|
|
67
70
|
/**
|
|
68
71
|
* A new transport sharing this one's credential, fetch, and resume token, with
|
|
@@ -83,8 +86,12 @@ class Transport {
|
|
|
83
86
|
* response handling (filesystem, log streams) use this and inspect the
|
|
84
87
|
* `Response` themselves. Injects the tenant credential + attribution headers;
|
|
85
88
|
* sets no content-type.
|
|
89
|
+
*
|
|
90
|
+
* The credential rides `x-sapiom-api-key` by default; pass
|
|
91
|
+
* `{ authHeader: "x-api-key" }` for a destination that expects that header
|
|
92
|
+
* instead (the value is identical — the Transport owns the key either way).
|
|
86
93
|
*/
|
|
87
|
-
async fetch(url, init = {}) {
|
|
94
|
+
async fetch(url, init = {}, options = {}) {
|
|
88
95
|
if (!this.apiKey) {
|
|
89
96
|
throw new Error("@sapiom/tools: no tenant credential. Pass createClient({ apiKey }) for standalone use, " +
|
|
90
97
|
"or run inside a Sapiom workflow (the engine injects SAPIOM_API_KEY).");
|
|
@@ -92,18 +99,21 @@ class Transport {
|
|
|
92
99
|
return this.fetchImpl(url, {
|
|
93
100
|
...init,
|
|
94
101
|
headers: {
|
|
95
|
-
|
|
102
|
+
[options.authHeader ?? DEFAULT_AUTH_HEADER]: this.apiKey,
|
|
96
103
|
...attributionToHeaders(this.attribution),
|
|
97
104
|
...(init.headers ?? {}),
|
|
98
105
|
},
|
|
99
106
|
});
|
|
100
107
|
}
|
|
101
108
|
/** Authenticated JSON request — parses the body and throws on a non-2xx status. */
|
|
102
|
-
async request(url, init = {}) {
|
|
109
|
+
async request(url, init = {}, options = {}) {
|
|
103
110
|
const res = await this.fetch(url, {
|
|
104
111
|
...init,
|
|
105
|
-
headers: {
|
|
106
|
-
|
|
112
|
+
headers: {
|
|
113
|
+
"content-type": "application/json",
|
|
114
|
+
...(init.headers ?? {}),
|
|
115
|
+
},
|
|
116
|
+
}, options);
|
|
107
117
|
if (!res.ok) {
|
|
108
118
|
throw new Error(`${init.method ?? "GET"} ${url} → ${res.status} ${await res.text()}`);
|
|
109
119
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_client/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/_client/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;GAmBG;;;AA0EH,gDASC;AAiGD,4CAEC;AAxID,MAAM,mBAAmB,GAAe,kBAAkB,CAAC;AAW3D,SAAS,oBAAoB,CAAC,CAAc;IAC1C,MAAM,CAAC,GAA2B,EAAE,CAAC;IACrC,IAAI,CAAC,CAAC,SAAS;QAAE,CAAC,CAAC,qBAAqB,CAAC,GAAG,CAAC,CAAC,SAAS,CAAC;IACxD,IAAI,CAAC,CAAC,OAAO;QAAE,CAAC,CAAC,mBAAmB,CAAC,G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AAE,EAAE,CAAC;YACZ,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,CAAC,MAAM,IAAI,KAAK,IAAI,GAAG,MAAM,GAAG,CAAC,MAAM,IAAI,MAAM,GAAG,CAAC,IAAI,EAAE,EAAE,CACrE,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAM,CAAC;IACjC,CAAC;CACF;AA3FD,8BA2FC;AAED,qGAAqG;AACrG,IAAI,QAA+B,CAAC;AACpC,SAAgB,gBAAgB;IAC9B,OAAO,CAAC,QAAQ,KAAR,QAAQ,GAAK,IAAI,SAAS,CAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,EAAE,CAAC,EAAC,CAAC;AAC7E,CAAC"}
|
package/dist/cjs/client.d.ts
CHANGED
|
@@ -21,7 +21,9 @@ import { Repository } from "./repositories/index.js";
|
|
|
21
21
|
import type { CodingRunSpec, CodingRunResult, RunHandle } from "./agent/index.js";
|
|
22
22
|
import type { OrchestrationRunSpec, OrchestrationRunResult, RunHandle as OrchestrationRunHandle } from "./orchestrations/index.js";
|
|
23
23
|
import type { UploadInput, UploadResponse, DownloadUrlResponse, ListOptions, ListResponse, FileMetadata } from "./file-storage/index.js";
|
|
24
|
-
import type { ImageCreateInput, ImageGenerationResult } from "./content-generation/index.js";
|
|
24
|
+
import type { ImageCreateInput, ImageGenerationResult, VideoCreateInput, VideoGenerationResult, VideoLaunchHandle } from "./content-generation/index.js";
|
|
25
|
+
import type { ScrapeInput, ScrapeResult, WebSearchInput, WebSearchResponse, FindEmailInput, FindEmailResult, VerifyEmailInput, VerifyEmailResult, DomainSearchInput, DomainSearchResult } from "./search/index.js";
|
|
26
|
+
import type { CreateDatabaseInput, Database } from "./database/index.js";
|
|
25
27
|
export interface Sapiom {
|
|
26
28
|
readonly sandboxes: {
|
|
27
29
|
create(opts: SandboxCreateOptions): Promise<Sandbox>;
|
|
@@ -64,6 +66,49 @@ export interface Sapiom {
|
|
|
64
66
|
*/
|
|
65
67
|
create(input: ImageCreateInput): Promise<ImageGenerationResult>;
|
|
66
68
|
};
|
|
69
|
+
video: {
|
|
70
|
+
/**
|
|
71
|
+
* Generate a video from a prompt — async (submits, then polls until ready, then
|
|
72
|
+
* returns it). Pass `storage` to persist the output (the returned video carries
|
|
73
|
+
* `fileId`).
|
|
74
|
+
*/
|
|
75
|
+
create(input: VideoCreateInput): Promise<VideoGenerationResult>;
|
|
76
|
+
/**
|
|
77
|
+
* Submit a video generation job and return a dispatchable handle immediately.
|
|
78
|
+
* Pass the handle to `pauseUntilSignal(handle, { resumeStep })` to suspend the
|
|
79
|
+
* workflow step until the video is ready, or call `handle.wait()` to block
|
|
80
|
+
* inline (equivalent to `video.create`). Pass `storage` to persist the output.
|
|
81
|
+
*/
|
|
82
|
+
launch(input: VideoCreateInput): Promise<VideoLaunchHandle>;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Search the web, read pages, and look up professional emails. More operations
|
|
87
|
+
* are added to this namespace as they ship.
|
|
88
|
+
*/
|
|
89
|
+
readonly search: {
|
|
90
|
+
/** Read a page and return its content (markdown by default). */
|
|
91
|
+
scrape(input: ScrapeInput): Promise<ScrapeResult>;
|
|
92
|
+
/** Search the web — a synthesized answer plus results by default. */
|
|
93
|
+
webSearch(input: WebSearchInput): Promise<WebSearchResponse>;
|
|
94
|
+
/** Find, verify, and discover professional email addresses. */
|
|
95
|
+
readonly emailSearch: {
|
|
96
|
+
/** Find a person's email from their name and company. */
|
|
97
|
+
findEmail(input: FindEmailInput): Promise<FindEmailResult>;
|
|
98
|
+
/** Verify that an email address is deliverable. */
|
|
99
|
+
verifyEmail(input: VerifyEmailInput): Promise<VerifyEmailResult>;
|
|
100
|
+
/** Discover the emails published at a company domain. */
|
|
101
|
+
domainSearch(input: DomainSearchInput): Promise<DomainSearchResult>;
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
/** On-demand Postgres databases, returned with direct connection credentials. */
|
|
105
|
+
readonly database: {
|
|
106
|
+
/** Provision a database (returns connection credentials). `duration` is required. */
|
|
107
|
+
create(input: CreateDatabaseInput): Promise<Database>;
|
|
108
|
+
/** Retrieve a database by its id or handle. */
|
|
109
|
+
get(idOrHandle: string): Promise<Database>;
|
|
110
|
+
/** Delete a database by its id or handle. */
|
|
111
|
+
delete(idOrHandle: string): Promise<void>;
|
|
67
112
|
};
|
|
68
113
|
/**
|
|
69
114
|
* Derive a client that attributes its calls to a different agent/trace. For the
|
package/dist/cjs/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAC/C,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACjE,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAErD,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,SAAS,EACV,MAAM,kBAAkB,CAAC;AAK1B,OAAO,KAAK,EACV,oBAAoB,EACpB,sBAAsB,EACtB,SAAS,IAAI,sBAAsB,EACpC,MAAM,2BAA2B,CAAC;AAEnC,OAAO,KAAK,EACV,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,YAAY,EACb,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EACV,gBAAgB,EAChB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAGL,KAAK,eAAe,EACpB,KAAK,WAAW,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAA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AAG,MAAM,CAAC;CAEnD;AA8DD,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,eAAe,GAAG,MAAM,CAE7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C"}
|
package/dist/cjs/client.js
CHANGED
|
@@ -58,6 +58,8 @@ const index_js_4 = require("./agent/index.js");
|
|
|
58
58
|
const index_js_5 = require("./orchestrations/index.js");
|
|
59
59
|
const fileStorage = __importStar(require("./file-storage/index.js"));
|
|
60
60
|
const contentGeneration = __importStar(require("./content-generation/index.js"));
|
|
61
|
+
const index_js_6 = require("./search/index.js");
|
|
62
|
+
const database = __importStar(require("./database/index.js"));
|
|
61
63
|
/** Bind every capability namespace to a transport. `withAttribution` rebinds to a derived one. */
|
|
62
64
|
function bind(transport) {
|
|
63
65
|
return {
|
|
@@ -93,6 +95,24 @@ function bind(transport) {
|
|
|
93
95
|
images: {
|
|
94
96
|
create: (input) => contentGeneration.createImage(input, transport),
|
|
95
97
|
},
|
|
98
|
+
video: {
|
|
99
|
+
create: (input) => contentGeneration.createVideo(input, transport),
|
|
100
|
+
launch: (input) => contentGeneration.launchVideo(input, transport),
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
search: {
|
|
104
|
+
scrape: (input) => (0, index_js_6.scrape)(input, transport),
|
|
105
|
+
webSearch: (input) => (0, index_js_6.webSearch)(input, transport),
|
|
106
|
+
emailSearch: {
|
|
107
|
+
findEmail: (input) => (0, index_js_6.findEmail)(input, transport),
|
|
108
|
+
verifyEmail: (input) => (0, index_js_6.verifyEmail)(input, transport),
|
|
109
|
+
domainSearch: (input) => (0, index_js_6.domainSearch)(input, transport),
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
database: {
|
|
113
|
+
create: (input) => database.create(input, transport),
|
|
114
|
+
get: (idOrHandle) => database.get(idOrHandle, transport),
|
|
115
|
+
delete: (idOrHandle) => database.delete(idOrHandle, transport),
|
|
96
116
|
},
|
|
97
117
|
withAttribution: (attribution) => bind(transport.withAttribution(attribution)),
|
|
98
118
|
};
|
package/dist/cjs/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6OA,oCAEC;AAWD,kDAEC;AA5PD;;;;;;;;;;;;;;;GAeG;AACH,iDAK4B;AAC5B,mDAA+C;AAE/C,sDAAqD;AACrD,+CAA4E;AAM5E,wDAGmC;AAMnC,qEAAuD;AASvD,iFAAmE;AAQnE,gDAM2B;AAa3B,8DAAgD;AAqGhD,kGAAkG;AAClG,SAAS,IAAI,CAAC,SAAoB;IAChC,OAAO;QACL,SAAS,EAAE;YACT,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAO,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;YACjD,MAAM,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,CAAC,kBAAO,CAAC,MAAM,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC;SAC9D;QACD,YAAY,EAAE;YACZ,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAU,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;YACpD,GAAG,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAU,CAAC,GAAG,CAAC,IAAI,EAAE,SAAS,CAAC;YAC9C,IAAI,EAAE,GAAG,EAAE,CAAC,qBAAU,CAAC,IAAI,CAAC,SAAS,CAAC;YACtC,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,qBAAU,CAAC,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC;YACpD,MAAM,EAAE,CAAC,IAAI,EA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AAC,CAAC;AACrC,CAAC;AAED;;;;;;;;GAQG;AACH,SAAgB,mBAAmB;IACjC,OAAO,IAAI,CAAC,IAAI,oBAAS,CAAC,EAAE,WAAW,EAAE,IAAA,6BAAkB,GAAE,EAAE,CAAC,CAAC,CAAC;AACpE,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `contentGeneration` capability — generate media (images
|
|
2
|
+
* `contentGeneration` capability — generate media (images and video today; audio
|
|
3
3
|
* to come), with an optional `storage` param that persists each output to Sapiom
|
|
4
4
|
* file storage so you get a durable `fileId` back inline.
|
|
5
5
|
*
|
|
@@ -12,10 +12,24 @@
|
|
|
12
12
|
* out.images[0].fileId; // present when `storage` was passed → use with fileStorage
|
|
13
13
|
*
|
|
14
14
|
* Or via an explicit client: `createClient({ apiKey }).contentGeneration.images.create(...)`.
|
|
15
|
+
*
|
|
16
|
+
* `video.launch` is the dispatchable surface: it submits the job and returns a
|
|
17
|
+
* handle immediately. Pass the handle to `pauseUntilSignal(handle, { resumeStep })`
|
|
18
|
+
* to suspend the workflow step until the video is ready, or call `handle.wait()`
|
|
19
|
+
* inline to block until done — same as `video.create` but with the ability to
|
|
20
|
+
* pause a running workflow.
|
|
15
21
|
*/
|
|
16
22
|
import { Transport } from "../_client/index.js";
|
|
17
23
|
import { ContentGenerationHttpError } from "./errors.js";
|
|
24
|
+
import type { DispatchHandle } from "../dispatch.js";
|
|
18
25
|
export { ContentGenerationHttpError };
|
|
26
|
+
/**
|
|
27
|
+
* Capability-stable signal a video launch fires when the video reaches a terminal
|
|
28
|
+
* state (ready OR failed — it carries the result either way, the resumed step
|
|
29
|
+
* branches). A workflow step paused on a launch handle resumes on this; it is the
|
|
30
|
+
* value carried in the handle's `dispatch.resultSignal`.
|
|
31
|
+
*/
|
|
32
|
+
export declare const VIDEO_RESULT_SIGNAL = "contentGeneration.video.result";
|
|
19
33
|
export interface StorageOptions {
|
|
20
34
|
/**
|
|
21
35
|
* Visibility of the persisted output.
|
|
@@ -78,10 +92,111 @@ export interface ImageGenerationResult {
|
|
|
78
92
|
export declare function createImage(input: ImageCreateInput, transport?: Transport, baseUrl?: string): Promise<ImageGenerationResult>;
|
|
79
93
|
/**
|
|
80
94
|
* The `images` sub-namespace, so `contentGeneration.images.create(...)` reads the
|
|
81
|
-
* same whether imported from the barrel or used on a client.
|
|
82
|
-
* land here as sibling sub-namespaces.
|
|
95
|
+
* same whether imported from the barrel or used on a client.
|
|
83
96
|
*/
|
|
84
97
|
export declare const images: {
|
|
85
98
|
create: typeof createImage;
|
|
86
99
|
};
|
|
100
|
+
export interface VideoCreateInput {
|
|
101
|
+
/** Text prompt describing the video to generate. */
|
|
102
|
+
prompt: string;
|
|
103
|
+
/**
|
|
104
|
+
* Optional model selector. Defaults to a standard video model; most callers omit it.
|
|
105
|
+
* (Model identifiers are an advanced, evolving surface.)
|
|
106
|
+
*/
|
|
107
|
+
model?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Optional: persist the generated output to Sapiom file storage. When set, the
|
|
110
|
+
* returned `video` comes back annotated with `fileId` (or `storageError` if
|
|
111
|
+
* persisting failed).
|
|
112
|
+
*/
|
|
113
|
+
storage?: StorageOptions;
|
|
114
|
+
/** Advanced: extra model-specific parameters, forwarded verbatim. */
|
|
115
|
+
params?: Record<string, unknown>;
|
|
116
|
+
/** How often to poll while the video generates (default 5s). */
|
|
117
|
+
pollIntervalMs?: number;
|
|
118
|
+
/** Give up and throw if the result isn't ready within this window (default 5 min). */
|
|
119
|
+
timeoutMs?: number;
|
|
120
|
+
}
|
|
121
|
+
export interface GeneratedVideo {
|
|
122
|
+
/** Hosted URL of the generated video. */
|
|
123
|
+
url: string;
|
|
124
|
+
/** MIME type, when reported. */
|
|
125
|
+
contentType?: string;
|
|
126
|
+
/**
|
|
127
|
+
* Present when `storage` was requested and the output was persisted — pass to
|
|
128
|
+
* `fileStorage.getDownloadUrl(fileId)` to retrieve it.
|
|
129
|
+
*/
|
|
130
|
+
fileId?: string;
|
|
131
|
+
/** Present when `storage` was requested but persisting the output failed. */
|
|
132
|
+
storageError?: string;
|
|
133
|
+
}
|
|
134
|
+
export interface VideoGenerationResult {
|
|
135
|
+
/** The generated video. */
|
|
136
|
+
video?: GeneratedVideo;
|
|
137
|
+
/** Additional model-specific fields (e.g. `seed`, `timings`), returned as-is. */
|
|
138
|
+
[key: string]: unknown;
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Generate a video from a prompt. Video generation is asynchronous: this submits the
|
|
142
|
+
* job, then polls the result through Sapiom until it's ready and returns it — so you
|
|
143
|
+
* `await` it just like {@link createImage}, it just takes longer. Pass `storage` to
|
|
144
|
+
* persist the output (the returned `video` then carries `fileId`). Throws
|
|
145
|
+
* {@link ContentGenerationHttpError} on a failed submit, or an `Error` if the result
|
|
146
|
+
* isn't ready within `timeoutMs`.
|
|
147
|
+
*/
|
|
148
|
+
export declare function createVideo(input: VideoCreateInput, transport?: Transport, baseUrl?: string): Promise<VideoGenerationResult>;
|
|
149
|
+
/**
|
|
150
|
+
* A launched-but-not-awaited video generation job. Satisfies {@link DispatchHandle},
|
|
151
|
+
* so it can be handed straight to `pauseUntilSignal(handle, { resumeStep })` to
|
|
152
|
+
* suspend a workflow step until the video is ready — or `wait()`-ed inline for
|
|
153
|
+
* standalone use (same as `video.create`, but with the dispatchable surface).
|
|
154
|
+
*/
|
|
155
|
+
export interface VideoLaunchHandle extends DispatchHandle {
|
|
156
|
+
/** The queue request id for this job. */
|
|
157
|
+
requestId: string;
|
|
158
|
+
/** Poll to completion and resolve the full result. */
|
|
159
|
+
wait(opts?: {
|
|
160
|
+
timeoutMs?: number;
|
|
161
|
+
pollMs?: number;
|
|
162
|
+
}): Promise<VideoGenerationResult>;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* The video job's terminal result as it arrives at a step **resumed** from
|
|
166
|
+
* `pauseUntilSignal(launchHandle, { resumeStep })`. It crossed a wire boundary,
|
|
167
|
+
* so the shape is plain JSON. Annotate a resumed step's input with this type.
|
|
168
|
+
*
|
|
169
|
+
* const finalize = defineStep({
|
|
170
|
+
* name: "finalize", terminal: true,
|
|
171
|
+
* async run(result: VideoResultPayload, ctx) { … },
|
|
172
|
+
* });
|
|
173
|
+
*/
|
|
174
|
+
export interface VideoResultPayload {
|
|
175
|
+
outputs: Array<{
|
|
176
|
+
/** Present when the output was persisted to file storage. */
|
|
177
|
+
fileId?: string;
|
|
178
|
+
/** Present when storage was requested but persisting this output failed. */
|
|
179
|
+
storageError?: string;
|
|
180
|
+
}>;
|
|
181
|
+
}
|
|
182
|
+
/**
|
|
183
|
+
* Map a live, awaited {@link VideoGenerationResult} to the plain
|
|
184
|
+
* {@link VideoResultPayload} a resumed step receives across the wire boundary.
|
|
185
|
+
*/
|
|
186
|
+
export declare function toVideoResumePayload(result: VideoGenerationResult): VideoResultPayload;
|
|
187
|
+
/**
|
|
188
|
+
* Submit a video generation job and return a dispatchable handle immediately.
|
|
189
|
+
* The handle's `dispatch` member lets a workflow step pause until the video
|
|
190
|
+
* is ready; `handle.wait()` blocks inline instead — same as `video.create` but
|
|
191
|
+
* with the ability to suspend a running workflow.
|
|
192
|
+
*
|
|
193
|
+
* Pass `storage` to persist the output (the result then carries `fileId`).
|
|
194
|
+
* Throws {@link ContentGenerationHttpError} when the submit fails.
|
|
195
|
+
*/
|
|
196
|
+
export declare function launchVideo(input: VideoCreateInput, transport?: Transport, baseUrl?: string): Promise<VideoLaunchHandle>;
|
|
197
|
+
/** The `video` sub-namespace: `contentGeneration.video.create(...)` and `contentGeneration.video.launch(...)`. */
|
|
198
|
+
export declare const video: {
|
|
199
|
+
create: typeof createVideo;
|
|
200
|
+
launch: typeof launchVideo;
|
|
201
|
+
};
|
|
87
202
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/content-generation/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/content-generation/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EAAE,SAAS,EAAoB,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAY,0BAA0B,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAErD,OAAO,EAAE,0BAA0B,EAAE,CAAC;AAKtC;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,mCAAmC,CAAC;AAOpE,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CACnC;AAED,MAAM,WAAW,gBAAgB;IAC/B,oDAAoD;IACpD,MAAM,EAAE,MAAM,CAAC;IACf,oCAAoC;IACpC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,OAAO,CAAC,EAAE,cAAc,CAAC;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,cAAc;IAC7B,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,gCAAgC;IAChC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,wBAAwB;IACxB,MAAM,CAAC,EAAE,cAAc,EAAE,CAAC;IAC1B,iFAAiF;IACjF,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAwED;;;;GAIG;AACH,wBAA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