sarvam-agents-client 0.1.2 → 0.2.0
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 +15 -0
- package/dist/apis/AgentConversationsApi.d.ts +44 -1
- package/dist/apis/AgentConversationsApi.js +104 -1
- package/dist/apis/AgentsApi.d.ts +77 -5
- package/dist/apis/AgentsApi.js +163 -5
- package/dist/apis/AppsApi.d.ts +43 -1
- package/dist/apis/AppsApi.js +108 -0
- package/dist/apis/ArtifactsApi.d.ts +31 -1
- package/dist/apis/ArtifactsApi.js +82 -0
- package/dist/apis/CustomAPIsApi.d.ts +124 -0
- package/dist/apis/CustomAPIsApi.js +305 -0
- package/dist/apis/ModelsApi.d.ts +26 -0
- package/dist/apis/ModelsApi.js +52 -0
- package/dist/apis/index.d.ts +2 -0
- package/dist/apis/index.js +2 -0
- package/dist/compose/agent.d.ts +40 -0
- package/dist/compose/agent.js +191 -0
- package/dist/compose/deploy.d.ts +30 -0
- package/dist/compose/deploy.js +146 -0
- package/dist/compose/errors.d.ts +48 -0
- package/dist/compose/errors.js +68 -0
- package/dist/compose/events.d.ts +63 -0
- package/dist/compose/events.js +100 -0
- package/dist/compose/fingerprint.d.ts +6 -0
- package/dist/compose/fingerprint.js +83 -0
- package/dist/compose/index.d.ts +13 -0
- package/dist/compose/index.js +33 -0
- package/dist/compose/run.d.ts +100 -0
- package/dist/compose/run.js +536 -0
- package/dist/compose/runState.d.ts +26 -0
- package/dist/compose/runState.js +79 -0
- package/dist/compose/settingsTransport.d.ts +24 -0
- package/dist/compose/settingsTransport.js +280 -0
- package/dist/compose/tools.d.ts +17 -0
- package/dist/compose/tools.js +29 -0
- package/dist/compose/transport.d.ts +34 -0
- package/dist/compose/transport.js +2 -0
- package/dist/esm/apis/AgentConversationsApi.d.ts +44 -1
- package/dist/esm/apis/AgentConversationsApi.js +104 -1
- package/dist/esm/apis/AgentsApi.d.ts +77 -5
- package/dist/esm/apis/AgentsApi.js +163 -5
- package/dist/esm/apis/AppsApi.d.ts +43 -1
- package/dist/esm/apis/AppsApi.js +109 -1
- package/dist/esm/apis/ArtifactsApi.d.ts +31 -1
- package/dist/esm/apis/ArtifactsApi.js +83 -1
- package/dist/esm/apis/CustomAPIsApi.d.ts +124 -0
- package/dist/esm/apis/CustomAPIsApi.js +301 -0
- package/dist/esm/apis/ModelsApi.d.ts +26 -0
- package/dist/esm/apis/ModelsApi.js +48 -0
- package/dist/esm/apis/index.d.ts +2 -0
- package/dist/esm/apis/index.js +2 -0
- package/dist/esm/compose/agent.d.ts +40 -0
- package/dist/esm/compose/agent.js +187 -0
- package/dist/esm/compose/deploy.d.ts +30 -0
- package/dist/esm/compose/deploy.js +137 -0
- package/dist/esm/compose/errors.d.ts +48 -0
- package/dist/esm/compose/errors.js +53 -0
- package/dist/esm/compose/events.d.ts +63 -0
- package/dist/esm/compose/events.js +97 -0
- package/dist/esm/compose/fingerprint.d.ts +6 -0
- package/dist/esm/compose/fingerprint.js +78 -0
- package/dist/esm/compose/index.d.ts +13 -0
- package/dist/esm/compose/index.js +8 -0
- package/dist/esm/compose/run.d.ts +100 -0
- package/dist/esm/compose/run.js +530 -0
- package/dist/esm/compose/runState.d.ts +26 -0
- package/dist/esm/compose/runState.js +75 -0
- package/dist/esm/compose/settingsTransport.d.ts +24 -0
- package/dist/esm/compose/settingsTransport.js +276 -0
- package/dist/esm/compose/tools.d.ts +17 -0
- package/dist/esm/compose/tools.js +19 -0
- package/dist/esm/compose/transport.d.ts +34 -0
- package/dist/esm/compose/transport.js +1 -0
- package/dist/esm/models/AgentChannelRef.d.ts +1 -0
- package/dist/esm/models/AgentChannelRef.js +2 -1
- package/dist/esm/models/AgentConversationDetail.d.ts +15 -2
- package/dist/esm/models/AgentConversationDetail.js +6 -4
- package/dist/esm/models/AgentConversationView.d.ts +11 -5
- package/dist/esm/models/AgentConversationView.js +4 -4
- package/dist/esm/models/AgentCreate.d.ts +8 -0
- package/dist/esm/models/AgentCreate.js +2 -0
- package/dist/esm/models/AgentCustomApiList.d.ts +33 -0
- package/dist/esm/models/AgentCustomApiList.js +44 -0
- package/dist/esm/models/AgentResource.d.ts +14 -0
- package/dist/esm/models/AgentResource.js +4 -0
- package/dist/esm/models/AgentSettingsResponse.d.ts +53 -0
- package/dist/esm/models/AgentSettingsResponse.js +52 -0
- package/dist/esm/models/AgentUpdate.d.ts +8 -0
- package/dist/esm/models/AgentUpdate.js +2 -0
- package/dist/esm/models/AppAccountView.d.ts +88 -0
- package/dist/esm/models/AppAccountView.js +79 -0
- package/dist/esm/models/AppAccountsView.d.ts +66 -0
- package/dist/esm/models/AppAccountsView.js +60 -0
- package/dist/esm/models/AppResource.d.ts +36 -0
- package/dist/esm/models/AppResource.js +12 -0
- package/dist/esm/models/AppResourceCheckView.d.ts +74 -0
- package/dist/esm/models/AppResourceCheckView.js +63 -0
- package/dist/esm/models/AppResourceView.d.ts +68 -0
- package/dist/esm/models/AppResourceView.js +67 -0
- package/dist/esm/models/AppResourcesView.d.ts +54 -0
- package/dist/esm/models/AppResourcesView.js +56 -0
- package/dist/esm/models/AppToolsResponse.d.ts +14 -0
- package/dist/esm/models/AppToolsResponse.js +4 -0
- package/dist/esm/models/AppView.d.ts +42 -0
- package/dist/esm/models/AppView.js +14 -0
- package/dist/esm/models/ArtifactVersionResponse.d.ts +94 -0
- package/dist/esm/models/ArtifactVersionResponse.js +80 -0
- package/dist/esm/models/AttachedAgent.d.ts +44 -0
- package/dist/esm/models/AttachedAgent.js +49 -0
- package/dist/esm/models/Auth.d.ts +30 -0
- package/dist/esm/models/Auth.js +52 -0
- package/dist/esm/models/BindCustomApiBody.d.ts +32 -0
- package/dist/esm/models/BindCustomApiBody.js +43 -0
- package/dist/esm/models/ConversationArtifact.d.ts +14 -0
- package/dist/esm/models/ConversationArtifact.js +9 -0
- package/dist/esm/models/CustomApi.d.ts +102 -0
- package/dist/esm/models/CustomApi.js +90 -0
- package/dist/esm/models/CustomApiBasicAuth.d.ts +51 -0
- package/dist/esm/models/CustomApiBasicAuth.js +57 -0
- package/dist/esm/models/CustomApiBearerAuth.d.ts +45 -0
- package/dist/esm/models/CustomApiBearerAuth.js +53 -0
- package/dist/esm/models/CustomApiCreate.d.ts +57 -0
- package/dist/esm/models/CustomApiCreate.js +56 -0
- package/dist/esm/models/CustomApiHeader.d.ts +44 -0
- package/dist/esm/models/CustomApiHeader.js +47 -0
- package/dist/esm/models/CustomApiHeadersAuth.d.ts +46 -0
- package/dist/esm/models/CustomApiHeadersAuth.js +54 -0
- package/dist/esm/models/CustomApiList.d.ts +64 -0
- package/dist/esm/models/CustomApiList.js +64 -0
- package/dist/esm/models/CustomApiName.d.ts +44 -0
- package/dist/esm/models/CustomApiName.js +49 -0
- package/dist/esm/models/CustomApiUpdate.d.ts +58 -0
- package/dist/esm/models/CustomApiUpdate.js +50 -0
- package/dist/esm/models/CustomApiUpdateAuth.d.ts +30 -0
- package/dist/esm/models/CustomApiUpdateAuth.js +52 -0
- package/dist/esm/models/ErrorDetailItem.d.ts +5 -0
- package/dist/esm/models/ListModels403Response.d.ts +23 -0
- package/dist/esm/models/ListModels403Response.js +45 -0
- package/dist/esm/models/ModelEndpointView.d.ts +38 -0
- package/dist/esm/models/ModelEndpointView.js +45 -0
- package/dist/esm/models/ModelView.d.ts +69 -0
- package/dist/esm/models/ModelView.js +56 -0
- package/dist/esm/models/ModelsResponse.d.ts +33 -0
- package/dist/esm/models/ModelsResponse.js +44 -0
- package/dist/esm/models/SettingsIssueView.d.ts +44 -0
- package/dist/esm/models/SettingsIssueView.js +51 -0
- package/dist/esm/models/VersionCommitBody.d.ts +44 -0
- package/dist/esm/models/VersionCommitBody.js +51 -0
- package/dist/esm/models/VersionUploadUrlBody.d.ts +32 -0
- package/dist/esm/models/VersionUploadUrlBody.js +43 -0
- package/dist/esm/models/index.d.ts +28 -0
- package/dist/esm/models/index.js +28 -0
- package/dist/models/AgentChannelRef.d.ts +1 -0
- package/dist/models/AgentChannelRef.js +2 -1
- package/dist/models/AgentConversationDetail.d.ts +15 -2
- package/dist/models/AgentConversationDetail.js +6 -4
- package/dist/models/AgentConversationView.d.ts +11 -5
- package/dist/models/AgentConversationView.js +4 -4
- package/dist/models/AgentCreate.d.ts +8 -0
- package/dist/models/AgentCreate.js +2 -0
- package/dist/models/AgentCustomApiList.d.ts +33 -0
- package/dist/models/AgentCustomApiList.js +51 -0
- package/dist/models/AgentResource.d.ts +14 -0
- package/dist/models/AgentResource.js +4 -0
- package/dist/models/AgentSettingsResponse.d.ts +53 -0
- package/dist/models/AgentSettingsResponse.js +59 -0
- package/dist/models/AgentUpdate.d.ts +8 -0
- package/dist/models/AgentUpdate.js +2 -0
- package/dist/models/AppAccountView.d.ts +88 -0
- package/dist/models/AppAccountView.js +87 -0
- package/dist/models/AppAccountsView.d.ts +66 -0
- package/dist/models/AppAccountsView.js +68 -0
- package/dist/models/AppResource.d.ts +36 -0
- package/dist/models/AppResource.js +12 -0
- package/dist/models/AppResourceCheckView.d.ts +74 -0
- package/dist/models/AppResourceCheckView.js +71 -0
- package/dist/models/AppResourceView.d.ts +68 -0
- package/dist/models/AppResourceView.js +74 -0
- package/dist/models/AppResourcesView.d.ts +54 -0
- package/dist/models/AppResourcesView.js +64 -0
- package/dist/models/AppToolsResponse.d.ts +14 -0
- package/dist/models/AppToolsResponse.js +4 -0
- package/dist/models/AppView.d.ts +42 -0
- package/dist/models/AppView.js +14 -0
- package/dist/models/ArtifactVersionResponse.d.ts +94 -0
- package/dist/models/ArtifactVersionResponse.js +88 -0
- package/dist/models/AttachedAgent.d.ts +44 -0
- package/dist/models/AttachedAgent.js +56 -0
- package/dist/models/Auth.d.ts +30 -0
- package/dist/models/Auth.js +58 -0
- package/dist/models/BindCustomApiBody.d.ts +32 -0
- package/dist/models/BindCustomApiBody.js +50 -0
- package/dist/models/ConversationArtifact.d.ts +14 -0
- package/dist/models/ConversationArtifact.js +10 -0
- package/dist/models/CustomApi.d.ts +102 -0
- package/dist/models/CustomApi.js +98 -0
- package/dist/models/CustomApiBasicAuth.d.ts +51 -0
- package/dist/models/CustomApiBasicAuth.js +65 -0
- package/dist/models/CustomApiBearerAuth.d.ts +45 -0
- package/dist/models/CustomApiBearerAuth.js +61 -0
- package/dist/models/CustomApiCreate.d.ts +57 -0
- package/dist/models/CustomApiCreate.js +63 -0
- package/dist/models/CustomApiHeader.d.ts +44 -0
- package/dist/models/CustomApiHeader.js +54 -0
- package/dist/models/CustomApiHeadersAuth.d.ts +46 -0
- package/dist/models/CustomApiHeadersAuth.js +62 -0
- package/dist/models/CustomApiList.d.ts +64 -0
- package/dist/models/CustomApiList.js +71 -0
- package/dist/models/CustomApiName.d.ts +44 -0
- package/dist/models/CustomApiName.js +56 -0
- package/dist/models/CustomApiUpdate.d.ts +58 -0
- package/dist/models/CustomApiUpdate.js +57 -0
- package/dist/models/CustomApiUpdateAuth.d.ts +30 -0
- package/dist/models/CustomApiUpdateAuth.js +58 -0
- package/dist/models/ErrorDetailItem.d.ts +5 -0
- package/dist/models/ListModels403Response.d.ts +23 -0
- package/dist/models/ListModels403Response.js +51 -0
- package/dist/models/ModelEndpointView.d.ts +38 -0
- package/dist/models/ModelEndpointView.js +52 -0
- package/dist/models/ModelView.d.ts +69 -0
- package/dist/models/ModelView.js +63 -0
- package/dist/models/ModelsResponse.d.ts +33 -0
- package/dist/models/ModelsResponse.js +51 -0
- package/dist/models/SettingsIssueView.d.ts +44 -0
- package/dist/models/SettingsIssueView.js +58 -0
- package/dist/models/VersionCommitBody.d.ts +44 -0
- package/dist/models/VersionCommitBody.js +58 -0
- package/dist/models/VersionUploadUrlBody.d.ts +32 -0
- package/dist/models/VersionUploadUrlBody.js +50 -0
- package/dist/models/index.d.ts +28 -0
- package/dist/models/index.js +28 -0
- package/package.json +15 -2
- package/src/apis/AgentConversationsApi.ts +172 -3
- package/src/apis/AgentsApi.ts +242 -7
- package/src/apis/AppsApi.ts +174 -3
- package/src/apis/ArtifactsApi.ts +144 -0
- package/src/apis/ClarifyApi.ts +3 -3
- package/src/apis/CollectionsApi.ts +3 -3
- package/src/apis/ConversationsApi.ts +3 -3
- package/src/apis/CronsApi.ts +3 -3
- package/src/apis/CustomAPIsApi.ts +471 -0
- package/src/apis/MessagesApi.ts +3 -3
- package/src/apis/ModelsApi.ts +70 -0
- package/src/apis/QueueApi.ts +3 -3
- package/src/apis/ResponsesApi.ts +3 -3
- package/src/apis/SkillsApi.ts +3 -3
- package/src/apis/index.ts +2 -0
- package/src/compose/agent.ts +223 -0
- package/src/compose/deploy.ts +168 -0
- package/src/compose/errors.ts +66 -0
- package/src/compose/events.ts +122 -0
- package/src/compose/fingerprint.ts +74 -0
- package/src/compose/index.ts +13 -0
- package/src/compose/run.ts +601 -0
- package/src/compose/runState.ts +95 -0
- package/src/compose/settingsTransport.ts +299 -0
- package/src/compose/tools.ts +27 -0
- package/src/compose/transport.ts +48 -0
- package/src/models/AgentChannelRef.ts +2 -1
- package/src/models/AgentConversationDetail.ts +21 -5
- package/src/models/AgentConversationView.ts +15 -8
- package/src/models/AgentCreate.ts +8 -0
- package/src/models/AgentCustomApiList.ts +74 -0
- package/src/models/AgentResource.ts +16 -0
- package/src/models/AgentSettingsResponse.ts +99 -0
- package/src/models/AgentUpdate.ts +8 -0
- package/src/models/AppAccountView.ts +143 -0
- package/src/models/AppAccountsView.ts +118 -0
- package/src/models/AppResource.ts +48 -0
- package/src/models/AppResourceCheckView.ts +117 -0
- package/src/models/AppResourceView.ts +120 -0
- package/src/models/AppResourcesView.ts +102 -0
- package/src/models/AppToolsResponse.ts +16 -0
- package/src/models/AppView.ts +56 -0
- package/src/models/ArtifactVersionResponse.ts +155 -0
- package/src/models/AttachedAgent.ts +83 -0
- package/src/models/Auth.ts +84 -0
- package/src/models/BindCustomApiBody.ts +66 -0
- package/src/models/ConversationArtifact.ts +19 -0
- package/src/models/CustomApi.ts +175 -0
- package/src/models/CustomApiBasicAuth.ts +94 -0
- package/src/models/CustomApiBearerAuth.ts +85 -0
- package/src/models/CustomApiCreate.ts +108 -0
- package/src/models/CustomApiHeader.ts +82 -0
- package/src/models/CustomApiHeadersAuth.ts +93 -0
- package/src/models/CustomApiList.ts +120 -0
- package/src/models/CustomApiName.ts +83 -0
- package/src/models/CustomApiUpdate.ts +106 -0
- package/src/models/CustomApiUpdateAuth.ts +84 -0
- package/src/models/ErrorDetailItem.ts +5 -0
- package/src/models/ListModels403Response.ts +73 -0
- package/src/models/ModelEndpointView.ts +74 -0
- package/src/models/ModelView.ts +122 -0
- package/src/models/ModelsResponse.ts +74 -0
- package/src/models/SettingsIssueView.ts +84 -0
- package/src/models/VersionCommitBody.ts +84 -0
- package/src/models/VersionUploadUrlBody.ts +66 -0
- package/src/models/index.ts +28 -0
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
/** SettingsTransport: the compose transport on the generated API (agent settings file + responses stream). */
|
|
2
|
+
import { randomUUID } from "node:crypto";
|
|
3
|
+
import { AgentsApi } from "../apis/AgentsApi.js";
|
|
4
|
+
import { ConversationsApi } from "../apis/ConversationsApi.js";
|
|
5
|
+
import { ResponsesApi } from "../apis/ResponsesApi.js";
|
|
6
|
+
import { ResponseError } from "../runtime.js";
|
|
7
|
+
import { answerClarify, reconnect, streamResponse } from "../streaming.js";
|
|
8
|
+
import { NotSupportedByServerError, UserError } from "./errors.js";
|
|
9
|
+
import { fromUiChunk } from "./events.js";
|
|
10
|
+
const PAGE = 100;
|
|
11
|
+
function isNotFound(err) {
|
|
12
|
+
return err instanceof ResponseError && err.response.status === 404;
|
|
13
|
+
}
|
|
14
|
+
/** TurnStream over a streaming ResponseStream; ids are read live from the underlying stream. */
|
|
15
|
+
class Stream {
|
|
16
|
+
constructor(inner, conversationId) {
|
|
17
|
+
this.inner = inner;
|
|
18
|
+
this.conversationId = conversationId;
|
|
19
|
+
}
|
|
20
|
+
get responseId() {
|
|
21
|
+
return this.inner.responseId;
|
|
22
|
+
}
|
|
23
|
+
get lastEventId() {
|
|
24
|
+
return this.inner.lastEventId;
|
|
25
|
+
}
|
|
26
|
+
async *[Symbol.asyncIterator]() {
|
|
27
|
+
for await (const chunk of this.inner) {
|
|
28
|
+
const event = fromUiChunk(chunk);
|
|
29
|
+
if (event !== null)
|
|
30
|
+
yield event;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
close() {
|
|
34
|
+
this.inner.close();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class SettingsTransport {
|
|
38
|
+
constructor(config) {
|
|
39
|
+
this.config = config;
|
|
40
|
+
this.kind = "settings";
|
|
41
|
+
this.agents = new AgentsApi(config);
|
|
42
|
+
this.conversations = new ConversationsApi(config);
|
|
43
|
+
this.responses = new ResponsesApi(config);
|
|
44
|
+
}
|
|
45
|
+
// -- agents ---------------------------------------------------------------------------------------------
|
|
46
|
+
async findAgents(sdkName) {
|
|
47
|
+
var _a;
|
|
48
|
+
const found = [];
|
|
49
|
+
let offset = 0;
|
|
50
|
+
for (;;) {
|
|
51
|
+
const result = await this.agents.listAgents({ q: sdkName, limit: PAGE, offset });
|
|
52
|
+
const items = result.data;
|
|
53
|
+
for (const item of items) {
|
|
54
|
+
if (item.name !== sdkName)
|
|
55
|
+
continue;
|
|
56
|
+
const resource = await this.agents.getAgent({ agentId: item.id });
|
|
57
|
+
const metadata = ((_a = resource.settings) !== null && _a !== void 0 ? _a : {})["metadata"];
|
|
58
|
+
if (metadata && metadata["sdk_name"] === sdkName) {
|
|
59
|
+
found.push(this.remote(resource, await this.instructions(item.id)));
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
offset += items.length;
|
|
63
|
+
if (items.length === 0 || !result.hasMore)
|
|
64
|
+
return found;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
async readAgent(agentId) {
|
|
68
|
+
const resource = await this.agents.getAgent({ agentId });
|
|
69
|
+
return this.remote(resource, await this.instructions(agentId));
|
|
70
|
+
}
|
|
71
|
+
async createAgent(agent) {
|
|
72
|
+
var _a, _b;
|
|
73
|
+
const settings = agent.toSettings();
|
|
74
|
+
let resource;
|
|
75
|
+
try {
|
|
76
|
+
resource = await this.agents.createAgent({
|
|
77
|
+
agentCreate: { name: agent.name, instructions: agent.instructions, settings },
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
// A 422 stored nothing, so there is no agent to delete.
|
|
82
|
+
throw (_a = (await invalidSettings(err))) !== null && _a !== void 0 ? _a : err;
|
|
83
|
+
}
|
|
84
|
+
let envelope;
|
|
85
|
+
let warnings;
|
|
86
|
+
// The create response never echoes settings, so support is read back from the settings route, which 404s
|
|
87
|
+
// when the server has settings switched off (create then silently drops them).
|
|
88
|
+
try {
|
|
89
|
+
try {
|
|
90
|
+
envelope = await this.agents.getAgentSettings({ agentId: resource.id });
|
|
91
|
+
}
|
|
92
|
+
catch (err) {
|
|
93
|
+
if (isNotFound(err))
|
|
94
|
+
throw new NotSupportedByServerError(["settings"]);
|
|
95
|
+
throw err;
|
|
96
|
+
}
|
|
97
|
+
warnings = checkWarnings(envelope, settings);
|
|
98
|
+
checkMetadata(envelope, agent);
|
|
99
|
+
await this.agents.deployAgent({ agentId: resource.id });
|
|
100
|
+
}
|
|
101
|
+
catch (err) {
|
|
102
|
+
// Don't leave an orphan agent behind; a failing cleanup must not mask the original error.
|
|
103
|
+
try {
|
|
104
|
+
await this.agents.deleteAgent({ agentId: resource.id });
|
|
105
|
+
}
|
|
106
|
+
catch (cleanup) {
|
|
107
|
+
console.warn(`could not delete agent ${resource.id} after failed create: ${cleanup}`);
|
|
108
|
+
}
|
|
109
|
+
throw err;
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
agentId: resource.id,
|
|
113
|
+
name: agent.name,
|
|
114
|
+
instructions: agent.instructions,
|
|
115
|
+
settings: { ...((_b = envelope.settings) !== null && _b !== void 0 ? _b : {}) },
|
|
116
|
+
warnings,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
async updateAgent(agentId, agent) {
|
|
120
|
+
var _a, _b;
|
|
121
|
+
const settings = agent.toSettings();
|
|
122
|
+
// findAgents searches by display name, so an adopted (or dashboard-renamed) agent must carry sdk_name.
|
|
123
|
+
if ((await this.agents.getAgent({ agentId })).name !== agent.name) {
|
|
124
|
+
await this.agents.updateAgent({ agentId, agentUpdate: { name: agent.name } });
|
|
125
|
+
}
|
|
126
|
+
// Rejections are only visible after the server stored the settings, so keep what was there to put it back.
|
|
127
|
+
const previousInstructions = await this.instructions(agentId);
|
|
128
|
+
let previousSettings;
|
|
129
|
+
try {
|
|
130
|
+
previousSettings = { ...((_a = (await this.agents.getAgentSettings({ agentId })).settings) !== null && _a !== void 0 ? _a : {}) };
|
|
131
|
+
}
|
|
132
|
+
catch (err) {
|
|
133
|
+
if (isNotFound(err))
|
|
134
|
+
throw new NotSupportedByServerError(["settings"]);
|
|
135
|
+
throw err;
|
|
136
|
+
}
|
|
137
|
+
// Instructions first: the settings carry the new sdk_hash, and a hash written ahead of the instructions it
|
|
138
|
+
// covers would read as an edit made outside the SDK if the instructions write then failed.
|
|
139
|
+
const instructionsChanged = previousInstructions !== agent.instructions;
|
|
140
|
+
if (instructionsChanged) {
|
|
141
|
+
await this.agents.putInstructions({ agentId, instructionsBody: { data: agent.instructions } });
|
|
142
|
+
}
|
|
143
|
+
let envelope;
|
|
144
|
+
try {
|
|
145
|
+
envelope = await this.agents.putAgentSettings({ agentId, body: settings });
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
if (isNotFound(err))
|
|
149
|
+
throw new NotSupportedByServerError(["settings"]);
|
|
150
|
+
const invalid = await invalidSettings(err);
|
|
151
|
+
if (invalid === null)
|
|
152
|
+
throw err;
|
|
153
|
+
// The failed PUT stored nothing; only the instructions need putting back.
|
|
154
|
+
if (instructionsChanged)
|
|
155
|
+
await this.restore(agentId, null, previousInstructions);
|
|
156
|
+
throw invalid;
|
|
157
|
+
}
|
|
158
|
+
let warnings;
|
|
159
|
+
try {
|
|
160
|
+
warnings = checkWarnings(envelope, settings);
|
|
161
|
+
}
|
|
162
|
+
catch (err) {
|
|
163
|
+
if (err instanceof NotSupportedByServerError || err instanceof UserError) {
|
|
164
|
+
await this.restore(agentId, previousSettings, instructionsChanged ? previousInstructions : null);
|
|
165
|
+
}
|
|
166
|
+
throw err;
|
|
167
|
+
}
|
|
168
|
+
checkMetadata(envelope, agent);
|
|
169
|
+
await this.agents.deployAgent({ agentId }); // idempotent; moves an adopted draft to deployed
|
|
170
|
+
return {
|
|
171
|
+
agentId,
|
|
172
|
+
name: agent.name,
|
|
173
|
+
instructions: agent.instructions,
|
|
174
|
+
settings: { ...((_b = envelope.settings) !== null && _b !== void 0 ? _b : {}) },
|
|
175
|
+
warnings,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
async deleteAgent(agentId) {
|
|
179
|
+
await this.agents.deleteAgent({ agentId });
|
|
180
|
+
}
|
|
181
|
+
// -- turns ----------------------------------------------------------------------------------------------
|
|
182
|
+
async startTurn(agentId, conversationId, text, signal) {
|
|
183
|
+
if (conversationId === null) {
|
|
184
|
+
conversationId = (await this.conversations.createConversation({ createConversationBody: { agentId } })).id;
|
|
185
|
+
}
|
|
186
|
+
const body = {
|
|
187
|
+
id: conversationId,
|
|
188
|
+
agentId,
|
|
189
|
+
message: { id: randomUUID(), role: "user", parts: [{ type: "text", text }] },
|
|
190
|
+
};
|
|
191
|
+
return new Stream(await streamResponse(this.config, body, { signal }), conversationId);
|
|
192
|
+
}
|
|
193
|
+
async answerClarify(conversationId, requestId, answers, signal) {
|
|
194
|
+
const inner = await answerClarify(this.config, conversationId, { requestId, answers }, { signal });
|
|
195
|
+
return new Stream(inner, conversationId);
|
|
196
|
+
}
|
|
197
|
+
async resume(conversationId, responseId, lastEventId, signal) {
|
|
198
|
+
const inner = await reconnect(this.config, conversationId, responseId, lastEventId, { signal });
|
|
199
|
+
return new Stream(inner, conversationId);
|
|
200
|
+
}
|
|
201
|
+
async stop(conversationId) {
|
|
202
|
+
await this.responses.stopResponse({ conversationId });
|
|
203
|
+
}
|
|
204
|
+
// -- helpers --------------------------------------------------------------------------------------------
|
|
205
|
+
/** Put back what updateAgent overwrote; a failing restore must not mask the original error. */
|
|
206
|
+
async restore(agentId, settings, instructions) {
|
|
207
|
+
try {
|
|
208
|
+
if (instructions !== null) {
|
|
209
|
+
await this.agents.putInstructions({ agentId, instructionsBody: { data: instructions } });
|
|
210
|
+
}
|
|
211
|
+
if (settings !== null)
|
|
212
|
+
await this.agents.putAgentSettings({ agentId, body: settings });
|
|
213
|
+
}
|
|
214
|
+
catch (err) {
|
|
215
|
+
console.warn(`could not restore agent ${agentId} after rejected settings: ${err}`);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
async instructions(agentId) {
|
|
219
|
+
return (await this.agents.getInstructions({ agentId })).data;
|
|
220
|
+
}
|
|
221
|
+
remote(resource, instructions) {
|
|
222
|
+
var _a;
|
|
223
|
+
return { agentId: resource.id, name: resource.name, instructions, settings: { ...((_a = resource.settings) !== null && _a !== void 0 ? _a : {}) }, warnings: [] };
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
/** The server's 422 CHAT_VALIDATION / invalid_agent_settings rejection as a UserError, else null. */
|
|
227
|
+
async function invalidSettings(err) {
|
|
228
|
+
if (!(err instanceof ResponseError) || err.response.status !== 422)
|
|
229
|
+
return null;
|
|
230
|
+
try {
|
|
231
|
+
const error = (await err.response.clone().json()).error;
|
|
232
|
+
const details = error.details.filter((d) => d && d.code === "invalid_agent_settings");
|
|
233
|
+
if (details.length === 0)
|
|
234
|
+
return null;
|
|
235
|
+
const issues = details.flatMap((d) => { var _a; return ((_a = d.issues) !== null && _a !== void 0 ? _a : []); }).map((i) => ({
|
|
236
|
+
code: i.code, path: i.path, message: i.message,
|
|
237
|
+
}));
|
|
238
|
+
return new UserError(String(error.message || "the server rejected the agent settings"), issues);
|
|
239
|
+
}
|
|
240
|
+
catch (_a) {
|
|
241
|
+
return null;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
/** findAgents() matches on metadata.sdk_name; a server that drops it would get a new agent per deploy. */
|
|
245
|
+
function checkMetadata(envelope, agent) {
|
|
246
|
+
var _a;
|
|
247
|
+
const metadata = ((_a = envelope.settings) !== null && _a !== void 0 ? _a : {})["metadata"];
|
|
248
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata) || metadata["sdk_name"] !== agent.name) {
|
|
249
|
+
throw new NotSupportedByServerError(["metadata"]);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
function checkWarnings(envelope, sent) {
|
|
253
|
+
var _a;
|
|
254
|
+
const warnings = [];
|
|
255
|
+
const rejected = [];
|
|
256
|
+
const unsupported = [];
|
|
257
|
+
for (const w of (_a = envelope.warnings) !== null && _a !== void 0 ? _a : []) {
|
|
258
|
+
const item = { code: w.code, path: w.path, message: w.message };
|
|
259
|
+
warnings.push(item);
|
|
260
|
+
if (item.code === "unknown_key" && Object.prototype.hasOwnProperty.call(sent, item.path) && item.path !== "metadata") {
|
|
261
|
+
if (rejected.indexOf(item.path) === -1)
|
|
262
|
+
rejected.push(item.path);
|
|
263
|
+
}
|
|
264
|
+
else if (item.code === "reasoning_unsupported") {
|
|
265
|
+
unsupported.push(String(item.message || "reasoning is not supported by the model"));
|
|
266
|
+
}
|
|
267
|
+
else if (!(item.code === "unknown_key" && item.path === "metadata")) {
|
|
268
|
+
console.warn(`agent settings warning ${item.code} at ${item.path}: ${item.message}`);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (rejected.length)
|
|
272
|
+
throw new NotSupportedByServerError(rejected.sort());
|
|
273
|
+
if (unsupported.length)
|
|
274
|
+
throw new UserError(unsupported.join("; "));
|
|
275
|
+
return warnings;
|
|
276
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Built-in (server-side) tools. Listing a tool enables it; unlisted tools keep the server default. */
|
|
2
|
+
export interface BuiltinTool {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly options?: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export declare function webSearchTool(opts?: {
|
|
7
|
+
filters?: {
|
|
8
|
+
allowedDomains?: string[] | null;
|
|
9
|
+
};
|
|
10
|
+
blockedDomains?: string[];
|
|
11
|
+
}): BuiltinTool;
|
|
12
|
+
export declare const sandbox: () => BuiltinTool;
|
|
13
|
+
export declare const codeMode: () => BuiltinTool;
|
|
14
|
+
export declare const todo: () => BuiltinTool;
|
|
15
|
+
export declare const schedules: () => BuiltinTool;
|
|
16
|
+
export declare const clarify: () => BuiltinTool;
|
|
17
|
+
export declare const subagents: () => BuiltinTool;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Built-in (server-side) tools. Listing a tool enables it; unlisted tools keep the server default. */
|
|
2
|
+
export function webSearchTool(opts = {}) {
|
|
3
|
+
var _a;
|
|
4
|
+
const options = {};
|
|
5
|
+
const allowed = (_a = opts.filters) === null || _a === void 0 ? void 0 : _a.allowedDomains;
|
|
6
|
+
if (allowed !== undefined && allowed !== null)
|
|
7
|
+
options["allowed_domains"] = allowed.slice();
|
|
8
|
+
if (opts.blockedDomains !== undefined)
|
|
9
|
+
options["blocked_domains"] = opts.blockedDomains.slice();
|
|
10
|
+
const tool = Object.keys(options).length > 0 ? { name: "web_search", options } : { name: "web_search" };
|
|
11
|
+
return tool;
|
|
12
|
+
}
|
|
13
|
+
const simple = (name) => ({ name });
|
|
14
|
+
export const sandbox = () => simple("sandbox");
|
|
15
|
+
export const codeMode = () => simple("code_mode");
|
|
16
|
+
export const todo = () => simple("todo");
|
|
17
|
+
export const schedules = () => simple("schedules");
|
|
18
|
+
export const clarify = () => simple("clarify");
|
|
19
|
+
export const subagents = () => simple("subagents");
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Transport interface: the seam between the compose layer and the server. */
|
|
2
|
+
import type { Agent } from "./agent.js";
|
|
3
|
+
import type { Event } from "./events.js";
|
|
4
|
+
export interface SettingsWarning {
|
|
5
|
+
code: string;
|
|
6
|
+
path: string;
|
|
7
|
+
message: string;
|
|
8
|
+
}
|
|
9
|
+
export interface RemoteAgent {
|
|
10
|
+
agentId: string;
|
|
11
|
+
name: string;
|
|
12
|
+
instructions: string;
|
|
13
|
+
settings: Record<string, unknown>;
|
|
14
|
+
warnings: SettingsWarning[];
|
|
15
|
+
}
|
|
16
|
+
/** Async iterable of Events; the ids are filled in as the stream progresses. */
|
|
17
|
+
export interface TurnStream extends AsyncIterable<Event> {
|
|
18
|
+
readonly conversationId: string | null;
|
|
19
|
+
readonly responseId: string | null;
|
|
20
|
+
readonly lastEventId: string | null;
|
|
21
|
+
close(): void;
|
|
22
|
+
}
|
|
23
|
+
export interface Transport {
|
|
24
|
+
readonly kind: "settings";
|
|
25
|
+
findAgents(sdkName: string): Promise<RemoteAgent[]>;
|
|
26
|
+
readAgent(agentId: string): Promise<RemoteAgent>;
|
|
27
|
+
createAgent(agent: Agent): Promise<RemoteAgent>;
|
|
28
|
+
updateAgent(agentId: string, agent: Agent): Promise<RemoteAgent>;
|
|
29
|
+
deleteAgent(agentId: string): Promise<void>;
|
|
30
|
+
startTurn(agentId: string, conversationId: string | null, text: string, signal?: AbortSignal): Promise<TurnStream>;
|
|
31
|
+
answerClarify(conversationId: string, requestId: string, answers: Record<string, unknown>, signal?: AbortSignal): Promise<TurnStream>;
|
|
32
|
+
resume(conversationId: string, responseId: string, lastEventId: string | null, signal?: AbortSignal): Promise<TurnStream>;
|
|
33
|
+
stop(conversationId: string): Promise<void>;
|
|
34
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -49,6 +49,7 @@ export declare const AgentChannelRefTypeEnum: {
|
|
|
49
49
|
readonly Slack: "slack";
|
|
50
50
|
readonly Whatsapp: "whatsapp";
|
|
51
51
|
readonly Cli: "cli";
|
|
52
|
+
readonly Teams: "teams";
|
|
52
53
|
};
|
|
53
54
|
export type AgentChannelRefTypeEnum = typeof AgentChannelRefTypeEnum[keyof typeof AgentChannelRefTypeEnum];
|
|
54
55
|
/**
|
|
@@ -136,16 +136,29 @@ export interface AgentConversationDetail {
|
|
|
136
136
|
queuedTurns?: Array<QueuedTurnView>;
|
|
137
137
|
/**
|
|
138
138
|
*
|
|
139
|
-
* @type {
|
|
139
|
+
* @type {boolean}
|
|
140
140
|
* @memberof AgentConversationDetail
|
|
141
141
|
*/
|
|
142
|
-
|
|
142
|
+
isMine?: boolean;
|
|
143
143
|
/**
|
|
144
144
|
*
|
|
145
145
|
* @type {string}
|
|
146
146
|
* @memberof AgentConversationDetail
|
|
147
147
|
*/
|
|
148
148
|
panjaWsId: string | null;
|
|
149
|
+
/**
|
|
150
|
+
*
|
|
151
|
+
* @type {boolean}
|
|
152
|
+
* @memberof AgentConversationDetail
|
|
153
|
+
*/
|
|
154
|
+
readOnly?: boolean;
|
|
155
|
+
/**
|
|
156
|
+
* Deprecated: the server no longer sends this field, so it is always undefined. Use isMine.
|
|
157
|
+
* @type {string}
|
|
158
|
+
* @memberof AgentConversationDetail
|
|
159
|
+
* @deprecated
|
|
160
|
+
*/
|
|
161
|
+
panjaUserId?: string;
|
|
149
162
|
}
|
|
150
163
|
/**
|
|
151
164
|
* Check if a given object implements the AgentConversationDetail interface.
|
|
@@ -48,8 +48,6 @@ export function instanceOfAgentConversationDetail(value) {
|
|
|
48
48
|
return false;
|
|
49
49
|
if (!('lastEventId' in value) || value['lastEventId'] === undefined)
|
|
50
50
|
return false;
|
|
51
|
-
if (!('panjaUserId' in value) || value['panjaUserId'] === undefined)
|
|
52
|
-
return false;
|
|
53
51
|
if (!('panjaWsId' in value) || value['panjaWsId'] === undefined)
|
|
54
52
|
return false;
|
|
55
53
|
return true;
|
|
@@ -81,8 +79,10 @@ export function AgentConversationDetailFromJSONTyped(json, ignoreDiscriminator)
|
|
|
81
79
|
'hasMore': json['hasMore'] == null ? undefined : json['hasMore'],
|
|
82
80
|
'nextBeforeCursor': json['nextBeforeCursor'] == null ? undefined : json['nextBeforeCursor'],
|
|
83
81
|
'queuedTurns': json['queuedTurns'] == null ? undefined : (json['queuedTurns'].map(QueuedTurnViewFromJSON)),
|
|
84
|
-
'
|
|
82
|
+
'isMine': json['isMine'] == null ? undefined : json['isMine'],
|
|
85
83
|
'panjaWsId': json['panjaWsId'],
|
|
84
|
+
'readOnly': json['readOnly'] == null ? undefined : json['readOnly'],
|
|
85
|
+
'panjaUserId': json['panjaUserId'] == null ? undefined : json['panjaUserId'],
|
|
86
86
|
};
|
|
87
87
|
}
|
|
88
88
|
export function AgentConversationDetailToJSON(json) {
|
|
@@ -112,7 +112,9 @@ export function AgentConversationDetailToJSONTyped(value, ignoreDiscriminator =
|
|
|
112
112
|
'hasMore': value['hasMore'],
|
|
113
113
|
'nextBeforeCursor': value['nextBeforeCursor'],
|
|
114
114
|
'queuedTurns': value['queuedTurns'] == null ? undefined : (value['queuedTurns'].map(QueuedTurnViewToJSON)),
|
|
115
|
-
'
|
|
115
|
+
'isMine': value['isMine'],
|
|
116
116
|
'panjaWsId': value['panjaWsId'],
|
|
117
|
+
'readOnly': value['readOnly'],
|
|
118
|
+
'panjaUserId': value['panjaUserId'],
|
|
117
119
|
};
|
|
118
120
|
}
|
|
@@ -11,9 +11,8 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import type { FieldHighlight } from './FieldHighlight.js';
|
|
13
13
|
/**
|
|
14
|
-
* One session-log row: the inbox view
|
|
15
|
-
*
|
|
16
|
-
* table ever needs them.
|
|
14
|
+
* One session-log row: the inbox view, anonymised (see module doc), plus
|
|
15
|
+
* whether it is the caller's own and which workspace it lives in.
|
|
17
16
|
* @export
|
|
18
17
|
* @interface AgentConversationView
|
|
19
18
|
*/
|
|
@@ -106,16 +105,23 @@ export interface AgentConversationView {
|
|
|
106
105
|
highlight?: Array<FieldHighlight>;
|
|
107
106
|
/**
|
|
108
107
|
*
|
|
109
|
-
* @type {
|
|
108
|
+
* @type {boolean}
|
|
110
109
|
* @memberof AgentConversationView
|
|
111
110
|
*/
|
|
112
|
-
|
|
111
|
+
isMine?: boolean;
|
|
113
112
|
/**
|
|
114
113
|
*
|
|
115
114
|
* @type {string}
|
|
116
115
|
* @memberof AgentConversationView
|
|
117
116
|
*/
|
|
118
117
|
panjaWsId: string | null;
|
|
118
|
+
/**
|
|
119
|
+
* Deprecated: the server no longer sends this field, so it is always undefined. Use isMine.
|
|
120
|
+
* @type {string}
|
|
121
|
+
* @memberof AgentConversationView
|
|
122
|
+
* @deprecated
|
|
123
|
+
*/
|
|
124
|
+
panjaUserId?: string;
|
|
119
125
|
}
|
|
120
126
|
/**
|
|
121
127
|
* Check if a given object implements the AgentConversationView interface.
|
|
@@ -42,8 +42,6 @@ export function instanceOfAgentConversationView(value) {
|
|
|
42
42
|
return false;
|
|
43
43
|
if (!('createdAt' in value) || value['createdAt'] === undefined)
|
|
44
44
|
return false;
|
|
45
|
-
if (!('panjaUserId' in value) || value['panjaUserId'] === undefined)
|
|
46
|
-
return false;
|
|
47
45
|
if (!('panjaWsId' in value) || value['panjaWsId'] === undefined)
|
|
48
46
|
return false;
|
|
49
47
|
return true;
|
|
@@ -70,8 +68,9 @@ export function AgentConversationViewFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
70
68
|
'lastReadAt': (json['lastReadAt'] == null ? null : new Date(json['lastReadAt'])),
|
|
71
69
|
'createdAt': (new Date(json['createdAt'])),
|
|
72
70
|
'highlight': json['highlight'] == null ? undefined : (json['highlight'].map(FieldHighlightFromJSON)),
|
|
73
|
-
'
|
|
71
|
+
'isMine': json['isMine'] == null ? undefined : json['isMine'],
|
|
74
72
|
'panjaWsId': json['panjaWsId'],
|
|
73
|
+
'panjaUserId': json['panjaUserId'] == null ? undefined : json['panjaUserId'],
|
|
75
74
|
};
|
|
76
75
|
}
|
|
77
76
|
export function AgentConversationViewToJSON(json) {
|
|
@@ -96,7 +95,8 @@ export function AgentConversationViewToJSONTyped(value, ignoreDiscriminator = fa
|
|
|
96
95
|
'lastReadAt': (value['lastReadAt'] == null ? null : value['lastReadAt'].toISOString()),
|
|
97
96
|
'createdAt': ((value['createdAt']).toISOString()),
|
|
98
97
|
'highlight': value['highlight'] == null ? undefined : (value['highlight'].map(FieldHighlightToJSON)),
|
|
99
|
-
'
|
|
98
|
+
'isMine': value['isMine'],
|
|
100
99
|
'panjaWsId': value['panjaWsId'],
|
|
100
|
+
'panjaUserId': value['panjaUserId'],
|
|
101
101
|
};
|
|
102
102
|
}
|
|
@@ -49,6 +49,14 @@ export interface AgentCreate {
|
|
|
49
49
|
llmConfig?: {
|
|
50
50
|
[key: string]: any;
|
|
51
51
|
} | null;
|
|
52
|
+
/**
|
|
53
|
+
*
|
|
54
|
+
* @type {{ [key: string]: any; }}
|
|
55
|
+
* @memberof AgentCreate
|
|
56
|
+
*/
|
|
57
|
+
settings?: {
|
|
58
|
+
[key: string]: any;
|
|
59
|
+
} | null;
|
|
52
60
|
}
|
|
53
61
|
/**
|
|
54
62
|
* Check if a given object implements the AgentCreate interface.
|
|
@@ -30,6 +30,7 @@ export function AgentCreateFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
30
30
|
'instructions': json['instructions'] == null ? undefined : json['instructions'],
|
|
31
31
|
'appearance': json['appearance'] == null ? undefined : json['appearance'],
|
|
32
32
|
'llmConfig': json['llmConfig'] == null ? undefined : json['llmConfig'],
|
|
33
|
+
'settings': json['settings'] == null ? undefined : json['settings'],
|
|
33
34
|
};
|
|
34
35
|
}
|
|
35
36
|
export function AgentCreateToJSON(json) {
|
|
@@ -45,5 +46,6 @@ export function AgentCreateToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
45
46
|
'instructions': value['instructions'],
|
|
46
47
|
'appearance': value['appearance'],
|
|
47
48
|
'llmConfig': value['llmConfig'],
|
|
49
|
+
'settings': value['settings'],
|
|
48
50
|
};
|
|
49
51
|
}
|
|
@@ -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
|
+
import type { CustomApiName } from './CustomApiName.js';
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* @export
|
|
16
|
+
* @interface AgentCustomApiList
|
|
17
|
+
*/
|
|
18
|
+
export interface AgentCustomApiList {
|
|
19
|
+
/**
|
|
20
|
+
*
|
|
21
|
+
* @type {Array<CustomApiName>}
|
|
22
|
+
* @memberof AgentCustomApiList
|
|
23
|
+
*/
|
|
24
|
+
data: Array<CustomApiName>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Check if a given object implements the AgentCustomApiList interface.
|
|
28
|
+
*/
|
|
29
|
+
export declare function instanceOfAgentCustomApiList(value: object): value is AgentCustomApiList;
|
|
30
|
+
export declare function AgentCustomApiListFromJSON(json: any): AgentCustomApiList;
|
|
31
|
+
export declare function AgentCustomApiListFromJSONTyped(json: any, ignoreDiscriminator: boolean): AgentCustomApiList;
|
|
32
|
+
export declare function AgentCustomApiListToJSON(json: any): AgentCustomApiList;
|
|
33
|
+
export declare function AgentCustomApiListToJSONTyped(value?: AgentCustomApiList | null, ignoreDiscriminator?: boolean): any;
|
|
@@ -0,0 +1,44 @@
|
|
|
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 { CustomApiNameFromJSON, CustomApiNameToJSON, } from './CustomApiName.js';
|
|
15
|
+
/**
|
|
16
|
+
* Check if a given object implements the AgentCustomApiList interface.
|
|
17
|
+
*/
|
|
18
|
+
export function instanceOfAgentCustomApiList(value) {
|
|
19
|
+
if (!('data' in value) || value['data'] === undefined)
|
|
20
|
+
return false;
|
|
21
|
+
return true;
|
|
22
|
+
}
|
|
23
|
+
export function AgentCustomApiListFromJSON(json) {
|
|
24
|
+
return AgentCustomApiListFromJSONTyped(json, false);
|
|
25
|
+
}
|
|
26
|
+
export function AgentCustomApiListFromJSONTyped(json, ignoreDiscriminator) {
|
|
27
|
+
if (json == null) {
|
|
28
|
+
return json;
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
'data': (json['data'].map(CustomApiNameFromJSON)),
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
export function AgentCustomApiListToJSON(json) {
|
|
35
|
+
return AgentCustomApiListToJSONTyped(json, false);
|
|
36
|
+
}
|
|
37
|
+
export function AgentCustomApiListToJSONTyped(value, ignoreDiscriminator = false) {
|
|
38
|
+
if (value == null) {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
'data': (value['data'].map(CustomApiNameToJSON)),
|
|
43
|
+
};
|
|
44
|
+
}
|
|
@@ -105,6 +105,12 @@ export interface AgentResource {
|
|
|
105
105
|
* @memberof AgentResource
|
|
106
106
|
*/
|
|
107
107
|
deployState?: AgentResourceDeployStateEnum | null;
|
|
108
|
+
/**
|
|
109
|
+
*
|
|
110
|
+
* @type {Date}
|
|
111
|
+
* @memberof AgentResource
|
|
112
|
+
*/
|
|
113
|
+
deployedAt?: Date | null;
|
|
108
114
|
/**
|
|
109
115
|
*
|
|
110
116
|
* @type {string}
|
|
@@ -117,6 +123,14 @@ export interface AgentResource {
|
|
|
117
123
|
* @memberof AgentResource
|
|
118
124
|
*/
|
|
119
125
|
isDefault?: boolean;
|
|
126
|
+
/**
|
|
127
|
+
*
|
|
128
|
+
* @type {{ [key: string]: any; }}
|
|
129
|
+
* @memberof AgentResource
|
|
130
|
+
*/
|
|
131
|
+
settings?: {
|
|
132
|
+
[key: string]: any;
|
|
133
|
+
} | null;
|
|
120
134
|
/**
|
|
121
135
|
*
|
|
122
136
|
* @type {number}
|
|
@@ -79,8 +79,10 @@ export function AgentResourceFromJSONTyped(json, ignoreDiscriminator) {
|
|
|
79
79
|
'highlight': json['highlight'] == null ? undefined : (json['highlight'].map(FieldHighlightFromJSON)),
|
|
80
80
|
'agentTypes': json['agentTypes'] == null ? undefined : json['agentTypes'],
|
|
81
81
|
'deployState': json['deployState'] == null ? undefined : json['deployState'],
|
|
82
|
+
'deployedAt': json['deployedAt'] == null ? undefined : (new Date(json['deployedAt'])),
|
|
82
83
|
'clonedFromAgentId': json['clonedFromAgentId'] == null ? undefined : json['clonedFromAgentId'],
|
|
83
84
|
'isDefault': json['isDefault'] == null ? undefined : json['isDefault'],
|
|
85
|
+
'settings': json['settings'] == null ? undefined : json['settings'],
|
|
84
86
|
'interactionCount': json['interactionCount'] == null ? undefined : json['interactionCount'],
|
|
85
87
|
'slackChannelName': json['slackChannelName'] == null ? undefined : json['slackChannelName'],
|
|
86
88
|
'slackUrl': json['slackUrl'] == null ? undefined : json['slackUrl'],
|
|
@@ -113,8 +115,10 @@ export function AgentResourceToJSONTyped(value, ignoreDiscriminator = false) {
|
|
|
113
115
|
'highlight': value['highlight'] == null ? undefined : (value['highlight'].map(FieldHighlightToJSON)),
|
|
114
116
|
'agentTypes': value['agentTypes'],
|
|
115
117
|
'deployState': value['deployState'],
|
|
118
|
+
'deployedAt': value['deployedAt'] == null ? undefined : (value['deployedAt'].toISOString()),
|
|
116
119
|
'clonedFromAgentId': value['clonedFromAgentId'],
|
|
117
120
|
'isDefault': value['isDefault'],
|
|
121
|
+
'settings': value['settings'],
|
|
118
122
|
'interactionCount': value['interactionCount'],
|
|
119
123
|
'slackChannelName': value['slackChannelName'],
|
|
120
124
|
'slackUrl': value['slackUrl'],
|