codebuff 1.0.207 → 1.0.208

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 (67) hide show
  1. package/dist/cli.js +9 -0
  2. package/dist/cli.js.map +1 -1
  3. package/dist/client.js +21 -15
  4. package/dist/client.js.map +1 -1
  5. package/dist/common/browser-actions.d.ts +240 -240
  6. package/dist/common/logger.d.ts +1 -0
  7. package/dist/common/logger.js +7 -0
  8. package/dist/common/logger.js.map +1 -0
  9. package/dist/common/types/agent-state.d.ts +6 -6
  10. package/dist/common/types/message.d.ts +6 -6
  11. package/dist/common/util/constants.d.ts +1 -0
  12. package/dist/common/util/constants.js +7 -0
  13. package/dist/common/util/constants.js.map +1 -0
  14. package/dist/common/util/credentials.d.ts +2 -2
  15. package/dist/common/util/helpers.d.ts +1 -0
  16. package/dist/common/util/helpers.js +6 -0
  17. package/dist/common/util/helpers.js.map +1 -0
  18. package/dist/common/util/token-counter.d.ts +3 -0
  19. package/dist/common/util/token-counter.js +27 -0
  20. package/dist/common/util/token-counter.js.map +1 -0
  21. package/dist/common/websockets/websocket-schema.d.ts +8 -8
  22. package/dist/index.js +1 -1
  23. package/package.json +1 -1
  24. package/dist/common/actions.d.ts.map +0 -1
  25. package/dist/common/api-keys/constants.d.ts.map +0 -1
  26. package/dist/common/api-keys/crypto.d.ts.map +0 -1
  27. package/dist/common/billing/quota-manager.d.ts.map +0 -1
  28. package/dist/common/browser-actions.d.ts.map +0 -1
  29. package/dist/common/constants/tools.d.ts.map +0 -1
  30. package/dist/common/constants.d.ts.map +0 -1
  31. package/dist/common/db/drizzle.config.d.ts.map +0 -1
  32. package/dist/common/db/env.d.mts.map +0 -1
  33. package/dist/common/db/index.d.ts.map +0 -1
  34. package/dist/common/db/schema.d.ts.map +0 -1
  35. package/dist/common/env.d.mts.map +0 -1
  36. package/dist/common/project-file-tree.d.ts.map +0 -1
  37. package/dist/common/types/agent-state.d.ts.map +0 -1
  38. package/dist/common/types/message.d.ts.map +0 -1
  39. package/dist/common/types/plan.d.ts.map +0 -1
  40. package/dist/common/types/referral.d.ts.map +0 -1
  41. package/dist/common/types/tools.d.ts.map +0 -1
  42. package/dist/common/types/usage.d.ts.map +0 -1
  43. package/dist/common/util/__tests__/messages.test.d.ts.map +0 -1
  44. package/dist/common/util/__tests__/string.test.d.ts.map +0 -1
  45. package/dist/common/util/array.d.ts.map +0 -1
  46. package/dist/common/util/changes.d.ts.map +0 -1
  47. package/dist/common/util/credentials.d.ts.map +0 -1
  48. package/dist/common/util/crypto.d.ts +0 -27
  49. package/dist/common/util/crypto.js +0 -174
  50. package/dist/common/util/crypto.js.map +0 -1
  51. package/dist/common/util/dates.d.ts.map +0 -1
  52. package/dist/common/util/file.d.ts.map +0 -1
  53. package/dist/common/util/git.d.ts.map +0 -1
  54. package/dist/common/util/logger.d.ts.map +0 -1
  55. package/dist/common/util/lru-cache.d.ts.map +0 -1
  56. package/dist/common/util/messages.d.ts.map +0 -1
  57. package/dist/common/util/min-heap.d.ts.map +0 -1
  58. package/dist/common/util/object.d.ts.map +0 -1
  59. package/dist/common/util/patch.d.ts.map +0 -1
  60. package/dist/common/util/promise.d.ts.map +0 -1
  61. package/dist/common/util/referral.d.ts.map +0 -1
  62. package/dist/common/util/saxy.d.ts.map +0 -1
  63. package/dist/common/util/server/referral.d.ts.map +0 -1
  64. package/dist/common/util/string.d.ts.map +0 -1
  65. package/dist/common/util/stripe.d.ts.map +0 -1
  66. package/dist/common/websockets/websocket-client.d.ts.map +0 -1
  67. package/dist/common/websockets/websocket-schema.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ export declare function withLoggerContext(context: any, logger: any, callback: () => Promise<any>): Promise<any>;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.withLoggerContext = withLoggerContext;
