sarvam-agents-client 0.4.1 → 0.5.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 (298) hide show
  1. package/README.md +100 -0
  2. package/dist/apis/AgentConversationsApi.d.ts +8 -2
  3. package/dist/apis/AgentConversationsApi.js +8 -2
  4. package/dist/apis/AgentsApi.d.ts +6 -6
  5. package/dist/apis/AgentsApi.js +6 -6
  6. package/dist/apis/ConversationsApi.d.ts +6 -2
  7. package/dist/apis/ConversationsApi.js +10 -2
  8. package/dist/apis/MessagesApi.d.ts +1 -0
  9. package/dist/apis/MessagesApi.js +3 -0
  10. package/dist/apis/TriggersApi.d.ts +154 -0
  11. package/dist/apis/TriggersApi.js +376 -0
  12. package/dist/apis/index.d.ts +1 -0
  13. package/dist/apis/index.js +1 -0
  14. package/dist/client.d.ts +5 -0
  15. package/dist/client.js +3 -0
  16. package/dist/compat/core/agents.d.ts +53 -0
  17. package/dist/compat/core/agents.js +338 -0
  18. package/dist/compat/core/data.d.ts +10 -0
  19. package/dist/compat/core/data.js +284 -0
  20. package/dist/compat/core/errors.d.ts +37 -0
  21. package/dist/compat/core/errors.js +155 -0
  22. package/dist/compat/core/events.d.ts +101 -0
  23. package/dist/compat/core/events.js +160 -0
  24. package/dist/compat/core/history.d.ts +9 -0
  25. package/dist/compat/core/history.js +87 -0
  26. package/dist/compat/core/http.d.ts +60 -0
  27. package/dist/compat/core/http.js +444 -0
  28. package/dist/compat/core/ids.d.ts +4 -0
  29. package/dist/compat/core/ids.js +36 -0
  30. package/dist/compat/core/index.d.ts +14 -0
  31. package/dist/compat/core/index.js +30 -0
  32. package/dist/compat/core/models.d.ts +20 -0
  33. package/dist/compat/core/models.js +75 -0
  34. package/dist/compat/core/paging.d.ts +14 -0
  35. package/dist/compat/core/paging.js +124 -0
  36. package/dist/compat/core/refusals.d.ts +9 -0
  37. package/dist/compat/core/refusals.js +25 -0
  38. package/dist/compat/core/sessions.d.ts +65 -0
  39. package/dist/compat/core/sessions.js +317 -0
  40. package/dist/compat/core/toolResults.d.ts +43 -0
  41. package/dist/compat/core/toolResults.js +208 -0
  42. package/dist/compat/core/turns.d.ts +75 -0
  43. package/dist/compat/core/turns.js +353 -0
  44. package/dist/compat/core/warnings.d.ts +6 -0
  45. package/dist/compat/core/warnings.js +26 -0
  46. package/dist/compat/index.d.ts +3 -0
  47. package/dist/compat/index.js +9 -0
  48. package/dist/compat/openai/client.d.ts +57 -0
  49. package/dist/compat/openai/client.js +100 -0
  50. package/dist/compat/openai/errors.d.ts +72 -0
  51. package/dist/compat/openai/errors.js +150 -0
  52. package/dist/compat/openai/index.d.ts +14 -0
  53. package/dist/compat/openai/index.js +42 -0
  54. package/dist/compat/openai/pages.d.ts +19 -0
  55. package/dist/compat/openai/pages.js +39 -0
  56. package/dist/compat/openai/resources/agents.d.ts +36 -0
  57. package/dist/compat/openai/resources/agents.js +549 -0
  58. package/dist/compat/openai/resources/events.d.ts +23 -0
  59. package/dist/compat/openai/resources/events.js +288 -0
  60. package/dist/compat/openai/resources/sessions.d.ts +33 -0
  61. package/dist/compat/openai/resources/sessions.js +254 -0
  62. package/dist/compat/openai/stream.d.ts +40 -0
  63. package/dist/compat/openai/stream.js +585 -0
  64. package/dist/compat/openai/types.d.ts +125 -0
  65. package/dist/compat/openai/types.js +98 -0
  66. package/dist/compose/agent.d.ts +6 -0
  67. package/dist/compose/agent.js +36 -0
  68. package/dist/compose/deploy.d.ts +4 -0
  69. package/dist/compose/deploy.js +23 -5
  70. package/dist/compose/functionTool.d.ts +2 -0
  71. package/dist/compose/functionTool.js +46 -0
  72. package/dist/compose/index.d.ts +5 -1
  73. package/dist/compose/index.js +12 -1
  74. package/dist/compose/output.d.ts +2 -0
  75. package/dist/compose/output.js +15 -7
  76. package/dist/compose/settingsTransport.d.ts +17 -3
  77. package/dist/compose/settingsTransport.js +110 -8
  78. package/dist/compose/transport.d.ts +16 -3
  79. package/dist/compose/trigger.d.ts +166 -0
  80. package/dist/compose/trigger.js +525 -0
  81. package/dist/compose/triggers.d.ts +96 -0
  82. package/dist/compose/triggers.js +319 -0
  83. package/dist/esm/apis/AgentConversationsApi.d.ts +8 -2
  84. package/dist/esm/apis/AgentConversationsApi.js +8 -2
  85. package/dist/esm/apis/AgentsApi.d.ts +6 -6
  86. package/dist/esm/apis/AgentsApi.js +6 -6
  87. package/dist/esm/apis/ConversationsApi.d.ts +6 -2
  88. package/dist/esm/apis/ConversationsApi.js +10 -2
  89. package/dist/esm/apis/MessagesApi.d.ts +1 -0
  90. package/dist/esm/apis/MessagesApi.js +3 -0
  91. package/dist/esm/apis/TriggersApi.d.ts +154 -0
  92. package/dist/esm/apis/TriggersApi.js +372 -0
  93. package/dist/esm/apis/index.d.ts +1 -0
  94. package/dist/esm/apis/index.js +1 -0
  95. package/dist/esm/client.d.ts +5 -0
  96. package/dist/esm/client.js +3 -0
  97. package/dist/esm/compat/core/agents.d.ts +53 -0
  98. package/dist/esm/compat/core/agents.js +334 -0
  99. package/dist/esm/compat/core/data.d.ts +10 -0
  100. package/dist/esm/compat/core/data.js +281 -0
  101. package/dist/esm/compat/core/errors.d.ts +37 -0
  102. package/dist/esm/compat/core/errors.js +146 -0
  103. package/dist/esm/compat/core/events.d.ts +101 -0
  104. package/dist/esm/compat/core/events.js +156 -0
  105. package/dist/esm/compat/core/history.d.ts +9 -0
  106. package/dist/esm/compat/core/history.js +84 -0
  107. package/dist/esm/compat/core/http.d.ts +60 -0
  108. package/dist/esm/compat/core/http.js +439 -0
  109. package/dist/esm/compat/core/ids.d.ts +4 -0
  110. package/dist/esm/compat/core/ids.js +30 -0
  111. package/dist/esm/compat/core/index.d.ts +14 -0
  112. package/dist/esm/compat/core/index.js +14 -0
  113. package/dist/esm/compat/core/models.d.ts +20 -0
  114. package/dist/esm/compat/core/models.js +71 -0
  115. package/dist/esm/compat/core/paging.d.ts +14 -0
  116. package/dist/esm/compat/core/paging.js +118 -0
  117. package/dist/esm/compat/core/refusals.d.ts +9 -0
  118. package/dist/esm/compat/core/refusals.js +21 -0
  119. package/dist/esm/compat/core/sessions.d.ts +65 -0
  120. package/dist/esm/compat/core/sessions.js +312 -0
  121. package/dist/esm/compat/core/toolResults.d.ts +43 -0
  122. package/dist/esm/compat/core/toolResults.js +203 -0
  123. package/dist/esm/compat/core/turns.d.ts +75 -0
  124. package/dist/esm/compat/core/turns.js +347 -0
  125. package/dist/esm/compat/core/warnings.d.ts +6 -0
  126. package/dist/esm/compat/core/warnings.js +20 -0
  127. package/dist/esm/compat/index.d.ts +3 -0
  128. package/dist/esm/compat/index.js +3 -0
  129. package/dist/esm/compat/openai/client.d.ts +57 -0
  130. package/dist/esm/compat/openai/client.js +96 -0
  131. package/dist/esm/compat/openai/errors.d.ts +72 -0
  132. package/dist/esm/compat/openai/errors.js +130 -0
  133. package/dist/esm/compat/openai/index.d.ts +14 -0
  134. package/dist/esm/compat/openai/index.js +17 -0
  135. package/dist/esm/compat/openai/pages.d.ts +19 -0
  136. package/dist/esm/compat/openai/pages.js +35 -0
  137. package/dist/esm/compat/openai/resources/agents.d.ts +36 -0
  138. package/dist/esm/compat/openai/resources/agents.js +540 -0
  139. package/dist/esm/compat/openai/resources/events.d.ts +23 -0
  140. package/dist/esm/compat/openai/resources/events.js +282 -0
  141. package/dist/esm/compat/openai/resources/sessions.d.ts +33 -0
  142. package/dist/esm/compat/openai/resources/sessions.js +249 -0
  143. package/dist/esm/compat/openai/stream.d.ts +40 -0
  144. package/dist/esm/compat/openai/stream.js +579 -0
  145. package/dist/esm/compat/openai/types.d.ts +125 -0
  146. package/dist/esm/compat/openai/types.js +91 -0
  147. package/dist/esm/compose/agent.d.ts +6 -0
  148. package/dist/esm/compose/agent.js +37 -2
  149. package/dist/esm/compose/deploy.d.ts +4 -0
  150. package/dist/esm/compose/deploy.js +23 -5
  151. package/dist/esm/compose/functionTool.d.ts +2 -0
  152. package/dist/esm/compose/functionTool.js +45 -0
  153. package/dist/esm/compose/index.d.ts +5 -1
  154. package/dist/esm/compose/index.js +2 -0
  155. package/dist/esm/compose/output.d.ts +2 -0
  156. package/dist/esm/compose/output.js +14 -7
  157. package/dist/esm/compose/settingsTransport.d.ts +17 -3
  158. package/dist/esm/compose/settingsTransport.js +109 -8
  159. package/dist/esm/compose/transport.d.ts +16 -3
  160. package/dist/esm/compose/trigger.d.ts +166 -0
  161. package/dist/esm/compose/trigger.js +514 -0
  162. package/dist/esm/compose/triggers.d.ts +96 -0
  163. package/dist/esm/compose/triggers.js +315 -0
  164. package/dist/esm/index.d.ts +4 -0
  165. package/dist/esm/index.js +4 -1
  166. package/dist/esm/models/AgentResource.d.ts +7 -0
  167. package/dist/esm/models/AgentResource.js +3 -0
  168. package/dist/esm/models/FireResponse.d.ts +63 -0
  169. package/dist/esm/models/FireResponse.js +63 -0
  170. package/dist/esm/models/MessagePart.d.ts +8 -0
  171. package/dist/esm/models/MessagePart.js +2 -0
  172. package/dist/esm/models/ResponseRotateTriggerSecret.d.ts +50 -0
  173. package/dist/esm/models/ResponseRotateTriggerSecret.js +54 -0
  174. package/dist/esm/models/RotatedSecret.d.ts +44 -0
  175. package/dist/esm/models/RotatedSecret.js +50 -0
  176. package/dist/esm/models/RotatedSigningSecret.d.ts +40 -0
  177. package/dist/esm/models/RotatedSigningSecret.js +46 -0
  178. package/dist/esm/models/TriggerDryRun.d.ts +44 -0
  179. package/dist/esm/models/TriggerDryRun.js +47 -0
  180. package/dist/esm/models/TriggerEventList.d.ts +39 -0
  181. package/dist/esm/models/TriggerEventList.js +46 -0
  182. package/dist/esm/models/TriggerEventView.d.ts +117 -0
  183. package/dist/esm/models/TriggerEventView.js +89 -0
  184. package/dist/esm/models/TriggerList.d.ts +33 -0
  185. package/dist/esm/models/TriggerList.js +44 -0
  186. package/dist/esm/models/TriggerSecretPut.d.ts +38 -0
  187. package/dist/esm/models/TriggerSecretPut.js +45 -0
  188. package/dist/esm/models/TriggerSecretState.d.ts +52 -0
  189. package/dist/esm/models/TriggerSecretState.js +56 -0
  190. package/dist/esm/models/TriggerTestFireRequest.d.ts +38 -0
  191. package/dist/esm/models/TriggerTestFireRequest.js +43 -0
  192. package/dist/esm/models/TriggerToken.d.ts +50 -0
  193. package/dist/esm/models/TriggerToken.js +56 -0
  194. package/dist/esm/models/TriggerView.d.ts +105 -0
  195. package/dist/esm/models/TriggerView.js +92 -0
  196. package/dist/esm/models/index.d.ts +13 -0
  197. package/dist/esm/models/index.js +13 -0
  198. package/dist/esm/runtime.d.ts +5 -0
  199. package/dist/esm/runtime.js +11 -0
  200. package/dist/esm/webhooks.d.ts +5 -1
  201. package/dist/index.d.ts +4 -0
  202. package/dist/index.js +14 -2
  203. package/dist/models/AgentResource.d.ts +7 -0
  204. package/dist/models/AgentResource.js +3 -0
  205. package/dist/models/FireResponse.d.ts +63 -0
  206. package/dist/models/FireResponse.js +71 -0
  207. package/dist/models/MessagePart.d.ts +8 -0
  208. package/dist/models/MessagePart.js +2 -0
  209. package/dist/models/ResponseRotateTriggerSecret.d.ts +50 -0
  210. package/dist/models/ResponseRotateTriggerSecret.js +61 -0
  211. package/dist/models/RotatedSecret.d.ts +44 -0
  212. package/dist/models/RotatedSecret.js +57 -0
  213. package/dist/models/RotatedSigningSecret.d.ts +40 -0
  214. package/dist/models/RotatedSigningSecret.js +53 -0
  215. package/dist/models/TriggerDryRun.d.ts +44 -0
  216. package/dist/models/TriggerDryRun.js +54 -0
  217. package/dist/models/TriggerEventList.d.ts +39 -0
  218. package/dist/models/TriggerEventList.js +53 -0
  219. package/dist/models/TriggerEventView.d.ts +117 -0
  220. package/dist/models/TriggerEventView.js +97 -0
  221. package/dist/models/TriggerList.d.ts +33 -0
  222. package/dist/models/TriggerList.js +51 -0
  223. package/dist/models/TriggerSecretPut.d.ts +38 -0
  224. package/dist/models/TriggerSecretPut.js +52 -0
  225. package/dist/models/TriggerSecretState.d.ts +52 -0
  226. package/dist/models/TriggerSecretState.js +64 -0
  227. package/dist/models/TriggerTestFireRequest.d.ts +38 -0
  228. package/dist/models/TriggerTestFireRequest.js +50 -0
  229. package/dist/models/TriggerToken.d.ts +50 -0
  230. package/dist/models/TriggerToken.js +63 -0
  231. package/dist/models/TriggerView.d.ts +105 -0
  232. package/dist/models/TriggerView.js +100 -0
  233. package/dist/models/index.d.ts +13 -0
  234. package/dist/models/index.js +13 -0
  235. package/dist/runtime.d.ts +5 -0
  236. package/dist/runtime.js +12 -0
  237. package/dist/webhooks.d.ts +5 -1
  238. package/package.json +53 -11
  239. package/src/apis/AgentConversationsApi.ts +8 -2
  240. package/src/apis/AgentsApi.ts +6 -6
  241. package/src/apis/ConversationsApi.ts +14 -2
  242. package/src/apis/MessagesApi.ts +5 -0
  243. package/src/apis/TriggersApi.ts +584 -0
  244. package/src/apis/index.ts +1 -0
  245. package/src/client.ts +6 -0
  246. package/src/compat/core/agents.ts +437 -0
  247. package/src/compat/core/data.ts +292 -0
  248. package/src/compat/core/errors.ts +162 -0
  249. package/src/compat/core/events.ts +192 -0
  250. package/src/compat/core/history.ts +91 -0
  251. package/src/compat/core/http.ts +490 -0
  252. package/src/compat/core/ids.ts +35 -0
  253. package/src/compat/core/index.ts +14 -0
  254. package/src/compat/core/models.ts +85 -0
  255. package/src/compat/core/paging.ts +119 -0
  256. package/src/compat/core/refusals.ts +31 -0
  257. package/src/compat/core/sessions.ts +358 -0
  258. package/src/compat/core/toolResults.ts +235 -0
  259. package/src/compat/core/turns.ts +421 -0
  260. package/src/compat/core/warnings.ts +23 -0
  261. package/src/compat/index.ts +3 -0
  262. package/src/compat/openai/client.ts +165 -0
  263. package/src/compat/openai/errors.ts +165 -0
  264. package/src/compat/openai/index.ts +65 -0
  265. package/src/compat/openai/pages.ts +55 -0
  266. package/src/compat/openai/resources/agents.ts +603 -0
  267. package/src/compat/openai/resources/events.ts +296 -0
  268. package/src/compat/openai/resources/sessions.ts +334 -0
  269. package/src/compat/openai/stream.ts +599 -0
  270. package/src/compat/openai/types.ts +217 -0
  271. package/src/compose/agent.ts +41 -3
  272. package/src/compose/deploy.ts +28 -6
  273. package/src/compose/functionTool.ts +44 -0
  274. package/src/compose/index.ts +8 -1
  275. package/src/compose/output.ts +14 -8
  276. package/src/compose/settingsTransport.ts +109 -10
  277. package/src/compose/transport.ts +17 -3
  278. package/src/compose/trigger.ts +635 -0
  279. package/src/compose/triggers.ts +337 -0
  280. package/src/index.ts +9 -1
  281. package/src/models/AgentResource.ts +15 -0
  282. package/src/models/FireResponse.ts +107 -0
  283. package/src/models/MessagePart.ts +8 -0
  284. package/src/models/ResponseRotateTriggerSecret.ts +107 -0
  285. package/src/models/RotatedSecret.ts +83 -0
  286. package/src/models/RotatedSigningSecret.ts +76 -0
  287. package/src/models/TriggerDryRun.ts +82 -0
  288. package/src/models/TriggerEventList.ts +82 -0
  289. package/src/models/TriggerEventView.ts +183 -0
  290. package/src/models/TriggerList.ts +74 -0
  291. package/src/models/TriggerSecretPut.ts +74 -0
  292. package/src/models/TriggerSecretState.ts +94 -0
  293. package/src/models/TriggerTestFireRequest.ts +73 -0
  294. package/src/models/TriggerToken.ts +93 -0
  295. package/src/models/TriggerView.ts +168 -0
  296. package/src/models/index.ts +13 -0
  297. package/src/runtime.ts +12 -0
  298. package/src/webhooks.ts +5 -1
