piece-signal-cli-rest-api 0.2.9 → 0.2.11
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/lib/actions/receive-messages.js +2 -0
- package/src/lib/actions/request-approval-message.js +53 -160
- package/src/lib/actions/request-approval-message.js.map +1 -1
- package/src/lib/common/message-utils.d.ts +5 -2
- package/src/lib/common/message-utils.js +97 -90
- package/src/lib/triggers/new-message-received.js +5 -229
package/package.json
CHANGED
|
@@ -81,6 +81,8 @@ exports.receiveMessages = (0, pieces_framework_1.createAction)({
|
|
|
81
81
|
// Use HTTP GET for normal/native mode
|
|
82
82
|
messages = yield (0, message_utils_1.tryHttpReceive)(httpUrl, headers);
|
|
83
83
|
}
|
|
84
|
+
// Cleanup expired approvals (also when no messages)
|
|
85
|
+
yield (0, message_utils_1.cleanupExpiredApprovals)(context.store);
|
|
84
86
|
// Process each message: try to resume approval flows if applicable
|
|
85
87
|
// Messages are still returned regardless of whether they triggered a resume
|
|
86
88
|
// Debug information is output via console.log (visible in Docker logs)
|
|
@@ -12,7 +12,7 @@ exports.requestApprovalMessage = (0, pieces_framework_1.createAction)({
|
|
|
12
12
|
auth: auth_1.signalCliRestApiAuth,
|
|
13
13
|
name: 'request_approval_message',
|
|
14
14
|
displayName: 'Request Approval (Signal)',
|
|
15
|
-
description: 'Send an approval message via Signal and wait for a reaction
|
|
15
|
+
description: 'Send an approval message via Signal and wait for a reaction or text reply. This action sends a message and pauses the flow until the recipient reacts with an emoji or replies with text.',
|
|
16
16
|
props: {
|
|
17
17
|
number: pieces_framework_1.Property.ShortText({
|
|
18
18
|
displayName: 'Phone Number',
|
|
@@ -21,17 +21,18 @@ exports.requestApprovalMessage = (0, pieces_framework_1.createAction)({
|
|
|
21
21
|
}),
|
|
22
22
|
recipients: utils_1.commonProps.recipients,
|
|
23
23
|
message: utils_1.commonProps.message,
|
|
24
|
-
|
|
25
|
-
displayName: '
|
|
26
|
-
description: '
|
|
27
|
-
required:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
accept_reaction_modes: pieces_framework_1.Property.MultiSelectDropdown({
|
|
25
|
+
displayName: 'Accept Reaction Modes',
|
|
26
|
+
description: 'How can users respond?',
|
|
27
|
+
required: true,
|
|
28
|
+
options: {
|
|
29
|
+
options: [
|
|
30
|
+
{ label: 'Emoji Reactions', value: 'emoji' },
|
|
31
|
+
{ label: 'Text Replies', value: 'text' },
|
|
32
|
+
{ label: 'Both', value: 'both' }
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
defaultValue: ['both']
|
|
35
36
|
}),
|
|
36
37
|
timeout_seconds: pieces_framework_1.Property.Number({
|
|
37
38
|
displayName: 'Timeout (seconds)',
|
|
@@ -43,7 +44,7 @@ exports.requestApprovalMessage = (0, pieces_framework_1.createAction)({
|
|
|
43
44
|
run(context) {
|
|
44
45
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
45
46
|
if (context.executionType === shared_1.ExecutionType.BEGIN) {
|
|
46
|
-
const { number, recipients, message,
|
|
47
|
+
const { number, recipients, message, accept_reaction_modes = ['both'], timeout_seconds = 86400 } = context.propsValue;
|
|
47
48
|
(0, shared_2.assertNotNullOrUndefined)(message, 'message');
|
|
48
49
|
(0, shared_2.assertNotNullOrUndefined)(recipients, 'recipients');
|
|
49
50
|
const apiClient = new api_client_1.SignalCliApiClient(context.auth.props);
|
|
@@ -55,7 +56,7 @@ exports.requestApprovalMessage = (0, pieces_framework_1.createAction)({
|
|
|
55
56
|
const formattedNumber = (0, utils_1.formatPhoneNumber)(phoneNumber);
|
|
56
57
|
// Generate resume URL to extract requestId
|
|
57
58
|
const resumeUrl = context.generateResumeUrl({
|
|
58
|
-
queryParams: {
|
|
59
|
+
queryParams: { responseContent: '' },
|
|
59
60
|
});
|
|
60
61
|
// Extract requestId from URL: /v1/flow-runs/{flowRunId}/requests/{requestId}
|
|
61
62
|
const urlMatch = resumeUrl.match(/\/flow-runs\/[^/]+\/requests\/([^/?]+)/);
|
|
@@ -72,36 +73,39 @@ exports.requestApprovalMessage = (0, pieces_framework_1.createAction)({
|
|
|
72
73
|
// Send the message
|
|
73
74
|
const response = yield apiClient.post('/v2/send', requestBody);
|
|
74
75
|
// Extract messageTimestamp from response
|
|
75
|
-
// Signal API returns timestamp in milliseconds as a string
|
|
76
|
-
const
|
|
76
|
+
// Signal API returns timestamp in SECONDS (not milliseconds) as a string
|
|
77
|
+
const timestampSeconds = typeof response.timestamp === 'string'
|
|
77
78
|
? parseInt(response.timestamp, 10)
|
|
78
79
|
: Math.floor(response.timestamp);
|
|
79
|
-
const
|
|
80
|
+
const messageTimestampMs = timestampSeconds * 1000; // Convert to milliseconds for precise matching
|
|
81
|
+
const messageTimestamp = timestampSeconds; // Already in seconds for timeout calculation
|
|
80
82
|
// targetAuthor is the phone number of the sender
|
|
81
83
|
const targetAuthor = formattedNumber;
|
|
82
84
|
const createdAt = Math.floor(Date.now() / 1000); // Unix timestamp in seconds
|
|
83
|
-
// Create store key
|
|
84
|
-
const storeKey = `approval:${
|
|
85
|
+
// Create store key using milliseconds for precise matching
|
|
86
|
+
const storeKey = `approval:${messageTimestampMs}:${targetAuthor}`;
|
|
85
87
|
// DEBUG: Log storing approval mapping
|
|
86
88
|
console.log('[RequestApprovalMessage] DEBUG - Storing approval mapping:', {
|
|
87
89
|
storeKey,
|
|
88
|
-
|
|
90
|
+
timestampSeconds,
|
|
91
|
+
messageTimestampMs,
|
|
89
92
|
messageTimestamp,
|
|
90
93
|
targetAuthor,
|
|
91
94
|
formattedNumber,
|
|
92
95
|
flowRunId: context.run.id,
|
|
93
96
|
requestId,
|
|
94
97
|
responseTimestamp: response.timestamp,
|
|
95
|
-
responseTimestampType: typeof response.timestamp
|
|
98
|
+
responseTimestampType: typeof response.timestamp,
|
|
99
|
+
acceptReactionModes: accept_reaction_modes
|
|
96
100
|
});
|
|
97
101
|
// Create mapping value
|
|
98
102
|
const mapping = {
|
|
99
103
|
flowRunId: context.run.id,
|
|
100
104
|
requestId: requestId,
|
|
101
|
-
|
|
102
|
-
disapproveEmoji: disapprove_emoji,
|
|
103
|
-
targetAuthor: targetAuthor,
|
|
105
|
+
messageTimestampMs: messageTimestampMs,
|
|
104
106
|
messageTimestamp: messageTimestamp,
|
|
107
|
+
targetAuthor: targetAuthor,
|
|
108
|
+
acceptReactionModes: accept_reaction_modes,
|
|
105
109
|
timeoutSeconds: timeout_seconds,
|
|
106
110
|
createdAt: createdAt,
|
|
107
111
|
};
|
|
@@ -123,25 +127,11 @@ exports.requestApprovalMessage = (0, pieces_framework_1.createAction)({
|
|
|
123
127
|
const flowRunMappingKey = `approval:flowRun:${context.run.id}`;
|
|
124
128
|
yield context.store.put(flowRunMappingKey, storeKey, pieces_framework_1.StoreScope.PROJECT);
|
|
125
129
|
const output = {
|
|
126
|
-
|
|
130
|
+
responseContent: null, // Will be set in RESUME phase
|
|
127
131
|
messageTimestamp,
|
|
128
132
|
targetAuthor,
|
|
129
133
|
flowRunId: context.run.id,
|
|
130
134
|
requestId,
|
|
131
|
-
debug: {
|
|
132
|
-
timestampMs,
|
|
133
|
-
messageTimestamp,
|
|
134
|
-
storeKey,
|
|
135
|
-
formattedNumber,
|
|
136
|
-
responseTimestamp: response.timestamp,
|
|
137
|
-
responseTimestampType: typeof response.timestamp,
|
|
138
|
-
approveEmoji: approve_emoji,
|
|
139
|
-
disapproveEmoji: disapprove_emoji,
|
|
140
|
-
timeoutSeconds: timeout_seconds,
|
|
141
|
-
createdAt,
|
|
142
|
-
mapping: mapping,
|
|
143
|
-
verifiedMapping: verifyMapping,
|
|
144
|
-
},
|
|
145
135
|
};
|
|
146
136
|
// Pause the flow and wait for approval
|
|
147
137
|
context.run.pause({
|
|
@@ -153,100 +143,24 @@ exports.requestApprovalMessage = (0, pieces_framework_1.createAction)({
|
|
|
153
143
|
return output;
|
|
154
144
|
}
|
|
155
145
|
else {
|
|
156
|
-
// RESUME-Phase: Flow was resumed
|
|
157
|
-
//
|
|
158
|
-
const
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
};
|
|
175
|
-
console.log('[DEBUG]', JSON.stringify(resumeDebug));
|
|
176
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(resumeDebug) }).catch(() => { });
|
|
177
|
-
// #endregion
|
|
178
|
-
const actionRaw = context.resumePayload.queryParams['action'];
|
|
179
|
-
// Handle case where action might be an array
|
|
180
|
-
const action = Array.isArray(actionRaw) ? actionRaw[0] : actionRaw;
|
|
181
|
-
// Normalize action: trim whitespace and convert to lowercase for comparison
|
|
182
|
-
const normalizedAction = typeof action === 'string' ? action.trim().toLowerCase() : action;
|
|
183
|
-
// #region agent log
|
|
184
|
-
const actionDebug = {
|
|
185
|
-
location: 'request-approval-message.ts:187',
|
|
186
|
-
message: 'Action extracted from queryParams',
|
|
187
|
-
data: {
|
|
188
|
-
actionRaw,
|
|
189
|
-
action,
|
|
190
|
-
actionRawType: typeof actionRaw,
|
|
191
|
-
actionType: typeof action,
|
|
192
|
-
actionRawIsArray: Array.isArray(actionRaw),
|
|
193
|
-
approved: action === 'approve',
|
|
194
|
-
},
|
|
195
|
-
timestamp: Date.now(),
|
|
196
|
-
sessionId: 'debug-session',
|
|
197
|
-
runId: 'run2',
|
|
198
|
-
hypothesisId: 'G',
|
|
199
|
-
};
|
|
200
|
-
console.log('[DEBUG]', JSON.stringify(actionDebug));
|
|
201
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(actionDebug) }).catch(() => { });
|
|
202
|
-
// #endregion
|
|
203
|
-
// #region agent log
|
|
204
|
-
const beforeApprovedDebug = {
|
|
205
|
-
location: 'request-approval-message.ts:235',
|
|
206
|
-
message: 'Before approved calculation',
|
|
207
|
-
data: {
|
|
208
|
-
action,
|
|
209
|
-
normalizedAction,
|
|
210
|
-
actionType: typeof action,
|
|
211
|
-
normalizedActionType: typeof normalizedAction,
|
|
212
|
-
actionValue: action,
|
|
213
|
-
normalizedActionValue: normalizedAction,
|
|
214
|
-
actionLength: action === null || action === void 0 ? void 0 : action.length,
|
|
215
|
-
normalizedActionLength: normalizedAction === null || normalizedAction === void 0 ? void 0 : normalizedAction.length,
|
|
216
|
-
actionCharCodes: action ? Array.from(String(action)).map((c) => c.codePointAt(0)) : null,
|
|
217
|
-
normalizedActionCharCodes: normalizedAction ? Array.from(String(normalizedAction)).map((c) => c.codePointAt(0)) : null,
|
|
218
|
-
approveEqualsAction: 'approve' === action,
|
|
219
|
-
actionEqualsApprove: action === 'approve',
|
|
220
|
-
normalizedActionEqualsApprove: normalizedAction === 'approve',
|
|
221
|
-
actionEqualsDisapprove: action === 'disapprove',
|
|
222
|
-
normalizedActionEqualsDisapprove: normalizedAction === 'disapprove',
|
|
223
|
-
},
|
|
224
|
-
timestamp: Date.now(),
|
|
225
|
-
sessionId: 'debug-session',
|
|
226
|
-
runId: 'run2',
|
|
227
|
-
hypothesisId: 'G',
|
|
228
|
-
};
|
|
229
|
-
console.log('[DEBUG]', JSON.stringify(beforeApprovedDebug));
|
|
230
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(beforeApprovedDebug) }).catch(() => { });
|
|
231
|
-
// #endregion
|
|
232
|
-
const approved = normalizedAction === 'approve';
|
|
233
|
-
// #region agent log
|
|
234
|
-
const afterApprovedDebug = {
|
|
235
|
-
location: 'request-approval-message.ts:233',
|
|
236
|
-
message: 'After approved calculation',
|
|
237
|
-
data: {
|
|
238
|
-
approved,
|
|
239
|
-
approvedType: typeof approved,
|
|
240
|
-
approvedValue: approved,
|
|
241
|
-
},
|
|
242
|
-
timestamp: Date.now(),
|
|
243
|
-
sessionId: 'debug-session',
|
|
244
|
-
runId: 'run2',
|
|
245
|
-
hypothesisId: 'G',
|
|
246
|
-
};
|
|
247
|
-
console.log('[DEBUG]', JSON.stringify(afterApprovedDebug));
|
|
248
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(afterApprovedDebug) }).catch(() => { });
|
|
249
|
-
// #endregion
|
|
146
|
+
// RESUME-Phase: Flow was resumed
|
|
147
|
+
// Read responseContent from queryParams
|
|
148
|
+
const responseContentRaw = context.resumePayload.queryParams['responseContent'];
|
|
149
|
+
const responseContent = Array.isArray(responseContentRaw)
|
|
150
|
+
? responseContentRaw[0]
|
|
151
|
+
: (responseContentRaw || '');
|
|
152
|
+
|
|
153
|
+
// Get reaction type if available
|
|
154
|
+
const reactionTypeRaw = context.resumePayload.queryParams['reactionType'];
|
|
155
|
+
const reactionType = Array.isArray(reactionTypeRaw)
|
|
156
|
+
? reactionTypeRaw[0]
|
|
157
|
+
: (reactionTypeRaw || 'unknown');
|
|
158
|
+
|
|
159
|
+
// Get responder if available
|
|
160
|
+
const responderRaw = context.resumePayload.queryParams['responder'];
|
|
161
|
+
const responder = Array.isArray(responderRaw)
|
|
162
|
+
? responderRaw[0]
|
|
163
|
+
: (responderRaw || null);
|
|
250
164
|
// Find the storeKey for this flowRunId
|
|
251
165
|
const flowRunMappingKey = `approval:flowRun:${context.run.id}`;
|
|
252
166
|
const storeKey = yield context.store.get(flowRunMappingKey, pieces_framework_1.StoreScope.PROJECT);
|
|
@@ -261,34 +175,13 @@ exports.requestApprovalMessage = (0, pieces_framework_1.createAction)({
|
|
|
261
175
|
const updatedKeys = existingKeys.filter(key => key !== storeKey);
|
|
262
176
|
yield context.store.put(keysListKey, updatedKeys, pieces_framework_1.StoreScope.PROJECT);
|
|
263
177
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
},
|
|
271
|
-
};
|
|
272
|
-
// #region agent log
|
|
273
|
-
const returnDebug = {
|
|
274
|
-
location: 'request-approval-message.ts:230',
|
|
275
|
-
message: 'Return value from RESUME phase',
|
|
276
|
-
data: {
|
|
277
|
-
returnValue,
|
|
278
|
-
approved,
|
|
279
|
-
action,
|
|
280
|
-
approvedType: typeof approved,
|
|
281
|
-
approvedValue: approved,
|
|
282
|
-
},
|
|
283
|
-
timestamp: Date.now(),
|
|
284
|
-
sessionId: 'debug-session',
|
|
285
|
-
runId: 'run2',
|
|
286
|
-
hypothesisId: 'G',
|
|
178
|
+
// Return the response content (emoji or text)
|
|
179
|
+
return {
|
|
180
|
+
responseContent: responseContent, // Emoji string or text message
|
|
181
|
+
reactionType: reactionType, // 'emoji' or 'text'
|
|
182
|
+
responder: responder, // Phone number of responder
|
|
183
|
+
flowRunId: context.run.id,
|
|
287
184
|
};
|
|
288
|
-
console.log('[DEBUG]', JSON.stringify(returnDebug));
|
|
289
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(returnDebug) }).catch(() => { });
|
|
290
|
-
// #endregion
|
|
291
|
-
return returnValue;
|
|
292
185
|
}
|
|
293
186
|
});
|
|
294
187
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"request-approval-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/signal-cli-rest-api/src/lib/actions/request-approval-message.ts"],"names":[],"mappings":";;;;AAAA,qEAAoF;AACpF,yCAAsD;AACtD,qDAA0D;AAE1D,2C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E,MAAM;oBACb,YAAY,EAAE,GAAG;iBACjB,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;gBACpD,KAAK,CAAC,oEAAoE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;gBACpM,aAAa;gBAEb,OAAO,WAAW,CAAC;YACpB,CAAC;QACF,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"request-approval-message.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/signal-cli-rest-api/src/lib/actions/request-approval-message.ts"],"names":[],"mappings":";;;;AAAA,qEAAoF;AACpF,yCAAsD;AACtD,qDAA0D;AAE1D,2CAAiE;AACjE,iDAAgE;AAChE,iDAAgE;AAanD,QAAA,sBAAsB,GAAG,IAAA,+BAAY,EAAC;IAClD,IAAI,EAAE,2BAAoB;IAC1B,IAAI,EAAE,0BAA0B;IAChC,WAAW,EAAE,2BAA2B;IACxC,WAAW,EAAE,uLAAuL;IACpM,KAAK,EAAE;QACN,MAAM,EAAE,2BAAQ,CAAC,SAAS,CAAC;YAC1B,WAAW,EAAE,cAAc;YAC3B,WAAW,EAAE,qIAAqI;YAClJ,QAAQ,EAAE,KAAK;SACf,CAAC;QACF,UAAU,EAAE,mBAAW,CAAC,UAAU;QAClC,OAAO,EAAE,mBAAW,CAAC,OAAO;QAC5B,aAAa,EAAE,2BAAQ,CAAC,SAAS,CAAC;YACjC,WAAW,EAAE,eAAe;YAC5B,WAAW,EAAE,+BAA+B;YAC5C,QAAQ,EAAE,KAAK;YACf,YAAY,EAAE,IAAI;SAClB,CAAC;QACF,gBAAgB,EAAE,2BAAQ,CAAC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AAK,KAAK;wBAC5D,2BAA2B,EAAE,WAAW,CAAC,QAAQ,KAAK,IAAI;wBAC1D,8BAA8B,EAAE,OAAO,WAAW,CAAC,QAAQ,KAAK,SAAS;qBACzE;oBACD,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;oBACrB,SAAS,EAAE,eAAe;oBAC1B,KAAK,EAAE,MAAM;oBACb,YAAY,EAAE,GAAG;iBACjB,CAAC;gBACF,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC,CAAC;gBAC/D,KAAK,CAAC,oEAAoE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,cAAc,EAAE,kBAAkB,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;gBAC/M,aAAa;gBAEb,OAAO,WAAW,CAAC;YACpB,CAAC;QACF,CAAC;KAAA;CACD,CAAC,CAAC"}
|
|
@@ -50,7 +50,8 @@ export interface SignalMessage {
|
|
|
50
50
|
reaction?: {
|
|
51
51
|
emoji: string;
|
|
52
52
|
targetAuthor: string;
|
|
53
|
-
targetTimestamp
|
|
53
|
+
targetTimestamp?: number;
|
|
54
|
+
targetSentTimestamp?: number;
|
|
54
55
|
};
|
|
55
56
|
viewOnce?: boolean;
|
|
56
57
|
};
|
|
@@ -73,9 +74,11 @@ export interface SignalMessage {
|
|
|
73
74
|
};
|
|
74
75
|
account: string;
|
|
75
76
|
}
|
|
77
|
+
export declare function cleanupExpiredApprovals(store: any): Promise<void>;
|
|
76
78
|
export declare function tryResumeApprovalFlow(message: SignalMessage, store: any, apiUrl: string): Promise<{
|
|
77
79
|
resumed: boolean;
|
|
78
|
-
|
|
80
|
+
responseContent?: string;
|
|
81
|
+
reactionType?: string;
|
|
79
82
|
}>;
|
|
80
83
|
export declare function tryWebSocketReceive(httpUrl: string, headers: Record<string, string>, timeout: number, max_messages?: number): Promise<SignalMessage[]>;
|
|
81
84
|
export declare function tryHttpReceive(httpUrl: string, headers: Record<string, string>): Promise<SignalMessage[]>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.cleanupExpiredApprovals = cleanupExpiredApprovals;
|
|
3
4
|
exports.tryResumeApprovalFlow = tryResumeApprovalFlow;
|
|
4
5
|
exports.tryWebSocketReceive = tryWebSocketReceive;
|
|
5
6
|
exports.tryHttpReceive = tryHttpReceive;
|
|
@@ -7,44 +8,16 @@ const tslib_1 = require("tslib");
|
|
|
7
8
|
const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
8
9
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
9
10
|
const ws_1 = tslib_1.__importDefault(require("ws"));
|
|
10
|
-
// Function to
|
|
11
|
-
function
|
|
11
|
+
// Function to cleanup expired approval mappings
|
|
12
|
+
function cleanupExpiredApprovals(store) {
|
|
12
13
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
var _a, _b, _c, _d;
|
|
14
|
-
console.log('[ReceiveMessages] DEBUG - Processing message:', {
|
|
15
|
-
hasReaction: !!((_b = (_a = message.envelope) === null || _a === void 0 ? void 0 : _a.dataMessage) === null || _b === void 0 ? void 0 : _b.reaction),
|
|
16
|
-
});
|
|
17
|
-
// Check if it's a reaction
|
|
18
|
-
if (!((_d = (_c = message.envelope) === null || _c === void 0 ? void 0 : _c.dataMessage) === null || _d === void 0 ? void 0 : _d.reaction)) {
|
|
19
|
-
return { resumed: false };
|
|
20
|
-
}
|
|
21
|
-
console.log('[ReceiveMessages] DEBUG - Reaction detected');
|
|
22
|
-
const reaction = message.envelope.dataMessage.reaction;
|
|
23
|
-
// Convert targetTimestamp from milliseconds to seconds (Unix timestamp)
|
|
24
|
-
// Note: targetTimestamp in SignalMessage interface might be targetSentTimestamp in actual data
|
|
25
|
-
const targetTimestampMs = reaction.targetSentTimestamp || reaction.targetTimestamp;
|
|
26
|
-
const targetTimestamp = Math.floor(targetTimestampMs / 1000);
|
|
27
|
-
const targetAuthor = reaction.targetAuthor;
|
|
28
|
-
const reactionEmoji = reaction.emoji;
|
|
29
|
-
console.log('[ReceiveMessages] DEBUG - Reaction data:', {
|
|
30
|
-
targetSentTimestampOriginal: targetTimestampMs,
|
|
31
|
-
targetTimestamp,
|
|
32
|
-
targetAuthor,
|
|
33
|
-
reactionEmoji,
|
|
34
|
-
});
|
|
35
|
-
// Cleanup expired approvals
|
|
36
14
|
const keysListKey = 'approval:keys';
|
|
37
15
|
const existingKeys = (yield store.get(keysListKey, pieces_framework_1.StoreScope.PROJECT)) || [];
|
|
38
16
|
const currentTimestamp = Math.floor(Date.now() / 1000);
|
|
39
17
|
const validKeys = [];
|
|
40
18
|
const keysToDelete = [];
|
|
41
|
-
console.log('[ReceiveMessages] DEBUG - Store info:', {
|
|
42
|
-
existingKeysCount: existingKeys.length,
|
|
43
|
-
existingKeys: existingKeys,
|
|
44
|
-
currentTimestamp,
|
|
45
|
-
});
|
|
46
19
|
for (const key of existingKeys) {
|
|
47
|
-
const mapping =
|
|
20
|
+
const mapping = yield store.get(key, pieces_framework_1.StoreScope.PROJECT);
|
|
48
21
|
if (mapping) {
|
|
49
22
|
// Check if expired
|
|
50
23
|
if (currentTimestamp - mapping.createdAt > mapping.timeoutSeconds) {
|
|
@@ -67,85 +40,117 @@ function tryResumeApprovalFlow(message, store, apiUrl) {
|
|
|
67
40
|
if (keysToDelete.length > 0) {
|
|
68
41
|
yield store.put(keysListKey, validKeys, pieces_framework_1.StoreScope.PROJECT);
|
|
69
42
|
}
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
// Function to automatically resume approval flows
|
|
46
|
+
function tryResumeApprovalFlow(message, store, apiUrl) {
|
|
47
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
var _a, _b, _c, _d, _e, _f;
|
|
49
|
+
const dataMessage = message.envelope === null || message.envelope === void 0 ? void 0 : message.envelope.dataMessage;
|
|
50
|
+
if (!dataMessage) {
|
|
51
|
+
return { resumed: false };
|
|
52
|
+
}
|
|
53
|
+
// Check if it's a reaction or a quote (text reply)
|
|
54
|
+
const isReaction = !!dataMessage.reaction;
|
|
55
|
+
const isTextReply = !!dataMessage.quote;
|
|
56
|
+
if (!isReaction && !isTextReply) {
|
|
57
|
+
return { resumed: false };
|
|
58
|
+
}
|
|
59
|
+
console.log('[ReceiveMessages] DEBUG - Processing message:', {
|
|
60
|
+
hasReaction: isReaction,
|
|
61
|
+
hasQuote: isTextReply,
|
|
79
62
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
63
|
+
// Cleanup expired approvals
|
|
64
|
+
yield cleanupExpiredApprovals(store);
|
|
65
|
+
const keysListKey = 'approval:keys';
|
|
66
|
+
const existingKeys = (yield store.get(keysListKey, pieces_framework_1.StoreScope.PROJECT)) || [];
|
|
67
|
+
const currentTimestamp = Math.floor(Date.now() / 1000);
|
|
68
|
+
// Try to find matching approval
|
|
69
|
+
let mapping = null;
|
|
70
|
+
let storeKey = null;
|
|
71
|
+
let responseContent = null;
|
|
72
|
+
let reactionType = null;
|
|
73
|
+
let responder = message.envelope.source;
|
|
74
|
+
// Handle Emoji Reaction
|
|
75
|
+
if (isReaction) {
|
|
76
|
+
const reaction = dataMessage.reaction;
|
|
77
|
+
// signal-cli returns timestamps in SECONDS, convert to milliseconds for matching
|
|
78
|
+
const targetTimestampSeconds = reaction.targetSentTimestamp || reaction.targetTimestamp;
|
|
79
|
+
const targetTimestampMs = targetTimestampSeconds * 1000;
|
|
80
|
+
const targetAuthor = reaction.targetAuthor;
|
|
81
|
+
const reactionEmoji = reaction.emoji;
|
|
82
|
+
storeKey = `approval:${targetTimestampMs}:${targetAuthor}`;
|
|
83
|
+
mapping = yield store.get(storeKey, pieces_framework_1.StoreScope.PROJECT);
|
|
84
|
+
if (mapping) {
|
|
85
|
+
const acceptModes = mapping.acceptReactionModes || ['both'];
|
|
86
|
+
if (acceptModes.includes('emoji') || acceptModes.includes('both')) {
|
|
87
|
+
responseContent = reactionEmoji; // Return the emoji directly
|
|
88
|
+
reactionType = 'emoji';
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
// Mapping found but emoji mode not allowed
|
|
92
|
+
mapping = null;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
// Handle Text Reply (Quote) - only if not already found via reaction
|
|
97
|
+
if (isTextReply && !mapping) {
|
|
98
|
+
const quote = dataMessage.quote;
|
|
99
|
+
// signal-cli returns timestamps in SECONDS, convert to milliseconds for matching
|
|
100
|
+
const quoteTimestampSeconds = quote.id || quote.timestamp;
|
|
101
|
+
const quoteTimestampMs = quoteTimestampSeconds * 1000;
|
|
102
|
+
const quoteAuthor = quote.author;
|
|
103
|
+
const replyText = dataMessage.message || '';
|
|
104
|
+
// Try to find mapping by quote timestamp
|
|
105
|
+
storeKey = `approval:${quoteTimestampMs}:${quoteAuthor}`;
|
|
106
|
+
mapping = yield store.get(storeKey, pieces_framework_1.StoreScope.PROJECT);
|
|
107
|
+
if (mapping) {
|
|
108
|
+
const acceptModes = mapping.acceptReactionModes || ['both'];
|
|
109
|
+
if (acceptModes.includes('text') || acceptModes.includes('both')) {
|
|
110
|
+
responseContent = replyText; // Return the text directly
|
|
111
|
+
reactionType = 'text';
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
// Mapping found but text mode not allowed
|
|
115
|
+
mapping = null;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// If no matching approval found, return
|
|
120
|
+
if (!mapping || !responseContent) {
|
|
87
121
|
return { resumed: false };
|
|
88
122
|
}
|
|
89
123
|
console.log('[ReceiveMessages] DEBUG - Mapping found:', {
|
|
90
124
|
flowRunId: mapping.flowRunId,
|
|
91
125
|
requestId: mapping.requestId,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
timeoutSeconds: mapping.timeoutSeconds,
|
|
126
|
+
messageTimestampMs: mapping.messageTimestampMs,
|
|
127
|
+
acceptReactionModes: mapping.acceptReactionModes,
|
|
128
|
+
reactionType,
|
|
129
|
+
responseContent,
|
|
97
130
|
});
|
|
98
131
|
// Check if expired
|
|
99
132
|
const ageInSeconds = currentTimestamp - mapping.createdAt;
|
|
100
133
|
const isExpired = ageInSeconds > mapping.timeoutSeconds;
|
|
101
|
-
console.log('[ReceiveMessages] DEBUG - Expiration check:', {
|
|
102
|
-
currentTimestamp,
|
|
103
|
-
createdAt: mapping.createdAt,
|
|
104
|
-
ageInSeconds,
|
|
105
|
-
timeoutSeconds: mapping.timeoutSeconds,
|
|
106
|
-
isExpired,
|
|
107
|
-
});
|
|
108
134
|
if (isExpired) {
|
|
109
135
|
// Expired - delete and return
|
|
110
136
|
yield store.delete(storeKey, pieces_framework_1.StoreScope.PROJECT);
|
|
111
137
|
const flowRunMappingKey = `approval:flowRun:${mapping.flowRunId}`;
|
|
112
138
|
yield store.delete(flowRunMappingKey, pieces_framework_1.StoreScope.PROJECT);
|
|
113
|
-
const updatedKeys =
|
|
139
|
+
const updatedKeys = existingKeys.filter(key => key !== storeKey);
|
|
114
140
|
yield store.put(keysListKey, updatedKeys, pieces_framework_1.StoreScope.PROJECT);
|
|
115
141
|
console.log('[ReceiveMessages] DEBUG - Approval expired');
|
|
116
142
|
return { resumed: false };
|
|
117
143
|
}
|
|
118
|
-
//
|
|
119
|
-
|
|
120
|
-
console.log('[ReceiveMessages] DEBUG - Emoji check:', {
|
|
121
|
-
receivedEmoji: reactionEmoji,
|
|
122
|
-
expectedApproveEmoji: mapping.approveEmoji,
|
|
123
|
-
expectedDisapproveEmoji: mapping.disapproveEmoji,
|
|
124
|
-
});
|
|
125
|
-
if (reactionEmoji === mapping.approveEmoji) {
|
|
126
|
-
action = 'approve';
|
|
127
|
-
console.log('[ReceiveMessages] DEBUG - Emoji matched: approve');
|
|
128
|
-
}
|
|
129
|
-
else if (reactionEmoji === mapping.disapproveEmoji) {
|
|
130
|
-
action = 'disapprove';
|
|
131
|
-
console.log('[ReceiveMessages] DEBUG - Emoji matched: disapprove');
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
// Invalid emoji - not an approval reaction
|
|
135
|
-
console.log('[ReceiveMessages] DEBUG - Invalid emoji:', {
|
|
136
|
-
reason: 'invalid_emoji',
|
|
137
|
-
receivedEmoji: reactionEmoji,
|
|
138
|
-
});
|
|
139
|
-
return { resumed: false };
|
|
140
|
-
}
|
|
141
|
-
// Make HTTP request to resume the flow
|
|
142
|
-
const resumeUrl = `${apiUrl}v1/flow-runs/${mapping.flowRunId}/requests/${mapping.requestId}?action=${action}`;
|
|
144
|
+
// Resume the flow with responseContent
|
|
145
|
+
const resumeUrl = `${apiUrl}v1/flow-runs/${mapping.flowRunId}/requests/${mapping.requestId}?responseContent=${encodeURIComponent(responseContent)}&reactionType=${reactionType}&responder=${encodeURIComponent(responder || '')}`;
|
|
143
146
|
console.log('[ReceiveMessages] DEBUG - Attempting resume:', {
|
|
144
147
|
resumeUrl,
|
|
145
148
|
apiUrl,
|
|
146
149
|
flowRunId: mapping.flowRunId,
|
|
147
150
|
requestId: mapping.requestId,
|
|
148
|
-
|
|
151
|
+
responseContent,
|
|
152
|
+
reactionType,
|
|
153
|
+
responder,
|
|
149
154
|
});
|
|
150
155
|
try {
|
|
151
156
|
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
@@ -158,23 +163,25 @@ function tryResumeApprovalFlow(message, store, apiUrl) {
|
|
|
158
163
|
});
|
|
159
164
|
console.log('[ReceiveMessages] DEBUG - Resume successful:', {
|
|
160
165
|
flowRunId: mapping.flowRunId,
|
|
161
|
-
|
|
166
|
+
responseContent,
|
|
167
|
+
reactionType,
|
|
162
168
|
responseStatus: response.status,
|
|
163
169
|
responseBody: response.body,
|
|
164
170
|
});
|
|
165
|
-
// Delete mapping from Store (cleanup)
|
|
171
|
+
// Delete mapping from Store (cleanup) - only first reaction
|
|
166
172
|
yield store.delete(storeKey, pieces_framework_1.StoreScope.PROJECT);
|
|
167
173
|
// Delete flowRunId mapping
|
|
168
174
|
const flowRunMappingKey = `approval:flowRun:${mapping.flowRunId}`;
|
|
169
175
|
yield store.delete(flowRunMappingKey, pieces_framework_1.StoreScope.PROJECT);
|
|
170
176
|
// Remove key from approval keys list
|
|
171
|
-
const finalKeys =
|
|
177
|
+
const finalKeys = existingKeys.filter(key => key !== storeKey);
|
|
172
178
|
yield store.put(keysListKey, finalKeys, pieces_framework_1.StoreScope.PROJECT);
|
|
173
179
|
console.log('[ReceiveMessages] DEBUG - Cleanup completed');
|
|
174
|
-
return { resumed: true,
|
|
180
|
+
return { resumed: true, responseContent, reactionType };
|
|
175
181
|
}
|
|
176
182
|
catch (error) {
|
|
177
183
|
// If resume fails, log but don't throw - message will still be returned
|
|
184
|
+
// Mapping remains for retry (will be cleaned up by cleanupExpiredApprovals after timeout)
|
|
178
185
|
console.error('[ReceiveMessages] DEBUG - Resume failed:', {
|
|
179
186
|
error: error instanceof Error ? error.message : String(error),
|
|
180
187
|
errorStack: error instanceof Error ? error.stack : undefined,
|
|
@@ -6,234 +6,8 @@ const pieces_framework_1 = require("@activepieces/pieces-framework");
|
|
|
6
6
|
const pieces_common_1 = require("@activepieces/pieces-common");
|
|
7
7
|
const auth_1 = require("../common/auth");
|
|
8
8
|
const utils_1 = require("../common/utils");
|
|
9
|
+
const message_utils_1 = require("../common/message-utils");
|
|
9
10
|
const ws_1 = tslib_1.__importDefault(require("ws"));
|
|
10
|
-
// Function to automatically resume approval flows
|
|
11
|
-
function tryResumeApprovalFlow(message, store, apiUrl) {
|
|
12
|
-
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
13
|
-
var _a, _b, _c, _d;
|
|
14
|
-
console.log('[NewMessageReceived] DEBUG - Processing message:', {
|
|
15
|
-
hasReaction: !!((_b = (_a = message.envelope) === null || _a === void 0 ? void 0 : _a.dataMessage) === null || _b === void 0 ? void 0 : _b.reaction),
|
|
16
|
-
});
|
|
17
|
-
// Check if it's a reaction
|
|
18
|
-
if (!((_d = (_c = message.envelope) === null || _c === void 0 ? void 0 : _c.dataMessage) === null || _d === void 0 ? void 0 : _d.reaction)) {
|
|
19
|
-
return { resumed: false };
|
|
20
|
-
}
|
|
21
|
-
console.log('[NewMessageReceived] DEBUG - Reaction detected');
|
|
22
|
-
const reaction = message.envelope.dataMessage.reaction;
|
|
23
|
-
// Convert targetTimestamp from milliseconds to seconds (Unix timestamp)
|
|
24
|
-
// Note: targetTimestamp in SignalMessage interface might be targetSentTimestamp in actual data
|
|
25
|
-
const targetTimestampMs = reaction.targetSentTimestamp || reaction.targetTimestamp;
|
|
26
|
-
const targetTimestamp = Math.floor(targetTimestampMs / 1000);
|
|
27
|
-
const targetAuthor = reaction.targetAuthor;
|
|
28
|
-
const reactionEmoji = reaction.emoji;
|
|
29
|
-
console.log('[NewMessageReceived] DEBUG - Reaction data:', {
|
|
30
|
-
targetSentTimestampOriginal: targetTimestampMs,
|
|
31
|
-
targetTimestamp,
|
|
32
|
-
targetAuthor,
|
|
33
|
-
reactionEmoji,
|
|
34
|
-
});
|
|
35
|
-
// Cleanup expired approvals
|
|
36
|
-
const keysListKey = 'approval:keys';
|
|
37
|
-
const existingKeys = (yield store.get(keysListKey, pieces_framework_1.StoreScope.PROJECT)) || [];
|
|
38
|
-
const currentTimestamp = Math.floor(Date.now() / 1000);
|
|
39
|
-
const validKeys = [];
|
|
40
|
-
const keysToDelete = [];
|
|
41
|
-
console.log('[NewMessageReceived] DEBUG - Store info:', {
|
|
42
|
-
existingKeysCount: existingKeys.length,
|
|
43
|
-
existingKeys: existingKeys,
|
|
44
|
-
currentTimestamp,
|
|
45
|
-
});
|
|
46
|
-
for (const key of existingKeys) {
|
|
47
|
-
const mapping = (yield store.get(key, pieces_framework_1.StoreScope.PROJECT));
|
|
48
|
-
if (mapping) {
|
|
49
|
-
// Check if expired
|
|
50
|
-
if (currentTimestamp - mapping.createdAt > mapping.timeoutSeconds) {
|
|
51
|
-
// Expired - delete it and flowRunId mapping
|
|
52
|
-
yield store.delete(key, pieces_framework_1.StoreScope.PROJECT);
|
|
53
|
-
const flowRunMappingKey = `approval:flowRun:${mapping.flowRunId}`;
|
|
54
|
-
yield store.delete(flowRunMappingKey, pieces_framework_1.StoreScope.PROJECT);
|
|
55
|
-
keysToDelete.push(key);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
validKeys.push(key);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
// Mapping not found - remove from list
|
|
63
|
-
keysToDelete.push(key);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
// Update keys list if any were deleted
|
|
67
|
-
if (keysToDelete.length > 0) {
|
|
68
|
-
yield store.put(keysListKey, validKeys, pieces_framework_1.StoreScope.PROJECT);
|
|
69
|
-
}
|
|
70
|
-
console.log('[NewMessageReceived] DEBUG - Cleanup result:', {
|
|
71
|
-
keysDeleted: keysToDelete.length,
|
|
72
|
-
validKeysCount: validKeys.length,
|
|
73
|
-
});
|
|
74
|
-
// Look up the specific approval mapping
|
|
75
|
-
const storeKey = `approval:${targetTimestamp}:${targetAuthor}`;
|
|
76
|
-
console.log('[NewMessageReceived] DEBUG - Store lookup:', {
|
|
77
|
-
storeKey,
|
|
78
|
-
existingKeysCount: existingKeys.length,
|
|
79
|
-
});
|
|
80
|
-
const mapping = (yield store.get(storeKey, pieces_framework_1.StoreScope.PROJECT));
|
|
81
|
-
if (!mapping) {
|
|
82
|
-
// Not an approval message
|
|
83
|
-
console.log('[NewMessageReceived] DEBUG - No mapping found:', {
|
|
84
|
-
reason: 'not_an_approval_message',
|
|
85
|
-
searchedKey: storeKey,
|
|
86
|
-
});
|
|
87
|
-
return { resumed: false };
|
|
88
|
-
}
|
|
89
|
-
console.log('[NewMessageReceived] DEBUG - Mapping found:', {
|
|
90
|
-
flowRunId: mapping.flowRunId,
|
|
91
|
-
requestId: mapping.requestId,
|
|
92
|
-
approveEmoji: mapping.approveEmoji,
|
|
93
|
-
disapproveEmoji: mapping.disapproveEmoji,
|
|
94
|
-
messageTimestamp: mapping.messageTimestamp,
|
|
95
|
-
createdAt: mapping.createdAt,
|
|
96
|
-
timeoutSeconds: mapping.timeoutSeconds,
|
|
97
|
-
});
|
|
98
|
-
// Check if expired
|
|
99
|
-
const ageInSeconds = currentTimestamp - mapping.createdAt;
|
|
100
|
-
const isExpired = ageInSeconds > mapping.timeoutSeconds;
|
|
101
|
-
console.log('[NewMessageReceived] DEBUG - Expiration check:', {
|
|
102
|
-
currentTimestamp,
|
|
103
|
-
createdAt: mapping.createdAt,
|
|
104
|
-
ageInSeconds,
|
|
105
|
-
timeoutSeconds: mapping.timeoutSeconds,
|
|
106
|
-
isExpired,
|
|
107
|
-
});
|
|
108
|
-
if (isExpired) {
|
|
109
|
-
// Expired - delete and return
|
|
110
|
-
yield store.delete(storeKey, pieces_framework_1.StoreScope.PROJECT);
|
|
111
|
-
const flowRunMappingKey = `approval:flowRun:${mapping.flowRunId}`;
|
|
112
|
-
yield store.delete(flowRunMappingKey, pieces_framework_1.StoreScope.PROJECT);
|
|
113
|
-
const updatedKeys = validKeys.filter(key => key !== storeKey);
|
|
114
|
-
yield store.put(keysListKey, updatedKeys, pieces_framework_1.StoreScope.PROJECT);
|
|
115
|
-
console.log('[NewMessageReceived] DEBUG - Approval expired');
|
|
116
|
-
return { resumed: false };
|
|
117
|
-
}
|
|
118
|
-
// Check emoji and determine action
|
|
119
|
-
let action;
|
|
120
|
-
// #region agent log
|
|
121
|
-
const emojiDebug = {
|
|
122
|
-
location: 'new-message-received.ts:233',
|
|
123
|
-
message: 'Emoji comparison debug',
|
|
124
|
-
data: {
|
|
125
|
-
receivedEmoji: reactionEmoji,
|
|
126
|
-
expectedApproveEmoji: mapping.approveEmoji,
|
|
127
|
-
expectedDisapproveEmoji: mapping.disapproveEmoji,
|
|
128
|
-
receivedEmojiLength: reactionEmoji.length,
|
|
129
|
-
approveEmojiLength: mapping.approveEmoji.length,
|
|
130
|
-
disapproveEmojiLength: mapping.disapproveEmoji.length,
|
|
131
|
-
receivedEmojiCharCodes: Array.from(reactionEmoji).map(c => c.codePointAt(0)),
|
|
132
|
-
approveEmojiCharCodes: Array.from(mapping.approveEmoji).map(c => c.codePointAt(0)),
|
|
133
|
-
disapproveEmojiCharCodes: Array.from(mapping.disapproveEmoji).map(c => c.codePointAt(0)),
|
|
134
|
-
approveMatch: reactionEmoji === mapping.approveEmoji,
|
|
135
|
-
disapproveMatch: reactionEmoji === mapping.disapproveEmoji,
|
|
136
|
-
receivedEmojiJSON: JSON.stringify(reactionEmoji),
|
|
137
|
-
approveEmojiJSON: JSON.stringify(mapping.approveEmoji),
|
|
138
|
-
disapproveEmojiJSON: JSON.stringify(mapping.disapproveEmoji),
|
|
139
|
-
},
|
|
140
|
-
timestamp: Date.now(),
|
|
141
|
-
sessionId: 'debug-session',
|
|
142
|
-
runId: 'run2',
|
|
143
|
-
hypothesisId: 'F',
|
|
144
|
-
};
|
|
145
|
-
console.log('[DEBUG]', JSON.stringify(emojiDebug));
|
|
146
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(emojiDebug) }).catch(() => { });
|
|
147
|
-
// #endregion
|
|
148
|
-
console.log('[NewMessageReceived] DEBUG - Emoji check:', {
|
|
149
|
-
receivedEmoji: reactionEmoji,
|
|
150
|
-
expectedApproveEmoji: mapping.approveEmoji,
|
|
151
|
-
expectedDisapproveEmoji: mapping.disapproveEmoji,
|
|
152
|
-
});
|
|
153
|
-
if (reactionEmoji === mapping.approveEmoji) {
|
|
154
|
-
action = 'approve';
|
|
155
|
-
// #region agent log
|
|
156
|
-
const approveLog = { location: 'new-message-received.ts:242', message: 'Action set to approve', data: { action: 'approve' }, timestamp: Date.now(), sessionId: 'debug-session', runId: 'run2', hypothesisId: 'F' };
|
|
157
|
-
console.log('[DEBUG]', JSON.stringify(approveLog));
|
|
158
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(approveLog) }).catch(() => { });
|
|
159
|
-
// #endregion
|
|
160
|
-
console.log('[NewMessageReceived] DEBUG - Emoji matched: approve');
|
|
161
|
-
}
|
|
162
|
-
else if (reactionEmoji === mapping.disapproveEmoji) {
|
|
163
|
-
action = 'disapprove';
|
|
164
|
-
// #region agent log
|
|
165
|
-
const disapproveLog = { location: 'new-message-received.ts:246', message: 'Action set to disapprove', data: { action: 'disapprove' }, timestamp: Date.now(), sessionId: 'debug-session', runId: 'run2', hypothesisId: 'F' };
|
|
166
|
-
console.log('[DEBUG]', JSON.stringify(disapproveLog));
|
|
167
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(disapproveLog) }).catch(() => { });
|
|
168
|
-
// #endregion
|
|
169
|
-
console.log('[NewMessageReceived] DEBUG - Emoji matched: disapprove');
|
|
170
|
-
}
|
|
171
|
-
else {
|
|
172
|
-
// Invalid emoji - not an approval reaction
|
|
173
|
-
// #region agent log
|
|
174
|
-
const invalidLog = { location: 'new-message-received.ts:254', message: 'Invalid emoji', data: { reason: 'invalid_emoji', receivedEmoji: reactionEmoji }, timestamp: Date.now(), sessionId: 'debug-session', runId: 'run2', hypothesisId: 'F' };
|
|
175
|
-
console.log('[DEBUG]', JSON.stringify(invalidLog));
|
|
176
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(invalidLog) }).catch(() => { });
|
|
177
|
-
// #endregion
|
|
178
|
-
console.log('[NewMessageReceived] DEBUG - Invalid emoji:', {
|
|
179
|
-
reason: 'invalid_emoji',
|
|
180
|
-
receivedEmoji: reactionEmoji,
|
|
181
|
-
});
|
|
182
|
-
return { resumed: false };
|
|
183
|
-
}
|
|
184
|
-
// #region agent log
|
|
185
|
-
const actionLog = { location: 'new-message-received.ts:258', message: 'Final action before resume', data: { action, resumeUrl: `${apiUrl}v1/flow-runs/${mapping.flowRunId}/requests/${mapping.requestId}?action=${action}` }, timestamp: Date.now(), sessionId: 'debug-session', runId: 'run2', hypothesisId: 'F' };
|
|
186
|
-
console.log('[DEBUG]', JSON.stringify(actionLog));
|
|
187
|
-
fetch('http://10.3.0.249:7242/ingest/59e7eb7f-1143-46b9-b2a2-cd2fb084d263', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(actionLog) }).catch(() => { });
|
|
188
|
-
// #endregion
|
|
189
|
-
// Make HTTP request to resume the flow
|
|
190
|
-
const resumeUrl = `${apiUrl}v1/flow-runs/${mapping.flowRunId}/requests/${mapping.requestId}?action=${action}`;
|
|
191
|
-
console.log('[NewMessageReceived] DEBUG - Attempting resume:', {
|
|
192
|
-
resumeUrl,
|
|
193
|
-
apiUrl,
|
|
194
|
-
flowRunId: mapping.flowRunId,
|
|
195
|
-
requestId: mapping.requestId,
|
|
196
|
-
action,
|
|
197
|
-
});
|
|
198
|
-
try {
|
|
199
|
-
const response = yield pieces_common_1.httpClient.sendRequest({
|
|
200
|
-
method: pieces_common_1.HttpMethod.POST,
|
|
201
|
-
url: resumeUrl,
|
|
202
|
-
headers: {
|
|
203
|
-
'Content-Type': 'application/json',
|
|
204
|
-
},
|
|
205
|
-
body: {},
|
|
206
|
-
});
|
|
207
|
-
console.log('[NewMessageReceived] DEBUG - Resume successful:', {
|
|
208
|
-
flowRunId: mapping.flowRunId,
|
|
209
|
-
action,
|
|
210
|
-
responseStatus: response.status,
|
|
211
|
-
responseBody: response.body,
|
|
212
|
-
});
|
|
213
|
-
// Delete mapping from Store (cleanup)
|
|
214
|
-
yield store.delete(storeKey, pieces_framework_1.StoreScope.PROJECT);
|
|
215
|
-
// Delete flowRunId mapping
|
|
216
|
-
const flowRunMappingKey = `approval:flowRun:${mapping.flowRunId}`;
|
|
217
|
-
yield store.delete(flowRunMappingKey, pieces_framework_1.StoreScope.PROJECT);
|
|
218
|
-
// Remove key from approval keys list
|
|
219
|
-
const finalKeys = validKeys.filter(key => key !== storeKey);
|
|
220
|
-
yield store.put(keysListKey, finalKeys, pieces_framework_1.StoreScope.PROJECT);
|
|
221
|
-
console.log('[NewMessageReceived] DEBUG - Cleanup completed');
|
|
222
|
-
return { resumed: true, action };
|
|
223
|
-
}
|
|
224
|
-
catch (error) {
|
|
225
|
-
// If resume fails, log but don't throw - message will still be returned
|
|
226
|
-
console.error('[NewMessageReceived] DEBUG - Resume failed:', {
|
|
227
|
-
error: error instanceof Error ? error.message : String(error),
|
|
228
|
-
errorStack: error instanceof Error ? error.stack : undefined,
|
|
229
|
-
resumeUrl,
|
|
230
|
-
flowRunId: mapping.flowRunId,
|
|
231
|
-
reason: 'resume_failed',
|
|
232
|
-
});
|
|
233
|
-
return { resumed: false };
|
|
234
|
-
}
|
|
235
|
-
});
|
|
236
|
-
}
|
|
237
11
|
const polling = {
|
|
238
12
|
strategy: pieces_common_1.DedupeStrategy.TIMEBASED,
|
|
239
13
|
items: (_a) => tslib_1.__awaiter(void 0, [_a], void 0, function* ({ auth, propsValue, lastFetchEpochMS }) {
|
|
@@ -501,14 +275,16 @@ exports.newMessageReceived = (0, pieces_framework_1.createTrigger)({
|
|
|
501
275
|
var _a;
|
|
502
276
|
// Get messages from polling
|
|
503
277
|
const messages = yield pieces_common_1.pollingHelper.poll(polling, context);
|
|
278
|
+
const apiUrl = ((_a = context.server) === null || _a === void 0 ? void 0 : _a.apiUrl) || '';
|
|
279
|
+
// Cleanup expired approvals (also when no messages)
|
|
280
|
+
yield message_utils_1.cleanupExpiredApprovals(context.store);
|
|
504
281
|
// Process each message: try to resume approval flows if applicable
|
|
505
282
|
// Messages are still returned regardless of whether they triggered a resume
|
|
506
283
|
// Debug information is output via console.log (visible in Docker logs)
|
|
507
|
-
const apiUrl = ((_a = context.server) === null || _a === void 0 ? void 0 : _a.apiUrl) || '';
|
|
508
284
|
for (const message of messages) {
|
|
509
285
|
const signalMessage = message;
|
|
510
286
|
// This will output debug info via console.log
|
|
511
|
-
yield tryResumeApprovalFlow(signalMessage, context.store, apiUrl);
|
|
287
|
+
yield message_utils_1.tryResumeApprovalFlow(signalMessage, context.store, apiUrl);
|
|
512
288
|
}
|
|
513
289
|
// Return messages without debug fields (normal output)
|
|
514
290
|
return messages;
|