cclawd 1.0.3 → 1.0.5
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/dist/{active-listener-Dkhmfuwx.js → active-listener-BLd27Pxd.js} +1 -1
- package/dist/{api-key-rotation-BOfI3cG3.js → api-key-rotation-Dg3JlNDQ.js} +1 -1
- package/dist/{audio-preflight-CtkZ5SAs.js → audio-preflight-eV5m9mMp.js} +6 -6
- package/dist/{audio-transcription-runner-CbPqoiHX.js → audio-transcription-runner-CQU4Eg1M.js} +6 -6
- package/dist/build-info.json +3 -3
- package/dist/bundled/boot-md/handler.js +23 -23
- package/dist/bundled/session-memory/handler.js +23 -23
- package/dist/{channel-activity-DWAER4wd.js → channel-activity-dT3cYb0e.js} +1 -1
- package/dist/{commands-registry-BUyiA7nE.js → commands-registry-CyLMCPuP.js} +1 -1
- package/dist/compact.runtime-DGRl4st4.js +39 -0
- package/dist/{deliver-aHOaRbkt.js → deliver-B6eTtXSk.js} +4 -4
- package/dist/{deliver-runtime-D4bCsr6d.js → deliver-runtime-CLDpY6AW.js} +7 -7
- package/dist/{deps-send-discord.runtime-BziKU-pE.js → deps-send-discord.runtime-CxADlame.js} +7 -7
- package/dist/{deps-send-imessage.runtime-CFRnDTqp.js → deps-send-imessage.runtime-Wi79xm6H.js} +7 -7
- package/dist/{deps-send-signal.runtime-BuOtABJm.js → deps-send-signal.runtime-BDtzvsnR.js} +6 -6
- package/dist/{deps-send-slack.runtime-BOLqvMxW.js → deps-send-slack.runtime-CgX24hgT.js} +5 -5
- package/dist/{deps-send-telegram.runtime-DeEoFLv5.js → deps-send-telegram.runtime-CEWc7ePn.js} +6 -6
- package/dist/deps-send-whatsapp.runtime-B1KJ7YOp.js +43 -0
- package/dist/{diagnostic-BdcXX9iJ.js → diagnostic-BZmAxdu9.js} +1 -1
- package/dist/{fetch-D9NUULbj.js → fetch-CMLoICyN.js} +2 -2
- package/dist/{fetch-guard-B5ZMnGaN.js → fetch-guard-DCj3k042.js} +1 -1
- package/dist/{image-4x07m4Jl.js → image-Bt49ybRv.js} +2 -2
- package/dist/{image-runtime-smkMrIol.js → image-runtime-Cilhq73U.js} +2 -2
- package/dist/{ir-CsgNUpOU.js → ir-CVtBjUiL.js} +2 -2
- package/dist/llm-slug-generator.js +23 -23
- package/dist/{login-p_O59TVQ.js → login-D0fUoX-p.js} +2 -2
- package/dist/{login-qr-BCJpDsAy.js → login-qr-ClBxstxZ.js} +2 -2
- package/dist/{manager-CwYv8O3T.js → manager-DSfEj66R.js} +3 -3
- package/dist/{manager-runtime-D_jEoBr9.js → manager-runtime-BrZlGJsj.js} +4 -4
- package/dist/{model-selection-Cv2Puf5z.js → model-selection-CMEj8bpy.js} +11 -11
- package/dist/{outbound-Chpiwybe.js → outbound-BxIJyMzV.js} +4 -4
- package/dist/{outbound-attachment-BnAVJDLe.js → outbound-attachment-CVJwpypG.js} +2 -2
- package/dist/{pi-embedded-CJVNBk0y.js → pi-embedded-CHNPEUAv.js} +57 -57
- package/dist/{pi-model-discovery-7IzK0Uc3.js → pi-model-discovery-D-r5y7kV.js} +1 -1
- package/dist/{pi-model-discovery-runtime-DABef3qy.js → pi-model-discovery-runtime-DZQXYmdu.js} +2 -2
- package/dist/{pi-tools.before-tool-call.runtime-BP2UvGJb.js → pi-tools.before-tool-call.runtime-DagGpfw0.js} +2 -2
- package/dist/plugin-sdk/imessage.js +2 -2
- package/dist/{pw-ai-DwH5GpEO.js → pw-ai-CoIUdns_.js} +1 -1
- package/dist/{runtime-whatsapp-login.runtime-BI3U306v.js → runtime-whatsapp-login.runtime-ChqE9BkX.js} +3 -3
- package/dist/{runtime-whatsapp-outbound.runtime-Bsc2uD09.js → runtime-whatsapp-outbound.runtime-yiy6jzKk.js} +6 -6
- package/dist/{send-DtBvCnPQ.js → send-4rRrSKp9.js} +4 -4
- package/dist/{send-ORtn50qg.js → send-BKO1-P1t.js} +3 -3
- package/dist/{send-C-Q_WPMf.js → send-EDBPXjTT.js} +3 -3
- package/dist/{send-DUibfNQD.js → send-K2mAG7KC.js} +4 -4
- package/dist/{send-BDnOgWIp.js → send-V1MRV7QF.js} +3 -3
- package/dist/{session-B7imi6T5.js → session-CuVCho2m.js} +1 -1
- package/dist/{skill-commands-B9brPuiL.js → skill-commands-B55LOaMB.js} +2 -2
- package/dist/{slash-commands.runtime-Cf6ygfBp.js → slash-commands.runtime-BchS0VkW.js} +2 -2
- package/dist/{slash-dispatch.runtime-CsmvhO5K.js → slash-dispatch.runtime-BIKRY3fr.js} +23 -23
- package/dist/{slash-skill-commands.runtime-CX7stIEP.js → slash-skill-commands.runtime-BP4jBHU9.js} +3 -3
- package/dist/{subagent-registry-runtime-B_S1nf7y.js → subagent-registry-runtime-DjEYzSyM.js} +23 -23
- package/dist/{tables-CjQqTOdD.js → tables-BAGqh2XD.js} +1 -1
- package/dist/{target-errors-BZE1mc-W.js → target-errors-CeBF8Pws.js} +1 -1
- package/dist/{web-Cd8yK1Zq.js → web-BRSmQdtm.js} +27 -27
- package/dist/{whatsapp-actions-CYEzUMBI.js → whatsapp-actions-Dxb2K2Xh.js} +7 -7
- package/extensions/mfa-auth/index.ts +22 -13
- package/extensions/mfa-auth/src/auth-manager.ts +4 -0
- package/extensions/mfa-auth/src/notification-service.ts +68 -24
- package/package.json +1 -1
- package/dist/compact.runtime-DpcZpcTl.js +0 -39
- package/dist/deps-send-whatsapp.runtime-CG1uXYLY.js +0 -43
|
@@ -22,34 +22,47 @@ class NotificationService {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
async sendAuthNotification(session: AuthSession, message: string): Promise<void> {
|
|
25
|
-
const { channel
|
|
25
|
+
const { channel } = session.originalContext;
|
|
26
26
|
|
|
27
27
|
if (!this.cfg) {
|
|
28
28
|
console.warn("[mfa-auth] Config not set, skipping notification");
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
32
|
+
const normalizedChannel = String(channel || "")
|
|
33
|
+
.trim()
|
|
34
|
+
.toLowerCase();
|
|
37
35
|
|
|
38
|
-
if (
|
|
39
|
-
|
|
36
|
+
if (normalizedChannel === "feishu") {
|
|
37
|
+
try {
|
|
38
|
+
await this.sendToFeishu(session, message);
|
|
39
|
+
} catch (error) {
|
|
40
|
+
// Fallback to gateway injection to avoid silent message loss when channel API
|
|
41
|
+
// permissions are temporarily missing.
|
|
42
|
+
console.warn(
|
|
43
|
+
`[mfa-auth] Feishu direct send failed, falling back to gateway inject: ${String(error)}`,
|
|
44
|
+
);
|
|
45
|
+
await this.sendViaGatewayInject(session, message, normalizedChannel);
|
|
46
|
+
}
|
|
40
47
|
return;
|
|
41
48
|
}
|
|
42
49
|
|
|
43
|
-
|
|
50
|
+
await this.sendViaGatewayInject(session, message, normalizedChannel);
|
|
44
51
|
}
|
|
45
52
|
|
|
46
|
-
private async
|
|
47
|
-
|
|
53
|
+
private async sendViaGatewayInject(
|
|
54
|
+
session: AuthSession,
|
|
55
|
+
message: string,
|
|
56
|
+
channelHint?: string,
|
|
57
|
+
): Promise<void> {
|
|
58
|
+
const { sessionKey, accountId } = session.originalContext;
|
|
48
59
|
const port = this.cfg?.gateway?.port || 18789;
|
|
49
60
|
const token = this.cfg?.gateway?.auth?.token;
|
|
50
61
|
const host = config.gatewayHost || "127.0.0.1";
|
|
51
62
|
|
|
52
|
-
console.log(
|
|
63
|
+
console.log(
|
|
64
|
+
`[mfa-auth] sendViaGatewayInject: channel=${channelHint || "unknown"}, sessionKey=${sessionKey}, host=${host}, port=${port}`,
|
|
65
|
+
);
|
|
53
66
|
|
|
54
67
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
55
68
|
const wsModule = await import("ws");
|
|
@@ -133,7 +146,9 @@ class NotificationService {
|
|
|
133
146
|
reject(new Error(`sessions.list failed: ${JSON.stringify(response.error)}`));
|
|
134
147
|
return;
|
|
135
148
|
}
|
|
136
|
-
candidateSessionKeys = this.
|
|
149
|
+
candidateSessionKeys = this.resolveSessionCandidates({
|
|
150
|
+
channelHint,
|
|
151
|
+
accountId,
|
|
137
152
|
requestedSessionKey: sessionKey,
|
|
138
153
|
userId: session.userId,
|
|
139
154
|
targetTo: session.originalContext.to,
|
|
@@ -141,11 +156,11 @@ class NotificationService {
|
|
|
141
156
|
});
|
|
142
157
|
if (candidateSessionKeys.length === 0) {
|
|
143
158
|
ws.close();
|
|
144
|
-
reject(new Error("No candidate
|
|
159
|
+
reject(new Error("No candidate sessions found for gateway inject"));
|
|
145
160
|
return;
|
|
146
161
|
}
|
|
147
162
|
console.log(
|
|
148
|
-
`[mfa-auth] candidate
|
|
163
|
+
`[mfa-auth] candidate sessions (${channelHint || "any"}): ${candidateSessionKeys.join(", ")}`,
|
|
149
164
|
);
|
|
150
165
|
injectIndex = 0;
|
|
151
166
|
sendInject(candidateSessionKeys[injectIndex]);
|
|
@@ -193,12 +208,20 @@ class NotificationService {
|
|
|
193
208
|
});
|
|
194
209
|
}
|
|
195
210
|
|
|
196
|
-
private
|
|
211
|
+
private resolveSessionCandidates(params: {
|
|
212
|
+
channelHint?: string;
|
|
213
|
+
accountId?: string;
|
|
197
214
|
requestedSessionKey?: string;
|
|
198
215
|
userId: string;
|
|
199
216
|
targetTo?: string;
|
|
200
217
|
sessionsListResult: unknown;
|
|
201
218
|
}): string[] {
|
|
219
|
+
const normalizedChannelHint = String(params.channelHint || "")
|
|
220
|
+
.trim()
|
|
221
|
+
.toLowerCase();
|
|
222
|
+
const normalizedAccountId = String(params.accountId || "")
|
|
223
|
+
.trim()
|
|
224
|
+
.toLowerCase();
|
|
202
225
|
const normalizedTarget = String(params.targetTo || params.userId || "")
|
|
203
226
|
.trim()
|
|
204
227
|
.toLowerCase();
|
|
@@ -207,7 +230,7 @@ class NotificationService {
|
|
|
207
230
|
? (params.sessionsListResult as Record<string, unknown>)
|
|
208
231
|
: undefined;
|
|
209
232
|
const sessionsRaw = Array.isArray(resultObject?.sessions) ? resultObject.sessions : [];
|
|
210
|
-
const
|
|
233
|
+
const matchingRows = sessionsRaw
|
|
211
234
|
.map((row) => (row && typeof row === "object" ? (row as Record<string, unknown>) : undefined))
|
|
212
235
|
.filter((row): row is Record<string, unknown> => Boolean(row))
|
|
213
236
|
.filter((row) => {
|
|
@@ -218,20 +241,40 @@ class NotificationService {
|
|
|
218
241
|
const dcChannel = String(dc?.channel ?? "")
|
|
219
242
|
.trim()
|
|
220
243
|
.toLowerCase();
|
|
221
|
-
|
|
244
|
+
|
|
245
|
+
if (!normalizedChannelHint) {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
if (normalizedChannelHint === "web" || normalizedChannelHint === "webchat") {
|
|
250
|
+
return ch === "webchat" || ch === "web" || dcChannel === "webchat" || dcChannel === "web";
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return ch === normalizedChannelHint || dcChannel === normalizedChannelHint;
|
|
254
|
+
})
|
|
255
|
+
.filter((row) => {
|
|
256
|
+
if (!normalizedAccountId) return true;
|
|
257
|
+
const dc = row.deliveryContext as Record<string, unknown> | undefined;
|
|
258
|
+
const rowAccount = String(row.accountId ?? "")
|
|
259
|
+
.trim()
|
|
260
|
+
.toLowerCase();
|
|
261
|
+
const dcAccount = String(dc?.accountId ?? "")
|
|
262
|
+
.trim()
|
|
263
|
+
.toLowerCase();
|
|
264
|
+
return rowAccount === normalizedAccountId || dcAccount === normalizedAccountId;
|
|
222
265
|
});
|
|
223
266
|
|
|
224
|
-
const exactRows =
|
|
267
|
+
const exactRows = matchingRows.filter((row) => {
|
|
225
268
|
const dc = row.deliveryContext as Record<string, unknown> | undefined;
|
|
226
269
|
const peer = String(dc?.to ?? row.lastTo ?? "")
|
|
227
270
|
.trim()
|
|
228
271
|
.toLowerCase();
|
|
229
272
|
return peer.length > 0 && peer === normalizedTarget;
|
|
230
273
|
});
|
|
231
|
-
const fallbackRows =
|
|
274
|
+
const fallbackRows = matchingRows.filter((row) => !exactRows.includes(row));
|
|
232
275
|
|
|
233
|
-
// Fuzzy match: include any
|
|
234
|
-
const fuzzyRows =
|
|
276
|
+
// Fuzzy match: include any session whose key contains the target id.
|
|
277
|
+
const fuzzyRows = matchingRows.filter((row) => {
|
|
235
278
|
const key = String(row.key ?? "").toLowerCase();
|
|
236
279
|
// Ensure we don't duplicate rows already found
|
|
237
280
|
return (
|
|
@@ -253,9 +296,10 @@ class NotificationService {
|
|
|
253
296
|
...exactRows.map((row) => String(row.key ?? "").trim()),
|
|
254
297
|
...fallbackRows.map((row) => String(row.key ?? "").trim()),
|
|
255
298
|
...fuzzyRows.map((row) => String(row.key ?? "").trim()),
|
|
256
|
-
//
|
|
299
|
+
// Common fallback patterns.
|
|
257
300
|
`agent:main:${normalizedTarget}`,
|
|
258
|
-
|
|
301
|
+
`${normalizedChannelHint}:${normalizedTarget}`,
|
|
302
|
+
normalizedAccountId ? `${normalizedChannelHint}:${normalizedAccountId}:${normalizedTarget}` : "",
|
|
259
303
|
normalizedTarget,
|
|
260
304
|
"main",
|
|
261
305
|
];
|
package/package.json
CHANGED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import "./paths-CehYKFsO.js";
|
|
2
|
-
import "./paths-DkxwiA8g.js";
|
|
3
|
-
import "./subsystem-DfXy5gUB.js";
|
|
4
|
-
import "./workspace-DGIcKCCW.js";
|
|
5
|
-
import "./logger-CbUVl62f.js";
|
|
6
|
-
import "./model-selection-Cv2Puf5z.js";
|
|
7
|
-
import "./github-copilot-token-8N63GdbE.js";
|
|
8
|
-
import "./boolean-C7Ct_klp.js";
|
|
9
|
-
import "./env-lw2hsIUY.js";
|
|
10
|
-
import "./frontmatter-C_obXuTp.js";
|
|
11
|
-
import "./send-ORtn50qg.js";
|
|
12
|
-
import "./send-DtBvCnPQ.js";
|
|
13
|
-
import { n as compactEmbeddedPiSessionDirect } from "./pi-embedded-CJVNBk0y.js";
|
|
14
|
-
import "./tokens-6ul2IrzG.js";
|
|
15
|
-
import "./deliver-aHOaRbkt.js";
|
|
16
|
-
import "./diagnostic-BdcXX9iJ.js";
|
|
17
|
-
import "./send-BDnOgWIp.js";
|
|
18
|
-
import "./pi-model-discovery-7IzK0Uc3.js";
|
|
19
|
-
import "./image-4x07m4Jl.js";
|
|
20
|
-
import "./audio-transcription-runner-CbPqoiHX.js";
|
|
21
|
-
import "./fetch-D9NUULbj.js";
|
|
22
|
-
import "./fetch-guard-B5ZMnGaN.js";
|
|
23
|
-
import "./api-key-rotation-BOfI3cG3.js";
|
|
24
|
-
import "./proxy-fetch-BOh1PLOW.js";
|
|
25
|
-
import "./ir-CsgNUpOU.js";
|
|
26
|
-
import "./render-IRnn-2gt.js";
|
|
27
|
-
import "./target-errors-BZE1mc-W.js";
|
|
28
|
-
import "./commands-registry-BUyiA7nE.js";
|
|
29
|
-
import "./skill-commands-B9brPuiL.js";
|
|
30
|
-
import "./fetch-CeWULXBI.js";
|
|
31
|
-
import "./channel-activity-DWAER4wd.js";
|
|
32
|
-
import "./tables-CjQqTOdD.js";
|
|
33
|
-
import "./send-C-Q_WPMf.js";
|
|
34
|
-
import "./outbound-attachment-BnAVJDLe.js";
|
|
35
|
-
import "./send-DUibfNQD.js";
|
|
36
|
-
import "./fetch-C0iyt-Iz.js";
|
|
37
|
-
import "./manager-CwYv8O3T.js";
|
|
38
|
-
import "./query-expansion-BErUY8P2.js";
|
|
39
|
-
export { compactEmbeddedPiSessionDirect };
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import "./paths-CehYKFsO.js";
|
|
2
|
-
import "./paths-DkxwiA8g.js";
|
|
3
|
-
import "./subsystem-DfXy5gUB.js";
|
|
4
|
-
import "./workspace-DGIcKCCW.js";
|
|
5
|
-
import "./logger-CbUVl62f.js";
|
|
6
|
-
import "./model-selection-Cv2Puf5z.js";
|
|
7
|
-
import "./github-copilot-token-8N63GdbE.js";
|
|
8
|
-
import "./boolean-C7Ct_klp.js";
|
|
9
|
-
import "./env-lw2hsIUY.js";
|
|
10
|
-
import "./frontmatter-C_obXuTp.js";
|
|
11
|
-
import "./send-ORtn50qg.js";
|
|
12
|
-
import "./send-DtBvCnPQ.js";
|
|
13
|
-
import "./pi-embedded-CJVNBk0y.js";
|
|
14
|
-
import "./tokens-6ul2IrzG.js";
|
|
15
|
-
import "./deliver-aHOaRbkt.js";
|
|
16
|
-
import "./diagnostic-BdcXX9iJ.js";
|
|
17
|
-
import "./send-BDnOgWIp.js";
|
|
18
|
-
import "./pi-model-discovery-7IzK0Uc3.js";
|
|
19
|
-
import "./image-4x07m4Jl.js";
|
|
20
|
-
import "./audio-transcription-runner-CbPqoiHX.js";
|
|
21
|
-
import "./fetch-D9NUULbj.js";
|
|
22
|
-
import "./fetch-guard-B5ZMnGaN.js";
|
|
23
|
-
import "./api-key-rotation-BOfI3cG3.js";
|
|
24
|
-
import "./proxy-fetch-BOh1PLOW.js";
|
|
25
|
-
import "./ir-CsgNUpOU.js";
|
|
26
|
-
import "./render-IRnn-2gt.js";
|
|
27
|
-
import "./target-errors-BZE1mc-W.js";
|
|
28
|
-
import "./commands-registry-BUyiA7nE.js";
|
|
29
|
-
import "./skill-commands-B9brPuiL.js";
|
|
30
|
-
import "./fetch-CeWULXBI.js";
|
|
31
|
-
import "./channel-activity-DWAER4wd.js";
|
|
32
|
-
import "./tables-CjQqTOdD.js";
|
|
33
|
-
import "./send-C-Q_WPMf.js";
|
|
34
|
-
import "./outbound-attachment-BnAVJDLe.js";
|
|
35
|
-
import "./send-DUibfNQD.js";
|
|
36
|
-
import "./fetch-C0iyt-Iz.js";
|
|
37
|
-
import "./manager-CwYv8O3T.js";
|
|
38
|
-
import "./query-expansion-BErUY8P2.js";
|
|
39
|
-
import { t as sendMessageWhatsApp } from "./outbound-Chpiwybe.js";
|
|
40
|
-
import "./session-B7imi6T5.js";
|
|
41
|
-
import "./login-p_O59TVQ.js";
|
|
42
|
-
import "./web-Cd8yK1Zq.js";
|
|
43
|
-
export { sendMessageWhatsApp };
|