sarvam-agents-client 0.5.1 → 0.5.3

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 (178) hide show
  1. package/README.md +52 -29
  2. package/dist/apis/AgentsApi.d.ts +96 -11
  3. package/dist/apis/AgentsApi.js +229 -9
  4. package/dist/apis/ConversationsApi.d.ts +5 -2
  5. package/dist/apis/ConversationsApi.js +7 -2
  6. package/dist/client.d.ts +3 -2
  7. package/dist/client.js +2 -1
  8. package/dist/compat/core/data.js +5 -14
  9. package/dist/compat/core/events.d.ts +6 -0
  10. package/dist/compat/core/files.d.ts +65 -0
  11. package/dist/compat/core/files.js +851 -0
  12. package/dist/compat/core/history.js +32 -7
  13. package/dist/compat/core/http.d.ts +52 -0
  14. package/dist/compat/core/http.js +309 -0
  15. package/dist/compat/core/turns.d.ts +29 -0
  16. package/dist/compat/core/turns.js +163 -12
  17. package/dist/compat/openai/client.d.ts +5 -0
  18. package/dist/compat/openai/client.js +10 -2
  19. package/dist/compat/openai/resources/events.js +218 -21
  20. package/dist/compat/openai/resources/sessions.js +33 -4
  21. package/dist/compose/deploy.d.ts +14 -3
  22. package/dist/compose/deploy.js +60 -7
  23. package/dist/compose/errors.d.ts +4 -0
  24. package/dist/compose/errors.js +6 -1
  25. package/dist/compose/settingsTransport.d.ts +18 -13
  26. package/dist/compose/settingsTransport.js +78 -130
  27. package/dist/compose/transport.d.ts +12 -2
  28. package/dist/compose/webhook.d.ts +10 -13
  29. package/dist/compose/webhook.js +48 -45
  30. package/dist/compose/webhookSecrets.d.ts +79 -49
  31. package/dist/compose/webhookSecrets.js +244 -195
  32. package/dist/esm/apis/AgentsApi.d.ts +96 -11
  33. package/dist/esm/apis/AgentsApi.js +230 -10
  34. package/dist/esm/apis/ConversationsApi.d.ts +5 -2
  35. package/dist/esm/apis/ConversationsApi.js +7 -2
  36. package/dist/esm/client.d.ts +3 -2
  37. package/dist/esm/client.js +2 -1
  38. package/dist/esm/compat/core/data.js +5 -14
  39. package/dist/esm/compat/core/events.d.ts +6 -0
  40. package/dist/esm/compat/core/files.d.ts +65 -0
  41. package/dist/esm/compat/core/files.js +829 -0
  42. package/dist/esm/compat/core/history.js +32 -7
  43. package/dist/esm/compat/core/http.d.ts +52 -0
  44. package/dist/esm/compat/core/http.js +307 -0
  45. package/dist/esm/compat/core/turns.d.ts +29 -0
  46. package/dist/esm/compat/core/turns.js +162 -12
  47. package/dist/esm/compat/openai/client.d.ts +5 -0
  48. package/dist/esm/compat/openai/client.js +10 -2
  49. package/dist/esm/compat/openai/resources/events.js +209 -12
  50. package/dist/esm/compat/openai/resources/sessions.js +33 -4
  51. package/dist/esm/compose/deploy.d.ts +14 -3
  52. package/dist/esm/compose/deploy.js +60 -7
  53. package/dist/esm/compose/errors.d.ts +4 -0
  54. package/dist/esm/compose/errors.js +4 -0
  55. package/dist/esm/compose/settingsTransport.d.ts +18 -13
  56. package/dist/esm/compose/settingsTransport.js +80 -132
  57. package/dist/esm/compose/transport.d.ts +12 -2
  58. package/dist/esm/compose/webhook.d.ts +10 -13
  59. package/dist/esm/compose/webhook.js +45 -42
  60. package/dist/esm/compose/webhookSecrets.d.ts +79 -49
  61. package/dist/esm/compose/webhookSecrets.js +241 -193
  62. package/dist/esm/index.d.ts +2 -1
  63. package/dist/esm/index.js +2 -1
  64. package/dist/esm/models/AgentConversationDetail.d.ts +12 -0
  65. package/dist/esm/models/AgentConversationDetail.js +4 -0
  66. package/dist/esm/models/AgentConversationView.d.ts +12 -0
  67. package/dist/esm/models/AgentConversationView.js +4 -0
  68. package/dist/esm/models/AgentResource.d.ts +7 -0
  69. package/dist/esm/models/AgentResource.js +3 -0
  70. package/dist/esm/models/AgentVersionSavedResource.d.ts +65 -0
  71. package/dist/esm/models/AgentVersionSavedResource.js +60 -0
  72. package/dist/esm/models/AgentWebhookList.d.ts +33 -0
  73. package/dist/esm/models/AgentWebhookList.js +44 -0
  74. package/dist/esm/models/AgentWebhookView.d.ts +76 -0
  75. package/dist/esm/models/AgentWebhookView.js +70 -0
  76. package/dist/esm/models/ConversationDetail.d.ts +6 -0
  77. package/dist/esm/models/ConversationDetail.js +2 -0
  78. package/dist/esm/models/ConversationView.d.ts +6 -0
  79. package/dist/esm/models/ConversationView.js +2 -0
  80. package/dist/esm/models/ErrorDetailItem.d.ts +3 -0
  81. package/dist/esm/models/FileNodeView.d.ts +7 -0
  82. package/dist/esm/models/FileNodeView.js +3 -0
  83. package/dist/esm/models/QueueMessageInput.d.ts +6 -0
  84. package/dist/esm/models/QueueMessageInput.js +2 -0
  85. package/dist/esm/models/RotatedWebhookSecretView.d.ts +58 -0
  86. package/dist/esm/models/RotatedWebhookSecretView.js +61 -0
  87. package/dist/esm/models/SaveWarningView.d.ts +44 -0
  88. package/dist/esm/models/SaveWarningView.js +51 -0
  89. package/dist/esm/models/ShareSkippedResource.d.ts +41 -0
  90. package/dist/esm/models/ShareSkippedResource.js +47 -0
  91. package/dist/esm/models/WebhookSecretPutBody.d.ts +32 -0
  92. package/dist/esm/models/WebhookSecretPutBody.js +43 -0
  93. package/dist/esm/models/WebhookSecretStateView.d.ts +52 -0
  94. package/dist/esm/models/WebhookSecretStateView.js +56 -0
  95. package/dist/esm/models/WebhookSecretValueView.d.ts +32 -0
  96. package/dist/esm/models/WebhookSecretValueView.js +44 -0
  97. package/dist/esm/models/WebhookWarning.d.ts +44 -0
  98. package/dist/esm/models/WebhookWarning.js +51 -0
  99. package/dist/esm/models/index.d.ts +10 -0
  100. package/dist/esm/models/index.js +10 -0
  101. package/dist/index.d.ts +2 -1
  102. package/dist/index.js +4 -1
  103. package/dist/models/AgentConversationDetail.d.ts +12 -0
  104. package/dist/models/AgentConversationDetail.js +4 -0
  105. package/dist/models/AgentConversationView.d.ts +12 -0
  106. package/dist/models/AgentConversationView.js +4 -0
  107. package/dist/models/AgentResource.d.ts +7 -0
  108. package/dist/models/AgentResource.js +3 -0
  109. package/dist/models/AgentVersionSavedResource.d.ts +65 -0
  110. package/dist/models/AgentVersionSavedResource.js +67 -0
  111. package/dist/models/AgentWebhookList.d.ts +33 -0
  112. package/dist/models/AgentWebhookList.js +51 -0
  113. package/dist/models/AgentWebhookView.d.ts +76 -0
  114. package/dist/models/AgentWebhookView.js +78 -0
  115. package/dist/models/ConversationDetail.d.ts +6 -0
  116. package/dist/models/ConversationDetail.js +2 -0
  117. package/dist/models/ConversationView.d.ts +6 -0
  118. package/dist/models/ConversationView.js +2 -0
  119. package/dist/models/ErrorDetailItem.d.ts +3 -0
  120. package/dist/models/FileNodeView.d.ts +7 -0
  121. package/dist/models/FileNodeView.js +3 -0
  122. package/dist/models/QueueMessageInput.d.ts +6 -0
  123. package/dist/models/QueueMessageInput.js +2 -0
  124. package/dist/models/RotatedWebhookSecretView.d.ts +58 -0
  125. package/dist/models/RotatedWebhookSecretView.js +69 -0
  126. package/dist/models/SaveWarningView.d.ts +44 -0
  127. package/dist/models/SaveWarningView.js +58 -0
  128. package/dist/models/ShareSkippedResource.d.ts +41 -0
  129. package/dist/models/ShareSkippedResource.js +54 -0
  130. package/dist/models/WebhookSecretPutBody.d.ts +32 -0
  131. package/dist/models/WebhookSecretPutBody.js +50 -0
  132. package/dist/models/WebhookSecretStateView.d.ts +52 -0
  133. package/dist/models/WebhookSecretStateView.js +64 -0
  134. package/dist/models/WebhookSecretValueView.d.ts +32 -0
  135. package/dist/models/WebhookSecretValueView.js +51 -0
  136. package/dist/models/WebhookWarning.d.ts +44 -0
  137. package/dist/models/WebhookWarning.js +58 -0
  138. package/dist/models/index.d.ts +10 -0
  139. package/dist/models/index.js +10 -0
  140. package/package.json +1 -1
  141. package/src/apis/AgentsApi.ts +366 -11
  142. package/src/apis/ConversationsApi.ts +9 -2
  143. package/src/client.ts +3 -2
  144. package/src/compat/core/data.ts +5 -14
  145. package/src/compat/core/events.ts +7 -1
  146. package/src/compat/core/files.ts +913 -0
  147. package/src/compat/core/history.ts +32 -7
  148. package/src/compat/core/http.ts +338 -1
  149. package/src/compat/core/turns.ts +214 -13
  150. package/src/compat/openai/client.ts +13 -1
  151. package/src/compat/openai/resources/events.ts +239 -12
  152. package/src/compat/openai/resources/sessions.ts +39 -4
  153. package/src/compose/deploy.ts +71 -10
  154. package/src/compose/errors.ts +4 -0
  155. package/src/compose/settingsTransport.ts +78 -131
  156. package/src/compose/transport.ts +10 -2
  157. package/src/compose/webhook.ts +49 -45
  158. package/src/compose/webhookSecrets.ts +227 -179
  159. package/src/index.ts +2 -1
  160. package/src/models/AgentConversationDetail.ts +16 -0
  161. package/src/models/AgentConversationView.ts +16 -0
  162. package/src/models/AgentResource.ts +15 -0
  163. package/src/models/AgentVersionSavedResource.ts +119 -0
  164. package/src/models/AgentWebhookList.ts +74 -0
  165. package/src/models/AgentWebhookView.ts +129 -0
  166. package/src/models/ConversationDetail.ts +8 -0
  167. package/src/models/ConversationView.ts +8 -0
  168. package/src/models/ErrorDetailItem.ts +3 -0
  169. package/src/models/FileNodeView.ts +16 -0
  170. package/src/models/QueueMessageInput.ts +8 -0
  171. package/src/models/RotatedWebhookSecretView.ts +103 -0
  172. package/src/models/SaveWarningView.ts +84 -0
  173. package/src/models/ShareSkippedResource.ts +78 -0
  174. package/src/models/WebhookSecretPutBody.ts +66 -0
  175. package/src/models/WebhookSecretStateView.ts +94 -0
  176. package/src/models/WebhookSecretValueView.ts +66 -0
  177. package/src/models/WebhookWarning.ts +84 -0
  178. package/src/models/index.ts +10 -0
