codebuff 1.0.215 → 1.0.217
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/background-process-manager.d.ts +4 -2
- package/dist/background-process-manager.js +12 -4
- package/dist/background-process-manager.js.map +1 -1
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +2 -2
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +3 -2
- package/dist/client.js +11 -10
- package/dist/client.js.map +1 -1
- package/dist/common/actions.d.ts +18 -15
- package/dist/common/actions.d.ts.map +1 -0
- package/dist/common/actions.js +1 -0
- package/dist/common/actions.js.map +1 -1
- package/dist/common/api-keys/constants.d.ts.map +1 -0
- package/dist/common/api-keys/crypto.d.ts.map +1 -0
- package/dist/common/billing/quota-manager.d.ts.map +1 -0
- package/dist/common/browser-actions.d.ts.map +1 -0
- package/dist/common/constants/tools.d.ts.map +1 -0
- package/dist/common/constants.d.ts +23 -1
- package/dist/common/constants.d.ts.map +1 -0
- package/dist/common/constants.js +22 -2
- package/dist/common/constants.js.map +1 -1
- package/dist/common/db/drizzle.config.d.ts.map +1 -0
- package/dist/common/db/env.d.mts.map +1 -0
- package/dist/common/db/index.d.ts.map +1 -0
- package/dist/common/db/schema.d.ts.map +1 -0
- package/dist/common/env.d.mts.map +1 -0
- package/dist/common/project-file-tree.d.ts.map +1 -0
- package/dist/common/types/agent-state.d.ts +11 -11
- package/dist/common/types/agent-state.d.ts.map +1 -0
- package/dist/common/types/agent-state.js +2 -2
- package/dist/common/types/agent-state.js.map +1 -1
- package/dist/common/types/message.d.ts +6 -6
- package/dist/common/types/message.d.ts.map +1 -0
- package/dist/common/types/plan.d.ts.map +1 -0
- package/dist/common/types/referral.d.ts.map +1 -0
- package/dist/common/types/tools.d.ts.map +1 -0
- package/dist/common/types/usage.d.ts.map +1 -0
- package/dist/common/util/__tests__/messages.test.d.ts.map +1 -0
- package/dist/common/util/__tests__/string.test.d.ts.map +1 -0
- package/dist/common/util/array.d.ts.map +1 -0
- package/dist/common/util/changes.d.ts.map +1 -0
- package/dist/common/util/credentials.d.ts +2 -2
- package/dist/common/util/credentials.d.ts.map +1 -0
- package/dist/common/util/crypto.d.ts +27 -0
- package/dist/common/util/crypto.js +174 -0
- package/dist/common/util/crypto.js.map +1 -0
- package/dist/common/util/dates.d.ts.map +1 -0
- package/dist/common/util/file.d.ts.map +1 -0
- package/dist/common/util/git.d.ts.map +1 -0
- package/dist/common/util/logger.d.ts.map +1 -0
- package/dist/common/util/lru-cache.d.ts.map +1 -0
- package/dist/common/util/messages.d.ts.map +1 -0
- package/dist/common/util/min-heap.d.ts.map +1 -0
- package/dist/common/util/object.d.ts.map +1 -0
- package/dist/common/util/patch.d.ts.map +1 -0
- package/dist/common/util/promise.d.ts.map +1 -0
- package/dist/common/util/referral.d.ts.map +1 -0
- package/dist/common/util/saxy.d.ts.map +1 -0
- package/dist/common/util/server/referral.d.ts.map +1 -0
- package/dist/common/util/string.d.ts.map +1 -0
- package/dist/common/util/stripe.d.ts.map +1 -0
- package/dist/common/websockets/websocket-client.d.ts.map +1 -0
- package/dist/common/websockets/websocket-schema.d.ts +38 -28
- package/dist/common/websockets/websocket-schema.d.ts.map +1 -0
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/tool-handlers.js +1 -1
- package/dist/tool-handlers.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/dist/utils/__tests__/background-process-manager.test.js +26 -13
- package/dist/utils/__tests__/background-process-manager.test.js.map +1 -1
- package/dist/utils/terminal.d.ts +1 -1
- package/dist/utils/terminal.js +5 -4
- package/dist/utils/terminal.js.map +1 -1
- package/package.json +1 -1
- package/dist/common/logger.d.ts +0 -1
- package/dist/common/logger.js +0 -7
- package/dist/common/logger.js.map +0 -1
- package/dist/common/util/constants.d.ts +0 -1
- package/dist/common/util/constants.js +0 -7
- package/dist/common/util/constants.js.map +0 -1
- package/dist/common/util/helpers.d.ts +0 -1
- package/dist/common/util/helpers.js +0 -6
- package/dist/common/util/helpers.js.map +0 -1
- package/dist/common/util/token-counter.d.ts +0 -3
- package/dist/common/util/token-counter.js +0 -27
- package/dist/common/util/token-counter.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"quota-manager.d.ts","sourceRoot":"","sources":["../../src/billing/quota-manager.ts"],"names":[],"mappings":"AAOA,KAAK,gBAAgB,GAAG,OAAO,CAAC;IAC9B,WAAW,EAAE,MAAM,CAAA;IACnB,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,IAAI,CAAA;IACb,mBAAmB,EAAE,OAAO,CAAA;IAC5B,oBAAoB,CAAC,EAAE,MAAM,CAAA;CAC9B,CAAC,CAAA;AAEF,MAAM,WAAW,aAAa;IAC5B,UAAU,CACR,EAAE,EAAE,MAAM,EACV,SAAS,CAAC,EAAE,MAAM,GACjB,gBAAgB,CAAA;IACnB,YAAY,CACV,EAAE,EAAE,MAAM,EACV,cAAc,EAAE,OAAO,EACvB,gBAAgB,EAAE,IAAI,GACrB,OAAO,CAAC,IAAI,CAAC,CAAA;CACjB;AAED,qBAAa,qBAAsB,YAAW,aAAa;IACnD,UAAU,CACd,aAAa,EAAE,MAAM,EACrB,SAAS,CAAC,EAAE,MAAM,GACjB,gBAAgB;IA6Db,YAAY,CAChB,aAAa,EAAE,MAAM,EACrB,cAAc,EAAE,OAAO,EACvB,gBAAgB,EAAE,IAAI,GACrB,OAAO,CAAC,IAAI,CAAC;CASjB;AAED,qBAAa,yBAA0B,YAAW,aAAa;IACvD,0BAA0B,CAC9B,MAAM,EAAE,MAAM,GACb,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC;IAiDnD,UAAU,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,gBAAgB;IA+EhE,YAAY,CAChB,MAAM,EAAE,MAAM,EACd,cAAc,EAAE,OA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ED,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AACnE,MAAM,MAAM,aAAa,GAAG,CAAC,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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -20,7 +20,7 @@ export declare const MAX_DATE: Date;
|
|
|
20
20
|
export declare const BILLING_PERIOD_DAYS = 30;
|
|
21
21
|
export declare const OVERAGE_RATE_PRO = 0.99;
|
|
22
22
|
export declare const OVERAGE_RATE_MOAR_PRO = 0.9;
|
|
23
|
-
export declare const CREDITS_REFERRAL_BONUS =
|
|
23
|
+
export declare const CREDITS_REFERRAL_BONUS = 500;
|
|
24
24
|
export declare const AFFILIATE_USER_REFFERAL_LIMIT = 500;
|
|
25
25
|
export declare const getPlanDisplayName: (limit: UsageLimits) => string;
|
|
26
26
|
export declare const getUsageLimitFromPlanName: (planName: string) => UsageLimits;
|
|
@@ -45,10 +45,12 @@ export type CostMode = (typeof costModes)[number];
|
|
|
45
45
|
export declare const getModelForMode: (costMode: CostMode, operation: "agent" | "file-requests" | "check-new-files") => "claude-3-5-sonnet-20241022" | "claude-3-5-haiku-20241022" | "gpt-4o-2024-11-20" | "gpt-4o-mini-2024-07-18" | "gemini-2.5-pro-exp-03-25";
|
|
46
46
|
export declare const claudeModels: {
|
|
47
47
|
readonly sonnet: "claude-3-5-sonnet-20241022";
|
|
48
|
+
readonly sonnet3_7: "claude-3-7-sonnet-20250219";
|
|
48
49
|
readonly haiku: "claude-3-5-haiku-20241022";
|
|
49
50
|
};
|
|
50
51
|
export type AnthropicModel = (typeof claudeModels)[keyof typeof claudeModels];
|
|
51
52
|
export declare const openaiModels: {
|
|
53
|
+
readonly gpt4_1: "gpt-4.1-2025-04-14";
|
|
52
54
|
readonly gpt4o: "gpt-4o-2024-11-20";
|
|
53
55
|
readonly gpt4omini: "gpt-4o-mini-2024-07-18";
|
|
54
56
|
readonly o3mini: "o3-mini-2025-01-31";
|
|
@@ -79,12 +81,32 @@ export declare const models: {
|
|
|
79
81
|
readonly gemini2flash: "gemini-2.0-flash-001";
|
|
80
82
|
readonly gemini2_5_pro_exp: "gemini-2.5-pro-exp-03-25";
|
|
81
83
|
readonly gemini2_5_pro_preview: "gemini-2.5-pro-preview-03-25";
|
|
84
|
+
readonly gpt4_1: "gpt-4.1-2025-04-14";
|
|
82
85
|
readonly gpt4o: "gpt-4o-2024-11-20";
|
|
83
86
|
readonly gpt4omini: "gpt-4o-mini-2024-07-18";
|
|
84
87
|
readonly o3mini: "o3-mini-2025-01-31";
|
|
85
88
|
readonly generatePatch: "ft:gpt-4o-2024-08-06:manifold-markets:generate-patch-batch2:AKYtDIhk";
|
|
86
89
|
readonly sonnet: "claude-3-5-sonnet-20241022";
|
|
90
|
+
readonly sonnet3_7: "claude-3-7-sonnet-20250219";
|
|
87
91
|
readonly haiku: "claude-3-5-haiku-20241022";
|
|
88
92
|
};
|
|
93
|
+
export declare const shortModelNames: {
|
|
94
|
+
'gemini-2.5-pro': "gemini-2.5-pro-preview-03-25";
|
|
95
|
+
'sonnet-3.7': "claude-3-7-sonnet-20250219";
|
|
96
|
+
'sonnet-3.5': "claude-3-5-sonnet-20241022";
|
|
97
|
+
'sonnet-3.6': "claude-3-5-sonnet-20241022";
|
|
98
|
+
'gpt-4.1': "gpt-4.1-2025-04-14";
|
|
99
|
+
'o3-mini': "o3-mini-2025-01-31";
|
|
100
|
+
};
|
|
101
|
+
export declare const providerModelNames: {
|
|
102
|
+
"gemini-2.5-pro-preview-03-25": string;
|
|
103
|
+
"gemini-2.5-pro-exp-03-25": string;
|
|
104
|
+
"claude-3-7-sonnet-20250219": string;
|
|
105
|
+
"claude-3-5-sonnet-20241022": string;
|
|
106
|
+
"gpt-4.1-2025-04-14": string;
|
|
107
|
+
"gpt-4o-2024-11-20": string;
|
|
108
|
+
"gpt-4o-mini-2024-07-18": string;
|
|
109
|
+
"o3-mini-2025-01-31": string;
|
|
110
|
+
};
|
|
89
111
|
export type Model = (typeof models)[keyof typeof models];
|
|
90
112
|
export declare const TEST_USER_ID = "test-user-id";
|
|
@@ -0,0 +1 @@
|
|
|
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,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AAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAA;AAExD,eAAO,MAAM,YAAY,iBAAiB,CAAA"}
|
package/dist/common/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TEST_USER_ID = exports.models = exports.deepseekModels = exports.openrouterModels = exports.geminiModels = exports.openaiModels = exports.claudeModels = exports.getModelForMode = exports.costModes = exports.CREDITS_USAGE_LIMITS = exports.PLAN_CONFIGS = exports.UsageLimits = exports.getUsageLimitFromPlanName = exports.getPlanDisplayName = exports.AFFILIATE_USER_REFFERAL_LIMIT = exports.CREDITS_REFERRAL_BONUS = exports.OVERAGE_RATE_MOAR_PRO = exports.OVERAGE_RATE_PRO = exports.BILLING_PERIOD_DAYS = exports.MAX_DATE = exports.REQUEST_CREDIT_SHOW_THRESHOLD = exports.HIDDEN_FILE_READ_STATUS = exports.FILE_READ_STATUS = exports.ONE_TIME_TAGS = exports.CODEBUFF_INVALID_KEY_INFO = exports.CODEBUFF_CLAUDE_FALLBACK_INFO = exports.CODEBUFF_RATE_LIMIT_INFO = exports.DEFAULT_IGNORED_FILES = exports.EXISTING_CODE_MARKER = exports.FIND_FILES_MARKER = exports.STOP_MARKER = void 0;
|
|
3
|
+
exports.TEST_USER_ID = exports.providerModelNames = exports.shortModelNames = exports.models = exports.deepseekModels = exports.openrouterModels = exports.geminiModels = exports.openaiModels = exports.claudeModels = exports.getModelForMode = exports.costModes = exports.CREDITS_USAGE_LIMITS = exports.PLAN_CONFIGS = exports.UsageLimits = exports.getUsageLimitFromPlanName = exports.getPlanDisplayName = exports.AFFILIATE_USER_REFFERAL_LIMIT = exports.CREDITS_REFERRAL_BONUS = exports.OVERAGE_RATE_MOAR_PRO = exports.OVERAGE_RATE_PRO = exports.BILLING_PERIOD_DAYS = exports.MAX_DATE = exports.REQUEST_CREDIT_SHOW_THRESHOLD = exports.HIDDEN_FILE_READ_STATUS = exports.FILE_READ_STATUS = exports.ONE_TIME_TAGS = exports.CODEBUFF_INVALID_KEY_INFO = exports.CODEBUFF_CLAUDE_FALLBACK_INFO = exports.CODEBUFF_RATE_LIMIT_INFO = exports.DEFAULT_IGNORED_FILES = exports.EXISTING_CODE_MARKER = exports.FIND_FILES_MARKER = exports.STOP_MARKER = void 0;
|
|
4
4
|
exports.toOptionalFile = toOptionalFile;
|
|
5
5
|
exports.STOP_MARKER = '[' + 'END]';
|
|
6
6
|
exports.FIND_FILES_MARKER = '[' + 'FIND_FILES_PLEASE]';
|
|
@@ -63,7 +63,7 @@ exports.MAX_DATE = new Date(86399999999999);
|
|
|
63
63
|
exports.BILLING_PERIOD_DAYS = 30;
|
|
64
64
|
exports.OVERAGE_RATE_PRO = 0.99;
|
|
65
65
|
exports.OVERAGE_RATE_MOAR_PRO = 0.9;
|
|
66
|
-
exports.CREDITS_REFERRAL_BONUS =
|
|
66
|
+
exports.CREDITS_REFERRAL_BONUS = 500;
|
|
67
67
|
exports.AFFILIATE_USER_REFFERAL_LIMIT = 500;
|
|
68
68
|
const getPlanDisplayName = (limit) => {
|
|
69
69
|
return exports.PLAN_CONFIGS[limit].displayName;
|
|
@@ -139,9 +139,11 @@ const getModelForMode = (costMode, operation) => {
|
|
|
139
139
|
exports.getModelForMode = getModelForMode;
|
|
140
140
|
exports.claudeModels = {
|
|
141
141
|
sonnet: 'claude-3-5-sonnet-20241022',
|
|
142
|
+
sonnet3_7: 'claude-3-7-sonnet-20250219',
|
|
142
143
|
haiku: 'claude-3-5-haiku-20241022',
|
|
143
144
|
};
|
|
144
145
|
exports.openaiModels = {
|
|
146
|
+
gpt4_1: 'gpt-4.1-2025-04-14',
|
|
145
147
|
gpt4o: 'gpt-4o-2024-11-20',
|
|
146
148
|
gpt4omini: 'gpt-4o-mini-2024-07-18',
|
|
147
149
|
o3mini: 'o3-mini-2025-01-31',
|
|
@@ -167,5 +169,23 @@ exports.models = {
|
|
|
167
169
|
...exports.deepseekModels,
|
|
168
170
|
...exports.openrouterModels,
|
|
169
171
|
};
|
|
172
|
+
exports.shortModelNames = {
|
|
173
|
+
'gemini-2.5-pro': exports.models.gemini2_5_pro_preview,
|
|
174
|
+
'sonnet-3.7': exports.models.sonnet3_7,
|
|
175
|
+
'sonnet-3.5': exports.models.sonnet,
|
|
176
|
+
'sonnet-3.6': exports.models.sonnet,
|
|
177
|
+
'gpt-4.1': exports.models.gpt4_1,
|
|
178
|
+
'o3-mini': exports.models.o3mini,
|
|
179
|
+
};
|
|
180
|
+
exports.providerModelNames = {
|
|
181
|
+
[exports.models.gemini2_5_pro_preview]: 'gemini',
|
|
182
|
+
[exports.models.gemini2_5_pro_exp]: 'gemini',
|
|
183
|
+
[exports.models.sonnet3_7]: 'anthropic',
|
|
184
|
+
[exports.models.sonnet]: 'anthropic',
|
|
185
|
+
[exports.models.gpt4_1]: 'openai',
|
|
186
|
+
[exports.models.gpt4o]: 'openai',
|
|
187
|
+
[exports.models.gpt4omini]: 'openai',
|
|
188
|
+
[exports.models.o3mini]: 'openai',
|
|
189
|
+
};
|
|
170
190
|
exports.TEST_USER_ID = 'test-user-id';
|
|
171
191
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAsDA,wCAKC;AA3DY,QAAA,WAAW,GAAG,GAAG,GAAG,MAAM,CAAA;AAC1B,QAAA,iBAAiB,GAAG,GAAG,GAAG,oBAAoB,CAAA;AAC9C,QAAA,oBAAoB,GAAG,oCAAoC,CAAA;AAE3D,QAAA,qBAAqB,GAAG;IACnC,MAAM;IACN,MAAM;IACN,QAAQ;IACR,KAAK;IACL,KAAK;IACL,SAAS;IACT,cAAc;IACd,MAAM;IACN,YAAY;IACZ,OAAO;IACP,aAAa;IACb,aAAa;IACb,aAAa;IACb,OAAO;IACP,WAAW;IACX,eAAe;IACf,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AA;AAEY,QAAA,kBAAkB,GAAG;IAChC,CAAC,cAAM,CAAC,qBAAqB,CAAC,EAAE,QAAQ;IACxC,CAAC,cAAM,CAAC,iBAAiB,CAAC,EAAE,QAAQ;IACpC,CAAC,cAAM,CAAC,SAAS,CAAC,EAAE,WAAW;IAC/B,CAAC,cAAM,CAAC,MAAM,CAAC,EAAE,WAAW;IAC5B,CAAC,cAAM,CAAC,MAAM,CAAC,EAAE,QAAQ;IACzB,CAAC,cAAM,CAAC,KAAK,CAAC,EAAE,QAAQ;IACxB,CAAC,cAAM,CAAC,SAAS,CAAC,EAAE,QAAQ;IAC5B,CAAC,cAAM,CAAC,MAAM,CAAC,EAAE,QAAQ;CAC1B,CAAA;AAIY,QAAA,YAAY,GAAG,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"drizzle.config.d.ts","sourceRoot":"","sources":["../../src/db/drizzle.config.ts"],"names":[],"mappings":";AAIA,wBAOE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.mts","sourceRoot":"","sources":["../../src/db/env.mjs"],"names":[],"mappings":"AAeA,sBAME"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;;;;;;;;;;;;;;;;;;;;;;;;;EAiCnB,CAAA;AAED,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAOlB,CAAA;AAEF,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQ7B,CAAA;AAGD,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAa5B,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env.d.mts","sourceRoot":"","sources":["../src/env.mjs"],"names":[],"mappings":"AAiBA,sBAeE"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -6,12 +6,12 @@ export declare const ToolCallSchema: z.ZodObject<{
|
|
|
6
6
|
id: z.ZodString;
|
|
7
7
|
}, "strip", z.ZodTypeAny, {
|
|
8
8
|
name: string;
|
|
9
|
-
id: string;
|
|
10
9
|
parameters: Record<string, string>;
|
|
10
|
+
id: string;
|
|
11
11
|
}, {
|
|
12
12
|
name: string;
|
|
13
|
-
id: string;
|
|
14
13
|
parameters: Record<string, string>;
|
|
14
|
+
id: string;
|
|
15
15
|
}>;
|
|
16
16
|
export type ToolCall = z.infer<typeof ToolCallSchema>;
|
|
17
17
|
export declare const ToolResultSchema: z.ZodObject<{
|
|
@@ -176,16 +176,16 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
176
176
|
type: "ephemeral";
|
|
177
177
|
}>>;
|
|
178
178
|
}, "strip", z.ZodTypeAny, {
|
|
179
|
-
type: "tool_use";
|
|
180
179
|
name: string;
|
|
180
|
+
type: "tool_use";
|
|
181
181
|
id: string;
|
|
182
182
|
input: Record<string, any>;
|
|
183
183
|
cache_control?: {
|
|
184
184
|
type: "ephemeral";
|
|
185
185
|
} | undefined;
|
|
186
186
|
}, {
|
|
187
|
-
type: "tool_use";
|
|
188
187
|
name: string;
|
|
188
|
+
type: "tool_use";
|
|
189
189
|
id: string;
|
|
190
190
|
input: Record<string, any>;
|
|
191
191
|
cache_control?: {
|
|
@@ -267,8 +267,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
267
267
|
type: "ephemeral";
|
|
268
268
|
} | undefined;
|
|
269
269
|
} | {
|
|
270
|
-
type: "tool_use";
|
|
271
270
|
name: string;
|
|
271
|
+
type: "tool_use";
|
|
272
272
|
id: string;
|
|
273
273
|
input: Record<string, any>;
|
|
274
274
|
cache_control?: {
|
|
@@ -301,8 +301,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
301
301
|
type: "ephemeral";
|
|
302
302
|
} | undefined;
|
|
303
303
|
} | {
|
|
304
|
-
type: "tool_use";
|
|
305
304
|
name: string;
|
|
305
|
+
type: "tool_use";
|
|
306
306
|
id: string;
|
|
307
307
|
input: Record<string, any>;
|
|
308
308
|
cache_control?: {
|
|
@@ -328,7 +328,7 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
328
328
|
})[];
|
|
329
329
|
role: "user" | "assistant";
|
|
330
330
|
}>, "many">;
|
|
331
|
-
|
|
331
|
+
consecutiveAssistantMessages: z.ZodOptional<z.ZodNumber>;
|
|
332
332
|
}, "strip", z.ZodTypeAny, {
|
|
333
333
|
agentContext: string;
|
|
334
334
|
fileContext: {
|
|
@@ -366,8 +366,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
366
366
|
type: "ephemeral";
|
|
367
367
|
} | undefined;
|
|
368
368
|
} | {
|
|
369
|
-
type: "tool_use";
|
|
370
369
|
name: string;
|
|
370
|
+
type: "tool_use";
|
|
371
371
|
id: string;
|
|
372
372
|
input: Record<string, any>;
|
|
373
373
|
cache_control?: {
|
|
@@ -393,7 +393,7 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
393
393
|
})[];
|
|
394
394
|
role: "user" | "assistant";
|
|
395
395
|
}[];
|
|
396
|
-
|
|
396
|
+
consecutiveAssistantMessages?: number | undefined;
|
|
397
397
|
}, {
|
|
398
398
|
agentContext: string;
|
|
399
399
|
fileContext: {
|
|
@@ -431,8 +431,8 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
431
431
|
type: "ephemeral";
|
|
432
432
|
} | undefined;
|
|
433
433
|
} | {
|
|
434
|
-
type: "tool_use";
|
|
435
434
|
name: string;
|
|
435
|
+
type: "tool_use";
|
|
436
436
|
id: string;
|
|
437
437
|
input: Record<string, any>;
|
|
438
438
|
cache_control?: {
|
|
@@ -458,7 +458,7 @@ export declare const AgentStateSchema: z.ZodObject<{
|
|
|
458
458
|
})[];
|
|
459
459
|
role: "user" | "assistant";
|
|
460
460
|
}[];
|
|
461
|
-
|
|
461
|
+
consecutiveAssistantMessages?: number | undefined;
|
|
462
462
|
}>;
|
|
463
463
|
export type AgentState = z.infer<typeof AgentStateSchema>;
|
|
464
464
|
export declare function getInitialAgentState(fileContext: ProjectFileContext): AgentState;
|
|
@@ -0,0 +1 @@
|
|
|
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAK3B,CAAA;AACF,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,wBAAgB,oBAAoB,CAClC,WAAW,EAAE,kBAAkB,GAC9B,UAAU,CAOZ"}
|
|
@@ -19,14 +19,14 @@ exports.AgentStateSchema = zod_1.z.object({
|
|
|
19
19
|
agentContext: zod_1.z.string(),
|
|
20
20
|
fileContext: file_1.ProjectFileContextSchema,
|
|
21
21
|
messageHistory: zod_1.z.array(message_1.MessageSchema),
|
|
22
|
-
|
|
22
|
+
consecutiveAssistantMessages: zod_1.z.number().optional(),
|
|
23
23
|
});
|
|
24
24
|
function getInitialAgentState(fileContext) {
|
|
25
25
|
return {
|
|
26
26
|
agentContext: '',
|
|
27
27
|
messageHistory: [],
|
|
28
28
|
fileContext,
|
|
29
|
-
|
|
29
|
+
consecutiveAssistantMessages: 0,
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
//# sourceMappingURL=agent-state.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-state.js","sourceRoot":"","sources":["../../src/types/agent-state.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"agent-state.js","sourceRoot":"","sources":["../../src/types/agent-state.ts"],"names":[],"mappings":";;;AA0BA,oDASC;AAnCD,6BAAuB;AAEvB,uCAA2E;AAC3E,uCAAyC;AAE5B,QAAA,cAAc,GAAG,OAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,UAAU,EAAE,OAAC,CAAC,MAAM,CAAC,OAAC,CAAC,MAAM,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC;IAC5C,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAA;AAEW,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE;IAChB,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE;IAClB,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE;CACf,CAAC,CAAA;AAGW,QAAA,gBAAgB,GAAG,OAAC,CAAC,MAAM,CAAC;IACvC,YAAY,EAAE,OAAC,CAAC,MAAM,EAAE;IACxB,WAAW,EAAE,+BAAwB;IACrC,cAAc,EAAE,OAAC,CAAC,KAAK,CAAC,uBAAa,CAAC;IACtC,4BAA4B,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CACpD,CAAC,CAAA;AAGF,SAAgB,oBAAoB,CAClC,WAA+B;IAE/B,OAAO;QACL,YAAY,EAAE,EAAE;QAChB,cAAc,EAAE,EAAE;QAClB,WAAW;QACX,4BAA4B,EAAE,CAAC;KAChC,CAAA;AACH,CAAC"}
|
|
@@ -61,15 +61,15 @@ declare const MessageContentObjectSchema: z.ZodUnion<[z.ZodObject<{
|
|
|
61
61
|
type: "ephemeral";
|
|
62
62
|
}>>;
|
|
63
63
|
}, "strip", z.ZodTypeAny, {
|
|
64
|
-
type: "tool_result";
|
|
65
64
|
content: string;
|
|
65
|
+
type: "tool_result";
|
|
66
66
|
tool_use_id: string;
|
|
67
67
|
cache_control?: {
|
|
68
68
|
type: "ephemeral";
|
|
69
69
|
} | undefined;
|
|
70
70
|
}, {
|
|
71
|
-
type: "tool_result";
|
|
72
71
|
content: string;
|
|
72
|
+
type: "tool_result";
|
|
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
|
-
type: "tool_result";
|
|
185
184
|
content: string;
|
|
185
|
+
type: "tool_result";
|
|
186
186
|
tool_use_id: string;
|
|
187
187
|
cache_control?: {
|
|
188
188
|
type: "ephemeral";
|
|
189
189
|
} | undefined;
|
|
190
190
|
}, {
|
|
191
|
-
type: "tool_result";
|
|
192
191
|
content: string;
|
|
192
|
+
type: "tool_result";
|
|
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
|
-
type: "tool_result";
|
|
257
256
|
content: string;
|
|
257
|
+
type: "tool_result";
|
|
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
|
-
type: "tool_result";
|
|
291
290
|
content: string;
|
|
291
|
+
type: "tool_result";
|
|
292
292
|
tool_use_id: string;
|
|
293
293
|
cache_control?: {
|
|
294
294
|
type: "ephemeral";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message.d.ts","sourceRoot":"","sources":["../../src/types/message.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,QAAA,MAAM,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IA4C9B,CAAA;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGxB,CAAA;AACF,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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messages.test.d.ts","sourceRoot":"","sources":["../../../src/util/__tests__/messages.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"string.test.d.ts","sourceRoot":"","sources":["../../../src/util/__tests__/string.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -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;
|
|
10
11
|
name: string | null;
|
|
11
12
|
id: string;
|
|
12
13
|
fingerprintId: string;
|
|
13
14
|
authToken: string;
|
|
14
|
-
email: string;
|
|
15
15
|
fingerprintHash: string;
|
|
16
16
|
}, {
|
|
17
|
+
email: string;
|
|
17
18
|
name: string | null;
|
|
18
19
|
id: string;
|
|
19
20
|
fingerprintId: string;
|
|
20
21
|
authToken: string;
|
|
21
|
-
email: string;
|
|
22
22
|
fingerprintHash: string;
|
|
23
23
|
}>;
|
|
24
24
|
export type User = z.infer<typeof userSchema>;
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|
|
@@ -0,0 +1,27 @@
|
|
|
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>;
|
|
@@ -0,0 +1,174 @@
|
|
|
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
|