cclawd 1.0.0 → 1.0.2

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.
Files changed (111) hide show
  1. package/dist/{active-listener-DYmI7imH.js → active-listener-BLd27Pxd.js} +2 -2
  2. package/dist/{api-key-rotation-DLU4jvSu.js → api-key-rotation-Dg3JlNDQ.js} +1 -1
  3. package/dist/{audio-preflight-C9TMbRb4.js → audio-preflight-eV5m9mMp.js} +15 -15
  4. package/dist/{audio-transcription-runner-Q5zG_hYd.js → audio-transcription-runner-CQU4Eg1M.js} +10 -10
  5. package/dist/{audit-membership-runtime-DhxSwFnF.js → audit-membership-runtime-hXUuer4x.js} +6 -6
  6. package/dist/build-info.json +3 -3
  7. package/dist/bundled/boot-md/handler.js +35 -35
  8. package/dist/bundled/bootstrap-extra-files/handler.js +5 -5
  9. package/dist/bundled/command-logger/handler.js +2 -2
  10. package/dist/bundled/session-memory/handler.js +35 -35
  11. package/dist/{channel-activity-Bx08UTAg.js → channel-activity-dT3cYb0e.js} +2 -2
  12. package/dist/{commands-registry-llLVCTH9.js → commands-registry-CyLMCPuP.js} +2 -2
  13. package/dist/compact.runtime-DGRl4st4.js +39 -0
  14. package/dist/{deliver-DJf2ZBpe.js → deliver-B6eTtXSk.js} +19 -19
  15. package/dist/deliver-runtime-CLDpY6AW.js +19 -0
  16. package/dist/deps-send-discord.runtime-CxADlame.js +19 -0
  17. package/dist/deps-send-imessage.runtime-Wi79xm6H.js +18 -0
  18. package/dist/deps-send-signal.runtime-BDtzvsnR.js +17 -0
  19. package/dist/deps-send-slack.runtime-CgX24hgT.js +17 -0
  20. package/dist/deps-send-telegram.runtime-CEWc7ePn.js +20 -0
  21. package/dist/deps-send-whatsapp.runtime-B1KJ7YOp.js +43 -0
  22. package/dist/{diagnostic-BCCMF3O_.js → diagnostic-BZmAxdu9.js} +2 -2
  23. package/dist/{env-aYXLHjfZ.js → env-lw2hsIUY.js} +1 -1
  24. package/dist/{fetch-bvgIiupu.js → fetch-C0iyt-Iz.js} +3 -3
  25. package/dist/{fetch-DCTUdr1U.js → fetch-CMLoICyN.js} +5 -5
  26. package/dist/{fetch-guard-CqpEmMQ2.js → fetch-guard-DCj3k042.js} +2 -2
  27. package/dist/{frontmatter-DjZuS525.js → frontmatter-C_obXuTp.js} +3 -3
  28. package/dist/{github-copilot-token-CQmATy5E.js → github-copilot-token-8N63GdbE.js} +7 -7
  29. package/dist/{image-Q8E1-lZn.js → image-Bt49ybRv.js} +4 -4
  30. package/dist/image-runtime-Cilhq73U.js +12 -0
  31. package/dist/{ir-CzM3SxId.js → ir-CVtBjUiL.js} +6 -6
  32. package/dist/llm-slug-generator.js +35 -35
  33. package/dist/{logger-ChbX1G7s.js → logger-CbUVl62f.js} +7 -7
  34. package/dist/{login-B0mtU11X.js → login-D0fUoX-p.js} +4 -4
  35. package/dist/{login-qr-DY_i60f5.js → login-qr-ClBxstxZ.js} +10 -10
  36. package/dist/{manager-FAQPC0uO.js → manager-DSfEj66R.js} +12 -12
  37. package/dist/manager-runtime-BrZlGJsj.js +15 -0
  38. package/dist/{model-selection-wf3OY5DX.js → model-selection-CMEj8bpy.js} +130 -130
  39. package/dist/{outbound-Bw0dOVS7.js → outbound-BxIJyMzV.js} +6 -6
  40. package/dist/{outbound-attachment-1R6r9Pg_.js → outbound-attachment-CVJwpypG.js} +2 -2
  41. package/dist/{paths-C0HLtPu0.js → paths-CehYKFsO.js} +7 -7
  42. package/dist/{paths-hfkBoC7i.js → paths-DkxwiA8g.js} +5 -5
  43. package/dist/{pi-embedded-BAHaY-Oh.js → pi-embedded-CHNPEUAv.js} +159 -159
  44. package/dist/{pi-model-discovery-ItS07aJB.js → pi-model-discovery-D-r5y7kV.js} +7 -7
  45. package/dist/pi-model-discovery-runtime-DZQXYmdu.js +12 -0
  46. package/dist/{pi-tools.before-tool-call.runtime-D_mthvtC.js → pi-tools.before-tool-call.runtime-DagGpfw0.js} +10 -10
  47. package/dist/{proxy-fetch-c1ZUFFcO.js → proxy-fetch-BOh1PLOW.js} +1 -1
  48. package/dist/{pw-ai-Ok6KGelf.js → pw-ai-CoIUdns_.js} +9 -9
  49. package/dist/{qmd-manager-DhfEz4Ar.js → qmd-manager-DEscZz5_.js} +6 -6
  50. package/dist/{query-expansion-GqNV2iIE.js → query-expansion-BErUY8P2.js} +4 -4
  51. package/dist/runtime-whatsapp-login.runtime-ChqE9BkX.js +13 -0
  52. package/dist/runtime-whatsapp-outbound.runtime-yiy6jzKk.js +17 -0
  53. package/dist/{send-DPflcjM5.js → send-4rRrSKp9.js} +6 -6
  54. package/dist/{send-CEg4P96c.js → send-BKO1-P1t.js} +5 -5
  55. package/dist/{send-CS0ocZHl.js → send-EDBPXjTT.js} +3 -3
  56. package/dist/{send-6R8b9zsj.js → send-K2mAG7KC.js} +5 -5
  57. package/dist/{send-DwAoiT2p.js → send-V1MRV7QF.js} +25 -25
  58. package/dist/{session-BoIID5UR.js → session-CuVCho2m.js} +7 -7
  59. package/dist/{skill-commands-DhdiziMs.js → skill-commands-B55LOaMB.js} +9 -9
  60. package/dist/slash-commands.runtime-BchS0VkW.js +12 -0
  61. package/dist/slash-dispatch.runtime-BIKRY3fr.js +39 -0
  62. package/dist/slash-skill-commands.runtime-BP4jBHU9.js +13 -0
  63. package/dist/subagent-registry-runtime-DjEYzSyM.js +39 -0
  64. package/dist/{subsystem-C8z6w6xC.js → subsystem-DfXy5gUB.js} +14 -14
  65. package/dist/{tables-DQusRhkD.js → tables-BAGqh2XD.js} +1 -1
  66. package/dist/{target-errors-CfavnC9U.js → target-errors-CeBF8Pws.js} +1 -1
  67. package/dist/{tokens-BWDIKewp.js → tokens-6ul2IrzG.js} +1 -1
  68. package/dist/{web-CrcrTQ2c.js → web-BRSmQdtm.js} +39 -39
  69. package/dist/{whatsapp-actions-B0u0ZAme.js → whatsapp-actions-Dxb2K2Xh.js} +15 -15
  70. package/dist/{workspace-CWDYHR27.js → workspace-DGIcKCCW.js} +20 -20
  71. package/extensions/mfa-auth/README.md +33 -38
  72. package/extensions/mfa-auth/index.ts +97 -92
  73. package/extensions/mfa-auth/node_modules/.bin/qrcode-terminal +1 -6
  74. package/extensions/mfa-auth/node_modules/.bin/qrcode-terminal.cmd +17 -0
  75. package/extensions/mfa-auth/node_modules/.bin/qrcode-terminal.ps1 +0 -13
  76. package/extensions/mfa-auth/node_modules/.bin/tsx +1 -6
  77. package/extensions/mfa-auth/node_modules/.bin/tsx.cmd +17 -0
  78. package/extensions/mfa-auth/node_modules/.bin/tsx.ps1 +0 -13
  79. package/extensions/mfa-auth/node_modules/.package-lock.json +103 -0
  80. package/extensions/mfa-auth/package-lock.json +115 -0
  81. package/extensions/mfa-auth/package.json +1 -1
  82. package/extensions/mfa-auth/src/auth-manager.ts +4 -2
  83. package/extensions/mfa-auth/src/config.ts +1 -4
  84. package/extensions/mfa-auth/src/dabby-client.test.ts +68 -147
  85. package/extensions/mfa-auth/src/dabby-client.ts +70 -89
  86. package/extensions/mfa-auth/src/feishu-support/index.ts +2 -2
  87. package/extensions/mfa-auth/src/notification-service.ts +19 -14
  88. package/extensions/mfa-auth/src/providers/base.ts +0 -1
  89. package/extensions/mfa-auth/src/providers/qr-code.ts +3 -506
  90. package/extensions/mfa-auth/src/server.ts +3 -223
  91. package/extensions/mfa-auth/src/types.ts +13 -36
  92. package/package.json +458 -460
  93. package/dist/compact.runtime-BEn3giMt.js +0 -39
  94. package/dist/deliver-runtime-DkQ3XzGv.js +0 -19
  95. package/dist/deps-send-discord.runtime-BLpqSj6s.js +0 -19
  96. package/dist/deps-send-imessage.runtime-BFzyYqvR.js +0 -18
  97. package/dist/deps-send-signal.runtime-DT0TYCy1.js +0 -17
  98. package/dist/deps-send-slack.runtime-BhaGFfMX.js +0 -17
  99. package/dist/deps-send-telegram.runtime-B6Cic9NX.js +0 -20
  100. package/dist/deps-send-whatsapp.runtime-WtEhIq2S.js +0 -43
  101. package/dist/image-runtime-B1LFYfQ2.js +0 -12
  102. package/dist/manager-runtime-Da7ME9vS.js +0 -15
  103. package/dist/pi-model-discovery-runtime-DjM7Z1fx.js +0 -12
  104. package/dist/runtime-whatsapp-login.runtime-D4BRhQkK.js +0 -13
  105. package/dist/runtime-whatsapp-outbound.runtime-DJPpS6g-.js +0 -17
  106. package/dist/slash-commands.runtime-Cu1lTjV9.js +0 -12
  107. package/dist/slash-dispatch.runtime-DRVJEF4l.js +0 -39
  108. package/dist/slash-skill-commands.runtime-C373PJjv.js +0 -13
  109. package/dist/subagent-registry-runtime-D7hWBo1G.js +0 -39
  110. package/extensions/mfa-auth/node_modules/.bin/qrcode-terminal.CMD +0 -12
  111. package/extensions/mfa-auth/node_modules/.bin/tsx.CMD +0 -12
