@agents24/node 0.5.33 → 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.
Files changed (47) hide show
  1. package/compatibility.json +8 -8
  2. package/dist/bff.cjs +103 -4
  3. package/dist/bff.cjs.map +1 -1
  4. package/dist/bff.d.cts +1 -1
  5. package/dist/bff.d.ts +1 -1
  6. package/dist/bff.js +103 -4
  7. package/dist/bff.js.map +1 -1
  8. package/dist/{client-IX8nsoyr.d.cts → client-BQN80Nb5.d.cts} +111 -3
  9. package/dist/{client-IX8nsoyr.d.ts → client-BQN80Nb5.d.ts} +111 -3
  10. package/dist/index.cjs +132 -11
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +4 -4
  13. package/dist/index.d.ts +4 -4
  14. package/dist/index.js +132 -11
  15. package/dist/index.js.map +1 -1
  16. package/dist/types/agents.d.ts +5 -0
  17. package/dist/types/agents.d.ts.map +1 -1
  18. package/dist/types/bff-conversation-submission.d.ts.map +1 -1
  19. package/dist/types/bff-multi-agent.d.ts.map +1 -1
  20. package/dist/types/bff-request.d.ts +2 -0
  21. package/dist/types/bff-request.d.ts.map +1 -1
  22. package/dist/types/bff-single-agent.d.ts.map +1 -1
  23. package/dist/types/bff-sse.d.ts +3 -0
  24. package/dist/types/bff-sse.d.ts.map +1 -1
  25. package/dist/types/embed-run-wait.d.ts +4 -1
  26. package/dist/types/embed-run-wait.d.ts.map +1 -1
  27. package/dist/types/embed-types.d.ts +7 -0
  28. package/dist/types/embed-types.d.ts.map +1 -1
  29. package/dist/types/embed.d.ts +5 -0
  30. package/dist/types/embed.d.ts.map +1 -1
  31. package/dist/types/generated/dictation.d.ts +99 -0
  32. package/dist/types/generated/dictation.d.ts.map +1 -0
  33. package/dist/types/generated/embed.d.ts +4 -1
  34. package/dist/types/generated/embed.d.ts.map +1 -1
  35. package/dist/types/generated/ingestion-types.d.ts +2 -0
  36. package/dist/types/generated/ingestion-types.d.ts.map +1 -1
  37. package/dist/types/generated/manifest.d.ts +1 -1
  38. package/dist/types/generated/manifest.d.ts.map +1 -1
  39. package/dist/types/generated/model-capabilities.d.ts +2 -2
  40. package/dist/types/generated/model-capabilities.d.ts.map +1 -1
  41. package/dist/types/generated/run-usage.d.ts +2 -0
  42. package/dist/types/generated/run-usage.d.ts.map +1 -1
  43. package/dist/types/runs.d.ts +11 -0
  44. package/dist/types/runs.d.ts.map +1 -1
  45. package/dist/types/types.d.ts +24 -0
  46. package/dist/types/types.d.ts.map +1 -1
  47. 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, ...wire } = payload;
223
- return { ...wire, ...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
  }
