@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
@@ -1,5 +1,5 @@
1
1
  {
2
- "contractHash": "b9b9a3f464ed29f9df64462c3104802c5e9a4e7d3ed6f4ecfc078295e4458ed5",
2
+ "contractHash": "0855723f1fcc295edf523aca825e9b9c43b120c10e8ba261979da9eb2cc3768e",
3
3
  "contractVersion": "0.3.0",
4
4
  "corpus": "conformance/v1/corpus.json",
5
5
  "generatedBy": "@agents24/sdk-contract",
@@ -19,7 +19,7 @@
19
19
  "runtime": "run-stream.v3"
20
20
  },
21
21
  "@agents24/node": {
22
- "contract": "b9b9a3f464ed29f9df64462c3104802c5e9a4e7d3ed6f4ecfc078295e4458ed5",
22
+ "contract": "0855723f1fcc295edf523aca825e9b9c43b120c10e8ba261979da9eb2cc3768e",
23
23
  "node": "^22.0.0 || ^24.0.0"
24
24
  },
25
25
  "@agents24/react": {
@@ -31,7 +31,7 @@
31
31
  "protocolOwner": "@agents24/client"
32
32
  },
33
33
  "agents24": {
34
- "contract": "b9b9a3f464ed29f9df64462c3104802c5e9a4e7d3ed6f4ecfc078295e4458ed5",
34
+ "contract": "0855723f1fcc295edf523aca825e9b9c43b120c10e8ba261979da9eb2cc3768e",
35
35
  "python": ">=3.10"
36
36
  }
37
37
  },
@@ -47,8 +47,8 @@
47
47
  },
48
48
  "schemaVersion": "agents24.compatibility.v1",
49
49
  "targetOperationCounts": {
50
- "client": 38,
51
- "node": 202,
52
- "python": 196
50
+ "client": 41,
51
+ "node": 211,
52
+ "python": 205
53
53
  }
54
54
  }
