sarvam-agents-client 0.3.1 → 0.4.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 +82 -0
- package/dist/apis/AgentConversationsApi.d.ts +2 -2
- package/dist/apis/AgentConversationsApi.js +2 -2
- package/dist/apis/AgentsApi.d.ts +195 -5
- package/dist/apis/AgentsApi.js +478 -5
- package/dist/apis/ArtifactsApi.d.ts +8 -4
- package/dist/apis/ArtifactsApi.js +8 -4
- package/dist/apis/ConversationsApi.d.ts +2 -0
- package/dist/apis/ConversationsApi.js +6 -0
- package/dist/compose/agent.d.ts +4 -0
- package/dist/compose/agent.js +8 -0
- package/dist/compose/deploy.d.ts +33 -7
- package/dist/compose/deploy.js +97 -19
- package/dist/compose/errors.d.ts +1 -1
- package/dist/compose/errors.js +1 -1
- package/dist/compose/index.d.ts +2 -1
- package/dist/compose/index.js +2 -1
- package/dist/compose/run.d.ts +5 -1
- package/dist/compose/run.js +9 -9
- package/dist/compose/settingsTransport.d.ts +17 -0
- package/dist/compose/settingsTransport.js +176 -12
- package/dist/compose/transport.d.ts +11 -0
- package/dist/compose/transport.js +3 -0
- package/dist/compose/webhook.d.ts +19 -0
- package/dist/compose/webhook.js +184 -0
- package/dist/esm/apis/AgentConversationsApi.d.ts +2 -2
- package/dist/esm/apis/AgentConversationsApi.js +2 -2
- package/dist/esm/apis/AgentsApi.d.ts +195 -5
- package/dist/esm/apis/AgentsApi.js +478 -5
- package/dist/esm/apis/ArtifactsApi.d.ts +8 -4
- package/dist/esm/apis/ArtifactsApi.js +8 -4
- package/dist/esm/apis/ConversationsApi.d.ts +2 -0
- package/dist/esm/apis/ConversationsApi.js +6 -0
- package/dist/esm/compose/agent.d.ts +4 -0
- package/dist/esm/compose/agent.js +8 -0
- package/dist/esm/compose/deploy.d.ts +33 -7
- package/dist/esm/compose/deploy.js +97 -20
- package/dist/esm/compose/errors.d.ts +1 -1
- package/dist/esm/compose/errors.js +1 -1
- package/dist/esm/compose/index.d.ts +2 -1
- package/dist/esm/compose/index.js +1 -1
- package/dist/esm/compose/run.d.ts +5 -1
- package/dist/esm/compose/run.js +9 -9
- package/dist/esm/compose/settingsTransport.d.ts +17 -0
- package/dist/esm/compose/settingsTransport.js +176 -12
- package/dist/esm/compose/transport.d.ts +11 -0
- package/dist/esm/compose/transport.js +2 -1
- package/dist/esm/compose/webhook.d.ts +19 -0
- package/dist/esm/compose/webhook.js +177 -0
- package/dist/esm/models/AgentAttachmentDiff.d.ts +50 -0
- package/dist/esm/models/AgentAttachmentDiff.js +55 -0
- package/dist/esm/models/AgentContentsResource.d.ts +71 -0
- package/dist/esm/models/AgentContentsResource.js +70 -0
- package/dist/esm/models/AgentDeploy.d.ts +33 -0
- package/dist/esm/models/AgentDeploy.js +41 -0
- package/dist/esm/models/AgentDraftResource.d.ts +51 -0
- package/dist/esm/models/AgentDraftResource.js +52 -0
- package/dist/esm/models/AgentFileContent.d.ts +38 -0
- package/dist/esm/models/AgentFileContent.js +47 -0
- package/dist/esm/models/AgentHistoryResource.d.ts +71 -0
- package/dist/esm/models/AgentHistoryResource.js +66 -0
- package/dist/esm/models/AgentResource.d.ts +21 -0
- package/dist/esm/models/AgentResource.js +12 -0
- package/dist/esm/models/AgentSkillFilePin.d.ts +44 -0
- package/dist/esm/models/AgentSkillFilePin.js +51 -0
- package/dist/esm/models/AgentSubagentEntry.d.ts +38 -0
- package/dist/esm/models/AgentSubagentEntry.js +47 -0
- package/dist/esm/models/AgentVersionCreate.d.ts +32 -0
- package/dist/esm/models/AgentVersionCreate.js +41 -0
- package/dist/esm/models/AgentVersionDiffResource.d.ts +87 -0
- package/dist/esm/models/AgentVersionDiffResource.js +78 -0
- package/dist/esm/models/AgentVersionPick.d.ts +32 -0
- package/dist/esm/models/AgentVersionPick.js +43 -0
- package/dist/esm/models/AgentVersionResource.d.ts +56 -0
- package/dist/esm/models/AgentVersionResource.js +57 -0
- package/dist/esm/models/AppResource.d.ts +12 -0
- package/dist/esm/models/AppResource.js +4 -0
- package/dist/esm/models/ResponseInput.d.ts +6 -0
- package/dist/esm/models/ResponseInput.js +2 -0
- package/dist/esm/models/SkillUpdateResource.d.ts +38 -0
- package/dist/esm/models/SkillUpdateResource.js +47 -0
- package/dist/esm/models/index.d.ts +13 -0
- package/dist/esm/models/index.js +13 -0
- package/dist/esm/webhooks.d.ts +203 -0
- package/dist/esm/webhooks.js +215 -0
- package/dist/models/AgentAttachmentDiff.d.ts +50 -0
- package/dist/models/AgentAttachmentDiff.js +62 -0
- package/dist/models/AgentContentsResource.d.ts +71 -0
- package/dist/models/AgentContentsResource.js +77 -0
- package/dist/models/AgentDeploy.d.ts +33 -0
- package/dist/models/AgentDeploy.js +48 -0
- package/dist/models/AgentDraftResource.d.ts +51 -0
- package/dist/models/AgentDraftResource.js +59 -0
- package/dist/models/AgentFileContent.d.ts +38 -0
- package/dist/models/AgentFileContent.js +54 -0
- package/dist/models/AgentHistoryResource.d.ts +71 -0
- package/dist/models/AgentHistoryResource.js +74 -0
- package/dist/models/AgentResource.d.ts +21 -0
- package/dist/models/AgentResource.js +13 -1
- package/dist/models/AgentSkillFilePin.d.ts +44 -0
- package/dist/models/AgentSkillFilePin.js +58 -0
- package/dist/models/AgentSubagentEntry.d.ts +38 -0
- package/dist/models/AgentSubagentEntry.js +54 -0
- package/dist/models/AgentVersionCreate.d.ts +32 -0
- package/dist/models/AgentVersionCreate.js +48 -0
- package/dist/models/AgentVersionDiffResource.d.ts +87 -0
- package/dist/models/AgentVersionDiffResource.js +85 -0
- package/dist/models/AgentVersionPick.d.ts +32 -0
- package/dist/models/AgentVersionPick.js +50 -0
- package/dist/models/AgentVersionResource.d.ts +56 -0
- package/dist/models/AgentVersionResource.js +64 -0
- package/dist/models/AppResource.d.ts +12 -0
- package/dist/models/AppResource.js +4 -0
- package/dist/models/ResponseInput.d.ts +6 -0
- package/dist/models/ResponseInput.js +2 -0
- package/dist/models/SkillUpdateResource.d.ts +38 -0
- package/dist/models/SkillUpdateResource.js +54 -0
- package/dist/models/index.d.ts +13 -0
- package/dist/models/index.js +13 -0
- package/dist/webhooks.d.ts +203 -0
- package/dist/webhooks.js +224 -0
- package/package.json +9 -1
- package/src/apis/AgentConversationsApi.ts +2 -2
- package/src/apis/AgentsApi.ts +737 -6
- package/src/apis/ArtifactsApi.ts +8 -4
- package/src/apis/ConversationsApi.ts +10 -0
- package/src/compose/agent.ts +9 -0
- package/src/compose/deploy.ts +113 -20
- package/src/compose/errors.ts +1 -1
- package/src/compose/index.ts +2 -1
- package/src/compose/run.ts +6 -2
- package/src/compose/settingsTransport.ts +167 -10
- package/src/compose/transport.ts +12 -0
- package/src/compose/webhook.ts +181 -0
- package/src/models/AgentAttachmentDiff.ts +93 -0
- package/src/models/AgentContentsResource.ts +142 -0
- package/src/models/AgentDeploy.ts +66 -0
- package/src/models/AgentDraftResource.ts +99 -0
- package/src/models/AgentFileContent.ts +75 -0
- package/src/models/AgentHistoryResource.ts +121 -0
- package/src/models/AgentResource.ts +26 -0
- package/src/models/AgentSkillFilePin.ts +84 -0
- package/src/models/AgentSubagentEntry.ts +75 -0
- package/src/models/AgentVersionCreate.ts +65 -0
- package/src/models/AgentVersionDiffResource.ts +154 -0
- package/src/models/AgentVersionPick.ts +66 -0
- package/src/models/AgentVersionResource.ts +101 -0
- package/src/models/AppResource.ts +16 -0
- package/src/models/ResponseInput.ts +8 -0
- package/src/models/SkillUpdateResource.ts +75 -0
- package/src/models/index.ts +13 -0
- package/src/webhooks.ts +390 -0
package/README.md
CHANGED
|
@@ -164,6 +164,88 @@ console.log((await run(agent, "How do I update my card?", { client: config })).f
|
|
|
164
164
|
|
|
165
165
|
See [docs/compose.md](../docs/compose.md#typescript) for the full guide.
|
|
166
166
|
|
|
167
|
+
## Webhooks
|
|
168
|
+
|
|
169
|
+
An agent can POST an event to your server when a turn completes, fails or waits for an answer. The server must have
|
|
170
|
+
outbound webhooks switched on; until then a deploy keeps the setting and logs the warning `webhooks_disabled`.
|
|
171
|
+
|
|
172
|
+
**1. Make a secret and store it as a credential.** The secret is `whsec_` plus base64 of 24 to 64 random bytes. Keep
|
|
173
|
+
a copy where your receiver runs; Panja never shows it again. Store it as a Custom API whose host is the webhook's
|
|
174
|
+
host, with "enabled for chats" off (otherwise the agent's sandbox could be handed it):
|
|
175
|
+
|
|
176
|
+
```ts
|
|
177
|
+
import { CustomAPIsApi } from "sarvam-agents-client";
|
|
178
|
+
import { generateSecret } from "sarvam-agents-client/webhooks";
|
|
179
|
+
|
|
180
|
+
const secret = generateSecret();
|
|
181
|
+
const api = new CustomAPIsApi(config);
|
|
182
|
+
const created = await api.createCustomApi({ customApiCreate: { name: "acme_webhook", host: "hooks.acme.com",
|
|
183
|
+
enabledForChats: false, auth: { type: "bearer", token: secret } } });
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
The server only accepts a webhook whose credential is bound to the agent. The deploy that creates the agent binds
|
|
187
|
+
it for you: it creates the agent without `webhooks`, binds your Custom API named by each `secretCredential`
|
|
188
|
+
(`bindCustomApi`), then saves the settings in full. If you have no Custom API of that name, or several, it binds
|
|
189
|
+
none and says so in the `UserError` (or, while the server doesn't check credentials, in a logged warning). For an
|
|
190
|
+
agent that already exists, bind the credential yourself before adding `webhooks`, with the `agentId` of the
|
|
191
|
+
deploy that created it: `await api.bindCustomApi({ agentId, bindCustomApiBody: { customApiId: created.id } })`.
|
|
192
|
+
|
|
193
|
+
**2. Name the endpoint on the agent** (`agent.json` `webhooks`, with `secretCredential` written as
|
|
194
|
+
`secret_credential`):
|
|
195
|
+
|
|
196
|
+
```ts
|
|
197
|
+
import { Agent } from "sarvam-agents-client/compose";
|
|
198
|
+
|
|
199
|
+
const agent = new Agent({ name: "support-bot", instructions: "...", webhooks: [
|
|
200
|
+
{ url: "https://hooks.acme.com/panja", events: ["turn.completed", "turn.failed", "turn.requires_action"],
|
|
201
|
+
secretCredential: "acme_webhook" },
|
|
202
|
+
] });
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
The rules are Python's (see the [Python README](../python/README.md#webhooks)), with the same `UserError` messages,
|
|
206
|
+
which name the `agent.json` path (`webhooks.0.secret_credential: ...`). Checks that need the server fail the deploy
|
|
207
|
+
(and delete an agent the deploy created) with `UserError`, whose `issues` hold the server's `{ code, path, message }` list; a server without webhooks throws
|
|
208
|
+
`NotSupportedByServerError` with `features` `["webhooks"]`.
|
|
209
|
+
|
|
210
|
+
**3. Verify and parse each delivery** from `sarvam-agents-client/webhooks` (a separate import path; `node:crypto`
|
|
211
|
+
only, so Node 18+ or a runtime with Node's `crypto` and `Buffer`, such as Workers with `nodejs_compat`; not a browser
|
|
212
|
+
or an edge runtime without them), on the raw body bytes (`express.raw()`, not `express.json()`):
|
|
213
|
+
|
|
214
|
+
```ts
|
|
215
|
+
import { parseEvent, verify, WebhookVerificationError } from "sarvam-agents-client/webhooks";
|
|
216
|
+
|
|
217
|
+
let msgId: string;
|
|
218
|
+
try {
|
|
219
|
+
({ msgId } = verify(req.body, req.headers, secret)); // or [oldSecret, newSecret] while rotating
|
|
220
|
+
} catch (e) {
|
|
221
|
+
if (e instanceof WebhookVerificationError) return res.status(400).send(e.reason);
|
|
222
|
+
throw e;
|
|
223
|
+
}
|
|
224
|
+
const event = parseEvent(req.body);
|
|
225
|
+
if (event?.type === "turn.completed") console.log(event.data.text, event.data.output);
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
`verify(payload, headers, secret, { tolerance, now })` takes a `Buffer`/`Uint8Array` or string body, and Node's
|
|
229
|
+
`req.headers` or a fetch `Headers`. It behaves exactly like Python's `verify` and the server's reference verifier,
|
|
230
|
+
and both SDKs run the server's test vectors. It returns `{ msgId, timestamp }`; `e.reason` and `SecretFormatError`
|
|
231
|
+
are as in Python; an empty list of secrets throws `TypeError`. A header given as an array counts as missing.
|
|
232
|
+
|
|
233
|
+
`parseEvent` returns the JSON as sent, typed by its `type` (`TurnCompletedEvent`, `TurnFailedEvent`,
|
|
234
|
+
`TurnRequiresActionEvent`; narrow with `event.type`), or `undefined` for an event type this release doesn't know. It
|
|
235
|
+
checks the envelope and `data.status` and throws `TypeError` for a body that is not an event. A newer server may send
|
|
236
|
+
an action type this release doesn't know (typed `UnknownAction`, passed through as sent), so keep a default branch
|
|
237
|
+
when you switch on `action.type`. Answer a `clarify` action with `answerClarify` and a `function_call` action with
|
|
238
|
+
`postToolResults` (one result per `toolCallId`); a turn the SDK runner is driving answers its own function calls, so
|
|
239
|
+
leave those alone (a second answer gets 409 `already_answered`). The fields are listed
|
|
240
|
+
in the [Python README](../python/README.md#webhooks), in camelCase here (`data.turn.responseId`, `outputSkipped`,
|
|
241
|
+
`rawText`, `actions[i].toolCallId`).
|
|
242
|
+
|
|
243
|
+
Reply 2xx within 10 seconds and do the work afterwards. Only a 2xx stops the retries: a 408, 425, 429, 5xx, timeout
|
|
244
|
+
or network failure is retried (10 attempts over about 16 hours), while a 3xx or any other 4xx is given up at once.
|
|
245
|
+
So return a 5xx (or 429) for a failure you want retried, never a 4xx. Dedupe on `msgId`. Starting a delivery is best effort: if an event you expect doesn't come, read the turn from the conversation
|
|
246
|
+
API. A complete Express receiver is in
|
|
247
|
+
[docs/examples/webhooks/express_receiver.ts](../docs/examples/webhooks/express_receiver.ts).
|
|
248
|
+
|
|
167
249
|
## Errors
|
|
168
250
|
|
|
169
251
|
If an ID passed as a path parameter is empty, `.` or `..`, the SDK throws `InvalidPathParameterError` before
|
|
@@ -43,12 +43,12 @@ export interface ListAgentConversationsRequest {
|
|
|
43
43
|
*/
|
|
44
44
|
export declare class AgentConversationsApi extends runtime.BaseAPI {
|
|
45
45
|
/**
|
|
46
|
-
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign
|
|
46
|
+
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign with the owner\'s identity, as share links do. The artifact service still checks the ids against the artifact\'s real owner. The URL is a presigned S3 URL while the file is plaintext; clients that can follow file-gateway URLs use the v2 route.
|
|
47
47
|
* Agent Conversation Artifact Download Url Route
|
|
48
48
|
*/
|
|
49
49
|
agentConversationArtifactDownloadUrlRaw(requestParameters: AgentConversationArtifactDownloadUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DownloadUrlResponse>>;
|
|
50
50
|
/**
|
|
51
|
-
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign
|
|
51
|
+
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign with the owner\'s identity, as share links do. The artifact service still checks the ids against the artifact\'s real owner. The URL is a presigned S3 URL while the file is plaintext; clients that can follow file-gateway URLs use the v2 route.
|
|
52
52
|
* Agent Conversation Artifact Download Url Route
|
|
53
53
|
*/
|
|
54
54
|
agentConversationArtifactDownloadUrl(requestParameters: AgentConversationArtifactDownloadUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DownloadUrlResponse>;
|
|
@@ -21,7 +21,7 @@ const index_js_1 = require("../models/index.js");
|
|
|
21
21
|
*/
|
|
22
22
|
class AgentConversationsApi extends runtime.BaseAPI {
|
|
23
23
|
/**
|
|
24
|
-
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign
|
|
24
|
+
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign with the owner\'s identity, as share links do. The artifact service still checks the ids against the artifact\'s real owner. The URL is a presigned S3 URL while the file is plaintext; clients that can follow file-gateway URLs use the v2 route.
|
|
25
25
|
* Agent Conversation Artifact Download Url Route
|
|
26
26
|
*/
|
|
27
27
|
async agentConversationArtifactDownloadUrlRaw(requestParameters, initOverrides) {
|
|
@@ -58,7 +58,7 @@ class AgentConversationsApi extends runtime.BaseAPI {
|
|
|
58
58
|
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_js_1.DownloadUrlResponseFromJSON)(jsonValue));
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
61
|
-
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign
|
|
61
|
+
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign with the owner\'s identity, as share links do. The artifact service still checks the ids against the artifact\'s real owner. The URL is a presigned S3 URL while the file is plaintext; clients that can follow file-gateway URLs use the v2 route.
|
|
62
62
|
* Agent Conversation Artifact Download Url Route
|
|
63
63
|
*/
|
|
64
64
|
async agentConversationArtifactDownloadUrl(requestParameters, initOverrides) {
|
package/dist/apis/AgentsApi.d.ts
CHANGED
|
@@ -10,12 +10,25 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime.js';
|
|
13
|
-
import type { AgentCreate, AgentResource, AgentSearchChannel, AgentSettingsResponse, AgentTemplateResource, AgentUpdate, EntityCategory, EntityListAgentResource, EntityListAgentTemplateResource, FileNodeView, FileWriteBody, InstructionsBody, InstructionsResponse, PageFileNodeView, PublishRequest, Scope } from '../models/index.js';
|
|
13
|
+
import type { AgentContentsResource, AgentCreate, AgentDeploy, AgentDraftResource, AgentHistoryResource, AgentResource, AgentSearchChannel, AgentSettingsResponse, AgentTemplateResource, AgentUpdate, AgentVersionCreate, AgentVersionDiffResource, AgentVersionPick, AgentVersionResource, EntityCategory, EntityListAgentResource, EntityListAgentTemplateResource, FileNodeView, FileWriteBody, InstructionsBody, InstructionsResponse, PageFileNodeView, PublishRequest, Scope, SkillUpdateResource } from '../models/index.js';
|
|
14
|
+
export interface AcceptSkillUpdateRequest {
|
|
15
|
+
agentId: string;
|
|
16
|
+
skillId: string;
|
|
17
|
+
}
|
|
18
|
+
export interface BranchFromVersionRequest {
|
|
19
|
+
agentId: string;
|
|
20
|
+
agentVersionPick: AgentVersionPick;
|
|
21
|
+
}
|
|
14
22
|
export interface CloneAgentRequest {
|
|
15
23
|
agentId: string;
|
|
16
24
|
origin?: CloneAgentOriginEnum;
|
|
17
25
|
xPanjaOrigin?: CloneAgentXPanjaOriginEnum;
|
|
18
26
|
}
|
|
27
|
+
export interface CompareVersionsRequest {
|
|
28
|
+
agentId: string;
|
|
29
|
+
fromVersion?: number | null;
|
|
30
|
+
toVersion?: number | null;
|
|
31
|
+
}
|
|
19
32
|
export interface CreateAgentRequest {
|
|
20
33
|
agentCreate: AgentCreate;
|
|
21
34
|
origin?: CreateAgentOriginEnum;
|
|
@@ -24,8 +37,13 @@ export interface CreateAgentRequest {
|
|
|
24
37
|
export interface DeleteAgentRequest {
|
|
25
38
|
agentId: string;
|
|
26
39
|
}
|
|
40
|
+
export interface DeleteVersionRequest {
|
|
41
|
+
agentId: string;
|
|
42
|
+
version: number;
|
|
43
|
+
}
|
|
27
44
|
export interface DeployAgentRequest {
|
|
28
45
|
agentId: string;
|
|
46
|
+
agentDeploy?: AgentDeploy;
|
|
29
47
|
}
|
|
30
48
|
export interface GetAgentRequest {
|
|
31
49
|
agentId: string;
|
|
@@ -45,9 +63,16 @@ export interface GetAgentSettingsSchemaRequest {
|
|
|
45
63
|
export interface GetAgentTemplateRequest {
|
|
46
64
|
templateId: string;
|
|
47
65
|
}
|
|
66
|
+
export interface GetDraftRequest {
|
|
67
|
+
agentId: string;
|
|
68
|
+
}
|
|
48
69
|
export interface GetInstructionsRequest {
|
|
49
70
|
agentId: string;
|
|
50
71
|
}
|
|
72
|
+
export interface GetVersionRequest {
|
|
73
|
+
agentId: string;
|
|
74
|
+
version: number;
|
|
75
|
+
}
|
|
51
76
|
export interface ListAgentFileHistoryRequest {
|
|
52
77
|
agentId: string;
|
|
53
78
|
filePath: string;
|
|
@@ -76,6 +101,15 @@ export interface ListAgentsRequest {
|
|
|
76
101
|
origin?: ListAgentsOriginEnum;
|
|
77
102
|
xPanjaOrigin?: ListAgentsXPanjaOriginEnum;
|
|
78
103
|
}
|
|
104
|
+
export interface ListHistoryRequest {
|
|
105
|
+
agentId: string;
|
|
106
|
+
}
|
|
107
|
+
export interface ListSkillUpdatesRequest {
|
|
108
|
+
agentId: string;
|
|
109
|
+
}
|
|
110
|
+
export interface ListVersionsRequest {
|
|
111
|
+
agentId: string;
|
|
112
|
+
}
|
|
79
113
|
export interface PatchAgentSettingsRequest {
|
|
80
114
|
agentId: string;
|
|
81
115
|
body: object;
|
|
@@ -97,9 +131,25 @@ export interface PutInstructionsRequest {
|
|
|
97
131
|
agentId: string;
|
|
98
132
|
instructionsBody: InstructionsBody;
|
|
99
133
|
}
|
|
134
|
+
export interface ResumeAgentRequest {
|
|
135
|
+
agentId: string;
|
|
136
|
+
}
|
|
137
|
+
export interface SaveVersionRequest {
|
|
138
|
+
agentId: string;
|
|
139
|
+
agentVersionCreate: AgentVersionCreate;
|
|
140
|
+
}
|
|
100
141
|
export interface UndeployAgentRequest {
|
|
101
142
|
agentId: string;
|
|
102
143
|
}
|
|
144
|
+
export interface UndoAttachmentEditRequest {
|
|
145
|
+
agentId: string;
|
|
146
|
+
kind: UndoAttachmentEditKindEnum;
|
|
147
|
+
targetId: string;
|
|
148
|
+
}
|
|
149
|
+
export interface UndoFileEditRequest {
|
|
150
|
+
agentId: string;
|
|
151
|
+
path: string;
|
|
152
|
+
}
|
|
103
153
|
export interface UnpublishAgentRequest {
|
|
104
154
|
agentId: string;
|
|
105
155
|
publishRequest?: PublishRequest;
|
|
@@ -112,6 +162,26 @@ export interface UpdateAgentRequest {
|
|
|
112
162
|
*
|
|
113
163
|
*/
|
|
114
164
|
export declare class AgentsApi extends runtime.BaseAPI {
|
|
165
|
+
/**
|
|
166
|
+
* Move the whole skill to its current files in the draft.
|
|
167
|
+
* Accept Skill Update
|
|
168
|
+
*/
|
|
169
|
+
acceptSkillUpdateRaw(requestParameters: AcceptSkillUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentDraftResource>>;
|
|
170
|
+
/**
|
|
171
|
+
* Move the whole skill to its current files in the draft.
|
|
172
|
+
* Accept Skill Update
|
|
173
|
+
*/
|
|
174
|
+
acceptSkillUpdate(requestParameters: AcceptSkillUpdateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentDraftResource>;
|
|
175
|
+
/**
|
|
176
|
+
* Replace the draft so it reads as ``version`` (\"Edit from vN\").
|
|
177
|
+
* Branch From Version
|
|
178
|
+
*/
|
|
179
|
+
branchFromVersionRaw(requestParameters: BranchFromVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentDraftResource>>;
|
|
180
|
+
/**
|
|
181
|
+
* Replace the draft so it reads as ``version`` (\"Edit from vN\").
|
|
182
|
+
* Branch From Version
|
|
183
|
+
*/
|
|
184
|
+
branchFromVersion(requestParameters: BranchFromVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentDraftResource>;
|
|
115
185
|
/**
|
|
116
186
|
* Clone any agent the caller can *see* into a fresh private copy they own (no ownership required — clone is the non-owner\'s path to editing). Panja deep-clones skills + copies MCP/collection bindings; the clone is born ``user``-scoped. With ``origin=managed_agents`` the clone is tagged as a managed agent in ``draft`` (deploy state is never copied).
|
|
117
187
|
* Clone Agent
|
|
@@ -122,6 +192,16 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
122
192
|
* Clone Agent
|
|
123
193
|
*/
|
|
124
194
|
cloneAgent(requestParameters: CloneAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
|
|
195
|
+
/**
|
|
196
|
+
* What ``toVersion`` changes relative to ``fromVersion``. Omitted ``fromVersion`` is the live version (the deploy screen); omitted ``toVersion`` is the draft (the save dialog).
|
|
197
|
+
* Compare Versions
|
|
198
|
+
*/
|
|
199
|
+
compareVersionsRaw(requestParameters: CompareVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentVersionDiffResource>>;
|
|
200
|
+
/**
|
|
201
|
+
* What ``toVersion`` changes relative to ``fromVersion``. Omitted ``fromVersion`` is the live version (the deploy screen); omitted ``toVersion`` is the draft (the save dialog).
|
|
202
|
+
* Compare Versions
|
|
203
|
+
*/
|
|
204
|
+
compareVersions(requestParameters: CompareVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentVersionDiffResource>;
|
|
125
205
|
/**
|
|
126
206
|
* Create an agent, born ``user``-scoped and owned by the caller. ``llm_config`` is deployment-gated (ACCEPT_AGENT_LLM_CONFIG, same rule as v1): where disabled a non-null value is a 400, and the server stamps the fleet default so a fresh agent runs out of the box. ``instructions``, if given, is written as the initial ``AGENT.md``. ``origin=managed_agents`` also tags the new agent as a managed agent (``draft``) once the gateway create has succeeded; the gateway call itself is unchanged.
|
|
127
207
|
* Create Agent
|
|
@@ -143,12 +223,22 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
143
223
|
*/
|
|
144
224
|
deleteAgent(requestParameters: DeleteAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
145
225
|
/**
|
|
146
|
-
*
|
|
226
|
+
* Delete a never-live version; 409 ``VERSION_WAS_LIVE`` otherwise.
|
|
227
|
+
* Delete Version
|
|
228
|
+
*/
|
|
229
|
+
deleteVersionRaw(requestParameters: DeleteVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
|
|
230
|
+
/**
|
|
231
|
+
* Delete a never-live version; 409 ``VERSION_WAS_LIVE`` otherwise.
|
|
232
|
+
* Delete Version
|
|
233
|
+
*/
|
|
234
|
+
deleteVersion(requestParameters: DeleteVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
|
|
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.
|
|
147
237
|
* Deploy Agent
|
|
148
238
|
*/
|
|
149
239
|
deployAgentRaw(requestParameters: DeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentResource>>;
|
|
150
240
|
/**
|
|
151
|
-
*
|
|
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.
|
|
152
242
|
* Deploy Agent
|
|
153
243
|
*/
|
|
154
244
|
deployAgent(requestParameters: DeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
|
|
@@ -202,6 +292,16 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
202
292
|
* Get Agent Template
|
|
203
293
|
*/
|
|
204
294
|
getAgentTemplate(requestParameters: GetAgentTemplateRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentTemplateResource>;
|
|
295
|
+
/**
|
|
296
|
+
* The draft (what Preview runs) and whether it has unsaved changes.
|
|
297
|
+
* Get Draft
|
|
298
|
+
*/
|
|
299
|
+
getDraftRaw(requestParameters: GetDraftRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentDraftResource>>;
|
|
300
|
+
/**
|
|
301
|
+
* The draft (what Preview runs) and whether it has unsaved changes.
|
|
302
|
+
* Get Draft
|
|
303
|
+
*/
|
|
304
|
+
getDraft(requestParameters: GetDraftRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentDraftResource>;
|
|
205
305
|
/**
|
|
206
306
|
* Get Instructions
|
|
207
307
|
*/
|
|
@@ -210,6 +310,16 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
210
310
|
* Get Instructions
|
|
211
311
|
*/
|
|
212
312
|
getInstructions(requestParameters: GetInstructionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InstructionsResponse>;
|
|
313
|
+
/**
|
|
314
|
+
* What a saved version is made of (read-only).
|
|
315
|
+
* Get Version
|
|
316
|
+
*/
|
|
317
|
+
getVersionRaw(requestParameters: GetVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentContentsResource>>;
|
|
318
|
+
/**
|
|
319
|
+
* What a saved version is made of (read-only).
|
|
320
|
+
* Get Version
|
|
321
|
+
*/
|
|
322
|
+
getVersion(requestParameters: GetVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentContentsResource>;
|
|
213
323
|
/**
|
|
214
324
|
* List Agent File History Route
|
|
215
325
|
*/
|
|
@@ -246,6 +356,36 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
246
356
|
* List Agents
|
|
247
357
|
*/
|
|
248
358
|
listAgents(requestParameters?: ListAgentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EntityListAgentResource>;
|
|
359
|
+
/**
|
|
360
|
+
* Every deploy, rollback, pause and resume, newest first.
|
|
361
|
+
* List History
|
|
362
|
+
*/
|
|
363
|
+
listHistoryRaw(requestParameters: ListHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<AgentHistoryResource>>>;
|
|
364
|
+
/**
|
|
365
|
+
* Every deploy, rollback, pause and resume, newest first.
|
|
366
|
+
* List History
|
|
367
|
+
*/
|
|
368
|
+
listHistory(requestParameters: ListHistoryRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<AgentHistoryResource>>;
|
|
369
|
+
/**
|
|
370
|
+
* Skills whose files changed since the agent pinned them.
|
|
371
|
+
* List Skill Updates
|
|
372
|
+
*/
|
|
373
|
+
listSkillUpdatesRaw(requestParameters: ListSkillUpdatesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<SkillUpdateResource>>>;
|
|
374
|
+
/**
|
|
375
|
+
* Skills whose files changed since the agent pinned them.
|
|
376
|
+
* List Skill Updates
|
|
377
|
+
*/
|
|
378
|
+
listSkillUpdates(requestParameters: ListSkillUpdatesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<SkillUpdateResource>>;
|
|
379
|
+
/**
|
|
380
|
+
* Saved versions, newest first (deleted ones left out).
|
|
381
|
+
* List Versions
|
|
382
|
+
*/
|
|
383
|
+
listVersionsRaw(requestParameters: ListVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<Array<AgentVersionResource>>>;
|
|
384
|
+
/**
|
|
385
|
+
* Saved versions, newest first (deleted ones left out).
|
|
386
|
+
* List Versions
|
|
387
|
+
*/
|
|
388
|
+
listVersions(requestParameters: ListVersionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<Array<AgentVersionResource>>;
|
|
249
389
|
/**
|
|
250
390
|
* JSON Merge Patch (RFC 7396) onto the latest settings; ``null`` removes a key.
|
|
251
391
|
* Patch Agent Settings
|
|
@@ -293,15 +433,55 @@ export declare class AgentsApi extends runtime.BaseAPI {
|
|
|
293
433
|
*/
|
|
294
434
|
putInstructions(requestParameters: PutInstructionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InstructionsResponse>;
|
|
295
435
|
/**
|
|
296
|
-
*
|
|
436
|
+
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
|
|
437
|
+
* Resume Agent
|
|
438
|
+
*/
|
|
439
|
+
resumeAgentRaw(requestParameters: ResumeAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentResource>>;
|
|
440
|
+
/**
|
|
441
|
+
* Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
|
|
442
|
+
* Resume Agent
|
|
443
|
+
*/
|
|
444
|
+
resumeAgent(requestParameters: ResumeAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
|
|
445
|
+
/**
|
|
446
|
+
* Save the draft as the next version; 409 ``NO_CHANGES`` on an empty draft. Nothing is deployed.
|
|
447
|
+
* Save Version
|
|
448
|
+
*/
|
|
449
|
+
saveVersionRaw(requestParameters: SaveVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentVersionResource>>;
|
|
450
|
+
/**
|
|
451
|
+
* Save the draft as the next version; 409 ``NO_CHANGES`` on an empty draft. Nothing is deployed.
|
|
452
|
+
* Save Version
|
|
453
|
+
*/
|
|
454
|
+
saveVersion(requestParameters: SaveVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentVersionResource>;
|
|
455
|
+
/**
|
|
456
|
+
* Pause the live version: every surface stops answering (API sessions get 409 ``AGENT_NOT_DEPLOYED`` on their next turn) and ``/resume`` brings the same version back. The builder and Playground keep working. Idempotent: a no-op when nothing is live.
|
|
297
457
|
* Undeploy Agent
|
|
298
458
|
*/
|
|
299
459
|
undeployAgentRaw(requestParameters: UndeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentResource>>;
|
|
300
460
|
/**
|
|
301
|
-
*
|
|
461
|
+
* Pause the live version: every surface stops answering (API sessions get 409 ``AGENT_NOT_DEPLOYED`` on their next turn) and ``/resume`` brings the same version back. The builder and Playground keep working. Idempotent: a no-op when nothing is live.
|
|
302
462
|
* Undeploy Agent
|
|
303
463
|
*/
|
|
304
464
|
undeployAgent(requestParameters: UndeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
|
|
465
|
+
/**
|
|
466
|
+
* Undo the draft\'s attach or detach of one skill / app / knowledge base / sub-agent.
|
|
467
|
+
* Undo Attachment Edit
|
|
468
|
+
*/
|
|
469
|
+
undoAttachmentEditRaw(requestParameters: UndoAttachmentEditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentDraftResource>>;
|
|
470
|
+
/**
|
|
471
|
+
* Undo the draft\'s attach or detach of one skill / app / knowledge base / sub-agent.
|
|
472
|
+
* Undo Attachment Edit
|
|
473
|
+
*/
|
|
474
|
+
undoAttachmentEdit(requestParameters: UndoAttachmentEditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentDraftResource>;
|
|
475
|
+
/**
|
|
476
|
+
* Undo the draft\'s edit or removal of one file.
|
|
477
|
+
* Undo File Edit
|
|
478
|
+
*/
|
|
479
|
+
undoFileEditRaw(requestParameters: UndoFileEditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentDraftResource>>;
|
|
480
|
+
/**
|
|
481
|
+
* Undo the draft\'s edit or removal of one file.
|
|
482
|
+
* Undo File Edit
|
|
483
|
+
*/
|
|
484
|
+
undoFileEdit(requestParameters: UndoFileEditRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentDraftResource>;
|
|
305
485
|
/**
|
|
306
486
|
* Narrow the agent back to the owner\'s private (``user``) scope in one move. Owner-only; a gateway 409 (a shared channel/default would be left dangling) surfaces as ``CHAT_CONFLICT``.
|
|
307
487
|
* Unpublish Agent
|
|
@@ -379,3 +559,13 @@ export declare const ListAgentsXPanjaOriginEnum: {
|
|
|
379
559
|
readonly ManagedAgents: "managed_agents";
|
|
380
560
|
};
|
|
381
561
|
export type ListAgentsXPanjaOriginEnum = typeof ListAgentsXPanjaOriginEnum[keyof typeof ListAgentsXPanjaOriginEnum];
|
|
562
|
+
/**
|
|
563
|
+
* @export
|
|
564
|
+
*/
|
|
565
|
+
export declare const UndoAttachmentEditKindEnum: {
|
|
566
|
+
readonly Skill: "skill";
|
|
567
|
+
readonly App: "app";
|
|
568
|
+
readonly Collection: "collection";
|
|
569
|
+
readonly Subagent: "subagent";
|
|
570
|
+
};
|
|
571
|
+
export type UndoAttachmentEditKindEnum = typeof UndoAttachmentEditKindEnum[keyof typeof UndoAttachmentEditKindEnum];
|