@agents24/node 0.5.11 → 0.5.13

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.
@@ -1,5 +1,5 @@
1
1
  {
2
- "contractHash": "dd147d991227abbd4733d63e7203e32b1e918df689d540681dec0d0678311af1",
2
+ "contractHash": "4eafcf792d4e39243e0d8261c45959252f575ff291d3bba9d722d0d172588e22",
3
3
  "contractVersion": "0.3.0",
4
4
  "corpus": "conformance/v1/corpus.json",
5
5
  "generatedBy": "@agents24/sdk-contract",
@@ -15,11 +15,11 @@
15
15
  "reactDom": ">=19 <20"
16
16
  },
17
17
  "@agents24/client": {
18
- "contract": "f936f83dc38a06dcf3690e0c0474a5558704cb1c866b0a688d62a4514a5a81cf",
18
+ "contract": "37437aff006eec5ea404f4259bf2e8cb0ba442ecc5aa72b4d39964530899d58a",
19
19
  "runtime": "run-stream.v3"
20
20
  },
21
21
  "@agents24/node": {
22
- "contract": "dd147d991227abbd4733d63e7203e32b1e918df689d540681dec0d0678311af1",
22
+ "contract": "4eafcf792d4e39243e0d8261c45959252f575ff291d3bba9d722d0d172588e22",
23
23
  "node": "^22.0.0 || ^24.0.0"
24
24
  },
25
25
  "@agents24/react": {
@@ -27,11 +27,11 @@
27
27
  "react": ">=19 <20"
28
28
  },
29
29
  "@talmudpedia/runtime-sdk": {
30
- "contract": "f936f83dc38a06dcf3690e0c0474a5558704cb1c866b0a688d62a4514a5a81cf",
30
+ "contract": "37437aff006eec5ea404f4259bf2e8cb0ba442ecc5aa72b4d39964530899d58a",
31
31
  "protocolOwner": "@agents24/client"
32
32
  },
33
33
  "agents24": {
34
- "contract": "dd147d991227abbd4733d63e7203e32b1e918df689d540681dec0d0678311af1",
34
+ "contract": "4eafcf792d4e39243e0d8261c45959252f575ff291d3bba9d722d0d172588e22",
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": 22,
51
- "node": 112,
52
- "python": 105
50
+ "client": 31,
51
+ "node": 139,
52
+ "python": 132
53
53
  }
54
54
  }
package/dist/bff.cjs CHANGED
@@ -215,6 +215,41 @@ function reportFailureResponse(callback, request, operation, response) {
215
215
  return response;
216
216
  }
217
217
 
218
+ // src/bff-sse.ts
219
+ function sseHeaders(headers) {
220
+ const result = new Headers(headers);
221
+ result.set("Cache-Control", "no-cache, no-transform");
222
+ result.set("Content-Type", "text/event-stream; charset=utf-8");
223
+ result.set("X-Accel-Buffering", "no");
224
+ return result;
225
+ }
226
+ function sseResponse(execute, headers, failurePayload, onFailure) {
227
+ const stream = new TransformStream();
228
+ const writer = stream.writable.getWriter();
229
+ const encoder = new TextEncoder();
230
+ const write = (value) => writer.write(encoder.encode(`data: ${JSON.stringify(value)}
231
+
232
+ `));
233
+ void execute(write).catch(async (error) => {
234
+ onFailure?.(error);
235
+ if (failurePayload) {
236
+ await write(failurePayload(error)).catch(() => void 0);
237
+ return;
238
+ }
239
+ const event = {
240
+ version: "run-stream.v3",
241
+ seq: Number.MAX_SAFE_INTEGER,
242
+ ts: (/* @__PURE__ */ new Date()).toISOString(),
243
+ event: "run.failed",
244
+ run_id: "bff-stream-error",
245
+ stage: "run",
246
+ payload: { error: "The Agent stream failed." }
247
+ };
248
+ await write(event).catch(() => void 0);
249
+ }).finally(() => writer.close().catch(() => void 0));
250
+ return new Response(stream.readable, { headers: sseHeaders(headers) });
251
+ }
252
+
218
253
  // src/bff-values.ts
219
254
  function normalized(value, field) {
220
255
  const result = String(value || "").trim();
@@ -355,39 +390,49 @@ function routeId(path, pattern, field) {
355
390
  throw new BffInputError(400, "INVALID_PATH", `${field} is invalid.`);
356
391
  }
357
392
  }