@@ -1,234 +1,14 @@
1
- import http from "node:http";
2
- import { authManager } from "./auth-manager.js";
3
- import { config } from "./config.js";
4
- import { dabbyClient } from "./dabby-client.js";
5
- import { qrCodeAuthProvider } from "./providers/qr-code.js";
6
- import { renderQrPngBase64 } from "./qr.js";
7
1
  import type { AuthSession } from "./types.js";
8
- import { getLocalIpAddress } from "./utils.js";
9
2
 
10
3
  let notifyCallback: ((session: AuthSession) => void | Promise<void>) | null = null;
11
- let serverIpAddress = "localhost";
12
4
 
13
5
  export function setNotifyCallback(callback: (session: AuthSession) => void | Promise<void>): void {
14
6
  console.log("[mfa-auth] setNotifyCallback called");
15
7
  notifyCallback = callback;
16
8
  }
17
9
 
18
- export function getServerIpAddress(): string {
19
- if (config.domain) {
20
- return config.domain;
10
+ export async function notifyVerificationSuccess(session: AuthSession): Promise<void> {
11
+ if (notifyCallback) {
12
+ await notifyCallback(session);
21
13
  }
22
- return serverIpAddress;
23
- }
24
-
25
- export function getServerBaseUrl(): string {
26
- const host = getServerIpAddress();
27
- if (host.startsWith("http://") || host.startsWith("https://")) {
28
- return host.replace(/\/$/, ""); // Remove trailing slash if present
29
- }
30
- return `http://${host}:${config.port}`;
31
- }
32
-
33
- export function startHttpServer(): void {
34
- serverIpAddress = getLocalIpAddress();
35
- console.log("[mfa-auth] startHttpServer called, attempting to start server on port", config.port);
36
-
37
- const server = http.createServer(async (req, res) => {
38
- const url = new URL(req.url || "", `http://${req.headers.host}`);
39
-
40
- if (url.pathname === "/health") {
41
- res.writeHead(200, { "Content-Type": "text/plain" });
42
- res.end("OK");
43
- return;
44
- }
45
-
46
- if (url.pathname.startsWith("/mfa-auth/")) {
47
- if (url.pathname === "/mfa-auth/verify") {
48
- if (req.method === "POST") {
49
- let body = "";
50
- req.on("data", (chunk) => {
51
- body += chunk.toString();
52
- });
53
- req.on("end", async () => {
54
- try {
55
- const { sessionId } = JSON.parse(body);
56
- const session = authManager.getSession(sessionId);
57
- if (!session) {
58
- res.writeHead(404, { "Content-Type": "application/json" });
59
- res.end(JSON.stringify({ success: false, error: "Session not found" }));
60
- return;
61
- }
62
-
63
- const result = await authManager.verifySession(sessionId);
64
-
65
- if (result.success) {
66
- if (notifyCallback) {
67
- await notifyCallback(session);
68
- }
69
- }
70
-
71
- res.writeHead(200, { "Content-Type": "application/json" });
72
- res.end(JSON.stringify(result));
73
- } catch (error) {
74
- res.writeHead(400, { "Content-Type": "application/json" });
75
- res.end(JSON.stringify({ success: false, error: "Invalid request" }));
76
- }
77
- });
78
- return;
79
- }
80
- }
81
-
82
- if (url.pathname === "/mfa-auth/refresh") {
83
- if (req.method === "POST") {
84
- let body = "";
85
- req.on("data", (chunk) => {
86
- body += chunk.toString();
87
- });
88
- req.on("end", async () => {
89
- try {
90
- const { sessionId } = JSON.parse(body);
91
- const session = authManager.getSession(sessionId);
92
- if (!session) {
93
- res.writeHead(404, { "Content-Type": "application/json" });
94
- res.end(JSON.stringify({ success: false, error: "Session not found" }));
95
- return;
96
- }
97
-
98
- const tokenInfo = await dabbyClient.getQrCode();
99
- session.certToken = tokenInfo.certToken;
100
- session.qrcodeContent = tokenInfo.qrcodeContent;
101
- session.expireTimeMs = tokenInfo.expireTimeMs;
102
-
103
- authManager.updateAuthStatus(sessionId, "pending");
104
- console.log(`[mfa-auth] QR code refreshed for session ${session.sessionId}`);
105
-
106
- const qrcodeBase64 = await renderQrPngBase64(session.qrcodeContent);
107
-
108
- // 计算剩余时间
109
- const remainingTime = Math.max(
110
- 0,
111
- Math.ceil((config.timeout - (Date.now() - session.timestamp)) / 1000),
112
- );
113
-
114
- res.writeHead(200, { "Content-Type": "application/json" });
115
- res.end(
116
- JSON.stringify({
117
- success: true,
118
- qrcodeBase64,
119
- qrcodeContent: session.qrcodeContent,
120
- expireTimeMs: session.expireTimeMs,
121
- remainingTime,
122
- }),
123
- );
124
- } catch (error) {
125
- console.error(`[mfa-auth] Failed to refresh QR code: ${error}`);
126
- res.writeHead(500, { "Content-Type": "application/json" });
127
- res.end(JSON.stringify({ success: false, error: String(error) }));
128
- }
129
- });
130
- return;
131
- }
132
- }
133
-
134
- const sessionId = url.pathname.split("/")[2];
135
- if (req.method === "GET" && sessionId) {
136
- const session = authManager.getSession(sessionId);
137
-
138
- if (config.debug) {
139
- console.log(`[mfa-auth] GET request for sessionId: ${sessionId}`);
140
- console.log(`[mfa-auth] Session found: ${!!session}`);
141
- console.log(
142
- `[mfa-auth] All sessions: ${Array.from(authManager.getSessionIds()).join(", ")}`,
143
- );
144
- }
145
-
146
- if (!session) {
147
- if (config.debug) {
148
- console.log(`[mfa-auth] Session not found or expired: ${sessionId}`);
149
- }
150
- res.writeHead(404, { "Content-Type": "text/html; charset=utf-8" });
151
- res.end(`
152
- <!DOCTYPE html>
153
- <html>
154
- <head>
155
- <meta charset="utf-8">
156
- <title>验证码不存在</title>
157
- <style>
158
- body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; background: #f5f5f5; }
159
- .container { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); text-align: center; }
160
- h1 { color: #e53e3e; margin-top: 0; }
161
- </style>
162
- </head>
163
- <body>
164
- <div class="container">
165
- <h1>❌ 验证二维码不存在或已过期</h1>
166
- <p>请重新执操作以获取新的验证二维码</p>
167
- </div>
168
- </body>
169
- </html>
170
- `);
171
- return;
172
- }
173
-
174
- try {
175
- const provider = authManager.getProvider(session.authMethod);
176
- if (!provider) {
177
- res.writeHead(500, { "Content-Type": "text/plain" });
178
- res.end("Provider not found");
179
- return;
180
- }
181
-
182
- await provider.initialize(session);
183
-
184
- const authUrl = `${getServerBaseUrl()}/mfa-auth/${session.sessionId}`;
185
- const html = await provider.generateAuthPage(session, authUrl);
186
-
187
- res.writeHead(200, { "Content-Type": "text/html; charset=utf-8" });
188
- res.end(html);
189
- } catch (error) {
190
- console.error(`[mfa-auth] Error generating auth page: ${error}`);
191
- res.writeHead(500, { "Content-Type": "text/html; charset=utf-8" });
192
- res.end(`
193
- <!DOCTYPE html>
194
- <html>
195
- <head>
196
- <meta charset="utf-8">
197
- <title>错误</title>
198
- <style>
199
- body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; background: #f5f5f5; }
200
- .container { background: white; padding: 40px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); text-align: center; }
201
- h1 { color: #e53e3e; margin-top: 0; }
202
- p { color: #666; }
203
- </style>
204
- </head>
205
- <body>
206
- <div class="container">
207
- <h1>❌ 生成认证页面失败</h1>
208
- <p>错误信息: ${String(error)}</p>
209
- <p>请稍后重试</p>
210
- </div>
211
- </body>
212
- </html>
213
- `);
214
- }
215
- return;
216
- }
217
- }
218
-
219
- res.writeHead(404, { "Content-Type": "text/plain" });
220
- res.end("Not found");
221
- });
222
-
223
- server.listen(config.port, () => {
224
- console.log(`[mfa-auth] HTTP server running on http://${serverIpAddress}:${config.port}`);
225
- });
226
-
227
- server.on("error", (err: any) => {
228
- if (err.code === "EADDRINUSE") {
229
- console.error(`[mfa-auth] Port ${config.port} is already in use`);
230
- } else {
231
- console.error("[mfa-auth] Server error:", err);
232
- }
233
- });
234
14
  }
@@ -9,7 +9,7 @@ export interface AuthSession {
9
9
  timestamp: number;
10
10
  originalContext: PendingAuthContext;
11
11
  certToken?: string;
12
- qrcodeContent?: string;
12
+ qrCodeUrl?: string;
13
13
  expireTimeMs?: number;
14
14
  authStatus?: AuthStatus;
15
15
  metadata?: Record<string, unknown>;
@@ -35,7 +35,6 @@ export interface PendingAuthContext {
35
35
  export interface MfaConfig {
36
36
  timeout: number;
37
37
  verificationDuration: number;
38
- port: number;
39
38
  domain?: string;
40
39
  debug: boolean;
41
40
  sensitiveKeywords: string[];
@@ -58,7 +57,6 @@ export interface AuthMethodProvider {
58
57
  initialize(session: AuthSession): Promise<void>;
59
58
  verify(sessionId: string, userInput?: string): Promise<AuthResult>;
60
59
  cleanup(sessionId: string): void;
61
- generateAuthPage(session: AuthSession, authUrl: string): Promise<string>;
62
60
  }
63
61
 
64
62
  export interface AuthResult {
@@ -68,51 +66,30 @@ export interface AuthResult {
68
66
  }
69
67
 
70
68
  export interface DabbyConfig {
71
- clientId: string;
72
- clientSecret: string;
69
+ apiKey: string;
73
70
  apiBaseUrl: string;
74
- tokenCacheDuration: number;
75
71
  pollInterval: number;
76
72
  }
77
73
 
78
- export interface DabbyAccessTokenResponse {
79
- accessToken: string;
80
- apiVersion: string;
81
- expireSeconds: number;
74
+ export interface DabbyVerifyCodeResponse {
82
75
  retCode: number;
83
76
  retMessage: string;
84
- timestamp: number;
85
- }
86
-
87
- export interface DabbyQrCodeResponse {
88
- apiVersion: string;
89
- retCode: number;
90
- retMessage: string;
91
- tokenInfo: {
92
- authType: string;
77
+ message?: string;
78
+ data: {
93
79
  certToken: string;
94
- createdAt: string;
95
- expireAt: string;
96
- expireTimeMs: number;
97
- qrcodeContent: string;
98
- timestamp: number;
80
+ qrCodeUrl: string;
99
81
  };
100
82
  }
101
83
 
102
- export interface DabbyAuthResultResponse {
103
- apiVersion: string;
104
- authData: {
105
- authMode: number;
106
- authObject: {
84
+ export interface DabbyCheckAuthStatusResponse {
85
+ retCode: number;
86
+ message: string;
87
+ data: {
88
+ authSuccess: boolean;
89
+ authResult: {
107
90
  idNum: string;
108
91
  fullName: string;
109
92
  };
110
- authType: string;
111
- portrait: string;
112
- resCode: number;
113
- resStr: string;
93
+ message: string;
114
94
  };
115
- authInfo: Record<string, unknown>;
116
- retCode: number;
117
- retMessage: string;
118
95
  }