sarvam-agents-client 0.3.2 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/README.md +36 -23
  2. package/dist/apis/AgentConversationsApi.d.ts +2 -2
  3. package/dist/apis/AgentConversationsApi.js +2 -2
  4. package/dist/apis/AgentsApi.d.ts +195 -5
  5. package/dist/apis/AgentsApi.js +478 -5
  6. package/dist/apis/ArtifactsApi.d.ts +8 -4
  7. package/dist/apis/ArtifactsApi.js +8 -4
  8. package/dist/apis/ConversationsApi.d.ts +2 -0
  9. package/dist/apis/ConversationsApi.js +6 -0
  10. package/dist/client.d.ts +16 -0
  11. package/dist/client.js +21 -0
  12. package/dist/compose/deploy.d.ts +37 -7
  13. package/dist/compose/deploy.js +105 -19
  14. package/dist/compose/errors.d.ts +1 -1
  15. package/dist/compose/errors.js +1 -1
  16. package/dist/compose/index.d.ts +1 -1
  17. package/dist/compose/index.js +2 -1
  18. package/dist/compose/run.d.ts +5 -1
  19. package/dist/compose/run.js +9 -9
  20. package/dist/compose/settingsTransport.d.ts +14 -0
  21. package/dist/compose/settingsTransport.js +151 -14
  22. package/dist/compose/transport.d.ts +14 -0
  23. package/dist/compose/transport.js +3 -0
  24. package/dist/compose/webhook.d.ts +18 -3
  25. package/dist/compose/webhook.js +59 -10
  26. package/dist/compose/webhookSecrets.d.ts +64 -0
  27. package/dist/compose/webhookSecrets.js +255 -0
  28. package/dist/esm/apis/AgentConversationsApi.d.ts +2 -2
  29. package/dist/esm/apis/AgentConversationsApi.js +2 -2
  30. package/dist/esm/apis/AgentsApi.d.ts +195 -5
  31. package/dist/esm/apis/AgentsApi.js +478 -5
  32. package/dist/esm/apis/ArtifactsApi.d.ts +8 -4
  33. package/dist/esm/apis/ArtifactsApi.js +8 -4
  34. package/dist/esm/apis/ConversationsApi.d.ts +2 -0
  35. package/dist/esm/apis/ConversationsApi.js +6 -0
  36. package/dist/esm/client.d.ts +16 -0
  37. package/dist/esm/client.js +17 -0
  38. package/dist/esm/compose/deploy.d.ts +37 -7
  39. package/dist/esm/compose/deploy.js +105 -20
  40. package/dist/esm/compose/errors.d.ts +1 -1
  41. package/dist/esm/compose/errors.js +1 -1
  42. package/dist/esm/compose/index.d.ts +1 -1
  43. package/dist/esm/compose/index.js +1 -1
  44. package/dist/esm/compose/run.d.ts +5 -1
  45. package/dist/esm/compose/run.js +9 -9
  46. package/dist/esm/compose/settingsTransport.d.ts +14 -0
  47. package/dist/esm/compose/settingsTransport.js +151 -14
  48. package/dist/esm/compose/transport.d.ts +14 -0
  49. package/dist/esm/compose/transport.js +2 -1
  50. package/dist/esm/compose/webhook.d.ts +18 -3
  51. package/dist/esm/compose/webhook.js +55 -9
  52. package/dist/esm/compose/webhookSecrets.d.ts +64 -0
  53. package/dist/esm/compose/webhookSecrets.js +250 -0
  54. package/dist/esm/index.d.ts +3 -0
  55. package/dist/esm/index.js +3 -0
  56. package/dist/esm/models/AgentAttachmentDiff.d.ts +50 -0
  57. package/dist/esm/models/AgentAttachmentDiff.js +55 -0
  58. package/dist/esm/models/AgentContentsResource.d.ts +71 -0
  59. package/dist/esm/models/AgentContentsResource.js +70 -0
  60. package/dist/esm/models/AgentDeploy.d.ts +33 -0
  61. package/dist/esm/models/AgentDeploy.js +41 -0
  62. package/dist/esm/models/AgentDraftResource.d.ts +51 -0
  63. package/dist/esm/models/AgentDraftResource.js +52 -0
  64. package/dist/esm/models/AgentFileContent.d.ts +38 -0
  65. package/dist/esm/models/AgentFileContent.js +47 -0
  66. package/dist/esm/models/AgentHistoryResource.d.ts +71 -0
  67. package/dist/esm/models/AgentHistoryResource.js +66 -0
  68. package/dist/esm/models/AgentResource.d.ts +21 -0
  69. package/dist/esm/models/AgentResource.js +12 -0
  70. package/dist/esm/models/AgentSkillFilePin.d.ts +44 -0
  71. package/dist/esm/models/AgentSkillFilePin.js +51 -0
  72. package/dist/esm/models/AgentSubagentEntry.d.ts +38 -0
  73. package/dist/esm/models/AgentSubagentEntry.js +47 -0
  74. package/dist/esm/models/AgentVersionCreate.d.ts +32 -0
  75. package/dist/esm/models/AgentVersionCreate.js +41 -0
  76. package/dist/esm/models/AgentVersionDiffResource.d.ts +87 -0
  77. package/dist/esm/models/AgentVersionDiffResource.js +78 -0
  78. package/dist/esm/models/AgentVersionPick.d.ts +32 -0
  79. package/dist/esm/models/AgentVersionPick.js +43 -0
  80. package/dist/esm/models/AgentVersionResource.d.ts +56 -0
  81. package/dist/esm/models/AgentVersionResource.js +57 -0
  82. package/dist/esm/models/AppResource.d.ts +12 -0
  83. package/dist/esm/models/AppResource.js +4 -0
  84. package/dist/esm/models/ResponseInput.d.ts +6 -0
  85. package/dist/esm/models/ResponseInput.js +2 -0
  86. package/dist/esm/models/SkillUpdateResource.d.ts +38 -0
  87. package/dist/esm/models/SkillUpdateResource.js +47 -0
  88. package/dist/esm/models/index.d.ts +13 -0
  89. package/dist/esm/models/index.js +13 -0
  90. package/dist/index.d.ts +3 -0
  91. package/dist/index.js +6 -0
  92. package/dist/models/AgentAttachmentDiff.d.ts +50 -0
  93. package/dist/models/AgentAttachmentDiff.js +62 -0
  94. package/dist/models/AgentContentsResource.d.ts +71 -0
  95. package/dist/models/AgentContentsResource.js +77 -0
  96. package/dist/models/AgentDeploy.d.ts +33 -0
  97. package/dist/models/AgentDeploy.js +48 -0
  98. package/dist/models/AgentDraftResource.d.ts +51 -0
  99. package/dist/models/AgentDraftResource.js +59 -0
  100. package/dist/models/AgentFileContent.d.ts +38 -0
  101. package/dist/models/AgentFileContent.js +54 -0
  102. package/dist/models/AgentHistoryResource.d.ts +71 -0
  103. package/dist/models/AgentHistoryResource.js +74 -0
  104. package/dist/models/AgentResource.d.ts +21 -0
  105. package/dist/models/AgentResource.js +13 -1
  106. package/dist/models/AgentSkillFilePin.d.ts +44 -0
  107. package/dist/models/AgentSkillFilePin.js +58 -0
  108. package/dist/models/AgentSubagentEntry.d.ts +38 -0
  109. package/dist/models/AgentSubagentEntry.js +54 -0
  110. package/dist/models/AgentVersionCreate.d.ts +32 -0
  111. package/dist/models/AgentVersionCreate.js +48 -0
  112. package/dist/models/AgentVersionDiffResource.d.ts +87 -0
  113. package/dist/models/AgentVersionDiffResource.js +85 -0
  114. package/dist/models/AgentVersionPick.d.ts +32 -0
  115. package/dist/models/AgentVersionPick.js +50 -0
  116. package/dist/models/AgentVersionResource.d.ts +56 -0
  117. package/dist/models/AgentVersionResource.js +64 -0
  118. package/dist/models/AppResource.d.ts +12 -0
  119. package/dist/models/AppResource.js +4 -0
  120. package/dist/models/ResponseInput.d.ts +6 -0
  121. package/dist/models/ResponseInput.js +2 -0
  122. package/dist/models/SkillUpdateResource.d.ts +38 -0
  123. package/dist/models/SkillUpdateResource.js +54 -0
  124. package/dist/models/index.d.ts +13 -0
  125. package/dist/models/index.js +13 -0
  126. package/package.json +1 -1
  127. package/src/apis/AgentConversationsApi.ts +2 -2
  128. package/src/apis/AgentsApi.ts +737 -6
  129. package/src/apis/ArtifactsApi.ts +8 -4
  130. package/src/apis/ConversationsApi.ts +10 -0
  131. package/src/client.ts +21 -0
  132. package/src/compose/deploy.ts +126 -20
  133. package/src/compose/errors.ts +1 -1
  134. package/src/compose/index.ts +1 -1
  135. package/src/compose/run.ts +6 -2
  136. package/src/compose/settingsTransport.ts +154 -16
  137. package/src/compose/transport.ts +15 -0
  138. package/src/compose/webhook.ts +64 -11
  139. package/src/compose/webhookSecrets.ts +257 -0
  140. package/src/index.ts +4 -0
  141. package/src/models/AgentAttachmentDiff.ts +93 -0
  142. package/src/models/AgentContentsResource.ts +142 -0
  143. package/src/models/AgentDeploy.ts +66 -0
  144. package/src/models/AgentDraftResource.ts +99 -0
  145. package/src/models/AgentFileContent.ts +75 -0
  146. package/src/models/AgentHistoryResource.ts +121 -0
  147. package/src/models/AgentResource.ts +26 -0
  148. package/src/models/AgentSkillFilePin.ts +84 -0
  149. package/src/models/AgentSubagentEntry.ts +75 -0
  150. package/src/models/AgentVersionCreate.ts +65 -0
  151. package/src/models/AgentVersionDiffResource.ts +154 -0
  152. package/src/models/AgentVersionPick.ts +66 -0
  153. package/src/models/AgentVersionResource.ts +101 -0
  154. package/src/models/AppResource.ts +16 -0
  155. package/src/models/ResponseInput.ts +8 -0
  156. package/src/models/SkillUpdateResource.ts +75 -0
  157. package/src/models/index.ts +13 -0
