@bpmsoftwaresolutions/ai-engine-client 1.1.45 → 1.1.48

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +535 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmsoftwaresolutions/ai-engine-client",
3
- "version": "1.1.45",
3
+ "version": "1.1.48",
4
4
  "description": "Thin npm client for the AI Engine operator and retrieval APIs",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
package/src/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const DEFAULT_TIMEOUT_MS = 30000;
2
- export const AI_ENGINE_CLIENT_VERSION = '1.1.45';
2
+ export const AI_ENGINE_CLIENT_VERSION = '1.1.48';
3
3
  export const GOVERNED_MUTATION_REQUIRED_CAPABILITIES = [
4
4
  'executeVerifiedMutation',
5
5
  'post_mutation_verification',
@@ -20,6 +20,99 @@ export const LOGA_INTERACTION_CONTRACT = 'loga-choreography/v1';
20
20
  export const LOGA_NAVIGATION_CONTRACT = 'loga-navigation/v1';
21
21
  export const LOGA_PROJECTION_WORKFLOW = 'loga-document-projection';
22
22
  export const TASK_BOUND_SUBSTRATE_EXECUTION_POLICY = 'task_bound_substrate_execution/v1';
23
+ export const AGENT_COMMUNICATION_CONTRACT_VERSION = 'v1';
24
+ export const AGENT_COMMUNICATION_THREAD_TYPES = ['request', 'review', 'handoff', 'coordination', 'task', 'escalation'];
25
+ export const AGENT_COMMUNICATION_MESSAGE_KINDS = [
26
+ 'request',
27
+ 'response',
28
+ 'review',
29
+ 'handoff',
30
+ 'blocker',
31
+ 'evidence',
32
+ 'decision_request',
33
+ 'task_request',
34
+ 'review_request',
35
+ 'evidence_response',
36
+ ];
37
+ export const AGENT_COMMUNICATION_TRANSFER_KINDS = [
38
+ 'upstream_remediation',
39
+ 'review_request',
40
+ 'handoff',
41
+ 'coordination',
42
+ 'evidence_delivery',
43
+ ];
44
+ export const AGENT_COMMUNICATION_TRANSFER_MODES = ['bundle', 'artifact_refs', 'inline_payload'];
45
+ export const AGENT_COMMUNICATION_TRANSFER_LIFECYCLE_STATES = [
46
+ 'created',
47
+ 'delivered',
48
+ 'accepted',
49
+ 'in_progress',
50
+ 'responded',
51
+ 'closed',
52
+ 'failed',
53
+ 'superseded',
54
+ ];
55
+ export const AGENT_COMMUNICATION_TRANSFER_RECEIPT_TYPES = [
56
+ 'delivery_receipt',
57
+ 'acceptance_receipt',
58
+ 'evidence_receipt',
59
+ 'closure_receipt',
60
+ 'failure_receipt',
61
+ ];
62
+ export const AGENT_COMMUNICATION_RECIPIENT_MODES = ['role', 'agent_session'];
63
+
64
+ function normalizeEnum(value, allowed, defaultValue, fieldName, aliases = {}) {
65
+ const text = cleanText(value);
66
+ if (!text) return defaultValue;
67
+ let normalized = text.toLowerCase();
68
+ if (Object.prototype.hasOwnProperty.call(aliases, normalized)) {
69
+ normalized = aliases[normalized];
70
+ }
71
+ if (!allowed.includes(normalized)) {
72
+ throw new Error(`${fieldName} must be one of ${allowed.join(', ')}.`);
73
+ }
74
+ return normalized;
75
+ }
76
+
77
+ function normalizeThreadType(value) {
78
+ return normalizeEnum(value, AGENT_COMMUNICATION_THREAD_TYPES, 'coordination', 'thread_type', {
79
+ task_request: 'request',
80
+ task: 'request',
81
+ review_request: 'review',
82
+ handoff_request: 'handoff',
83
+ });
84
+ }
85
+
86
+ function normalizeMessageKind(value) {
87
+ return normalizeEnum(value, AGENT_COMMUNICATION_MESSAGE_KINDS, 'request', 'message_kind', {
88
+ task: 'request',
89
+ note: 'request',
90
+ update: 'response',
91
+ });
92
+ }
93
+
94
+ function normalizeTransferKind(value) {
95
+ return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_KINDS, 'upstream_remediation', 'transfer_kind', {
96
+ remediation_request: 'upstream_remediation',
97
+ review: 'review_request',
98
+ });
99
+ }
100
+
101
+ function normalizeTransferMode(value) {
102
+ return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_MODES, 'inline_payload', 'transfer_mode');
103
+ }
104
+
105
+ function normalizeTransferLifecycleStatus(value) {
106
+ return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_LIFECYCLE_STATES, 'created', 'lifecycle_status');
107
+ }
108
+
109
+ function normalizeTransferReceiptType(value) {
110
+ return normalizeEnum(value, AGENT_COMMUNICATION_TRANSFER_RECEIPT_TYPES, 'delivery_receipt', 'receipt_type');
111
+ }
112
+
113
+ function normalizeRecipientMode(value) {
114
+ return normalizeEnum(value, AGENT_COMMUNICATION_RECIPIENT_MODES, 'role', 'recipient_mode');
115
+ }
23
116
 