package/README.md CHANGED
@@ -144,6 +144,7 @@ one with `ArtifactsApi.downloadUrl`.
144
144
  |---|---|
145
145
  | Instructions | `AgentsApi.getInstructions` / `putInstructions` |
146
146
  | Deploy | `AgentsApi.deployAgent` / `undeployAgent` |
147
+ | Trigger secrets | `new Client(config).triggers`: `setSecret`, `rotateSecret`, `deleteSecret`, `secretStatus` (per trigger, after deploy) |
147
148
  | Skills | `SkillsApi.listAgentSkills`, `bindSkill`, `unbindSkill`, `createSkillForAgent` |
148
149
  | Knowledge bases | `CollectionsApi.listAgentCollections`, `bindAgentToCollection`, then upload files: `initFileUpload` → PUT → `completeFileUpload` → poll `getFile` |
149
150
  | Connectors | `AppsApi.listApps`, `listAgentApps`, `bindApp`, `unbindApp`, `connectApp` |
@@ -259,6 +260,105 @@ So return a 5xx (or 429) for a failure you want retried, never a 4xx. Dedupe on
259
260
  API. A complete Express receiver is in
260
261
  [docs/examples/webhooks/express_receiver.ts](../docs/examples/webhooks/express_receiver.ts).
261
262
 