package/dist/bff.cjs CHANGED
@@ -298,6 +298,7 @@ async function submitConversationStream(input) {
298
298
  input: value.input,
299
299
  attachment_ids: value.attachmentIds,
300
300
  client_submission_id: value.clientSubmissionId,
301
+ ...stringValue(body.dictationSessionId) ? { dictation_session_id: stringValue(body.dictationSessionId) } : {},
301
302
  ...input.requestedAgentId ? { requested_agent_id: input.requestedAgentId } : {},
302
303
  ...value.requestedModelId ? { requested_model_id: value.requestedModelId } : {},
303
304
  ...resolution.chatScope === void 0 ? {} : { chat_scope: resolution.chatScope },
@@ -714,6 +715,40 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
714
715
  if (request.method === "GET" && path === "/bootstrap") {
715
716
  const raw = await embed.getRuntimeBootstrap(agentId, agentVersionId, runtimeTarget);
716
717
  response = json(bootstrapDocument(raw, agentVersionId));
718
+ } else if (request.method === "POST" && path === "/dictation-sessions") {
719
+ if (!idempotencyKey) throw new BffInputError(400, "IDEMPOTENCY_REQUIRED", "A dictation operation ID is required.");
720
+ response = json(await embed.createDictationSession(agentId, {
721
+ external_user_id: customerPrincipalRef,
722
+ integration_id: integrationId,
723
+ ...principal.externalSessionId ? { external_session_id: principal.externalSessionId } : {},
724
+ ...resolution.chatScope === void 0 ? {} : { chat_scope: resolution.chatScope },
725
+ ...agentVersionId ? { agent_version_id: agentVersionId } : {},
726
+ runtime_target: runtimeTarget,
727
+ origin: new URL(request.url).origin
728
+ }, { idempotencyKey, signal: request.signal }));
729
+ } else if (path.startsWith("/dictation-sessions/")) {
730
+ const match = /^\/dictation-sessions\/([^/]+)(\/cancel)?$/.exec(path);
731
+ if (!match) throw new BffInputError(404, "NOT_FOUND", "Dictation session is unavailable.");
732
+ const sessionId = decodeURIComponent(match[1]);
733
+ const scope = {
734
+ external_user_id: customerPrincipalRef,
735
+ integration_id: integrationId,
736
+ ...principal.externalSessionId ? { external_session_id: principal.externalSessionId } : {},
737
+ ...resolution.chatScope === void 0 ? {} : { chat_scope: resolution.chatScope },
738
+ ...agentVersionId ? { agent_version_id: agentVersionId } : {},
739
+ runtime_target: runtimeTarget
740
+ };
741
+ if (request.method === "POST" && match[2]) response = json(await embed.cancelDictationSession(agentId, sessionId, scope, { signal: request.signal }));
742
+ else if (request.method === "GET" && !match[2]) response = json(await embed.getDictationSession(agentId, sessionId, {
743
+ externalUserId: customerPrincipalRef,
744
+ integrationId,
745
+ externalSessionId: principal.externalSessionId,
746
+ chatScope: resolution.chatScope,
747
+ runtimeTarget,
748
+ agentVersionId,
749
+ signal: request.signal
750
+ }));
751
+ else throw new BffInputError(405, "METHOD_NOT_ALLOWED", "The operation is unavailable.");
717
752
  } else if (request.method === "GET" && path === "/resource-policy") {
718
753
  response = json(await embed.getResourcePolicy(agentId, {
719
754
  external_user_id: customerPrincipalRef,
@@ -750,6 +785,7 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
750
785
  ...resolution.trustedContext === void 0 ? {} : { trustedContext: resolution.trustedContext },
751
786
  ...stringValue(body.requestedModelId) ? { requestedModelId: stringValue(body.requestedModelId) } : {},
752
787
  ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledgeNamespaces: resolution.knowledgeNamespaces },
788
+ ...stringValue(body.dictationSessionId) ? { dictationSessionId: stringValue(body.dictationSessionId) } : {},
753
789
  ...body.requestedOutputs === void 0 ? {} : { requestedOutputs: requestedOutputNames(body.requestedOutputs) },
754
790
  toolInputs: objectValue(body.toolInputs),
755
791
  ...body.metadata === void 0 ? {} : { metadata: objectValue(body.metadata) }
@@ -767,6 +803,7 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
767
803
  attachment_ids: attachmentIds,
768
804
  ...stringValue(body.requestedModelId) ? { requested_model_id: stringValue(body.requestedModelId) } : {},
769
805
  ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: resolution.knowledgeNamespaces },
806
+ ...stringValue(body.dictationSessionId) ? { dictation_session_id: stringValue(body.dictationSessionId) } : {},
770
807
  ...body.requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputNames(body.requestedOutputs) },
771
808
  tool_inputs: objectValue(body.toolInputs),
772
809
  ...body.metadata === void 0 ? {} : { metadata: objectValue(body.metadata) },
@@ -902,7 +939,15 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
902
939
  response = json(await embed.submitAgentThreadMessage(
903
940
  agentId,
904
941
  threadId,
905
- { ...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 },
942
+ {
943
+ ...threadIdentity,
944
+ integrationId,
945
+ ...messageBody(body),
946
+ ...resolution.trustedContext === void 0 ? {} : { trustedContext: resolution.trustedContext },
947
+ ...resolution.customerTenant === void 0 ? {} : { customerTenant: resolution.customerTenant },
948
+ ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledgeNamespaces: resolution.knowledgeNamespaces },
949
+ agentVersionId: agentVersionId ?? null
950
+ },
906
951
  { idempotencyKey }
907
952
  ));
908
953
  } else if (/^\/threads\/[^/]+\/messages\/[^/]+$/.test(path) && request.method === "PATCH") {
@@ -1005,6 +1050,17 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
1005
1050
  response = json(await embed.uploadAgentAttachments(agentId, {
1006
1051
  ...threadIdentity,
1007
1052
  files,
1053
+ ...form.has("transcript_presentations") ? { transcriptPresentations: (() => {
1054
+ const value = stringValue(form.get("transcript_presentations"));
1055
+ let parsed;
1056
+ try {
1057
+ parsed = JSON.parse(value || "null");
1058
+ } catch {
1059
+ throw new BffInputError(400, "INVALID_REQUEST", "Invalid transcript presentation.");
1060
+ }
1061
+ if (!Array.isArray(parsed) || parsed.length !== files.length || parsed.some((item) => item !== "attachment" && item !== "dictation")) throw new BffInputError(400, "INVALID_REQUEST", "Invalid transcript presentation.");
1062
+ return parsed;
1063
+ })() } : {},
1008
1064
  ...stringValue(form.get("thread_id")) ? { threadId: stringValue(form.get("thread_id")) } : {},
1009
1065
  integrationId,
1010
1066
  ...resolution.chatScope === void 0 ? {} : { chatScope: resolution.chatScope },
@@ -1199,6 +1255,12 @@ function createResolvedAgents24BffHandler(options, sharedIdentity) {
1199
1255
  const runId = routeId(path, /^\/runs\/([^/]+)\/outputs/, "runId");
1200
1256
  return dispatchToAgent(await resolveRunAgent(runId));
1201
1257
  }
1258
+ if (path === "/dictation-sessions" || /^\/dictation-sessions\/[^/]+(?:\/cancel)?$/.test(path)) {
1259
+ const message = request.method === "POST" ? await requestJson(request) : void 0;
1260
+ const selected = await requestedAgent(message?.requestedAgentId || url.searchParams.get("requestedAgentId"));
1261
+ assertWritableAgent(selected.agentId, historical);
1262
+ return dispatchToAgent(selected.agentId, message);
1263
+ }
1202
1264
  if (request.method === "POST" && path === "/chat/stream") {
1203
1265
  const body = await requestJson(request);
1204
1266
  const threadId = stringValue(body.threadId);
@@ -1233,6 +1295,7 @@ function createResolvedAgents24BffHandler(options, sharedIdentity) {
1233
1295
  client_submission_id: stringValue(body.clientSubmissionId),
1234
1296
  ...body.relayClientId === null ? { relay_client_id: null } : stringValue(body.relayClientId) ? { relay_client_id: stringValue(body.relayClientId) } : {},
1235
1297
  attachment_ids: attachmentIds,
1298
+ ...stringValue(body.dictationSessionId) ? { dictation_session_id: stringValue(body.dictationSessionId) } : {},
1236
1299
  ...body.requestedOutputs === void 0 ? {} : { requested_outputs: requestedOutputNames(body.requestedOutputs) },
1237
1300
  ...stringValue(body.requestedModelId) ? { requested_model_id: stringValue(body.requestedModelId) } : {},
1238
1301
  ...resolution.knowledgeNamespaces === void 0 ? {} : { knowledge_namespaces: resolution.knowledgeNamespaces },