358
- function sseHeaders(headers) {
359
- const result = new Headers(headers);
360
- result.set("Cache-Control", "no-cache, no-transform");
361
- result.set("Content-Type", "text/event-stream; charset=utf-8");
362
- result.set("X-Accel-Buffering", "no");
363
- return result;
393
+ function messageBody(body) {
394
+ const mode = body.mode === "steer" ? "steer" : body.mode === "queue" ? "queue" : null;
395
+ if (!mode) throw new BffInputError(400, "INVALID_MODE", "Message mode must be queue or steer.");
396
+ const input = stringValue(body.input) ?? "";
397
+ const attachmentIds = stringList(body.attachmentIds);
398
+ if (!input && attachmentIds.length === 0) throw new BffInputError(400, "INPUT_REQUIRED", "A message or attachment is required.");
399
+ if (input.length > MAX_INPUT_LENGTH) throw new BffInputError(413, "INPUT_TOO_LARGE", "The message is too large.");
400
+ if (attachmentIds.length > MAX_ATTACHMENTS) throw new BffInputError(400, "TOO_MANY_ATTACHMENTS", "Too many attachments.");
401
+ if (mode === "steer" && attachmentIds.length) throw new BffInputError(400, "STEER_TEXT_ONLY", "Steering supports text only.");
402
+ const requestedModelId = stringValue(body.requestedModelId) || void 0;
403
+ return {
404
+ mode,
405
+ input,
406
+ attachmentIds,
407
+ ...requestedModelId ? { requestedModelId } : {},
408
+ toolInputs: objectValue(body.toolInputs),
409
+ metadata: objectValue(body.metadata)
410
+ };
364
411
  }
365
- function sseResponse(execute, headers, failurePayload, onFailure) {
366
- const stream = new TransformStream();
367
- const writer = stream.writable.getWriter();
368
- const encoder = new TextEncoder();
369
- const write = (value) => writer.write(encoder.encode(`data: ${JSON.stringify(value)}
370
-
371
- `));
372
- void execute(write).catch(async (error) => {
373
- onFailure?.(error);
374
- if (failurePayload) {
375
- await write(failurePayload(error)).catch(() => void 0);
376
- return;
377
- }
378
- const message = "The Agent stream failed.";
379
- const event = {
380
- version: "run-stream.v3",
381
- seq: Number.MAX_SAFE_INTEGER,
382
- ts: (/* @__PURE__ */ new Date()).toISOString(),
383
- event: "run.failed",
384
- run_id: "bff-stream-error",
385
- stage: "run",
386
- payload: { error: message }
387
- };
388
- await write(event).catch(() => void 0);
389
- }).finally(() => writer.close().catch(() => void 0));
390
- return new Response(stream.readable, { headers: sseHeaders(headers) });
412
+ function messageRevision(value) {
413
+ const revision = Number(value);
414
+ if (!Number.isInteger(revision) || revision < 1) throw new BffInputError(400, "INVALID_REVISION", "Message revision is invalid.");
415
+ return revision;
416
+ }
417
+ function computerFileQuery(url, requirePath) {
418
+ const path = url.searchParams.get("path") || void 0;
419
+ if (requirePath && !path) throw new BffInputError(400, "INVALID_PATH", "path is required.");
420
+ if (path && path.length > 1024) throw new BffInputError(400, "INVALID_PATH", "path is too long.");
421
+ const rawCursor = url.searchParams.get("cursor");
422
+ const rawLimit = url.searchParams.get("limit");
423
+ const cursor = rawCursor === null ? void 0 : Number(rawCursor);
424
+ const limit = rawLimit === null ? void 0 : Number(rawLimit);
425
+ if (cursor !== void 0 && (!Number.isInteger(cursor) || cursor < 0)) {
426
+ throw new BffInputError(400, "INVALID_PAGINATION", "cursor is invalid.");
427
+ }
428
+ if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 200)) {
429
+ throw new BffInputError(400, "INVALID_PAGINATION", "limit is invalid.");
430
+ }
431
+ return {
432
+ ...path ? { path } : {},
433
+ ...cursor !== void 0 ? { cursor } : {},
434
+ ...limit !== void 0 ? { limit } : {}
435
+ };
391
436
  }
