@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.
Files changed (40) hide show
  1. package/compatibility.json +6 -6
  2. package/dist/bff.cjs +64 -1
  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 +64 -1
  7. package/dist/bff.js.map +1 -1
  8. package/dist/{client-CY0o68YO.d.cts → client-BQN80Nb5.d.cts} +86 -3
  9. package/dist/{client-CY0o68YO.d.ts → client-BQN80Nb5.d.ts} +86 -3
  10. package/dist/index.cjs +99 -7
  11. package/dist/index.cjs.map +1 -1
  12. package/dist/index.d.cts +3 -3
  13. package/dist/index.d.ts +3 -3
  14. package/dist/index.js +99 -7
  15. package/dist/index.js.map +1 -1
  16. package/dist/types/agents.d.ts +4 -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-single-agent.d.ts.map +1 -1
  21. package/dist/types/embed-run-wait.d.ts +4 -1
  22. package/dist/types/embed-run-wait.d.ts.map +1 -1
  23. package/dist/types/embed-types.d.ts +4 -0
  24. package/dist/types/embed-types.d.ts.map +1 -1
  25. package/dist/types/embed.d.ts.map +1 -1
  26. package/dist/types/generated/dictation.d.ts +99 -0
  27. package/dist/types/generated/dictation.d.ts.map +1 -0
  28. package/dist/types/generated/embed.d.ts +4 -1
  29. package/dist/types/generated/embed.d.ts.map +1 -1
  30. package/dist/types/generated/ingestion-types.d.ts +2 -0
  31. package/dist/types/generated/ingestion-types.d.ts.map +1 -1
  32. package/dist/types/generated/manifest.d.ts +1 -1
  33. package/dist/types/generated/manifest.d.ts.map +1 -1
  34. package/dist/types/generated/model-capabilities.d.ts +2 -2
  35. package/dist/types/generated/model-capabilities.d.ts.map +1 -1
  36. package/dist/types/generated/run-usage.d.ts +2 -0
  37. package/dist/types/generated/run-usage.d.ts.map +1 -1
  38. package/dist/types/types.d.ts +18 -0
  39. package/dist/types/types.d.ts.map +1 -1
  40. package/package.json +2 -2
package/dist/bff.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as Agents24 } from './client-CY0o68YO.cjs';
1
+ import { A as Agents24 } from './client-BQN80Nb5.cjs';
2
2
  import '@agents24/client/protocol';
3
3
  import '@agents24/client';
4
4
 
package/dist/bff.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { A as Agents24 } from './client-CY0o68YO.js';
1
+ import { A as Agents24 } from './client-BQN80Nb5.js';
2
2
  import '@agents24/client/protocol';
3
3
  import '@agents24/client';
4
4
 
