@palai/sdk 0.1.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 +65 -0
- package/LICENSE +201 -0
- package/README.md +160 -0
- package/dist/client.d.ts +94 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +296 -0
- package/dist/client.js.map +1 -0
- package/dist/errors.d.ts +40 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +143 -0
- package/dist/errors.js.map +1 -0
- package/dist/generated/tools.d.ts +39 -0
- package/dist/generated/tools.d.ts.map +1 -0
- package/dist/generated/tools.js +44 -0
- package/dist/generated/tools.js.map +1 -0
- package/dist/generated/types.d.ts +341 -0
- package/dist/generated/types.d.ts.map +1 -0
- package/dist/generated/types.js +7 -0
- package/dist/generated/types.js.map +1 -0
- package/dist/index.browser.d.ts +3 -0
- package/dist/index.browser.d.ts.map +1 -0
- package/dist/index.browser.js +6 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/orchestrator.d.ts +61 -0
- package/dist/orchestrator.d.ts.map +1 -0
- package/dist/orchestrator.js +159 -0
- package/dist/orchestrator.js.map +1 -0
- package/dist/resources/agents.d.ts +67 -0
- package/dist/resources/agents.d.ts.map +1 -0
- package/dist/resources/agents.js +75 -0
- package/dist/resources/agents.js.map +1 -0
- package/dist/resources/approvals.d.ts +33 -0
- package/dist/resources/approvals.d.ts.map +1 -0
- package/dist/resources/approvals.js +33 -0
- package/dist/resources/approvals.js.map +1 -0
- package/dist/resources/artifacts.d.ts +36 -0
- package/dist/resources/artifacts.d.ts.map +1 -0
- package/dist/resources/artifacts.js +70 -0
- package/dist/resources/artifacts.js.map +1 -0
- package/dist/resources/model-routes.d.ts +70 -0
- package/dist/resources/model-routes.d.ts.map +1 -0
- package/dist/resources/model-routes.js +74 -0
- package/dist/resources/model-routes.js.map +1 -0
- package/dist/resources/reads.d.ts +49 -0
- package/dist/resources/reads.d.ts.map +1 -0
- package/dist/resources/reads.js +91 -0
- package/dist/resources/reads.js.map +1 -0
- package/dist/resources/responses.d.ts +70 -0
- package/dist/resources/responses.d.ts.map +1 -0
- package/dist/resources/responses.js +147 -0
- package/dist/resources/responses.js.map +1 -0
- package/dist/resources/secret-refs.d.ts +24 -0
- package/dist/resources/secret-refs.d.ts.map +1 -0
- package/dist/resources/secret-refs.js +33 -0
- package/dist/resources/secret-refs.js.map +1 -0
- package/dist/resources/sessions.d.ts +106 -0
- package/dist/resources/sessions.d.ts.map +1 -0
- package/dist/resources/sessions.js +161 -0
- package/dist/resources/sessions.js.map +1 -0
- package/dist/resources/shared.d.ts +31 -0
- package/dist/resources/shared.d.ts.map +1 -0
- package/dist/resources/shared.js +32 -0
- package/dist/resources/shared.js.map +1 -0
- package/dist/resources/skills.d.ts +40 -0
- package/dist/resources/skills.d.ts.map +1 -0
- package/dist/resources/skills.js +40 -0
- package/dist/resources/skills.js.map +1 -0
- package/dist/schema.d.ts +35 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/schema.js +30 -0
- package/dist/schema.js.map +1 -0
- package/dist/server-only.d.ts +2 -0
- package/dist/server-only.d.ts.map +1 -0
- package/dist/server-only.js +22 -0
- package/dist/server-only.js.map +1 -0
- package/dist/stream.d.ts +38 -0
- package/dist/stream.d.ts.map +1 -0
- package/dist/stream.js +314 -0
- package/dist/stream.js.map +1 -0
- package/package.json +44 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { callArgs, enc } from "./shared.js";
|
|
2
|
+
// ModelRoutes is the model-routing admin surface (E13 T8 write + E16 T1 read-back, MCI-006): a project
|
|
3
|
+
// binds its own provider connection and publishes route revisions, so two projects on one stack run
|
|
4
|
+
// different models on different credentials — AND reads them back. The list methods return the admin
|
|
5
|
+
// ListView envelope ({object:"list", data:[…]}) — a full, small, tenant-scoped set, no cursor. Requires a
|
|
6
|
+
// key with the `provision` capability. A connection projection carries the secret REF name only, never a
|
|
7
|
+
// value.
|
|
8
|
+
export class ModelRoutes {
|
|
9
|
+
#client;
|
|
10
|
+
constructor(client) {
|
|
11
|
+
this.#client = client;
|
|
12
|
+
}
|
|
13
|
+
// createConnection binds a provider family to a secret-ref handle (201).
|
|
14
|
+
async createConnection(params, options = {}) {
|
|
15
|
+
const r = await this.#client.request("POST", "/v1/model-connections", { body: params, ...callArgs(options) });
|
|
16
|
+
return r.body;
|
|
17
|
+
}
|
|
18
|
+
// verifyConnection performs a REAL credential probe against the connection's endpoint (E29): the control
|
|
19
|
+
// plane redeems this connection's own credential and asks the endpoint whether it accepts it. It resolves
|
|
20
|
+
// (200) for every outcome it reached a verdict on, INCLUDING a rejected credential — the request
|
|
21
|
+
// succeeded and the verdict is in the body, because a 4xx would blame the caller's request for the
|
|
22
|
+
// operator's key. Only an unknown connection rejects, with a 404.
|
|
23
|
+
async verifyConnection(connectionID, options = {}) {
|
|
24
|
+
const r = await this.#client.request("POST", `/v1/model-connections/${enc(connectionID)}/verify`, callArgs(options));
|
|
25
|
+
return r.body;
|
|
26
|
+
}
|
|
27
|
+
// createRoute opens a named route alias for the project (201).
|
|
28
|
+
async createRoute(params, options = {}) {
|
|
29
|
+
const r = await this.#client.request("POST", "/v1/model-routes", { body: params, ...callArgs(options) });
|
|
30
|
+
return r.body;
|
|
31
|
+
}
|
|
32
|
+
// createRevision adds a DRAFT revision to a route (201) — a draft never steers a run; publishing does.
|
|
33
|
+
async createRevision(routeID, params, options = {}) {
|
|
34
|
+
const r = await this.#client.request("POST", `/v1/model-routes/${enc(routeID)}/revisions`, { body: params, ...callArgs(options) });
|
|
35
|
+
return r.body;
|
|
36
|
+
}
|
|
37
|
+
// publishRevision makes a draft revision the project's routed target. Re-publishing is idempotent.
|
|
38
|
+
async publishRevision(routeID, revisionID, options = {}) {
|
|
39
|
+
const r = await this.#client.request("POST", `/v1/model-routes/${enc(routeID)}/revisions/${enc(revisionID)}/publish`, callArgs(options));
|
|
40
|
+
return r.body;
|
|
41
|
+
}
|
|
42
|
+
// --- E16 T1 read-back (the E13 T10 write-only gap) ------------------------------------------------
|
|
43
|
+
// listConnections returns the project's connections (secret REF names only, never values).
|
|
44
|
+
async listConnections(options = {}) {
|
|
45
|
+
const r = await this.#client.request("GET", "/v1/model-connections", callArgs(options));
|
|
46
|
+
return r.body;
|
|
47
|
+
}
|
|
48
|
+
// getConnection reads one connection by id; an absent/foreign id is a 404.
|
|
49
|
+
async getConnection(connectionID, options = {}) {
|
|
50
|
+
const r = await this.#client.request("GET", `/v1/model-connections/${enc(connectionID)}`, callArgs(options));
|
|
51
|
+
return r.body;
|
|
52
|
+
}
|
|
53
|
+
// listRoutes returns the project's route aliases.
|
|
54
|
+
async listRoutes(options = {}) {
|
|
55
|
+
const r = await this.#client.request("GET", "/v1/model-routes", callArgs(options));
|
|
56
|
+
return r.body;
|
|
57
|
+
}
|
|
58
|
+
// getRoute reads one route alias by id; an absent/foreign id is a 404.
|
|
59
|
+
async getRoute(routeID, options = {}) {
|
|
60
|
+
const r = await this.#client.request("GET", `/v1/model-routes/${enc(routeID)}`, callArgs(options));
|
|
61
|
+
return r.body;
|
|
62
|
+
}
|
|
63
|
+
// listRevisions returns a route's revisions (each with its derived `published` flag).
|
|
64
|
+
async listRevisions(routeID, options = {}) {
|
|
65
|
+
const r = await this.#client.request("GET", `/v1/model-routes/${enc(routeID)}/revisions`, callArgs(options));
|
|
66
|
+
return r.body;
|
|
67
|
+
}
|
|
68
|
+
// getRevision reads one revision of a route; an absent/foreign route or revision is a 404.
|
|
69
|
+
async getRevision(routeID, revisionID, options = {}) {
|
|
70
|
+
const r = await this.#client.request("GET", `/v1/model-routes/${enc(routeID)}/revisions/${enc(revisionID)}`, callArgs(options));
|
|
71
|
+
return r.body;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
//# sourceMappingURL=model-routes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"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Connection, RepositoryBinding, Tool, ToolSet } from "../generated/types.ts";
|
|
2
|
+
import type { Palai } from "../client.ts";
|
|
3
|
+
import { type CallOptions, type ListParams, type Page } from "./shared.ts";
|
|
4
|
+
export interface Trigger {
|
|
5
|
+
id: string;
|
|
6
|
+
object: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export declare class RepositoryBindings {
|
|
10
|
+
#private;
|
|
11
|
+
constructor(client: Palai);
|
|
12
|
+
list(params?: ListParams, options?: CallOptions): Promise<Page<RepositoryBinding>>;
|
|
13
|
+
retrieve(bindingID: string, options?: CallOptions): Promise<RepositoryBinding>;
|
|
14
|
+
}
|
|
15
|
+
export declare class Tools {
|
|
16
|
+
#private;
|
|
17
|
+
constructor(client: Palai);
|
|
18
|
+
list(params?: ListParams, options?: CallOptions): Promise<Page<Tool>>;
|
|
19
|
+
retrieve(toolID: string, options?: CallOptions): Promise<Tool>;
|
|
20
|
+
listSets(params?: ListParams, options?: CallOptions): Promise<Page<ToolSet>>;
|
|
21
|
+
}
|
|
22
|
+
export declare class MCPConnections {
|
|
23
|
+
#private;
|
|
24
|
+
constructor(client: Palai);
|
|
25
|
+
list(params?: ListParams, options?: CallOptions): Promise<Page<MCPConnection>>;
|
|
26
|
+
retrieve(connectionID: string, options?: CallOptions): Promise<MCPConnection>;
|
|
27
|
+
}
|
|
28
|
+
export declare class Triggers {
|
|
29
|
+
#private;
|
|
30
|
+
constructor(client: Palai);
|
|
31
|
+
list(params?: ListParams, options?: CallOptions): Promise<Page<Trigger>>;
|
|
32
|
+
retrieve(triggerID: string, options?: CallOptions): Promise<Trigger>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* The model providers this project can route to, and the models each one offers.
|
|
36
|
+
*
|
|
37
|
+
* ‼️ THIS IS THE ONLY SOURCE OF A MODEL LIST. The engine has no `GET /v1/models` — it answers 404
|
|
38
|
+
* (measured 2026-08-26). Models are reachable only THROUGH a connection, which is the honest shape:
|
|
39
|
+
* a model id means nothing without the provider serving it, and the same name can be offered by two
|
|
40
|
+
* connections with different credentials and different limits.
|
|
41
|
+
*/
|
|
42
|
+
export declare class ModelConnections {
|
|
43
|
+
#private;
|
|
44
|
+
constructor(client: Palai);
|
|
45
|
+
list(options?: CallOptions): Promise<ModelConnection[]>;
|
|
46
|
+
/** The model ids this connection offers. */
|
|
47
|
+
models(connectionID: string, options?: CallOptions): Promise<string[]>;
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=reads.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads.d.ts","sourceRoot":"","sources":["../../src/resources/reads.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,eAAe,EAAE,iBAAiB,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC9G,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAA2B,KAAK,WAAW,EAAE,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AASpG,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAGD,qBAAa,kBAAkB;;IAE7B,YAAY,MAAM,EAAE,KAAK,EAExB;IACK,IAAI,CAAC,MAAM,GAAE,UAAe,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAG/F;IACK,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAGvF;CACF;AAGD,qBAAa,KAAK;;IAEhB,YAAY,MAAM,EAAE,KAAK,EAExB;IACK,IAAI,CAAC,MAAM,GAAE,UAAe,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAGlF;IACK,QAAQ,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE;IAEK,QAAQ,CAAC,MAAM,GAAE,UAAe,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAGzF;CACF;AAID,qBAAa,cAAc;;IAEzB,YAAY,MAAM,EAAE,KAAK,EAExB;IACK,IAAI,CAAC,MAAM,GAAE,UAAe,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,CAG3F;IACK,QAAQ,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,aAAa,CAAC,CAGtF;CACF;AAGD,qBAAa,QAAQ;;IAEnB,YAAY,MAAM,EAAE,KAAK,EAExB;IACK,IAAI,CAAC,MAAM,GAAE,UAAe,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAGrF;IACK,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,OAAO,CAAC,CAG7E;CACF;AAED;;;;;;;GAOG;AACH,qBAAa,gBAAgB;;IAE3B,YAAY,MAAM,EAAE,KAAK,EAExB;IAEK,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC,CAGhE;IAED,4CAA4C;IACtC,MAAM,CAAC,YAAY,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAO/E;CACF"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { callArgs, enc, listPath } from "./shared.js";
|
|
2
|
+
// RepositoryBindings: the external repositories a project's coding sessions attach (spec §30.1).
|
|
3
|
+
export class RepositoryBindings {
|
|
4
|
+
#client;
|
|
5
|
+
constructor(client) {
|
|
6
|
+
this.#client = client;
|
|
7
|
+
}
|
|
8
|
+
async list(params = {}, options = {}) {
|
|
9
|
+
const r = await this.#client.request("GET", listPath("/v1/repository-bindings", params), callArgs(options));
|
|
10
|
+
return r.body;
|
|
11
|
+
}
|
|
12
|
+
async retrieve(bindingID, options = {}) {
|
|
13
|
+
const r = await this.#client.request("GET", `/v1/repository-bindings/${enc(bindingID)}`, callArgs(options));
|
|
14
|
+
return r.body;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
// Tools: the extensibility tool lineages + the named tool-sets (spec §20.2, §28.2-28.4).
|
|
18
|
+
export class Tools {
|
|
19
|
+
#client;
|
|
20
|
+
constructor(client) {
|
|
21
|
+
this.#client = client;
|
|
22
|
+
}
|
|
23
|
+
async list(params = {}, options = {}) {
|
|
24
|
+
const r = await this.#client.request("GET", listPath("/v1/tools", params), callArgs(options));
|
|
25
|
+
return r.body;
|
|
26
|
+
}
|
|
27
|
+
async retrieve(toolID, options = {}) {
|
|
28
|
+
const r = await this.#client.request("GET", `/v1/tools/${enc(toolID)}`, callArgs(options));
|
|
29
|
+
return r.body;
|
|
30
|
+
}
|
|
31
|
+
// listSets pages the named tool-sets (GET /v1/tool-sets).
|
|
32
|
+
async listSets(params = {}, options = {}) {
|
|
33
|
+
const r = await this.#client.request("GET", listPath("/v1/tool-sets", params), callArgs(options));
|
|
34
|
+
return r.body;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
// MCPConnections: the admin-registered upstream MCP servers (spec §28.13-28.14). Read-only here — the
|
|
38
|
+
// register/discover writes are the admin-only management surface, not this parity task.
|
|
39
|
+
export class MCPConnections {
|
|
40
|
+
#client;
|
|
41
|
+
constructor(client) {
|
|
42
|
+
this.#client = client;
|
|
43
|
+
}
|
|
44
|
+
async list(params = {}, options = {}) {
|
|
45
|
+
const r = await this.#client.request("GET", listPath("/v1/mcp-connections", params), callArgs(options));
|
|
46
|
+
return r.body;
|
|
47
|
+
}
|
|
48
|
+
async retrieve(connectionID, options = {}) {
|
|
49
|
+
const r = await this.#client.request("GET", `/v1/mcp-connections/${enc(connectionID)}`, callArgs(options));
|
|
50
|
+
return r.body;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
// Triggers: the automation triggers read surface (spec §20.2.2).
|
|
54
|
+
export class Triggers {
|
|
55
|
+
#client;
|
|
56
|
+
constructor(client) {
|
|
57
|
+
this.#client = client;
|
|
58
|
+
}
|
|
59
|
+
async list(params = {}, options = {}) {
|
|
60
|
+
const r = await this.#client.request("GET", listPath("/v1/triggers", params), callArgs(options));
|
|
61
|
+
return r.body;
|
|
62
|
+
}
|
|
63
|
+
async retrieve(triggerID, options = {}) {
|
|
64
|
+
const r = await this.#client.request("GET", `/v1/triggers/${enc(triggerID)}`, callArgs(options));
|
|
65
|
+
return r.body;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The model providers this project can route to, and the models each one offers.
|
|
70
|
+
*
|
|
71
|
+
* ‼️ THIS IS THE ONLY SOURCE OF A MODEL LIST. The engine has no `GET /v1/models` — it answers 404
|
|
72
|
+
* (measured 2026-08-26). Models are reachable only THROUGH a connection, which is the honest shape:
|
|
73
|
+
* a model id means nothing without the provider serving it, and the same name can be offered by two
|
|
74
|
+
* connections with different credentials and different limits.
|
|
75
|
+
*/
|
|
76
|
+
export class ModelConnections {
|
|
77
|
+
#client;
|
|
78
|
+
constructor(client) {
|
|
79
|
+
this.#client = client;
|
|
80
|
+
}
|
|
81
|
+
async list(options = {}) {
|
|
82
|
+
const r = await this.#client.request("GET", "/v1/model-connections", callArgs(options));
|
|
83
|
+
return r.body.data;
|
|
84
|
+
}
|
|
85
|
+
/** The model ids this connection offers. */
|
|
86
|
+
async models(connectionID, options = {}) {
|
|
87
|
+
const r = await this.#client.request("GET", `/v1/model-connections/${enc(connectionID)}/models`, callArgs(options));
|
|
88
|
+
return r.body.data.map((m) => m.id);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=reads.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reads.js","sourceRoot":"","sources":["../../src/resources/reads.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAAgD,MAAM,aAAa,CAAC;AAepG,iGAAiG;AACjG,MAAM,OAAO,kBAAkB;IAC7B,OAAO,CAAQ;IACf,YAAY,MAAa;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,MAAM,GAAe,EAAE,EAAE,OAAO,GAAgB,EAAE;QAC3D,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAA0B,KAAK,EAAE,QAAQ,CAAC,yBAAyB,EAAE,MAAM,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QACrI,OAAO,CAAC,CAAC,IAAI,CAAC;IAChB,CAAC;IACD,KAAK,CAAC,QAAQ,CAAC,SAAiB,EAAE,OAAO,GAAgB,EAAE;QACzD,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAoB,KAAK,EAAE,2BAA2B,GAAG,CAAC,SAAS,CAAC,EAAE,EAAE,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;QAC/H,OAAO,CAAC,CAAC,IAAI,CAAC;IAChB,CAAC;CACF;AAED,yFAAyF;AACzF,MAAM,OAAO,KAAK;IAChB,OAAO,CAAQ;IACf,YAAY,MAAa;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,MAAM,GAAe,EAAE,EAAE,OAAO,GAAgB,EAAE;QAC3D,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAa,KAAK,EAAE,QAA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IAED,4CAA4C;IAC5C,KAAK,CAAC,MAAM,CAAC,YAAoB,EAAE,OAAO,GAAgB,EAAE;QAC1D,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAClC,KAAK,EACL,yBAAyB,GAAG,CAAC,YAAY,CAAC,SAAS,EACnD,QAAQ,CAAC,OAAO,CAAC,CAClB,CAAC;QACF,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IACtC,CAAC;CACF"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { JSONSchema } from "../schema.ts";
|
|
2
|
+
import type { Response as PalaiResponse, ResponseCreateRequest } from "../generated/types.ts";
|
|
3
|
+
import type { Palai } from "../client.ts";
|
|
4
|
+
import { ResponseStream } from "../stream.ts";
|
|
5
|
+
import { type ListParams, type Page } from "./shared.ts";
|
|
6
|
+
export interface CreateOptions {
|
|
7
|
+
/** Override the auto-generated stable idempotency key (e.g. to dedupe across processes). */
|
|
8
|
+
idempotencyKey?: string;
|
|
9
|
+
signal?: AbortSignal | undefined;
|
|
10
|
+
timeoutMs?: number;
|
|
11
|
+
maxRetries?: number;
|
|
12
|
+
}
|
|
13
|
+
export interface RetrieveOptions {
|
|
14
|
+
signal?: AbortSignal | undefined;
|
|
15
|
+
timeoutMs?: number;
|
|
16
|
+
maxRetries?: number;
|
|
17
|
+
}
|
|
18
|
+
/** Options for `run` — everything `create` takes, plus how long to wait. */
|
|
19
|
+
export interface RunOptions extends StreamOptions {
|
|
20
|
+
/** How long to wait for a terminal event. Default 300_000 ms.
|
|
21
|
+
* The engine can hold a run in `waiting` while it provisions a machine, so this is a real
|
|
22
|
+
* bound: a measurement saw a run still `waiting` after 45 seconds. */
|
|
23
|
+
deadlineMs?: number;
|
|
24
|
+
}
|
|
25
|
+
/** Options for `parse` — the output contract plus the usual run knobs. */
|
|
26
|
+
export interface ParseOptions extends RunOptions {
|
|
27
|
+
schema: JSONSchema;
|
|
28
|
+
/** A name for the schema, forwarded to providers that require one. */
|
|
29
|
+
name: string;
|
|
30
|
+
model?: string;
|
|
31
|
+
effort?: string;
|
|
32
|
+
}
|
|
33
|
+
/** One tool the agent called, with what it was given and what came back.
|
|
34
|
+
*
|
|
35
|
+
* ‼️ READ `succeeded`, NEVER `state`. The two answer different questions and a live run proved
|
|
36
|
+
* they disagree: the journal emitted `tool_call.completed.v1` while this record carried
|
|
37
|
+
* `result.status: "error"`. `state` says the call FINISHED; `result.status` says whether it
|
|
38
|
+
* WORKED. `succeeded` is `undefined` when the server has not said yet — unknown is not failure. */
|
|
39
|
+
export interface ToolCall {
|
|
40
|
+
id: string;
|
|
41
|
+
name: string;
|
|
42
|
+
state: string;
|
|
43
|
+
arguments: Record<string, unknown>;
|
|
44
|
+
result?: {
|
|
45
|
+
status?: string;
|
|
46
|
+
error?: {
|
|
47
|
+
code?: string;
|
|
48
|
+
message?: string;
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
replay_class?: string;
|
|
52
|
+
succeeded?: boolean | undefined;
|
|
53
|
+
}
|
|
54
|
+
export interface StreamOptions extends CreateOptions {
|
|
55
|
+
/** Resume a prior stream from this cursor instead of the beginning. */
|
|
56
|
+
lastEventId?: string | null;
|
|
57
|
+
}
|
|
58
|
+
export declare class Responses {
|
|
59
|
+
#private;
|
|
60
|
+
constructor(client: Palai);
|
|
61
|
+
create(request: ResponseCreateRequest, options?: CreateOptions): Promise<PalaiResponse>;
|
|
62
|
+
retrieve(responseID: string, options?: RetrieveOptions): Promise<PalaiResponse>;
|
|
63
|
+
list(params?: ListParams, options?: RetrieveOptions): Promise<Page<PalaiResponse>>;
|
|
64
|
+
cancel(responseID: string, options?: RetrieveOptions): Promise<void>;
|
|
65
|
+
run(request: ResponseCreateRequest, options?: RunOptions): Promise<PalaiResponse>;
|
|
66
|
+
parse<T>(prompt: string, options: ParseOptions): Promise<T>;
|
|
67
|
+
toolCalls(responseID: string, options?: RetrieveOptions): Promise<ToolCall[]>;
|
|
68
|
+
stream(request: ResponseCreateRequest, options?: StreamOptions): ResponseStream;
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/resources/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG/C,OAAO,KAAK,EAAE,QAAQ,IAAI,aAAa,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C,OAAO,EAA2B,KAAK,UAAU,EAAE,KAAK,IAAI,EAAE,MAAM,aAAa,CAAC;AAElF,MAAM,WAAW,aAAa;IAC5B,4FAA4F;IAC5F,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,4EAA4E;AAC5E,MAAM,WAAW,UAAW,SAAQ,aAAa;IAC/C;;2EAEuE;IACvE,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,0EAA0E;AAC1E,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,MAAM,EAAE,UAAU,CAAC;IACnB,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,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,GAAG,OAAO,CAAC,CAAC,CAAC,CAiBhE;IAIK,SAAS,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC,CAOtF;IAMD,MAAM,CAAC,OAAO,EAAE,qBAAqB,EAAE,OAAO,GAAE,aAAkB,GAAG,cAAc,CAalF;CACF"}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
import { randomUUID } from "node:crypto";
|
|
2
|
+
import { ResponseStream } from "../stream.js";
|
|
3
|
+
import { PalaiConnectionError } from "../errors.js";
|
|
4
|
+
import { callArgs, enc, listPath } from "./shared.js";
|
|
5
|
+
function withSuccess(call) {
|
|
6
|
+
const status = call.result?.status;
|
|
7
|
+
return { ...call, succeeded: status === undefined ? undefined : status === "ok" };
|
|
8
|
+
}
|
|
9
|
+
/** The model's text, joined across every message part of the output.
|
|
10
|
+
* `content` is not a declared field of the content-item schema — that schema fixes only the
|
|
11
|
+
* `type` discriminator — so it arrives as an open field. Reading it is what an open union means. */
|
|
12
|
+
function responseText(response) {
|
|
13
|
+
const output = response.output ?? [];
|
|
14
|
+
return output.map((part) => (typeof part.content === "string" ? part.content : "")).join("");
|
|
15
|
+
}
|
|
16
|
+
// Responses is the /v1/responses resource group: create, retrieve, cancel, and stream.
|
|
17
|
+
export class Responses {
|
|
18
|
+
#client;
|
|
19
|
+
constructor(client) {
|
|
20
|
+
this.#client = client;
|
|
21
|
+
}
|
|
22
|
+
// create posts a new response and returns the queued Response handle from the 202 body
|
|
23
|
+
// (its id, session_id, and run_id). A stable Idempotency-Key is minted once per call and
|
|
24
|
+
// reused across transport retries, so a retried create settles exactly one response; pass
|
|
25
|
+
// options.idempotencyKey to supply your own.
|
|
26
|
+
async create(request, options = {}) {
|
|
27
|
+
const result = await this.#client.request("POST", "/v1/responses", {
|
|
28
|
+
body: request,
|
|
29
|
+
idempotencyKey: options.idempotencyKey ?? newIdempotencyKey(),
|
|
30
|
+
signal: options.signal,
|
|
31
|
+
...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
|
|
32
|
+
...(options.maxRetries !== undefined ? { maxRetries: options.maxRetries } : {}),
|
|
33
|
+
});
|
|
34
|
+
return result.body;
|
|
35
|
+
}
|
|
36
|
+
// retrieve reads a stored response, including its model and, on a failed terminal, the
|
|
37
|
+
// problem-shaped error. A 404 throws NotFoundError; a 410 (retention-purged) throws
|
|
38
|
+
// GoneError.
|
|
39
|
+
async retrieve(responseID, options = {}) {
|
|
40
|
+
const result = await this.#client.request("GET", `/v1/responses/${encodeURIComponent(responseID)}`, {
|
|
41
|
+
signal: options.signal,
|
|
42
|
+
...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
|
|
43
|
+
...(options.maxRetries !== undefined ? { maxRetries: options.maxRetries } : {}),
|
|
44
|
+
});
|
|
45
|
+
return result.body;
|
|
46
|
+
}
|
|
47
|
+
// list returns a tenant-scoped page of run history (GET /v1/responses, E13 T4), with the shared
|
|
48
|
+
// opaque cursor and the basic filters (?status=, created_at bounds).
|
|
49
|
+
async list(params = {}, options = {}) {
|
|
50
|
+
const result = await this.#client.request("GET", listPath("/v1/responses", params), callArgs(options));
|
|
51
|
+
return result.body;
|
|
52
|
+
}
|
|
53
|
+
// cancel requests best-effort cancellation of an in-flight response (accepted as 202).
|
|
54
|
+
async cancel(responseID, options = {}) {
|
|
55
|
+
await this.#client.request("POST", `/v1/responses/${encodeURIComponent(responseID)}/cancel`, {
|
|
56
|
+
signal: options.signal,
|
|
57
|
+
...(options.timeoutMs !== undefined ? { timeoutMs: options.timeoutMs } : {}),
|
|
58
|
+
...(options.maxRetries !== undefined ? { maxRetries: options.maxRetries } : {}),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// run drives one turn and returns it FINISHED — the shape both OpenAI and Anthropic give their
|
|
62
|
+
// `create()`. Palai's own create answers 202 with a queued handle (the engine is genuinely
|
|
63
|
+
// asynchronous), so the waiting lives here rather than being hidden inside `create`.
|
|
64
|
+
//
|
|
65
|
+
// ‼️ IT DOES NOT POLL. The journal already announces the terminal state; asking the same question
|
|
66
|
+
// on a timer would be asking a server that is already answering. Neither vendor offers a poll
|
|
67
|
+
// helper on this path — OpenAI's `_and_poll` methods exist only on the deprecated Assistants
|
|
68
|
+
// surface, Vector Stores and Videos.
|
|
69
|
+
async run(request, options = {}) {
|
|
70
|
+
const deadlineMs = options.deadlineMs ?? 300_000;
|
|
71
|
+
const stream = this.stream(request, options);
|
|
72
|
+
let timer;
|
|
73
|
+
const expiry = new Promise((resolve) => {
|
|
74
|
+
timer = setTimeout(() => resolve(null), deadlineMs);
|
|
75
|
+
});
|
|
76
|
+
try {
|
|
77
|
+
const settled = await Promise.race([stream.finalResponse(), expiry]);
|
|
78
|
+
if (settled !== null)
|
|
79
|
+
return settled;
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
if (timer !== undefined)
|
|
83
|
+
clearTimeout(timer);
|
|
84
|
+
}
|
|
85
|
+
// The deadline won. Ask the server where the run actually is: one request turns "something
|
|
86
|
+
// went wrong" into a status the caller can act on.
|
|
87
|
+
const id = stream.responseID ?? "(unknown)";
|
|
88
|
+
const latest = await this.retrieve(id);
|
|
89
|
+
throw new PalaiConnectionError(`response ${id} did not reach a terminal state within ${deadlineMs}ms (last seen: ${latest.status})`);
|
|
90
|
+
}
|
|
91
|
+
// parse drives one turn under a JSON-Schema output contract and returns the decoded value.
|
|
92
|
+
//
|
|
93
|
+
// The name is `parse` because that is what BOTH vendors call this: OpenAI's
|
|
94
|
+
// `responses.parse(text_format:)` and Anthropic's `messages.parse()`.
|
|
95
|
+
//
|
|
96
|
+
// ‼️ THE SCHEMA IS NOT VALIDATED HERE. The server reads `output.format` and answers 400 on a
|
|
97
|
+
// value it does not accept. A second validator in the SDK would be a second definition of
|
|
98
|
+
// "invalid", and the day the two disagree the caller cannot tell which one is right.
|
|
99
|
+
async parse(prompt, options) {
|
|
100
|
+
const request = {
|
|
101
|
+
input: prompt,
|
|
102
|
+
...(options.model !== undefined ? { model: options.model } : {}),
|
|
103
|
+
...(options.effort !== undefined ? { effort: options.effort } : {}),
|
|
104
|
+
output: { format: "json_schema", name: options.name, schema: options.schema },
|
|
105
|
+
};
|
|
106
|
+
const response = await this.run(request, options);
|
|
107
|
+
const text = responseText(response);
|
|
108
|
+
try {
|
|
109
|
+
return JSON.parse(text);
|
|
110
|
+
}
|
|
111
|
+
catch (cause) {
|
|
112
|
+
// ‼️ THE RAW TEXT IS NOT IN THIS MESSAGE. A failed parse is exactly when the model output is
|
|
113
|
+
// least trustworthy and most likely to be pasted into a log; the error says what was expected
|
|
114
|
+
// without carrying the payload.
|
|
115
|
+
throw new PalaiConnectionError(`response ${response.id}: the model's output did not parse as JSON`, { cause });
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
// toolCalls reads the AUTHORITATIVE record of what the agent did — arguments AND results.
|
|
119
|
+
// The event stream carries neither: its payload is only {run_id, tool_call_id, tool_name}.
|
|
120
|
+
async toolCalls(responseID, options = {}) {
|
|
121
|
+
const r = await this.#client.request("GET", `/v1/responses/${enc(responseID)}/tool-calls`, callArgs(options));
|
|
122
|
+
return r.body.data.map(withSuccess);
|
|
123
|
+
}
|
|
124
|
+
// stream creates a response and returns a resumable, typed event stream over its session.
|
|
125
|
+
// It returns synchronously; the create fires lazily on first consumption. The stream
|
|
126
|
+
// reconnects with Last-Event-ID on a drop, and stream.finalResponse() resolves the
|
|
127
|
+
// canonical terminal Response.
|
|
128
|
+
stream(request, options = {}) {
|
|
129
|
+
return new ResponseStream({
|
|
130
|
+
transport: this.#client,
|
|
131
|
+
start: async () => {
|
|
132
|
+
const created = await this.create(request, options);
|
|
133
|
+
return {
|
|
134
|
+
responseID: String(created.id),
|
|
135
|
+
sessionID: String(created.session_id ?? ""),
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
signal: options.signal,
|
|
139
|
+
lastEventId: options.lastEventId ?? null,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// newIdempotencyKey mints a fresh, collision-resistant key for one logical create.
|
|
144
|
+
function newIdempotencyKey() {
|
|
145
|
+
return `idem_${randomUUID()}`;
|
|
146
|
+
}
|
|
147
|
+
//# sourceMappingURL=responses.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.js","sourceRoot":"","sources":["../../src/resources/responses.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAIzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,EAA8B,MAAM,aAAa,CAAC;AAiDlF,SAAS,WAAW,CAAC,IAAc;IACjC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC;IACnC,OAAO,EAAE,GAAG,IAAI,EAAE,SAAS,EAAE,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,KAAK,IAAI,EAAE,CAAC;AACpF,CAAC;AAED;;qGAEqG;AACrG,SAAS,YAAY,CAAC,QAAuB;IAC3C,MAAM,MAAM,GAAI,QAA4D,CAAC,MAAM,IAAI,EAAE,CAAC;IAC1F,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,OAAO,IAAI,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAC/F,CAAC;AAOD,uFAAuF;AACvF,MAAM,OAAO,SAAS;IACpB,OAAO,CAAQ;IAEf,YAAY,MAAa;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,uFAAuF;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AAO,CAAC,EAAE,CAAC;oBAC9B,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,UAAU,IAAI,EAAE,CAAC;iBAC5C,CAAC;YACJ,CAAC;YACD,MAAM,EAAE,OAAO,CAAC,MAAM;YACtB,WAAW,EAAE,OAAO,CAAC,WAAW,IAAI,IAAI;SACzC,CAAC,CAAC;IACL,CAAC;CACF;AAED,mFAAmF;AACnF,SAAS,iBAAiB;IACxB,OAAO,QAAQ,UAAU,EAAE,EAAE,CAAC;AAChC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Palai } from "../client.ts";
|
|
2
|
+
import { type CallOptions, type ListView } from "./shared.ts";
|
|
3
|
+
export interface SecretRef {
|
|
4
|
+
name: string;
|
|
5
|
+
version: number;
|
|
6
|
+
object: string;
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
}
|
|
9
|
+
export interface SecretRefCreateParams {
|
|
10
|
+
name: string;
|
|
11
|
+
value: string;
|
|
12
|
+
}
|
|
13
|
+
export interface SecretRefRotateParams {
|
|
14
|
+
value: string;
|
|
15
|
+
}
|
|
16
|
+
export declare class SecretRefs {
|
|
17
|
+
#private;
|
|
18
|
+
constructor(client: Palai);
|
|
19
|
+
create(params: SecretRefCreateParams, options?: CallOptions): Promise<SecretRef>;
|
|
20
|
+
list(options?: CallOptions): Promise<ListView<SecretRef>>;
|
|
21
|
+
retrieve(name: string, options?: CallOptions): Promise<SecretRef>;
|
|
22
|
+
rotate(name: string, params: SecretRefRotateParams, options?: CallOptions): Promise<SecretRef>;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=secret-refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-refs.d.ts","sourceRoot":"","sources":["../../src/resources/secret-refs.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAC;AAK7E,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf;AACD,MAAM,WAAW,qBAAqB;IACpC,KAAK,EAAE,MAAM,CAAC;CACf;AAKD,qBAAa,UAAU;;IAErB,YAAY,MAAM,EAAE,KAAK,EAExB;IAIK,MAAM,CAAC,MAAM,EAAE,qBAAqB,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAGzF;IAGK,IAAI,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC,CAGlE;IAGK,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAG1E;IAIK,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,SAAS,CAAC,CAGvG;CACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { callArgs, enc } from "./shared.js";
|
|
2
|
+
// SecretRefs is the restart-less secret-ref write-path (spec §39.x, E13 T3, SEC-002/MCI-002): a tenant
|
|
3
|
+
// POSTs a write-only value the resolver reads fresh, so a rotation takes effect with no restart; reads
|
|
4
|
+
// return metadata only. Requires a key with the `provision` capability.
|
|
5
|
+
export class SecretRefs {
|
|
6
|
+
#client;
|
|
7
|
+
constructor(client) {
|
|
8
|
+
this.#client = client;
|
|
9
|
+
}
|
|
10
|
+
// create stores a new secret under a name (201). The response is metadata only — the value never
|
|
11
|
+
// comes back.
|
|
12
|
+
async create(params, options = {}) {
|
|
13
|
+
const r = await this.#client.request("POST", "/v1/secret-refs", { body: params, ...callArgs(options) });
|
|
14
|
+
return r.body;
|
|
15
|
+
}
|
|
16
|
+
// list returns the tenant's secret-ref metadata (names/versions), never values.
|
|
17
|
+
async list(options = {}) {
|
|
18
|
+
const r = await this.#client.request("GET", "/v1/secret-refs", callArgs(options));
|
|
19
|
+
return r.body;
|
|
20
|
+
}
|
|
21
|
+
// retrieve reads one secret-ref's metadata by name; an unknown name is a 404.
|
|
22
|
+
async retrieve(name, options = {}) {
|
|
23
|
+
const r = await this.#client.request("GET", `/v1/secret-refs/${enc(name)}`, callArgs(options));
|
|
24
|
+
return r.body;
|
|
25
|
+
}
|
|
26
|
+
// rotate inserts a new version for an existing name; rotating a never-created name is a 404. The new
|
|
27
|
+
// value takes effect with no restart.
|
|
28
|
+
async rotate(name, params, options = {}) {
|
|
29
|
+
const r = await this.#client.request("POST", `/v1/secret-refs/${enc(name)}/rotate`, { body: params, ...callArgs(options) });
|
|
30
|
+
return r.body;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
//# sourceMappingURL=secret-refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secret-refs.js","sourceRoot":"","sources":["../../src/resources/secret-refs.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAmC,MAAM,aAAa,CAAC;AAoB7E,uGAAuG;AACvG,uGAAuG;AACvG,wEAAwE;AACxE,MAAM,OAAO,UAAU;IACrB,OAAO,CAAQ;IACf,YAAY,MAAa;QACvB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;IACxB,CAAC;IAED,iGAAiG;IACjG,cAAc;IACd,KAAK,CAAC,MAAM,CAAC,MAA6B,EAAE,OAAO,GAAgB,EAAE;QACnE,MAAM,CAAC,GAAG,MAAM,IAAI,CAAC,OAAO,CAAC,OAAO,CAAY,MAAM,EAAE,iBAAiB,EAAE,EAAE,IAAI,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