392
437
  function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity) {
393
438
  const agentId = normalized(options.agentId, "agentId");
@@ -445,7 +490,8 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
445
490
  }));
446
491
  } else if (request.method === "POST" && path === "/chat/stream") {
447
492
  const body = await requestJson(request);
448
- const input = stringValue(body.input);
493
+ const input = stringValue(body.input) ?? "";
494
+ const threadId = stringValue(body.threadId);
449
495
  const attachmentIds = stringList(body.attachmentIds);
450
496
  if (!input && attachmentIds.length === 0) throw new BffInputError(400, "INPUT_REQUIRED", "A message or attachment is required.");
451
497
  if (input && input.length > MAX_INPUT_LENGTH) {
@@ -454,32 +500,47 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
454
500
  if (attachmentIds.length > MAX_ATTACHMENTS) {
455
501
  throw new BffInputError(400, "TOO_MANY_ATTACHMENTS", `At most ${MAX_ATTACHMENTS} attachments are allowed.`);
456
502
  }
457
- const admission = await embed.startAgentRun(agentId, {
503
+ const admission = threadId ? await embed.submitAgentThreadMessage(agentId, threadId, {
504
+ externalUserId: customerPrincipalRef,
505
+ ...principal.externalSessionId ? { externalSessionId: principal.externalSessionId } : {},
506
+ integrationId,
507
+ runtimeTarget,
508
+ mode: "queue",
509
+ input,
510
+ attachmentIds,
511
+ ...stringValue(body.requestedModelId) ? { requestedModelId: stringValue(body.requestedModelId) } : {},
512
+ toolInputs: objectValue(body.toolInputs),
513
+ metadata: objectValue(body.metadata)
514
+ }, { idempotencyKey }) : await embed.startAgentRun(agentId, {
458
515
  ...identity,
459
516
  integration_id: integrationId,
460
517
  ...agentVersionId ? { agent_version_id: agentVersionId } : {},
461
518
  runtime_target: runtimeTarget,
462
519
  ...input ? { input } : {},
463
520
  attachment_ids: attachmentIds,
464
- ...stringValue(body.threadId) ? { thread_id: stringValue(body.threadId) } : {},
465
521
  ...stringValue(body.requestedModelId) ? { requested_model_id: stringValue(body.requestedModelId) } : {},
466
522
  tool_inputs: objectValue(body.toolInputs),
467
523
  metadata: objectValue(body.metadata),
468
524
  client: objectValue(body.client)
469
525
  }, { idempotencyKey });
470
- response = sseResponse(async (write) => {
471
- await embed.attachAgentRun(agentId, admission.run_id, {
472
- ...identity,
473
- integration_id: integrationId,
474
- runtime_target: runtimeTarget,
475
- metadata: objectValue(body.metadata),
476
- client: objectValue(body.client),
477
- cursor: 0
478
- }, (event) => write(event), { signal: request.signal });
479
- }, {
480
- "X-Run-ID": admission.run_id,
481
- ...admission.thread_id ? { "X-Thread-ID": admission.thread_id } : {}
482
- }, void 0, streamFailure(request, "chat.stream"));
526
+ const admittedRunId = admission.run_id;
527
+ if (!admittedRunId) {
528
+ response = json(admission, void 0, 202);
529
+ } else {
530
+ response = sseResponse(async (write) => {
531
+ await embed.attachAgentRun(agentId, admittedRunId, {
532
+ ...identity,
533
+ integration_id: integrationId,
534
+ runtime_target: runtimeTarget,
535
+ metadata: objectValue(body.metadata),
536
+ client: objectValue(body.client),
537
+ cursor: 0
538
+ }, (event) => write(event), { signal: request.signal });
539
+ }, {
540
+ "X-Run-ID": admittedRunId,
541
+ ...admission.thread_id ? { "X-Thread-ID": admission.thread_id } : {}
542
+ }, void 0, streamFailure(request, "chat.stream"));
543
+ }
483
544
  } else if (request.method === "POST" && /^\/runs\/[^/]+\/attach$/.test(path)) {
484
545
  const runId = routeId(path, /^\/runs\/([^/]+)\/attach$/, "runId");
485
546
  const body = await requestJson(request);
@@ -560,6 +621,80 @@ function createAgents24BffHandlerWithResolver(options, resolveCustomerIdentity)
560
621
  cursor,
561
622
  reason: "stream_failed"
562
623
  }), streamFailure(request, "threads.events"));
624
+ } else if (/^\/threads\/[^/]+\/messages$/.test(path) && request.method === "GET") {
625
+ const threadId = routeId(path, /^\/threads\/([^/]+)\/messages$/, "threadId");
626
+ const before = url.searchParams.has("before") ? messageRevision(url.searchParams.get("before")) : void 0;
627
+ const limit = url.searchParams.has("limit") ? messageRevision(url.searchParams.get("limit")) : void 0;
628
+ if (limit !== void 0 && limit > 100) throw new BffInputError(400, "INVALID_PAGINATION", "limit is too large.");
629
+ response = json(await embed.listAgentThreadMessages(agentId, threadId, { ...threadIdentity, integrationId, before, limit }));
630
+ } else if (/^\/threads\/[^/]+\/messages$/.test(path) && request.method === "POST") {
631
+ const threadId = routeId(path, /^\/threads\/([^/]+)\/messages$/, "threadId");
632
+ const body = await requestJson(request);
633
+ response = json(await embed.submitAgentThreadMessage(
634
+ agentId,
635
+ threadId,
636
+ { ...threadIdentity, integrationId, ...messageBody(body) },
637
+ { idempotencyKey }
638
+ ));
639
+ } else if (/^\/threads\/[^/]+\/messages\/[^/]+$/.test(path) && request.method === "PATCH") {
640
+ const threadId = routeId(path, /^\/threads\/([^/]+)\/messages\//, "threadId");
641
+ const messageId = routeId(path, /\/messages\/([^/]+)$/, "messageId");
642
+ const body = await requestJson(request);
643
+ const input = stringValue(body.input) ?? "";
644
+ const attachmentIds = stringList(body.attachmentIds);
645
+ if (!input && !attachmentIds.length) throw new BffInputError(400, "INPUT_REQUIRED", "A message or attachment is required.");
646
+ const mode = body.mode === void 0 ? void 0 : stringValue(body.mode);
647
+ if (mode !== void 0 && mode !== "steer") throw new BffInputError(400, "INVALID_MODE", "Message mode must be steer.");
648
+ if (mode === "steer" && attachmentIds.length) throw new BffInputError(400, "STEER_TEXT_ONLY", "Steering supports text only.");
649
+ if (input.length > MAX_INPUT_LENGTH || attachmentIds.length > MAX_ATTACHMENTS) throw new BffInputError(400, "INVALID_MESSAGE", "Message limits exceeded.");
650
+ response = json(await embed.editAgentThreadMessage(
651
+ agentId,
652
+ threadId,
653
+ messageId,
654
+ {
655
+ ...threadIdentity,
656
+ integrationId,
657
+ revision: messageRevision(body.revision),
658
+ input,
659
+ attachmentIds,
660
+ ...mode ? { mode } : {},
661
+ ...stringValue(body.requestedModelId) ? { requestedModelId: stringValue(body.requestedModelId) } : {}
662
+ }
663
+ ));
664
+ } else if (/^\/threads\/[^/]+\/messages\/[^/]+$/.test(path) && request.method === "DELETE") {
665
+ const threadId = routeId(path, /^\/threads\/([^/]+)\/messages\//, "threadId");
666
+ const messageId = routeId(path, /\/messages\/([^/]+)$/, "messageId");
667
+ response = json(await embed.removeAgentThreadMessage(
668
+ agentId,
669
+ threadId,
670
+ messageId,
671
+ { ...threadIdentity, integrationId, revision: messageRevision(url.searchParams.get("revision")) }
672
+ ));
673
+ } else if (/^\/threads\/[^/]+\/queue\/resume$/.test(path) && request.method === "POST") {
674
+ const threadId = routeId(path, /^\/threads\/([^/]+)\/queue\/resume$/, "threadId");
675
+ response = json(await embed.resumeAgentThreadQueue(agentId, threadId, { ...threadIdentity, integrationId }));
676
+ } else if (/^\/threads\/[^/]+\/computer(?:\/files|\/file|\/content-access)?$/.test(path) && (request.method === "GET" || request.method === "POST" && path.endsWith("/content-access"))) {
677
+ const threadId = routeId(path, /^\/threads\/([^/]+)\/computer/, "threadId");
678
+ const scope = { ...threadIdentity, integrationId, runtimeTarget };
679
+ if (path.endsWith("/content-access")) {
680
+ response = json(await embed.createAgentComputerContentAccess(agentId, threadId, {
681
+ ...scope,
682
+ path: computerFileQuery(url, true).path,
683
+ download: url.searchParams.get("download") === "true"
684
+ }));
685
+ } else if (path.endsWith("/files")) {
686
+ response = json(await embed.listAgentComputerFiles(agentId, threadId, {
687
+ ...scope,
688
+ ...computerFileQuery(url, false)
689
+ }));
690
+ } else if (path.endsWith("/file")) {
691
+ response = json(await embed.readAgentComputerFile(agentId, threadId, {
692
+ ...scope,
693
+ path: computerFileQuery(url, true).path
694
+ }));
695
+ } else {
696
+ response = json(await embed.getAgentComputer(agentId, threadId, scope));
697
+ }
563
698
  } else if (/^\/threads\/[^/]+$/.test(path) && request.method === "GET") {
564
699
  const threadId = routeId(path, /^\/threads\/([^/]+)$/, "threadId");
565
700
  const rawBefore = url.searchParams.get("before_turn_index");
@@ -752,6 +887,16 @@ function createResolvedAgents24BffHandler(options) {
752
887
  });
753
888
  return requestedAgent(result.agent_id).agentId;
754
889
  };
890
+ const resolveThreadAgent = async (threadId) => {
891
+ const detail = await options.client.embed.getConversationThread(threadId, {
892
+ agentIds: agents.map((agent) => agent.agentId),
893
+ externalUserId,
894
+ ...resolution.principal.externalSessionId ? { externalSessionId: resolution.principal.externalSessionId } : {},
895
+ integrationId,
896
+ runtimeTarget
897
+ });
898
+ return requestedAgent(detail.runtime_selection?.agent_id).agentId;
899
+ };
755
900
  if (request.method === "GET" && path === "/bootstrap") {
756
901
  const candidates = await Promise.all(agents.map(async (agent) => {
757
902
  const [raw, policy] = await Promise.all([
@@ -798,25 +943,38 @@ function createResolvedAgents24BffHandler(options) {
798
943
  const body = await requestJson(request);
799
944
  const selected = requestedAgent(body.requestedAgentId);
800
945
  const input = stringValue(body.input);
946
+ const threadId = stringValue(body.threadId);
801
947
  const attachmentIds = stringList(body.attachmentIds);
802
948
  if (!input && attachmentIds.length === 0) throw new BffInputError(400, "INPUT_REQUIRED", "A message or attachment is required.");
803
949
  if (input && input.length > MAX_INPUT_LENGTH) throw new BffInputError(413, "INPUT_TOO_LARGE", "The message is too large.");
804
950
  if (attachmentIds.length > MAX_ATTACHMENTS) throw new BffInputError(400, "TOO_MANY_ATTACHMENTS", `At most ${MAX_ATTACHMENTS} attachments are allowed.`);
805
- const admission = await options.client.embed.startAgentRun(selected.agentId, {
951
+ const admission = threadId ? await options.client.embed.submitAgentThreadMessage(selected.agentId, threadId, {
952
+ externalUserId,
953
+ ...resolution.principal.externalSessionId ? { externalSessionId: resolution.principal.externalSessionId } : {},
954
+ integrationId,
955
+ runtimeTarget,
956
+ mode: "queue",
957
+ input: input ?? "",
958
+ attachmentIds,
959
+ ...stringValue(body.requestedModelId) ? { requestedModelId: stringValue(body.requestedModelId) } : {},
960
+ toolInputs: objectValue(body.toolInputs),
961
+ metadata: objectValue(body.metadata)
962
+ }, { idempotencyKey: stringValue(request.headers.get("idempotency-key")) }) : await options.client.embed.startAgentRun(selected.agentId, {
806
963
  ...identity,
807
964
  ...selected.agentVersionId ? { agent_version_id: selected.agentVersionId } : {},
808
965
  runtime_target: runtimeTarget,
809
966
  integration_id: integrationId,
810
967
  ...input ? { input } : {},
811
968
  attachment_ids: attachmentIds,
812
- ...stringValue(body.threadId) ? { thread_id: stringValue(body.threadId) } : {},
813
969
  ...stringValue(body.requestedModelId) ? { requested_model_id: stringValue(body.requestedModelId) } : {},
814
970
  tool_inputs: objectValue(body.toolInputs),
815
971
  metadata: objectValue(body.metadata),
816
972
  client: objectValue(body.client)
817
973
  }, { idempotencyKey: stringValue(request.headers.get("idempotency-key")) });
974
+ const admittedRunId = admission.run_id;
975
+ if (!admittedRunId) return mergeHeaders(json(admission, void 0, 202), resolution.responseHeaders);
818
976
  return mergeHeaders(sseResponse(async (write) => {
819
- await options.client.embed.attachAgentRun(selected.agentId, admission.run_id, {
977
+ await options.client.embed.attachAgentRun(selected.agentId, admittedRunId, {
820
978
  ...identity,
821
979
  runtime_target: runtimeTarget,
822
980
  integration_id: integrationId,
@@ -825,7 +983,7 @@ function createResolvedAgents24BffHandler(options) {
825
983
  cursor: 0
826
984
  }, (event) => write(event), { signal: request.signal });
827
985
  }, {
828
- "X-Run-ID": admission.run_id,
986
+ "X-Run-ID": admittedRunId,
829
987
  ...admission.thread_id ? { "X-Thread-ID": admission.thread_id } : {}
830
988
  }, void 0, (error) => reportFailureResponse(options.onDiagnostic, request, "chat.stream", errorResponse(error))), resolution.responseHeaders);
831
989
  }
@@ -868,6 +1026,40 @@ function createResolvedAgents24BffHandler(options) {
868
1026
  reason: "stream_failed"
869
1027
  }), (error) => reportFailureResponse(options.onDiagnostic, request, "threads.events", errorResponse(error))), resolution.responseHeaders);
870
1028
  }
1029
+ if (/^\/threads\/[^/]+\/(?:messages(?:\/[^/]+)?|queue\/resume)$/.test(path) && ["GET", "POST", "PATCH", "DELETE"].includes(request.method)) {
1030
+ const threadId = routeId(path, /^\/threads\/([^/]+)\//, "threadId");
1031
+ return dispatchToAgent(await resolveThreadAgent(threadId));
1032
+ }
1033
+ if (/^\/threads\/[^/]+\/computer(?:\/files|\/file|\/content-access)?$/.test(path) && (request.method === "GET" || request.method === "POST" && path.endsWith("/content-access"))) {
1034
+ const threadId = routeId(path, /^\/threads\/([^/]+)\/computer/, "threadId");
1035
+ const scope = {
1036
+ agentIds: agents.map((agent) => agent.agentId),
1037
+ externalUserId,
1038
+ ...resolution.principal.externalSessionId ? { externalSessionId: resolution.principal.externalSessionId } : {},
1039
+ integrationId,
1040
+ runtimeTarget
1041
+ };
1042
+ if (path.endsWith("/content-access")) {
1043
+ return mergeHeaders(json(await options.client.embed.createConversationComputerContentAccess(threadId, {
1044
+ ...scope,
1045
+ path: computerFileQuery(url, true).path,
1046
+ download: url.searchParams.get("download") === "true"
1047
+ })), resolution.responseHeaders);
1048
+ }
1049
+ if (path.endsWith("/files")) {
1050
+ return mergeHeaders(json(await options.client.embed.listConversationComputerFiles(threadId, {
1051
+ ...scope,
1052
+ ...computerFileQuery(url, false)
1053
+ })), resolution.responseHeaders);
1054
+ }
1055
+ if (path.endsWith("/file")) {
1056
+ return mergeHeaders(json(await options.client.embed.readConversationComputerFile(threadId, {
1057
+ ...scope,
1058
+ path: computerFileQuery(url, true).path
1059
+ })), resolution.responseHeaders);
1060
+ }
1061
+ return mergeHeaders(json(await options.client.embed.getConversationComputer(threadId, scope)), resolution.responseHeaders);
1062
+ }
871
1063
  if (/^\/threads\/[^/]+$/.test(path) && request.method === "GET") {
872
1064
  const threadId = routeId(path, /^\/threads\/([^/]+)$/, "threadId");
873
1065
  const rawBefore = url.searchParams.get("before_turn_index");