@@ -267,6 +276,7 @@ var AgentsNamespace = class {
267
276
  return this.http.requestJson(`/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/messages`, {
268
277
  method: "POST",
269
278
  body: {
279
+ ...payload.requestedOutputs === void 0 ? {} : { requested_outputs: payload.requestedOutputs },
270
280
  mode: payload.mode,
271
281
  input: payload.input,
272
282
  attachment_ids: payload.attachmentIds ?? [],
@@ -307,7 +317,7 @@ var AgentsNamespace = class {
307
317
  });
308
318
  }
309
319
  async stream(agentId, payload, onEvent, mode, options = {}) {
310
- const response = await this.http.fetchOrThrow(this.http.url(`/agents/${agentId}/stream`, { mode, stream_features: "assistant-completion-v1" }), {
320
+ const response = await this.http.fetchOrThrow(this.http.url(`/agents/${agentId}/stream`, { mode, stream_features: "assistant-completion-v1,workflow-outputs-v1" }), {
311
321
  method: "POST",
312
322
  headers: this.http.streamHeaders(),
313
323
  body: JSON.stringify(runBody(payload)),
@@ -331,6 +341,7 @@ var AgentsNamespace = class {
331
341
  const form = new FormData();
332
342
  if (options.threadId) form.set("thread_id", options.threadId);
333
343
  if (options.agentVersionId) form.set("agent_version_id", options.agentVersionId);
344
+ if (options.transcriptPresentations) form.set("transcript_presentations", JSON.stringify(options.transcriptPresentations));
334
345
  for (const file of options.files) form.append("files", file, file.name);
335
346
  const response = await this.http.fetchOrThrow(this.http.url(`/agents/${agentId}/attachments/upload`), {
336
347
  method: "POST",
@@ -538,6 +549,27 @@ var ClientSessionsNamespace = class {
538
549
  };
539
550
 
540
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
+ }
541
573
  var AgentRunWaitError = class extends Error {
542
574
  constructor(runId, snapshot, name) {
543
575
  super(`Stopped waiting for Agent run ${runId}.`);
@@ -548,7 +580,7 @@ var AgentRunWaitError = class extends Error {
548
580
  runId;
549
581
  snapshot;
550
582
  };
551
- async function waitForEmbeddedRun(runId, read, options = {}) {
583
+ async function waitForEmbeddedRun(runId, read, options = {}, observe) {
552
584
  const timeoutMs = options.timeoutMs ?? 12e4;
553
585
  if (!Number.isFinite(timeoutMs) || timeoutMs <= 0) throw new RangeError("timeoutMs must be a positive finite number.");
554
586
  const controller = new AbortController();
@@ -567,7 +599,11 @@ async function waitForEmbeddedRun(runId, read, options = {}) {
567
599
  controller.signal.throwIfAborted();
568
600
  snapshot = await read(controller.signal);
569
601
  controller.signal.throwIfAborted();
570
- if (["completed", "failed", "cancelled", "paused"].includes(snapshot.status)) return snapshot;
602
+ if (terminal(snapshot.status)) return snapshot;
603
+ if (observe) {
604
+ await observeCompletion(observe, controller.signal);
605
+ continue;
606
+ }
571
607
  await new Promise((resolve, reject) => {
572
608
  const stop = () => {
573
609
  clearTimeout(delay);
@@ -673,7 +709,7 @@ var EmbedNamespace = class extends EmbedDelegationsNamespace {
673
709
  }
674
710
  async openConversationSubmission(threadId, request, options) {
675
711
  const response = await this.http.fetchOrThrow(
676
- this.http.url(`/public/embed/threads/${encodeURIComponent(threadId)}/messages/stream`, { stream_features: options?.streamFeatures ?? "assistant-completion-v1" }),
712
+ this.http.url(`/public/embed/threads/${encodeURIComponent(threadId)}/messages/stream`, { stream_features: options?.streamFeatures ?? "assistant-completion-v1,workflow-outputs-v1" }),
677
713
  { method: "POST", headers: this.http.streamHeaders(void 0, options, true), body: JSON.stringify(request), signal: options?.signal },
678
714
  "Failed to connect to the conversation endpoint."
679
715
  );
@@ -686,6 +722,33 @@ var EmbedNamespace = class extends EmbedDelegationsNamespace {
686
722
  body: request
687
723
  });
688
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
+ }
689
752
  };
690
753
  var EmbedNamespace2 = class extends EmbedNamespace {
691
754
  constructor(http) {
@@ -704,20 +767,22 @@ var EmbedNamespace2 = class extends EmbedNamespace {
704
767
  });
705
768
  }
706
769
  async attachAgentRun(agentId, runId, payload, onEvent, options = {}) {
707
- 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);
708
771
  }
709
772
  namespacePayload(payload) {
710
773
  if (!payload || typeof payload !== "object") return payload;
711
- const { knowledgeNamespaces, chatScope, customerTenant, ...wire } = payload;
774
+ const { knowledgeNamespaces, chatScope, customerTenant, requestedOutputs, dictationSessionId, ...wire } = payload;
712
775
  return {
713
776
  ...wire,
777
+ ...dictationSessionId === void 0 ? {} : { dictation_session_id: dictationSessionId },
778
+ ...requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputs },
714
779
  ...customerTenant === void 0 ? {} : { customer_tenant: customerTenant },
715
780
  ...knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: knowledgeNamespaces },
716
781
  ...chatScope === void 0 ? {} : { chat_scope: chatScope }
717
782
  };
718
783
  }
719
784
  async stream(path, payload, onEvent, options) {
720
- const response = await this.http.fetchOrThrow(this.http.url(path, { stream_features: options.streamFeatures ?? "assistant-completion-v1", lease_seconds: options.leaseSeconds }), {
785
+ const response = await this.http.fetchOrThrow(this.http.url(path, { stream_features: options.streamFeatures ?? "assistant-completion-v1,workflow-outputs-v1", lease_seconds: options.leaseSeconds }), {
721
786
  method: "POST",
722
787
  headers: this.http.streamHeaders(void 0, options, true),
723
788
  body: JSON.stringify(this.namespacePayload(payload)),
@@ -851,6 +916,8 @@ var EmbedNamespace2 = class extends EmbedNamespace {
851
916
  customer_tenant: payload.customerTenant,
852
917
  ...payload.trustedContext === void 0 ? {} : { trusted_context: payload.trustedContext },
853
918
  execution_limits: payload.executionLimits,
919
+ ...payload.dictationSessionId === void 0 ? {} : { dictation_session_id: payload.dictationSessionId },
920
+ ...payload.requestedOutputs === void 0 ? {} : { requested_outputs: payload.requestedOutputs },
854
921
  tool_inputs: payload.toolInputs ?? {},
855
922
  ...payload.metadata === void 0 ? {} : { metadata: payload.metadata }
856
923
  },
@@ -1030,6 +1097,16 @@ var EmbedNamespace2 = class extends EmbedNamespace {
1030
1097
  chat_scope: options.chatScope
1031
1098
  }, options: requestOptions, mutation: true });
1032
1099
  }
1100
+ listAgentRunOutputs(agentId, runId, scope) {
1101
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/runs/${encodeURIComponent(runId)}/outputs`, {
1102
+ query: { ...this.threadMessageQuery(scope), after: scope.after, limit: scope.limit }
1103
+ });
1104
+ }
1105
+ getAgentRunOutput(agentId, runId, outputId, scope) {
1106
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/runs/${encodeURIComponent(runId)}/outputs/${encodeURIComponent(outputId)}`, {
1107
+ query: this.threadMessageQuery(scope)
1108
+ });
1109
+ }
1033
1110
  getAgentRun(agentId, runId, scope, options = {}) {
1034
1111
  return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/runs/${encodeURIComponent(runId)}`, {
1035
1112
  query: this.threadMessageQuery(scope),
@@ -1037,7 +1114,25 @@ var EmbedNamespace2 = class extends EmbedNamespace {
1037
1114
  });
1038
1115
  }
1039
1116
  waitForAgentRun(agentId, runId, scope, options = {}) {
1040
- return waitForEmbeddedRun(runId, (signal) => this.getAgentRun(agentId, runId, scope, { signal }), options);
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
+ );
1041
1136
  }
1042
1137
  getAgentRunContext(agentId, runId, options) {
1043
1138
  return this.http.requestJson(`/public/embed/agents/${agentId}/runs/${runId}/context`, { query: {
@@ -1065,6 +1160,7 @@ var EmbedNamespace2 = class extends EmbedNamespace {
1065
1160
  }
1066
1161
  async uploadAgentAttachments(agentId, options) {
1067
1162
  const form = new FormData();
1163
+ if (options.transcriptPresentations) form.set("transcript_presentations", JSON.stringify(options.transcriptPresentations));
1068
1164
  form.set("external_user_id", options.externalUserId);
1069
1165
  if (options.externalSessionId) form.set("external_session_id", options.externalSessionId);
1070
1166
  if (options.threadId) form.set("thread_id", options.threadId);
@@ -1351,8 +1447,18 @@ var ResourceInstallationsNamespace = class {
1351
1447
  var RunsNamespace = class {
1352
1448
  constructor(http) {
1353
1449
  this.http = http;
1450
+ this.outputs = {
1451
+ list: (input) => http.requestJson(
1452
+ `/agents/runs/${encodeURIComponent(input.runId)}/outputs`,
1453
+ { query: { after: input.after, limit: input.limit } }
1454
+ ),
1455
+ get: (input) => http.requestJson(
1456
+ `/agents/runs/${encodeURIComponent(input.runId)}/outputs/${encodeURIComponent(input.outputId)}`
1457
+ )
1458
+ };
1354
1459
  }
1355
1460
  http;
1461
+ outputs;
1356
1462
  get(runId, options = {}) {
1357
1463
  return this.http.requestJson(`/agents/runs/${runId}`, { query: { include_tree: options.includeTree } });
1358
1464
  }
@@ -2013,12 +2119,15 @@ var Agents24 = class extends GeneratedIntegrationNamespaces {
2013
2119
 
2014
2120
  // src/generated/manifest.ts
2015
2121
  var SDK_OPERATION_IDS = [
2122
+ "agents.cancel_dictation_session",
2016
2123
  "agents.cancel_run",
2017
2124
  "agents.catalog",
2018
2125
  "agents.create",
2019
2126
  "agents.create_attachment_content_access",
2127
+ "agents.create_dictation_session",
2020
2128
  "agents.delete",
2021
2129
  "agents.get",
2130
+ "agents.get_dictation_session",
2022
2131
  "agents.list",
2023
2132
  "agents.publish",
2024
2133
  "agents.resume_run",
@@ -2043,6 +2152,9 @@ var SDK_OPERATION_IDS = [
2043
2152
  "client.deployments.get",
2044
2153
  "client.deployments.list",
2045
2154
  "client.deployments.update",
2155
+ "client.dictation.cancel",
2156
+ "client.dictation.create",
2157
+ "client.dictation.get",
2046
2158
  "client.hitl.resume",
2047
2159
  "client.jwks",
2048
2160
  "client.mcp.redeem",
@@ -2050,6 +2162,8 @@ var SDK_OPERATION_IDS = [
2050
2162
  "client.resource_policy",
2051
2163
  "client.runs.attach",
2052
2164
  "client.runs.cancel",
2165
+ "client.runs.outputs.get",
2166
+ "client.runs.outputs.list",
2053
2167
  "client.runs.set_feedback",
2054
2168
  "client.sessions.anonymous",
2055
2169
  "client.sessions.backendExchange",
@@ -2080,10 +2194,12 @@ var SDK_OPERATION_IDS = [
2080
2194
  "embed.attach_agent_run",
2081
2195
  "embed.bootstrap_runtime",
2082
2196
  "embed.cancel_agent_run",
2197
+ "embed.cancel_dictation_session",
2083
2198
  "embed.complete_tool_invocation",
2084
2199
  "embed.create_agent_computer_content_access",
2085
2200
  "embed.create_attachment_content_access",
2086
2201
  "embed.create_conversation_computer_content_access",
2202
+ "embed.create_dictation_session",
2087
2203
  "embed.delete_agent_thread",
2088
2204
  "embed.delete_conversation_thread",
2089
2205
  "embed.get_agent_computer",
@@ -2092,12 +2208,15 @@ var SDK_OPERATION_IDS = [
2092
2208
  "embed.get_agent_thread",
2093
2209
  "embed.get_conversation_computer",
2094
2210
  "embed.get_conversation_thread",
2211
+ "embed.get_dictation_session",
2212
+ "embed.get_output",
2095
2213
  "embed.get_resource_policy",
2096
2214
  "embed.get_runtime_bootstrap",
2097
2215
  "embed.list_agent_computer_files",
2098
2216
  "embed.list_agent_threads",
2099
2217
  "embed.list_agent_threads_multi",
2100
2218
  "embed.list_conversation_computer_files",
2219
+ "embed.list_outputs",
2101
2220
  "embed.open_conversation_submission",
2102
2221
  "embed.read_agent_computer_file",
2103
2222
  "embed.read_conversation_computer_file",
@@ -2207,8 +2326,10 @@ var SDK_OPERATION_IDS = [
2207
2326
  "runs.get",
2208
2327
  "runs.get_context",
2209
2328
  "runs.get_events",
2329
+ "runs.get_output",
2210
2330
  "runs.get_trace",
2211
- "runs.get_tree"
2331
+ "runs.get_tree",
2332
+ "runs.list_outputs"
2212
2333
  ];
2213
2334
 
2214
2335
  Object.defineProperty(exports, "CONTRACT_HASH", {