@verana-labs/vs-agent-plugin-chat 1.10.1
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/LICENSE +201 -0
- package/build/events/ChatEvents.d.ts +4 -0
- package/build/events/ChatEvents.js +223 -0
- package/build/events/ChatEvents.js.map +1 -0
- package/build/handlers/ChatMessageHandler.d.ts +13 -0
- package/build/handlers/ChatMessageHandler.js +273 -0
- package/build/handlers/ChatMessageHandler.js.map +1 -0
- package/build/index.d.ts +6 -0
- package/build/index.js +12 -0
- package/build/index.js.map +1 -0
- package/build/nestjs/ChatPlugin.d.ts +2 -0
- package/build/nestjs/ChatPlugin.js +16 -0
- package/build/nestjs/ChatPlugin.js.map +1 -0
- package/build/sdk/setupChatProtocols.d.ts +5 -0
- package/build/sdk/setupChatProtocols.js +25 -0
- package/build/sdk/setupChatProtocols.js.map +1 -0
- package/build/types.d.ts +17 -0
- package/build/types.js +3 -0
- package/build/types.js.map +1 -0
- package/package.json +48 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ChatAgentModules } from '../types';
|
|
2
|
+
import type { VsAgentPluginConfig } from '@verana-labs/vs-agent-sdk';
|
|
3
|
+
import { VsAgent } from '@verana-labs/vs-agent-sdk';
|
|
4
|
+
export declare const chatEvents: (agent: VsAgent<ChatAgentModules>, config: VsAgentPluginConfig) => Promise<void>;
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chatEvents = void 0;
|
|
4
|
+
const credo_ts_didcomm_calls_1 = require("@2060.io/credo-ts-didcomm-calls");
|
|
5
|
+
const credo_ts_didcomm_media_sharing_1 = require("@2060.io/credo-ts-didcomm-media-sharing");
|
|
6
|
+
const credo_ts_didcomm_reactions_1 = require("@2060.io/credo-ts-didcomm-reactions");
|
|
7
|
+
const credo_ts_didcomm_receipts_1 = require("@2060.io/credo-ts-didcomm-receipts");
|
|
8
|
+
const credo_ts_didcomm_user_profile_1 = require("@2060.io/credo-ts-didcomm-user-profile");
|
|
9
|
+
const action_menu_1 = require("@credo-ts/action-menu");
|
|
10
|
+
const didcomm_1 = require("@credo-ts/didcomm");
|
|
11
|
+
const question_answer_1 = require("@credo-ts/question-answer");
|
|
12
|
+
const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
|
|
13
|
+
const vs_agent_sdk_1 = require("@verana-labs/vs-agent-sdk");
|
|
14
|
+
// FIXME: timestamps are currently taken from reception date. They should be get from the originating DIDComm message
|
|
15
|
+
// as soon as the corresponding extension is added to them
|
|
16
|
+
const chatEvents = async (agent, config) => {
|
|
17
|
+
agent.events.on(didcomm_1.DidCommEventTypes.DidCommMessageProcessed, async ({ payload }) => {
|
|
18
|
+
var _a, _b, _c, _d, _e;
|
|
19
|
+
config.logger.debug(`DidCommMessageProcessedEvent received: ${JSON.stringify(payload.message)}`);
|
|
20
|
+
const { message, connection } = payload;
|
|
21
|
+
if (!connection) {
|
|
22
|
+
config.logger.warn(`[chatEvents] Received contactless message of type ${message.type}. Not supported yet.`);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// Basic Message protocol messages
|
|
26
|
+
if (message.type === didcomm_1.DidCommBasicMessage.type.messageTypeUri) {
|
|
27
|
+
const msg = new vs_agent_model_1.TextMessage({
|
|
28
|
+
connectionId: connection.id,
|
|
29
|
+
content: payload.message.content,
|
|
30
|
+
id: payload.message.id,
|
|
31
|
+
threadId: (_a = payload.message.thread) === null || _a === void 0 ? void 0 : _a.parentThreadId,
|
|
32
|
+
timestamp: new Date(),
|
|
33
|
+
});
|
|
34
|
+
if (msg.threadId)
|
|
35
|
+
msg.threadId = await (0, vs_agent_sdk_1.getRecordId)(agent, msg.threadId);
|
|
36
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
37
|
+
}
|
|
38
|
+
// Action Menu protocol messages
|
|
39
|
+
if (message.type === action_menu_1.MenuRequestMessage.type.messageTypeUri) {
|
|
40
|
+
const msg = new vs_agent_model_1.ContextualMenuRequestMessage({
|
|
41
|
+
connectionId: connection.id,
|
|
42
|
+
id: connection.id,
|
|
43
|
+
timestamp: new Date(),
|
|
44
|
+
});
|
|
45
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
46
|
+
}
|
|
47
|
+
if (message.type === action_menu_1.PerformMessage.type.messageTypeUri) {
|
|
48
|
+
const msg = new vs_agent_model_1.ContextualMenuSelectMessage({
|
|
49
|
+
selectionId: message.name,
|
|
50
|
+
connectionId: connection.id,
|
|
51
|
+
id: message.id,
|
|
52
|
+
timestamp: new Date(),
|
|
53
|
+
});
|
|
54
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
55
|
+
}
|
|
56
|
+
// Question Answer protocol messages
|
|
57
|
+
if (message.type === question_answer_1.AnswerMessage.type.messageTypeUri) {
|
|
58
|
+
const record = await agent.dependencyManager
|
|
59
|
+
.resolve(question_answer_1.QuestionAnswerService)
|
|
60
|
+
.getByThreadAndConnectionId(agent.context, connection.id, message.threadId);
|
|
61
|
+
const textIdMapping = record.metadata.get('text-id-mapping');
|
|
62
|
+
if (!textIdMapping) {
|
|
63
|
+
config.logger.warn(`[chatEvents] No text-id mapping found for Menu message. Using responded text as identifier`);
|
|
64
|
+
}
|
|
65
|
+
const selectionId = textIdMapping
|
|
66
|
+
? textIdMapping[message.response]
|
|
67
|
+
: message.response;
|
|
68
|
+
const msg = new vs_agent_model_1.MenuSelectMessage({
|
|
69
|
+
threadId: message.threadId,
|
|
70
|
+
connectionId: connection.id,
|
|
71
|
+
menuItems: [{ id: selectionId }],
|
|
72
|
+
id: message.id,
|
|
73
|
+
});
|
|
74
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
75
|
+
}
|
|
76
|
+
if (message.type === credo_ts_didcomm_calls_1.CallOfferMessage.type.messageTypeUri) {
|
|
77
|
+
const callOffer = message;
|
|
78
|
+
const msg = new vs_agent_model_1.CallOfferRequestMessage({
|
|
79
|
+
id: await (0, vs_agent_sdk_1.getRecordId)(agent, message.id),
|
|
80
|
+
connectionId: connection.id,
|
|
81
|
+
offerExpirationTime: (_b = callOffer.offerExpirationTime) !== null && _b !== void 0 ? _b : undefined,
|
|
82
|
+
offerStartTime: (_c = callOffer.offerStartTime) !== null && _c !== void 0 ? _c : undefined,
|
|
83
|
+
description: callOffer.description,
|
|
84
|
+
parameters: callOffer.parameters,
|
|
85
|
+
threadId: (_d = message.thread) === null || _d === void 0 ? void 0 : _d.threadId,
|
|
86
|
+
timestamp: new Date(),
|
|
87
|
+
});
|
|
88
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
89
|
+
}
|
|
90
|
+
if (message.type === credo_ts_didcomm_calls_1.CallEndMessage.type.messageTypeUri) {
|
|
91
|
+
const thread = message.thread;
|
|
92
|
+
const msg = new vs_agent_model_1.CallEndRequestMessage({
|
|
93
|
+
id: await (0, vs_agent_sdk_1.getRecordId)(agent, message.id),
|
|
94
|
+
connectionId: connection.id,
|
|
95
|
+
threadId: thread === null || thread === void 0 ? void 0 : thread.threadId,
|
|
96
|
+
timestamp: new Date(),
|
|
97
|
+
});
|
|
98
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
99
|
+
}
|
|
100
|
+
if (message.type === credo_ts_didcomm_calls_1.CallAcceptMessage.type.messageTypeUri) {
|
|
101
|
+
const parameters = message.parameters;
|
|
102
|
+
const msg = new vs_agent_model_1.CallAcceptRequestMessage({
|
|
103
|
+
id: await (0, vs_agent_sdk_1.getRecordId)(agent, message.id),
|
|
104
|
+
connectionId: connection.id,
|
|
105
|
+
parameters: parameters,
|
|
106
|
+
threadId: (_e = message.thread) === null || _e === void 0 ? void 0 : _e.threadId,
|
|
107
|
+
timestamp: new Date(),
|
|
108
|
+
});
|
|
109
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
110
|
+
}
|
|
111
|
+
if (message.type === credo_ts_didcomm_calls_1.CallRejectMessage.type.messageTypeUri) {
|
|
112
|
+
const thread = message.thread;
|
|
113
|
+
const msg = new vs_agent_model_1.CallRejectRequestMessage({
|
|
114
|
+
id: await (0, vs_agent_sdk_1.getRecordId)(agent, message.id),
|
|
115
|
+
connectionId: connection.id,
|
|
116
|
+
threadId: thread === null || thread === void 0 ? void 0 : thread.threadId,
|
|
117
|
+
timestamp: new Date(),
|
|
118
|
+
});
|
|
119
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
// Media protocol events
|
|
123
|
+
agent.events.on(credo_ts_didcomm_media_sharing_1.DidCommMediaSharingEventTypes.StateChanged, async ({ payload }) => {
|
|
124
|
+
var _a;
|
|
125
|
+
const record = payload.mediaSharingRecord;
|
|
126
|
+
config.logger.debug(`MediaSharingStateChangedEvent received. Role: ${record.role} Connection id: ${record.connectionId}. Items: ${JSON.stringify(record.items)}`);
|
|
127
|
+
if (record.state === credo_ts_didcomm_media_sharing_1.DidCommMediaSharingState.MediaShared &&
|
|
128
|
+
record.role === credo_ts_didcomm_media_sharing_1.DidCommMediaSharingRole.Receiver) {
|
|
129
|
+
if (record.items) {
|
|
130
|
+
const message = new vs_agent_model_1.MediaMessage({
|
|
131
|
+
connectionId: record.connectionId,
|
|
132
|
+
id: record.threadId,
|
|
133
|
+
threadId: record.parentThreadId,
|
|
134
|
+
timestamp: record.createdAt,
|
|
135
|
+
items: (_a = record.items) === null || _a === void 0 ? void 0 : _a.map(item => {
|
|
136
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
137
|
+
return ({
|
|
138
|
+
id: item.id,
|
|
139
|
+
ciphering: item.ciphering,
|
|
140
|
+
uri: item.uri,
|
|
141
|
+
mimeType: item.mimeType,
|
|
142
|
+
byteCount: item.byteCount,
|
|
143
|
+
description: item.description,
|
|
144
|
+
filename: item.fileName,
|
|
145
|
+
duration: (_a = item.metadata) === null || _a === void 0 ? void 0 : _a.duration,
|
|
146
|
+
preview: (_b = item.metadata) === null || _b === void 0 ? void 0 : _b.preview,
|
|
147
|
+
width: (_c = item.metadata) === null || _c === void 0 ? void 0 : _c.width,
|
|
148
|
+
height: (_d = item.metadata) === null || _d === void 0 ? void 0 : _d.height,
|
|
149
|
+
title: (_e = item.metadata) === null || _e === void 0 ? void 0 : _e.title,
|
|
150
|
+
icon: (_f = item.metadata) === null || _f === void 0 ? void 0 : _f.icon,
|
|
151
|
+
openingMode: (_g = item.metadata) === null || _g === void 0 ? void 0 : _g.openingMode,
|
|
152
|
+
screenOrientation: (_h = item.metadata) === null || _h === void 0 ? void 0 : _h.screenOrientation,
|
|
153
|
+
});
|
|
154
|
+
}),
|
|
155
|
+
});
|
|
156
|
+
if (message.threadId)
|
|
157
|
+
message.threadId = await (0, vs_agent_sdk_1.getRecordId)(agent, message.threadId);
|
|
158
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(message, message.timestamp, config);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
// Receipts protocol events
|
|
163
|
+
agent.events.on(credo_ts_didcomm_receipts_1.ReceiptsEventTypes.MessageReceiptsReceived, async ({ payload }) => {
|
|
164
|
+
const connectionId = payload.connectionId;
|
|
165
|
+
config.logger.debug(`MessageReceiptsReceivedEvent received. Connection id: ${connectionId}. Receipts: ${JSON.stringify(payload.receipts)}`);
|
|
166
|
+
const receipts = payload.receipts;
|
|
167
|
+
receipts.forEach(receipt => {
|
|
168
|
+
const { messageId, timestamp, state } = receipt;
|
|
169
|
+
sendMessageStateUpdatedEvent({ agent, messageId, connectionId, state, timestamp, config });
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
// Reactions protocol events
|
|
173
|
+
agent.events.on(credo_ts_didcomm_reactions_1.DidCommReactionsEventTypes.DidCommMessageReactionsReceived, async ({ payload }) => {
|
|
174
|
+
const { connectionId, reactions } = payload;
|
|
175
|
+
config.logger.debug(`DidCommMessageReactionsReceivedEvent received. Connection id: ${connectionId}. Reactions: ${JSON.stringify(reactions)}`);
|
|
176
|
+
const msg = new vs_agent_model_1.ReactionMessage({
|
|
177
|
+
connectionId,
|
|
178
|
+
reactions: reactions.map(r => ({
|
|
179
|
+
messageId: r.messageId,
|
|
180
|
+
emoji: r.emoji,
|
|
181
|
+
action: r.action,
|
|
182
|
+
timestamp: r.timestamp,
|
|
183
|
+
})),
|
|
184
|
+
});
|
|
185
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
186
|
+
});
|
|
187
|
+
// User profile events
|
|
188
|
+
agent.events.on(credo_ts_didcomm_user_profile_1.DidCommProfileEventTypes.UserProfileRequested, async ({ payload }) => {
|
|
189
|
+
config.logger.debug(`UserProfileRequestedEvent received. Connection id: ${payload.connection.id} Query: ${JSON.stringify(payload.query)}`);
|
|
190
|
+
const outOfBandRecordId = payload.connection.outOfBandId;
|
|
191
|
+
if (outOfBandRecordId) {
|
|
192
|
+
const outOfBandRecord = await agent.didcomm.oob.findById(outOfBandRecordId);
|
|
193
|
+
const parentConnectionId = outOfBandRecord === null || outOfBandRecord === void 0 ? void 0 : outOfBandRecord.getTag('parentConnectionId');
|
|
194
|
+
if (!parentConnectionId && agent.autoDiscloseUserProfile)
|
|
195
|
+
await agent.modules.userProfile.sendUserProfile({ connectionId: payload.connection.id });
|
|
196
|
+
}
|
|
197
|
+
});
|
|
198
|
+
agent.events.on(credo_ts_didcomm_user_profile_1.DidCommProfileEventTypes.ConnectionProfileUpdated, async ({ payload: { connection, profile } }) => {
|
|
199
|
+
const { displayName, displayPicture, displayIcon, description, preferredLanguage } = profile;
|
|
200
|
+
config.logger.debug(`ConnectionProfileUpdatedEvent received. Connection id: ${connection.id} Profile: ${JSON.stringify(profile)}`);
|
|
201
|
+
const msg = new vs_agent_model_1.ProfileMessage({
|
|
202
|
+
connectionId: connection.id,
|
|
203
|
+
displayName,
|
|
204
|
+
displayImageUrl: displayPicture && (0, vs_agent_sdk_1.createDataUrl)(displayPicture),
|
|
205
|
+
displayIconUrl: displayIcon && (0, vs_agent_sdk_1.createDataUrl)(displayIcon),
|
|
206
|
+
description,
|
|
207
|
+
preferredLanguage,
|
|
208
|
+
});
|
|
209
|
+
await (0, vs_agent_sdk_1.sendMessageReceivedEvent)(msg, msg.timestamp, config);
|
|
210
|
+
});
|
|
211
|
+
};
|
|
212
|
+
exports.chatEvents = chatEvents;
|
|
213
|
+
const sendMessageStateUpdatedEvent = async (options) => {
|
|
214
|
+
const { agent, messageId, connectionId, state, timestamp, config } = options;
|
|
215
|
+
const body = new vs_agent_model_1.MessageStateUpdated({
|
|
216
|
+
messageId: await (0, vs_agent_sdk_1.getRecordId)(agent, messageId),
|
|
217
|
+
state,
|
|
218
|
+
timestamp,
|
|
219
|
+
connectionId,
|
|
220
|
+
});
|
|
221
|
+
await (0, vs_agent_sdk_1.sendWebhookEvent)(config.webhookUrl + '/message-state-updated', body, config.logger);
|
|
222
|
+
};
|
|
223
|
+
//# sourceMappingURL=ChatEvents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatEvents.js","sourceRoot":"","sources":["../../src/events/ChatEvents.ts"],"names":[],"mappings":";;;AAIA,4EAKwC;AACxC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c,EAAE,WAAW,IAAI,IAAA,4BAAa,EAAC,WAAW,CAAC;YACzD,WAAW;YACX,iBAAiB;SAClB,CAAC,CAAA;QAEF,MAAM,IAAA,uCAAwB,EAAC,GAAG,EAAE,GAAG,CAAC,SAAS,EAAE,MAAM,CAAC,CAAA;IAC5D,CAAC,CACF,CAAA;AACH,CAAC,CAAA;AA/PY,QAAA,UAAU,cA+PtB;AAED,MAAM,4BAA4B,GAAG,KAAK,EAAE,OAO3C,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,OAAO,CAAA;IAC5E,MAAM,IAAI,GAAG,IAAI,oCAAmB,CAAC;QACnC,SAAS,EAAE,MAAM,IAAA,0BAAW,EAAC,KAAK,EAAE,SAAS,CAAC;QAC9C,KAAK;QACL,SAAS;QACT,YAAY;KACb,CAAC,CAAA;IACF,MAAM,IAAA,+BAAgB,EAAC,MAAM,CAAC,UAAU,GAAG,wBAAwB,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,CAAA;AAC3F,CAAC,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MessageHandler } from '@verana-labs/vs-agent-sdk';
|
|
2
|
+
import { DidCommConnectionRecord } from '@credo-ts/didcomm';
|
|
3
|
+
import { IBaseMessage, MessageType } from '@verana-labs/vs-agent-model';
|
|
4
|
+
import { VsAgent } from '@verana-labs/vs-agent-sdk';
|
|
5
|
+
export declare class ChatMessageHandler implements MessageHandler {
|
|
6
|
+
readonly supportedTypes: MessageType[];
|
|
7
|
+
readonly openApiExamples: Record<string, {
|
|
8
|
+
summary: string;
|
|
9
|
+
description: string;
|
|
10
|
+
value: object;
|
|
11
|
+
}>;
|
|
12
|
+
handle(agent: VsAgent<any>, message: IBaseMessage, connection: DidCommConnectionRecord): Promise<string | undefined>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.ChatMessageHandler = void 0;
|
|
10
|
+
const action_menu_1 = require("@credo-ts/action-menu");
|
|
11
|
+
const core_1 = require("@credo-ts/core");
|
|
12
|
+
const question_answer_1 = require("@credo-ts/question-answer");
|
|
13
|
+
const common_1 = require("@nestjs/common");
|
|
14
|
+
const vs_agent_model_1 = require("@verana-labs/vs-agent-model");
|
|
15
|
+
const vs_agent_sdk_1 = require("@verana-labs/vs-agent-sdk");
|
|
16
|
+
let ChatMessageHandler = class ChatMessageHandler {
|
|
17
|
+
constructor() {
|
|
18
|
+
this.supportedTypes = [
|
|
19
|
+
vs_agent_model_1.MessageType.TextMessage,
|
|
20
|
+
vs_agent_model_1.MessageType.MediaMessage,
|
|
21
|
+
vs_agent_model_1.MessageType.ReceiptsMessage,
|
|
22
|
+
vs_agent_model_1.MessageType.ReactionMessage,
|
|
23
|
+
vs_agent_model_1.MessageType.MenuDisplayMessage,
|
|
24
|
+
vs_agent_model_1.MessageType.ContextualMenuUpdateMessage,
|
|
25
|
+
vs_agent_model_1.MessageType.ProfileMessage,
|
|
26
|
+
vs_agent_model_1.MessageType.CallOfferRequestMessage,
|
|
27
|
+
vs_agent_model_1.MessageType.CallEndRequestMessage,
|
|
28
|
+
];
|
|
29
|
+
this.openApiExamples = {
|
|
30
|
+
callAccept: {
|
|
31
|
+
summary: 'Call Accept',
|
|
32
|
+
description: '#### Call Accept\n\nAccept a call offer from a third party to initiate a WebRTC call. This message will return a `threadId`, which can be used to track the subsequent status of the call. Additional parameters related to the `wsUrl` of the WebRTC server connection are expected to notify the other party.',
|
|
33
|
+
value: { type: 'call-accept', parameters: { key: 'value' } },
|
|
34
|
+
},
|
|
35
|
+
callReject: {
|
|
36
|
+
summary: 'Call Reject',
|
|
37
|
+
description: '#### Call Reject\n\nReject a call offer from a third party to initiate a WebRTC call. This message will return a `threadId`, which can be used to identify which offer has been terminated.',
|
|
38
|
+
value: { type: 'call-reject' },
|
|
39
|
+
},
|
|
40
|
+
callEnd: {
|
|
41
|
+
summary: 'Call End',
|
|
42
|
+
description: '#### Call End\n\nEnd a call offer from a third party to initiate a WebRTC call. This message will return a `threadId`, which can be used to identify which offer has been terminated.',
|
|
43
|
+
value: { type: 'call-end' },
|
|
44
|
+
},
|
|
45
|
+
callOffer: {
|
|
46
|
+
summary: 'Call Offer',
|
|
47
|
+
description: '#### Call Offer\n\nCreate a call offer from a service to initiate a WebRTC call and notify the other party of the created request. This message will return a `threadId`, which can be used to track the subsequent status of the call. Additional parameters related to the `wsUrl` of the WebRTC server connection are expected to notify the other party.',
|
|
48
|
+
value: { type: 'call-offer', parameters: { key: 'value' } },
|
|
49
|
+
},
|
|
50
|
+
contextualMenuRequest: {
|
|
51
|
+
summary: 'Contextual Menu Request',
|
|
52
|
+
description: '#### Contextual Menu Request\n\nRequests a destination agent context menu root (if any). The other side should always respond with a [Context Menu Update](#contextual-menu-update) even if no context menu is available (in such case, an empty payload will be sent).',
|
|
53
|
+
value: { type: 'contextual-menu-request' },
|
|
54
|
+
},
|
|
55
|
+
contextualMenuSelect: {
|
|
56
|
+
summary: 'Contextual Menu Select',
|
|
57
|
+
description: '#### Contextual Menu Select\n\nSubmits the selected item of context menu.',
|
|
58
|
+
value: { type: 'contextual-menu-select', selectionId: 'string' },
|
|
59
|
+
},
|
|
60
|
+
contextualMenuUpdate: {
|
|
61
|
+
summary: 'Contextual Menu Update',
|
|
62
|
+
description: '#### Contextual Menu Update\n\nSends or updates the contents for the contextual menu to destination agent.',
|
|
63
|
+
value: {
|
|
64
|
+
type: 'contextual-menu-update',
|
|
65
|
+
payload: {
|
|
66
|
+
title: 'string',
|
|
67
|
+
description: 'string',
|
|
68
|
+
options: [{ id: 'string', title: 'string', description: 'string' }],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
media: {
|
|
73
|
+
summary: 'Media',
|
|
74
|
+
description: '#### Media\n\nShares media files to a destination. They might be previously encrypted and stored in an URL reachable by the destination agent.',
|
|
75
|
+
value: {
|
|
76
|
+
type: 'media',
|
|
77
|
+
description: 'string',
|
|
78
|
+
items: [
|
|
79
|
+
{
|
|
80
|
+
mimeType: 'string',
|
|
81
|
+
filename: 'string',
|
|
82
|
+
description: 'string',
|
|
83
|
+
byteCount: 'number',
|
|
84
|
+
uri: 'string',
|
|
85
|
+
ciphering: { algorithm: 'string' },
|
|
86
|
+
preview: 'string',
|
|
87
|
+
width: 'number',
|
|
88
|
+
height: 'number',
|
|
89
|
+
duration: 'number',
|
|
90
|
+
title: 'string',
|
|
91
|
+
icon: 'string',
|
|
92
|
+
openingMode: 'string',
|
|
93
|
+
screenOrientaton: 'string',
|
|
94
|
+
},
|
|
95
|
+
],
|
|
96
|
+
},
|
|
97
|
+
},
|
|
98
|
+
menuDisplay: {
|
|
99
|
+
summary: 'Menu Display',
|
|
100
|
+
description: 'Menu Display\n\nAuto-generated example .',
|
|
101
|
+
value: {
|
|
102
|
+
type: 'menu-display',
|
|
103
|
+
connectionId: 'REPLACE_WITH_CONNECTION_ID',
|
|
104
|
+
timestamp: '2025-08-19T16:17:08.871Z',
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
menuSelect: {
|
|
108
|
+
summary: 'Menu Select',
|
|
109
|
+
description: '#### Menu Select\n\nSubmits the selected item of a presented menu, defined in `threadId` field.',
|
|
110
|
+
value: { type: 'menu-select', menuItems: [{ id: 'string' }], content: 'string' },
|
|
111
|
+
},
|
|
112
|
+
profile: {
|
|
113
|
+
summary: 'Profile',
|
|
114
|
+
description: '#### Profile\n\nSends User Profile to a particular connection. An Agent may have its default profile settings, but also override them and send any arbitrary value to each connection. All items are optional.\n\n> **Notes**:\n\n- Display Image and Contextual Menu Image are sent as a Data URL or regular URL\n- A null value means to delete any existing one. A missing value means to keep the previous one.',
|
|
115
|
+
value: { type: 'profile', displayName: 'string', displayImageUrl: 'string', displayIconUrl: 'string' },
|
|
116
|
+
},
|
|
117
|
+
reaction: {
|
|
118
|
+
summary: 'Reaction',
|
|
119
|
+
description: '#### Reaction\n\nSends emoji reactions to previously received messages. Each reaction references a `message_id` and an `emoji`. Use `action: "react"` to add a reaction or `action: "unreact"` to remove it.',
|
|
120
|
+
value: {
|
|
121
|
+
type: 'reaction',
|
|
122
|
+
reactions: [{ message_id: 'uuid-of-original-message', emoji: '👍', action: 'react' }],
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
receipts: {
|
|
126
|
+
summary: 'Receipts',
|
|
127
|
+
description: '#### Receipts\n\nSends message updates for a number of messages.',
|
|
128
|
+
value: {
|
|
129
|
+
type: 'receipts',
|
|
130
|
+
receipts: [{ messageId: 'string', state: 'MessageState', timestamp: 'Date' }],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
text: {
|
|
134
|
+
summary: 'Text',
|
|
135
|
+
description: '#### Text\n\nSends a simple text to a destination',
|
|
136
|
+
value: { type: 'text', content: 'string' },
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
async handle(agent, message, connection) {
|
|
141
|
+
var _a;
|
|
142
|
+
const messageType = message.type;
|
|
143
|
+
let messageId;
|
|
144
|
+
if (messageType === vs_agent_model_1.TextMessage.type) {
|
|
145
|
+
const textMsg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.TextMessage);
|
|
146
|
+
const record = await agent.didcomm.basicMessages.sendMessage(textMsg.connectionId, textMsg.content);
|
|
147
|
+
messageId = record.threadId;
|
|
148
|
+
}
|
|
149
|
+
else if (messageType === vs_agent_model_1.MediaMessage.type) {
|
|
150
|
+
const mediaMsg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.MediaMessage);
|
|
151
|
+
const mediaRecord = await agent.modules.media.create({ connectionId: mediaMsg.connectionId });
|
|
152
|
+
const record = await agent.modules.media.share({
|
|
153
|
+
recordId: mediaRecord.id,
|
|
154
|
+
description: mediaMsg.description,
|
|
155
|
+
items: mediaMsg.items.map(item => {
|
|
156
|
+
var _a, _b;
|
|
157
|
+
return ({
|
|
158
|
+
id: item.id,
|
|
159
|
+
uri: item.uri,
|
|
160
|
+
description: item.description,
|
|
161
|
+
mimeType: item.mimeType,
|
|
162
|
+
byteCount: item.byteCount,
|
|
163
|
+
ciphering: ((_a = item.ciphering) === null || _a === void 0 ? void 0 : _a.algorithm)
|
|
164
|
+
? Object.assign(Object.assign({}, item.ciphering), { parameters: (_b = item.ciphering.parameters) !== null && _b !== void 0 ? _b : {} }) : undefined,
|
|
165
|
+
fileName: item.filename,
|
|
166
|
+
metadata: {
|
|
167
|
+
preview: item.preview,
|
|
168
|
+
width: item.width,
|
|
169
|
+
height: item.height,
|
|
170
|
+
duration: item.duration,
|
|
171
|
+
title: item.title,
|
|
172
|
+
icon: item.icon,
|
|
173
|
+
openingMode: item.openingMode,
|
|
174
|
+
screenOrientation: item.screenOrientation,
|
|
175
|
+
},
|
|
176
|
+
});
|
|
177
|
+
}),
|
|
178
|
+
});
|
|
179
|
+
messageId = record.threadId;
|
|
180
|
+
}
|
|
181
|
+
else if (messageType === vs_agent_model_1.ReceiptsMessage.type) {
|
|
182
|
+
const textMsg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.ReceiptsMessage);
|
|
183
|
+
await agent.modules.receipts.send({
|
|
184
|
+
connectionId: textMsg.connectionId,
|
|
185
|
+
receipts: textMsg.receipts.map(vs_agent_sdk_1.didcommReceiptFromVsAgentReceipt),
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
else if (messageType === vs_agent_model_1.ReactionMessage.type) {
|
|
189
|
+
const msg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.ReactionMessage);
|
|
190
|
+
await agent.modules.reactions.send({
|
|
191
|
+
connectionId: msg.connectionId,
|
|
192
|
+
reactions: msg.reactions.map(r => ({
|
|
193
|
+
messageId: r.messageId,
|
|
194
|
+
emoji: r.emoji,
|
|
195
|
+
action: r.action,
|
|
196
|
+
timestamp: r.timestamp,
|
|
197
|
+
})),
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
else if (messageType === vs_agent_model_1.MenuDisplayMessage.type) {
|
|
201
|
+
const msg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.MenuDisplayMessage);
|
|
202
|
+
const record = await agent.modules.questionAnswer.sendQuestion(msg.connectionId, {
|
|
203
|
+
question: msg.prompt,
|
|
204
|
+
validResponses: msg.menuItems.map(item => new question_answer_1.ValidResponse({ text: item.text })),
|
|
205
|
+
});
|
|
206
|
+
messageId = record.threadId;
|
|
207
|
+
record.metadata.add('text-id-mapping', msg.menuItems.reduce((acc, curr) => ((acc[curr.text] = curr.id), acc), {}));
|
|
208
|
+
await agent.dependencyManager.resolve(question_answer_1.QuestionAnswerRepository).update(agent.context, record);
|
|
209
|
+
}
|
|
210
|
+
else if (messageType === vs_agent_model_1.ContextualMenuUpdateMessage.type) {
|
|
211
|
+
const msg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.ContextualMenuUpdateMessage);
|
|
212
|
+
await agent.modules.actionMenu.clearActiveMenu({
|
|
213
|
+
connectionId: msg.connectionId,
|
|
214
|
+
role: action_menu_1.ActionMenuRole.Responder,
|
|
215
|
+
});
|
|
216
|
+
await agent.modules.actionMenu.sendMenu({
|
|
217
|
+
connectionId: msg.connectionId,
|
|
218
|
+
menu: {
|
|
219
|
+
title: msg.title,
|
|
220
|
+
description: (_a = msg.description) !== null && _a !== void 0 ? _a : '',
|
|
221
|
+
options: msg.options.map(item => {
|
|
222
|
+
var _a;
|
|
223
|
+
return new action_menu_1.ActionMenuOption({
|
|
224
|
+
title: item.title,
|
|
225
|
+
name: item.id,
|
|
226
|
+
description: (_a = item.description) !== null && _a !== void 0 ? _a : '',
|
|
227
|
+
});
|
|
228
|
+
}),
|
|
229
|
+
},
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
else if (messageType === vs_agent_model_1.ProfileMessage.type) {
|
|
233
|
+
const msg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.ProfileMessage);
|
|
234
|
+
const { displayImageUrl, displayName, displayIconUrl, description, preferredLanguage } = msg;
|
|
235
|
+
await agent.modules.userProfile.sendUserProfile({
|
|
236
|
+
connectionId: connection.id,
|
|
237
|
+
profileData: {
|
|
238
|
+
displayName: displayName !== null && displayName !== void 0 ? displayName : undefined,
|
|
239
|
+
displayPicture: displayImageUrl ? (0, vs_agent_sdk_1.parsePictureData)(displayImageUrl) : undefined,
|
|
240
|
+
displayIcon: displayIconUrl ? (0, vs_agent_sdk_1.parsePictureData)(displayIconUrl) : undefined,
|
|
241
|
+
description: description !== null && description !== void 0 ? description : undefined,
|
|
242
|
+
preferredLanguage: preferredLanguage !== null && preferredLanguage !== void 0 ? preferredLanguage : undefined,
|
|
243
|
+
},
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
else if (messageType === vs_agent_model_1.CallOfferRequestMessage.type) {
|
|
247
|
+
const msg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.CallOfferRequestMessage);
|
|
248
|
+
const callOffer = await agent.modules.calls.offer({
|
|
249
|
+
connectionId: connection.id,
|
|
250
|
+
offerExpirationTime: msg.offerExpirationTime,
|
|
251
|
+
offerStartTime: msg.offerStartTime,
|
|
252
|
+
description: msg.description,
|
|
253
|
+
callType: 'service',
|
|
254
|
+
parameters: msg.parameters,
|
|
255
|
+
});
|
|
256
|
+
messageId = callOffer.messageId;
|
|
257
|
+
}
|
|
258
|
+
else if (messageType === vs_agent_model_1.CallEndRequestMessage.type) {
|
|
259
|
+
const msg = core_1.JsonTransformer.fromJSON(message, vs_agent_model_1.CallEndRequestMessage);
|
|
260
|
+
const hangup = await agent.modules.calls.hangup({
|
|
261
|
+
connectionId: connection.id,
|
|
262
|
+
threadId: msg.threadId,
|
|
263
|
+
});
|
|
264
|
+
messageId = hangup.messageId;
|
|
265
|
+
}
|
|
266
|
+
return messageId;
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
exports.ChatMessageHandler = ChatMessageHandler;
|
|
270
|
+
exports.ChatMessageHandler = ChatMessageHandler = __decorate([
|
|
271
|
+
(0, common_1.Injectable)()
|
|
272
|
+
], ChatMessageHandler);
|
|
273
|
+
//# sourceMappingURL=ChatMessageHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatMessageHandler.js","sourceRoot":"","sources":["../../src/handlers/ChatMessageHandler.ts"],"names":[],"mappings":";;;;;;;;;AAEA,uDAAwE;AACxE,yCAAgD;AAEhD,+DAAmF;AACnF,2CAA2C;AAC3C,gEAYoC;AACpC,4DAAuG;AAGhG,IAAM,kBAAkB,GAAxB,MAAM,kBAAkB;IAAxB;QACI,mBAAc,GAAkB;YACvC,4BAAW,CAAC,WAAW;YACvB,4BAAW,CAAC,YAAY;YACxB,4BAAW,CAAC,eAAe;YAC3B,4BAAW,CAAC,eAAe;YAC3B,4BAAW,CAAC,kBAAkB;YAC9B,4BAAW,CAAC,2BAA2B;YACvC,4BAAW,CAAC,cAAc;YAC1B,4BAAW,CAAC,uBAAuB;YACnC,4BAAW,CAAC,qBAAqB;SAClC,CAAA;QAEQ,oBAAe,GAA4E;YAClG,UAAU,EAAE;gBACV,OAAO,EAAE,aAAa;gBACtB,WAAW,EACT,iTAAiT;gBACnT,KAAK,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,EAAE,EAAE,GAAG,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AI,WAAW,KAAK,sCAAqB,CAAC,IAAI,EAAE,CAAC;YACtD,MAAM,GAAG,GAAG,sBAAe,CAAC,QAAQ,CAAC,OAAO,EAAE,sCAAqB,CAAC,CAAA;YACpE,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;gBAC9C,YAAY,EAAE,UAAU,CAAC,EAAE;gBAC3B,QAAQ,EAAE,GAAG,CAAC,QAAQ;aACvB,CAAC,CAAA;YACF,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;QAC9B,CAAC;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;CACF,CAAA;AAxQY,gDAAkB;6BAAlB,kBAAkB;IAD9B,IAAA,mBAAU,GAAE;GACA,kBAAkB,CAwQ9B"}
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { setupChatProtocols } from './sdk/setupChatProtocols';
|
|
2
|
+
export type { ChatSdkPlugin } from './sdk/setupChatProtocols';
|
|
3
|
+
export { ChatPlugin } from './nestjs/ChatPlugin';
|
|
4
|
+
export { ChatMessageHandler } from './handlers/ChatMessageHandler';
|
|
5
|
+
export { chatEvents } from './events/ChatEvents';
|
|
6
|
+
export type { ChatAgentModules } from './types';
|
package/build/index.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.chatEvents = exports.ChatMessageHandler = exports.ChatPlugin = exports.setupChatProtocols = void 0;
|
|
4
|
+
var setupChatProtocols_1 = require("./sdk/setupChatProtocols");
|
|
5
|
+
Object.defineProperty(exports, "setupChatProtocols", { enumerable: true, get: function () { return setupChatProtocols_1.setupChatProtocols; } });
|
|
6
|
+
var ChatPlugin_1 = require("./nestjs/ChatPlugin");
|
|
7
|
+
Object.defineProperty(exports, "ChatPlugin", { enumerable: true, get: function () { return ChatPlugin_1.ChatPlugin; } });
|
|
8
|
+
var ChatMessageHandler_1 = require("./handlers/ChatMessageHandler");
|
|
9
|
+
Object.defineProperty(exports, "ChatMessageHandler", { enumerable: true, get: function () { return ChatMessageHandler_1.ChatMessageHandler; } });
|
|
10
|
+
var ChatEvents_1 = require("./events/ChatEvents");
|
|
11
|
+
Object.defineProperty(exports, "chatEvents", { enumerable: true, get: function () { return ChatEvents_1.chatEvents; } });
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,+DAA6D;AAApD,wHAAA,kBAAkB,OAAA;AAG3B,kDAAgD;AAAvC,wGAAA,UAAU,OAAA;AAEnB,oEAAkE;AAAzD,wHAAA,kBAAkB,OAAA;AAE3B,kDAAgD;AAAvC,wGAAA,UAAU,OAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ChatPlugin = void 0;
|
|
4
|
+
const ChatEvents_1 = require("../events/ChatEvents");
|
|
5
|
+
const ChatMessageHandler_1 = require("../handlers/ChatMessageHandler");
|
|
6
|
+
const setupChatProtocols_1 = require("../sdk/setupChatProtocols");
|
|
7
|
+
exports.ChatPlugin = {
|
|
8
|
+
name: 'chat',
|
|
9
|
+
credoPlugin: (0, setupChatProtocols_1.setupChatProtocols)(),
|
|
10
|
+
providers: [ChatMessageHandler_1.ChatMessageHandler],
|
|
11
|
+
messageHandlers: [ChatMessageHandler_1.ChatMessageHandler],
|
|
12
|
+
registerEvents: (agent, config) => {
|
|
13
|
+
(0, ChatEvents_1.chatEvents)(agent, config);
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=ChatPlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChatPlugin.js","sourceRoot":"","sources":["../../src/nestjs/ChatPlugin.ts"],"names":[],"mappings":";;;AAEA,qDAAiD;AACjD,uEAAmE;AACnE,kEAA8D;AAEjD,QAAA,UAAU,GAAsB;IAC3C,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,IAAA,uCAAkB,GAAE;IACjC,SAAS,EAAE,CAAC,uCAAkB,CAAC;IAC/B,eAAe,EAAE,CAAC,uCAAkB,CAAC;IACrC,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE;QAChC,IAAA,uBAAU,EAAC,KAAY,EAAE,MAAM,CAAC,CAAA;IAClC,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChatAgentModules } from '../types';
|
|
2
|
+
export interface ChatSdkPlugin {
|
|
3
|
+
modules: Pick<ChatAgentModules, 'actionMenu' | 'calls' | 'reactions' | 'media' | 'questionAnswer' | 'receipts' | 'userProfile'>;
|
|
4
|
+
}
|
|
5
|
+
export declare function setupChatProtocols(): ChatSdkPlugin;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.setupChatProtocols = setupChatProtocols;
|
|
4
|
+
const credo_ts_didcomm_calls_1 = require("@2060.io/credo-ts-didcomm-calls");
|
|
5
|
+
const credo_ts_didcomm_media_sharing_1 = require("@2060.io/credo-ts-didcomm-media-sharing");
|
|
6
|
+
const credo_ts_didcomm_reactions_1 = require("@2060.io/credo-ts-didcomm-reactions");
|
|
7
|
+
const credo_ts_didcomm_receipts_1 = require("@2060.io/credo-ts-didcomm-receipts");
|
|
8
|
+
const credo_ts_didcomm_user_profile_1 = require("@2060.io/credo-ts-didcomm-user-profile");
|
|
9
|
+
const action_menu_1 = require("@credo-ts/action-menu");
|
|
10
|
+
const question_answer_1 = require("@credo-ts/question-answer");
|
|
11
|
+
function setupChatProtocols() {
|
|
12
|
+
return {
|
|
13
|
+
modules: {
|
|
14
|
+
actionMenu: new action_menu_1.ActionMenuModule({ strictStateChecking: false }),
|
|
15
|
+
calls: new credo_ts_didcomm_calls_1.DidCommCallsModule(),
|
|
16
|
+
reactions: new credo_ts_didcomm_reactions_1.DidCommReactionsModule(),
|
|
17
|
+
media: new credo_ts_didcomm_media_sharing_1.DidCommMediaSharingModule(),
|
|
18
|
+
questionAnswer: new question_answer_1.QuestionAnswerModule(),
|
|
19
|
+
receipts: new credo_ts_didcomm_receipts_1.DidCommReceiptsModule(),
|
|
20
|
+
// Disable module's auto disclose feature, managed externally in ChatEvents
|
|
21
|
+
userProfile: new credo_ts_didcomm_user_profile_1.DidCommUserProfileModule(new credo_ts_didcomm_user_profile_1.DidCommUserProfileModuleConfig({ autoSendProfile: false })),
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=setupChatProtocols.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setupChatProtocols.js","sourceRoot":"","sources":["../../src/sdk/setupChatProtocols.ts"],"names":[],"mappings":";;AAoBA,gDAeC;AAnCD,4EAAoE;AACpE,4FAAmF;AACnF,oFAA4E;AAC5E,kFAA0E;AAC1E,0FAG+C;AAC/C,uDAAwD;AACxD,+DAAgE;AAWhE,SAAgB,kBAAkB;IAChC,OAAO;QACL,OAAO,EAAE;YACP,UAAU,EAAE,IAAI,8BAAgB,CAAC,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC;YAChE,KAAK,EAAE,IAAI,2CAAkB,EAAE;YAC/B,SAAS,EAAE,IAAI,mDAAsB,EAAE;YACvC,KAAK,EAAE,IAAI,0DAAyB,EAAE;YACtC,cAAc,EAAE,IAAI,sCAAoB,EAAE;YAC1C,QAAQ,EAAE,IAAI,iDAAqB,EAAE;YACrC,2EAA2E;YAC3E,WAAW,EAAE,IAAI,wDAAwB,CACvC,IAAI,8DAA8B,CAAC,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,CAC/D;SACF;KACF,CAAA;AACH,CAAC"}
|
package/build/types.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { DidCommCallsModule } from '@2060.io/credo-ts-didcomm-calls';
|
|
2
|
+
import type { DidCommMediaSharingModule } from '@2060.io/credo-ts-didcomm-media-sharing';
|
|
3
|
+
import type { DidCommReactionsModule } from '@2060.io/credo-ts-didcomm-reactions';
|
|
4
|
+
import type { DidCommReceiptsModule } from '@2060.io/credo-ts-didcomm-receipts';
|
|
5
|
+
import type { DidCommUserProfileModule } from '@2060.io/credo-ts-didcomm-user-profile';
|
|
6
|
+
import type { ActionMenuModule } from '@credo-ts/action-menu';
|
|
7
|
+
import type { QuestionAnswerModule } from '@credo-ts/question-answer';
|
|
8
|
+
import type { BaseAgentModules } from '@verana-labs/vs-agent-sdk';
|
|
9
|
+
export type ChatAgentModules = BaseAgentModules & {
|
|
10
|
+
actionMenu: ActionMenuModule;
|
|
11
|
+
calls: DidCommCallsModule;
|
|
12
|
+
reactions: DidCommReactionsModule;
|
|
13
|
+
media: DidCommMediaSharingModule;
|
|
14
|
+
questionAnswer: QuestionAnswerModule;
|
|
15
|
+
receipts: DidCommReceiptsModule;
|
|
16
|
+
userProfile: DidCommUserProfileModule;
|
|
17
|
+
};
|
package/build/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@verana-labs/vs-agent-plugin-chat",
|
|
3
|
+
"main": "build/index",
|
|
4
|
+
"types": "build/index",
|
|
5
|
+
"exports": {
|
|
6
|
+
".": {
|
|
7
|
+
"types": "./build/index.d.ts",
|
|
8
|
+
"require": "./build/index.js",
|
|
9
|
+
"default": "./build/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"version": "1.10.1",
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "https://github.com/verana-labs/vs-agent"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"build"
|
|
19
|
+
],
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public"
|
|
22
|
+
},
|
|
23
|
+
"license": "Apache-2.0",
|
|
24
|
+
"description": "Chat DIDComm plugin for VS Agent",
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@2060.io/credo-ts-didcomm-calls": "0.1.0",
|
|
27
|
+
"@2060.io/credo-ts-didcomm-media-sharing": "0.1.1",
|
|
28
|
+
"@2060.io/credo-ts-didcomm-reactions": "^0.1.1",
|
|
29
|
+
"@2060.io/credo-ts-didcomm-receipts": "0.1.1",
|
|
30
|
+
"@2060.io/credo-ts-didcomm-user-profile": "0.1.0",
|
|
31
|
+
"@credo-ts/action-menu": "0.7.0-alpha-20260410113934",
|
|
32
|
+
"@credo-ts/core": "0.7.0-alpha-20260410113934",
|
|
33
|
+
"@credo-ts/didcomm": "0.7.0-alpha-20260410113934",
|
|
34
|
+
"@credo-ts/question-answer": "0.7.0-alpha-20260410113934",
|
|
35
|
+
"@nestjs/common": "^10.0.0",
|
|
36
|
+
"@verana-labs/vs-agent-model": "1.10.1",
|
|
37
|
+
"@verana-labs/vs-agent-sdk": "1.10.1"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"@credo-ts/core": "0.7.0-alpha-20260410113934"
|
|
41
|
+
},
|
|
42
|
+
"scripts": {
|
|
43
|
+
"build": "pnpm run clean && pnpm run compile",
|
|
44
|
+
"clean": "rimraf -rf ./build",
|
|
45
|
+
"compile": "tsc -p tsconfig.build.json",
|
|
46
|
+
"version": "pnpm version --allow-same-version"
|
|
47
|
+
}
|
|
48
|
+
}
|