@@ -0,0 +1,250 @@
1
+ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
2
+ if (kind === "m") throw new TypeError("Private method is not writable");
3
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
4
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
5
+ return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
6
+ };
7
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
8
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
9
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
10
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
11
+ };
12
+ var _WebhookSecrets_backend;
13
+ /**
14
+ * `client.webhooks`: set, rotate, check and delete an agent webhook's signing secret (as Python's
15
+ * `sarvam_agents.compose.webhook_secrets`).
16
+ *
17
+ * The public surface is `WebhookSecrets`. Where the secret lives is behind `SecretBackend`, one small interface with
18
+ * one implementation today, `CustomApiBackend`: the secret is a bearer Custom API the SDK creates, owns and binds to
19
+ * the agent, always with `enabledForChats: false` (`CustomApiCreate` defaults it to true, which would let the agent's
20
+ * sandbox be handed the secret on requests to the webhook's host). When the server ships dedicated secret endpoints
21
+ * (SARC-2597: PUT/DELETE secret, rotate-secret, secretStatus), a second backend replaces this one in `secretBackend`
22
+ * and nothing else changes.
23
+ *
24
+ * No secret is logged, kept on an object or put in an error message.
25
+ */
26
+ import { CustomAPIsApi } from "../apis/CustomAPIsApi.js";
27
+ import { ResponseError } from "../runtime.js";
28
+ import { UserError } from "./errors.js";
29
+ // Loaded on first use, so the root entry point (which exports `Client`) does not import `node:crypto` up front.
30
+ const loadWebhook = () => import("./webhook.js");
31
+ const loadCrypto = () => import("../webhooks.js");
32
+ /** Every Custom API the SDK creates for a webhook secret carries this description (and its name). */
33
+ export const SECRET_DESCRIPTION = "Webhook signing secret managed by the Sarvam Agents SDK (client.webhooks). Do not edit.";
34
+ /** The description of the random secret `deploy` stores when none is set yet: `secretStatus` reads it as
35
+ * `"missing"`, and `setSecret`/`rotateSecret` overwrite it with `SECRET_DESCRIPTION`. */
36
+ export const PLACEHOLDER_DESCRIPTION = "Webhook signing secret managed by the Sarvam Agents SDK (client.webhooks). Placeholder: call client.webhooks.set_secret";
37
+ const OWNED = [SECRET_DESCRIPTION, PLACEHOLDER_DESCRIPTION];
38
+ const PAGE = 100;
39
+ /** Throws `SecretFormatError` unless `secret` is `whsec_` plus base64 of 24 to 64 bytes (the verifier's own parser). */
40
+ async function checkSecret(secret) {
41
+ (await loadCrypto()).sign(secret, { msgId: "check", timestamp: 0, body: "" });
42
+ }
43
+ async function urlOf(hook) {
44
+ const url = typeof hook === "string" ? hook : hook === null || hook === void 0 ? void 0 : hook.url;
45
+ if (typeof url !== "string")
46
+ throw new UserError("webhook: pass the webhook's URL (a string) or a webhook");
47
+ const problem = (await loadWebhook()).urlProblem(url);
48
+ if (problem !== null)
49
+ throw new UserError("webhook: " + problem);
50
+ return url;
51
+ }
52
+ function agent(agentId) {
53
+ if (typeof agentId !== "string" || agentId.trim() === "")
54
+ throw new UserError("agentId: pass the agent's id");
55
+ return agentId;
56
+ }
57
+ function status(err) {
58
+ return err instanceof ResponseError ? err.response.status : 0;
59
+ }
60
+ /** The server's reason, never its raw body: a 422 may echo the request, and the request carries the secret. */
61
+ async function apiMessage(err, secret) {
62
+ var _a, _b;
63
+ let message;
64
+ if (err instanceof ResponseError) {
65
+ try {
66
+ message = (_b = (_a = ((await err.response.clone().json()))) === null || _a === void 0 ? void 0 : _a.error) === null || _b === void 0 ? void 0 : _b.message;
67
+ }
68
+ catch (_c) {
69
+ message = undefined;
70
+ }
71
+ }
72
+ if (typeof message !== "string" || !message || (secret !== undefined && message.includes(secret))) {
73
+ return `HTTP ${status(err) || "error"}`;
74
+ }
75
+ return message;
76
+ }
77
+ /** Today's store: a bearer Custom API the SDK owns, bound to the agent, never enabled for chats. */
78
+ class CustomApiBackend {
79
+ constructor(api) {
80
+ this.api = api;
81
+ }
82
+ /** The caller's Custom APIs named exactly `name` (`q` also matches substrings and hosts). */
83
+ async named(name) {
84
+ const found = [];
85
+ let offset = 0;
86
+ for (;;) {
87
+ const result = await this.api.listCustomApis({ q: name, limit: PAGE, offset });
88
+ for (const item of result.data)
89
+ if (item.name === name)
90
+ found.push(item);
91
+ offset += result.data.length;
92
+ if (result.data.length === 0 || !result.hasMore)
93
+ return found;
94
+ }
95
+ }
96
+ /** The Custom APIs named `name` that the SDK created; throws when only someone else's has the name. */
97
+ async owned(name) {
98
+ const named = await this.named(name);
99
+ const owned = named.filter((item) => { var _a; return OWNED.includes((_a = item.description) !== null && _a !== void 0 ? _a : ""); });
100
+ if (named.length > 0 && owned.length === 0) {
101
+ throw new UserError(`a Custom API named '${name}' exists that the SDK did not create; it was left alone. ` +
102
+ "Rename or delete it, then try again");
103
+ }
104
+ return owned;
105
+ }
106
+ async bind(agentId, customApiId) {
107
+ const bound = (await this.api.listAgentCustomApis({ agentId })).data;
108
+ if (bound.some((item) => item.id === customApiId))
109
+ return;
110
+ try {
111
+ await this.api.bindCustomApi({ agentId, bindCustomApiBody: { customApiId } });
112
+ }
113
+ catch (err) {
114
+ if (status(err) === 409)
115
+ return; // bound meanwhile
116
+ throw new UserError(`could not bind the webhook secret to agent ${agentId}: ${await apiMessage(err)}`);
117
+ }
118
+ }
119
+ /** PATCH the secret in, always asking for `enabledForChats: false`. The server switches chats off by detaching a
120
+ * capability, and answers 404 when there is nothing to detach (the API is already off). Then the API is read
121
+ * back: only when it exists and is off is the PATCH sent again without the switch, so the secret still lands and
122
+ * chats stay off. */
123
+ async update(customApiId, host, description, secret) {
124
+ const patch = (off) => this.api.updateCustomApi({ customApiId, customApiUpdate: {
125
+ host, description, auth: { type: "bearer", token: secret }, ...off,
126
+ } });
127
+ try {
128
+ await patch({ enabledForChats: false });
129
+ }
130
+ catch (err) {
131
+ if (status(err) !== 404)
132
+ throw err;
133
+ if ((await this.api.getCustomApi({ customApiId })).enabledForChats !== false)
134
+ throw err; // gone (404) or on
135
+ await patch({});
136
+ }
137
+ }
138
+ async store(agentId, url, secret, owned, description = SECRET_DESCRIPTION) {
139
+ const { secretCredentialName, webhookHost } = await loadWebhook();
140
+ const name = secretCredentialName(agentId, url);
141
+ const host = webhookHost(url);
142
+ let customApiId;
143
+ try {
144
+ if (owned.length > 0) {
145
+ customApiId = owned[0].id;
146
+ await this.update(customApiId, host, description, secret);
147
+ }
148
+ else {
149
+ customApiId = (await this.api.createCustomApi({ customApiCreate: {
150
+ name, description, host, enabledForChats: false, auth: { type: "bearer", token: secret },
151
+ } })).id;
152
+ }
153
+ }
154
+ catch (err) {
155
+ if (!(err instanceof ResponseError))
156
+ throw err;
157
+ throw new UserError(`could not store the webhook secret for ${host}: ${await apiMessage(err, secret)}`);
158
+ }
159
+ await this.bind(agentId, customApiId);
160
+ return name;
161
+ }
162
+ async put(agentId, url, secret) {
163
+ await this.store(agentId, url, secret, await this.owned((await loadWebhook()).secretCredentialName(agentId, url)));
164
+ }
165
+ async status(agentId, url) {
166
+ const name = (await loadWebhook()).secretCredentialName(agentId, url);
167
+ // Not a placeholder, not someone else's.
168
+ const stored = (await this.named(name)).filter((item) => item.description === SECRET_DESCRIPTION).map((i) => i.id);
169
+ if (stored.length === 0)
170
+ return "missing";
171
+ const bound = (await this.api.listAgentCustomApis({ agentId })).data;
172
+ return bound.some((item) => stored.includes(item.id)) ? "set" : "missing";
173
+ }
174
+ async delete(agentId, url) {
175
+ for (const item of await this.owned((await loadWebhook()).secretCredentialName(agentId, url))) {
176
+ try {
177
+ await this.api.unbindCustomApi({ agentId, customApiId: item.id });
178
+ }
179
+ catch (err) {
180
+ if (status(err) !== 404)
181
+ throw err;
182
+ }
183
+ try {
184
+ await this.api.deleteCustomApi({ customApiId: item.id });
185
+ }
186
+ catch (err) {
187
+ if (status(err) !== 404)
188
+ throw err;
189
+ }
190
+ }
191
+ }
192
+ async ensure(agentId, url) {
193
+ const name = (await loadWebhook()).secretCredentialName(agentId, url);
194
+ const owned = await this.owned(name);
195
+ if (owned.length > 0) {
196
+ await this.bind(agentId, owned[0].id);
197
+ return { name, status: owned[0].description === SECRET_DESCRIPTION ? "set" : "missing" };
198
+ }
199
+ console.warn(`agent ${agentId}: webhook ${url} has no signing secret yet; stored a random one nobody holds, so ` +
200
+ "deliveries fail verification until you call client.webhooks.setSecret");
201
+ const stored = await this.store(agentId, url, (await loadCrypto()).generateSecret(), owned, PLACEHOLDER_DESCRIPTION);
202
+ return { name: stored, status: "missing" };
203
+ }
204
+ }
205
+ /** The one place that picks where secrets live. */
206
+ export function secretBackend(api) {
207
+ var _a;
208
+ return new CustomApiBackend((_a = api.customApis) !== null && _a !== void 0 ? _a : new CustomAPIsApi(api.config));
209
+ }
210
+ /**
211
+ * `client.webhooks`: the signing secret of each agent.json webhook.
212
+ *
213
+ * `webhook` is the webhook's URL (or a webhook object); the secret covers the URL's host. Secrets are `whsec_` plus
214
+ * base64 of 24 to 64 bytes.
215
+ */
216
+ export class WebhookSecrets {
217
+ constructor(config) {
218
+ _WebhookSecrets_backend.set(this, void 0);
219
+ __classPrivateFieldSet(this, _WebhookSecrets_backend, secretBackend({ config }), "f");
220
+ }
221
+ /** Store `secret` (a new generated one when left out) as the webhook's signing secret and return it. A malformed
222
+ * secret throws `SecretFormatError` before anything is sent. */
223
+ async setSecret(agentId, webhook, secret) {
224
+ const id = agent(agentId);
225
+ const url = await urlOf(webhook);
226
+ const value = secret === undefined ? (await loadCrypto()).generateSecret() : secret;
227
+ if (secret !== undefined)
228
+ await checkSecret(secret);
229
+ await __classPrivateFieldGet(this, _WebhookSecrets_backend, "f").put(id, url, value);
230
+ return value;
231
+ }
232
+ /** Replace the webhook's signing secret with a new generated one and return it. Have your receiver accept the old
233
+ * and the new secret for a few minutes: a delivery still retrying is signed with the new one. */
234
+ async rotateSecret(agentId, webhook) {
235
+ return this.setSecret(agentId, webhook);
236
+ }
237
+ /** `"set"` when the agent has a signing secret stored by `setSecret` or `rotateSecret` for the webhook; `"missing"`
238
+ * otherwise, including while it holds the placeholder a deploy stored. */
239
+ async secretStatus(agentId, webhook) {
240
+ const id = agent(agentId);
241
+ return __classPrivateFieldGet(this, _WebhookSecrets_backend, "f").status(id, await urlOf(webhook));
242
+ }
243
+ /** Remove the webhook's signing secret. Only what the SDK stored is removed; a Custom API you made yourself is
244
+ * never touched. Deliveries to the webhook fail until a new secret is set or the webhook is removed. */
245
+ async deleteSecret(agentId, webhook) {
246
+ const id = agent(agentId);
247
+ await __classPrivateFieldGet(this, _WebhookSecrets_backend, "f").delete(id, await urlOf(webhook));
248
+ }
249
+ }
250
+ _WebhookSecrets_backend = new WeakMap();
@@ -2,3 +2,6 @@ export * from './runtime.js';
2
2
  export * from './apis/index.js';