package/dist/bff.js CHANGED
@@ -296,6 +296,7 @@ async function submitConversationStream(input) {
296
296
  input: value.input,
297
297
  attachment_ids: value.attachmentIds,
298
298
  client_submission_id: value.clientSubmissionId,
299
+ ...stringValue(body.dictationSessionId) ? { dictation_session_id: stringValue(body.dictationSessionId) } : {},
299
300
  ...input.requestedAgentId ? { requested_agent_id: input.requestedAgentId } : {},
300
301
  ...value.requestedModelId ? { requested_model_id: value.requestedModelId } : {},
301
302
  ...resolution.chatScope === void 0 ? {} : { chat_scope: resolution.chatScope },
@@ -712,6 +713,40 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
712
713
  if (request.method === "GET" && path === "/bootstrap") {
713
714
  const raw = await embed.getRuntimeBootstrap(agentId, agentVersionId, runtimeTarget);
714
715
  response = json(bootstrapDocument(raw, agentVersionId));
716
+ } else if (request.method === "POST" && path === "/dictation-sessions") {
717
+ if (!idempotencyKey) throw new BffInputError(400, "IDEMPOTENCY_REQUIRED", "A dictation operation ID is required.");
718
+ response = json(await embed.createDictationSession(agentId, {
719
+ external_user_id: customerPrincipalRef,
720
+ integration_id: integrationId,
721
+ ...principal.externalSessionId ? { external_session_id: principal.externalSessionId } : {},
722
+ ...resolution.chatScope === void 0 ? {} : { chat_scope: resolution.chatScope },
723
+ ...agentVersionId ? { agent_version_id: agentVersionId } : {},
724
+ runtime_target: runtimeTarget,
725
+ origin: new URL(request.url).origin
726
+ }, { idempotencyKey, signal: request.signal }));
727
+ } else if (path.startsWith("/dictation-sessions/")) {
728
+ const match = /^\/dictation-sessions\/([^/]+)(\/cancel)?$/.exec(path);
729
+ if (!match) throw new BffInputError(404, "NOT_FOUND", "Dictation session is unavailable.");
730
+ const sessionId = decodeURIComponent(match[1]);
731
+ const scope = {
732
+ external_user_id: customerPrincipalRef,
733
+ integration_id: integrationId,
734
+ ...principal.externalSessionId ? { external_session_id: principal.externalSessionId } : {},
735
+ ...resolution.chatScope === void 0 ? {} : { chat_scope: resolution.chatScope },
736
+ ...agentVersionId ? { agent_version_id: agentVersionId } : {},
737
+ runtime_target: runtimeTarget
738
+ };
739
+ if (request.method === "POST" && match[2]) response = json(await embed.cancelDictationSession(agentId, sessionId, scope, { signal: request.signal }));
740
+ else if (request.method === "GET" && !match[2]) response = json(await embed.getDictationSession(agentId, sessionId, {
741
+ externalUserId: customerPrincipalRef,
742
+ integrationId,
743
+ externalSessionId: principal.externalSessionId,
744
+ chatScope: resolution.chatScope,
745
+ runtimeTarget,
746
+ agentVersionId,
747
+ signal: request.signal
748
+ }));
749
+ else throw new BffInputError(405, "METHOD_NOT_ALLOWED", "The operation is unavailable.");
715
750
  } else if (request.method === "GET" && path === "/resource-policy") {
716
751
  response = json(await embed.getResourcePolicy(agentId, {
717
752
  external_user_id: customerPrincipalRef,
@@ -748,6 +783,7 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
748
783
  ...resolution.trustedContext === void 0 ? {} : { trustedContext: resolution.trustedContext },
749
784
  ...stringValue(body.requestedModelId) ? { requestedModelId: stringValue(body.requestedModelId) } : {},
750
785
  ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledgeNamespaces: resolution.knowledgeNamespaces },
786
+ ...stringValue(body.dictationSessionId) ? { dictationSessionId: stringValue(body.dictationSessionId) } : {},
751
787
  ...body.requestedOutputs === void 0 ? {} : { requestedOutputs: requestedOutputNames(body.requestedOutputs) },
752
788
  toolInputs: objectValue(body.toolInputs),
753
789
  ...body.metadata === void 0 ? {} : { metadata: objectValue(body.metadata) }
@@ -765,6 +801,7 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
765
801
  attachment_ids: attachmentIds,
766
802
  ...stringValue(body.requestedModelId) ? { requested_model_id: stringValue(body.requestedModelId) } : {},
767
803
  ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: resolution.knowledgeNamespaces },
804
+ ...stringValue(body.dictationSessionId) ? { dictation_session_id: stringValue(body.dictationSessionId) } : {},
768
805
  ...body.requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputNames(body.requestedOutputs) },
769
806
  tool_inputs: objectValue(body.toolInputs),
770
807
  ...body.metadata === void 0 ? {} : { metadata: objectValue(body.metadata) },
@@ -900,7 +937,15 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
900
937
  response = json(await embed.submitAgentThreadMessage(
901
938
  agentId,
902
939
  threadId,
903
- { ...threadIdentity, integrationId, ...messageBody(body), ...resolution.trustedContext === void 0 ? {} : { trustedContext: resolution.trustedContext }, ...resolution.customerTenant === void 0 ? {} : { customerTenant: resolution.customerTenant }, ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledgeNamespaces: resolution.knowledgeNamespaces }, agentVersionId: agentVersionId ?? null },
940
+ {
941
+ ...threadIdentity,
942
+ integrationId,
943
+ ...messageBody(body),
944
+ ...resolution.trustedContext === void 0 ? {} : { trustedContext: resolution.trustedContext },
945
+ ...resolution.customerTenant === void 0 ? {} : { customerTenant: resolution.customerTenant },
946
+ ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledgeNamespaces: resolution.knowledgeNamespaces },
947
+ agentVersionId: agentVersionId ?? null
948
+ },
904
949
  { idempotencyKey }
905
950
  ));
