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.
- package/README.md +100 -0
- package/dist/apis/AgentConversationsApi.d.ts +8 -2
- package/dist/apis/AgentConversationsApi.js +8 -2
- package/dist/apis/AgentsApi.d.ts +6 -6
- package/dist/apis/AgentsApi.js +6 -6
- package/dist/apis/ConversationsApi.d.ts +6 -2
- package/dist/apis/ConversationsApi.js +10 -2
- package/dist/apis/MessagesApi.d.ts +1 -0
- package/dist/apis/MessagesApi.js +3 -0
- package/dist/apis/TriggersApi.d.ts +154 -0
- package/dist/apis/TriggersApi.js +376 -0
- package/dist/apis/index.d.ts +1 -0
- package/dist/apis/index.js +1 -0
- package/dist/client.d.ts +5 -0
- package/dist/client.js +3 -0
- package/dist/compat/core/agents.d.ts +53 -0
- package/dist/compat/core/agents.js +338 -0
- package/dist/compat/core/data.d.ts +10 -0
- package/dist/compat/core/data.js +284 -0
- package/dist/compat/core/errors.d.ts +37 -0
- package/dist/compat/core/errors.js +155 -0
- package/dist/compat/core/events.d.ts +101 -0
- package/dist/compat/core/events.js +160 -0
- package/dist/compat/core/history.d.ts +9 -0
- package/dist/compat/core/history.js +87 -0
- package/dist/compat/core/http.d.ts +60 -0
- package/dist/compat/core/http.js +444 -0
- package/dist/compat/core/ids.d.ts +4 -0
- package/dist/compat/core/ids.js +36 -0
- package/dist/compat/core/index.d.ts +14 -0
- package/dist/compat/core/index.js +30 -0
- package/dist/compat/core/models.d.ts +20 -0
- package/dist/compat/core/models.js +75 -0
- package/dist/compat/core/paging.d.ts +14 -0
- package/dist/compat/core/paging.js +124 -0
- package/dist/compat/core/refusals.d.ts +9 -0
- package/dist/compat/core/refusals.js +25 -0
- package/dist/compat/core/sessions.d.ts +65 -0
- package/dist/compat/core/sessions.js +317 -0
- package/dist/compat/core/toolResults.d.ts +43 -0
- package/dist/compat/core/toolResults.js +208 -0
- package/dist/compat/core/turns.d.ts +75 -0
- package/dist/compat/core/turns.js +353 -0
- package/dist/compat/core/warnings.d.ts +6 -0
- package/dist/compat/core/warnings.js +26 -0
- package/dist/compat/index.d.ts +3 -0
- package/dist/compat/index.js +9 -0
- package/dist/compat/openai/client.d.ts +57 -0
- package/dist/compat/openai/client.js +100 -0
- package/dist/compat/openai/errors.d.ts +72 -0
- package/dist/compat/openai/errors.js +150 -0
- package/dist/compat/openai/index.d.ts +14 -0
- package/dist/compat/openai/index.js +42 -0
- package/dist/compat/openai/pages.d.ts +19 -0
- package/dist/compat/openai/pages.js +39 -0
- package/dist/compat/openai/resources/agents.d.ts +36 -0
- package/dist/compat/openai/resources/agents.js +549 -0
- package/dist/compat/openai/resources/events.d.ts +23 -0
- package/dist/compat/openai/resources/events.js +288 -0
- package/dist/compat/openai/resources/sessions.d.ts +33 -0
- package/dist/compat/openai/resources/sessions.js +254 -0
- package/dist/compat/openai/stream.d.ts +40 -0
- package/dist/compat/openai/stream.js +585 -0
- package/dist/compat/openai/types.d.ts +125 -0
- package/dist/compat/openai/types.js +98 -0
- package/dist/compose/agent.d.ts +6 -0
- package/dist/compose/agent.js +36 -0
- package/dist/compose/deploy.d.ts +4 -0
- package/dist/compose/deploy.js +23 -5
- package/dist/compose/functionTool.d.ts +2 -0
- package/dist/compose/functionTool.js +46 -0
- package/dist/compose/index.d.ts +5 -1
- package/dist/compose/index.js +12 -1
- package/dist/compose/output.d.ts +2 -0
- package/dist/compose/output.js +15 -7
- package/dist/compose/settingsTransport.d.ts +17 -3
- package/dist/compose/settingsTransport.js +110 -8
- package/dist/compose/transport.d.ts +16 -3
- package/dist/compose/trigger.d.ts +166 -0
- package/dist/compose/trigger.js +525 -0
- package/dist/compose/triggers.d.ts +96 -0
- package/dist/compose/triggers.js +319 -0
- package/dist/esm/apis/AgentConversationsApi.d.ts +8 -2
- package/dist/esm/apis/AgentConversationsApi.js +8 -2
- package/dist/esm/apis/AgentsApi.d.ts +6 -6
- package/dist/esm/apis/AgentsApi.js +6 -6
- package/dist/esm/apis/ConversationsApi.d.ts +6 -2
- package/dist/esm/apis/ConversationsApi.js +10 -2
- package/dist/esm/apis/MessagesApi.d.ts +1 -0
- package/dist/esm/apis/MessagesApi.js +3 -0
- package/dist/esm/apis/TriggersApi.d.ts +154 -0
- package/dist/esm/apis/TriggersApi.js +372 -0
- package/dist/esm/apis/index.d.ts +1 -0
- package/dist/esm/apis/index.js +1 -0
- package/dist/esm/client.d.ts +5 -0
- package/dist/esm/client.js +3 -0
- package/dist/esm/compat/core/agents.d.ts +53 -0
- package/dist/esm/compat/core/agents.js +334 -0
- package/dist/esm/compat/core/data.d.ts +10 -0
- package/dist/esm/compat/core/data.js +281 -0
- package/dist/esm/compat/core/errors.d.ts +37 -0
- package/dist/esm/compat/core/errors.js +146 -0
- package/dist/esm/compat/core/events.d.ts +101 -0
- package/dist/esm/compat/core/events.js +156 -0
- package/dist/esm/compat/core/history.d.ts +9 -0
- package/dist/esm/compat/core/history.js +84 -0
- package/dist/esm/compat/core/http.d.ts +60 -0
- package/dist/esm/compat/core/http.js +439 -0
- package/dist/esm/compat/core/ids.d.ts +4 -0
- package/dist/esm/compat/core/ids.js +30 -0
- package/dist/esm/compat/core/index.d.ts +14 -0
- package/dist/esm/compat/core/index.js +14 -0
- package/dist/esm/compat/core/models.d.ts +20 -0
- package/dist/esm/compat/core/models.js +71 -0
- package/dist/esm/compat/core/paging.d.ts +14 -0
- package/dist/esm/compat/core/paging.js +118 -0
- package/dist/esm/compat/core/refusals.d.ts +9 -0
- package/dist/esm/compat/core/refusals.js +21 -0
- package/dist/esm/compat/core/sessions.d.ts +65 -0
- package/dist/esm/compat/core/sessions.js +312 -0
- package/dist/esm/compat/core/toolResults.d.ts +43 -0
- package/dist/esm/compat/core/toolResults.js +203 -0
- package/dist/esm/compat/core/turns.d.ts +75 -0
- package/dist/esm/compat/core/turns.js +347 -0
- package/dist/esm/compat/core/warnings.d.ts +6 -0
- package/dist/esm/compat/core/warnings.js +20 -0
- package/dist/esm/compat/index.d.ts +3 -0
- package/dist/esm/compat/index.js +3 -0
- package/dist/esm/compat/openai/client.d.ts +57 -0
- package/dist/esm/compat/openai/client.js +96 -0
- package/dist/esm/compat/openai/errors.d.ts +72 -0
- package/dist/esm/compat/openai/errors.js +130 -0
- package/dist/esm/compat/openai/index.d.ts +14 -0
- package/dist/esm/compat/openai/index.js +17 -0
- package/dist/esm/compat/openai/pages.d.ts +19 -0
- package/dist/esm/compat/openai/pages.js +35 -0
- package/dist/esm/compat/openai/resources/agents.d.ts +36 -0
- package/dist/esm/compat/openai/resources/agents.js +540 -0
- package/dist/esm/compat/openai/resources/events.d.ts +23 -0
- package/dist/esm/compat/openai/resources/events.js +282 -0
- package/dist/esm/compat/openai/resources/sessions.d.ts +33 -0
- package/dist/esm/compat/openai/resources/sessions.js +249 -0
- package/dist/esm/compat/openai/stream.d.ts +40 -0
- package/dist/esm/compat/openai/stream.js +579 -0
- package/dist/esm/compat/openai/types.d.ts +125 -0
- package/dist/esm/compat/openai/types.js +91 -0
- package/dist/esm/compose/agent.d.ts +6 -0
- package/dist/esm/compose/agent.js +37 -2
- package/dist/esm/compose/deploy.d.ts +4 -0
- package/dist/esm/compose/deploy.js +23 -5
- package/dist/esm/compose/functionTool.d.ts +2 -0
- package/dist/esm/compose/functionTool.js +45 -0
- package/dist/esm/compose/index.d.ts +5 -1
- package/dist/esm/compose/index.js +2 -0
- package/dist/esm/compose/output.d.ts +2 -0
- package/dist/esm/compose/output.js +14 -7
- package/dist/esm/compose/settingsTransport.d.ts +17 -3
- package/dist/esm/compose/settingsTransport.js +109 -8
- package/dist/esm/compose/transport.d.ts +16 -3
- package/dist/esm/compose/trigger.d.ts +166 -0
- package/dist/esm/compose/trigger.js +514 -0
- package/dist/esm/compose/triggers.d.ts +96 -0
- package/dist/esm/compose/triggers.js +315 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -1
- package/dist/esm/models/AgentResource.d.ts +7 -0
- package/dist/esm/models/AgentResource.js +3 -0
- package/dist/esm/models/FireResponse.d.ts +63 -0
- package/dist/esm/models/FireResponse.js +63 -0
- package/dist/esm/models/MessagePart.d.ts +8 -0
- package/dist/esm/models/MessagePart.js +2 -0
- package/dist/esm/models/ResponseRotateTriggerSecret.d.ts +50 -0
- package/dist/esm/models/ResponseRotateTriggerSecret.js +54 -0
- package/dist/esm/models/RotatedSecret.d.ts +44 -0
- package/dist/esm/models/RotatedSecret.js +50 -0
- package/dist/esm/models/RotatedSigningSecret.d.ts +40 -0
- package/dist/esm/models/RotatedSigningSecret.js +46 -0
- package/dist/esm/models/TriggerDryRun.d.ts +44 -0
- package/dist/esm/models/TriggerDryRun.js +47 -0
- package/dist/esm/models/TriggerEventList.d.ts +39 -0
- package/dist/esm/models/TriggerEventList.js +46 -0
- package/dist/esm/models/TriggerEventView.d.ts +117 -0
- package/dist/esm/models/TriggerEventView.js +89 -0
- package/dist/esm/models/TriggerList.d.ts +33 -0
- package/dist/esm/models/TriggerList.js +44 -0
- package/dist/esm/models/TriggerSecretPut.d.ts +38 -0
- package/dist/esm/models/TriggerSecretPut.js +45 -0
- package/dist/esm/models/TriggerSecretState.d.ts +52 -0
- package/dist/esm/models/TriggerSecretState.js +56 -0
- package/dist/esm/models/TriggerTestFireRequest.d.ts +38 -0
- package/dist/esm/models/TriggerTestFireRequest.js +43 -0
- package/dist/esm/models/TriggerToken.d.ts +50 -0
- package/dist/esm/models/TriggerToken.js +56 -0
- package/dist/esm/models/TriggerView.d.ts +105 -0
- package/dist/esm/models/TriggerView.js +92 -0
- package/dist/esm/models/index.d.ts +13 -0
- package/dist/esm/models/index.js +13 -0
- package/dist/esm/runtime.d.ts +5 -0
- package/dist/esm/runtime.js +11 -0
- package/dist/esm/webhooks.d.ts +5 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.js +14 -2
- package/dist/models/AgentResource.d.ts +7 -0
- package/dist/models/AgentResource.js +3 -0
- package/dist/models/FireResponse.d.ts +63 -0
- package/dist/models/FireResponse.js +71 -0
- package/dist/models/MessagePart.d.ts +8 -0
- package/dist/models/MessagePart.js +2 -0
- package/dist/models/ResponseRotateTriggerSecret.d.ts +50 -0
- package/dist/models/ResponseRotateTriggerSecret.js +61 -0
- package/dist/models/RotatedSecret.d.ts +44 -0
- package/dist/models/RotatedSecret.js +57 -0
- package/dist/models/RotatedSigningSecret.d.ts +40 -0
- package/dist/models/RotatedSigningSecret.js +53 -0
- package/dist/models/TriggerDryRun.d.ts +44 -0
- package/dist/models/TriggerDryRun.js +54 -0
- package/dist/models/TriggerEventList.d.ts +39 -0
- package/dist/models/TriggerEventList.js +53 -0
- package/dist/models/TriggerEventView.d.ts +117 -0
- package/dist/models/TriggerEventView.js +97 -0
- package/dist/models/TriggerList.d.ts +33 -0
- package/dist/models/TriggerList.js +51 -0
- package/dist/models/TriggerSecretPut.d.ts +38 -0
- package/dist/models/TriggerSecretPut.js +52 -0
- package/dist/models/TriggerSecretState.d.ts +52 -0
- package/dist/models/TriggerSecretState.js +64 -0
- package/dist/models/TriggerTestFireRequest.d.ts +38 -0
- package/dist/models/TriggerTestFireRequest.js +50 -0
- package/dist/models/TriggerToken.d.ts +50 -0
- package/dist/models/TriggerToken.js +63 -0
- package/dist/models/TriggerView.d.ts +105 -0
- package/dist/models/TriggerView.js +100 -0
- package/dist/models/index.d.ts +13 -0
- package/dist/models/index.js +13 -0
- package/dist/runtime.d.ts +5 -0
- package/dist/runtime.js +12 -0
- package/dist/webhooks.d.ts +5 -1
- package/package.json +53 -11
- package/src/apis/AgentConversationsApi.ts +8 -2
- package/src/apis/AgentsApi.ts +6 -6
- package/src/apis/ConversationsApi.ts +14 -2
- package/src/apis/MessagesApi.ts +5 -0
- package/src/apis/TriggersApi.ts +584 -0
- package/src/apis/index.ts +1 -0
- package/src/client.ts +6 -0
- package/src/compat/core/agents.ts +437 -0
- package/src/compat/core/data.ts +292 -0
- package/src/compat/core/errors.ts +162 -0
- package/src/compat/core/events.ts +192 -0
- package/src/compat/core/history.ts +91 -0
- package/src/compat/core/http.ts +490 -0
- package/src/compat/core/ids.ts +35 -0
- package/src/compat/core/index.ts +14 -0
- package/src/compat/core/models.ts +85 -0
- package/src/compat/core/paging.ts +119 -0
- package/src/compat/core/refusals.ts +31 -0
- package/src/compat/core/sessions.ts +358 -0
- package/src/compat/core/toolResults.ts +235 -0
- package/src/compat/core/turns.ts +421 -0
- package/src/compat/core/warnings.ts +23 -0
- package/src/compat/index.ts +3 -0
- package/src/compat/openai/client.ts +165 -0
- package/src/compat/openai/errors.ts +165 -0
- package/src/compat/openai/index.ts +65 -0
- package/src/compat/openai/pages.ts +55 -0
- package/src/compat/openai/resources/agents.ts +603 -0
- package/src/compat/openai/resources/events.ts +296 -0
- package/src/compat/openai/resources/sessions.ts +334 -0
- package/src/compat/openai/stream.ts +599 -0
- package/src/compat/openai/types.ts +217 -0
- package/src/compose/agent.ts +41 -3
- package/src/compose/deploy.ts +28 -6
- package/src/compose/functionTool.ts +44 -0
- package/src/compose/index.ts +8 -1
- package/src/compose/output.ts +14 -8
- package/src/compose/settingsTransport.ts +109 -10
- package/src/compose/transport.ts +17 -3
- package/src/compose/trigger.ts +635 -0
- package/src/compose/triggers.ts +337 -0
- package/src/index.ts +9 -1
- package/src/models/AgentResource.ts +15 -0
- package/src/models/FireResponse.ts +107 -0
- package/src/models/MessagePart.ts +8 -0
- package/src/models/ResponseRotateTriggerSecret.ts +107 -0
- package/src/models/RotatedSecret.ts +83 -0
- package/src/models/RotatedSigningSecret.ts +76 -0
- package/src/models/TriggerDryRun.ts +82 -0
- package/src/models/TriggerEventList.ts +82 -0
- package/src/models/TriggerEventView.ts +183 -0
- package/src/models/TriggerList.ts +74 -0
- package/src/models/TriggerSecretPut.ts +74 -0
- package/src/models/TriggerSecretState.ts +94 -0
- package/src/models/TriggerTestFireRequest.ts +73 -0
- package/src/models/TriggerToken.ts +93 -0
- package/src/models/TriggerView.ts +168 -0
- package/src/models/index.ts +13 -0
- package/src/runtime.ts +12 -0
- package/src/webhooks.ts +5 -1
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'
|
package/dist/apis/AgentsApi.d.ts
CHANGED
|
@@ -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>;
|
package/dist/apis/AgentsApi.js
CHANGED
|
@@ -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
|
};
|
package/dist/apis/MessagesApi.js
CHANGED
|
@@ -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
|
+
}
|