3
3
  export * from './models/index.js';
4
4
  export * from './streaming.js';
5
+ export { Client } from './client.js';
6
+ export { WebhookSecrets } from './compose/webhookSecrets.js';
7
+ export type { SecretStatus } from './compose/webhookSecrets.js';
package/dist/esm/index.js CHANGED
@@ -5,3 +5,6 @@ export * from './runtime.js';
5
5
  export * from './apis/index.js';
6
6
  export * from './models/index.js';
7
7
  export * from './streaming.js';
8
+ // Hand-written: the high-level client (client.webhooks).
9
+ export { Client } from './client.js';
10
+ export { WebhookSecrets } from './compose/webhookSecrets.js';
@@ -0,0 +1,50 @@
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
+ /**
13
+ *
14
+ * @export
15
+ * @interface AgentAttachmentDiff
16
+ */
17
+ export interface AgentAttachmentDiff {
18
+ /**
19
+ *
20
+ * @type {Array<string>}
21
+ * @memberof AgentAttachmentDiff
22
+ */
23
+ added: Array<string>;
24
+ /**
25
+ *
26
+ * @type {Array<string>}
27
+ * @memberof AgentAttachmentDiff
28
+ */
29
+ removed: Array<string>;
30
+ /**
31
+ *
32
+ * @type {Array<string>}
33
+ * @memberof AgentAttachmentDiff
34
+ */
35
+ switchedOn: Array<string>;
36
+ /**
37
+ *
38
+ * @type {Array<string>}
39
+ * @memberof AgentAttachmentDiff
40
+ */
41
+ switchedOff: Array<string>;
42
+ }
43
+ /**
44
+ * Check if a given object implements the AgentAttachmentDiff interface.
45
+ */
46
+ export declare function instanceOfAgentAttachmentDiff(value: object): value is AgentAttachmentDiff;
47
+ export declare function AgentAttachmentDiffFromJSON(json: any): AgentAttachmentDiff;
48
+ export declare function AgentAttachmentDiffFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentAttachmentDiff;
49
+ export declare function AgentAttachmentDiffToJSON(json: any): AgentAttachmentDiff;
50
+ export declare function AgentAttachmentDiffToJSONTyped(value?: AgentAttachmentDiff | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,55 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Sarvam Agents API
5
+ * 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.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ * Contact: support@sarvam.ai
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ * Check if a given object implements the AgentAttachmentDiff interface.
16
+ */
17
+ export function instanceOfAgentAttachmentDiff(value) {
18
+ if (!('added' in value) || value['added'] === undefined)
19
+ return false;
20
+ if (!('removed' in value) || value['removed'] === undefined)
21
+ return false;
22
+ if (!('switchedOn' in value) || value['switchedOn'] === undefined)
23
+ return false;
24
+ if (!('switchedOff' in value) || value['switchedOff'] === undefined)
25
+ return false;
26
+ return true;
27
+ }
28
+ export function AgentAttachmentDiffFromJSON(json) {
29
+ return AgentAttachmentDiffFromJSONTyped(json, false);
30
+ }
31
+ export function AgentAttachmentDiffFromJSONTyped(json, ignoreDiscriminator) {
32
+ if (json == null) {
33
+ return json;
34
+ }
35
+ return {
36
+ 'added': json['added'],
37
+ 'removed': json['removed'],
38
+ 'switchedOn': json['switchedOn'],
39
+ 'switchedOff': json['switchedOff'],
40
+ };
41
+ }
42
+ export function AgentAttachmentDiffToJSON(json) {
43
+ return AgentAttachmentDiffToJSONTyped(json, false);
44
+ }
45
+ export function AgentAttachmentDiffToJSONTyped(value, ignoreDiscriminator = false) {
46
+ if (value == null) {
47
+ return value;
48
+ }
49
+ return {
50
+ 'added': value['added'],
51
+ 'removed': value['removed'],
52
+ 'switchedOn': value['switchedOn'],
53
+ 'switchedOff': value['switchedOff'],
54
+ };
55
+ }
@@ -0,0 +1,71 @@
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 type { AgentSkillFilePin } from './AgentSkillFilePin.js';
13
+ import type { AgentFileContent } from './AgentFileContent.js';
14
+ import type { AgentSubagentEntry } from './AgentSubagentEntry.js';
15
+ /**
16
+ * A saved version (``version >= 1``) or the draft (``version = -2``).
17
+ * @export
18
+ * @interface AgentContentsResource
19
+ */
20
+ export interface AgentContentsResource {
21
+ /**
22
+ *
23
+ * @type {number}
24
+ * @memberof AgentContentsResource
25
+ */
26
+ version: number;
27
+ /**
28
+ *
29
+ * @type {Array<AgentFileContent>}
30
+ * @memberof AgentContentsResource
31
+ */
32
+ files: Array<AgentFileContent>;
33
+ /**
34
+ *
35
+ * @type {Array<string>}
36
+ * @memberof AgentContentsResource
37
+ */
38
+ skillIds: Array<string>;
39
+ /**
40
+ *
41
+ * @type {Array<string>}
42
+ * @memberof AgentContentsResource
43
+ */
44
+ appIds: Array<string>;
45
+ /**
46
+ *
47
+ * @type {Array<string>}
48
+ * @memberof AgentContentsResource
49
+ */
50
+ collectionIds: Array<string>;
51
+ /**
52
+ *
53
+ * @type {Array<AgentSubagentEntry>}
54
+ * @memberof AgentContentsResource
55
+ */
56
+ subagents: Array<AgentSubagentEntry>;
57
+ /**
58
+ *
59
+ * @type {Array<AgentSkillFilePin>}
60
+ * @memberof AgentContentsResource
61
+ */
62
+ skillFiles: Array<AgentSkillFilePin>;
63
+ }
64
+ /**
65
+ * Check if a given object implements the AgentContentsResource interface.
66
+ */
67
+ export declare function instanceOfAgentContentsResource(value: object): value is AgentContentsResource;
68
+ export declare function AgentContentsResourceFromJSON(json: any): AgentContentsResource;
69
+ export declare function AgentContentsResourceFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentContentsResource;
70
+ export declare function AgentContentsResourceToJSON(json: any): AgentContentsResource;
71
+ export declare function AgentContentsResourceToJSONTyped(value?: AgentContentsResource | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,70 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Sarvam Agents API
5
+ * 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.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ * Contact: support@sarvam.ai
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ import { AgentSkillFilePinFromJSON, AgentSkillFilePinToJSON, } from './AgentSkillFilePin.js';
15
+ import { AgentFileContentFromJSON, AgentFileContentToJSON, } from './AgentFileContent.js';
16
+ import { AgentSubagentEntryFromJSON, AgentSubagentEntryToJSON, } from './AgentSubagentEntry.js';
17
+ /**
18
+ * Check if a given object implements the AgentContentsResource interface.
19
+ */
20
+ export function instanceOfAgentContentsResource(value) {
21
+ if (!('version' in value) || value['version'] === undefined)
22
+ return false;
23
+ if (!('files' in value) || value['files'] === undefined)
24
+ return false;
25
+ if (!('skillIds' in value) || value['skillIds'] === undefined)
26
+ return false;
27
+ if (!('appIds' in value) || value['appIds'] === undefined)
28
+ return false;
29
+ if (!('collectionIds' in value) || value['collectionIds'] === undefined)
30
+ return false;
31
+ if (!('subagents' in value) || value['subagents'] === undefined)
32
+ return false;
33
+ if (!('skillFiles' in value) || value['skillFiles'] === undefined)
34
+ return false;
35
+ return true;
36
+ }
37
+ export function AgentContentsResourceFromJSON(json) {
38
+ return AgentContentsResourceFromJSONTyped(json, false);
39
+ }
40
+ export function AgentContentsResourceFromJSONTyped(json, ignoreDiscriminator) {
41
+ if (json == null) {
42
+ return json;
43
+ }
44
+ return {
45
+ 'version': json['version'],
46
+ 'files': (json['files'].map(AgentFileContentFromJSON)),
47
+ 'skillIds': json['skillIds'],
48
+ 'appIds': json['appIds'],
49
+ 'collectionIds': json['collectionIds'],
50
+ 'subagents': (json['subagents'].map(AgentSubagentEntryFromJSON)),
51
+ 'skillFiles': (json['skillFiles'].map(AgentSkillFilePinFromJSON)),
52
+ };
53
+ }
54
+ export function AgentContentsResourceToJSON(json) {
55
+ return AgentContentsResourceToJSONTyped(json, false);
56
+ }
57
+ export function AgentContentsResourceToJSONTyped(value, ignoreDiscriminator = false) {
58
+ if (value == null) {
59
+ return value;
60
+ }
61
+ return {
62
+ 'version': value['version'],
63
+ 'files': (value['files'].map(AgentFileContentToJSON)),
64
+ 'skillIds': value['skillIds'],
65
+ 'appIds': value['appIds'],
66
+ 'collectionIds': value['collectionIds'],
67
+ 'subagents': (value['subagents'].map(AgentSubagentEntryToJSON)),
68
+ 'skillFiles': (value['skillFiles'].map(AgentSkillFilePinToJSON)),
69
+ };
70
+ }
@@ -0,0 +1,33 @@
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
+ /**
13
+ * Body of ``POST /v2/agents/{id}/deploy``; omitted (or no body) deploys
14
+ * the newest saved version.
15
+ * @export
16
+ * @interface AgentDeploy
17
+ */
18
+ export interface AgentDeploy {
19
+ /**
20
+ *
21
+ * @type {number}
22
+ * @memberof AgentDeploy
23
+ */
24
+ version?: number | null;
25
+ }
26
+ /**
27
+ * Check if a given object implements the AgentDeploy interface.
28
+ */
29
+ export declare function instanceOfAgentDeploy(value: object): value is AgentDeploy;
30
+ export declare function AgentDeployFromJSON(json: any): AgentDeploy;
31
+ export declare function AgentDeployFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentDeploy;
32
+ export declare function AgentDeployToJSON(json: any): AgentDeploy;
33
+ export declare function AgentDeployToJSONTyped(value?: AgentDeploy | null, ignoreDiscriminator?: boolean): any;
@@ -0,0 +1,41 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ * Sarvam Agents API
5
+ * 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.
6
+ *
7
+ * The version of the OpenAPI document: 0.1.0
8
+ * Contact: support@sarvam.ai
9
+ *
10
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
11
+ * https://openapi-generator.tech
12
+ * Do not edit the class manually.
13
+ */
14
+ /**
15
+ * Check if a given object implements the AgentDeploy interface.
16
+ */
17
+ export function instanceOfAgentDeploy(value) {
18
+ return true;
19
+ }
20
+ export function AgentDeployFromJSON(json) {
21
+ return AgentDeployFromJSONTyped(json, false);
22
+ }
23
+ export function AgentDeployFromJSONTyped(json, ignoreDiscriminator) {
24
+ if (json == null) {
25
+ return json;
26
+ }
27
+ return {
28
+ 'version': json['version'] == null ? undefined : json['version'],
29
+ };
30
+ }
31
+ export function AgentDeployToJSON(json) {
32
+ return AgentDeployToJSONTyped(json, false);
33
+ }
34
+ export function AgentDeployToJSONTyped(value, ignoreDiscriminator = false) {
35
+ if (value == null) {
36
+ return value;
37
+ }
38
+ return {
39
+ 'version': value['version'],
40
+ };
41
+ }
@@ -0,0 +1,51 @@
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 type { AgentContentsResource } from './AgentContentsResource.js';
13
+ /**
14
+ *
15
+ * @export
16
+ * @interface AgentDraftResource
17
+ */
18
+ export interface AgentDraftResource {
19
+ /**
20
+ *
21
+ * @type {AgentContentsResource}
22
+ * @memberof AgentDraftResource
23
+ */
24
+ contents: AgentContentsResource;
25
+ /**
26
+ *
27
+ * @type {boolean}
28
+ * @memberof AgentDraftResource
29
+ */
30
+ hasChanges: boolean;
31
+ /**
32
+ *
33
+ * @type {number}
34
+ * @memberof AgentDraftResource
35
+ */
36
+ basedOnVersion?: number | null;
37
+ /**
38
+ *
39
+ * @type {number}
40
+ * @memberof AgentDraftResource
41
+ */
42
+ nextVersion?: number | null;
43
+ }
44
+ /**
45
+ * Check if a given object implements the AgentDraftResource interface.
46
+ */
47
+ export declare function instanceOfAgentDraftResource(value: object): value is AgentDraftResource;
48
+ export declare function AgentDraftResourceFromJSON(json: any): AgentDraftResource;
49
+ export declare function AgentDraftResourceFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentDraftResource;
50
+ export declare function AgentDraftResourceToJSON(json: any): AgentDraftResource;
51
+ export declare function AgentDraftResourceToJSONTyped(value?: AgentDraftResource | null, ignoreDiscriminator?: boolean): any;