263
+ ## Inbound triggers
264
+
265
+ A trigger lets another system start a turn: GitHub, Slack, a payment provider or your own code POSTs an event to the
266
+ trigger's URL, and the agent runs with a message written from it. The rules, `UserError` messages and `agent.json`
267
+ are Python's (see [docs/compose.md](../docs/compose.md#triggers)); the fields are camelCase here (`promptTemplate`,
268
+ `toolPolicy`, `limits.perHour`). The server needs inbound triggers (panja PR #1758, with its per-trigger secrets)
269
+ switched on (`CLAW_TRIGGERS_ENABLED`).
270
+
271
+ **GitHub issues triage**, one conversation per issue:
272
+
273
+ ```ts
274
+ import { Client } from "sarvam-agents-client";
275
+ import { Agent, Trigger, deploy, keyed } from "sarvam-agents-client/compose";
276
+
277
+ const triage = new Agent({ name: "issue-triage", instructions: "Label and prioritise new GitHub issues.", triggers: [
278
+ Trigger.github({
279
+ name: "github_issues",
280
+ filter: [{ path: "action", op: "in", value: ["opened", "reopened"] }],
281
+ promptTemplate: "A GitHub issue was {{ payload.action }}. Triage the issue in the payload below.",
282
+ session: keyed(["repository.full_name", "issue.number"]),
283
+ toolPolicy: ["github_get_issue", "github_add_labels"],
284
+ }),
285
+ ] });
286
+ const { agentId } = await deploy(triage, { client: config });
287
+
288
+ const triggers = new Client(config).triggers;
289
+ const secret = await triggers.setSecret(agentId, "github_issues"); // a whsec_ secret, shown once: paste it into GitHub
290
+ console.log((await triggers.get(agentId, "github_issues")).url); // GitHub's Payload URL
291
+ ```
292
+
293
+ `agent.json` never holds a trigger's secret. Until `setSecret` runs, a provider trigger refuses every request
294
+ (`secretStatus` is `"missing"`). Pass a secret to bring your own: Slack's signing secret (Slack issues it, so a
295
+ `slack` trigger needs it), the secret you set on GitHub, a sender's `whsec_` secret. A plain object of the `Trigger`
296
+ type works too; the helpers check it as soon as it is built.
297
+
298
+ **Tools are read-only by default.** A trigger's payload is untrusted, so a trigger with no `toolPolicy` gets only the
299
+ agent's read-only tools (a name like `get_*`, `list_*`, `*_search`); a tool that sends, posts, writes or deletes is
300
+ left out, and so is one that reaches an address it is given (a `url`, `host`, `domain` or callback argument, a fetch,
301
+ `dns` or `ping` tool). Name the write tools a trigger needs in `toolPolicy` (glob patterns, or `{ allow: [...] }`), or pass
302
+ `["*"]` (`ToolPolicy.all()`) for every tool, `bash`, `run_program`, `delegate_task` and `agent_test_run` included; a
303
+ partial glob never matches those four.
304
+
305
+ **A bearer trigger from your own system.** The deploy that creates it mints the token and returns it once:
306
+
307
+ ```ts
308
+ const orders = new Agent({ name: "order-care", instructions: "Write to customers about late orders.", triggers: [
309
+ Trigger.bearer({ name: "late_orders", session: keyed("order_id"),
310
+ promptTemplate: "An order is late. Draft a short apology email for the order in the payload." }),
311
+ ] });
312
+ const [token] = (await deploy(orders, { client: config })).triggerTokens ?? []; // none if already minted
313
+ const reply = await fetch(token.url, { method: "POST",
314
+ headers: { Authorization: `Bearer ${token.token}`, "Idempotency-Key": "o1042-late", "Content-Type": "application/json" },
315
+ body: JSON.stringify({ order_id: "o1042", days_late: 3 }) });
316
+ if (!reply.ok) throw new Error(`trigger refused: ${reply.status}`); // 202 { eventId, status: "received", statusUrl }
317
+ ```
318
+
319
+ `token` is not enumerable on a `MintedTriggerToken`, so `console.log` and `JSON.stringify` leave it out; read it by
320
+ name. The generated models hide their secrets the same way (`TriggerToken.token`, `RotatedSecret.token`,
321
+ `RotatedSigningSecret.secret`).
322
+
323
+ **Manage them** with `client.triggers` (owner only; each method takes the agent's id and the trigger's name, a
324
+ `Trigger` or a `TriggerView`):
325
+
326
+ ```ts
327
+ const triggers = new Client(config).triggers;
328
+ for (const t of await triggers.list(agentId)) console.log(t.name, t.url, t.enabled, t.secretStatus, t.tokenPrefix);
329
+ await triggers.rotateSecret(agentId, "github_issues"); // the old one verifies for a day
330
+ await triggers.rotateSecret(agentId, "github_issues", { graceSeconds: 0 }); // after a leak
331
+ const newToken = await triggers.rotateSecret(agentId, "late_orders"); // a bearer trigger: a new token
332
+ await triggers.setSecret(agentId, "slack_events", "<Slack signing secret>");
333
+ await triggers.deleteSecret(agentId, "github_issues");
334
+ for await (const e of triggers.iterEvents(agentId, "github_issues")) console.log(e.id, e.status, e.error);
335
+ const page = await triggers.listEvents(agentId, "github_issues", { limit: 50 }); // nextCursor pages on
336
+ ```
337
+
338
+ Every secret method resolves to the secret (or token) once and never logs it or puts it in an error. A refusal
339
+ throws `UserError` with the server's reason; a `slack` trigger's `setSecret` without a secret, or its `rotateSecret`,
340
+ throws `UserError` (Slack issues the secret); a bearer trigger's `setSecret`/`deleteSecret` throws too.
341
+ `NotSupportedByServerError` means the server has triggers off or predates per-trigger secrets. `triggers.api` (the
342
+ generated `TriggersApi`, by trigger id) has the rest: `getTriggerEvent`, `replayTriggerEvent`, `enableTrigger`,
343
+ `disableTrigger` and `sendTestEvent({ triggerId, triggerTestFireRequest: { payload, dryRun: true } })`.
344
+
345
+ Pausing the agent skips the events that arrive meanwhile (`skipped_agent_unavailable`); `resumeAgent` readmits them,
346
+ in the order they arrived. A trigger whose turns failed 5 times in a row is auto-paused (`pausedReason`
347
+ `auto_paused: ...`); `enableTrigger` or a deploy of a changed agent clears it, and `deploy()` of an unchanged agent
348
+ leaves it. A turn that failed on a model-provider outage (`error` `llm_unavailable`, `PROVIDER_OUTAGE_ERROR`) does not
349
+ count: replay it once the provider is back. Events are kept 7 days. A queued trigger turn always runs as its own turn
350
+ ("send now" answers 409 `TRIGGER_TURN`); its reply stays in its conversation and reaches the agent's webhooks.
351
+
352
+ The senders' `POST /v1/triggers/{id}/fire` is not in the client: it takes the trigger's token or the provider's
353
+ signature, never your service token. A sender gets `202` with the `statusUrl` for a new event; for a duplicate, the first
354
+ event's id (`202` while it is still `received`, then `200` with its `status`); `200` with the event's `status` for a
355
+ filtered event, or one skipped because the agent is paused; `429` over a rate limit;
356
+ `413` for a body over the trigger's limit; `503` (`Retry-After: 30`) for a server outage; and `404` for anything
357
+ refused before the token or signature is verified (an unknown or disabled trigger, a bad token or signature, no secret
358
+ set yet), so a stranger cannot tell which trigger ids exist. A bearer sender's `Idempotency-Key` header (1 to 255
359
+ characters) makes a retry the same event for 7 days; without one, only an identical body inside the same 5-minute
360
+ window is merged, so a sender that posts a fixed body fires each time.
361
+
262
362
  ## Errors
