sarvam-agents-client 0.3.2 → 0.4.1

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.
Files changed (157) hide show
  1. package/README.md +36 -23
  2. package/dist/apis/AgentConversationsApi.d.ts +2 -2
  3. package/dist/apis/AgentConversationsApi.js +2 -2
  4. package/dist/apis/AgentsApi.d.ts +195 -5
  5. package/dist/apis/AgentsApi.js +478 -5
  6. package/dist/apis/ArtifactsApi.d.ts +8 -4
  7. package/dist/apis/ArtifactsApi.js +8 -4
  8. package/dist/apis/ConversationsApi.d.ts +2 -0
  9. package/dist/apis/ConversationsApi.js +6 -0
  10. package/dist/client.d.ts +16 -0
  11. package/dist/client.js +21 -0
  12. package/dist/compose/deploy.d.ts +37 -7
  13. package/dist/compose/deploy.js +105 -19
  14. package/dist/compose/errors.d.ts +1 -1
  15. package/dist/compose/errors.js +1 -1
  16. package/dist/compose/index.d.ts +1 -1
  17. package/dist/compose/index.js +2 -1
  18. package/dist/compose/run.d.ts +5 -1
  19. package/dist/compose/run.js +9 -9
  20. package/dist/compose/settingsTransport.d.ts +14 -0
  21. package/dist/compose/settingsTransport.js +151 -14
  22. package/dist/compose/transport.d.ts +14 -0
  23. package/dist/compose/transport.js +3 -0
  24. package/dist/compose/webhook.d.ts +18 -3
  25. package/dist/compose/webhook.js +59 -10
  26. package/dist/compose/webhookSecrets.d.ts +64 -0
  27. package/dist/compose/webhookSecrets.js +255 -0
  28. package/dist/esm/apis/AgentConversationsApi.d.ts +2 -2
  29. package/dist/esm/apis/AgentConversationsApi.js +2 -2
  30. package/dist/esm/apis/AgentsApi.d.ts +195 -5
  31. package/dist/esm/apis/AgentsApi.js +478 -5
  32. package/dist/esm/apis/ArtifactsApi.d.ts +8 -4
  33. package/dist/esm/apis/ArtifactsApi.js +8 -4
  34. package/dist/esm/apis/ConversationsApi.d.ts +2 -0
  35. package/dist/esm/apis/ConversationsApi.js +6 -0
  36. package/dist/esm/client.d.ts +16 -0
  37. package/dist/esm/client.js +17 -0
  38. package/dist/esm/compose/deploy.d.ts +37 -7
  39. package/dist/esm/compose/deploy.js +105 -20
  40. package/dist/esm/compose/errors.d.ts +1 -1
  41. package/dist/esm/compose/errors.js +1 -1
  42. package/dist/esm/compose/index.d.ts +1 -1
  43. package/dist/esm/compose/index.js +1 -1
  44. package/dist/esm/compose/run.d.ts +5 -1
  45. package/dist/esm/compose/run.js +9 -9
  46. package/dist/esm/compose/settingsTransport.d.ts +14 -0
  47. package/dist/esm/compose/settingsTransport.js +151 -14
  48. package/dist/esm/compose/transport.d.ts +14 -0
  49. package/dist/esm/compose/transport.js +2 -1
  50. package/dist/esm/compose/webhook.d.ts +18 -3
  51. package/dist/esm/compose/webhook.js +55 -9
  52. package/dist/esm/compose/webhookSecrets.d.ts +64 -0
  53. package/dist/esm/compose/webhookSecrets.js +250 -0
  54. package/dist/esm/index.d.ts +3 -0
  55. package/dist/esm/index.js +3 -0
  56. package/dist/esm/models/AgentAttachmentDiff.d.ts +50 -0
  57. package/dist/esm/models/AgentAttachmentDiff.js +55 -0
  58. package/dist/esm/models/AgentContentsResource.d.ts +71 -0
  59. package/dist/esm/models/AgentContentsResource.js +70 -0
  60. package/dist/esm/models/AgentDeploy.d.ts +33 -0
  61. package/dist/esm/models/AgentDeploy.js +41 -0
  62. package/dist/esm/models/AgentDraftResource.d.ts +51 -0
  63. package/dist/esm/models/AgentDraftResource.js +52 -0
  64. package/dist/esm/models/AgentFileContent.d.ts +38 -0
  65. package/dist/esm/models/AgentFileContent.js +47 -0
  66. package/dist/esm/models/AgentHistoryResource.d.ts +71 -0
  67. package/dist/esm/models/AgentHistoryResource.js +66 -0
  68. package/dist/esm/models/AgentResource.d.ts +21 -0
  69. package/dist/esm/models/AgentResource.js +12 -0
  70. package/dist/esm/models/AgentSkillFilePin.d.ts +44 -0
  71. package/dist/esm/models/AgentSkillFilePin.js +51 -0
  72. package/dist/esm/models/AgentSubagentEntry.d.ts +38 -0
  73. package/dist/esm/models/AgentSubagentEntry.js +47 -0
  74. package/dist/esm/models/AgentVersionCreate.d.ts +32 -0
  75. package/dist/esm/models/AgentVersionCreate.js +41 -0
  76. package/dist/esm/models/AgentVersionDiffResource.d.ts +87 -0
  77. package/dist/esm/models/AgentVersionDiffResource.js +78 -0
  78. package/dist/esm/models/AgentVersionPick.d.ts +32 -0
  79. package/dist/esm/models/AgentVersionPick.js +43 -0
  80. package/dist/esm/models/AgentVersionResource.d.ts +56 -0
  81. package/dist/esm/models/AgentVersionResource.js +57 -0
  82. package/dist/esm/models/AppResource.d.ts +12 -0
  83. package/dist/esm/models/AppResource.js +4 -0
  84. package/dist/esm/models/ResponseInput.d.ts +6 -0
  85. package/dist/esm/models/ResponseInput.js +2 -0
  86. package/dist/esm/models/SkillUpdateResource.d.ts +38 -0
  87. package/dist/esm/models/SkillUpdateResource.js +47 -0
  88. package/dist/esm/models/index.d.ts +13 -0
  89. package/dist/esm/models/index.js +13 -0
  90. package/dist/index.d.ts +3 -0
  91. package/dist/index.js +6 -0
  92. package/dist/models/AgentAttachmentDiff.d.ts +50 -0
  93. package/dist/models/AgentAttachmentDiff.js +62 -0
  94. package/dist/models/AgentContentsResource.d.ts +71 -0
  95. package/dist/models/AgentContentsResource.js +77 -0
  96. package/dist/models/AgentDeploy.d.ts +33 -0
  97. package/dist/models/AgentDeploy.js +48 -0
  98. package/dist/models/AgentDraftResource.d.ts +51 -0
  99. package/dist/models/AgentDraftResource.js +59 -0
  100. package/dist/models/AgentFileContent.d.ts +38 -0
  101. package/dist/models/AgentFileContent.js +54 -0
  102. package/dist/models/AgentHistoryResource.d.ts +71 -0
  103. package/dist/models/AgentHistoryResource.js +74 -0
  104. package/dist/models/AgentResource.d.ts +21 -0
  105. package/dist/models/AgentResource.js +13 -1
  106. package/dist/models/AgentSkillFilePin.d.ts +44 -0
  107. package/dist/models/AgentSkillFilePin.js +58 -0
  108. package/dist/models/AgentSubagentEntry.d.ts +38 -0
  109. package/dist/models/AgentSubagentEntry.js +54 -0
  110. package/dist/models/AgentVersionCreate.d.ts +32 -0
  111. package/dist/models/AgentVersionCreate.js +48 -0
  112. package/dist/models/AgentVersionDiffResource.d.ts +87 -0
  113. package/dist/models/AgentVersionDiffResource.js +85 -0
  114. package/dist/models/AgentVersionPick.d.ts +32 -0
  115. package/dist/models/AgentVersionPick.js +50 -0
  116. package/dist/models/AgentVersionResource.d.ts +56 -0
  117. package/dist/models/AgentVersionResource.js +64 -0
  118. package/dist/models/AppResource.d.ts +12 -0
  119. package/dist/models/AppResource.js +4 -0
  120. package/dist/models/ResponseInput.d.ts +6 -0
  121. package/dist/models/ResponseInput.js +2 -0
  122. package/dist/models/SkillUpdateResource.d.ts +38 -0
  123. package/dist/models/SkillUpdateResource.js +54 -0
  124. package/dist/models/index.d.ts +13 -0
  125. package/dist/models/index.js +13 -0
  126. package/package.json +1 -1
  127. package/src/apis/AgentConversationsApi.ts +2 -2
  128. package/src/apis/AgentsApi.ts +737 -6
  129. package/src/apis/ArtifactsApi.ts +8 -4
  130. package/src/apis/ConversationsApi.ts +10 -0
  131. package/src/client.ts +21 -0
  132. package/src/compose/deploy.ts +126 -20
  133. package/src/compose/errors.ts +1 -1
  134. package/src/compose/index.ts +1 -1
  135. package/src/compose/run.ts +6 -2
  136. package/src/compose/settingsTransport.ts +154 -16
  137. package/src/compose/transport.ts +15 -0
  138. package/src/compose/webhook.ts +64 -11
  139. package/src/compose/webhookSecrets.ts +257 -0
  140. package/src/index.ts +4 -0
  141. package/src/models/AgentAttachmentDiff.ts +93 -0
  142. package/src/models/AgentContentsResource.ts +142 -0
  143. package/src/models/AgentDeploy.ts +66 -0
  144. package/src/models/AgentDraftResource.ts +99 -0
  145. package/src/models/AgentFileContent.ts +75 -0
  146. package/src/models/AgentHistoryResource.ts +121 -0
  147. package/src/models/AgentResource.ts +26 -0
  148. package/src/models/AgentSkillFilePin.ts +84 -0
  149. package/src/models/AgentSubagentEntry.ts +75 -0
  150. package/src/models/AgentVersionCreate.ts +65 -0
  151. package/src/models/AgentVersionDiffResource.ts +154 -0
  152. package/src/models/AgentVersionPick.ts +66 -0
  153. package/src/models/AgentVersionResource.ts +101 -0
  154. package/src/models/AppResource.ts +16 -0
  155. package/src/models/ResponseInput.ts +8 -0
  156. package/src/models/SkillUpdateResource.ts +75 -0
  157. package/src/models/index.ts +13 -0
