@agents24/node 0.5.12 → 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.
package/dist/index.cjs CHANGED
@@ -235,6 +235,51 @@ var AgentsNamespace = class {
235
235
  startRun(agentId, payload, options) {
236
236
  return this.http.requestJson(`/agents/${agentId}/run`, { method: "POST", body: payload, options, mutation: true });
237
237
  }
238
+ listThreadMessages(agentId, threadId, query) {
239
+ return this.http.requestJson(`/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/messages`, { query });
240
+ }
241
+ submitThreadMessage(agentId, threadId, payload, options) {
242
+ return this.http.requestJson(`/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/messages`, {
243
+ method: "POST",
244
+ body: {
245
+ mode: payload.mode,
246
+ input: payload.input,
247
+ attachment_ids: payload.attachmentIds ?? [],
248
+ requested_agent_id: payload.requestedAgentId,
249
+ requested_model_id: payload.requestedModelId
250
+ },
251
+ options,
252
+ mutation: true
253
+ });
254
+ }
255
+ editPendingMessage(agentId, message, payload) {
256
+ return this.http.requestJson(`/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(message.thread_id)}/messages/${encodeURIComponent(message.id)}`, {
257
+ method: "PATCH",
258
+ body: {
259
+ revision: message.revision,
260
+ input: payload.input,
261
+ mode: payload.mode,
262
+ attachment_ids: payload.attachmentIds ?? message.attachment_ids,
263
+ requested_agent_id: payload.requestedAgentId,
264
+ requested_model_id: payload.requestedModelId
265
+ },
266
+ mutation: true
267
+ });
268
+ }
269
+ removePendingMessage(agentId, message) {
270
+ return this.http.requestJson(`/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(message.thread_id)}/messages/${encodeURIComponent(message.id)}`, {
271
+ method: "DELETE",
272
+ query: { revision: message.revision },
273
+ mutation: true
274
+ });
275
+ }
276
+ resumeThreadQueue(agentId, threadId) {
277
+ return this.http.requestJson(`/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/queue/resume`, {
278
+ method: "POST",
279
+ body: {},
280
+ mutation: true
281
+ });
282
+ }
238
283
  async stream(agentId, payload, onEvent, mode, options = {}) {
239
284
  const response = await this.http.fetchOrThrow(this.http.url(`/agents/${agentId}/stream`, { mode }), {
240
285
  method: "POST",
@@ -487,6 +532,19 @@ var EmbedNamespace = class {
487
532
  signal: options.signal
488
533
  }, "Failed to connect to the embedded-agent stream endpoint.");
489
534
  await assertOk(response);
535
+ if (response.status === 202) {
536
+ const receipt = await response.json();
537
+ if (typeof receipt.message_id !== "string" || typeof receipt.thread_id !== "string" || !["queued", "blocked", "steer_pending"].includes(String(receipt.status))) {
538
+ throw new Error("Invalid queued message receipt");
539
+ }
540
+ return {
541
+ threadId: receipt.thread_id,
542
+ runId: null,
543
+ messageId: receipt.message_id,
544
+ messageStatus: receipt.status,
545
+ queuePosition: typeof receipt.queue_position === "number" ? receipt.queue_position : null
546
+ };
547
+ }
490
548
  let runId = response.headers.get("X-Run-ID");
491
549
  await consumeRuntimeEventStream(response, async (event) => {
492
550
  runId ||= event.run_id;
@@ -559,6 +617,67 @@ var EmbedNamespace = class {
559
617
  await assertOk(response);
560
618
  await consumeThreadSummaryEventStream(response, onEvent, options.signal);
561
619
  }
620
+ threadMessageQuery(scope) {
621
+ return {
622
+ external_user_id: scope.externalUserId,
623
+ external_session_id: scope.externalSessionId,
624
+ integration_id: scope.integrationId,
625
+ runtime_target: scope.runtimeTarget ?? "published"
626
+ };
627
+ }
628
+ listAgentThreadMessages(agentId, threadId, options) {
629
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/messages`, {
630
+ query: { ...this.threadMessageQuery(options), before: options.before, limit: options.limit }
631
+ });
632
+ }
633
+ submitAgentThreadMessage(agentId, threadId, payload, options) {
634
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/messages`, {
635
+ method: "POST",
636
+ body: {
637
+ external_user_id: payload.externalUserId,
638
+ external_session_id: payload.externalSessionId,
639
+ integration_id: payload.integrationId,
640
+ runtime_target: payload.runtimeTarget ?? "published",
641
+ mode: payload.mode,
642
+ input: payload.input,
643
+ attachment_ids: payload.attachmentIds ?? [],
644
+ requested_model_id: payload.requestedModelId,
645
+ tool_inputs: payload.toolInputs ?? {},
646
+ metadata: payload.metadata ?? {}
647
+ },
648
+ options,
649
+ mutation: true
650
+ });
651
+ }
652
+ editAgentThreadMessage(agentId, threadId, messageId, payload) {
653
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/messages/${encodeURIComponent(messageId)}`, {
654
+ method: "PATCH",
655
+ query: this.threadMessageQuery(payload),
656
+ body: {
657
+ revision: payload.revision,
658
+ input: payload.input,
659
+ mode: payload.mode,
660
+ attachment_ids: payload.attachmentIds ?? [],
661
+ requested_model_id: payload.requestedModelId
662
+ },
663
+ mutation: true
664
+ });
665
+ }
666
+ removeAgentThreadMessage(agentId, threadId, messageId, scope) {
667
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/messages/${encodeURIComponent(messageId)}`, {
668
+ method: "DELETE",
669
+ query: { ...this.threadMessageQuery(scope), revision: scope.revision },
670
+ mutation: true
671
+ });
672
+ }
673
+ resumeAgentThreadQueue(agentId, threadId, scope) {
674
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/queue/resume`, {
675
+ method: "POST",
676
+ query: this.threadMessageQuery(scope),
677
+ body: {},
678
+ mutation: true
679
+ });
680
+ }
562
681
  getConversationThread(threadId, options) {
563
682
  return this.http.requestJson(`/public/embed/threads/${threadId}`, { query: {
564
683
  agent_ids: options.agentIds,
@@ -570,6 +689,48 @@ var EmbedNamespace = class {
570
689
  runtime_target: options.runtimeTarget
571
690
  } });
572
691
  }
692
+ getConversationComputer(threadId, options) {
693
+ return this.http.requestJson(`/public/embed/threads/${encodeURIComponent(threadId)}/computer`, { query: {
694
+ agent_ids: options.agentIds,
695
+ external_user_id: options.externalUserId,
696
+ external_session_id: options.externalSessionId,
697
+ integration_id: options.integrationId,
698
+ runtime_target: options.runtimeTarget
699
+ } });
700
+ }
701
+ listConversationComputerFiles(threadId, options) {
702
+ return this.http.requestJson(`/public/embed/threads/${encodeURIComponent(threadId)}/computer/files`, { query: {
703
+ agent_ids: options.agentIds,
704
+ external_user_id: options.externalUserId,
705
+ external_session_id: options.externalSessionId,
706
+ integration_id: options.integrationId,
707
+ runtime_target: options.runtimeTarget,
708
+ path: options.path,
709
+ cursor: options.cursor,
710
+ limit: options.limit
711
+ } });
712
+ }
713
+ readConversationComputerFile(threadId, options) {
714
+ return this.http.requestJson(`/public/embed/threads/${encodeURIComponent(threadId)}/computer/file`, { query: {
715
+ agent_ids: options.agentIds,
716
+ external_user_id: options.externalUserId,
717
+ external_session_id: options.externalSessionId,
718
+ integration_id: options.integrationId,
719
+ runtime_target: options.runtimeTarget,
720
+ path: options.path
721
+ } });
722
+ }
723
+ createConversationComputerContentAccess(threadId, options) {
724
+ return this.http.requestJson(`/public/embed/threads/${encodeURIComponent(threadId)}/computer/content-access`, { method: "POST", query: {
725
+ agent_ids: options.agentIds,
726
+ external_user_id: options.externalUserId,
727
+ external_session_id: options.externalSessionId,
728
+ integration_id: options.integrationId,
729
+ runtime_target: options.runtimeTarget,
730
+ path: options.path,
731
+ download: options.download
732
+ }, body: {}, mutation: true });
733
+ }
573
734
  setConversationRuntimeSelection(threadId, request) {
574
735
  return this.http.requestJson(`/public/embed/threads/${threadId}/runtime-selection`, { method: "PATCH", body: request, mutation: true });
575
736
  }
@@ -599,6 +760,44 @@ var EmbedNamespace = class {
599
760
  integration_id: options.integrationId
600
761
  } });
601
762
  }
763
+ getAgentComputer(agentId, threadId, options) {
764
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/computer`, { query: {
765
+ external_user_id: options.externalUserId,
766
+ external_session_id: options.externalSessionId,
767
+ integration_id: options.integrationId,
768
+ runtime_target: options.runtimeTarget
769
+ } });
770
+ }
771
+ listAgentComputerFiles(agentId, threadId, options) {
772
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/computer/files`, { query: {
773
+ external_user_id: options.externalUserId,
774
+ external_session_id: options.externalSessionId,
775
+ integration_id: options.integrationId,
776
+ runtime_target: options.runtimeTarget,
777
+ path: options.path,
778
+ cursor: options.cursor,
779
+ limit: options.limit
780
+ } });
781
+ }
782
+ readAgentComputerFile(agentId, threadId, options) {
783
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/computer/file`, { query: {
784
+ external_user_id: options.externalUserId,
785
+ external_session_id: options.externalSessionId,
786
+ integration_id: options.integrationId,
787
+ runtime_target: options.runtimeTarget,
788
+ path: options.path
789
+ } });
790
+ }
791
+ createAgentComputerContentAccess(agentId, threadId, options) {
792
+ return this.http.requestJson(`/public/embed/agents/${encodeURIComponent(agentId)}/threads/${encodeURIComponent(threadId)}/computer/content-access`, { method: "POST", query: {
793
+ external_user_id: options.externalUserId,
794
+ external_session_id: options.externalSessionId,
795
+ integration_id: options.integrationId,
796
+ runtime_target: options.runtimeTarget,
797
+ path: options.path,
798
+ download: options.download
799
+ }, body: {}, mutation: true });
800
+ }
602
801
  deleteAgentThread(agentId, threadId, options, requestOptions) {
603
802
  return this.http.requestJson(`/public/embed/agents/${agentId}/threads/${threadId}`, { method: "DELETE", query: {
604
803
  external_user_id: options.externalUserId,
@@ -954,6 +1153,51 @@ var InstructionsNamespace = class {
954
1153
  }
955
1154
  };
956
1155
 
1156
+ // src/hosted-artifacts.ts
1157
+ var HostedArtifactsNamespace = class {
1158
+ constructor(http) {
1159
+ this.http = http;
1160
+ }
1161
+ http;
1162
+ create(payload, options) {
1163
+ return this.http.requestJson("/admin/artifacts", { method: "POST", body: payload, mutation: true, options });
1164
+ }
1165
+ get(id) {
1166
+ return this.http.requestJson(`/admin/artifacts/${encodeURIComponent(id)}`);
1167
+ }
1168
+ draft(id) {
1169
+ return this.http.requestJson(`/admin/artifacts/${encodeURIComponent(id)}/working-draft`);
1170
+ }
1171
+ saveDraft(id, snapshot, expectedVersion, options) {
1172
+ return this.http.requestJson(`/admin/artifacts/${encodeURIComponent(id)}/working-draft`, {
1173
+ method: "PUT",
1174
+ body: { draft_snapshot: snapshot, expected_version: expectedVersion, origin: "cli" },
1175
+ mutation: true,
1176
+ options
1177
+ });
1178
+ }
1179
+ build(id, draft, options) {
1180
+ return this.http.requestJson(`/admin/artifacts/${encodeURIComponent(id)}/builds`, {
1181
+ method: "POST",
1182
+ body: { expected_draft_version: draft.draft_version, expected_draft_hash: draft.draft_hash, expected_runtime_hash: draft.runtime_hash },
1183
+ mutation: true,
1184
+ options
1185
+ });
1186
+ }
1187
+ buildStatus(id, buildId) {
1188
+ return this.http.requestJson(`/admin/artifacts/${encodeURIComponent(id)}/builds/${encodeURIComponent(buildId)}`);
1189
+ }
1190
+ test(id, payload, options) {
1191
+ return this.http.requestJson(`/admin/artifacts/${encodeURIComponent(id)}/test-runs`, { method: "POST", body: payload, mutation: true, options });
1192
+ }
1193
+ run(runId) {
1194
+ return this.http.requestJson(`/admin/artifact-runs/${encodeURIComponent(runId)}`);
1195
+ }
1196
+ analyzeDependencies(payload) {
1197
+ return this.http.requestJson("/admin/artifacts/analyze-dependencies", { method: "POST", body: payload });
1198
+ }
1199
+ };
1200
+
957
1201
  // src/generated/resourcePolicies.ts
958
1202
  var ResourcePoliciesNamespace = class {
959
1203
  constructor(http) {
@@ -1055,6 +1299,7 @@ var Agents24 = class {
1055
1299
  clientDeployments;
1056
1300
  clientSessions;
1057
1301
  instructions;
1302
+ hostedArtifacts;
1058
1303
  resourcePolicies;
1059
1304
  customerProfiles;
1060
1305
  constructor(options) {
@@ -1068,6 +1313,7 @@ var Agents24 = class {
1068
1313
  this.clientDeployments = new ClientDeploymentsNamespace(http);
1069
1314
  this.clientSessions = new ClientSessionsNamespace(http);
1070
1315
  this.instructions = new InstructionsNamespace(http);
1316
+ this.hostedArtifacts = new HostedArtifactsNamespace(http);
1071
1317
  this.resourcePolicies = new ResourcePoliciesNamespace(http);
1072
1318
  this.customerProfiles = new CustomerProfilesNamespace(http);
1073
1319
  }
@@ -1093,6 +1339,11 @@ var SDK_OPERATION_IDS = [
1093
1339
  "agents.schema",
1094
1340
  "agents.start_run",
1095
1341
  "agents.stream",
1342
+ "agents.thread_messages.edit",
1343
+ "agents.thread_messages.list",
1344
+ "agents.thread_messages.remove",
1345
+ "agents.thread_messages.resume_queue",
1346
+ "agents.thread_messages.submit",
1096
1347
  "agents.update",
1097
1348
  "agents.update_graph",
1098
1349
  "agents.upload_attachments",
@@ -1118,10 +1369,19 @@ var SDK_OPERATION_IDS = [
1118
1369
  "client.sessions.backendExchange",
1119
1370
  "client.sessions.refresh",
1120
1371
  "client.sessions.revoke",
1372
+ "client.threads.computer.create_content_access",
1373
+ "client.threads.computer.get",
1374
+ "client.threads.computer.list",
1375
+ "client.threads.computer.read",
1121
1376
  "client.threads.delete",
1122
1377
  "client.threads.events",
1123
1378
  "client.threads.get",
1124
1379
  "client.threads.list",
1380
+ "client.threads.messages.edit",
1381
+ "client.threads.messages.list",
1382
+ "client.threads.messages.remove",
1383
+ "client.threads.messages.submit",
1384
+ "client.threads.queue.resume",
1125
1385
  "customer_profiles.clear",
1126
1386
  "customer_profiles.get",
1127
1387
  "customer_profiles.search",
@@ -1133,16 +1393,24 @@ var SDK_OPERATION_IDS = [
1133
1393
  "delegations.list",
1134
1394
  "embed.attach_agent_run",
1135
1395
  "embed.cancel_agent_run",
1396
+ "embed.create_agent_computer_content_access",
1136
1397
  "embed.create_attachment_content_access",
1398
+ "embed.create_conversation_computer_content_access",
1137
1399
  "embed.delete_agent_thread",
1138
1400
  "embed.delete_conversation_thread",
1401
+ "embed.get_agent_computer",
1139
1402
  "embed.get_agent_run_context",
1140
1403
  "embed.get_agent_thread",
1404
+ "embed.get_conversation_computer",
1141
1405
  "embed.get_conversation_thread",
1142
1406
  "embed.get_resource_policy",
1143
1407
  "embed.get_runtime_bootstrap",
1408
+ "embed.list_agent_computer_files",
1144
1409
  "embed.list_agent_threads",
1145
1410
  "embed.list_agent_threads_multi",
1411
+ "embed.list_conversation_computer_files",
1412
+ "embed.read_agent_computer_file",
1413
+ "embed.read_conversation_computer_file",
1146
1414
  "embed.resolve_agent_alias",
1147
1415
  "embed.resolve_conversation_run",
1148
1416
  "embed.resolve_customer_principal",
@@ -1154,6 +1422,11 @@ var SDK_OPERATION_IDS = [
1154
1422
  "embed.stream_agent",
1155
1423
  "embed.stream_agent_thread_events",
1156
1424
  "embed.stream_agent_thread_events_multi",
1425
+ "embed.thread_messages.edit",
1426
+ "embed.thread_messages.list",
1427
+ "embed.thread_messages.remove",
1428
+ "embed.thread_messages.resume_queue",
1429
+ "embed.thread_messages.submit",
1157
1430
  "embed.upload_agent_attachments",
1158
1431
  "instructions.publish",
1159
1432
  "resource_installations.accept_pull",
@@ -1260,6 +1533,7 @@ exports.Agents24 = Agents24;
1260
1533
  exports.Agents24NodeError = Agents24SDKError;
1261
1534
  exports.Agents24SDKError = Agents24SDKError;
1262
1535
  exports.GraphBuilder = GraphBuilder;
1536
+ exports.HostedArtifactsNamespace = HostedArtifactsNamespace;
1263
1537
  exports.SDK_OPERATION_IDS = SDK_OPERATION_IDS;
1264
1538
  //# sourceMappingURL=index.cjs.map
1265
1539
  //# sourceMappingURL=index.cjs.map