sarvam-agents-client 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +136 -23
- package/dist/apis/AgentConversationsApi.d.ts +8 -2
- package/dist/apis/AgentConversationsApi.js +8 -2
- package/dist/apis/AgentsApi.d.ts +6 -6
- package/dist/apis/AgentsApi.js +6 -6
- package/dist/apis/ConversationsApi.d.ts +6 -2
- package/dist/apis/ConversationsApi.js +10 -2
- package/dist/apis/MessagesApi.d.ts +1 -0
- package/dist/apis/MessagesApi.js +3 -0
- package/dist/apis/TriggersApi.d.ts +154 -0
- package/dist/apis/TriggersApi.js +376 -0
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +1 -0
- package/dist/client.d.ts +21 -0
- package/dist/client.js +24 -0
- package/dist/compose/agent.d.ts +4 -0
- package/dist/compose/agent.js +9 -0
- package/dist/compose/deploy.d.ts +8 -0
- package/dist/compose/deploy.js +32 -6
- package/dist/compose/index.d.ts +5 -1
- package/dist/compose/index.js +12 -1
- package/dist/compose/settingsTransport.d.ts +22 -3
- package/dist/compose/settingsTransport.js +180 -15
- package/dist/compose/transport.d.ts +19 -3
- package/dist/compose/trigger.d.ts +166 -0
- package/dist/compose/trigger.js +525 -0
- package/dist/compose/triggers.d.ts +96 -0
- package/dist/compose/triggers.js +319 -0
- package/dist/compose/webhook.d.ts +18 -3
- package/dist/compose/webhook.js +59 -10
- package/dist/compose/webhookSecrets.d.ts +64 -0
- package/dist/compose/webhookSecrets.js +255 -0
- package/dist/esm/apis/AgentConversationsApi.d.ts +8 -2
- package/dist/esm/apis/AgentConversationsApi.js +8 -2
- package/dist/esm/apis/AgentsApi.d.ts +6 -6
- package/dist/esm/apis/AgentsApi.js +6 -6
- package/dist/esm/apis/ConversationsApi.d.ts +6 -2
- package/dist/esm/apis/ConversationsApi.js +10 -2
- package/dist/esm/apis/MessagesApi.d.ts +1 -0
- package/dist/esm/apis/MessagesApi.js +3 -0
- package/dist/esm/apis/TriggersApi.d.ts +154 -0
- package/dist/esm/apis/TriggersApi.js +372 -0
- package/dist/esm/apis/index.d.ts +1 -0
- package/dist/esm/apis/index.js +1 -0
- package/dist/esm/client.d.ts +21 -0
- package/dist/esm/client.js +20 -0
- package/dist/esm/compose/agent.d.ts +4 -0
- package/dist/esm/compose/agent.js +9 -0
- package/dist/esm/compose/deploy.d.ts +8 -0
- package/dist/esm/compose/deploy.js +32 -6
- package/dist/esm/compose/index.d.ts +5 -1
- package/dist/esm/compose/index.js +2 -0
- package/dist/esm/compose/settingsTransport.d.ts +22 -3
- package/dist/esm/compose/settingsTransport.js +179 -15
- package/dist/esm/compose/transport.d.ts +19 -3
- package/dist/esm/compose/trigger.d.ts +166 -0
- package/dist/esm/compose/trigger.js +514 -0
- package/dist/esm/compose/triggers.d.ts +96 -0
- package/dist/esm/compose/triggers.js +315 -0
- package/dist/esm/compose/webhook.d.ts +18 -3
- package/dist/esm/compose/webhook.js +55 -9
- package/dist/esm/compose/webhookSecrets.d.ts +64 -0
- package/dist/esm/compose/webhookSecrets.js +250 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/models/AgentResource.d.ts +7 -0
- package/dist/esm/models/AgentResource.js +3 -0
- package/dist/esm/models/FireResponse.d.ts +63 -0
- package/dist/esm/models/FireResponse.js +63 -0
- package/dist/esm/models/MessagePart.d.ts +8 -0
- package/dist/esm/models/MessagePart.js +2 -0
- package/dist/esm/models/ResponseRotateTriggerSecret.d.ts +50 -0
- package/dist/esm/models/ResponseRotateTriggerSecret.js +54 -0
- package/dist/esm/models/RotatedSecret.d.ts +44 -0
- package/dist/esm/models/RotatedSecret.js +50 -0
- package/dist/esm/models/RotatedSigningSecret.d.ts +40 -0
- package/dist/esm/models/RotatedSigningSecret.js +46 -0
- package/dist/esm/models/TriggerDryRun.d.ts +44 -0
- package/dist/esm/models/TriggerDryRun.js +47 -0
- package/dist/esm/models/TriggerEventList.d.ts +39 -0
- package/dist/esm/models/TriggerEventList.js +46 -0
- package/dist/esm/models/TriggerEventView.d.ts +117 -0
- package/dist/esm/models/TriggerEventView.js +89 -0
- package/dist/esm/models/TriggerList.d.ts +33 -0
- package/dist/esm/models/TriggerList.js +44 -0
- package/dist/esm/models/TriggerSecretPut.d.ts +38 -0
- package/dist/esm/models/TriggerSecretPut.js +45 -0
- package/dist/esm/models/TriggerSecretState.d.ts +52 -0
- package/dist/esm/models/TriggerSecretState.js +56 -0
- package/dist/esm/models/TriggerTestFireRequest.d.ts +38 -0
- package/dist/esm/models/TriggerTestFireRequest.js +43 -0
- package/dist/esm/models/TriggerToken.d.ts +50 -0
- package/dist/esm/models/TriggerToken.js +56 -0
- package/dist/esm/models/TriggerView.d.ts +105 -0
- package/dist/esm/models/TriggerView.js +92 -0
- package/dist/esm/models/index.d.ts +13 -0
- package/dist/esm/models/index.js +13 -0
- package/dist/esm/runtime.d.ts +5 -0
- package/dist/esm/runtime.js +11 -0
- package/dist/esm/webhooks.d.ts +5 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.js +14 -0
- package/dist/models/AgentResource.d.ts +7 -0
- package/dist/models/AgentResource.js +3 -0
- package/dist/models/FireResponse.d.ts +63 -0
- package/dist/models/FireResponse.js +71 -0
- package/dist/models/MessagePart.d.ts +8 -0
- package/dist/models/MessagePart.js +2 -0
- package/dist/models/ResponseRotateTriggerSecret.d.ts +50 -0
- package/dist/models/ResponseRotateTriggerSecret.js +61 -0
- package/dist/models/RotatedSecret.d.ts +44 -0
- package/dist/models/RotatedSecret.js +57 -0
- package/dist/models/RotatedSigningSecret.d.ts +40 -0
- package/dist/models/RotatedSigningSecret.js +53 -0
- package/dist/models/TriggerDryRun.d.ts +44 -0
- package/dist/models/TriggerDryRun.js +54 -0
- package/dist/models/TriggerEventList.d.ts +39 -0
- package/dist/models/TriggerEventList.js +53 -0
- package/dist/models/TriggerEventView.d.ts +117 -0
- package/dist/models/TriggerEventView.js +97 -0
- package/dist/models/TriggerList.d.ts +33 -0
- package/dist/models/TriggerList.js +51 -0
- package/dist/models/TriggerSecretPut.d.ts +38 -0
- package/dist/models/TriggerSecretPut.js +52 -0
- package/dist/models/TriggerSecretState.d.ts +52 -0
- package/dist/models/TriggerSecretState.js +64 -0
- package/dist/models/TriggerTestFireRequest.d.ts +38 -0
- package/dist/models/TriggerTestFireRequest.js +50 -0
- package/dist/models/TriggerToken.d.ts +50 -0
- package/dist/models/TriggerToken.js +63 -0
- package/dist/models/TriggerView.d.ts +105 -0
- package/dist/models/TriggerView.js +100 -0
- package/dist/models/index.d.ts +13 -0
- package/dist/models/index.js +13 -0
- package/dist/runtime.d.ts +5 -0
- package/dist/runtime.js +12 -0
- package/dist/webhooks.d.ts +5 -1
- package/package.json +1 -1
- package/src/apis/AgentConversationsApi.ts +8 -2
- package/src/apis/AgentsApi.ts +6 -6
- package/src/apis/ConversationsApi.ts +14 -2
- package/src/apis/MessagesApi.ts +5 -0
- package/src/apis/TriggersApi.ts +584 -0
- package/src/apis/index.ts +1 -0
- package/src/client.ts +27 -0
- package/src/compose/agent.ts +11 -0
- package/src/compose/deploy.ts +42 -7
- package/src/compose/index.ts +8 -1
- package/src/compose/settingsTransport.ts +183 -18
- package/src/compose/transport.ts +20 -3
- package/src/compose/trigger.ts +635 -0
- package/src/compose/triggers.ts +337 -0
- package/src/compose/webhook.ts +64 -11
- package/src/compose/webhookSecrets.ts +257 -0
- package/src/index.ts +9 -0
- package/src/models/AgentResource.ts +15 -0
- package/src/models/FireResponse.ts +107 -0
- package/src/models/MessagePart.ts +8 -0
- package/src/models/ResponseRotateTriggerSecret.ts +107 -0
- package/src/models/RotatedSecret.ts +83 -0
- package/src/models/RotatedSigningSecret.ts +76 -0
- package/src/models/TriggerDryRun.ts +82 -0
- package/src/models/TriggerEventList.ts +82 -0
- package/src/models/TriggerEventView.ts +183 -0
- package/src/models/TriggerList.ts +74 -0
- package/src/models/TriggerSecretPut.ts +74 -0
- package/src/models/TriggerSecretState.ts +94 -0
- package/src/models/TriggerTestFireRequest.ts +73 -0
- package/src/models/TriggerToken.ts +93 -0
- package/src/models/TriggerView.ts +168 -0
- package/src/models/index.ts +13 -0
- package/src/runtime.ts +12 -0
- package/src/webhooks.ts +5 -1
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
7
|
+
};
|
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
12
|
+
};
|
|
13
|
+
var _WebhookSecrets_backend;
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.WebhookSecrets = exports.PLACEHOLDER_DESCRIPTION = exports.SECRET_DESCRIPTION = void 0;
|
|
16
|
+
exports.secretBackend = secretBackend;
|
|
17
|
+
/**
|
|
18
|
+
* `client.webhooks`: set, rotate, check and delete an agent webhook's signing secret (as Python's
|
|
19
|
+
* `sarvam_agents.compose.webhook_secrets`).
|
|
20
|
+
*
|
|
21
|
+
* The public surface is `WebhookSecrets`. Where the secret lives is behind `SecretBackend`, one small interface with
|
|
22
|
+
* one implementation today, `CustomApiBackend`: the secret is a bearer Custom API the SDK creates, owns and binds to
|
|
23
|
+
* the agent, always with `enabledForChats: false` (`CustomApiCreate` defaults it to true, which would let the agent's
|
|
24
|
+
* sandbox be handed the secret on requests to the webhook's host). When the server ships dedicated secret endpoints
|
|
25
|
+
* (SARC-2597: PUT/DELETE secret, rotate-secret, secretStatus), a second backend replaces this one in `secretBackend`
|
|
26
|
+
* and nothing else changes.
|
|
27
|
+
*
|
|
28
|
+
* No secret is logged, kept on an object or put in an error message.
|
|
29
|
+
*/
|
|
30
|
+
const CustomAPIsApi_js_1 = require("../apis/CustomAPIsApi.js");
|
|
31
|
+
const runtime_js_1 = require("../runtime.js");
|
|
32
|
+
const errors_js_1 = require("./errors.js");
|
|
33
|
+
// Loaded on first use, so the root entry point (which exports `Client`) does not import `node:crypto` up front.
|
|
34
|
+
const loadWebhook = () => Promise.resolve().then(() => require("./webhook.js"));
|
|
35
|
+
const loadCrypto = () => Promise.resolve().then(() => require("../webhooks.js"));
|
|
36
|
+
/** Every Custom API the SDK creates for a webhook secret carries this description (and its name). */
|
|
37
|
+
exports.SECRET_DESCRIPTION = "Webhook signing secret managed by the Sarvam Agents SDK (client.webhooks). Do not edit.";
|
|
38
|
+
/** The description of the random secret `deploy` stores when none is set yet: `secretStatus` reads it as
|
|
39
|
+
* `"missing"`, and `setSecret`/`rotateSecret` overwrite it with `SECRET_DESCRIPTION`. */
|
|
40
|
+
exports.PLACEHOLDER_DESCRIPTION = "Webhook signing secret managed by the Sarvam Agents SDK (client.webhooks). Placeholder: call client.webhooks.set_secret";
|
|
41
|
+
const OWNED = [exports.SECRET_DESCRIPTION, exports.PLACEHOLDER_DESCRIPTION];
|
|
42
|
+
const PAGE = 100;
|
|
43
|
+
/** Throws `SecretFormatError` unless `secret` is `whsec_` plus base64 of 24 to 64 bytes (the verifier's own parser). */
|
|
44
|
+
async function checkSecret(secret) {
|
|
45
|
+
(await loadCrypto()).sign(secret, { msgId: "check", timestamp: 0, body: "" });
|
|
46
|
+
}
|
|
47
|
+
async function urlOf(hook) {
|
|
48
|
+
const url = typeof hook === "string" ? hook : hook === null || hook === void 0 ? void 0 : hook.url;
|
|
49
|
+
if (typeof url !== "string")
|
|
50
|
+
throw new errors_js_1.UserError("webhook: pass the webhook's URL (a string) or a webhook");
|
|
51
|
+
const problem = (await loadWebhook()).urlProblem(url);
|
|
52
|
+
if (problem !== null)
|
|
53
|
+
throw new errors_js_1.UserError("webhook: " + problem);
|
|
54
|
+
return url;
|
|
55
|
+
}
|
|
56
|
+
function agent(agentId) {
|
|
57
|
+
if (typeof agentId !== "string" || agentId.trim() === "")
|
|
58
|
+
throw new errors_js_1.UserError("agentId: pass the agent's id");
|
|
59
|
+
return agentId;
|
|
60
|
+
}
|
|
61
|
+
function status(err) {
|
|
62
|
+
return err instanceof runtime_js_1.ResponseError ? err.response.status : 0;
|
|
63
|
+
}
|
|
64
|
+
/** The server's reason, never its raw body: a 422 may echo the request, and the request carries the secret. */
|
|
65
|
+
async function apiMessage(err, secret) {
|
|
66
|
+
var _a, _b;
|
|
67
|
+
let message;
|
|
68
|
+
if (err instanceof runtime_js_1.ResponseError) {
|
|
69
|
+
try {
|
|
70
|
+
message = (_b = (_a = ((await err.response.clone().json()))) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message;
|
|
71
|
+
}
|
|
72
|
+
catch (_c) {
|
|
73
|
+
message = undefined;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
if (typeof message !== "string" || !message || (secret !== undefined && message.includes(secret))) {
|
|
77
|
+
return `HTTP ${status(err) || "error"}`;
|
|
78
|
+
}
|
|
79
|
+
return message;
|
|
80
|
+
}
|
|
81
|
+
/** Today's store: a bearer Custom API the SDK owns, bound to the agent, never enabled for chats. */
|
|
82
|
+
class CustomApiBackend {
|
|
83
|
+
constructor(api) {
|
|
84
|
+
this.api = api;
|
|
85
|
+
}
|
|
86
|
+
/** The caller's Custom APIs named exactly `name` (`q` also matches substrings and hosts). */
|
|
87
|
+
async named(name) {
|
|
88
|
+
const found = [];
|
|
89
|
+
let offset = 0;
|
|
90
|
+
for (;;) {
|
|
91
|
+
const result = await this.api.listCustomApis({ q: name, limit: PAGE, offset });
|
|
92
|
+
for (const item of result.data)
|
|
93
|
+
if (item.name === name)
|
|
94
|
+
found.push(item);
|
|
95
|
+
offset += result.data.length;
|
|
96
|
+
if (result.data.length === 0 || !result.hasMore)
|
|
97
|
+
return found;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/** The Custom APIs named `name` that the SDK created; throws when only someone else's has the name. */
|
|
101
|
+
async owned(name) {
|
|
102
|
+
const named = await this.named(name);
|
|
103
|
+
const owned = named.filter((item) => { var _a; return OWNED.includes((_a = item.description) !== null && _a !== void 0 ? _a : ""); });
|
|
104
|
+
if (named.length > 0 && owned.length === 0) {
|
|
105
|
+
throw new errors_js_1.UserError(`a Custom API named '${name}' exists that the SDK did not create; it was left alone. ` +
|
|
106
|
+
"Rename or delete it, then try again");
|
|
107
|
+
}
|
|
108
|
+
return owned;
|
|
109
|
+
}
|
|
110
|
+
async bind(agentId, customApiId) {
|
|
111
|
+
const bound = (await this.api.listAgentCustomApis({ agentId })).data;
|
|
112
|
+
if (bound.some((item) => item.id === customApiId))
|
|
113
|
+
return;
|
|
114
|
+
try {
|
|
115
|
+
await this.api.bindCustomApi({ agentId, bindCustomApiBody: { customApiId } });
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
if (status(err) === 409)
|
|
119
|
+
return; // bound meanwhile
|
|
120
|
+
throw new errors_js_1.UserError(`could not bind the webhook secret to agent ${agentId}: ${await apiMessage(err)}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
/** PATCH the secret in, always asking for `enabledForChats: false`. The server switches chats off by detaching a
|
|
124
|
+
* capability, and answers 404 when there is nothing to detach (the API is already off). Then the API is read
|
|
125
|
+
* back: only when it exists and is off is the PATCH sent again without the switch, so the secret still lands and
|
|
126
|
+
* chats stay off. */
|
|
127
|
+
async update(customApiId, host, description, secret) {
|
|
128
|
+
const patch = (off) => this.api.updateCustomApi({ customApiId, customApiUpdate: {
|
|
129
|
+
host, description, auth: { type: "bearer", token: secret }, ...off,
|
|
130
|
+
} });
|
|
131
|
+
try {
|
|
132
|
+
await patch({ enabledForChats: false });
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
if (status(err) !== 404)
|
|
136
|
+
throw err;
|
|
137
|
+
if ((await this.api.getCustomApi({ customApiId })).enabledForChats !== false)
|
|
138
|
+
throw err; // gone (404) or on
|
|
139
|
+
await patch({});
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async store(agentId, url, secret, owned, description = exports.SECRET_DESCRIPTION) {
|
|
143
|
+
const { secretCredentialName, webhookHost } = await loadWebhook();
|
|
144
|
+
const name = secretCredentialName(agentId, url);
|
|
145
|
+
const host = webhookHost(url);
|
|
146
|
+
let customApiId;
|
|
147
|
+
try {
|
|
148
|
+
if (owned.length > 0) {
|
|
149
|
+
customApiId = owned[0].id;
|
|
150
|
+
await this.update(customApiId, host, description, secret);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
customApiId = (await this.api.createCustomApi({ customApiCreate: {
|
|
154
|
+
name, description, host, enabledForChats: false, auth: { type: "bearer", token: secret },
|
|
155
|
+
} })).id;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
catch (err) {
|
|
159
|
+
if (!(err instanceof runtime_js_1.ResponseError))
|
|
160
|
+
throw err;
|
|
161
|
+
throw new errors_js_1.UserError(`could not store the webhook secret for ${host}: ${await apiMessage(err, secret)}`);
|
|
162
|
+
}
|
|
163
|
+
await this.bind(agentId, customApiId);
|
|
164
|
+
return name;
|
|
165
|
+
}
|
|
166
|
+
async put(agentId, url, secret) {
|
|
167
|
+
await this.store(agentId, url, secret, await this.owned((await loadWebhook()).secretCredentialName(agentId, url)));
|
|
168
|
+
}
|
|
169
|
+
async status(agentId, url) {
|
|
170
|
+
const name = (await loadWebhook()).secretCredentialName(agentId, url);
|
|
171
|
+
// Not a placeholder, not someone else's.
|
|
172
|
+
const stored = (await this.named(name)).filter((item) => item.description === exports.SECRET_DESCRIPTION).map((i) => i.id);
|
|
173
|
+
if (stored.length === 0)
|
|
174
|
+
return "missing";
|
|
175
|
+
const bound = (await this.api.listAgentCustomApis({ agentId })).data;
|
|
176
|
+
return bound.some((item) => stored.includes(item.id)) ? "set" : "missing";
|
|
177
|
+
}
|
|
178
|
+
async delete(agentId, url) {
|
|
179
|
+
for (const item of await this.owned((await loadWebhook()).secretCredentialName(agentId, url))) {
|
|
180
|
+
try {
|
|
181
|
+
await this.api.unbindCustomApi({ agentId, customApiId: item.id });
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
if (status(err) !== 404)
|
|
185
|
+
throw err;
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
await this.api.deleteCustomApi({ customApiId: item.id });
|
|
189
|
+
}
|
|
190
|
+
catch (err) {
|
|
191
|
+
if (status(err) !== 404)
|
|
192
|
+
throw err;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async ensure(agentId, url) {
|
|
197
|
+
const name = (await loadWebhook()).secretCredentialName(agentId, url);
|
|
198
|
+
const owned = await this.owned(name);
|
|
199
|
+
if (owned.length > 0) {
|
|
200
|
+
await this.bind(agentId, owned[0].id);
|
|
201
|
+
return { name, status: owned[0].description === exports.SECRET_DESCRIPTION ? "set" : "missing" };
|
|
202
|
+
}
|
|
203
|
+
console.warn(`agent ${agentId}: webhook ${url} has no signing secret yet; stored a random one nobody holds, so ` +
|
|
204
|
+
"deliveries fail verification until you call client.webhooks.setSecret");
|
|
205
|
+
const stored = await this.store(agentId, url, (await loadCrypto()).generateSecret(), owned, exports.PLACEHOLDER_DESCRIPTION);
|
|
206
|
+
return { name: stored, status: "missing" };
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/** The one place that picks where secrets live. */
|
|
210
|
+
function secretBackend(api) {
|
|
211
|
+
var _a;
|
|
212
|
+
return new CustomApiBackend((_a = api.customApis) !== null && _a !== void 0 ? _a : new CustomAPIsApi_js_1.CustomAPIsApi(api.config));
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* `client.webhooks`: the signing secret of each agent.json webhook.
|
|
216
|
+
*
|
|
217
|
+
* `webhook` is the webhook's URL (or a webhook object); the secret covers the URL's host. Secrets are `whsec_` plus
|
|
218
|
+
* base64 of 24 to 64 bytes.
|
|
219
|
+
*/
|
|
220
|
+
class WebhookSecrets {
|
|
221
|
+
constructor(config) {
|
|
222
|
+
_WebhookSecrets_backend.set(this, void 0);
|
|
223
|
+
__classPrivateFieldSet(this, _WebhookSecrets_backend, secretBackend({ config }), "f");
|
|
224
|
+
}
|
|
225
|
+
/** Store `secret` (a new generated one when left out) as the webhook's signing secret and return it. A malformed
|
|
226
|
+
* secret throws `SecretFormatError` before anything is sent. */
|
|
227
|
+
async setSecret(agentId, webhook, secret) {
|
|
228
|
+
const id = agent(agentId);
|
|
229
|
+
const url = await urlOf(webhook);
|
|
230
|
+
const value = secret === undefined ? (await loadCrypto()).generateSecret() : secret;
|
|
231
|
+
if (secret !== undefined)
|
|
232
|
+
await checkSecret(secret);
|
|
233
|
+
await __classPrivateFieldGet(this, _WebhookSecrets_backend, "f").put(id, url, value);
|
|
234
|
+
return value;
|
|
235
|
+
}
|
|
236
|
+
/** Replace the webhook's signing secret with a new generated one and return it. Have your receiver accept the old
|
|
237
|
+
* and the new secret for a few minutes: a delivery still retrying is signed with the new one. */
|
|
238
|
+
async rotateSecret(agentId, webhook) {
|
|
239
|
+
return this.setSecret(agentId, webhook);
|
|
240
|
+
}
|
|
241
|
+
/** `"set"` when the agent has a signing secret stored by `setSecret` or `rotateSecret` for the webhook; `"missing"`
|
|
242
|
+
* otherwise, including while it holds the placeholder a deploy stored. */
|
|
243
|
+
async secretStatus(agentId, webhook) {
|
|
244
|
+
const id = agent(agentId);
|
|
245
|
+
return __classPrivateFieldGet(this, _WebhookSecrets_backend, "f").status(id, await urlOf(webhook));
|
|
246
|
+
}
|
|
247
|
+
/** Remove the webhook's signing secret. Only what the SDK stored is removed; a Custom API you made yourself is
|
|
248
|
+
* never touched. Deliveries to the webhook fail until a new secret is set or the webhook is removed. */
|
|
249
|
+
async deleteSecret(agentId, webhook) {
|
|
250
|
+
const id = agent(agentId);
|
|
251
|
+
await __classPrivateFieldGet(this, _WebhookSecrets_backend, "f").delete(id, await urlOf(webhook));
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
exports.WebhookSecrets = WebhookSecrets;
|
|
255
|
+
_WebhookSecrets_backend = new WeakMap();
|
|
@@ -73,12 +73,12 @@ export declare class AgentConversationsApi extends runtime.BaseAPI {
|
|
|
73
73
|
*/
|
|
74
74
|
listAgentConversationMessages(requestParameters: ListAgentConversationMessagesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MessagesResponse>;
|
|
75
75
|
/**
|
|
76
|
-
* The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``slack``, ``teams``, ``all``) and the values add up.
|
|
76
|
+
* The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``playground``, ``trigger``, ``slack``, ``teams``, ``all``) and the values add up; ``trigger`` (included in ``all``) is the conversations an inbound trigger started.
|
|
77
77
|
* List Agent Conversations Route
|
|
78
78
|
*/
|
|
79
79
|
listAgentConversationsRaw(requestParameters: ListAgentConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PageAgentConversationView>>;
|
|
80
80
|
/**
|
|
81
|
-
* The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``slack``, ``teams``, ``all``) and the values add up.
|
|
81
|
+
* The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``playground``, ``trigger``, ``slack``, ``teams``, ``all``) and the values add up; ``trigger`` (included in ``all``) is the conversations an inbound trigger started.
|
|
82
82
|
* List Agent Conversations Route
|
|
83
83
|
*/
|
|
84
84
|
listAgentConversations(requestParameters: ListAgentConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PageAgentConversationView>;
|
|
@@ -97,6 +97,8 @@ export type AgentConversationArtifactDownloadUrlDispositionEnum = typeof AgentCo
|
|
|
97
97
|
export declare const GetAgentConversationSessionTypeEnum: {
|
|
98
98
|
readonly Api: "api";
|
|
99
99
|
readonly Chat: "chat";
|
|
100
|
+
readonly Playground: "playground";
|
|
101
|
+
readonly Trigger: "trigger";
|
|
100
102
|
readonly Slack: "slack";
|
|
101
103
|
readonly Teams: "teams";
|
|
102
104
|
readonly All: "all";
|
|
@@ -108,6 +110,8 @@ export type GetAgentConversationSessionTypeEnum = typeof GetAgentConversationSes
|
|
|
108
110
|
export declare const ListAgentConversationMessagesSessionTypeEnum: {
|
|
109
111
|
readonly Api: "api";
|
|
110
112
|
readonly Chat: "chat";
|
|
113
|
+
readonly Playground: "playground";
|
|
114
|
+
readonly Trigger: "trigger";
|
|
111
115
|
readonly Slack: "slack";
|
|
112
116
|
readonly Teams: "teams";
|
|
113
117
|
readonly All: "all";
|
|
@@ -119,6 +123,8 @@ export type ListAgentConversationMessagesSessionTypeEnum = typeof ListAgentConve
|
|
|
119
123
|
export declare const ListAgentConversationsSessionTypeEnum: {
|
|
120
124
|
readonly Api: "api";
|
|
121
125
|
readonly Chat: "chat";
|
|
126
|
+
readonly Playground: "playground";
|
|
127
|
+
readonly Trigger: "trigger";
|
|
122
128
|
readonly Slack: "slack";
|
|
123
129
|
readonly Teams: "teams";
|
|
124
130
|
readonly All: "all";
|
|
@@ -150,7 +150,7 @@ export class AgentConversationsApi extends runtime.BaseAPI {
|
|
|
150
150
|
return await response.value();
|
|
151
151
|
}
|
|
152
152
|
/**
|
|
153
|
-
* The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``slack``, ``teams``, ``all``) and the values add up.
|
|
153
|
+
* The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``playground``, ``trigger``, ``slack``, ``teams``, ``all``) and the values add up; ``trigger`` (included in ``all``) is the conversations an inbound trigger started.
|
|
154
154
|
* List Agent Conversations Route
|
|
155
155
|
*/
|
|
156
156
|
async listAgentConversationsRaw(requestParameters, initOverrides) {
|
|
@@ -190,7 +190,7 @@ export class AgentConversationsApi extends runtime.BaseAPI {
|
|
|
190
190
|
return new runtime.JSONApiResponse(response, (jsonValue) => PageAgentConversationViewFromJSON(jsonValue));
|
|
191
191
|
}
|
|
192
192
|
/**
|
|
193
|
-
* The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``slack``, ``teams``, ``all``) and the values add up.
|
|
193
|
+
* The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``playground``, ``trigger``, ``slack``, ``teams``, ``all``) and the values add up; ``trigger`` (included in ``all``) is the conversations an inbound trigger started.
|
|
194
194
|
* List Agent Conversations Route
|
|
195
195
|
*/
|
|
196
196
|
async listAgentConversations(requestParameters, initOverrides) {
|
|
@@ -211,6 +211,8 @@ export const AgentConversationArtifactDownloadUrlDispositionEnum = {
|
|
|
211
211
|
export const GetAgentConversationSessionTypeEnum = {
|
|
212
212
|
Api: 'api',
|
|
213
213
|
Chat: 'chat',
|
|
214
|
+
Playground: 'playground',
|
|
215
|
+
Trigger: 'trigger',
|
|
214
216
|
Slack: 'slack',
|
|
215
217
|
Teams: 'teams',
|
|
216
218
|
All: 'all'
|
|
@@ -221,6 +223,8 @@ export const GetAgentConversationSessionTypeEnum = {
|
|
|
221
223
|
export const ListAgentConversationMessagesSessionTypeEnum = {
|
|
222
224
|
Api: 'api',
|
|
223
225
|
Chat: 'chat',
|
|
226
|
+
Playground: 'playground',
|
|
227
|
+
Trigger: 'trigger',
|
|
224
228
|
Slack: 'slack',
|
|
225
229
|
Teams: 'teams',
|
|
226
230
|
All: 'all'
|
|
@@ -231,6 +235,8 @@ export const ListAgentConversationMessagesSessionTypeEnum = {
|
|
|
231
235
|
export const ListAgentConversationsSessionTypeEnum = {
|
|
232
236
|
Api: 'api',
|
|
233
237
|
Chat: 'chat',
|
|
238
|
+
Playground: 'playground',
|
|
239
|
+
Trigger: 'trigger',
|
|
234
240
|
Slack: 'slack',
|
|
235
241
|
Teams: 'teams',
|
|
236
242
|
All: 'all'
|
|
@@ -213,12 +213,12 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
213
213
|
*/
|
|
214
214
|
createAgent(requestParameters: CreateAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
|
|
215
215
|
/**
|
|
216
|
-
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
|
|
216
|
+
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it. Once the gateway confirms the delete, the agent\'s inbound triggers are retired (only with ``CLAW_TRIGGERS_ENABLED`` on); that cleanup never fails the delete.
|
|
217
217
|
* Delete Agent
|
|
218
218
|
*/
|
|
219
219
|
deleteAgentRaw(requestParameters: DeleteAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
220
220
|
/**
|
|
221
|
-
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
|
|
221
|
+
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it. Once the gateway confirms the delete, the agent\'s inbound triggers are retired (only with ``CLAW_TRIGGERS_ENABLED`` on); that cleanup never fails the delete.
|
|
222
222
|
* Delete Agent
|
|
223
223
|
*/
|
|
224
224
|
deleteAgent(requestParameters: DeleteAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
@@ -233,12 +233,12 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
233
233
|
*/
|
|
234
234
|
deleteVersion(requestParameters: DeleteVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
235
235
|
/**
|
|
236
|
-
* Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change.
|
|
236
|
+
* Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change. With inbound triggers on, it then makes the agent\'s ``triggers`` rows match the live version\'s ``agent.json``, and returns the bearer token of each trigger minted by this call in ``triggerTokens`` (once; a repeat deploy returns none for a trigger that already has one). That response carries secrets: it is marked ``Cache-Control: no-store``, this route does no request or response body logging, and the tokens are never logged or put on a span. A reconcile failure leaves the deploy done and answers 502; deploying again finishes the reconcile.
|
|
237
237
|
* Deploy Agent
|
|
238
238
|
*/
|
|
239
239
|
deployAgentRaw(requestParameters: DeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentResource>>;
|
|
240
240
|
/**
|
|
241
|
-
* Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change.
|
|
241
|
+
* Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change. With inbound triggers on, it then makes the agent\'s ``triggers`` rows match the live version\'s ``agent.json``, and returns the bearer token of each trigger minted by this call in ``triggerTokens`` (once; a repeat deploy returns none for a trigger that already has one). That response carries secrets: it is marked ``Cache-Control: no-store``, this route does no request or response body logging, and the tokens are never logged or put on a span. A reconcile failure leaves the deploy done and answers 502; deploying again finishes the reconcile.
|
|
242
242
|
* Deploy Agent
|
|
243
243
|
*/
|
|
244
244
|
deployAgent(requestParameters: DeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
|
|
@@ -433,12 +433,12 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
433
433
|
*/
|
|
434
434
|
putInstructions(requestParameters: PutInstructionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InstructionsResponse>;
|
|
435
435
|
/**
|
|
436
|
-
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
|
|
436
|
+
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise. With inbound triggers on, the events its triggers received while it was paused (``skipped_agent_unavailable``, payload kept) go back to the inbox and start in received order. A failure there is logged and leaves the resume done: those events stay replayable one by one.
|
|
437
437
|
* Resume Agent
|
|
438
438
|
*/
|
|
439
439
|
resumeAgentRaw(requestParameters: ResumeAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentResource>>;
|
|
440
440
|
/**
|
|
441
|
-
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
|
|
441
|
+
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise. With inbound triggers on, the events its triggers received while it was paused (``skipped_agent_unavailable``, payload kept) go back to the inbox and start in received order. A failure there is logged and leaves the resume done: those events stay replayable one by one.
|
|
442
442
|
* Resume Agent
|
|
443
443
|
*/
|
|
444
444
|
resumeAgent(requestParameters: ResumeAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
|
|
@@ -211,7 +211,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
211
211
|
return await response.value();
|
|
212
212
|
}
|
|
213
213
|
/**
|
|
214
|
-
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
|
|
214
|
+
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it. Once the gateway confirms the delete, the agent\'s inbound triggers are retired (only with ``CLAW_TRIGGERS_ENABLED`` on); that cleanup never fails the delete.
|
|
215
215
|
* Delete Agent
|
|
216
216
|
*/
|
|
217
217
|
async deleteAgentRaw(requestParameters, initOverrides) {
|
|
@@ -236,7 +236,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
236
236
|
return new runtime.VoidApiResponse(response);
|
|
237
237
|
}
|
|
238
238
|
/**
|
|
239
|
-
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
|
|
239
|
+
* Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it. Once the gateway confirms the delete, the agent\'s inbound triggers are retired (only with ``CLAW_TRIGGERS_ENABLED`` on); that cleanup never fails the delete.
|
|
240
240
|
* Delete Agent
|
|
241
241
|
*/
|
|
242
242
|
async deleteAgent(requestParameters, initOverrides) {
|
|
@@ -278,7 +278,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
278
278
|
await this.deleteVersionRaw(requestParameters, initOverrides);
|
|
279
279
|
}
|
|
280
280
|
/**
|
|
281
|
-
* Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change.
|
|
281
|
+
* Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change. With inbound triggers on, it then makes the agent\'s ``triggers`` rows match the live version\'s ``agent.json``, and returns the bearer token of each trigger minted by this call in ``triggerTokens`` (once; a repeat deploy returns none for a trigger that already has one). That response carries secrets: it is marked ``Cache-Control: no-store``, this route does no request or response body logging, and the tokens are never logged or put on a span. A reconcile failure leaves the deploy done and answers 502; deploying again finishes the reconcile.
|
|
282
282
|
* Deploy Agent
|
|
283
283
|
*/
|
|
284
284
|
async deployAgentRaw(requestParameters, initOverrides) {
|
|
@@ -305,7 +305,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
305
305
|
return new runtime.JSONApiResponse(response, (jsonValue) => AgentResourceFromJSON(jsonValue));
|
|
306
306
|
}
|
|
307
307
|
/**
|
|
308
|
-
* Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change.
|
|
308
|
+
* Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change. With inbound triggers on, it then makes the agent\'s ``triggers`` rows match the live version\'s ``agent.json``, and returns the bearer token of each trigger minted by this call in ``triggerTokens`` (once; a repeat deploy returns none for a trigger that already has one). That response carries secrets: it is marked ``Cache-Control: no-store``, this route does no request or response body logging, and the tokens are never logged or put on a span. A reconcile failure leaves the deploy done and answers 502; deploying again finishes the reconcile.
|
|
309
309
|
* Deploy Agent
|
|
310
310
|
*/
|
|
311
311
|
async deployAgent(requestParameters, initOverrides) {
|
|
@@ -1044,7 +1044,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
1044
1044
|
return await response.value();
|
|
1045
1045
|
}
|
|
1046
1046
|
/**
|
|
1047
|
-
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
|
|
1047
|
+
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise. With inbound triggers on, the events its triggers received while it was paused (``skipped_agent_unavailable``, payload kept) go back to the inbox and start in received order. A failure there is logged and leaves the resume done: those events stay replayable one by one.
|
|
1048
1048
|
* Resume Agent
|
|
1049
1049
|
*/
|
|
1050
1050
|
async resumeAgentRaw(requestParameters, initOverrides) {
|
|
@@ -1069,7 +1069,7 @@ export class AgentsApi extends runtime.BaseAPI {
|
|
|
1069
1069
|
return new runtime.JSONApiResponse(response, (jsonValue) => AgentResourceFromJSON(jsonValue));
|
|
1070
1070
|
}
|
|
1071
1071
|
/**
|
|
1072
|
-
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
|
|
1072
|
+
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise. With inbound triggers on, the events its triggers received while it was paused (``skipped_agent_unavailable``, payload kept) go back to the inbox and start in received order. A failure there is logged and leaves the resume done: those events stay replayable one by one.
|
|
1073
1073
|
* Resume Agent
|
|
1074
1074
|
*/
|
|
1075
1075
|
async resumeAgent(requestParameters, initOverrides) {
|
|
@@ -23,10 +23,12 @@ export interface GetConversationRequest {
|
|
|
23
23
|
conversationId: string;
|
|
24
24
|
xClientPlatform?: string | null;
|
|
25
25
|
xClientVersion?: string | null;
|
|
26
|
+
xClientFeatures?: string | null;
|
|
26
27
|
}
|
|
27
28
|
export interface GetResponseRequest {
|
|
28
29
|
conversationId: string;
|
|
29
30
|
responseId: string;
|
|
31
|
+
xClientFeatures?: string | null;
|
|
30
32
|
}
|
|
31
33
|
export interface ListConversationsRequest {
|
|
32
34
|
limit?: number;
|
|
@@ -54,12 +56,12 @@ export interface UpdateConversationRequest {
|
|
|
54
56
|
*/
|
|
55
57
|
export declare class ConversationsApi extends runtime.BaseAPI {
|
|
56
58
|
/**
|
|
57
|
-
* ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has.
|
|
59
|
+
* ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has. A conversation created with ``X-Panja-Surface: playground`` (an agent\'s Playground) is saved as session type ``playground``: hidden from the default inbox and listed apart from real chats in the agent\'s session log. Never gated, so drafts work (``services.session_types``).
|
|
58
60
|
* Create Conversation Route
|
|
59
61
|
*/
|
|
60
62
|
createConversationRaw(requestParameters: CreateConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationView>>;
|
|
61
63
|
/**
|
|
62
|
-
* ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has.
|
|
64
|
+
* ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has. A conversation created with ``X-Panja-Surface: playground`` (an agent\'s Playground) is saved as session type ``playground``: hidden from the default inbox and listed apart from real chats in the agent\'s session log. Never gated, so drafts work (``services.session_types``).
|
|
63
65
|
* Create Conversation Route
|
|
64
66
|
*/
|
|
65
67
|
createConversation(requestParameters: CreateConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationView>;
|
|
@@ -155,6 +157,8 @@ export declare const ListConversationsSessionTypeEnum: {
|
|
|
155
157
|
readonly Chat: "chat";
|
|
156
158
|
readonly Build: "build";
|
|
157
159
|
readonly Api: "api";
|
|
160
|
+
readonly Playground: "playground";
|
|
161
|
+
readonly Trigger: "trigger";
|
|
158
162
|
readonly All: "all";
|
|
159
163
|
};
|
|
160
164
|
export type ListConversationsSessionTypeEnum = typeof ListConversationsSessionTypeEnum[keyof typeof ListConversationsSessionTypeEnum];
|
|
@@ -18,7 +18,7 @@ import { ConversationDetailFromJSON, ConversationViewFromJSON, CreateConversatio
|
|
|
18
18
|
*/
|
|
19
19
|
export class ConversationsApi extends runtime.BaseAPI {
|
|
20
20
|
/**
|
|
21
|
-
* ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has.
|
|
21
|
+
* ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has. A conversation created with ``X-Panja-Surface: playground`` (an agent\'s Playground) is saved as session type ``playground``: hidden from the default inbox and listed apart from real chats in the agent\'s session log. Never gated, so drafts work (``services.session_types``).
|
|
22
22
|
* Create Conversation Route
|
|
23
23
|
*/
|
|
24
24
|
async createConversationRaw(requestParameters, initOverrides) {
|
|
@@ -51,7 +51,7 @@ export class ConversationsApi extends runtime.BaseAPI {
|
|
|
51
51
|
return new runtime.JSONApiResponse(response, (jsonValue) => ConversationViewFromJSON(jsonValue));
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
|
-
* ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has.
|
|
54
|
+
* ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has. A conversation created with ``X-Panja-Surface: playground`` (an agent\'s Playground) is saved as session type ``playground``: hidden from the default inbox and listed apart from real chats in the agent\'s session log. Never gated, so drafts work (``services.session_types``).
|
|
55
55
|
* Create Conversation Route
|
|
56
56
|
*/
|
|
57
57
|
async createConversation(requestParameters, initOverrides) {
|
|
@@ -103,6 +103,9 @@ export class ConversationsApi extends runtime.BaseAPI {
|
|
|
103
103
|
if (requestParameters['xClientVersion'] != null) {
|
|
104
104
|
headerParameters['X-Client-Version'] = String(requestParameters['xClientVersion']);
|
|
105
105
|
}
|
|
106
|
+
if (requestParameters['xClientFeatures'] != null) {
|
|
107
|
+
headerParameters['X-Client-Features'] = String(requestParameters['xClientFeatures']);
|
|
108
|
+
}
|
|
106
109
|
if (this.configuration && this.configuration.accessToken) {
|
|
107
110
|
const token = this.configuration.accessToken;
|
|
108
111
|
const tokenString = await token("bearerAuth", []);
|
|
@@ -138,6 +141,9 @@ export class ConversationsApi extends runtime.BaseAPI {
|
|
|
138
141
|
}
|
|
139
142
|
const queryParameters = {};
|
|
140
143
|
const headerParameters = {};
|
|
144
|
+
if (requestParameters['xClientFeatures'] != null) {
|
|
145
|
+
headerParameters['X-Client-Features'] = String(requestParameters['xClientFeatures']);
|
|
146
|
+
}
|
|
141
147
|
if (this.configuration && this.configuration.accessToken) {
|
|
142
148
|
const token = this.configuration.accessToken;
|
|
143
149
|
const tokenString = await token("bearerAuth", []);
|
|
@@ -362,5 +368,7 @@ export const ListConversationsSessionTypeEnum = {
|
|
|
362
368
|
Chat: 'chat',
|
|
363
369
|
Build: 'build',
|
|
364
370
|
Api: 'api',
|
|
371
|
+
Playground: 'playground',
|
|
372
|
+
Trigger: 'trigger',
|
|
365
373
|
All: 'all'
|
|
366
374
|
};
|
|
@@ -144,6 +144,9 @@ export class MessagesApi extends runtime.BaseAPI {
|
|
|
144
144
|
queryParameters['turnLimit'] = requestParameters['turnLimit'];
|
|
145
145
|
}
|
|
146
146
|
const headerParameters = {};
|
|
147
|
+
if (requestParameters['xClientFeatures'] != null) {
|
|
148
|
+
headerParameters['X-Client-Features'] = String(requestParameters['xClientFeatures']);
|
|
149
|
+
}
|
|
147
150
|
if (this.configuration && this.configuration.accessToken) {
|
|
148
151
|
const token = this.configuration.accessToken;
|
|
149
152
|
const tokenString = await token("bearerAuth", []);
|