@bpmsoftwaresolutions/ai-engine-client 1.1.44 → 1.1.45
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/package.json +1 -1
- package/src/index.js +251 -1
package/package.json
CHANGED
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.
|
|
2
|
+
export const AI_ENGINE_CLIENT_VERSION = '1.1.45';
|
|
3
3
|
export const GOVERNED_MUTATION_REQUIRED_CAPABILITIES = [
|
|
4
4
|
'executeVerifiedMutation',
|
|
5
5
|
'post_mutation_verification',
|
|
@@ -310,6 +310,15 @@ export class AIEngineClient {
|
|
|
310
310
|
getThread: (threadId) => this.getCommunicationThread(threadId),
|
|
311
311
|
listInbox: (request) => this.listCommunicationInbox(request),
|
|
312
312
|
sendMessage: (request) => this.sendCommunicationMessage(request),
|
|
313
|
+
createBundle: (request) => this.createCommunicationBundle(request),
|
|
314
|
+
getBundle: (bundleId) => this.getCommunicationBundle(bundleId),
|
|
315
|
+
listBundles: (request) => this.listCommunicationBundles(request),
|
|
316
|
+
addBundleItem: (request) => this.addCommunicationBundleItem(request),
|
|
317
|
+
uploadBundle: (request) => this.uploadCommunicationBundle(request),
|
|
318
|
+
attachBundleToMessage: (request) => this.attachCommunicationBundleToMessage(request),
|
|
319
|
+
recordBundleReceipt: (request) => this.recordCommunicationBundleReceipt(request),
|
|
320
|
+
recordBundleCleanupEvent: (request) => this.recordCommunicationBundleCleanupEvent(request),
|
|
321
|
+
claimBundle: (request) => this.claimCommunicationBundle(request),
|
|
313
322
|
acceptMessage: (messageId) => this.acceptCommunicationMessage(messageId),
|
|
314
323
|
respondWithEvidence: (request) => this.respondToCommunicationMessage(request),
|
|
315
324
|
attachEvidence: (request) => this.attachCommunicationMessageEvidence(request),
|
|
@@ -548,6 +557,8 @@ export class AIEngineClient {
|
|
|
548
557
|
communicationThreadId,
|
|
549
558
|
communication_thread_id,
|
|
550
559
|
threadId,
|
|
560
|
+
communicationBundleId,
|
|
561
|
+
communication_bundle_id,
|
|
551
562
|
senderAgentSessionId,
|
|
552
563
|
sender_agent_session_id,
|
|
553
564
|
recipientAgentSessionId,
|
|
@@ -570,6 +581,7 @@ export class AIEngineClient {
|
|
|
570
581
|
method: 'POST',
|
|
571
582
|
body: {
|
|
572
583
|
communication_thread_id: cleanText(communication_thread_id) || cleanText(communicationThreadId) || cleanText(threadId),
|
|
584
|
+
communication_bundle_id: cleanText(communication_bundle_id) || cleanText(communicationBundleId),
|
|
573
585
|
sender_agent_session_id: cleanText(sender_agent_session_id) || cleanText(senderAgentSessionId),
|
|
574
586
|
recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
|
|
575
587
|
recipient_role_key: cleanText(recipient_role_key) || cleanText(recipientRoleKey),
|
|
@@ -586,6 +598,244 @@ export class AIEngineClient {
|
|
|
586
598
|
});
|
|
587
599
|
}
|
|
588
600
|
|
|
601
|
+
async createCommunicationBundle({
|
|
602
|
+
workflowRunId,
|
|
603
|
+
workflow_run_id,
|
|
604
|
+
communicationThreadId,
|
|
605
|
+
communication_thread_id,
|
|
606
|
+
threadId,
|
|
607
|
+
sourceAgentSessionId,
|
|
608
|
+
source_agent_session_id,
|
|
609
|
+
sourceActorSessionId,
|
|
610
|
+
source_actor_session_id,
|
|
611
|
+
recipientAgentSessionId,
|
|
612
|
+
recipient_agent_session_id,
|
|
613
|
+
recipientRoleKey,
|
|
614
|
+
recipient_role_key,
|
|
615
|
+
bundleKind,
|
|
616
|
+
bundle_kind,
|
|
617
|
+
cleanupPolicy,
|
|
618
|
+
cleanup_policy,
|
|
619
|
+
manifest = {},
|
|
620
|
+
manifestSha256,
|
|
621
|
+
manifest_sha256,
|
|
622
|
+
blobUri,
|
|
623
|
+
blob_uri,
|
|
624
|
+
blobSha256,
|
|
625
|
+
blob_sha256,
|
|
626
|
+
blobContainerName,
|
|
627
|
+
blob_container_name,
|
|
628
|
+
blobObjectKey,
|
|
629
|
+
blob_object_key,
|
|
630
|
+
metadata = {},
|
|
631
|
+
} = {}) {
|
|
632
|
+
return this._request('/api/agent-communications/bundles', {
|
|
633
|
+
method: 'POST',
|
|
634
|
+
body: {
|
|
635
|
+
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
636
|
+
communication_thread_id: cleanText(communication_thread_id) || cleanText(communicationThreadId) || cleanText(threadId),
|
|
637
|
+
source_agent_session_id: cleanText(source_agent_session_id) || cleanText(sourceAgentSessionId),
|
|
638
|
+
source_actor_session_id: cleanText(source_actor_session_id) || cleanText(sourceActorSessionId),
|
|
639
|
+
recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
|
|
640
|
+
recipient_role_key: cleanText(recipient_role_key) || cleanText(recipientRoleKey),
|
|
641
|
+
bundle_kind: cleanText(bundle_kind) || cleanText(bundleKind) || 'transfer',
|
|
642
|
+
cleanup_policy: cleanText(cleanup_policy) || cleanText(cleanupPolicy) || 'cleanup_after_receipt',
|
|
643
|
+
manifest: isPlainObject(manifest) ? manifest : {},
|
|
644
|
+
manifest_sha256: cleanText(manifest_sha256) || cleanText(manifestSha256),
|
|
645
|
+
blob_uri: cleanText(blob_uri) || cleanText(blobUri),
|
|
646
|
+
blob_sha256: cleanText(blob_sha256) || cleanText(blobSha256),
|
|
647
|
+
blob_container_name: cleanText(blob_container_name) || cleanText(blobContainerName),
|
|
648
|
+
blob_object_key: cleanText(blob_object_key) || cleanText(blobObjectKey),
|
|
649
|
+
metadata: isPlainObject(metadata) ? metadata : {},
|
|
650
|
+
},
|
|
651
|
+
});
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
async getCommunicationBundle(bundleId) {
|
|
655
|
+
return this._request(`/api/agent-communications/bundles/${encodeURIComponent(bundleId)}`);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
async listCommunicationBundles({ workflowRunId, workflow_run_id } = {}) {
|
|
659
|
+
return this._request('/api/agent-communications/bundles', {
|
|
660
|
+
query: { workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId) },
|
|
661
|
+
});
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
async addCommunicationBundleItem({
|
|
665
|
+
communicationBundleId,
|
|
666
|
+
communication_bundle_id,
|
|
667
|
+
itemOrder,
|
|
668
|
+
item_order,
|
|
669
|
+
itemKind,
|
|
670
|
+
item_kind,
|
|
671
|
+
itemRef,
|
|
672
|
+
item_ref,
|
|
673
|
+
itemName,
|
|
674
|
+
item_name,
|
|
675
|
+
itemSha256,
|
|
676
|
+
item_sha256,
|
|
677
|
+
required,
|
|
678
|
+
metadata = {},
|
|
679
|
+
} = {}) {
|
|
680
|
+
const normalizedBundleId = cleanText(communication_bundle_id) || cleanText(communicationBundleId);
|
|
681
|
+
if (!normalizedBundleId) throw new Error('communication_bundle_id is required.');
|
|
682
|
+
return this._request(`/api/agent-communications/bundles/${encodeURIComponent(normalizedBundleId)}/items`, {
|
|
683
|
+
method: 'POST',
|
|
684
|
+
body: {
|
|
685
|
+
item_order: Number(item_order ?? itemOrder ?? 0),
|
|
686
|
+
item_kind: cleanText(item_kind) || cleanText(itemKind) || 'artifact',
|
|
687
|
+
item_ref: cleanText(item_ref) || cleanText(itemRef),
|
|
688
|
+
item_name: cleanText(item_name) || cleanText(itemName),
|
|
689
|
+
item_sha256: cleanText(item_sha256) || cleanText(itemSha256),
|
|
690
|
+
required: required !== undefined ? Boolean(required) : true,
|
|
691
|
+
metadata: isPlainObject(metadata) ? metadata : {},
|
|
692
|
+
},
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
|
|
696
|
+
async uploadCommunicationBundle({
|
|
697
|
+
communicationBundleId,
|
|
698
|
+
communication_bundle_id,
|
|
699
|
+
blobUri,
|
|
700
|
+
blob_uri,
|
|
701
|
+
blobSha256,
|
|
702
|
+
blob_sha256,
|
|
703
|
+
blobContainerName,
|
|
704
|
+
blob_container_name,
|
|
705
|
+
blobObjectKey,
|
|
706
|
+
blob_object_key,
|
|
707
|
+
manifest = {},
|
|
708
|
+
manifestSha256,
|
|
709
|
+
manifest_sha256,
|
|
710
|
+
uploadedAt,
|
|
711
|
+
uploaded_at,
|
|
712
|
+
} = {}) {
|
|
713
|
+
const normalizedBundleId = cleanText(communication_bundle_id) || cleanText(communicationBundleId);
|
|
714
|
+
if (!normalizedBundleId) throw new Error('communication_bundle_id is required.');
|
|
715
|
+
return this._request(`/api/agent-communications/bundles/${encodeURIComponent(normalizedBundleId)}/upload`, {
|
|
716
|
+
method: 'POST',
|
|
717
|
+
body: {
|
|
718
|
+
blob_uri: cleanText(blob_uri) || cleanText(blobUri),
|
|
719
|
+
blob_sha256: cleanText(blob_sha256) || cleanText(blobSha256),
|
|
720
|
+
blob_container_name: cleanText(blob_container_name) || cleanText(blobContainerName),
|
|
721
|
+
blob_object_key: cleanText(blob_object_key) || cleanText(blobObjectKey),
|
|
722
|
+
manifest: isPlainObject(manifest) ? manifest : {},
|
|
723
|
+
manifest_sha256: cleanText(manifest_sha256) || cleanText(manifestSha256),
|
|
724
|
+
uploaded_at: cleanText(uploaded_at) || cleanText(uploadedAt),
|
|
725
|
+
},
|
|
726
|
+
});
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
async attachCommunicationBundleToMessage({
|
|
730
|
+
communicationBundleId,
|
|
731
|
+
communication_bundle_id,
|
|
732
|
+
agentMessageId,
|
|
733
|
+
agent_message_id,
|
|
734
|
+
messageId,
|
|
735
|
+
messageStatus,
|
|
736
|
+
message_status,
|
|
737
|
+
} = {}) {
|
|
738
|
+
const normalizedBundleId = cleanText(communication_bundle_id) || cleanText(communicationBundleId);
|
|
739
|
+
if (!normalizedBundleId) throw new Error('communication_bundle_id is required.');
|
|
740
|
+
return this._request(`/api/agent-communications/bundles/${encodeURIComponent(normalizedBundleId)}/attach-to-message`, {
|
|
741
|
+
method: 'POST',
|
|
742
|
+
body: {
|
|
743
|
+
agent_message_id: cleanText(agent_message_id) || cleanText(agentMessageId) || cleanText(messageId),
|
|
744
|
+
message_status: cleanText(message_status) || cleanText(messageStatus),
|
|
745
|
+
},
|
|
746
|
+
});
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
async recordCommunicationBundleReceipt({
|
|
750
|
+
communicationBundleId,
|
|
751
|
+
communication_bundle_id,
|
|
752
|
+
recipientAgentSessionId,
|
|
753
|
+
recipient_agent_session_id,
|
|
754
|
+
recipientActorSessionId,
|
|
755
|
+
recipient_actor_session_id,
|
|
756
|
+
receiptStatus,
|
|
757
|
+
receipt_status,
|
|
758
|
+
manifestSha256,
|
|
759
|
+
manifest_sha256,
|
|
760
|
+
blobSha256,
|
|
761
|
+
blob_sha256,
|
|
762
|
+
fetchedItemCount,
|
|
763
|
+
fetched_item_count,
|
|
764
|
+
explicitlyAcceptedItemCount,
|
|
765
|
+
explicitly_accepted_item_count,
|
|
766
|
+
allRequiredItemsFetched,
|
|
767
|
+
all_required_items_fetched,
|
|
768
|
+
checksumsVerified,
|
|
769
|
+
checksums_verified,
|
|
770
|
+
receipt = {},
|
|
771
|
+
metadata = {},
|
|
772
|
+
} = {}) {
|
|
773
|
+
const normalizedBundleId = cleanText(communication_bundle_id) || cleanText(communicationBundleId);
|
|
774
|
+
if (!normalizedBundleId) throw new Error('communication_bundle_id is required.');
|
|
775
|
+
return this._request(`/api/agent-communications/bundles/${encodeURIComponent(normalizedBundleId)}/receipts`, {
|
|
776
|
+
method: 'POST',
|
|
777
|
+
body: {
|
|
778
|
+
recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
|
|
779
|
+
recipient_actor_session_id: cleanText(recipient_actor_session_id) || cleanText(recipientActorSessionId),
|
|
780
|
+
receipt_status: cleanText(receipt_status) || cleanText(receiptStatus) || 'received',
|
|
781
|
+
manifest_sha256: cleanText(manifest_sha256) || cleanText(manifestSha256),
|
|
782
|
+
blob_sha256: cleanText(blob_sha256) || cleanText(blobSha256),
|
|
783
|
+
fetched_item_count: Number(fetched_item_count ?? fetchedItemCount ?? 0),
|
|
784
|
+
explicitly_accepted_item_count: Number(explicitly_accepted_item_count ?? explicitlyAcceptedItemCount ?? 0),
|
|
785
|
+
all_required_items_fetched: Boolean(all_required_items_fetched ?? allRequiredItemsFetched ?? false),
|
|
786
|
+
checksums_verified: Boolean(checksums_verified ?? checksumsVerified ?? false),
|
|
787
|
+
receipt: isPlainObject(receipt) ? receipt : {},
|
|
788
|
+
metadata: isPlainObject(metadata) ? metadata : {},
|
|
789
|
+
},
|
|
790
|
+
});
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
async recordCommunicationBundleCleanupEvent({
|
|
794
|
+
communicationBundleId,
|
|
795
|
+
communication_bundle_id,
|
|
796
|
+
cleanupStatus,
|
|
797
|
+
cleanup_status,
|
|
798
|
+
cleanupReason,
|
|
799
|
+
cleanup_reason,
|
|
800
|
+
blobUri,
|
|
801
|
+
blob_uri,
|
|
802
|
+
deletedAt,
|
|
803
|
+
deleted_at,
|
|
804
|
+
errorMessage,
|
|
805
|
+
error_message,
|
|
806
|
+
metadata = {},
|
|
807
|
+
} = {}) {
|
|
808
|
+
const normalizedBundleId = cleanText(communication_bundle_id) || cleanText(communicationBundleId);
|
|
809
|
+
if (!normalizedBundleId) throw new Error('communication_bundle_id is required.');
|
|
810
|
+
return this._request(`/api/agent-communications/bundles/${encodeURIComponent(normalizedBundleId)}/cleanup-events`, {
|
|
811
|
+
method: 'POST',
|
|
812
|
+
body: {
|
|
813
|
+
cleanup_status: cleanText(cleanup_status) || cleanText(cleanupStatus) || 'cleanup_failed',
|
|
814
|
+
cleanup_reason: cleanText(cleanup_reason) || cleanText(cleanupReason),
|
|
815
|
+
blob_uri: cleanText(blob_uri) || cleanText(blobUri),
|
|
816
|
+
deleted_at: cleanText(deleted_at) || cleanText(deletedAt),
|
|
817
|
+
error_message: cleanText(error_message) || cleanText(errorMessage),
|
|
818
|
+
metadata: isPlainObject(metadata) ? metadata : {},
|
|
819
|
+
},
|
|
820
|
+
});
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
async claimCommunicationBundle({
|
|
824
|
+
communicationBundleId,
|
|
825
|
+
communication_bundle_id,
|
|
826
|
+
claimedAt,
|
|
827
|
+
claimed_at,
|
|
828
|
+
} = {}) {
|
|
829
|
+
const normalizedBundleId = cleanText(communication_bundle_id) || cleanText(communicationBundleId);
|
|
830
|
+
if (!normalizedBundleId) throw new Error('communication_bundle_id is required.');
|
|
831
|
+
return this._request(`/api/agent-communications/bundles/${encodeURIComponent(normalizedBundleId)}/claim`, {
|
|
832
|
+
method: 'POST',
|
|
833
|
+
body: {
|
|
834
|
+
claimed_at: cleanText(claimed_at) || cleanText(claimedAt),
|
|
835
|
+
},
|
|
836
|
+
});
|
|
837
|
+
}
|
|
838
|
+
|
|
589
839
|
async acceptCommunicationMessage(messageId) {
|
|
590
840
|
return this._request(`/api/agent-communications/messages/${encodeURIComponent(messageId)}/accept`, {
|
|
591
841
|
method: 'POST',
|