4
+ function withLoggerContext(context, logger, callback) {
5
+ return callback();
6
+ }
7
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":";;AAAA,8CAEC;AAFD,SAAgB,iBAAiB,CAAC,OAAY,EAAE,MAAW,EAAE,QAA4B;IACvF,OAAO,QAAQ,EAAE,CAAA;AACnB,CAAC"}
@@ -203,15 +203,15 @@ export declare const AgentStateSchema: z.ZodObject<{
203
203
  type: "ephemeral";
204
204
  }>>;
205
205
  }, "strip", z.ZodTypeAny, {
206
- content: string;
207
206
  type: "tool_result";
207
+ content: string;
208
208
  tool_use_id: string;
209
209
  cache_control?: {
210
210
  type: "ephemeral";
211
211
  } | undefined;
212
212
  }, {
213
- content: string;
214
213
  type: "tool_result";
214
+ content: string;
215
215
  tool_use_id: string;
216
216
  cache_control?: {
217
217
  type: "ephemeral";
@@ -275,8 +275,8 @@ export declare const AgentStateSchema: z.ZodObject<{
275
275
  type: "ephemeral";
276
276
  } | undefined;
277
277
  } | {
278
- content: string;
279
278
  type: "tool_result";
279
+ content: string;
280
280
  tool_use_id: string;
281
281
  cache_control?: {
282
282
  type: "ephemeral";
@@ -309,8 +309,8 @@ export declare const AgentStateSchema: z.ZodObject<{
309
309
  type: "ephemeral";
310
310
  } | undefined;
311
311
  } | {
312
- content: string;
313
312
  type: "tool_result";
313
+ content: string;
314
314
  tool_use_id: string;
315
315
  cache_control?: {
316
316
  type: "ephemeral";
@@ -374,8 +374,8 @@ export declare const AgentStateSchema: z.ZodObject<{
374
374
  type: "ephemeral";
375
375
  } | undefined;
376
376
  } | {
377
- content: string;
378
377
  type: "tool_result";
378
+ content: string;
379
379
  tool_use_id: string;
380
380
  cache_control?: {
381
381
  type: "ephemeral";
@@ -439,8 +439,8 @@ export declare const AgentStateSchema: z.ZodObject<{
439
439
  type: "ephemeral";
440
440
  } | undefined;
441
441
  } | {
442
- content: string;
443
442
  type: "tool_result";
443
+ content: string;
444
444
  tool_use_id: string;
445
445
  cache_control?: {
446
446
  type: "ephemeral";
@@ -61,15 +61,15 @@ declare const MessageContentObjectSchema: z.ZodUnion<[z.ZodObject<{
61
61
  type: "ephemeral";
62
62
  }>>;
63
63
  }, "strip", z.ZodTypeAny, {
64
- content: string;
65
64
  type: "tool_result";
65
+ content: string;
66
66
  tool_use_id: string;
67
67
  cache_control?: {
68
68
  type: "ephemeral";
69
69
  } | undefined;
70
70
  }, {
71
- content: string;
72
71
  type: "tool_result";
72
+ content: string;
73
73
  tool_use_id: string;
74
74
  cache_control?: {
75
75
  type: "ephemeral";
@@ -181,15 +181,15 @@ export declare const MessageSchema: z.ZodObject<{
181
181
  type: "ephemeral";
182
182
  }>>;
183
183
  }, "strip", z.ZodTypeAny, {
184
- content: string;
185
184
  type: "tool_result";
185
+ content: string;
186
186
  tool_use_id: string;
187
187
  cache_control?: {
188
188
  type: "ephemeral";
189
189
  } | undefined;
190
190
  }, {
191
- content: string;
192
191
  type: "tool_result";
192
+ content: string;
193
193
  tool_use_id: string;
194
194
  cache_control?: {
195
195
  type: "ephemeral";
@@ -253,8 +253,8 @@ export declare const MessageSchema: z.ZodObject<{
253
253
  type: "ephemeral";
254
254
  } | undefined;
255
255
  } | {
256
- content: string;
257
256
  type: "tool_result";
257
+ content: string;
258
258
  tool_use_id: string;
259
259
  cache_control?: {
260
260
  type: "ephemeral";
@@ -287,8 +287,8 @@ export declare const MessageSchema: z.ZodObject<{
287
287
  type: "ephemeral";
288
288
  } | undefined;
289
289
  } | {
290
- content: string;
291
290
  type: "tool_result";
291
+ content: string;
292
292
  tool_use_id: string;
293
293
  cache_control?: {
294
294
  type: "ephemeral";
@@ -0,0 +1 @@
1
+ export declare function getModelForMode(mode: string): string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getModelForMode = getModelForMode;
4
+ function getModelForMode(mode) {
5
+ return 'claude-3-sonnet';
6
+ }
7
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/util/constants.ts"],"names":[],"mappings":";;AAAA,0CAEC;AAFD,SAAgB,eAAe,CAAC,IAAY;IAC1C,OAAO,iBAAiB,CAAA;AAC1B,CAAC"}
@@ -7,18 +7,18 @@ export declare const userSchema: z.ZodObject<{
7
7
  fingerprintId: z.ZodString;
8
8
  fingerprintHash: z.ZodString;
9
9
  }, "strip", z.ZodTypeAny, {
10
- email: string;
11
10
  name: string | null;
12
11
  id: string;
13
12
  fingerprintId: string;
14
13
  authToken: string;
14
+ email: string;
15
15
  fingerprintHash: string;
16
16
  }, {
17
- email: string;
18
17
  name: string | null;
19
18
  id: string;
20
19
  fingerprintId: string;
21
20
  authToken: string;
21
+ email: string;
22
22
  fingerprintHash: string;
23
23
  }>;
24
24
  export type User = z.infer<typeof userSchema>;
@@ -0,0 +1 @@
1
+ export declare const sleep: (ms: number) => Promise<unknown>;
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.sleep = void 0;
4
+ const sleep = (ms) => new Promise((r) => setTimeout(r, ms));
5
+ exports.sleep = sleep;
6
+ //# sourceMappingURL=helpers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.js","sourceRoot":"","sources":["../../src/util/helpers.ts"],"names":[],"mappings":";;;AAAO,MAAM,KAAK,GAAG,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;AAA7D,QAAA,KAAK,SAAwD"}
@@ -0,0 +1,3 @@
1
+ export declare function countTokens(text: string): number;
2
+ export declare function countTokensJson(text: string | object): number;
3
+ export declare function countTokensForFiles(files: Record<string, string | null>): Record<string, number>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.countTokens = countTokens;
4
+ exports.countTokensJson = countTokensJson;
5
+ exports.countTokensForFiles = countTokensForFiles;
6
+ const gpt_4o_1 = require("gpt-tokenizer/esm/model/gpt-4o");
7
+ const ANTHROPIC_TOKEN_FUDGE_FACTOR = 1.35;
8
+ function countTokens(text) {
9
+ try {
10
+ return Math.floor((0, gpt_4o_1.encode)(text).length * ANTHROPIC_TOKEN_FUDGE_FACTOR);
11
+ }
12
+ catch (e) {
13
+ console.error('Error counting tokens', e);
14
+ return Math.ceil(text.length / 3);
15
+ }
16
+ }
17
+ function countTokensJson(text) {
18
+ return countTokens(JSON.stringify(text));
19
+ }
20
+ function countTokensForFiles(files) {
21
+ const tokenCounts = {};
22
+ for (const [filePath, content] of Object.entries(files)) {
23
+ tokenCounts[filePath] = content ? countTokens(content) : 0;
24
+ }
25
+ return tokenCounts;
26
+ }
27
+ //# sourceMappingURL=token-counter.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"token-counter.js","sourceRoot":"","sources":["../../src/util/token-counter.ts"],"names":[],"mappings":";;AAIA,kCAOC;AAED,0CAEC;AAED,kDAQC;AAzBD,2DAAuD;AAEvD,MAAM,4BAA4B,GAAG,IAAI,CAAA;AAEzC,SAAgB,WAAW,CAAC,IAAY;IACtC,IAAI,CAAC;QACH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAA,eAAM,EAAC,IAAI,CAAC,CAAC,MAAM,GAAG,4BAA4B,CAAC,CAAA;IACvE,CAAC;IAAC,OAAO,CAAC,EAAE,CAAC;QACX,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAA;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAA;IACnC,CAAC;AACH,CAAC;AAED,SAAgB,eAAe,CAAC,IAAqB;IACnD,OAAO,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAA;AAC1C,CAAC;AAED,SAAgB,mBAAmB,CACjC,KAAoC;IAEpC,MAAM,WAAW,GAA2B,EAAE,CAAA;IAC9C,KAAK,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACxD,WAAW,CAAC,QAAQ,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC5D,CAAC;IACD,OAAO,WAAW,CAAA;AACpB,CAAC"}
@@ -6,12 +6,12 @@ export declare const CLIENT_MESSAGE_SCHEMAS: {
6
6
  clientSessionId: z.ZodString;
7
7
  }, "strip", z.ZodTypeAny, {
8
8
  type: "identify";
9
- txid: number;
10
9
  clientSessionId: string;
10
+ txid: number;
11
11
  }, {
12
12
  type: "identify";
13
- txid: number;
14
13
  clientSessionId: string;
14
+ txid: number;
15
15
  }>;
16
16
  readonly subscribe: z.ZodObject<{
17
17
  type: z.ZodLiteral<"subscribe">;
@@ -1115,12 +1115,12 @@ export declare const CLIENT_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
1115
1115
  clientSessionId: z.ZodString;
1116
1116
  }, "strip", z.ZodTypeAny, {
1117
1117
  type: "identify";
1118
- txid: number;
1119
1118
  clientSessionId: string;
1119
+ txid: number;
1120
1120
  }, {
1121
1121
  type: "identify";
1122
- txid: number;
1123
1122
  clientSessionId: string;
1123
+ txid: number;
1124
1124
  }>, z.ZodObject<{
1125
1125
  type: z.ZodLiteral<"subscribe">;
1126
1126
  txid: z.ZodNumber;
@@ -2224,13 +2224,13 @@ export declare const SERVER_MESSAGE_SCHEMAS: {
2224
2224
  }, "strip", z.ZodTypeAny, {
2225
2225
  type: "ack";
2226
2226
  success: boolean;
2227
- txid?: number | undefined;
2228
2227
  error?: string | undefined;
2228
+ txid?: number | undefined;
2229
2229
  }, {
2230
2230
  type: "ack";
2231
2231
  success: boolean;
2232
- txid?: number | undefined;
2233
2232
  error?: string | undefined;
2233
+ txid?: number | undefined;
2234
2234
  }>;
2235
2235
  action: z.ZodObject<{
2236
2236
  type: z.ZodLiteral<"action">;
@@ -3523,13 +3523,13 @@ export declare const SERVER_MESSAGE_SCHEMA: z.ZodUnion<[z.ZodObject<{
3523
3523
  }, "strip", z.ZodTypeAny, {
3524
3524
  type: "ack";
3525
3525
  success: boolean;
3526
- txid?: number | undefined;
3527
3526
  error?: string | undefined;
3527
+ txid?: number | undefined;
3528
3528
  }, {
3529
3529
  type: "ack";
3530
3530
  success: boolean;
3531
- txid?: number | undefined;
3532
3531
  error?: string | undefined;
3532
+ txid?: number | undefined;
3533
3533
  }>, z.ZodObject<{
3534
3534
  type: z.ZodLiteral<"action">;
3535
3535
  data: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  process.env.ENVIRONMENT = 'production';
3
3
  process.env.NEXT_PUBLIC_BACKEND_URL = 'manicode-backend.onrender.com';
4
- process.env.NEXT_PUBLIC_APP_URL = 'https://www.codebuff.com';
4
+ process.env.NEXT_PUBLIC_APP_URL = 'https://codebuff.com';
5
5
  process.env.NEXT_PUBLIC_SUPPORT_EMAIL = 'support@codebuff.com';
6
6
  "use strict";
7
7
  var __importDefault = (this && this.__importDefault) || function (mod) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codebuff",
3
- "version": "1.0.207",
3
+ "version": "1.0.208",
4
4
  "description": "AI dev assistant",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -1 +0,0 @@
1
- {"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../src/actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAUvB,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AACzD,eAAO,MAAM,OAAO;;;;;;;;;;;;WAA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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4C/B,CAAA;AACF,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/api-keys/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,gBAAgB,CAAA;AACtC,eAAO,MAAM,SAAS,KAAK,CAAA;AAC3B,eAAO,MAAM,eAAe,KAAK,CAAA;AAGjC,eAAO,MAAM,YAAY;;;;CAIxB,CAAA;AACD,eAAO,MAAM,WAAW;;;;CAIvB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"crypto.d.ts","sourceRoot":"","sources":["../../src/api-keys/crypto.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AAKtC,MAAM,MAAM,UAAU,GAAG,CAAC,OAAO,MAAM,CAAC,cAAc,CAAC,UAAU,CAAC,CAAC,MAAM,CAAC,CAAA;AAgF1E;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CA0Bf;AAED;;;;;;GAMG;AACH,wBAAsB,wBAAwB,CAC5C,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,GAClB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAqDxB;AAED;;;;GAIG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,UAAU,GACl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,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAA;AAE/D;;GAEG;AACH,wBAAgB,4BAA4B,CAC1C,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GACjC,aAAa,CAYf"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/constants/tools.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,UAAU;;;;;;;;;;CAmBtB,CAAA;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,OAAO,UAAU,CAAA;AAG9C,eAAO,MAAM,SAAS,EAA8B,QAAQ,EAAE,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW,QAAe,CAAA;AACvC,eAAO,MAAM,iBAAiB,QAA6B,CAAA;AAC3D,eAAO,MAAM,oBAAoB,uCAAuC,CAAA;AAExE,eAAO,MAAM,qBAAqB,UAsBjC,CAAA;AAED,eAAO,MAAM,gBAAgB;;;;;;CAMnB,CAAA;AAEV,eAAO,MAAM,uBAAuB,sJAMnC,CAAA;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,iBAKjD;AAED,eAAO,MAAM,6BAA6B,IAAI,CAAA;AAC9C,eAAO,MAAM,QAAQ,MAA2B,CAAA;AAChD,eAAO,MAAM,mBAAmB,KAAK,CAAA;AACrC,eAAO,MAAM,gBAAgB,OAAO,CAAA;AACpC,eAAO,MAAM,qBAAqB,MAAM,CAAA;AACxC,eAAO,MAAM,sBAAsB,MAAM,CAAA;AAEzC,eAAO,MAAM,kBAAkB,UAAW,WAAW,KAAG,MAEvD,CAAA;AAED,eAAO,MAAM,yBAAyB,aAAc,MAAM,KAAG,WAQ5D,CAAA;AAED,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,WAAW,CAAA;I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AM,OAAO,MAAM,CAAC,CAAA;AAExD,eAAO,MAAM,YAAY,iBAAiB,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"drizzle.config.d.ts","sourceRoot":"","sources":["../../src/db/drizzle.config.ts"],"names":[],"mappings":";AAIA,wBAOE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"env.d.mts","sourceRoot":"","sources":["../../src/db/env.mjs"],"names":[],"mappings":"AAeA,sBAME"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/db/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAA;AAEzB,OAAO,KAAK,MAAM,MAAM,UAAU,CAAA;AAMlC,QAAA,MAAM,EAAE;;CAA4B,CAAA;AACpC,eAAe,EAAE,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/db/schema.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,cAAc,qIAGzB,CAAA;AAGF,eAAO,MAAM,cAAc,yEAIzB,CAAA;AAEF,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuBf,CAAA;AAEF,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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BAeE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"project-file-tree.d.ts","sourceRoot":"","sources":["../src/project-file-tree.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,MAAM,QAAQ,CAAA;AAChC,OAAO,EAAiB,YAAY,EAAE,MAAM,aAAa,CAAA;AAIzD,eAAO,MAAM,iBAAiB,QAAS,CAAA;AAEvC,wBAAgB,kBAAkB,CAChC,WAAW,EAAE,MAAM,EACnB,EAAE,QAA4B,EAAE,GAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAO,GAC3D,YAAY,EAAE,CAiFhB;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,CA+B7D;AAED,wBAAgB,eAAe,CAC7B,KAAK,EAAE,YAAY,EAAE,EACrB,QAAQ,GAAE,MAAW,GACpB,MAAM,EAAE,CAOV;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,GAAG,YAAY,EAAE,CAOjE;AAED,wBAAgB,oBAAoB,CAClC,cAAc,EAAE,YAAY,EAAE,EAC9B,KAAK,EAAE,MAAM,YASd"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-state.d.ts","sourceRoot":"","sources":["../../src/types/agent-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EAAE,kBAAkB,EAA4B,MAAM,cAAc,CAAA;AAG3E,eAAO,MAAM,cAAc;;;;;;;;;;;;EAIzB,CAAA;AACF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AACrD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;EAI3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;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MAAM,MAAM,OAAO,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAA;AACnD,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,0BAA0B,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"plan.d.ts","sourceRoot":"","sources":["../../src/types/plan.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,EAAE,MAAM,CAAA;IACnB,MAAM,CAAC,EAAE;QACP,KAAK,EAAE,MAAM,CAAA;QACb,GAAG,EAAE,MAAM,CAAA;KACZ,CAAA;IACD,SAAS,EAAE,OAAO,CAAA;CACnB;AAED,MAAM,WAAW,2BAA2B;IAE1C,kBAAkB,EAAE,MAAM,CAAA;IAC1B,cAAc,EAAE,MAAM,CAAA;IACtB,4BAA4B,EAAE,MAAM,CAAA;IACpC,aAAa,EAAE,MAAM,CAAA;IAGrB,SAAS,EAAE,eAAe,EAAE,CAAA;IAG5B,cAAc,EAAE,MAAM,CAAA;IACtB,iBAAiB,EAAE,MAAM,CAAA;IACzB,oBAAoB,EAAE,MAAM,CAAA;IAC5B,gBAAgB,EAAE,MAAM,CAAA;IACxB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAA;IACjC,cAAc,EAAE,MAAM,CAAA;IACtB,YAAY,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;CACpB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"referral.d.ts","sourceRoot":"","sources":["../../src/types/referral.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,cAAc,GAAG,SAAS,GAAG,WAAW,CAAA;AAEpD,eAAO,MAAM,oBAAoB,EAAE,cAAc,EAA6B,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../src/types/tools.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,MAAM,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;CAChC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"usage.d.ts","sourceRoot":"","sources":["../../src/types/usage.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;EAO1B,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAA"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.test.d.ts","sourceRoot":"","sources":["../../../src/util/__tests__/messages.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["../../../src/util/__tests__/string.test.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"array.d.ts","sourceRoot":"","sources":["../../src/util/array.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GACQ,CAAC,EAAE,CAC1E;AAED,KAAK,MAAM,GAAG,KAAK,GAAG,SAAS,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,CAAA;AAC/C,KAAK,gBAAgB,CAAC,CAAC,IAAI,CAAC,GAAG,MAAM,GAAG,gBAAgB,CAAC,CAAC,CAAC,EAAE,CAAA;AAE7D,wBAAgB,UAAU,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC,EAAE,GACrB,CAAC,EAAE,CAC3C;AAED,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,SAiB/D"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"changes.d.ts","sourceRoot":"","sources":["../../src/util/changes.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AAGxC,wBAAgB,YAAY,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW;;;EAiCrE;AAED,wBAAsB,qBAAqB,CACzC,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,iBA2B7B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../../src/util/credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAGvB,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;EAOrB,CAAA;AAEF,MAAM,MAAM,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,CAAA;AAE7C,eAAO,MAAM,WAAW,kBACP,MAAM,aACV,MAAM,UACT,MAAM,WAOE,CAAA"}
@@ -1,27 +0,0 @@
1
- import * as schema from '../db/schema';
2
- export type ApiKeyType = (typeof schema.apiKeyTypeEnum.enumValues)[number];
3
- /**
4
- * Encrypts an API key using the provided secret and stores it in the database
5
- * for a specific user and key type. Overwrites any existing key of the same type
6
- * for that user.
7
- * @param userId The ID of the user.
8
- * @param keyType The type of the API key (e.g., 'gemini').
9
- * @param apiKey The plaintext API key to encrypt.
10
- * @param secretKey The 32-byte encryption secret key.
11
- */
12
- export declare function encryptAndStoreApiKey(userId: string, keyType: ApiKeyType, apiKey: string, secretKey: string): Promise<void>;
13
- /**
14
- * Retrieves and decrypts the stored API key for a specific user and key type
15
- * using the provided secret. Validates the format for Gemini keys.
16
- * @param userId The ID of the user.
17
- * @param keyType The type of the API key (e.g., 'gemini').
18
- * @param secretKey The 32-byte encryption secret key.
19
- * @returns The decrypted API key, or null if not found, decryption fails, or validation fails.
20
- */
21
- export declare function retrieveAndDecryptApiKey(userId: string, keyType: ApiKeyType, secretKey: string): Promise<string | null>;
22
- /**
23
- * Deletes a specific API key entry for a given user and key type.
24
- * @param userId The ID of the user.
25
- * @param keyType The type of the API key to delete (e.g., 'gemini').
26
- */
27
- export declare function clearApiKey(userId: string, keyType: ApiKeyType): Promise<void>;
@@ -1,174 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.encryptAndStoreApiKey = encryptAndStoreApiKey;
30
- exports.retrieveAndDecryptApiKey = retrieveAndDecryptApiKey;
31
- exports.clearApiKey = clearApiKey;
32
- const node_crypto_1 = __importDefault(require("node:crypto"));
33
- const db_1 = __importDefault(require("../db"));
34
- const schema = __importStar(require("../db/schema"));
35
- const drizzle_orm_1 = require("drizzle-orm");
36
- const ALGORITHM = 'aes-256-gcm';
37
- const IV_LENGTH = 12;
38
- const AUTH_TAG_LENGTH = 16;
39
- // --- Constants for Gemini Key Validation ---
40
- const GEMINI_API_KEY_PREFIX = 'AIzaSy';
41
- const GEMINI_API_KEY_LENGTH = 39;
42
- /**
43
- * Encrypts an API key using the provided secret.
44
- * @param apiKey The plaintext API key to encrypt.
45
- * @param secretKey The 32-byte encryption secret key.
46
- * @returns The encrypted string including iv and authTag, or throws error.
47
- */
48
- function encryptApiKeyInternal(apiKey, secretKey) {
49
- if (Buffer.from(secretKey, 'utf8').length !== 32) {
50
- throw new Error('Invalid secret key length. Must be 32 bytes.');
51
- }
52
- const iv = node_crypto_1.default.randomBytes(IV_LENGTH);
53
- const cipher = node_crypto_1.default.createCipheriv(ALGORITHM, Buffer.from(secretKey, 'utf8'), iv, {
54
- authTagLength: AUTH_TAG_LENGTH,
55
- });
56
- let encrypted = cipher.update(apiKey, 'utf8', 'hex');
57
- encrypted += cipher.final('hex');
58
- const authTag = cipher.getAuthTag();
59
- // Return IV, encrypted data, and auth tag together
60
- return `${iv.toString('hex')}:${encrypted}:${authTag.toString('hex')}`;
61
- }
62
- /**
63
- * Decrypts an API key string using the provided secret.
64
- * @param storedValue The encrypted string in format "iv:encrypted:authTag".
65
- * @param secretKey The 32-byte encryption secret key.
66
- * @returns The decrypted API key string, or null if decryption fails.
67
- */
68
- function decryptApiKeyInternal(storedValue, secretKey) {
69
- try {
70
- if (Buffer.from(secretKey, 'utf8').length !== 32) {
71
- throw new Error('Invalid secret key length. Must be 32 bytes.');
72
- }
73
- const parts = storedValue.split(':');
74
- if (parts.length !== 3) {
75
- return null; // Invalid format
76
- }
77
- const [ivHex, encryptedHex, authTagHex] = parts;
78
- const iv = Buffer.from(ivHex, 'hex');
79
- const encrypted = Buffer.from(encryptedHex, 'hex');
80
- const authTag = Buffer.from(authTagHex, 'hex');
81
- if (iv.length !== IV_LENGTH) {
82
- return null;
83
- }
84
- const decipher = node_crypto_1.default.createDecipheriv(ALGORITHM, Buffer.from(secretKey, 'utf8'), iv, {
85
- authTagLength: AUTH_TAG_LENGTH,
86
- });
87
- decipher.setAuthTag(authTag);
88
- let decryptedBuffer = decipher.update(encrypted);
89
- decryptedBuffer = Buffer.concat([decryptedBuffer, decipher.final()]);
90
- return decryptedBuffer.toString('utf8');
91
- }
92
- catch (error) {
93
- return null; // Decryption failed
94
- }
95
- }
96
- /**
97
- * Encrypts an API key using the provided secret and stores it in the database
98
- * for a specific user and key type. Overwrites any existing key of the same type
99
- * for that user.
100
- * @param userId The ID of the user.
101
- * @param keyType The type of the API key (e.g., 'gemini').
102
- * @param apiKey The plaintext API key to encrypt.
103
- * @param secretKey The 32-byte encryption secret key.
104
- */
105
- async function encryptAndStoreApiKey(userId, keyType, apiKey, secretKey) {
106
- try {
107
- const encryptedValue = encryptApiKeyInternal(apiKey, secretKey);
108
- // Use upsert logic based on the composite primary key (user_id, type)
109
- await db_1.default
110
- .insert(schema.encryptedApiKeys)
111
- .values({ user_id: userId, type: keyType, api_key: encryptedValue })
112
- .onConflictDoUpdate({
113
- target: [schema.encryptedApiKeys.user_id, schema.encryptedApiKeys.type],
114
- set: { api_key: encryptedValue },
115
- });
116
- }
117
- catch (error) {
118
- throw new Error(`API key encryption and storage failed: ${error instanceof Error ? error.message : String(error)}`);
119
- }
120
- }
121
- /**
122
- * Retrieves and decrypts the stored API key for a specific user and key type
123
- * using the provided secret. Validates the format for Gemini keys.
124
- * @param userId The ID of the user.
125
- * @param keyType The type of the API key (e.g., 'gemini').
126
- * @param secretKey The 32-byte encryption secret key.
127
- * @returns The decrypted API key, or null if not found, decryption fails, or validation fails.
128
- */
129
- async function retrieveAndDecryptApiKey(userId, keyType, secretKey) {
130
- try {
131
- const result = await db_1.default.query.encryptedApiKeys.findFirst({
132
- where: (0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(schema.encryptedApiKeys.user_id, userId), (0, drizzle_orm_1.eq)(schema.encryptedApiKeys.type, keyType)),
133
- columns: {
134
- api_key: true, // Select only the encrypted key column
135
- },
136
- });
137
- const storedValue = result?.api_key;
138
- if (!storedValue) {
139
- return null; // No key stored for this user/type
140
- }
141
- const decryptedKey = decryptApiKeyInternal(storedValue, secretKey);
142
- if (decryptedKey === null) {
143
- return null; // Decryption failed
144
- }
145
- // --- Add validation specific to Gemini API keys ---
146
- if (keyType === 'gemini') {
147
- if (!decryptedKey.startsWith(GEMINI_API_KEY_PREFIX) ||
148
- decryptedKey.length !== GEMINI_API_KEY_LENGTH) {
149
- return null; // Validation failed
150
- }
151
- }
152
- // --- End validation ---
153
- return decryptedKey;
154
- }
155
- catch (error) {
156
- return null; // Error during DB query or other unexpected issue
157
- }
158
- }
159
- /**
160
- * Deletes a specific API key entry for a given user and key type.
161
- * @param userId The ID of the user.
162
- * @param keyType The type of the API key to delete (e.g., 'gemini').
163
- */
164
- async function clearApiKey(userId, keyType) {
165
- try {
166
- await db_1.default
167
- .delete(schema.encryptedApiKeys)
168
- .where((0, drizzle_orm_1.and)((0, drizzle_orm_1.eq)(schema.encryptedApiKeys.user_id, userId), (0, drizzle_orm_1.eq)(schema.encryptedApiKeys.type, keyType)));
169
- }
170
- catch (error) {
171
- throw new Error(`Failed to clear API key: ${error instanceof Error ? error.message : String(error)}`);
172
- }
173
- }
174
- //# sourceMappingURL=crypto.js.map