package/README.md CHANGED
@@ -169,41 +169,54 @@ See [docs/compose.md](../docs/compose.md#typescript) for the full guide.
169
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
170
  outbound webhooks switched on; until then a deploy keeps the setting and logs the warning `webhooks_disabled`.
171
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):
172
+ **1. Name the endpoint on the agent** (`agent.json` `webhooks`) and deploy:
175
173
 
176
174
  ```ts
177
- import { CustomAPIsApi } from "sarvam-agents-client";
178
- import { generateSecret } from "sarvam-agents-client/webhooks";
175
+ import { Agent, deploy } from "sarvam-agents-client/compose";
179
176
 
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 } } });
177
+ const agent = new Agent({ name: "support-bot", instructions: "...", webhooks: [
178
+ { url: "https://hooks.acme.com/panja", events: ["turn.completed", "turn.failed", "turn.requires_action"] },
179
+ ] });
180
+ const deployment = await deploy(agent, { client: config });
184
181
  ```
185
182
 
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 } })`.
183
+ Leave `secretCredential` out: the deploy fills in the credential that `client.webhooks` manages for that agent and
184
+ host. The first deploy of a webhook with no secret yet stores a random placeholder secret, that nobody holds, so the
185
+ server accepts the webhook, and lists the webhook's URL in `deployment.webhooksMissingSecret`. While the placeholder
186
+ is there, `secretStatus` reads `"missing"`.
192
187
 
193
- **2. Name the endpoint on the agent** (`agent.json` `webhooks`, with `secretCredential` written as
194
- `secret_credential`):
188
+ Call `client.webhooks.setSecret` right after the first deploy, before pointing a provider at the agent. Until then
189
+ deliveries fail verification, and a receiver that answers 4xx makes Panja drop them.
190
+
191
+ **2. Set the signing secret** with `client.webhooks`:
195
192
 
196
193
  ```ts