263
363
 
264
364
  If an ID passed as a path parameter is empty, `.` or `..`, the SDK throws `InvalidPathParameterError` before
@@ -73,12 +73,12 @@ export declare class AgentConversationsApi extends runtime.BaseAPI {
73
73
  */
74
74
  listAgentConversationMessages(requestParameters: ListAgentConversationMessagesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MessagesResponse>;
75
75
  /**
76
- * The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``slack``, ``teams``, ``all``) and the values add up.
76
+ * The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``playground``, ``trigger``, ``slack``, ``teams``, ``all``) and the values add up; ``trigger`` (included in ``all``) is the conversations an inbound trigger started.
77
77
  * List Agent Conversations Route
78
78
  */
79
79
  listAgentConversationsRaw(requestParameters: ListAgentConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<PageAgentConversationView>>;
80
80
  /**
81
- * The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``slack``, ``teams``, ``all``) and the values add up.
81
+ * The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``playground``, ``trigger``, ``slack``, ``teams``, ``all``) and the values add up; ``trigger`` (included in ``all``) is the conversations an inbound trigger started.
82
82
  * List Agent Conversations Route
83
83
  */
84
84
  listAgentConversations(requestParameters: ListAgentConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PageAgentConversationView>;
@@ -97,6 +97,8 @@ export type AgentConversationArtifactDownloadUrlDispositionEnum = typeof AgentCo
97
97
  export declare const GetAgentConversationSessionTypeEnum: {
98
98
  readonly Api: "api";
99
99
  readonly Chat: "chat";
100
+ readonly Playground: "playground";
101
+ readonly Trigger: "trigger";
100
102
  readonly Slack: "slack";
101
103
  readonly Teams: "teams";
102
104
  readonly All: "all";
@@ -108,6 +110,8 @@ export type GetAgentConversationSessionTypeEnum = typeof GetAgentConversationSes
108
110
  export declare const ListAgentConversationMessagesSessionTypeEnum: {
109
111
  readonly Api: "api";
110
112
  readonly Chat: "chat";
113
+ readonly Playground: "playground";
114
+ readonly Trigger: "trigger";
111
115
  readonly Slack: "slack";
112
116
  readonly Teams: "teams";
113
117
  readonly All: "all";
@@ -119,6 +123,8 @@ export type ListAgentConversationMessagesSessionTypeEnum = typeof ListAgentConve
119
123
  export declare const ListAgentConversationsSessionTypeEnum: {
120
124
  readonly Api: "api";
121
125
  readonly Chat: "chat";
126
+ readonly Playground: "playground";
127
+ readonly Trigger: "trigger";
122
128
  readonly Slack: "slack";
123
129
  readonly Teams: "teams";
124
130
  readonly All: "all";
@@ -153,7 +153,7 @@ class AgentConversationsApi extends runtime.BaseAPI {
153
153
  return await response.value();
154
154
  }
155
155
  /**
156
- * The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``slack``, ``teams``, ``all``) and the values add up.
156
+ * The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``playground``, ``trigger``, ``slack``, ``teams``, ``all``) and the values add up; ``trigger`` (included in ``all``) is the conversations an inbound trigger started.
157
157
  * List Agent Conversations Route
158
158
  */
159
159
  async listAgentConversationsRaw(requestParameters, initOverrides) {
@@ -193,7 +193,7 @@ class AgentConversationsApi extends runtime.BaseAPI {
193
193
  return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_js_1.PageAgentConversationViewFromJSON)(jsonValue));
194
194
  }
195
195
  /**
196
- * The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``slack``, ``teams``, ``all``) and the values add up.
196
+ * The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first. ``sessionType`` is repeatable (``api``, ``chat``, ``playground``, ``trigger``, ``slack``, ``teams``, ``all``) and the values add up; ``trigger`` (included in ``all``) is the conversations an inbound trigger started.
197
197
  * List Agent Conversations Route
198
198
  */
199
199
  async listAgentConversations(requestParameters, initOverrides) {
@@ -215,6 +215,8 @@ exports.AgentConversationArtifactDownloadUrlDispositionEnum = {
215
215
  exports.GetAgentConversationSessionTypeEnum = {
216
216
  Api: 'api',
217
217
  Chat: 'chat',
218
+ Playground: 'playground',
219
+ Trigger: 'trigger',
218
220
  Slack: 'slack',
219
221
  Teams: 'teams',
220
222
  All: 'all'
@@ -225,6 +227,8 @@ exports.GetAgentConversationSessionTypeEnum = {
225
227
  exports.ListAgentConversationMessagesSessionTypeEnum = {
226
228
  Api: 'api',
227
229
  Chat: 'chat',
230
+ Playground: 'playground',
231
+ Trigger: 'trigger',
228
232
  Slack: 'slack',
229
233
  Teams: 'teams',
230
234
  All: 'all'
@@ -235,6 +239,8 @@ exports.ListAgentConversationMessagesSessionTypeEnum = {
235
239
  exports.ListAgentConversationsSessionTypeEnum = {
236
240
  Api: 'api',
237
241
  Chat: 'chat',
242
+ Playground: 'playground',
243
+ Trigger: 'trigger',
238
244
  Slack: 'slack',
239
245
  Teams: 'teams',
240
246
  All: 'all'
@@ -213,12 +213,12 @@ export declare class AgentsApi extends runtime.BaseAPI {
213
213
  */
214
214
  createAgent(requestParameters: CreateAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
215
215
  /**
216
- * Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
216
+ * Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it. Once the gateway confirms the delete, the agent\'s inbound triggers are retired (only with ``CLAW_TRIGGERS_ENABLED`` on); that cleanup never fails the delete.
217
217
  * Delete Agent
218
218
  */
219
219
  deleteAgentRaw(requestParameters: DeleteAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
220
220
  /**
221
- * Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
221
+ * Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it. Once the gateway confirms the delete, the agent\'s inbound triggers are retired (only with ``CLAW_TRIGGERS_ENABLED`` on); that cleanup never fails the delete.
222
222
  * Delete Agent
223
223
  */
224
224
  deleteAgent(requestParameters: DeleteAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
@@ -233,12 +233,12 @@ export declare class AgentsApi extends runtime.BaseAPI {
233
233
  */
234
234
  deleteVersion(requestParameters: DeleteVersionRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
235
235
  /**
236
- * Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change.
236
+ * Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change. With inbound triggers on, it then makes the agent\'s ``triggers`` rows match the live version\'s ``agent.json``, and returns the bearer token of each trigger minted by this call in ``triggerTokens`` (once; a repeat deploy returns none for a trigger that already has one). That response carries secrets: it is marked ``Cache-Control: no-store``, this route does no request or response body logging, and the tokens are never logged or put on a span. A reconcile failure leaves the deploy done and answers 502; deploying again finishes the reconcile.
237
237
  * Deploy Agent
238
238
  */
239
239
  deployAgentRaw(requestParameters: DeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentResource>>;
240
240
  /**
241
- * Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change.
241
+ * Make a saved version what end users get, on every surface. With ``version``, that version goes live (newer or older: a rollback is a deploy of an older one); 409 ``MISSING_DEPENDENCIES`` names anything it uses that was deleted. Without a body, the newest saved version goes live (idempotent), as before versions. The UI labels this *Publish*; the API noun is ``deploy`` because ``/publish`` already means widening the agent\'s audience (scope), which deploying does not change. With inbound triggers on, it then makes the agent\'s ``triggers`` rows match the live version\'s ``agent.json``, and returns the bearer token of each trigger minted by this call in ``triggerTokens`` (once; a repeat deploy returns none for a trigger that already has one). That response carries secrets: it is marked ``Cache-Control: no-store``, this route does no request or response body logging, and the tokens are never logged or put on a span. A reconcile failure leaves the deploy done and answers 502; deploying again finishes the reconcile.
242
242
  * Deploy Agent
243
243
  */
244
244
  deployAgent(requestParameters: DeployAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
@@ -433,12 +433,12 @@ export declare class AgentsApi extends runtime.BaseAPI {
433
433
  */
434
434
  putInstructions(requestParameters: PutInstructionsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<InstructionsResponse>;
435
435
  /**
436
- * Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
436
+ * Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise. With inbound triggers on, the events its triggers received while it was paused (``skipped_agent_unavailable``, payload kept) go back to the inbox and start in received order. A failure there is logged and leaves the resume done: those events stay replayable one by one.
437
437
  * Resume Agent
438
438
  */
439
439
  resumeAgentRaw(requestParameters: ResumeAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<AgentResource>>;
440
440
  /**
441
- * Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
441
+ * Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise. With inbound triggers on, the events its triggers received while it was paused (``skipped_agent_unavailable``, payload kept) go back to the inbox and start in received order. A failure there is logged and leaves the resume done: those events stay replayable one by one.
442
442
  * Resume Agent
443
443
  */
444
444
  resumeAgent(requestParameters: ResumeAgentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentResource>;
@@ -214,7 +214,7 @@ class AgentsApi extends runtime.BaseAPI {
214
214
  return await response.value();
215
215
  }
216
216
  /**
217
- * Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
217
+ * 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.
218
218
  * Delete Agent
219
219
  */
220
220
  async deleteAgentRaw(requestParameters, initOverrides) {
@@ -239,7 +239,7 @@ class AgentsApi extends runtime.BaseAPI {
239
239
  return new runtime.VoidApiResponse(response);
240
240
  }
241
241
  /**
242
- * Owner-only soft delete. The managed state lives on the agent row, so a deleted agent stops being a managed agent with it.
242
+ * 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.
243
243
  * Delete Agent
244
244
  */
245
245
  async deleteAgent(requestParameters, initOverrides) {
@@ -281,7 +281,7 @@ class AgentsApi extends runtime.BaseAPI {
281
281
  await this.deleteVersionRaw(requestParameters, initOverrides);
282
282
  }
283
283
  /**
284
- * 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.
284
+ * 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.
285
285
  * Deploy Agent
286
286
  */
287
287
  async deployAgentRaw(requestParameters, initOverrides) {
@@ -308,7 +308,7 @@ class AgentsApi extends runtime.BaseAPI {
308
308
  return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_js_1.AgentResourceFromJSON)(jsonValue));
309
309
  }
310
310
  /**
311
- * 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.
311
+ * 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.
312
312
  * Deploy Agent
313
313
  */
314
314
  async deployAgent(requestParameters, initOverrides) {
@@ -1047,7 +1047,7 @@ class AgentsApi extends runtime.BaseAPI {
1047
1047
  return await response.value();
1048
1048
  }
1049
1049
  /**
1050
- * Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
1050
+ * Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise. With inbound triggers on, the events its triggers received while it was paused (``skipped_agent_unavailable``, payload kept) go back to the inbox and start in received order. A failure there is logged and leaves the resume done: those events stay replayable one by one.
1051
1051
  * Resume Agent
1052
1052
  */
1053
1053
  async resumeAgentRaw(requestParameters, initOverrides) {
@@ -1072,7 +1072,7 @@ class AgentsApi extends runtime.BaseAPI {
1072
1072
  return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_js_1.AgentResourceFromJSON)(jsonValue));
1073
1073
  }
1074
1074
  /**
1075
- * Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise.
1075
+ * Bring the paused version back live; 409 ``NOT_PAUSED`` otherwise. With inbound triggers on, the events its triggers received while it was paused (``skipped_agent_unavailable``, payload kept) go back to the inbox and start in received order. A failure there is logged and leaves the resume done: those events stay replayable one by one.
1076
1076
  * Resume Agent
1077
1077
  */
1078
1078
  async resumeAgent(requestParameters, initOverrides) {
@@ -23,10 +23,12 @@ export interface GetConversationRequest {
23
23
  conversationId: string;
24
24
  xClientPlatform?: string | null;
25
25
  xClientVersion?: string | null;
26
+ xClientFeatures?: string | null;
26
27
  }
27
28
  export interface GetResponseRequest {
28
29
  conversationId: string;
29
30
  responseId: string;
31
+ xClientFeatures?: string | null;
30
32
  }
31
33
  export interface ListConversationsRequest {
32
34
  limit?: number;
@@ -54,12 +56,12 @@ export interface UpdateConversationRequest {
54
56
  */
55
57
  export declare class ConversationsApi extends runtime.BaseAPI {
56
58
  /**
57
- * ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has.
59
+ * ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has. A conversation created with ``X-Panja-Surface: playground`` (an agent\'s Playground) is saved as session type ``playground``: hidden from the default inbox and listed apart from real chats in the agent\'s session log. Never gated, so drafts work (``services.session_types``).
58
60
  * Create Conversation Route
59
61
  */
60
62
  createConversationRaw(requestParameters: CreateConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ConversationView>>;
61
63
  /**
62
- * ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has.
64
+ * ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has. A conversation created with ``X-Panja-Surface: playground`` (an agent\'s Playground) is saved as session type ``playground``: hidden from the default inbox and listed apart from real chats in the agent\'s session log. Never gated, so drafts work (``services.session_types``).
63
65
  * Create Conversation Route
64
66
  */
65
67
  createConversation(requestParameters: CreateConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ConversationView>;
@@ -155,6 +157,8 @@ export declare const ListConversationsSessionTypeEnum: {
155
157
  readonly Chat: "chat";
156
158
  readonly Build: "build";
157
159
  readonly Api: "api";
160
+ readonly Playground: "playground";
161
+ readonly Trigger: "trigger";
158
162
  readonly All: "all";
159
163
  };
160
164
  export type ListConversationsSessionTypeEnum = typeof ListConversationsSessionTypeEnum[keyof typeof ListConversationsSessionTypeEnum];
@@ -21,7 +21,7 @@ const index_js_1 = require("../models/index.js");
21
21
  */
22
22
  class ConversationsApi extends runtime.BaseAPI {
23
23
  /**
24
- * ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has.
24
+ * ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has. A conversation created with ``X-Panja-Surface: playground`` (an agent\'s Playground) is saved as session type ``playground``: hidden from the default inbox and listed apart from real chats in the agent\'s session log. Never gated, so drafts work (``services.session_types``).
25
25
  * Create Conversation Route
26
26
  */
27
27
  async createConversationRaw(requestParameters, initOverrides) {
@@ -54,7 +54,7 @@ class ConversationsApi extends runtime.BaseAPI {
54
54
  return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_js_1.ConversationViewFromJSON)(jsonValue));
55
55
  }
56
56
  /**
57
- * ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has.
57
+ * ``origin=managed_agents`` creates the conversation as session type ``api`` (a managed-agent API session, hidden from the default inbox). It requires ``agentId``: a managed-agent session is always about one agent, and the session log lists it by that id. The agent must be visible to the caller (else 404, existence hidden like every other agent read) and a deployed managed agent (else 409 ``AGENT_NOT_DEPLOYED``). Without ``origin`` nothing is checked here — the gateway enforces agent visibility at ingest, as it always has. A conversation created with ``X-Panja-Surface: playground`` (an agent\'s Playground) is saved as session type ``playground``: hidden from the default inbox and listed apart from real chats in the agent\'s session log. Never gated, so drafts work (``services.session_types``).
58
58
  * Create Conversation Route
59
59
  */
60
60
  async createConversation(requestParameters, initOverrides) {
@@ -106,6 +106,9 @@ class ConversationsApi extends runtime.BaseAPI {
106
106
  if (requestParameters['xClientVersion'] != null) {
107
107
  headerParameters['X-Client-Version'] = String(requestParameters['xClientVersion']);
108
108
  }
109
+ if (requestParameters['xClientFeatures'] != null) {
110
+ headerParameters['X-Client-Features'] = String(requestParameters['xClientFeatures']);
111
+ }
109
112
  if (this.configuration && this.configuration.accessToken) {
110
113
  const token = this.configuration.accessToken;
111
114
  const tokenString = await token("bearerAuth", []);
@@ -141,6 +144,9 @@ class ConversationsApi extends runtime.BaseAPI {
141
144
  }
142
145
  const queryParameters = {};
143
146
  const headerParameters = {};
147
+ if (requestParameters['xClientFeatures'] != null) {
148
+ headerParameters['X-Client-Features'] = String(requestParameters['xClientFeatures']);
149
+ }
144
150
  if (this.configuration && this.configuration.accessToken) {
145
151
  const token = this.configuration.accessToken;
146
152
  const tokenString = await token("bearerAuth", []);
@@ -366,5 +372,7 @@ exports.ListConversationsSessionTypeEnum = {
366
372
  Chat: 'chat',
367
373
  Build: 'build',
368
374
  Api: 'api',
375
+ Playground: 'playground',
376
+ Trigger: 'trigger',
369
377
  All: 'all'
370
378
  };
@@ -30,6 +30,7 @@ export interface ListMessagesRequest {
30
30
  delegationId?: string | null;
31
31
  before?: string | null;
32
32
  turnLimit?: number | null;
33
+ xClientFeatures?: string | null;
33
34
  }
34
35
  /**
35
36
  *
@@ -147,6 +147,9 @@ class MessagesApi extends runtime.BaseAPI {
147
147
  queryParameters['turnLimit'] = requestParameters['turnLimit'];
148
148
  }
149
149
  const headerParameters = {};
150
+ if (requestParameters['xClientFeatures'] != null) {
151
+ headerParameters['X-Client-Features'] = String(requestParameters['xClientFeatures']);
152
+ }
150
153
  if (this.configuration && this.configuration.accessToken) {
151
154
  const token = this.configuration.accessToken;
152
155
  const tokenString = await token("bearerAuth", []);
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Sarvam Agents API
3
+ * Chat with a Sarvam agent, exchange files with it, and set it up (instructions, skills, knowledge bases, connectors, deploy) from your own code. Authenticate with a service token sent as a Bearer token, and send the header X-Panja-Origin: managed_agents on every request.
4
+ *
5
+ * The version of the OpenAPI document: 0.1.0
6
+ * Contact: support@sarvam.ai
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+ import * as runtime from '../runtime.js';
13
+ import type { FireResponse, ResponseRotateTriggerSecret, TriggerDryRun, TriggerEventList, TriggerEventView, TriggerList, TriggerSecretPut, TriggerSecretState, TriggerTestFireRequest, TriggerView } from '../models/index.js';
14
+ export interface DeleteTriggerSecretRequest {
15
+ triggerId: string;
16
+ }
17
+ export interface DisableTriggerRequest {
18
+ triggerId: string;
19
+ }
20
+ export interface EnableTriggerRequest {
21
+ triggerId: string;
22
+ }
23
+ export interface GetTriggerEventRequest {
24
+ triggerId: string;
25
+ eventId: string;
26
+ }
27
+ export interface ListAgentTriggersRequest {
28
+ agentId: string;
29
+ }
30
+ export interface ListTriggerEventsRequest {
31
+ triggerId: string;
32
+ limit?: number;
33
+ cursor?: string | null;
34
+ }
35
+ export interface PutTriggerSecretRequest {
36
+ triggerId: string;
37
+ triggerSecretPut: TriggerSecretPut;
38
+ }
39
+ export interface ReplayTriggerEventRequest {
40
+ triggerId: string;
41
+ eventId: string;
42
+ }
43
+ export interface RotateTriggerSecretRequest {
44
+ triggerId: string;
45
+ }
46
+ export interface SendTestEventRequest {
47
+ triggerId: string;
48
+ triggerTestFireRequest: TriggerTestFireRequest;
49
+ }
50
+ /**
51
+ *
52
+ */
53
+ export declare class TriggersApi extends runtime.BaseAPI {
54
+ /**
55
+ * Remove a provider trigger\'s signing secret (current and previous): the trigger refuses every request until one is set again. Idempotent. A ``bearer`` trigger is 409 ``secret_not_applicable``.
56
+ * Delete Trigger Secret
57
+ */
58
+ deleteTriggerSecretRaw(requestParameters: DeleteTriggerSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<void>>;
59
+ /**
60
+ * Remove a provider trigger\'s signing secret (current and previous): the trigger refuses every request until one is set again. Idempotent. A ``bearer`` trigger is 409 ``secret_not_applicable``.
61
+ * Delete Trigger Secret
62
+ */
63
+ deleteTriggerSecret(requestParameters: DeleteTriggerSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<void>;
64
+ /**
65
+ * Disable the trigger: ``/fire`` answers 404 until it is enabled again. Its events can never start now, so they lose their payloads (waiting ones are settled ``trigger_disabled``) and are no longer replayable.
66
+ * Disable Trigger
67
+ */
68
+ disableTriggerRaw(requestParameters: DisableTriggerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TriggerView>>;
69
+ /**
70
+ * Disable the trigger: ``/fire`` answers 404 until it is enabled again. Its events can never start now, so they lose their payloads (waiting ones are settled ``trigger_disabled``) and are no longer replayable.
71
+ * Disable Trigger
72
+ */
73
+ disableTrigger(requestParameters: DisableTriggerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TriggerView>;
74
+ /**
75
+ * Enable the trigger; clears an auto-pause and the failure count. A trigger whose agent was deleted is 409 ``agent_deleted``.
76
+ * Enable Trigger
77
+ */
78
+ enableTriggerRaw(requestParameters: EnableTriggerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TriggerView>>;
79
+ /**
80
+ * Enable the trigger; clears an auto-pause and the failure count. A trigger whose agent was deleted is 409 ``agent_deleted``.
81
+ * Enable Trigger
82
+ */
83
+ enableTrigger(requestParameters: EnableTriggerRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TriggerView>;
84
+ /**
85
+ * One event; ``conversationId`` is set once it has started.
86
+ * Get Trigger Event
87
+ */
88
+ getTriggerEventRaw(requestParameters: GetTriggerEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TriggerEventView>>;
89
+ /**
90
+ * One event; ``conversationId`` is set once it has started.
91
+ * Get Trigger Event
92
+ */
93
+ getTriggerEvent(requestParameters: GetTriggerEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TriggerEventView>;
94
+ /**
95
+ * The agent\'s triggers with their fire URLs. Owner only; never a token.
96
+ * List Agent Triggers
97
+ */
98
+ listAgentTriggersRaw(requestParameters: ListAgentTriggersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TriggerList>>;
99
+ /**
100
+ * The agent\'s triggers with their fire URLs. Owner only; never a token.
101
+ * List Agent Triggers
102
+ */
103
+ listAgentTriggers(requestParameters: ListAgentTriggersRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TriggerList>;
104
+ /**
105
+ * The trigger\'s events inside the window, newest first; ``nextCursor`` (the last id) pages on.
106
+ * List Trigger Events
107
+ */
108
+ listTriggerEventsRaw(requestParameters: ListTriggerEventsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TriggerEventList>>;
109
+ /**
110
+ * The trigger\'s events inside the window, newest first; ``nextCursor`` (the last id) pages on.
111
+ * List Trigger Events
112
+ */
113
+ listTriggerEvents(requestParameters: ListTriggerEventsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TriggerEventList>;
114
+ /**
115
+ * Set a provider trigger\'s signing secret, as the provider issued it (Slack\'s signing secret, the secret you chose on GitHub). The replaced secret keeps verifying for ``graceSeconds`` (default a day; 0 at once). Never echoed. A ``bearer`` trigger is 409 ``secret_not_applicable``; an unusable secret is 400 ``invalid_secret``.
116
+ * Put Trigger Secret
117
+ */
118
+ putTriggerSecretRaw(requestParameters: PutTriggerSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TriggerSecretState>>;
119
+ /**
120
+ * Set a provider trigger\'s signing secret, as the provider issued it (Slack\'s signing secret, the secret you chose on GitHub). The replaced secret keeps verifying for ``graceSeconds`` (default a day; 0 at once). Never echoed. A ``bearer`` trigger is 409 ``secret_not_applicable``; an unusable secret is 400 ``invalid_secret``.
121
+ * Put Trigger Secret
122
+ */
123
+ putTriggerSecret(requestParameters: PutTriggerSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TriggerSecretState>;
124
+ /**
125
+ * Readmit an event that never started (``skipped_agent_unavailable``, ``rate_limited`` or ``failed``, payload still held): attempts reset, due now. The replay itself is not rate limited, but the dispatcher charges the readmitted event against the trigger\'s turn limits (hourly trigger, tenant and session key) before it starts, and holds it until they allow. Anything else is 409 ``not_replayable``.
126
+ * Replay Trigger Event
127
+ */
128
+ replayTriggerEventRaw(requestParameters: ReplayTriggerEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<FireResponse>>;
129
+ /**
130
+ * Readmit an event that never started (``skipped_agent_unavailable``, ``rate_limited`` or ``failed``, payload still held): attempts reset, due now. The replay itself is not rate limited, but the dispatcher charges the readmitted event against the trigger\'s turn limits (hourly trigger, tenant and session key) before it starts, and holds it until they allow. Anything else is 409 ``not_replayable``.
131
+ * Replay Trigger Event
132
+ */
133
+ replayTriggerEvent(requestParameters: ReplayTriggerEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<FireResponse>;
134
+ /**
135
+ * Replace the trigger\'s credential with a new one, shown in this response only (``Cache-Control: no-store``). The previous one keeps working for a day (``TOKEN_ROTATION_GRACE_SECONDS``). ``bearer``: a new token (``token``, ``tokenPrefix``). ``standard_webhooks``, ``github``, ``hmac``: a new ``whsec_`` signing secret (``secret``) to give the sender. ``slack``: 409 ``secret_not_generated``, since Slack issues the signing secret; set it with ``PUT /v1/triggers/{id}/secret``.
136
+ * Rotate Trigger Secret
137
+ */
138
+ rotateTriggerSecretRaw(requestParameters: RotateTriggerSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<ResponseRotateTriggerSecret>>;
139
+ /**
140
+ * Replace the trigger\'s credential with a new one, shown in this response only (``Cache-Control: no-store``). The previous one keeps working for a day (``TOKEN_ROTATION_GRACE_SECONDS``). ``bearer``: a new token (``token``, ``tokenPrefix``). ``standard_webhooks``, ``github``, ``hmac``: a new ``whsec_`` signing secret (``secret``) to give the sender. ``slack``: 409 ``secret_not_generated``, since Slack issues the signing secret; set it with ``PUT /v1/triggers/{id}/secret``.
141
+ * Rotate Trigger Secret
142
+ */
143
+ rotateTriggerSecret(requestParameters: RotateTriggerSecretRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<ResponseRotateTriggerSecret>;
144
+ /**
145
+ * Send ``payload`` to the trigger as its owner. ``dryRun`` answers 200 with the filter verdict and the prompt and writes nothing; otherwise the event goes through the receive pipeline without verification or the per-IP limit (dedupe key ``test:{event_id}``, no source IP) and answers as ``/fire``, except that every outcome that wrote a row (``received``, ``filtered``, ``skipped_agent_unavailable``) is a 202 ``FireResponse``: the dry run is the only 200, so the two bodies never share a status.
146
+ * Send Test Event
147
+ */
148
+ sendTestEventRaw(requestParameters: SendTestEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<TriggerDryRun | FireResponse>>;
149
+ /**
150
+ * Send ``payload`` to the trigger as its owner. ``dryRun`` answers 200 with the filter verdict and the prompt and writes nothing; otherwise the event goes through the receive pipeline without verification or the per-IP limit (dedupe key ``test:{event_id}``, no source IP) and answers as ``/fire``, except that every outcome that wrote a row (``received``, ``filtered``, ``skipped_agent_unavailable``) is a 202 ``FireResponse``: the dry run is the only 200, so the two bodies never share a status.
151
+ * Send Test Event
152
+ */
153
+ sendTestEvent(requestParameters: SendTestEventRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<TriggerDryRun | FireResponse>;
154
+ }