package/README.md CHANGED
@@ -170,57 +170,80 @@ See [docs/compose.md](../docs/compose.md#typescript) for the full guide.
170
170
  An agent can POST an event to your server when a turn completes, fails or waits for an answer. The server must have
171
171
  outbound webhooks switched on; until then a deploy keeps the setting and logs the warning `webhooks_disabled`.
172
172
 
173
- **1. Name the endpoint on the agent** (`agent.json` `webhooks`) and deploy:
173
+ **1. Declare the endpoint on the agent** (`agent.json` `webhooks`) and deploy:
174
174
 
175
175
  ```ts
176
176
  import { Agent, deploy } from "sarvam-agents-client/compose";
177
177
 
178
+ const URL = "https://hooks.acme.com/panja";
178
179
  const agent = new Agent({ name: "support-bot", instructions: "...", webhooks: [
179
- { url: "https://hooks.acme.com/panja", events: ["turn.completed", "turn.failed", "turn.requires_action"] },
180
+ { url: URL, events: ["turn.completed", "turn.failed", "turn.requires_action"] },
180
181
  ] });
181
182
  const deployment = await deploy(agent, { client: config });
183
+ const secret = deployment.webhookSecrets?.[URL]; // new on this deploy: put it where your receiver runs
182
184
  ```
183
185
 
184
- Leave `secretCredential` out: the deploy fills in the credential that `client.webhooks` manages for that agent and
185
- host. The first deploy of a webhook with no secret yet stores a random placeholder secret, that nobody holds, so the
186
- server accepts the webhook, and lists the webhook's URL in `deployment.webhooksMissingSecret`. While the placeholder
187
- is there, `secretStatus` reads `"missing"`.
186
+ A webhook is `{ url, events }` and is identified by its URL. Each one has its own signing secret, which Panja keeps.
187
+ `deploy` creates the secret of each webhook it adds, a URL that was not in the agent.json last deployed (on a first
188
+ deploy, every webhook), and returns it once in `deployment.webhookSecrets`, a frozen record of URL to secret
189
+ (non-enumerable, so logging or serialising the deployment leaves it out; left out when none was created). It reads the
190
+ deployed agent.json before it writes: the live (or paused) version's, from `GET /v2/agents/{id}/versions/{version}`.
191
+ A webhook that already has a secret keeps it: a deploy never rotates or overwrites one. A webhook deployed before whose
192
+ secret is missing (deleted, perhaps on purpose) is never given one by a deploy: it is listed in
193
+ `deployment.webhooksMissingSecret`, like a webhook whose create failed (the deploy still succeeds and warns why). Give
194
+ it one with `client.webhooks.createSecret`.
188
195
 
189
- Call `client.webhooks.setSecret` right after the first deploy, before pointing a provider at the agent. Until then
190
- deliveries fail verification, and a receiver that answers 4xx makes Panja drop them.
196
+ **No secret, no delivery.** Nothing is sent to a webhook without a secret (`secretStatus` `"missing"`). A changed URL,
197
+ even a trailing `/` or a reordered query, is a new webhook and gets a new secret: give your receiver the new one.
191
198
 
192
- **2. Set the signing secret** with `client.webhooks`:
199
+ **2. Manage the signing secret** with `client.webhooks` (owner only):
193
200
 
194
201
  ```ts
195
202
  import { Client } from "sarvam-agents-client";
196
203
 
197
- const client = new Client(config); // config: the Configuration from the Quickstart
198
- const url = "https://hooks.acme.com/panja";
199
-
200
- const secret = await client.webhooks.setSecret(deployment.agentId, url); // generates a whsec_ secret and returns it
201
- // or: await client.webhooks.setSecret(agentId, url, "whsec_...") to store one you made
202
- await client.webhooks.secretStatus(agentId, url); // "set" or "missing" ("missing" while the deploy placeholder is there)
203
- const newSecret = await client.webhooks.rotateSecret(agentId, url);
204
- await client.webhooks.deleteSecret(agentId, url);
204
+ const client = new Client(config); // config: the Configuration from the Quickstart
205
+
206
+ await client.webhooks.list(agentId); // each webhook: webhookKey, url, events, inAgentJson,
207
+ // secretStatus, secretUpdatedAt, previousExpiresAt
208
+ await client.webhooks.secretStatus(agentId, URL); // "set" or "missing"
209
+ await client.webhooks.getSecret(agentId, URL); // view the current secret again, any time
210
+ await client.webhooks.rotateSecret(agentId, URL); // a new secret; the old one keeps signing for 24 hours
211
+ await client.webhooks.setSecret(agentId, URL, "whsec_..."); // bring your own
212
+ await client.webhooks.createSecret(agentId, URL); // after a delete (SecretExistsError when it has one)
213
+ await client.webhooks.deleteSecret(agentId, URL); // nothing is sent until it gets a new one
214
+ await client.webhooks.deleteSecret(agentId, { webhookKey }); // an orphan (see below)
205
215
  ```
206
216
 
207
- Keep the returned secret where your receiver runs: Panja never shows it again. A secret that is not `whsec_` plus
208
- base64 of 24 to 64 bytes throws `SecretFormatError` before anything is sent. It works as in Python (see the
209
- [Python README](../python/README.md#webhooks)): today the secret is a Custom API the SDK creates and binds, named
210
- `webhook-secret:<agentId>:<host>`, with "enabled for chats" always **off**; `deleteSecret` only removes that one; a
211
- later release moves secrets to a dedicated server store with no change to `client.webhooks`. Nothing logs a secret or
212
- puts one in an error message.
217
+ `url` is the webhook's URL exactly as in `agent.json` (or the webhook object); the SDK finds the webhook's
218
+ `webhookKey` in `list` by exact URL, so the agent must have the webhook (deploy it first), or `UserError` is thrown.
219
+
220
+ - **Rotate.** For 24 hours after `rotateSecret` (fixed) every delivery carries two signatures, one per secret, so a
221
+ receiver holding either verifies: switch your receiver to the new secret within that time. There is one previous
222
+ slot: rotating again within the 24 hours drops the first old secret at once. `setSecret` keeps the replaced secret
223
+ signing for 24 hours the same way.
224
+ - **Bring your own.** A secret that is not `whsec_` plus base64 of 24 to 64 bytes throws `SecretFormatError` before
225
+ anything is sent. The server never echoes it. (`setSecret(agentId, url)` without a secret, the 0.5 form, still
226
+ generates and returns one, with a deprecation warning.)
227
+ - **After a leak**, cut over at once: `deleteSecret`, then `createSecret` (the new secret signs alone).
228
+ - **Orphans.** Removing a webhook from the agent keeps its secret, unused (the same URL added back signs with it
229
+ again). `list` shows such a secret after the agent's webhooks, with `inAgentJson: false` and `url: null` (Panja keeps
230
+ only the key). Delete it with `deleteSecret(agentId, { webhookKey })`. Deleting the agent deletes all its secrets.
213
231
 
214
- `secretCredential: "acme_webhook"` still works, but is `@deprecated`: it names a Custom API you created and bound
215
- yourself. To migrate, use `client.webhooks.setSecret` instead of creating a Custom API: call
216
- `setSecret(agentId, url, currentSecret)`, drop `secretCredential` and deploy, then unbind and delete the old Custom
217
- API (`unbindCustomApi`, `deleteCustomApi`).
232
+ `createSecret` throws `SecretExistsError` (a `UserError`) when the webhook already has a secret; every other refusal
233
+ is a `UserError` that says what to do. Nothing in `client.webhooks` logs a secret or puts one in an error message.
218
234
 
219
235
  The rules are Python's (see the [Python README](../python/README.md#webhooks)), with the same `UserError` messages,
220
- which name the `agent.json` path (`webhooks.0.url: ...`). Checks that need the server fail the deploy
221
- (and delete an agent the deploy created) with `UserError`, whose `issues` hold the server's `{ code, path, message }` list; a server without webhooks throws
236
+ which name the `agent.json` path (`webhooks.0.url: ...`). A webhook takes no other key (no `name`: the server refuses
237
+ it). Checks that need the server fail the deploy (and delete an agent the deploy created) with `UserError`, whose
238
+ `issues` hold the server's `{ code, path, message }` list; a server without webhooks throws
222
239
  `NotSupportedByServerError` with `features` `["webhooks"]`.
223
240
 
241
+ Upgrading from 0.5: the server no longer reads the Custom APIs 0.5 kept secrets in (`webhook-secret:<agentId>:<host>`).
242
+ A deploy does not create a secret for a webhook that was already deployed; it lists them in `webhooksMissingSecret`.
243
+ For each, keep your receiver's secret with `setSecret(agentId, url, thatSecret)`, or make a new one with
244
+ `createSecret`. Then unbind and delete those Custom APIs (`unbindCustomApi`,
245
+ `deleteCustomApi`). `secretCredential` is still accepted, `@deprecated` and ignored: it is never sent.
246
+
224
247
  **3. Verify and parse each delivery** from `sarvam-agents-client/webhooks` (a separate import path; `node:crypto`
225
248
  only, so Node 18+ or a runtime with Node's `crypto` and `Buffer`, such as Workers with `nodejs_compat`; not a browser
226
249
  or an edge runtime without them), on the raw body bytes (`express.raw()`, not `express.json()`):
@@ -10,7 +10,7 @@
10
10
  * Do not edit the class manually.
11
11
  */
12
12
  import * as runtime from '../runtime.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';
13
+ import type { AgentContentsResource, AgentCreate, AgentDeploy, AgentDraftResource, AgentHistoryResource, AgentResource, AgentSearchChannel, AgentSettingsResponse, AgentTemplateResource, AgentUpdate, AgentVersionCreate, AgentVersionDiffResource, AgentVersionPick, AgentVersionResource, AgentVersionSavedResource, AgentWebhookList, EntityCategory, EntityListAgentResource, EntityListAgentTemplateResource, FileNodeView, FileWriteBody, InstructionsBody, InstructionsResponse, PageFileNodeView, PublishRequest, RotatedWebhookSecretView, Scope, SkillUpdateResource, WebhookSecretPutBody, WebhookSecretStateView, WebhookSecretValueView } from '../models/index.js';
14
14
  export interface AcceptSkillUpdateRequest {
15
15
  agentId: string;
16
16
  skillId: string;
@@ -34,9 +34,17 @@ export interface CreateAgentRequest {
34
34
  origin?: CreateAgentOriginEnum;
35
35
  xPanjaOrigin?: CreateAgentXPanjaOriginEnum;
36
36
  }
37
+ export interface CreateAgentWebhookSecretRequest {
38
+ agentId: string;
39
+ webhookKey: string;
40
+ }
37
41
  export interface DeleteAgentRequest {
38
42
  agentId: string;
39
43
  }
44
+ export interface DeleteAgentWebhookSecretRequest {
45
+ agentId: string;
46
+ webhookKey: string;
47
+ }
40
48
  export interface DeleteVersionRequest {
41
49
  agentId: string;
42
50
  version: number;
@@ -87,8 +95,12 @@ export interface ListAgentTemplatesRequest {
87
95
  limit?: number;
88
96
  offset?: number;
89
97
  }
98
+ export interface ListAgentWebhooksRequest {
99
+ agentId: string;
100
+ }
90
101
  export interface ListAgentsRequest {
91
102
  channel?: Array<AgentSearchChannel> | null;
103
+ shared?: boolean;
92
104
  scope?: Scope | null;
93
105
  q?: string | null;
94
106
  limit?: number;
@@ -127,6 +139,11 @@ export interface PutAgentSettingsRequest {
127
139
  agentId: string;
128
140
  body: object;
129
141
  }
142
+ export interface PutAgentWebhookSecretRequest {
143
+ agentId: string;
144
+ webhookKey: string;
145
+ webhookSecretPutBody: WebhookSecretPutBody;
146
+ }
130
147
  export interface PutInstructionsRequest {
131
148
  agentId: string;
132
149
  instructionsBody: InstructionsBody;
@@ -134,6 +151,10 @@ export interface PutInstructionsRequest {
134
151
  export interface ResumeAgentRequest {
135
152
  agentId: string;
136
153
  }
154
+ export interface RotateAgentWebhookSecretRequest {
155
+ agentId: string;
156
+ webhookKey: string;
157
+ }
137
158
  export interface SaveVersionRequest {
138
159
  agentId: string;
139
160
  agentVersionCreate: AgentVersionCreate;
@@ -158,6 +179,10 @@ export interface UpdateAgentRequest {
158
179
  agentId: string;
159
180
  agentUpdate: AgentUpdate;
160
181
  }
182
+ export interface ViewAgentWebhookSecretRequest {
183
+ agentId: string;
184
+ webhookKey: string;
185
+ }
161
186
  /**
162
187
  *
163
188
  */
@@ -212,6 +237,16 @@ export declare class AgentsApi extends runtime.BaseAPI {
212
237
  * Create Agent
213
238
  */
214
239
  createAgent(requestParameters: CreateAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
240
+ /**
241
+ * Create the webhook\'s signing secret, shown in this response only (``no-store``): its first one, or a new one after a delete. 409 ``secret_exists`` when it already has one (rotate-secret replaces it).
242
+ * Create Agent Webhook Secret
243
+ */
244
+ createAgentWebhookSecretRaw(requestParameters: CreateAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WebhookSecretValueView>>;
245
+ /**
246
+ * Create the webhook\'s signing secret, shown in this response only (``no-store``): its first one, or a new one after a delete. 409 ``secret_exists`` when it already has one (rotate-secret replaces it).
247
+ * Create Agent Webhook Secret
248
+ */
249
+ createAgentWebhookSecret(requestParameters: CreateAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WebhookSecretValueView>;
215
250
  /**
216
251
  * 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
252
  * Delete Agent
@@ -222,6 +257,16 @@ export declare class AgentsApi extends runtime.BaseAPI {
222
257
  * Delete Agent
223
258
  */
224
259
  deleteAgent(requestParameters: DeleteAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
260
+ /**
261
+ * Remove the webhook\'s signing secret. Idempotent; the webhook need not be in ``agent.json`` (an orphan\'s secret).
262
+ * Delete Agent Webhook Secret
263
+ */
264
+ deleteAgentWebhookSecretRaw(requestParameters: DeleteAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
265
+ /**
266
+ * Remove the webhook\'s signing secret. Idempotent; the webhook need not be in ``agent.json`` (an orphan\'s secret).
267
+ * Delete Agent Webhook Secret
268
+ */
269
+ deleteAgentWebhookSecret(requestParameters: DeleteAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
225
270
  /**
226
271
  * Delete a never-live version; 409 ``VERSION_WAS_LIVE`` otherwise.
227
272
  * Delete Version
@@ -233,22 +278,22 @@ export declare class AgentsApi extends runtime.BaseAPI {
233
278
  */
234
279
  deleteVersion(requestParameters: DeleteVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
235
280
  /**
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.
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); nothing the version attaches blocks it (a deleted sub-agent, skill, MCP or knowledge base is dropped from the turn). 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
282
  * Deploy Agent
238
283
  */
239
284
  deployAgentRaw(requestParameters: DeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentResource>>;
240
285
  /**
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.
286
+ * 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); nothing the version attaches blocks it (a deleted sub-agent, skill, MCP or knowledge base is dropped from the turn). 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
287
  * Deploy Agent
243
288
  */
244
289
  deployAgent(requestParameters: DeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
245
290
  /**
246
- * One agent the caller can see, or 404 (missing and non-visible are indistinguishable). ``origin=managed_agents`` is owner-only, matching the managed list: a teammate\'s published agent is a 404 here (not a 403, so the Managed Agents surface never confirms it exists).
291
+ * One agent the caller can see, or 404 (missing and non-visible are indistinguishable). ``origin=managed_agents`` returns the caller\'s own agents and the managed agents shared with them (the ``shared=true`` list), so a tester can open one in the Playground. A teammate\'s Cowork agent is a 404 here (not a 403, so the Managed Agents surface never confirms it exists).
247
292
  * Get Agent
248
293
  */
249
294
  getAgentRaw(requestParameters: GetAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentResource>>;
250
295
  /**
251
- * One agent the caller can see, or 404 (missing and non-visible are indistinguishable). ``origin=managed_agents`` is owner-only, matching the managed list: a teammate\'s published agent is a 404 here (not a 403, so the Managed Agents surface never confirms it exists).
296
+ * One agent the caller can see, or 404 (missing and non-visible are indistinguishable). ``origin=managed_agents`` returns the caller\'s own agents and the managed agents shared with them (the ``shared=true`` list), so a tester can open one in the Playground. A teammate\'s Cowork agent is a 404 here (not a 403, so the Managed Agents surface never confirms it exists).
252
297
  * Get Agent
253
298
  */
254
299
  getAgent(requestParameters: GetAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
@@ -347,12 +392,22 @@ export declare class AgentsApi extends runtime.BaseAPI {
347
392
  */
348
393
  listAgentTemplates(requestParameters?: ListAgentTemplatesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EntityListAgentTemplateResource>;
349
394
  /**
350
- * Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which has no managed filter, so filtering its page here would return short pages and a wrong ``total``. Catalog-only filters are therefore a 400 with ``origin`` rather than silently ignored.
395
+ * The agent\'s webhooks with whether each has a signing secret, then any orphaned secret (``inAgentJson`` false, ``url`` null).
396
+ * List Agent Webhooks
397
+ */
398
+ listAgentWebhooksRaw(requestParameters: ListAgentWebhooksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentWebhookList>>;
399
+ /**
400
+ * The agent\'s webhooks with whether each has a signing secret, then any orphaned secret (``inAgentJson`` false, ``url`` null).
401
+ * List Agent Webhooks
402
+ */
403
+ listAgentWebhooks(requestParameters: ListAgentWebhooksRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentWebhookList>;
404
+ /**
405
+ * Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which has no managed filter, so filtering its page here would return short pages and a wrong ``total``. Catalog-only filters are therefore a 400 with ``origin`` rather than silently ignored. ``origin=managed_agents&shared=true`` lists the other side: managed agents visible to the caller that someone else owns (shared with their workspace or organisation), which the caller can test in the Playground. Their session logs stay the owner\'s. ``shared`` without ``origin`` is a 400.
351
406
  * List Agents
352
407
  */
353
408
  listAgentsRaw(requestParameters: ListAgentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<EntityListAgentResource>>;
354
409
  /**
355
- * Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which has no managed filter, so filtering its page here would return short pages and a wrong ``total``. Catalog-only filters are therefore a 400 with ``origin`` rather than silently ignored.
410
+ * Flat, scope-filterable agent catalog (contract replaces v1\'s grouped ``GET /v1/agents``; the FE re-groups client-side from each row\'s ``scope``). One gateway call returns the caller\'s full visible set (the triple powers the gateway\'s ``visibility_scope`` clause). We then drop the operator-seeded editor agents, re-apply the visibility predicate (defence in depth — the gateway is identity-agnostic), and apply the ``?scope=``/``q`` filters before counting, so ``total`` is authoritative for the returned set. ``origin=managed_agents`` keeps only managed agents the caller owns (:func:`is_owner`). A teammate\'s published managed agent is visible to the caller but its sessions are owner-only, so listing it would only lead to a 403 on the session log. It always takes the fetch-all path below: the SQL catalog pages at the gateway, which has no managed filter, so filtering its page here would return short pages and a wrong ``total``. Catalog-only filters are therefore a 400 with ``origin`` rather than silently ignored. ``origin=managed_agents&shared=true`` lists the other side: managed agents visible to the caller that someone else owns (shared with their workspace or organisation), which the caller can test in the Playground. Their session logs stay the owner\'s. ``shared`` without ``origin`` is a 400.
356
411
  * List Agents
357
412
  */
358
413
  listAgents(requestParameters?: ListAgentsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<EntityListAgentResource>;
@@ -424,6 +479,16 @@ export declare class AgentsApi extends runtime.BaseAPI {
424
479
  * Put Agent Settings
425
480
  */
426
481
  putAgentSettings(requestParameters: PutAgentSettingsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentSettingsResponse>;
482
+ /**
483
+ * Set the webhook\'s signing secret to one you made. A malformed one is 422 ``invalid_secret``; an unknown ``webhookKey`` is 404.
484
+ * Put Agent Webhook Secret
485
+ */
486
+ putAgentWebhookSecretRaw(requestParameters: PutAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WebhookSecretStateView>>;
487
+ /**
488
+ * Set the webhook\'s signing secret to one you made. A malformed one is 422 ``invalid_secret``; an unknown ``webhookKey`` is 404.
489
+ * Put Agent Webhook Secret
490
+ */
491
+ putAgentWebhookSecret(requestParameters: PutAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WebhookSecretStateView>;
427
492
  /**
428
493
  * Put Instructions
429
494
  */
@@ -443,15 +508,25 @@ export declare class AgentsApi extends runtime.BaseAPI {
443
508
  */
444
509
  resumeAgent(requestParameters: ResumeAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
445
510
  /**
446
- * Save the draft as the next version; 409 ``NO_CHANGES`` on an empty draft. Nothing is deployed.
511
+ * Replace the live secret with a new ``whsec_``, shown in this response only. 404 ``secret_missing`` when there is none: create one with ``POST .../secret`` first (rotate never creates one).
512
+ * Rotate Agent Webhook Secret
513
+ */
514
+ rotateAgentWebhookSecretRaw(requestParameters: RotateAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<RotatedWebhookSecretView>>;
515
+ /**
516
+ * Replace the live secret with a new ``whsec_``, shown in this response only. 404 ``secret_missing`` when there is none: create one with ``POST .../secret`` first (rotate never creates one).
517
+ * Rotate Agent Webhook Secret
518
+ */
519
+ rotateAgentWebhookSecret(requestParameters: RotateAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<RotatedWebhookSecretView>;
520
+ /**
521
+ * Save the draft as the next version; 409 ``NO_CHANGES`` on an empty draft. Nothing is deployed. The gateway then shares the agent with its workspace if it is still private; a refused share does not fail the save and comes back as ``shareSkipped``.
447
522
  * Save Version
448
523
  */
449
- saveVersionRaw(requestParameters: SaveVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentVersionResource>>;
524
+ saveVersionRaw(requestParameters: SaveVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentVersionSavedResource>>;
450
525
  /**
451
- * Save the draft as the next version; 409 ``NO_CHANGES`` on an empty draft. Nothing is deployed.
526
+ * Save the draft as the next version; 409 ``NO_CHANGES`` on an empty draft. Nothing is deployed. The gateway then shares the agent with its workspace if it is still private; a refused share does not fail the save and comes back as ``shareSkipped``.
452
527
  * Save Version
453
528
  */
454
- saveVersion(requestParameters: SaveVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentVersionResource>;
529
+ saveVersion(requestParameters: SaveVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentVersionSavedResource>;
455
530
  /**
456
531
  * 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.
457
532
  * Undeploy Agent
@@ -502,6 +577,16 @@ export declare class AgentsApi extends runtime.BaseAPI {
502
577
  * Update Agent
503
578
  */
504
579
  updateAgent(requestParameters: UpdateAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
580
+ /**
581
+ * The webhook\'s current signing secret, to view again (``no-store``). Owner only. 404 ``secret_missing`` when it has none: create one with ``POST .../secret`` or set your own with ``PUT``; rotate it if it leaked.
582
+ * View Agent Webhook Secret
583
+ */
584
+ viewAgentWebhookSecretRaw(requestParameters: ViewAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<WebhookSecretValueView>>;
585
+ /**
586
+ * The webhook\'s current signing secret, to view again (``no-store``). Owner only. 404 ``secret_missing`` when it has none: create one with ``POST .../secret`` or set your own with ``PUT``; rotate it if it leaked.
587
+ * View Agent Webhook Secret
588
+ */
589
+ viewAgentWebhookSecret(requestParameters: ViewAgentWebhookSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<WebhookSecretValueView>;
505
590
  }
506
591
  /**
507
592
  * @export