sarvam-agents-client 0.1.2 → 0.2.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 +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 +44 -0
- package/dist/compose/agent.js +222 -0
- package/dist/compose/builtins.d.ts +4 -0
- package/dist/compose/builtins.js +22 -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 +44 -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 +44 -0
- package/dist/esm/compose/agent.js +218 -0
- package/dist/esm/compose/builtins.d.ts +4 -0
- package/dist/esm/compose/builtins.js +18 -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 +34 -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 +254 -0
- package/src/compose/builtins.ts +19 -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 +42 -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,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RunState = void 0;
|
|
4
|
+
const errors_js_1 = require("./errors.js");
|
|
5
|
+
const STATE_VERSION = 1;
|
|
6
|
+
function isObject(v) {
|
|
7
|
+
return typeof v === "object" && v !== null && !Array.isArray(v);
|
|
8
|
+
}
|
|
9
|
+
class RunState {
|
|
10
|
+
/** @internal Use `result.state` or `RunState.fromString`. */
|
|
11
|
+
constructor(conversationId, pending, answers = {}, transportKind = "settings") {
|
|
12
|
+
this.conversationId = conversationId;
|
|
13
|
+
this.pending = pending;
|
|
14
|
+
this.answers = answers;
|
|
15
|
+
this.transportKind = transportKind;
|
|
16
|
+
}
|
|
17
|
+
/** Record the answers to a pending interruption; `run(agent, state)` sends them. */
|
|
18
|
+
answer(item, answers) {
|
|
19
|
+
if (!this.pending.some((p) => p.requestId === item.requestId)) {
|
|
20
|
+
throw new errors_js_1.UserError(`no pending item with request id "${item.requestId}"`);
|
|
21
|
+
}
|
|
22
|
+
this.answers[item.requestId] = { ...answers };
|
|
23
|
+
}
|
|
24
|
+
/** JSON in the format Python's `RunState.to_json()` writes. */
|
|
25
|
+
toString() {
|
|
26
|
+
return JSON.stringify({
|
|
27
|
+
version: STATE_VERSION,
|
|
28
|
+
transport_kind: this.transportKind,
|
|
29
|
+
conversation_id: this.conversationId,
|
|
30
|
+
pending: this.pending.map((p) => ({ kind: p.kind, request_id: p.requestId, payload: p.payload })),
|
|
31
|
+
answers: this.answers,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
/** Read a state written by `toString()` (or by Python's `to_json()`). */
|
|
35
|
+
static async fromString(agent, s) {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
void agent; // accepted for @openai/agents parity; the state holds no agent definition
|
|
38
|
+
let data;
|
|
39
|
+
try {
|
|
40
|
+
data = JSON.parse(s);
|
|
41
|
+
}
|
|
42
|
+
catch (err) {
|
|
43
|
+
throw new errors_js_1.UserError(`run state is not valid JSON: ${err.message}`);
|
|
44
|
+
}
|
|
45
|
+
if (!isObject(data) || data["version"] !== STATE_VERSION) {
|
|
46
|
+
const version = isObject(data) ? JSON.stringify(data["version"]) : "none";
|
|
47
|
+
throw new errors_js_1.UserError(`unsupported run state version: ${version}`);
|
|
48
|
+
}
|
|
49
|
+
const conversationId = data["conversation_id"];
|
|
50
|
+
if (typeof conversationId !== "string" || conversationId === "") {
|
|
51
|
+
throw new errors_js_1.UserError("run state is missing conversation_id");
|
|
52
|
+
}
|
|
53
|
+
const rawPending = (_a = data["pending"]) !== null && _a !== void 0 ? _a : [];
|
|
54
|
+
if (!Array.isArray(rawPending))
|
|
55
|
+
throw new errors_js_1.UserError("run state pending must be a list");
|
|
56
|
+
const pending = rawPending.map((p) => {
|
|
57
|
+
if (!isObject(p) || typeof p["kind"] !== "string")
|
|
58
|
+
throw new errors_js_1.UserError("run state pending item is missing kind");
|
|
59
|
+
if (typeof p["request_id"] !== "string")
|
|
60
|
+
throw new errors_js_1.UserError("run state pending item is missing request_id");
|
|
61
|
+
const payload = isObject(p["payload"]) ? p["payload"] : {};
|
|
62
|
+
// Other kinds are kept as read; run() refuses them with NotSupportedError, as Python does.
|
|
63
|
+
return { kind: p["kind"], requestId: p["request_id"], payload };
|
|
64
|
+
});
|
|
65
|
+
const rawAnswers = (_b = data["answers"]) !== null && _b !== void 0 ? _b : {};
|
|
66
|
+
if (!isObject(rawAnswers))
|
|
67
|
+
throw new errors_js_1.UserError("run state answers must be an object");
|
|
68
|
+
const answers = {};
|
|
69
|
+
for (const key of Object.keys(rawAnswers)) {
|
|
70
|
+
const value = rawAnswers[key];
|
|
71
|
+
if (!isObject(value))
|
|
72
|
+
throw new errors_js_1.UserError(`run state answers for "${key}" must be an object`);
|
|
73
|
+
answers[key] = { ...value };
|
|
74
|
+
}
|
|
75
|
+
const transportKind = typeof data["transport_kind"] === "string" ? data["transport_kind"] : "settings";
|
|
76
|
+
return new RunState(conversationId, pending, answers, transportKind);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.RunState = RunState;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Configuration } from "../runtime.js";
|
|
2
|
+
import type { Agent } from "./agent.js";
|
|
3
|
+
import type { RemoteAgent, Transport, TurnStream } from "./transport.js";
|
|
4
|
+
export declare class SettingsTransport implements Transport {
|
|
5
|
+
private readonly config;
|
|
6
|
+
readonly kind: "settings";
|
|
7
|
+
private readonly agents;
|
|
8
|
+
private readonly conversations;
|
|
9
|
+
private readonly responses;
|
|
10
|
+
constructor(config: Configuration);
|
|
11
|
+
findAgents(sdkName: string): Promise<RemoteAgent[]>;
|
|
12
|
+
readAgent(agentId: string): Promise<RemoteAgent>;
|
|
13
|
+
createAgent(agent: Agent): Promise<RemoteAgent>;
|
|
14
|
+
updateAgent(agentId: string, agent: Agent): Promise<RemoteAgent>;
|
|
15
|
+
deleteAgent(agentId: string): Promise<void>;
|
|
16
|
+
startTurn(agentId: string, conversationId: string | null, text: string, signal?: AbortSignal): Promise<TurnStream>;
|
|
17
|
+
answerClarify(conversationId: string, requestId: string, answers: Record<string, unknown>, signal?: AbortSignal): Promise<TurnStream>;
|
|
18
|
+
resume(conversationId: string, responseId: string, lastEventId: string | null, signal?: AbortSignal): Promise<TurnStream>;
|
|
19
|
+
stop(conversationId: string): Promise<void>;
|
|
20
|
+
/** Put back what updateAgent overwrote; a failing restore must not mask the original error. */
|
|
21
|
+
private restore;
|
|
22
|
+
private instructions;
|
|
23
|
+
private remote;
|
|
24
|
+
}
|
|
@@ -0,0 +1,280 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SettingsTransport = void 0;
|
|
4
|
+
/** SettingsTransport: the compose transport on the generated API (agent settings file + responses stream). */
|
|
5
|
+
const node_crypto_1 = require("node:crypto");
|
|
6
|
+
const AgentsApi_js_1 = require("../apis/AgentsApi.js");
|
|
7
|
+
const ConversationsApi_js_1 = require("../apis/ConversationsApi.js");
|
|
8
|
+
const ResponsesApi_js_1 = require("../apis/ResponsesApi.js");
|
|
9
|
+
const runtime_js_1 = require("../runtime.js");
|
|
10
|
+
const streaming_js_1 = require("../streaming.js");
|
|
11
|
+
const errors_js_1 = require("./errors.js");
|
|
12
|
+
const events_js_1 = require("./events.js");
|
|
13
|
+
const PAGE = 100;
|
|
14
|
+
function isNotFound(err) {
|
|
15
|
+
return err instanceof runtime_js_1.ResponseError && err.response.status === 404;
|
|
16
|
+
}
|
|
17
|
+
/** TurnStream over a streaming ResponseStream; ids are read live from the underlying stream. */
|
|
18
|
+
class Stream {
|
|
19
|
+
constructor(inner, conversationId) {
|
|
20
|
+
this.inner = inner;
|
|
21
|
+
this.conversationId = conversationId;
|
|
22
|
+
}
|
|
23
|
+
get responseId() {
|
|
24
|
+
return this.inner.responseId;
|
|
25
|
+
}
|
|
26
|
+
get lastEventId() {
|
|
27
|
+
return this.inner.lastEventId;
|
|
28
|
+
}
|
|
29
|
+
async *[Symbol.asyncIterator]() {
|
|
30
|
+
for await (const chunk of this.inner) {
|
|
31
|
+
const event = (0, events_js_1.fromUiChunk)(chunk);
|
|
32
|
+
if (event !== null)
|
|
33
|
+
yield event;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
close() {
|
|
37
|
+
this.inner.close();
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
class SettingsTransport {
|
|
41
|
+
constructor(config) {
|
|
42
|
+
this.config = config;
|
|
43
|
+
this.kind = "settings";
|
|
44
|
+
this.agents = new AgentsApi_js_1.AgentsApi(config);
|
|
45
|
+
this.conversations = new ConversationsApi_js_1.ConversationsApi(config);
|
|
46
|
+
this.responses = new ResponsesApi_js_1.ResponsesApi(config);
|
|
47
|
+
}
|
|
48
|
+
// -- agents ---------------------------------------------------------------------------------------------
|
|
49
|
+
async findAgents(sdkName) {
|
|
50
|
+
var _a;
|
|
51
|
+
const found = [];
|
|
52
|
+
let offset = 0;
|
|
53
|
+
for (;;) {
|
|
54
|
+
const result = await this.agents.listAgents({ q: sdkName, limit: PAGE, offset });
|
|
55
|
+
const items = result.data;
|
|
56
|
+
for (const item of items) {
|
|
57
|
+
if (item.name !== sdkName)
|
|
58
|
+
continue;
|
|
59
|
+
const resource = await this.agents.getAgent({ agentId: item.id });
|
|
60
|
+
const metadata = ((_a = resource.settings) !== null && _a !== void 0 ? _a : {})["metadata"];
|
|
61
|
+
if (metadata && metadata["sdk_name"] === sdkName) {
|
|
62
|
+
found.push(this.remote(resource, await this.instructions(item.id)));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
offset += items.length;
|
|
66
|
+
if (items.length === 0 || !result.hasMore)
|
|
67
|
+
return found;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async readAgent(agentId) {
|
|
71
|
+
const resource = await this.agents.getAgent({ agentId });
|
|
72
|
+
return this.remote(resource, await this.instructions(agentId));
|
|
73
|
+
}
|
|
74
|
+
async createAgent(agent) {
|
|
75
|
+
var _a, _b;
|
|
76
|
+
const settings = agent.toSettings();
|
|
77
|
+
let resource;
|
|
78
|
+
try {
|
|
79
|
+
resource = await this.agents.createAgent({
|
|
80
|
+
agentCreate: { name: agent.name, instructions: agent.instructions, settings },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
catch (err) {
|
|
84
|
+
// A 422 stored nothing, so there is no agent to delete.
|
|
85
|
+
throw (_a = (await invalidSettings(err))) !== null && _a !== void 0 ? _a : err;
|
|
86
|
+
}
|
|
87
|
+
let envelope;
|
|
88
|
+
let warnings;
|
|
89
|
+
// The create response never echoes settings, so support is read back from the settings route, which 404s
|
|
90
|
+
// when the server has settings switched off (create then silently drops them).
|
|
91
|
+
try {
|
|
92
|
+
try {
|
|
93
|
+
envelope = await this.agents.getAgentSettings({ agentId: resource.id });
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
if (isNotFound(err))
|
|
97
|
+
throw new errors_js_1.NotSupportedByServerError(["settings"]);
|
|
98
|
+
throw err;
|
|
99
|
+
}
|
|
100
|
+
warnings = checkWarnings(envelope, settings);
|
|
101
|
+
checkMetadata(envelope, agent);
|
|
102
|
+
await this.agents.deployAgent({ agentId: resource.id });
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
// Don't leave an orphan agent behind; a failing cleanup must not mask the original error.
|
|
106
|
+
try {
|
|
107
|
+
await this.agents.deleteAgent({ agentId: resource.id });
|
|
108
|
+
}
|
|
109
|
+
catch (cleanup) {
|
|
110
|
+
console.warn(`could not delete agent ${resource.id} after failed create: ${cleanup}`);
|
|
111
|
+
}
|
|
112
|
+
throw err;
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
agentId: resource.id,
|
|
116
|
+
name: agent.name,
|
|
117
|
+
instructions: agent.instructions,
|
|
118
|
+
settings: { ...((_b = envelope.settings) !== null && _b !== void 0 ? _b : {}) },
|
|
119
|
+
warnings,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
async updateAgent(agentId, agent) {
|
|
123
|
+
var _a, _b;
|
|
124
|
+
const settings = agent.toSettings();
|
|
125
|
+
// findAgents searches by display name, so an adopted (or dashboard-renamed) agent must carry sdk_name.
|
|
126
|
+
if ((await this.agents.getAgent({ agentId })).name !== agent.name) {
|
|
127
|
+
await this.agents.updateAgent({ agentId, agentUpdate: { name: agent.name } });
|
|
128
|
+
}
|
|
129
|
+
// Rejections are only visible after the server stored the settings, so keep what was there to put it back.
|
|
130
|
+
const previousInstructions = await this.instructions(agentId);
|
|
131
|
+
let previousSettings;
|
|
132
|
+
try {
|
|
133
|
+
previousSettings = { ...((_a = (await this.agents.getAgentSettings({ agentId })).settings) !== null && _a !== void 0 ? _a : {}) };
|
|
134
|
+
}
|
|
135
|
+
catch (err) {
|
|
136
|
+
if (isNotFound(err))
|
|
137
|
+
throw new errors_js_1.NotSupportedByServerError(["settings"]);
|
|
138
|
+
throw err;
|
|
139
|
+
}
|
|
140
|
+
// Instructions first: the settings carry the new sdk_hash, and a hash written ahead of the instructions it
|
|
141
|
+
// covers would read as an edit made outside the SDK if the instructions write then failed.
|
|
142
|
+
const instructionsChanged = previousInstructions !== agent.instructions;
|
|
143
|
+
if (instructionsChanged) {
|
|
144
|
+
await this.agents.putInstructions({ agentId, instructionsBody: { data: agent.instructions } });
|
|
145
|
+
}
|
|
146
|
+
let envelope;
|
|
147
|
+
try {
|
|
148
|
+
envelope = await this.agents.putAgentSettings({ agentId, body: settings });
|
|
149
|
+
}
|
|
150
|
+
catch (err) {
|
|
151
|
+
if (isNotFound(err))
|
|
152
|
+
throw new errors_js_1.NotSupportedByServerError(["settings"]);
|
|
153
|
+
const invalid = await invalidSettings(err);
|
|
154
|
+
if (invalid === null)
|
|
155
|
+
throw err;
|
|
156
|
+
// The failed PUT stored nothing; only the instructions need putting back.
|
|
157
|
+
if (instructionsChanged)
|
|
158
|
+
await this.restore(agentId, null, previousInstructions);
|
|
159
|
+
throw invalid;
|
|
160
|
+
}
|
|
161
|
+
let warnings;
|
|
162
|
+
try {
|
|
163
|
+
warnings = checkWarnings(envelope, settings);
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
if (err instanceof errors_js_1.NotSupportedByServerError || err instanceof errors_js_1.UserError) {
|
|
167
|
+
await this.restore(agentId, previousSettings, instructionsChanged ? previousInstructions : null);
|
|
168
|
+
}
|
|
169
|
+
throw err;
|
|
170
|
+
}
|
|
171
|
+
checkMetadata(envelope, agent);
|
|
172
|
+
await this.agents.deployAgent({ agentId }); // idempotent; moves an adopted draft to deployed
|
|
173
|
+
return {
|
|
174
|
+
agentId,
|
|
175
|
+
name: agent.name,
|
|
176
|
+
instructions: agent.instructions,
|
|
177
|
+
settings: { ...((_b = envelope.settings) !== null && _b !== void 0 ? _b : {}) },
|
|
178
|
+
warnings,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
async deleteAgent(agentId) {
|
|
182
|
+
await this.agents.deleteAgent({ agentId });
|
|
183
|
+
}
|
|
184
|
+
// -- turns ----------------------------------------------------------------------------------------------
|
|
185
|
+
async startTurn(agentId, conversationId, text, signal) {
|
|
186
|
+
if (conversationId === null) {
|
|
187
|
+
conversationId = (await this.conversations.createConversation({ createConversationBody: { agentId } })).id;
|
|
188
|
+
}
|
|
189
|
+
const body = {
|
|
190
|
+
id: conversationId,
|
|
191
|
+
agentId,
|
|
192
|
+
message: { id: (0, node_crypto_1.randomUUID)(), role: "user", parts: [{ type: "text", text }] },
|
|
193
|
+
};
|
|
194
|
+
return new Stream(await (0, streaming_js_1.streamResponse)(this.config, body, { signal }), conversationId);
|
|
195
|
+
}
|
|
196
|
+
async answerClarify(conversationId, requestId, answers, signal) {
|
|
197
|
+
const inner = await (0, streaming_js_1.answerClarify)(this.config, conversationId, { requestId, answers }, { signal });
|
|
198
|
+
return new Stream(inner, conversationId);
|
|
199
|
+
}
|
|
200
|
+
async resume(conversationId, responseId, lastEventId, signal) {
|
|
201
|
+
const inner = await (0, streaming_js_1.reconnect)(this.config, conversationId, responseId, lastEventId, { signal });
|
|
202
|
+
return new Stream(inner, conversationId);
|
|
203
|
+
}
|
|
204
|
+
async stop(conversationId) {
|
|
205
|
+
await this.responses.stopResponse({ conversationId });
|
|
206
|
+
}
|
|
207
|
+
// -- helpers --------------------------------------------------------------------------------------------
|
|
208
|
+
/** Put back what updateAgent overwrote; a failing restore must not mask the original error. */
|
|
209
|
+
async restore(agentId, settings, instructions) {
|
|
210
|
+
try {
|
|
211
|
+
if (instructions !== null) {
|
|
212
|
+
await this.agents.putInstructions({ agentId, instructionsBody: { data: instructions } });
|
|
213
|
+
}
|
|
214
|
+
if (settings !== null)
|
|
215
|
+
await this.agents.putAgentSettings({ agentId, body: settings });
|
|
216
|
+
}
|
|
217
|
+
catch (err) {
|
|
218
|
+
console.warn(`could not restore agent ${agentId} after rejected settings: ${err}`);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
async instructions(agentId) {
|
|
222
|
+
return (await this.agents.getInstructions({ agentId })).data;
|
|
223
|
+
}
|
|
224
|
+
remote(resource, instructions) {
|
|
225
|
+
var _a;
|
|
226
|
+
return { agentId: resource.id, name: resource.name, instructions, settings: { ...((_a = resource.settings) !== null && _a !== void 0 ? _a : {}) }, warnings: [] };
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
exports.SettingsTransport = SettingsTransport;
|
|
230
|
+
/** The server's 422 CHAT_VALIDATION / invalid_agent_settings rejection as a UserError, else null. */
|
|
231
|
+
async function invalidSettings(err) {
|
|
232
|
+
if (!(err instanceof runtime_js_1.ResponseError) || err.response.status !== 422)
|
|
233
|
+
return null;
|
|
234
|
+
try {
|
|
235
|
+
const error = (await err.response.clone().json()).error;
|
|
236
|
+
const details = error.details.filter((d) => d && d.code === "invalid_agent_settings");
|
|
237
|
+
if (details.length === 0)
|
|
238
|
+
return null;
|
|
239
|
+
const issues = details.flatMap((d) => { var _a; return ((_a = d.issues) !== null && _a !== void 0 ? _a : []); }).map((i) => ({
|
|
240
|
+
code: i.code, path: i.path, message: i.message,
|
|
241
|
+
}));
|
|
242
|
+
return new errors_js_1.UserError(String(error.message || "the server rejected the agent settings"), issues);
|
|
243
|
+
}
|
|
244
|
+
catch (_a) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
/** findAgents() matches on metadata.sdk_name; a server that drops it would get a new agent per deploy. */
|
|
249
|
+
function checkMetadata(envelope, agent) {
|
|
250
|
+
var _a;
|
|
251
|
+
const metadata = ((_a = envelope.settings) !== null && _a !== void 0 ? _a : {})["metadata"];
|
|
252
|
+
if (typeof metadata !== "object" || metadata === null || Array.isArray(metadata) || metadata["sdk_name"] !== agent.name) {
|
|
253
|
+
throw new errors_js_1.NotSupportedByServerError(["metadata"]);
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
function checkWarnings(envelope, sent) {
|
|
257
|
+
var _a;
|
|
258
|
+
const warnings = [];
|
|
259
|
+
const rejected = [];
|
|
260
|
+
const unsupported = [];
|
|
261
|
+
for (const w of (_a = envelope.warnings) !== null && _a !== void 0 ? _a : []) {
|
|
262
|
+
const item = { code: w.code, path: w.path, message: w.message };
|
|
263
|
+
warnings.push(item);
|
|
264
|
+
if (item.code === "unknown_key" && Object.prototype.hasOwnProperty.call(sent, item.path) && item.path !== "metadata") {
|
|
265
|
+
if (rejected.indexOf(item.path) === -1)
|
|
266
|
+
rejected.push(item.path);
|
|
267
|
+
}
|
|
268
|
+
else if (item.code === "reasoning_unsupported") {
|
|
269
|
+
unsupported.push(String(item.message || "reasoning is not supported by the model"));
|
|
270
|
+
}
|
|
271
|
+
else if (!(item.code === "unknown_key" && item.path === "metadata")) {
|
|
272
|
+
console.warn(`agent settings warning ${item.code} at ${item.path}: ${item.message}`);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
if (rejected.length)
|
|
276
|
+
throw new errors_js_1.NotSupportedByServerError(rejected.sort());
|
|
277
|
+
if (unsupported.length)
|
|
278
|
+
throw new errors_js_1.UserError(unsupported.join("; "));
|
|
279
|
+
return warnings;
|
|
280
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface BuiltinTool {
|
|
2
|
+
readonly name: string;
|
|
3
|
+
readonly options?: Record<string, unknown>;
|
|
4
|
+
}
|
|
5
|
+
/** Give at most one of `filters.allowedDomains` and `blockedDomains`, and never an empty list. */
|
|
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,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.subagents = exports.clarify = exports.schedules = exports.todo = exports.codeMode = exports.sandbox = void 0;
|
|
4
|
+
exports.webSearchTool = webSearchTool;
|
|
5
|
+
/**
|
|
6
|
+
* Built-in (server-side) tools. Every built-in is on by default. Passing `tools` to `Agent` makes the list exact:
|
|
7
|
+
* listed built-ins stay on and the rest are turned off. Leave `tools` out to keep the server default.
|
|
8
|
+
*/
|
|
9
|
+
const errors_js_1 = require("./errors.js");
|
|
10
|
+
/** Give at most one of `filters.allowedDomains` and `blockedDomains`, and never an empty list. */
|
|
11
|
+
function webSearchTool(opts = {}) {
|
|
12
|
+
var _a, _b;
|
|
13
|
+
const options = {};
|
|
14
|
+
const allowed = (_a = opts.filters) === null || _a === void 0 ? void 0 : _a.allowedDomains;
|
|
15
|
+
const blocked = (_b = opts.blockedDomains) !== null && _b !== void 0 ? _b : undefined;
|
|
16
|
+
if (allowed !== undefined && allowed !== null && blocked !== undefined) {
|
|
17
|
+
throw new errors_js_1.UserError("webSearchTool: give filters.allowedDomains or blockedDomains, not both");
|
|
18
|
+
}
|
|
19
|
+
if (allowed !== undefined && allowed !== null && allowed.length === 0) {
|
|
20
|
+
throw new errors_js_1.UserError("webSearchTool.filters.allowedDomains: must not be empty (leave it out for no restriction)");
|
|
21
|
+
}
|
|
22
|
+
if (blocked !== undefined && blocked.length === 0) {
|
|
23
|
+
throw new errors_js_1.UserError("webSearchTool.blockedDomains: must not be empty (leave it out for no restriction)");
|
|
24
|
+
}
|
|
25
|
+
if (allowed !== undefined && allowed !== null)
|
|
26
|
+
options["allowed_domains"] = allowed.slice();
|
|
27
|
+
if (blocked !== undefined)
|
|
28
|
+
options["blocked_domains"] = blocked.slice();
|
|
29
|
+
const tool = Object.keys(options).length > 0 ? { name: "web_search", options } : { name: "web_search" };
|
|
30
|
+
return tool;
|
|
31
|
+
}
|
|
32
|
+
const simple = (name) => ({ name });
|
|
33
|
+
const sandbox = () => simple("sandbox");
|
|
34
|
+
exports.sandbox = sandbox;
|
|
35
|
+
const codeMode = () => simple("code_mode");
|
|
36
|
+
exports.codeMode = codeMode;
|
|
37
|
+
const todo = () => simple("todo");
|
|
38
|
+
exports.todo = todo;
|
|
39
|
+
const schedules = () => simple("schedules");
|
|
40
|
+
exports.schedules = schedules;
|
|
41
|
+
const clarify = () => simple("clarify");
|
|
42
|
+
exports.clarify = clarify;
|
|
43
|
+
const subagents = () => simple("subagents");
|
|
44
|
+
exports.subagents = 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
|
+
}
|
|
@@ -10,21 +10,46 @@
|
|
|
10
10
|
* Do not edit the class manually.
|
|
11
11
|
*/
|
|
12
12
|
import * as runtime from '../runtime.js';
|
|
13
|
-
import type { AgentConversationDetail, PageAgentConversationView } from '../models/index.js';
|
|
13
|
+
import type { AgentConversationDetail, DownloadUrlResponse, MessagesResponse, PageAgentConversationView } from '../models/index.js';
|
|
14
|
+
export interface AgentConversationArtifactDownloadUrlRequest {
|
|
15
|
+
agentId: string;
|
|
16
|
+
conversationId: string;
|
|
17
|
+
artifactId: string;
|
|
18
|
+
expires?: number;
|
|
19
|
+
disposition?: AgentConversationArtifactDownloadUrlDispositionEnum;
|
|
20
|
+
}
|
|
14
21
|
export interface GetAgentConversationRequest {
|
|
15
22
|
agentId: string;
|
|
16
23
|
conversationId: string;
|
|
17
24
|
}
|
|
25
|
+
export interface ListAgentConversationMessagesRequest {
|
|
26
|
+
agentId: string;
|
|
27
|
+
conversationId: string;
|
|
28
|
+
before: string;
|
|
29
|
+
turnLimit?: number | null;
|
|
30
|
+
}
|
|
18
31
|
export interface ListAgentConversationsRequest {
|
|
19
32
|
agentId: string;
|
|
20
33
|
limit?: number;
|
|
21
34
|
cursor?: string | null;
|
|
22
35
|
sessionType?: ListAgentConversationsSessionTypeEnum;
|
|
36
|
+
workspaceId?: Array<string>;
|
|
37
|
+
mine?: boolean | null;
|
|
23
38
|
}
|
|
24
39
|
/**
|
|
25
40
|
*
|
|
26
41
|
*/
|
|
27
42
|
export declare class AgentConversationsApi extends runtime.BaseAPI {
|
|
43
|
+
/**
|
|
44
|
+
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign through the owner-identity route the share links use. The gateway still checks the ids against the artifact\'s real owner.
|
|
45
|
+
* Agent Conversation Artifact Download Url Route
|
|
46
|
+
*/
|
|
47
|
+
agentConversationArtifactDownloadUrlRaw(requestParameters: AgentConversationArtifactDownloadUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<DownloadUrlResponse>>;
|
|
48
|
+
/**
|
|
49
|
+
* Presign one file of a session from the log, signed on each click. The file belongs to the session\'s user, not to the caller, so the in-app presign (scoped to the caller) would 404. Instead: 1. List the session\'s artifacts as its owner and require ``artifact_id`` among them. Without this check, an agent owner could presign any file of that user by guessing an id, not just this session\'s. 2. Presign through the owner-identity route the share links use. The gateway still checks the ids against the artifact\'s real owner.
|
|
50
|
+
* Agent Conversation Artifact Download Url Route
|
|
51
|
+
*/
|
|
52
|
+
agentConversationArtifactDownloadUrl(requestParameters: AgentConversationArtifactDownloadUrlRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<DownloadUrlResponse>;
|
|
28
53
|
/**
|
|
29
54
|
* One session from the log, with its projected history and tool calls. Read-only: unlike the self route this never marks the row read, because ``last_read_at`` is the owning user\'s unread state, not the agent owner\'s.
|
|
30
55
|
* Get Agent Conversation Route
|
|
@@ -35,6 +60,16 @@ export declare class AgentConversationsApi extends runtime.BaseAPI {
|
|
|
35
60
|
* Get Agent Conversation Route
|
|
36
61
|
*/
|
|
37
62
|
getAgentConversation(requestParameters: GetAgentConversationRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<AgentConversationDetail>;
|
|
63
|
+
/**
|
|
64
|
+
* Older history of one session from the log: the backward page of the self route ``GET /v1/conversations/{id}/messages?before=``. Only the backward path is offered, because the detail already returns the newest window and there is no live stream to catch up with.
|
|
65
|
+
* List Agent Conversation Messages Route
|
|
66
|
+
*/
|
|
67
|
+
listAgentConversationMessagesRaw(requestParameters: ListAgentConversationMessagesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<MessagesResponse>>;
|
|
68
|
+
/**
|
|
69
|
+
* Older history of one session from the log: the backward page of the self route ``GET /v1/conversations/{id}/messages?before=``. Only the backward path is offered, because the detail already returns the newest window and there is no live stream to catch up with.
|
|
70
|
+
* List Agent Conversation Messages Route
|
|
71
|
+
*/
|
|
72
|
+
listAgentConversationMessages(requestParameters: ListAgentConversationMessagesRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<MessagesResponse>;
|
|
38
73
|
/**
|
|
39
74
|
* The agent owner\'s session log: conversations every user in the tenant has had with this agent on the selected surface, newest-active first.
|
|
40
75
|
* List Agent Conversations Route
|
|
@@ -46,6 +81,14 @@ export declare class AgentConversationsApi extends runtime.BaseAPI {
|
|
|
46
81
|
*/
|
|
47
82
|
listAgentConversations(requestParameters: ListAgentConversationsRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<PageAgentConversationView>;
|
|
48
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* @export
|
|
86
|
+
*/
|
|
87
|
+
export declare const AgentConversationArtifactDownloadUrlDispositionEnum: {
|
|
88
|
+
readonly Inline: "inline";
|
|
89
|
+
readonly Attachment: "attachment";
|
|
90
|
+
};
|
|
91
|
+
export type AgentConversationArtifactDownloadUrlDispositionEnum = typeof AgentConversationArtifactDownloadUrlDispositionEnum[keyof typeof AgentConversationArtifactDownloadUrlDispositionEnum];
|
|
49
92
|
/**
|
|
50
93
|
* @export
|
|
51
94
|
*/
|