@agents24/node 0.5.34 → 0.5.36

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 (43) hide show
  1. package/README.md +5 -1
  2. package/compatibility.json +6 -6
  3. package/dist/bff.cjs +65 -1
  4. package/dist/bff.cjs.map +1 -1
  5. package/dist/bff.d.cts +1 -1
  6. package/dist/bff.d.ts +1 -1
  7. package/dist/bff.js +65 -1
  8. package/dist/bff.js.map +1 -1
  9. package/dist/{client-CY0o68YO.d.cts → client-YSS2tctB.d.cts} +289 -3
  10. package/dist/{client-CY0o68YO.d.ts → client-YSS2tctB.d.ts} +289 -3
  11. package/dist/index.cjs +213 -7
  12. package/dist/index.cjs.map +1 -1
  13. package/dist/index.d.cts +3 -3
  14. package/dist/index.d.ts +3 -3
  15. package/dist/index.js +213 -7
  16. package/dist/index.js.map +1 -1
  17. package/dist/types/agents.d.ts +4 -0
  18. package/dist/types/agents.d.ts.map +1 -1
  19. package/dist/types/bff-conversation-submission.d.ts.map +1 -1
  20. package/dist/types/bff-multi-agent.d.ts.map +1 -1
  21. package/dist/types/bff-single-agent.d.ts.map +1 -1
  22. package/dist/types/embed-run-wait.d.ts +4 -1
  23. package/dist/types/embed-run-wait.d.ts.map +1 -1
  24. package/dist/types/embed-types.d.ts +8 -0
  25. package/dist/types/embed-types.d.ts.map +1 -1
  26. package/dist/types/embed.d.ts.map +1 -1
  27. package/dist/types/generated/dictation.d.ts +99 -0
  28. package/dist/types/generated/dictation.d.ts.map +1 -0
  29. package/dist/types/generated/embed.d.ts +15 -1
  30. package/dist/types/generated/embed.d.ts.map +1 -1
  31. package/dist/types/generated/ingestion-types.d.ts +2 -0
  32. package/dist/types/generated/ingestion-types.d.ts.map +1 -1
  33. package/dist/types/generated/manifest.d.ts +1 -1
  34. package/dist/types/generated/manifest.d.ts.map +1 -1
  35. package/dist/types/generated/model-capabilities.d.ts +2 -2
  36. package/dist/types/generated/model-capabilities.d.ts.map +1 -1
  37. package/dist/types/generated/personal-skills.d.ts +174 -0
  38. package/dist/types/generated/personal-skills.d.ts.map +1 -0
  39. package/dist/types/generated/run-usage.d.ts +2 -0
  40. package/dist/types/generated/run-usage.d.ts.map +1 -1
  41. package/dist/types/types.d.ts +39 -0
  42. package/dist/types/types.d.ts.map +1 -1
  43. 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-YSS2tctB.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-YSS2tctB.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) },
@@ -814,6 +851,7 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
814
851
  onControl: control,
815
852
  leaseSeconds: 60,
816
853
  streamFeatures: url.searchParams.get("stream_features") || "",
854
+ onPreview: (frame) => write(frame),
817
855
  ...url.searchParams.get("thread_id") ? { threadId: url.searchParams.get("thread_id") } : {}
818
856
  });
819
857
  }, void 0, void 0, streamFailure(request, "run.attach"), request.signal);
@@ -900,7 +938,15 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
900
938
  response = json(await embed.submitAgentThreadMessage(
901
939
  agentId,
902
940
  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 },
941
+ {
942
+ ...threadIdentity,
943
+ integrationId,
944
+ ...messageBody(body),
945
+ ...resolution.trustedContext === void 0 ? {} : { trustedContext: resolution.trustedContext },
946
+ ...resolution.customerTenant === void 0 ? {} : { customerTenant: resolution.customerTenant },
947
+ ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledgeNamespaces: resolution.knowledgeNamespaces },
948
+ agentVersionId: agentVersionId ?? null
949
+ },
904
950
  { idempotencyKey }
905
951
  ));
906
952
  } else if (/^\/threads\/[^/]+\/messages\/[^/]+$/.test(path) && request.method === "PATCH") {
@@ -1003,6 +1049,17 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
1003
1049
  response = json(await embed.uploadAgentAttachments(agentId, {
1004
1050
  ...threadIdentity,
1005
1051
  files,
1052
+ ...form.has("transcript_presentations") ? { transcriptPresentations: (() => {
1053
+ const value = stringValue(form.get("transcript_presentations"));
1054
+ let parsed;
1055
+ try {
1056
+ parsed = JSON.parse(value || "null");
1057
+ } catch {
1058
+ throw new BffInputError(400, "INVALID_REQUEST", "Invalid transcript presentation.");
1059
+ }
1060
+ if (!Array.isArray(parsed) || parsed.length !== files.length || parsed.some((item) => item !== "attachment" && item !== "dictation")) throw new BffInputError(400, "INVALID_REQUEST", "Invalid transcript presentation.");
1061
+ return parsed;
1062
+ })() } : {},
1006
1063
  ...stringValue(form.get("thread_id")) ? { threadId: stringValue(form.get("thread_id")) } : {},
1007
1064
  integrationId,
1008
1065
  ...resolution.chatScope === void 0 ? {} : { chatScope: resolution.chatScope },
@@ -1197,6 +1254,12 @@ function createResolvedAgents24BffHandler(options, sharedIdentity) {
1197
1254
  const runId = routeId(path, /^\/runs\/([^/]+)\/outputs/, "runId");
1198
1255
  return dispatchToAgent(await resolveRunAgent(runId));
1199
1256
  }
1257
+ if (path === "/dictation-sessions" || /^\/dictation-sessions\/[^/]+(?:\/cancel)?$/.test(path)) {
1258
+ const message = request.method === "POST" ? await requestJson(request) : void 0;
1259
+ const selected = await requestedAgent(message?.requestedAgentId || url.searchParams.get("requestedAgentId"));
1260
+ assertWritableAgent(selected.agentId, historical);
1261
+ return dispatchToAgent(selected.agentId, message);
1262
+ }
1200
1263
  if (request.method === "POST" && path === "/chat/stream") {
1201
1264
  const body = await requestJson(request);
1202
1265
  const threadId = stringValue(body.threadId);
@@ -1231,6 +1294,7 @@ function createResolvedAgents24BffHandler(options, sharedIdentity) {
1231
1294
  client_submission_id: stringValue(body.clientSubmissionId),
1232
1295
  ...body.relayClientId === null ? { relay_client_id: null } : stringValue(body.relayClientId) ? { relay_client_id: stringValue(body.relayClientId) } : {},
1233
1296
  attachment_ids: attachmentIds,
1297
+ ...stringValue(body.dictationSessionId) ? { dictation_session_id: stringValue(body.dictationSessionId) } : {},
1234
1298
  ...body.requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputNames(body.requestedOutputs) },
1235
1299
  ...stringValue(body.requestedModelId) ? { requested_model_id: stringValue(body.requestedModelId) } : {},
1236
1300
  ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: resolution.knowledgeNamespaces },