@agents24/node 0.5.34 → 0.5.35
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/compatibility.json +6 -6
- package/dist/bff.cjs +64 -1
- package/dist/bff.cjs.map +1 -1
- package/dist/bff.d.cts +1 -1
- package/dist/bff.d.ts +1 -1
- package/dist/bff.js +64 -1
- package/dist/bff.js.map +1 -1
- package/dist/{client-CY0o68YO.d.cts → client-BQN80Nb5.d.cts} +86 -3
- package/dist/{client-CY0o68YO.d.ts → client-BQN80Nb5.d.ts} +86 -3
- package/dist/index.cjs +99 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +99 -7
- package/dist/index.js.map +1 -1
- package/dist/types/agents.d.ts +4 -0
- package/dist/types/agents.d.ts.map +1 -1
- package/dist/types/bff-conversation-submission.d.ts.map +1 -1
- package/dist/types/bff-multi-agent.d.ts.map +1 -1
- package/dist/types/bff-single-agent.d.ts.map +1 -1
- package/dist/types/embed-run-wait.d.ts +4 -1
- package/dist/types/embed-run-wait.d.ts.map +1 -1
- package/dist/types/embed-types.d.ts +4 -0
- package/dist/types/embed-types.d.ts.map +1 -1
- package/dist/types/embed.d.ts.map +1 -1
- package/dist/types/generated/dictation.d.ts +99 -0
- package/dist/types/generated/dictation.d.ts.map +1 -0
- package/dist/types/generated/embed.d.ts +4 -1
- package/dist/types/generated/embed.d.ts.map +1 -1
- package/dist/types/generated/ingestion-types.d.ts +2 -0
- package/dist/types/generated/ingestion-types.d.ts.map +1 -1
- package/dist/types/generated/manifest.d.ts +1 -1
- package/dist/types/generated/manifest.d.ts.map +1 -1
- package/dist/types/generated/model-capabilities.d.ts +2 -2
- package/dist/types/generated/model-capabilities.d.ts.map +1 -1
- package/dist/types/generated/run-usage.d.ts +2 -0
- package/dist/types/generated/run-usage.d.ts.map +1 -1
- package/dist/types/types.d.ts +18 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -219,14 +219,23 @@ async function consumeThreadSummaryEventStream(response, onEvent, signal, onCont
|
|
|
219
219
|
|
|
220
220
|
// src/agents.ts
|
|
221
221
|
function runBody(payload) {
|
|
222
|
-
const { customerTenant, requestedOutputs, ...wire } = payload;
|
|
223
|
-
return { ...wire, ...requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputs }, ...customerTenant === void 0 ? {} : { customer_tenant: customerTenant } };
|
|
222
|
+
const { customerTenant, requestedOutputs, dictationSessionId, ...wire } = payload;
|
|
223
|
+
return { ...wire, ...dictationSessionId === void 0 ? {} : { dictation_session_id: dictationSessionId }, ...requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputs }, ...customerTenant === void 0 ? {} : { customer_tenant: customerTenant } };
|
|
224
224
|
}
|
|
225
225
|
var AgentsNamespace = class {
|
|
226
226
|
constructor(http) {
|
|
227
227
|
this.http = http;
|
|
228
228
|
}
|
|
229
229
|
http;
|
|
230
|
+
createDictationSession(agentId, request, options) {
|
|
231
|
+
return this.http.requestJson(`/agents/${encodeURIComponent(agentId)}/dictation-sessions`, { method: "POST", body: request, options, mutation: true });
|
|
232
|
+
}
|
|
233
|
+
getDictationSession(agentId, sessionId, query = {}, options) {
|
|
234
|
+
return this.http.requestJson(`/agents/${encodeURIComponent(agentId)}/dictation-sessions/${encodeURIComponent(sessionId)}`, { query, options });
|
|
235
|
+
}
|
|
236
|
+
cancelDictationSession(agentId, sessionId, request, options) {
|
|
237
|
+
return this.http.requestJson(`/agents/${encodeURIComponent(agentId)}/dictation-sessions/${encodeURIComponent(sessionId)}/cancel`, { method: "POST", body: request, options, mutation: true });
|
|
238
|
+
}
|
|
230
239
|
list(options = {}) {
|
|
231
240
|
return this.http.requestJson("/agents", { query: { status: options.status, skip: options.skip ?? 0, limit: options.limit ?? 20, view: options.view ?? "summary" } });
|
|
232
241
|
}
|
|
@@ -332,6 +341,7 @@ var AgentsNamespace = class {
|
|
|
332
341
|
const form = new FormData();
|
|
333
342
|
if (options.threadId) form.set("thread_id", options.threadId);
|
|
334
343
|
if (options.agentVersionId) form.set("agent_version_id", options.agentVersionId);
|
|
344
|
+
if (options.transcriptPresentations) form.set("transcript_presentations", JSON.stringify(options.transcriptPresentations));
|
|
335
345
|
for (const file of options.files) form.append("files", file, file.name);
|
|
336
346
|
const response = await this.http.fetchOrThrow(this.http.url(`/agents/${agentId}/attachments/upload`), {
|
|
337
347
|
method: "POST",
|
|
@@ -539,6 +549,27 @@ var ClientSessionsNamespace = class {
|
|
|
539
549
|
};
|
|
540
550
|
|
|
541
551
|
// src/embed-run-wait.ts
|
|
552
|
+
var terminal = (status) => ["completed", "failed", "cancelled", "paused"].includes(status);
|
|
553
|
+
async function observeCompletion(observe, signal) {
|
|
554
|
+
const stream = new AbortController();
|
|
555
|
+
const abort = () => stream.abort(signal.reason);
|
|
556
|
+
signal.addEventListener("abort", abort, { once: true });
|
|
557
|
+
if (signal.aborted) abort();
|
|
558
|
+
let completed = false;
|
|
559
|
+
try {
|
|
560
|
+
await observe((event) => {
|
|
561
|
+
if (terminal(event.event.replace(/^run\./, "")) || event.event === "run.snapshot" && terminal(String(event.payload.status))) {
|
|
562
|
+
completed = true;
|
|
563
|
+
stream.abort();
|
|
564
|
+
}
|
|
565
|
+
}, stream.signal);
|
|
566
|
+
} catch (error) {
|
|
567
|
+
if (!completed || signal.aborted) throw error;
|
|
568
|
+
} finally {
|
|
569
|
+
signal.removeEventListener("abort", abort);
|
|
570
|
+
stream.abort();
|
|
571
|
+
}
|
|
572
|
+
}
|
|
542
573
|
var AgentRunWaitError = class extends Error {
|
|
543
574
|
constructor(runId, snapshot, name) {
|
|
544
575
|
super(`Stopped waiting for Agent run ${runId}.`);
|
|
@@ -549,7 +580,7 @@ var AgentRunWaitError = class extends Error {
|
|
|
549
580
|
runId;
|
|
550
581
|
snapshot;
|
|
551
582
|
};
|
|
552
|
-
async function waitForEmbeddedRun(runId, read, options = {}) {
|
|
583
|
+
async function waitForEmbeddedRun(runId, read, options = {}, observe) {
|
|
553
584
|
const timeoutMs = options.timeoutMs ?? 12e4;
|
|
554
585
|
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) throw new RangeError("timeoutMs must be a positive finite number.");
|
|
555
586
|
const controller = new AbortController();
|
|
@@ -568,7 +599,11 @@ async function waitForEmbeddedRun(runId, read, options = {}) {
|
|
|
568
599
|
controller.signal.throwIfAborted();
|
|
569
600
|
snapshot = await read(controller.signal);
|
|
570
601
|
controller.signal.throwIfAborted();
|
|
571
|
-
if (
|
|
602
|
+
if (terminal(snapshot.status)) return snapshot;
|
|
603
|
+
if (observe) {
|
|
604
|
+
await observeCompletion(observe, controller.signal);
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
572
607
|
await new Promise((resolve, reject) => {
|
|
573
608
|
const stop = () => {
|
|
574
609
|
clearTimeout(delay);
|
|
@@ -687,6 +722,33 @@ var EmbedNamespace = class extends EmbedDelegationsNamespace {
|
|
|
687
722
|
body: request
|
|
688
723
|
});
|
|
689
724
|
}
|
|
725
|
+
createDictationSession(agentId, request, options) {
|
|
726
|
+
return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/dictation-sessions`, {
|
|
727
|
+
method: "POST",
|
|
728
|
+
body: request,
|
|
729
|
+
options,
|
|
730
|
+
mutation: true
|
|
731
|
+
});
|
|
732
|
+
}
|
|
733
|
+
getDictationSession(agentId, sessionId, options) {
|
|
734
|
+
return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/dictation-sessions/${encodeURIComponent(sessionId)}`, {
|
|
735
|
+
query: {
|
|
736
|
+
external_user_id: options.externalUserId,
|
|
737
|
+
external_session_id: options.externalSessionId,
|
|
738
|
+
integration_id: options.integrationId,
|
|
739
|
+
chat_scope: options.chatScope,
|
|
740
|
+
runtime_target: options.runtimeTarget,
|
|
741
|
+
agent_version_id: options.agentVersionId
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
cancelDictationSession(agentId, sessionId, request, options) {
|
|
746
|
+
return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/dictation-sessions/${encodeURIComponent(sessionId)}/cancel`, {
|
|
747
|
+
method: "POST",
|
|
748
|
+
body: request,
|
|
749
|
+
options
|
|
750
|
+
});
|
|
751
|
+
}
|
|
690
752
|
};
|
|
691
753
|
var EmbedNamespace2 = class extends EmbedNamespace {
|
|
692
754
|
constructor(http) {
|
|
@@ -705,13 +767,14 @@ var EmbedNamespace2 = class extends EmbedNamespace {
|
|
|
705
767
|
});
|
|
706
768
|
}
|
|
707
769
|
async attachAgentRun(agentId, runId, payload, onEvent, options = {}) {
|
|
708
|
-
return this.stream(`/public/embed/agents/${agentId}/runs/${runId}/stream`, payload, onEvent, options);
|
|
770
|
+
return this.stream(`/public/embed/agents/${encodeURIComponent(agentId)}/runs/${encodeURIComponent(runId)}/stream`, payload, onEvent, options);
|
|
709
771
|
}
|
|
710
772
|
namespacePayload(payload) {
|
|
711
773
|
if (!payload || typeof payload !== "object") return payload;
|
|
712
|
-
const { knowledgeNamespaces, chatScope, customerTenant, requestedOutputs, ...wire } = payload;
|
|
774
|
+
const { knowledgeNamespaces, chatScope, customerTenant, requestedOutputs, dictationSessionId, ...wire } = payload;
|
|
713
775
|
return {
|
|
714
776
|
...wire,
|
|
777
|
+
...dictationSessionId === void 0 ? {} : { dictation_session_id: dictationSessionId },
|
|
715
778
|
...requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputs },
|
|
716
779
|
...customerTenant === void 0 ? {} : { customer_tenant: customerTenant },
|
|
717
780
|
...knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: knowledgeNamespaces },
|
|
@@ -853,6 +916,7 @@ var EmbedNamespace2 = class extends EmbedNamespace {
|
|
|
853
916
|
customer_tenant: payload.customerTenant,
|
|
854
917
|
...payload.trustedContext === void 0 ? {} : { trusted_context: payload.trustedContext },
|
|
855
918
|
execution_limits: payload.executionLimits,
|
|
919
|
+
...payload.dictationSessionId === void 0 ? {} : { dictation_session_id: payload.dictationSessionId },
|
|
856
920
|
...payload.requestedOutputs === void 0 ? {} : { requested_outputs: payload.requestedOutputs },
|
|
857
921
|
tool_inputs: payload.toolInputs ?? {},
|
|
858
922
|
...payload.metadata === void 0 ? {} : { metadata: payload.metadata }
|
|
@@ -1050,7 +1114,25 @@ var EmbedNamespace2 = class extends EmbedNamespace {
|
|
|
1050
1114
|
});
|
|
1051
1115
|
}
|
|
1052
1116
|
waitForAgentRun(agentId, runId, scope, options = {}) {
|
|
1053
|
-
|
|
1117
|
+
let cursor;
|
|
1118
|
+
return waitForEmbeddedRun(
|
|
1119
|
+
runId,
|
|
1120
|
+
(signal) => this.getAgentRun(agentId, runId, scope, { signal }),
|
|
1121
|
+
options,
|
|
1122
|
+
options.observation === "stream" ? (onEvent, signal) => this.attachAgentRun(agentId, runId, {
|
|
1123
|
+
external_user_id: scope.externalUserId,
|
|
1124
|
+
external_session_id: scope.externalSessionId,
|
|
1125
|
+
integration_id: scope.integrationId,
|
|
1126
|
+
runtime_target: scope.runtimeTarget,
|
|
1127
|
+
chatScope: scope.chatScope,
|
|
1128
|
+
cursor
|
|
1129
|
+
}, (event) => {
|
|
1130
|
+
if (event.run_id === runId) {
|
|
1131
|
+
cursor = event.seq;
|
|
1132
|
+
onEvent(event);
|
|
1133
|
+
}
|
|
1134
|
+
}, { signal, leaseSeconds: 60 }) : void 0
|
|
1135
|
+
);
|
|
1054
1136
|
}
|
|
1055
1137
|
getAgentRunContext(agentId, runId, options) {
|
|
1056
1138
|
return this.http.requestJson(`/public/embed/agents/${agentId}/runs/${runId}/context`, { query: {
|
|
@@ -1078,6 +1160,7 @@ var EmbedNamespace2 = class extends EmbedNamespace {
|
|
|
1078
1160
|
}
|
|
1079
1161
|
async uploadAgentAttachments(agentId, options) {
|
|
1080
1162
|
const form = new FormData();
|
|
1163
|
+
if (options.transcriptPresentations) form.set("transcript_presentations", JSON.stringify(options.transcriptPresentations));
|
|
1081
1164
|
form.set("external_user_id", options.externalUserId);
|
|
1082
1165
|
if (options.externalSessionId) form.set("external_session_id", options.externalSessionId);
|
|
1083
1166
|
if (options.threadId) form.set("thread_id", options.threadId);
|
|
@@ -2036,12 +2119,15 @@ var Agents24 = class extends GeneratedIntegrationNamespaces {
|
|
|
2036
2119
|
|
|
2037
2120
|
// src/generated/manifest.ts
|
|
2038
2121
|
var SDK_OPERATION_IDS = [
|
|
2122
|
+
"agents.cancel_dictation_session",
|
|
2039
2123
|
"agents.cancel_run",
|
|
2040
2124
|
"agents.catalog",
|
|
2041
2125
|
"agents.create",
|
|
2042
2126
|
"agents.create_attachment_content_access",
|
|
2127
|
+
"agents.create_dictation_session",
|
|
2043
2128
|
"agents.delete",
|
|
2044
2129
|
"agents.get",
|
|
2130
|
+
"agents.get_dictation_session",
|
|
2045
2131
|
"agents.list",
|
|
2046
2132
|
"agents.publish",
|
|
2047
2133
|
"agents.resume_run",
|
|
@@ -2066,6 +2152,9 @@ var SDK_OPERATION_IDS = [
|
|
|
2066
2152
|
"client.deployments.get",
|
|
2067
2153
|
"client.deployments.list",
|
|
2068
2154
|
"client.deployments.update",
|
|
2155
|
+
"client.dictation.cancel",
|
|
2156
|
+
"client.dictation.create",
|
|
2157
|
+
"client.dictation.get",
|
|
2069
2158
|
"client.hitl.resume",
|
|
2070
2159
|
"client.jwks",
|
|
2071
2160
|
"client.mcp.redeem",
|
|
@@ -2105,10 +2194,12 @@ var SDK_OPERATION_IDS = [
|
|
|
2105
2194
|
"embed.attach_agent_run",
|
|
2106
2195
|
"embed.bootstrap_runtime",
|
|
2107
2196
|
"embed.cancel_agent_run",
|
|
2197
|
+
"embed.cancel_dictation_session",
|
|
2108
2198
|
"embed.complete_tool_invocation",
|
|
2109
2199
|
"embed.create_agent_computer_content_access",
|
|
2110
2200
|
"embed.create_attachment_content_access",
|
|
2111
2201
|
"embed.create_conversation_computer_content_access",
|
|
2202
|
+
"embed.create_dictation_session",
|
|
2112
2203
|
"embed.delete_agent_thread",
|
|
2113
2204
|
"embed.delete_conversation_thread",
|
|
2114
2205
|
"embed.get_agent_computer",
|
|
@@ -2117,6 +2208,7 @@ var SDK_OPERATION_IDS = [
|
|
|
2117
2208
|
"embed.get_agent_thread",
|
|
2118
2209
|
"embed.get_conversation_computer",
|
|
2119
2210
|
"embed.get_conversation_thread",
|
|
2211
|
+
"embed.get_dictation_session",
|
|
2120
2212
|
"embed.get_output",
|
|
2121
2213
|
"embed.get_resource_policy",
|
|
2122
2214
|
"embed.get_runtime_bootstrap",
|