906
951
  } else if (/^\/threads\/[^/]+\/messages\/[^/]+$/.test(path) && request.method === "PATCH") {
@@ -1003,6 +1048,17 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
1003
1048
  response = json(await embed.uploadAgentAttachments(agentId, {
1004
1049
  ...threadIdentity,
1005
1050
  files,
1051
+ ...form.has("transcript_presentations") ? { transcriptPresentations: (() => {
1052
+ const value = stringValue(form.get("transcript_presentations"));
1053
+ let parsed;
1054
+ try {
1055
+ parsed = JSON.parse(value || "null");
1056
+ } catch {
1057
+ throw new BffInputError(400, "INVALID_REQUEST", "Invalid transcript presentation.");
1058
+ }
1059
+ if (!Array.isArray(parsed) || parsed.length !== files.length || parsed.some((item) => item !== "attachment" && item !== "dictation")) throw new BffInputError(400, "INVALID_REQUEST", "Invalid transcript presentation.");
1060
+ return parsed;
1061
+ })() } : {},
1006
1062
  ...stringValue(form.get("thread_id")) ? { threadId: stringValue(form.get("thread_id")) } : {},
1007
1063
  integrationId,
1008
1064
  ...resolution.chatScope === void 0 ? {} : { chatScope: resolution.chatScope },
@@ -1197,6 +1253,12 @@ function createResolvedAgents24BffHandler(options, sharedIdentity) {
1197
1253
  const runId = routeId(path, /^\/runs\/([^/]+)\/outputs/, "runId");
1198
1254
  return dispatchToAgent(await resolveRunAgent(runId));
1199
1255
  }
1256
+ if (path === "/dictation-sessions" || /^\/dictation-sessions\/[^/]+(?:\/cancel)?$/.test(path)) {
1257
+ const message = request.method === "POST" ? await requestJson(request) : void 0;
1258
+ const selected = await requestedAgent(message?.requestedAgentId || url.searchParams.get("requestedAgentId"));
1259
+ assertWritableAgent(selected.agentId, historical);
1260
+ return dispatchToAgent(selected.agentId, message);
1261
+ }
1200
1262
  if (request.method === "POST" && path === "/chat/stream") {
1201
1263
  const body = await requestJson(request);
1202
1264
  const threadId = stringValue(body.threadId);
@@ -1231,6 +1293,7 @@ function createResolvedAgents24BffHandler(options, sharedIdentity) {
1231
1293
  client_submission_id: stringValue(body.clientSubmissionId),
1232
1294
  ...body.relayClientId === null ? { relay_client_id: null } : stringValue(body.relayClientId) ? { relay_client_id: stringValue(body.relayClientId) } : {},
1233
1295
  attachment_ids: attachmentIds,
1296
+ ...stringValue(body.dictationSessionId) ? { dictation_session_id: stringValue(body.dictationSessionId) } : {},
1234
1297
  ...body.requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputNames(body.requestedOutputs) },
1235
1298
  ...stringValue(body.requestedModelId) ? { requested_model_id: stringValue(body.requestedModelId) } : {},
1236
1299
  ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: resolution.knowledgeNamespaces },