24
117
  function trimTrailingSlash(value) {
25
118
  return String(value || '').replace(/\/+$/, '');
@@ -301,6 +394,13 @@ export class AIEngineClient {
301
394
  };
302
395
  this.projections = {
303
396
  render: (request) => this.renderProjection(request),
397
+ getTransferHomeProjection: () => this.getLogaTransferHomeProjection(),
398
+ getTransferInboxProjection: (query) => this.getLogaTransferInboxProjection(query),
399
+ getTransferPacketProjection: (workTransferPacketId) => this.getLogaTransferPacketProjection(workTransferPacketId),
400
+ getTransferNegotiationEventsProjection: (query) => this.getLogaTransferNegotiationEventsProjection(query),
401
+ getTransferFrictionLaneProjection: (query) => this.getLogaTransferFrictionLaneProjection(query),
402
+ getTransferReceiptsProjection: (query) => this.getLogaTransferReceiptsProjection(query),
403
+ getTransferClosureReviewProjection: (workTransferPacketId) => this.getLogaTransferClosureReviewProjection(workTransferPacketId),
304
404
  };
305
405
  this.actions = {
306
406
  submit: (request) => this.submitActionIntent(request),
@@ -310,6 +410,19 @@ export class AIEngineClient {
310
410
  getThread: (threadId) => this.getCommunicationThread(threadId),
311
411
  listInbox: (request) => this.listCommunicationInbox(request),
312
412
  sendMessage: (request) => this.sendCommunicationMessage(request),
413
+ getCommunicationCapabilities: (request) => this.getCommunicationCapabilities(request),
414
+ getDeploymentCapabilities: (request) => this.getDeploymentCapabilities(request),
415
+ bootstrap: (request) => this.bootstrapCommunication(request),
416
+ negotiateTransfer: (request) => this.negotiateCommunicationTransfer(request),
417
+ resolveCommunicationTarget: (request) => this.resolveCommunicationTarget(request),
418
+ createEvidencePacket: (request) => this.createCommunicationEvidencePacket(request),
419
+ transferWorkPacket: (request) => this.transferWorkPacket(request),
420
+ listFrictionTaxonomy: (request) => this.listCommunicationFrictionTaxonomy(request),
421
+ recordFrictionEvent: (request) => this.recordCommunicationFrictionEvent(request),
422
+ createTransferReceipt: (request) => this.recordCommunicationTransferReceipt(request),
423
+ acceptTransferPacket: (request) => this.acceptCommunicationTransferPacket(request),
424
+ closeTransferPacket: (request) => this.closeCommunicationTransferPacket(request),
425
+ getTransferHealth: (request) => this.getCommunicationTransferHealth(request),
313
426
  createBundle: (request) => this.createCommunicationBundle(request),
314
427
  getBundle: (bundleId) => this.getCommunicationBundle(bundleId),
315
428
  listBundles: (request) => this.listCommunicationBundles(request),
@@ -502,6 +615,250 @@ export class AIEngineClient {
502
615
  });
503
616
  }
504
617
 
618
+ async getCommunicationCapabilities() {
619
+ return this._request('/api/agent-communications/capabilities');
620
+ }
621
+
622
+ async getDeploymentCapabilities() {
623
+ return this._request('/api/agent-communications/deployment-capabilities');
624
+ }
625
+
626
+ async bootstrapCommunication() {
627
+ return this._request('/api/agent-communications/bootstrap');
628
+ }
629
+
630
+ async negotiateCommunicationTransfer({
631
+ preferredModes,
632
+ preferred_modes,
633
+ preferred,
634
+ capabilities = {},
635
+ estimatedPayloadKb,
636
+ estimated_payload_kb,
637
+ requiresReceipts = true,
638
+ requires_receipts = true,
639
+ supportsHashValidation = true,
640
+ supports_hash_validation = true,
641
+ transferKind,
642
+ transfer_kind,
643
+ workflowRunId,
644
+ workflow_run_id,
645
+ } = {}) {
646
+ const normalizedPreferredModes = Array.isArray(preferred_modes)
647
+ ? preferred_modes
648
+ : (Array.isArray(preferredModes) ? preferredModes : (Array.isArray(preferred) ? preferred : ['bundle', 'artifact_refs', 'inline_payload']));
649
+ return this._request('/api/agent-communications/transfers/negotiate', {
650
+ method: 'POST',
651
+ body: {
652
+ preferred_modes: normalizedPreferredModes.map((mode) => normalizeTransferMode(mode)),
653
+ capabilities: isPlainObject(capabilities) ? capabilities : {},
654
+ estimated_payload_kb: Number(estimated_payload_kb ?? estimatedPayloadKb ?? 0) || undefined,
655
+ requires_receipts: Boolean(requires_receipts ?? requiresReceipts),
656
+ supports_hash_validation: Boolean(supports_hash_validation ?? supportsHashValidation),
657
+ transfer_kind: normalizeTransferKind(transfer_kind ?? transferKind ?? 'upstream_remediation'),
658
+ workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
659
+ },
660
+ });
661
+ }
662
+
663
+ async resolveCommunicationTarget({
664
+ intent,
665
+ transferKind,
666
+ transfer_kind,
667
+ recipientMode,
668
+ recipient_mode,
669
+ preferredRoleKey,
670
+ preferred_role_key,
671
+ preferredAgentSessionId,
672
+ preferred_agent_session_id,
673
+ workflowRunId,
674
+ workflow_run_id,
675
+ } = {}) {
676
+ return this._request('/api/agent-communications/targets/resolve', {
677
+ method: 'POST',
678
+ body: {
679
+ intent: cleanText(intent) || cleanText(transfer_kind) || cleanText(transferKind),
680
+ recipient_mode: normalizeRecipientMode(recipient_mode ?? recipientMode ?? 'role'),
681
+ preferred_role_key: cleanText(preferred_role_key) || cleanText(preferredRoleKey),
682
+ preferred_agent_session_id: cleanText(preferred_agent_session_id) || cleanText(preferredAgentSessionId),
683
+ workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
684
+ },
685
+ });
686
+ }
687
+
688
+ async createCommunicationEvidencePacket({
689
+ workflowRunId,
690
+ workflow_run_id,
691
+ transferKind,
692
+ transfer_kind,
693
+ objective,
694
+ requestedOutcome,
695
+ requested_outcome,
696
+ artifacts = [],
697
+ artifactRefs,
698
+ artifact_refs,
699
+ issues = [],
700
+ issueRefs,
701
+ issue_refs,
702
+ expectedEvidence = [],
703
+ expected_evidence,
704
+ metadata = {},
705
+ } = {}) {
706
+ return this._request('/api/agent-communications/evidence-packets', {
707
+ method: 'POST',
708
+ body: {
709
+ workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
710
+ transfer_kind: normalizeTransferKind(transfer_kind ?? transferKind ?? 'upstream_remediation'),
711
+ objective: cleanText(objective),
712
+ requested_outcome: cleanText(requested_outcome) || cleanText(requestedOutcome),
713
+ artifacts: Array.isArray(artifacts) ? artifacts : (Array.isArray(artifact_refs) ? artifact_refs : (Array.isArray(artifactRefs) ? artifactRefs : [])),
714
+ issues: Array.isArray(issues) ? issues : (Array.isArray(issue_refs) ? issue_refs : (Array.isArray(issueRefs) ? issueRefs : [])),
715
+ expected_evidence: Array.isArray(expected_evidence) ? expected_evidence : (Array.isArray(expectedEvidence) ? expectedEvidence : []),
716
+ metadata: isPlainObject(metadata) ? metadata : {},
717
+ },
718
+ });
719
+ }
720
+
721
+ async listCommunicationFrictionTaxonomy({
722
+ categoryGroup,
723
+ category_group,
724
+ isActive,
725
+ is_active,
726
+ } = {}) {
727
+ return this._request('/api/agent-communications/friction-taxonomy', {
728
+ query: {
729
+ category_group: cleanText(category_group) || cleanText(categoryGroup),
730
+ is_active: is_active !== undefined ? String(Boolean(is_active)) : (isActive !== undefined ? String(Boolean(isActive)) : undefined),
731
+ },
732
+ });
733
+ }
734
+
735
+ async recordCommunicationFrictionEvent({
736
+ workflowRunId,
737
+ workflow_run_id,
738
+ workTransferPacketId,
739
+ work_transfer_packet_id,
740
+ communicationThreadId,
741
+ communication_thread_id,
742
+ communicationMessageId,
743
+ communication_message_id,
744
+ taxonomyKey,
745
+ taxonomy_key,
746
+ frictionType,
747
+ friction_type,
748
+ severity,
749
+ observedBehavior,
750
+ observed_behavior,
751
+ attemptedAction,
752
+ attempted_action,
753
+ resolutionPath,
754
+ resolution_path,
755
+ missingSurfaceKey,
756
+ missing_surface_key,
757
+ promotionCandidate,
758
+ promotion_candidate,
759
+ repeatedCount,
760
+ repeated_count,
761
+ metadata = {},
762
+ } = {}) {
763
+ return this._request('/api/agent-communications/friction-events', {
764
+ method: 'POST',
765
+ body: {
766
+ workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
767
+ work_transfer_packet_id: cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId),
768
+ communication_thread_id: cleanText(communication_thread_id) || cleanText(communicationThreadId),
769
+ communication_message_id: cleanText(communication_message_id) || cleanText(communicationMessageId),
770
+ taxonomy_key: cleanText(taxonomy_key) || cleanText(taxonomyKey) || 'enum_drift',
771
+ friction_type: cleanText(friction_type) || cleanText(frictionType) || 'discovery',
772
+ severity: cleanText(severity) || 'warning',
773
+ observed_behavior: cleanText(observed_behavior) || cleanText(observedBehavior),
774
+ attempted_action: cleanText(attempted_action) || cleanText(attemptedAction),
775
+ resolution_path: cleanText(resolution_path) || cleanText(resolutionPath),
776
+ missing_surface_key: cleanText(missing_surface_key) || cleanText(missingSurfaceKey),
777
+ promotion_candidate: Boolean(promotion_candidate ?? promotionCandidate),
778
+ repeated_count: Number(repeated_count ?? repeatedCount ?? 1) || 1,
779
+ metadata: isPlainObject(metadata) ? metadata : {},
780
+ },
781
+ });
782
+ }
783
+
784
+ async transferWorkPacket({
785
+ workflowRunId,
786
+ workflow_run_id,
787
+ transferKind,
788
+ transfer_kind,
789
+ objective,
790
+ requestedOutcome,
791
+ requested_outcome,
792
+ target = {},
793
+ artifacts = [],
794
+ issues = [],
795
+ expectedEvidence = [],
796
+ preferredModes,
797
+ preferred_modes,
798
+ preferred,
799
+ capabilities = {},
800
+ estimatedPayloadKb,
801
+ estimated_payload_kb,
802
+ requiresReceipts = true,
803
+ requires_receipts = true,
804
+ supportsHashValidation = true,
805
+ supports_hash_validation = true,
806
+ senderAgentSessionId,
807
+ sender_agent_session_id,
808
+ senderActorSessionId,
809
+ sender_actor_session_id,
810
+ subject,
811
+ bodyMarkdown,
812
+ body_markdown,
813
+ parentThreadId,
814
+ parent_thread_id,
815
+ recipientMode,
816
+ recipient_mode,
817
+ recipientRoleKey,
818
+ recipient_role_key,
819
+ recipientAgentSessionId,
820
+ recipient_agent_session_id,
821
+ cleanupPolicy,
822
+ cleanup_policy,
823
+ } = {}) {
824
+ const normalizedTarget = isPlainObject(target) ? target : {};
825
+ const normalizedWorkflowRunId = cleanText(workflow_run_id) || cleanText(workflowRunId);
826
+ const normalizedTransferKind = normalizeTransferKind(transfer_kind ?? transferKind ?? 'upstream_remediation');
827
+ const normalizedPreferredModes = Array.isArray(preferred_modes)
828
+ ? preferred_modes
829
+ : (Array.isArray(preferredModes) ? preferredModes : (Array.isArray(preferred) ? preferred : ['bundle', 'artifact_refs', 'inline_payload']));
830
+ const normalizedTargetMode = cleanText(normalizedTarget.recipient_mode) || cleanText(normalizedTarget.recipientMode) || cleanText(recipient_mode) || cleanText(recipientMode) || 'role';
831
+ return this._request('/api/agent-communications/work-transfers', {
832
+ method: 'POST',
833
+ body: {
834
+ workflow_run_id: normalizedWorkflowRunId,
835
+ transfer_kind: normalizedTransferKind,
836
+ objective: cleanText(objective),
837
+ requested_outcome: cleanText(requested_outcome) || cleanText(requestedOutcome),
838
+ target: {
839
+ intent: cleanText(normalizedTarget.intent) || normalizedTransferKind,
840
+ recipient_mode: normalizeRecipientMode(normalizedTargetMode),
841
+ preferred_role_key: cleanText(normalizedTarget.preferred_role_key) || cleanText(normalizedTarget.preferredRoleKey) || cleanText(recipient_role_key) || cleanText(recipientRoleKey),
842
+ preferred_agent_session_id: cleanText(normalizedTarget.preferred_agent_session_id) || cleanText(normalizedTarget.preferredAgentSessionId) || cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
843
+ },
844
+ artifacts: Array.isArray(artifacts) ? artifacts : [],
845
+ issues: Array.isArray(issues) ? issues : [],
846
+ expected_evidence: Array.isArray(expectedEvidence) ? expectedEvidence : [],
847
+ preferred_modes: normalizedPreferredModes.map((mode) => normalizeTransferMode(mode)),
848
+ capabilities: isPlainObject(capabilities) ? capabilities : {},
849
+ estimated_payload_kb: Number(estimated_payload_kb ?? estimatedPayloadKb ?? 0) || undefined,
850
+ requires_receipts: Boolean(requires_receipts ?? requiresReceipts),
851
+ supports_hash_validation: Boolean(supports_hash_validation ?? supportsHashValidation),
852
+ sender_agent_session_id: cleanText(sender_agent_session_id) || cleanText(senderAgentSessionId),
853
+ sender_actor_session_id: cleanText(sender_actor_session_id) || cleanText(senderActorSessionId),
854
+ subject: cleanText(subject),
855
+ body_markdown: cleanText(body_markdown) || cleanText(bodyMarkdown),
856
+ parent_thread_id: cleanText(parent_thread_id) || cleanText(parentThreadId),
857
+ cleanup_policy: cleanText(cleanup_policy) || cleanText(cleanupPolicy),
858
+ },
859
+ });
860
+ }
861
+
505
862
  async openCommunicationThread({
506
863
  workflowRunId,
507
864
  workflow_run_id,
@@ -522,7 +879,7 @@ export class AIEngineClient {
522
879
  body: {
523
880
  workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
524
881
  parent_thread_id: cleanText(parent_thread_id) || cleanText(parentThreadId),
525
- thread_type: cleanText(thread_type) || cleanText(threadType),
882
+ thread_type: normalizeThreadType(cleanText(thread_type) || cleanText(threadType)),
526
883
  subject: cleanText(subject),
527
884
  objective: cleanText(objective),
528
885
  created_by_agent_session_id: cleanText(created_by_agent_session_id) || cleanText(createdByAgentSessionId),
@@ -585,7 +942,7 @@ export class AIEngineClient {
585
942
  sender_agent_session_id: cleanText(sender_agent_session_id) || cleanText(senderAgentSessionId),
586
943
  recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
587
944
  recipient_role_key: cleanText(recipient_role_key) || cleanText(recipientRoleKey),
588
- message_kind: cleanText(message_kind) || cleanText(messageKind),
945
+ message_kind: normalizeMessageKind(cleanText(message_kind) || cleanText(messageKind)),
589
946
  message_status: cleanText(message_status) || cleanText(messageStatus) || 'sent',
590
947
  body_markdown: cleanText(body_markdown) || cleanText(bodyMarkdown),
591
948
  payload: isPlainObject(payload) ? payload : {},
@@ -836,6 +1193,135 @@ export class AIEngineClient {
836
1193
  });
837
1194
  }
838
1195
 
1196
+ async recordCommunicationTransferReceipt({
1197
+ workTransferPacketId,
1198
+ work_transfer_packet_id,
1199
+ receiptType,
1200
+ receipt_type,
1201
+ receiptStatus,
1202
+ receipt_status,
1203
+ actorSessionId,
1204
+ actor_session_id,
1205
+ agentSessionId,
1206
+ agent_session_id,
1207
+ claimId,
1208
+ claim_id,
1209
+ evidenceRef,
1210
+ evidence_ref,
1211
+ evidenceSha256,
1212
+ evidence_sha256,
1213
+ evidence = {},
1214
+ manifestSha256,
1215
+ manifest_sha256,
1216
+ closureReason,
1217
+ closure_reason,
1218
+ failureReason,
1219
+ failure_reason,
1220
+ lifecycleStatus,
1221
+ lifecycle_status,
1222
+ metadata = {},
1223
+ } = {}) {
1224
+ const normalizedPacketId = cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId);
1225
+ if (!normalizedPacketId) throw new Error('work_transfer_packet_id is required.');
1226
+ return this._request(`/api/agent-communications/transfers/${encodeURIComponent(normalizedPacketId)}/receipts`, {
1227
+ method: 'POST',
1228
+ body: {
1229
+ receipt_type: normalizeTransferReceiptType(cleanText(receipt_type) || cleanText(receiptType) || 'delivery_receipt'),
1230
+ receipt_status: cleanText(receipt_status) || cleanText(receiptStatus) || 'recorded',
1231
+ actor_session_id: cleanText(actor_session_id) || cleanText(actorSessionId),
1232
+ agent_session_id: cleanText(agent_session_id) || cleanText(agentSessionId),
1233
+ claim_id: cleanText(claim_id) || cleanText(claimId),
1234
+ evidence_ref: cleanText(evidence_ref) || cleanText(evidenceRef),
1235
+ evidence_sha256: cleanText(evidence_sha256) || cleanText(evidenceSha256),
1236
+ evidence: isPlainObject(evidence) ? evidence : {},
1237
+ manifest_sha256: cleanText(manifest_sha256) || cleanText(manifestSha256),
1238
+ closure_reason: cleanText(closure_reason) || cleanText(closureReason),
1239
+ failure_reason: cleanText(failure_reason) || cleanText(failureReason),
1240
+ lifecycle_status: cleanText(lifecycle_status) || cleanText(lifecycleStatus),
1241
+ metadata: isPlainObject(metadata) ? metadata : {},
1242
+ },
1243
+ });
1244
+ }
1245
+
1246
+ async acceptCommunicationTransferPacket({
1247
+ workTransferPacketId,
1248
+ work_transfer_packet_id,
1249
+ acceptedByAgentSessionId,
1250
+ accepted_by_agent_session_id,
1251
+ acceptedByActorSessionId,
1252
+ accepted_by_actor_session_id,
1253
+ acceptedByClaimId,
1254
+ accepted_by_claim_id,
1255
+ advanceToInProgress,
1256
+ advance_to_in_progress,
1257
+ metadata = {},
1258
+ } = {}) {
1259
+ const normalizedPacketId = cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId);
1260
+ if (!normalizedPacketId) throw new Error('work_transfer_packet_id is required.');
1261
+ return this._request(`/api/agent-communications/transfers/${encodeURIComponent(normalizedPacketId)}/accept`, {
1262
+ method: 'POST',
1263
+ body: {
1264
+ accepted_by_agent_session_id: cleanText(accepted_by_agent_session_id) || cleanText(acceptedByAgentSessionId),
1265
+ accepted_by_actor_session_id: cleanText(accepted_by_actor_session_id) || cleanText(acceptedByActorSessionId),
1266
+ accepted_by_claim_id: cleanText(accepted_by_claim_id) || cleanText(acceptedByClaimId),
1267
+ advance_to_in_progress: Boolean(advance_to_in_progress ?? advanceToInProgress),
1268
+ metadata: isPlainObject(metadata) ? metadata : {},
1269
+ },
1270
+ });
1271
+ }
1272
+
1273
+ async closeCommunicationTransferPacket({
1274
+ workTransferPacketId,
1275
+ work_transfer_packet_id,
1276
+ closureStatus,
1277
+ closure_status,
1278
+ closureReason,
1279
+ closure_reason,
1280
+ failureReason,
1281
+ failure_reason,
1282
+ closedByAgentSessionId,
1283
+ closed_by_agent_session_id,
1284
+ closedByActorSessionId,
1285
+ closed_by_actor_session_id,
1286
+ closedByClaimId,
1287
+ closed_by_claim_id,
1288
+ evidence = {},
1289
+ evidenceManifestSha256,
1290
+ evidence_manifest_sha256,
1291
+ metadata = {},
1292
+ } = {}) {
1293
+ const normalizedPacketId = cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId);
1294
+ if (!normalizedPacketId) throw new Error('work_transfer_packet_id is required.');
1295
+ return this._request(`/api/agent-communications/transfers/${encodeURIComponent(normalizedPacketId)}/close`, {
1296
+ method: 'POST',
1297
+ body: {
1298
+ closure_status: normalizeTransferLifecycleStatus(cleanText(closure_status) || cleanText(closureStatus) || 'closed'),
1299
+ closure_reason: cleanText(closure_reason) || cleanText(closureReason),
1300
+ failure_reason: cleanText(failure_reason) || cleanText(failureReason),
1301
+ closed_by_agent_session_id: cleanText(closed_by_agent_session_id) || cleanText(closedByAgentSessionId),
1302
+ closed_by_actor_session_id: cleanText(closed_by_actor_session_id) || cleanText(closedByActorSessionId),
1303
+ closed_by_claim_id: cleanText(closed_by_claim_id) || cleanText(closedByClaimId),
1304
+ evidence: isPlainObject(evidence) ? evidence : {},
1305
+ evidence_manifest_sha256: cleanText(evidence_manifest_sha256) || cleanText(evidenceManifestSha256),
1306
+ metadata: isPlainObject(metadata) ? metadata : {},
1307
+ },
1308
+ });
1309
+ }
1310
+
1311
+ async getCommunicationTransferHealth({
1312
+ workflowRunId,
1313
+ workflow_run_id,
1314
+ workTransferPacketId,
1315
+ work_transfer_packet_id,
1316
+ } = {}) {
1317
+ return this._request('/api/agent-communications/transfers/health', {
1318
+ query: {
1319
+ workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
1320
+ work_transfer_packet_id: cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId),
1321
+ },
1322
+ });
1323
+ }
1324
+
839
1325
  async acceptCommunicationMessage(messageId) {
840
1326
  return this._request(`/api/agent-communications/messages/${encodeURIComponent(messageId)}/accept`, {
841
1327
  method: 'POST',
@@ -2130,6 +2616,52 @@ export class AIEngineClient {
2130
2616
  return this._requestLogaProjection(`/api/operator/projections/evidence-packets/${packetKey}`);
2131
2617
  }
2132
2618
 
2619
+ async getLogaTransferHomeProjection() {
2620
+ return this._requestLogaProjection('/api/operator/projections/transfers/home');
2621
+ }
2622
+
2623
+ async getLogaTransferInboxProjection({ workflowRunId, recipientAgentSessionId, recipientRoleKey } = {}) {
2624
+ return this._requestLogaProjection('/api/operator/projections/transfers/inbox', {
2625
+ query: {
2626
+ workflow_run_id: workflowRunId,
2627
+ recipient_agent_session_id: recipientAgentSessionId,
2628
+ recipient_role_key: recipientRoleKey,
2629
+ },
2630
+ });
2631
+ }
2632
+
2633
+ async getLogaTransferPacketProjection(workTransferPacketId) {
2634
+ return this._requestLogaProjection(`/api/operator/projections/transfers/${workTransferPacketId}`);
2635
+ }
2636
+
2637
+ async getLogaTransferNegotiationEventsProjection({ workTransferPacketId, workflowRunId } = {}) {
2638
+ const path = workTransferPacketId
2639
+ ? `/api/operator/projections/transfers/${workTransferPacketId}/negotiation-events`
2640
+ : '/api/operator/projections/transfers/negotiation-events';
2641
+ return this._requestLogaProjection(path, {
2642
+ query: { workflow_run_id: workflowRunId },
2643
+ });
2644
+ }
2645
+
2646
+ async getLogaTransferFrictionLaneProjection({ workflowRunId } = {}) {
2647
+ return this._requestLogaProjection('/api/operator/projections/transfers/friction-lane', {
2648
+ query: { workflow_run_id: workflowRunId },
2649
+ });
2650
+ }
2651
+
2652
+ async getLogaTransferReceiptsProjection({ workTransferPacketId, workflowRunId } = {}) {
2653
+ return this._requestLogaProjection('/api/operator/projections/transfers/receipts', {
2654
+ query: {
2655
+ work_transfer_packet_id: workTransferPacketId,
2656
+ workflow_run_id: workflowRunId,
2657
+ },
2658
+ });
2659
+ }
2660
+
2661
+ async getLogaTransferClosureReviewProjection(workTransferPacketId) {
2662
+ return this._requestLogaProjection(`/api/operator/projections/transfers/${workTransferPacketId}/closure-review`);
2663
+ }
2664
+
2133
2665
  async submitUxGateRemediation({
2134
2666
  projectionType,
2135
2667
  projectionId,