@bpmsoftwaresolutions/ai-engine-client 1.1.56 → 1.1.57
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 +144 -2
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.57';
|
|
3
3
|
export const GOVERNED_MUTATION_REQUIRED_CAPABILITIES = [
|
|
4
4
|
'executeVerifiedMutation',
|
|
5
5
|
'post_mutation_verification',
|
|
@@ -409,7 +409,7 @@ export class AIEngineClient {
|
|
|
409
409
|
openThread: (request) => this.openCommunicationThread(request),
|
|
410
410
|
getThread: (threadId) => this.getCommunicationThread(threadId),
|
|
411
411
|
listInbox: (request) => this.listCommunicationInbox(request),
|
|
412
|
-
sendMessage: (request) => this.
|
|
412
|
+
sendMessage: (request) => this._sendAgentCommsMessage(request),
|
|
413
413
|
getCommunicationCapabilities: (request) => this.getCommunicationCapabilities(request),
|
|
414
414
|
getCollaborationCapabilities: (request) => this.getCollaborationCapabilities(request),
|
|
415
415
|
getDeploymentCapabilities: (request) => this.getDeploymentCapabilities(request),
|
|
@@ -440,6 +440,10 @@ export class AIEngineClient {
|
|
|
440
440
|
acceptHandoff: (request) => this.acceptCommunicationHandoff(request),
|
|
441
441
|
whoIsOnline: (request) => this.whoIsOnline(request),
|
|
442
442
|
findOnlineParticipant: (request) => this.findOnlineParticipant(request),
|
|
443
|
+
listCommunicationChannels: (request) => this.listCommunicationChannels(request),
|
|
444
|
+
listOpenCommunicationChannels: (request) => this.listOpenCommunicationChannels(request),
|
|
445
|
+
getCommunicationChannelStatus: (request) => this.getCommunicationChannelStatus(request),
|
|
446
|
+
getCommunicationChannelParticipants: (request) => this.getCommunicationChannelParticipants(request),
|
|
443
447
|
getPresenceBoard: (request) => this.getPresenceBoard(request),
|
|
444
448
|
getChannelPresence: (request) => this.getChannelPresence(request),
|
|
445
449
|
markParticipantOnline: (request) => this.markParticipantOnline(request),
|
|
@@ -447,6 +451,9 @@ export class AIEngineClient {
|
|
|
447
451
|
sendToParticipant: (request) => this.sendToParticipant(request),
|
|
448
452
|
sendToRole: (request) => this.sendToRole(request),
|
|
449
453
|
getMyInbox: (request) => this.getMyInbox(request),
|
|
454
|
+
verifyMessageSent: (request) => this.verifyMessageSent(request),
|
|
455
|
+
verifyMessageReceived: (request) => this.verifyMessageReceived(request),
|
|
456
|
+
getMessageDeliveryReceipt: (request) => this.getMessageDeliveryReceipt(request),
|
|
450
457
|
connectToTransferChannel: (request) => this.connectToTransferChannel(request),
|
|
451
458
|
respondToMessageWatch: (request) => this.respondToMessageWatch(request),
|
|
452
459
|
};
|
|
@@ -460,6 +467,10 @@ export class AIEngineClient {
|
|
|
460
467
|
requestClosure: (request) => this.requestCollaborationClosure(request),
|
|
461
468
|
whoIsOnline: (request) => this.whoIsOnline(request),
|
|
462
469
|
findOnlineParticipant: (request) => this.findOnlineParticipant(request),
|
|
470
|
+
listCommunicationChannels: (request) => this.listCommunicationChannels(request),
|
|
471
|
+
listOpenCommunicationChannels: (request) => this.listOpenCommunicationChannels(request),
|
|
472
|
+
getCommunicationChannelStatus: (request) => this.getCommunicationChannelStatus(request),
|
|
473
|
+
getCommunicationChannelParticipants: (request) => this.getCommunicationChannelParticipants(request),
|
|
463
474
|
getPresenceBoard: (request) => this.getPresenceBoard(request),
|
|
464
475
|
getChannelPresence: (request) => this.getChannelPresence(request),
|
|
465
476
|
markParticipantOnline: (request) => this.markParticipantOnline(request),
|
|
@@ -467,6 +478,10 @@ export class AIEngineClient {
|
|
|
467
478
|
sendToParticipant: (request) => this.sendToParticipant(request),
|
|
468
479
|
sendToRole: (request) => this.sendToRole(request),
|
|
469
480
|
getMyInbox: (request) => this.getMyInbox(request),
|
|
481
|
+
sendMessage: (request) => this._sendAgentCommsMessage(request),
|
|
482
|
+
verifyMessageSent: (request) => this.verifyMessageSent(request),
|
|
483
|
+
verifyMessageReceived: (request) => this.verifyMessageReceived(request),
|
|
484
|
+
getMessageDeliveryReceipt: (request) => this.getMessageDeliveryReceipt(request),
|
|
470
485
|
};
|
|
471
486
|
}
|
|
472
487
|
|
|
@@ -657,6 +672,50 @@ export class AIEngineClient {
|
|
|
657
672
|
return this._request('/api/agent-communications/deployment-capabilities');
|
|
658
673
|
}
|
|
659
674
|
|
|
675
|
+
async listCommunicationChannels({
|
|
676
|
+
workflowRunId,
|
|
677
|
+
workflow_run_id,
|
|
678
|
+
workTransferPacketId,
|
|
679
|
+
work_transfer_packet_id,
|
|
680
|
+
status,
|
|
681
|
+
channelStatus,
|
|
682
|
+
channel_status,
|
|
683
|
+
} = {}) {
|
|
684
|
+
return this._request('/api/agent-communications/transfer-channels', {
|
|
685
|
+
query: {
|
|
686
|
+
workflow_run_id: cleanText(workflow_run_id) || cleanText(workflowRunId),
|
|
687
|
+
work_transfer_packet_id: cleanText(work_transfer_packet_id) || cleanText(workTransferPacketId),
|
|
688
|
+
status: cleanText(status) || cleanText(channel_status) || cleanText(channelStatus),
|
|
689
|
+
},
|
|
690
|
+
});
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
async listOpenCommunicationChannels(request = {}) {
|
|
694
|
+
return this.listCommunicationChannels({ ...request, status: 'open' });
|
|
695
|
+
}
|
|
696
|
+
|
|
697
|
+
async getCommunicationChannelStatus({
|
|
698
|
+
transferChannelId,
|
|
699
|
+
transfer_channel_id,
|
|
700
|
+
channelId,
|
|
701
|
+
channel_id,
|
|
702
|
+
} = {}) {
|
|
703
|
+
const normalizedTransferChannelId = cleanText(transfer_channel_id) || cleanText(transferChannelId) || cleanText(channel_id) || cleanText(channelId);
|
|
704
|
+
if (!normalizedTransferChannelId) throw new Error('transferChannelId is required.');
|
|
705
|
+
return this._request(`/api/agent-communications/transfer-channels/${encodeURIComponent(normalizedTransferChannelId)}/status`);
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
async getCommunicationChannelParticipants({
|
|
709
|
+
transferChannelId,
|
|
710
|
+
transfer_channel_id,
|
|
711
|
+
channelId,
|
|
712
|
+
channel_id,
|
|
713
|
+
} = {}) {
|
|
714
|
+
const normalizedTransferChannelId = cleanText(transfer_channel_id) || cleanText(transferChannelId) || cleanText(channel_id) || cleanText(channelId);
|
|
715
|
+
if (!normalizedTransferChannelId) throw new Error('transferChannelId is required.');
|
|
716
|
+
return this._request(`/api/agent-communications/transfer-channels/${encodeURIComponent(normalizedTransferChannelId)}/participants`);
|
|
717
|
+
}
|
|
718
|
+
|
|
660
719
|
async getPresenceBoard({
|
|
661
720
|
workflowRunId,
|
|
662
721
|
workflow_run_id,
|
|
@@ -1617,6 +1676,89 @@ export class AIEngineClient {
|
|
|
1617
1676
|
});
|
|
1618
1677
|
}
|
|
1619
1678
|
|
|
1679
|
+
async verifyMessageSent({ messageId, message_id } = {}) {
|
|
1680
|
+
const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
|
|
1681
|
+
if (!normalizedMessageId) throw new Error('message_id is required.');
|
|
1682
|
+
return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/verify-sent`, {
|
|
1683
|
+
method: 'POST',
|
|
1684
|
+
body: { message_id: normalizedMessageId },
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
async verifyMessageReceived({
|
|
1689
|
+
messageId,
|
|
1690
|
+
message_id,
|
|
1691
|
+
recipientAgentSessionId,
|
|
1692
|
+
recipient_agent_session_id,
|
|
1693
|
+
recipientRole,
|
|
1694
|
+
recipient_role,
|
|
1695
|
+
role,
|
|
1696
|
+
participantId,
|
|
1697
|
+
participant_id,
|
|
1698
|
+
} = {}) {
|
|
1699
|
+
const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
|
|
1700
|
+
if (!normalizedMessageId) throw new Error('message_id is required.');
|
|
1701
|
+
return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/verify-received`, {
|
|
1702
|
+
method: 'POST',
|
|
1703
|
+
body: {
|
|
1704
|
+
message_id: normalizedMessageId,
|
|
1705
|
+
recipient_agent_session_id: cleanText(recipient_agent_session_id) || cleanText(recipientAgentSessionId),
|
|
1706
|
+
recipient_role: cleanText(recipient_role) || cleanText(recipientRole) || cleanText(role),
|
|
1707
|
+
participant_id: cleanText(participant_id) || cleanText(participantId),
|
|
1708
|
+
},
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
async getMessageDeliveryReceipt({ messageId, message_id } = {}) {
|
|
1713
|
+
const normalizedMessageId = cleanText(message_id) || cleanText(messageId);
|
|
1714
|
+
if (!normalizedMessageId) throw new Error('message_id is required.');
|
|
1715
|
+
return this._request(`/api/agent-communications/messages/${encodeURIComponent(normalizedMessageId)}/delivery-receipt`, {
|
|
1716
|
+
method: 'GET',
|
|
1717
|
+
});
|
|
1718
|
+
}
|
|
1719
|
+
|
|
1720
|
+
async _sendAgentCommsMessage(request = {}) {
|
|
1721
|
+
const hasThreadContext = Boolean(
|
|
1722
|
+
cleanText(request.communication_thread_id)
|
|
1723
|
+
|| cleanText(request.communicationThreadId)
|
|
1724
|
+
|| cleanText(request.thread_id)
|
|
1725
|
+
|| cleanText(request.threadId)
|
|
1726
|
+
|| cleanText(request.recipient_role_key)
|
|
1727
|
+
|| cleanText(request.recipientRoleKey)
|
|
1728
|
+
);
|
|
1729
|
+
const hasTransferChannelContext = Boolean(
|
|
1730
|
+
cleanText(request.transfer_channel_id)
|
|
1731
|
+
|| cleanText(request.transferChannelId)
|
|
1732
|
+
|| cleanText(request.channel_id)
|
|
1733
|
+
|| cleanText(request.channelId)
|
|
1734
|
+
|| cleanText(request.sender_role)
|
|
1735
|
+
|| cleanText(request.senderRole)
|
|
1736
|
+
|| cleanText(request.recipient_role)
|
|
1737
|
+
|| cleanText(request.recipientRole)
|
|
1738
|
+
|| cleanText(request.role)
|
|
1739
|
+
|| cleanText(request.participant_role)
|
|
1740
|
+
|| cleanText(request.participantRole)
|
|
1741
|
+
|| cleanText(request.participant_id)
|
|
1742
|
+
|| cleanText(request.participantId)
|
|
1743
|
+
|| cleanText(request.recipient_participant_id)
|
|
1744
|
+
|| cleanText(request.recipientParticipantId)
|
|
1745
|
+
);
|
|
1746
|
+
if (hasTransferChannelContext && !hasThreadContext) {
|
|
1747
|
+
if (
|
|
1748
|
+
cleanText(request.participant_id)
|
|
1749
|
+
|| cleanText(request.participantId)
|
|
1750
|
+
|| cleanText(request.recipient_participant_id)
|
|
1751
|
+
|| cleanText(request.recipientParticipantId)
|
|
1752
|
+
|| cleanText(request.recipient_agent_session_id)
|
|
1753
|
+
|| cleanText(request.recipientAgentSessionId)
|
|
1754
|
+
) {
|
|
1755
|
+
return this.sendToParticipant(request);
|
|
1756
|
+
}
|
|
1757
|
+
return this.sendToRole(request);
|
|
1758
|
+
}
|
|
1759
|
+
return this.sendCommunicationMessage(request);
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1620
1762
|
async sendCommunicationMessage({
|
|
1621
1763
|
communicationThreadId,
|
|
1622
1764
|
communication_thread_id,
|