197
- import { Agent } from "sarvam-agents-client/compose";
194
+ import { Client } from "sarvam-agents-client";
198
195
 
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
- ] });
196
+ const client = new Client(config); // config: the Configuration from the Quickstart
197
+ const url = "https://hooks.acme.com/panja";
198
+
199
+ const secret = await client.webhooks.setSecret(deployment.agentId, url); // generates a whsec_ secret and returns it
200
+ // or: await client.webhooks.setSecret(agentId, url, "whsec_...") to store one you made
201
+ await client.webhooks.secretStatus(agentId, url); // "set" or "missing" ("missing" while the deploy placeholder is there)
202
+ const newSecret = await client.webhooks.rotateSecret(agentId, url);
203
+ await client.webhooks.deleteSecret(agentId, url);
203
204
  ```
204
205
 
206
+ Keep the returned secret where your receiver runs: Panja never shows it again. A secret that is not `whsec_` plus
207
+ base64 of 24 to 64 bytes throws `SecretFormatError` before anything is sent. It works as in Python (see the
208
+ [Python README](../python/README.md#webhooks)): today the secret is a Custom API the SDK creates and binds, named
209
+ `webhook-secret:<agentId>:<host>`, with "enabled for chats" always **off**; `deleteSecret` only removes that one; a
210
+ later release moves secrets to a dedicated server store with no change to `client.webhooks`. Nothing logs a secret or
211
+ puts one in an error message.
212
+
213
+ `secretCredential: "acme_webhook"` still works, but is `@deprecated`: it names a Custom API you created and bound
214
+ yourself. To migrate, use `client.webhooks.setSecret` instead of creating a Custom API: call
215
+ `setSecret(agentId, url, currentSecret)`, drop `secretCredential` and deploy, then unbind and delete the old Custom
216
+ API (`unbindCustomApi`, `deleteCustomApi`).
217
+
205
218
  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
219
+ which name the `agent.json` path (`webhooks.0.url: ...`). Checks that need the server fail the deploy
207
220
  (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
221
  `NotSupportedByServerError` with `features` `["webhooks"]`.
209
222
 
@@ -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 through the owner-identity route the share links use. The gateway still checks the ids against the artifact\'s real owner.
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 through the owner-identity route the share links use. The gateway still checks the ids against the artifact\'s real owner.
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 through the owner-identity route the share links use. The gateway still checks the ids against the artifact\'s real owner.
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 through the owner-identity route the share links use. The gateway still checks the ids against the artifact\'s real owner.
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) {
@@ -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
- * Move a managed agent from ``draft`` to ``deployed`` so managed-agent API sessions (``origin=managed_agents``) can run against it. Idempotent. 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.
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
- * Move a managed agent from ``draft`` to ``deployed`` so managed-agent API sessions (``origin=managed_agents``) can run against it. Idempotent. 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.
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
- * Move a managed agent back to ``draft``. New API sessions and the next turn of existing ones get 409 ``AGENT_NOT_DEPLOYED``; the builder and Playground keep working. Idempotent.
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
- * Move a managed agent back to ``draft``. New API sessions and the next turn of existing ones get 409 ``AGENT_NOT_DEPLOYED``; the builder and Playground keep working. Idempotent.
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];