codebuff 1.0.231 → 1.0.232
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/cli-handlers/inititalization-flow.d.ts +1 -0
- package/dist/cli-handlers/inititalization-flow.js +24 -0
- package/dist/cli-handlers/inititalization-flow.js.map +1 -0
- package/dist/cli.js +7 -0
- package/dist/cli.js.map +1 -1
- package/dist/client.d.ts +6 -6
- package/dist/client.js +29 -34
- package/dist/client.js.map +1 -1
- package/dist/code-map/tsconfig.tsbuildinfo +1 -1
- package/dist/common/actions.d.ts +54 -54
- package/dist/common/bigquery/client.js +5 -4
- package/dist/common/bigquery/client.js.map +1 -1
- package/dist/common/bigquery/schema.d.ts +1 -0
- package/dist/common/bigquery/schema.js.map +1 -1
- package/dist/common/billing/balance-calculator.d.ts +2 -2
- package/dist/common/billing/quota-manager.d.ts +29 -0
- package/dist/common/billing/quota-manager.js +251 -0
- package/dist/common/billing/quota-manager.js.map +1 -0
- package/dist/common/constants.d.ts +7 -5
- package/dist/common/constants.js +14 -9
- package/dist/common/constants.js.map +1 -1
- package/dist/common/json-config/__tests__/stringify-schema.test.js +7 -7
- package/dist/common/json-config/__tests__/stringify-schema.test.js.map +1 -1
- package/dist/common/json-config/constants.d.ts +5 -0
- package/dist/common/json-config/constants.js +11 -5
- package/dist/common/json-config/constants.js.map +1 -1
- package/dist/common/json-config/parser.d.ts +1 -1
- package/dist/common/json-config/parser.js +16 -9
- package/dist/common/json-config/parser.js.map +1 -1
- package/dist/common/json-config/stringify-schema.d.ts +1 -1
- package/dist/common/json-config/stringify-schema.js +51 -36
- package/dist/common/json-config/stringify-schema.js.map +1 -1
- package/dist/common/logger.d.ts +1 -0
- package/dist/common/logger.js +7 -0
- package/dist/common/logger.js.map +1 -0
- package/dist/common/types/usage.d.ts +4 -4
- package/dist/common/util/constants.d.ts +1 -0
- package/dist/common/util/constants.js +7 -0
- package/dist/common/util/constants.js.map +1 -0
- package/dist/common/util/helpers.d.ts +1 -0
- package/dist/common/util/helpers.js +6 -0
- package/dist/common/util/helpers.js.map +1 -0
- package/dist/common/util/token-counter.d.ts +3 -0
- package/dist/common/util/token-counter.js +27 -0
- package/dist/common/util/token-counter.js.map +1 -0
- package/dist/common/util/tools.d.ts +2 -0
- package/dist/common/util/tools.js +13 -0
- package/dist/common/util/tools.js.map +1 -0
- package/dist/common/websockets/websocket-schema.d.ts +104 -104
- package/dist/dev-process-manager.d.ts +1 -1
- package/dist/dev-process-manager.js +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/menu.js +12 -11
- package/dist/menu.js.map +1 -1
- package/dist/tool-handlers.js +16 -2
- package/dist/tool-handlers.js.map +1 -1
- package/package.json +2 -1
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CodebuffConfigSchema = exports.StartupProcessSchema = void 0;
|
|
3
|
+
exports.CodebuffConfigSchema = exports.StartupProcessSchema = exports.codebuffConfigFileBackup = exports.codebuffConfigFile = void 0;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
|
+
exports.codebuffConfigFile = 'codebuff.json';
|
|
6
|
+
exports.codebuffConfigFileBackup = 'codebuff.jsonc';
|
|
5
7
|
exports.StartupProcessSchema = zod_1.z
|
|
6
8
|
.object({
|
|
7
9
|
name: zod_1.z
|
|
8
10
|
.string()
|
|
9
11
|
.min(1, 'Process name is required')
|
|
10
|
-
.describe('A user-friendly name for the process.'),
|
|
12
|
+
.describe('A user-friendly name for the process. Should be one word and unique.'),
|
|
11
13
|
command: zod_1.z
|
|
12
14
|
.string()
|
|
13
15
|
.min(1, 'Command is required')
|
|
@@ -30,13 +32,17 @@ exports.StartupProcessSchema = zod_1.z
|
|
|
30
32
|
.optional()
|
|
31
33
|
.describe('Path to write process stderr output. If not specified, output is not stored.'),
|
|
32
34
|
})
|
|
33
|
-
.describe('Defines a single startup process.
|
|
35
|
+
.describe('Defines a single startup process.');
|
|
34
36
|
exports.CodebuffConfigSchema = zod_1.z
|
|
35
37
|
.object({
|
|
38
|
+
description: zod_1.z
|
|
39
|
+
.any()
|
|
40
|
+
.optional()
|
|
41
|
+
.describe('Does nothing. Put any thing you want here!'),
|
|
36
42
|
startupProcesses: zod_1.z
|
|
37
43
|
.array(exports.StartupProcessSchema)
|
|
38
44
|
.optional()
|
|
39
|
-
.describe('An array of startup processes
|
|
45
|
+
.describe('An array of startup processes.'),
|
|
40
46
|
})
|
|
41
|
-
.describe(
|
|
47
|
+
.describe(`Defines the overall Codebuff configuration file (e.g., ${exports.codebuffConfigFile}). This schema defines the top-level structure of the configuration.`);
|
|
42
48
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/json-config/constants.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,oBAAoB,GAAG,OAAC;KAClC,MAAM,CAAC;IACN,IAAI,EAAE,OAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;SAClC,QAAQ,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/json-config/constants.ts"],"names":[],"mappings":";;;AAAA,6BAAuB;AAEV,QAAA,kBAAkB,GAAG,eAAe,CAAA;AACpC,QAAA,wBAAwB,GAAG,gBAAgB,CAAA;AAE3C,QAAA,oBAAoB,GAAG,OAAC;KAClC,MAAM,CAAC;IACN,IAAI,EAAE,OAAC;SACJ,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,0BAA0B,CAAC;SAClC,QAAQ,CACP,sEAAsE,CACvE;IACH,OAAO,EAAE,OAAC;SACP,MAAM,EAAE;SACR,GAAG,CAAC,CAAC,EAAE,qBAAqB,CAAC;SAC7B,QAAQ,CAAC,sCAAsC,CAAC;IACnD,GAAG,EAAE,OAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,sDAAsD,CAAC;IACnE,OAAO,EAAE,OAAC;SACP,OAAO,EAAE;SACT,QAAQ,EAAE;SACV,OAAO,CAAC,IAAI,CAAC;SACb,QAAQ,CAAC,qCAAqC,CAAC;IAClD,UAAU,EAAE,OAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,8EAA8E,CAC/E;IACH,UAAU,EAAE,OAAC;SACV,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CACP,8EAA8E,CAC/E;CACJ,CAAC;KACD,QAAQ,CAAC,mCAAmC,CAAC,CAAA;AAEnC,QAAA,oBAAoB,GAAG,OAAC;KAClC,MAAM,CAAC;IACN,WAAW,EAAE,OAAC;SACX,GAAG,EAAE;SACL,QAAQ,EAAE;SACV,QAAQ,CAAC,4CAA4C,CAAC;IACzD,gBAAgB,EAAE,OAAC;SAChB,KAAK,CAAC,4BAAoB,CAAC;SAC3B,QAAQ,EAAE;SACV,QAAQ,CAAC,gCAAgC,CAAC;CAC9C,CAAC;KACD,QAAQ,CACP,0DAA0D,0BAAkB,sEAAsE,CACnJ,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CodebuffConfig } from './constants';
|
|
2
2
|
/**
|
|
3
|
-
* Loads and validates the
|
|
3
|
+
* Loads and validates the configuration file from the project directory.
|
|
4
4
|
* @param projectPath - The root directory of the project
|
|
5
5
|
* @returns The parsed and validated configuration, or null if no valid config exists
|
|
6
6
|
*/
|
|
@@ -4,26 +4,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.loadCodebuffConfig = loadCodebuffConfig;
|
|
7
|
-
const fs_1 =
|
|
7
|
+
const fs_1 = require("fs");
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const jsonc_parser_1 = require("jsonc-parser");
|
|
9
10
|
const picocolors_1 = require("picocolors");
|
|
10
11
|
const constants_1 = require("./constants");
|
|
11
12
|
/**
|
|
12
|
-
* Loads and validates the
|
|
13
|
+
* Loads and validates the configuration file from the project directory.
|
|
13
14
|
* @param projectPath - The root directory of the project
|
|
14
15
|
* @returns The parsed and validated configuration, or null if no valid config exists
|
|
15
16
|
*/
|
|
16
17
|
function loadCodebuffConfig(projectPath) {
|
|
17
|
-
const
|
|
18
|
-
|
|
18
|
+
const configPathPrimary = path_1.default.join(projectPath, constants_1.codebuffConfigFile);
|
|
19
|
+
const configPathBackup = path_1.default.join(projectPath, constants_1.codebuffConfigFileBackup);
|
|
20
|
+
const configPath = (0, fs_1.existsSync)(configPathBackup)
|
|
21
|
+
? configPathBackup
|
|
22
|
+
: (0, fs_1.existsSync)(configPathPrimary)
|
|
23
|
+
? configPathPrimary
|
|
24
|
+
: null;
|
|
25
|
+
if (configPath === null) {
|
|
19
26
|
return null;
|
|
20
27
|
}
|
|
21
28
|
try {
|
|
22
|
-
const
|
|
23
|
-
const parsedConfig =
|
|
29
|
+
const jsoncContent = (0, fs_1.readFileSync)(configPath, 'utf-8');
|
|
30
|
+
const parsedConfig = (0, jsonc_parser_1.parse)(jsoncContent);
|
|
24
31
|
const result = constants_1.CodebuffConfigSchema.safeParse(parsedConfig);
|
|
25
32
|
if (!result.success) {
|
|
26
|
-
console.warn((0, picocolors_1.yellow)(
|
|
33
|
+
console.warn((0, picocolors_1.yellow)(`Warning: Invalid ${constants_1.codebuffConfigFile} configuration. Please check the schema:\n` +
|
|
27
34
|
result.error.errors
|
|
28
35
|
.map((err) => `- ${err.path.join('.')}: ${err.message}`)
|
|
29
36
|
.join('\n')));
|
|
@@ -33,10 +40,10 @@ function loadCodebuffConfig(projectPath) {
|
|
|
33
40
|
}
|
|
34
41
|
catch (error) {
|
|
35
42
|
if (error instanceof SyntaxError) {
|
|
36
|
-
console.warn((0, picocolors_1.yellow)(
|
|
43
|
+
console.warn((0, picocolors_1.yellow)(`Warning: Invalid JSON in ${constants_1.codebuffConfigFile}. Please check the syntax.`));
|
|
37
44
|
}
|
|
38
45
|
else {
|
|
39
|
-
console.warn((0, picocolors_1.yellow)(
|
|
46
|
+
console.warn((0, picocolors_1.yellow)(`Warning: Error reading ${constants_1.codebuffConfigFile} configuration file.`));
|
|
40
47
|
}
|
|
41
48
|
return null;
|
|
42
49
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/json-config/parser.ts"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"parser.js","sourceRoot":"","sources":["../../src/json-config/parser.ts"],"names":[],"mappings":";;;;;AAkBA,gDAgDC;AAlED,2BAA6C;AAC7C,gDAAuB;AAEvB,+CAAkD;AAClD,2CAAmC;AAEnC,2CAKoB;AAEpB;;;;GAIG;AACH,SAAgB,kBAAkB,CAAC,WAAmB;IACpD,MAAM,iBAAiB,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,8BAAkB,CAAC,CAAA;IACpE,MAAM,gBAAgB,GAAG,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,oCAAwB,CAAC,CAAA;IACzE,MAAM,UAAU,GAAG,IAAA,eAAU,EAAC,gBAAgB,CAAC;QAC7C,CAAC,CAAC,gBAAgB;QAClB,CAAC,CAAC,IAAA,eAAU,EAAC,iBAAiB,CAAC;YAC7B,CAAC,CAAC,iBAAiB;YACnB,CAAC,CAAC,IAAI,CAAA;IAEV,IAAI,UAAU,KAAK,IAAI,EAAE,CAAC;QACxB,OAAO,IAAI,CAAA;IACb,CAAC;IAED,IAAI,CAAC;QACH,MAAM,YAAY,GAAG,IAAA,iBAAY,EAAC,UAAU,EAAE,OAAO,CAAC,CAAA;QACtD,MAAM,YAAY,GAAG,IAAA,oBAAU,EAAC,YAAY,CAAC,CAAA;QAE7C,MAAM,MAAM,GAAG,gCAAoB,CAAC,SAAS,CAAC,YAAY,CAAC,CAAA;QAE3D,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;YACpB,OAAO,CAAC,IAAI,CACV,IAAA,mBAAM,EACJ,oBAAoB,8BAAkB,4CAA4C;gBAChF,MAAM,CAAC,KAAK,CAAC,MAAM;qBAChB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,GAAG,CAAC,OAAO,EAAE,CAAC;qBACvD,IAAI,CAAC,IAAI,CAAC,CAChB,CACF,CAAA;YACD,OAAO,IAAI,CAAA;QACb,CAAC;QAED,OAAO,MAAM,CAAC,IAAI,CAAA;IACpB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,WAAW,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,CACV,IAAA,mBAAM,EACJ,4BAA4B,8BAAkB,4BAA4B,CAC3E,CACF,CAAA;QACH,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,IAAI,CACV,IAAA,mBAAM,EACJ,0BAA0B,8BAAkB,sBAAsB,CACnE,CACF,CAAA;QACH,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC"}
|
|
@@ -7,4 +7,4 @@ import { z } from 'zod';
|
|
|
7
7
|
* @param schemaName A name for the root schema.
|
|
8
8
|
* @returns A string describing the schema structure and field descriptions.
|
|
9
9
|
*/
|
|
10
|
-
export declare function
|
|
10
|
+
export declare function stringifySchema(schema: z.ZodObject<any>, schemaName: string): string;
|
|
@@ -1,67 +1,92 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.stringifySchema = stringifySchema;
|
|
4
4
|
const zod_1 = require("zod");
|
|
5
5
|
function getSchemaDescription(schema) {
|
|
6
6
|
return schema.description;
|
|
7
7
|
}
|
|
8
8
|
function formatDescription(description) {
|
|
9
|
-
|
|
9
|
+
if (!description)
|
|
10
|
+
return '';
|
|
11
|
+
return `(${description})`;
|
|
10
12
|
}
|
|
11
13
|
function indent(level) {
|
|
12
|
-
return '
|
|
14
|
+
return ' '.repeat(level);
|
|
13
15
|
}
|
|
14
16
|
function stringifyZodType(schema, level = 0, fieldName) {
|
|
15
17
|
const description = getSchemaDescription(schema);
|
|
16
18
|
const baseIndent = indent(level);
|
|
17
|
-
const fieldPrefix = fieldName ?
|
|
19
|
+
const fieldPrefix = fieldName ? `\`${fieldName}\`:` : '';
|
|
20
|
+
const desc = formatDescription(description);
|
|
21
|
+
// Handle object types
|
|
22
|
+
if (schema instanceof zod_1.z.ZodObject) {
|
|
23
|
+
const shape = schema.shape;
|
|
24
|
+
let output = `${baseIndent}${fieldPrefix}`;
|
|
25
|
+
if (desc)
|
|
26
|
+
output += `\n${indent(level + 1)}${desc}`;
|
|
27
|
+
output += `\n${indent(level + 1)}Object`;
|
|
28
|
+
if (Object.keys(shape).length === 0) {
|
|
29
|
+
output += `\n${baseIndent}{\n${baseIndent}}`;
|
|
30
|
+
return output;
|
|
31
|
+
}
|
|
32
|
+
output += `\n${baseIndent}{\n`;
|
|
33
|
+
for (const key in shape) {
|
|
34
|
+
output += stringifyZodType(shape[key], level + 1, key) + '\n\n';
|
|
35
|
+
}
|
|
36
|
+
output = output.slice(0, -1); // Remove last newline
|
|
37
|
+
output += `${baseIndent}}`;
|
|
38
|
+
return output;
|
|
39
|
+
}
|
|
18
40
|
// Handle optional types
|
|
19
41
|
if (schema instanceof zod_1.z.ZodOptional || schema instanceof zod_1.z.ZodNullable) {
|
|
20
42
|
const innerType = stringifyZodType(schema._def.innerType, level, fieldName);
|
|
21
43
|
// Remove the field name from the inner type string if present
|
|
22
44
|
const innerTypeWithoutPrefix = fieldName
|
|
23
|
-
? innerType.replace(`${baseIndent}
|
|
45
|
+
? innerType.replace(`${baseIndent}\`${fieldName}\`:`, `${baseIndent}`)
|
|
24
46
|
: innerType;
|
|
25
|
-
return `${baseIndent}${fieldPrefix}Optional<${innerTypeWithoutPrefix.trim()}
|
|
47
|
+
return `${baseIndent}${fieldPrefix}\n${indent(level + 1)}${desc}\n${indent(level + 1)}Optional<${innerTypeWithoutPrefix.trim()}>`;
|
|
26
48
|
}
|
|
27
49
|
// Handle default types
|
|
28
50
|
if (schema instanceof zod_1.z.ZodDefault) {
|
|
29
51
|
const innerType = stringifyZodType(schema._def.innerType, level, fieldName);
|
|
30
52
|
// Remove the field name from the inner type string if present
|
|
31
53
|
const innerTypeWithoutPrefix = fieldName
|
|
32
|
-
? innerType.replace(`${baseIndent}
|
|
54
|
+
? innerType.replace(`${baseIndent}\`${fieldName}\`:`, `${baseIndent}`)
|
|
33
55
|
: innerType;
|
|
34
56
|
const defaultValue = JSON.stringify(schema._def.defaultValue());
|
|
35
|
-
return
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
let output = `${baseIndent}${fieldPrefix}Object${formatDescription(description)} {\n`;
|
|
41
|
-
for (const key in shape) {
|
|
42
|
-
output += stringifyZodType(shape[key], level + 1, key) + '\n';
|
|
43
|
-
}
|
|
44
|
-
output += `${baseIndent}}`;
|
|
45
|
-
return output;
|
|
57
|
+
return [
|
|
58
|
+
`${baseIndent}${fieldPrefix}`,
|
|
59
|
+
`${indent(level + 1)}${desc}`,
|
|
60
|
+
`${indent(level + 1)}${innerTypeWithoutPrefix.trim()} (default: ${defaultValue})`,
|
|
61
|
+
].join('\n');
|
|
46
62
|
}
|
|
47
63
|
// Handle array types
|
|
48
64
|
if (schema instanceof zod_1.z.ZodArray) {
|
|
49
|
-
const elementType = stringifyZodType(schema.element, level).trim();
|
|
50
|
-
return
|
|
65
|
+
const elementType = stringifyZodType(schema.element, level + 2, `${fieldName}.item`).trim();
|
|
66
|
+
return [
|
|
67
|
+
`${baseIndent}${fieldPrefix}`,
|
|
68
|
+
`${indent(level + 1)}${desc}`,
|
|
69
|
+
`${indent(level + 1)}Array<`,
|
|
70
|
+
`${indent(level + 2)}${elementType}`,
|
|
71
|
+
`${indent(level + 1)}>`,
|
|
72
|
+
].join('\n');
|
|
51
73
|
}
|
|
52
74
|
// Handle basic types (string, number, boolean, etc.)
|
|
53
75
|
if (schema instanceof zod_1.z.ZodString) {
|
|
54
|
-
return `${baseIndent}${fieldPrefix}
|
|
76
|
+
return `${baseIndent}${fieldPrefix}\n${indent(level + 1)}${desc}\n${indent(level + 1)}String`;
|
|
55
77
|
}
|
|
56
78
|
if (schema instanceof zod_1.z.ZodBoolean) {
|
|
57
|
-
return `${baseIndent}${fieldPrefix}
|
|
79
|
+
return `${baseIndent}${fieldPrefix}\n${indent(level + 1)}${desc}\n${indent(level + 1)}Boolean`;
|
|
58
80
|
}
|
|
59
81
|
if (schema instanceof zod_1.z.ZodNumber) {
|
|
60
|
-
return `${baseIndent}${fieldPrefix}
|
|
82
|
+
return `${baseIndent}${fieldPrefix}\n${indent(level + 1)}${desc}\n${indent(level + 1)}Number`;
|
|
83
|
+
}
|
|
84
|
+
if (schema instanceof zod_1.z.ZodAny) {
|
|
85
|
+
return `${baseIndent}${fieldPrefix}\n${indent(level + 1)}${desc}\n${indent(level + 1)}Any`;
|
|
61
86
|
}
|
|
62
87
|
// Add more basic types as needed (e.g., ZodDate, ZodEnum)
|
|
63
88
|
// Fallback for unknown types
|
|
64
|
-
return `${baseIndent}${fieldPrefix}
|
|
89
|
+
return `${baseIndent}${fieldPrefix}\n${indent(level + 1)}${desc}\n${indent(level + 1)}UnknownType`;
|
|
65
90
|
}
|
|
66
91
|
/**
|
|
67
92
|
* Generates a human-readable string representation of a Zod schema,
|
|
@@ -71,17 +96,7 @@ function stringifyZodType(schema, level = 0, fieldName) {
|
|
|
71
96
|
* @param schemaName A name for the root schema.
|
|
72
97
|
* @returns A string describing the schema structure and field descriptions.
|
|
73
98
|
*/
|
|
74
|
-
function
|
|
75
|
-
|
|
76
|
-
output += stringifyZodType(schema);
|
|
77
|
-
return output;
|
|
99
|
+
function stringifySchema(schema, schemaName) {
|
|
100
|
+
return stringifyZodType(schema, 0, schemaName);
|
|
78
101
|
}
|
|
79
|
-
// --- Example Usage ---
|
|
80
|
-
/*
|
|
81
|
-
console.log('--- StartupProcessSchema ---')
|
|
82
|
-
console.log(stringifySchemaForLLM(StartupProcessSchema, 'StartupProcessSchema'))
|
|
83
|
-
|
|
84
|
-
console.log('\n--- CodebuffConfigSchema ---')
|
|
85
|
-
console.log(stringifySchemaForLLM(CodebuffConfigSchema, 'CodebuffConfigSchema'))
|
|
86
|
-
*/
|
|
87
102
|
//# sourceMappingURL=stringify-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify-schema.js","sourceRoot":"","sources":["../../src/json-config/stringify-schema.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"stringify-schema.js","sourceRoot":"","sources":["../../src/json-config/stringify-schema.ts"],"names":[],"mappings":";;AAgHA,0CAKC;AArHD,6BAAmC;AAEnC,SAAS,oBAAoB,CAAC,MAAkB;IAC9C,OAAO,MAAM,CAAC,WAAW,CAAA;AAC3B,CAAC;AAED,SAAS,iBAAiB,CAAC,WAA+B;IACxD,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAA;IAC3B,OAAO,IAAI,WAAW,GAAG,CAAA;AAC3B,CAAC;AAED,SAAS,MAAM,CAAC,KAAa;IAC3B,OAAO,GAAG,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,gBAAgB,CACvB,MAAkB,EAClB,QAAgB,CAAC,EACjB,SAAkB;IAElB,MAAM,WAAW,GAAG,oBAAoB,CAAC,MAAM,CAAC,CAAA;IAChD,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAChC,MAAM,WAAW,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,SAAS,KAAK,CAAC,CAAC,CAAC,EAAE,CAAA;IACxD,MAAM,IAAI,GAAG,iBAAiB,CAAC,WAAW,CAAC,CAAA;IAE3C,sBAA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GAAG,CAAC,CAAC,GAAG,IAAI,KAAK,MAAM,CAAC,KAAK,GAAG,CAAC,CAAC,aAAa,CAAA;AACpG,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,eAAe,CAC7B,MAAwB,EACxB,UAAkB;IAElB,OAAO,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,UAAU,CAAC,CAAA;AAChD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function withLoggerContext(context: any, logger: any, callback: () => Promise<any>): Promise<any>;
|
|
@@ -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"}
|
|
@@ -7,13 +7,13 @@ export declare const usageDataSchema: z.ZodObject<{
|
|
|
7
7
|
netBalance: z.ZodNumber;
|
|
8
8
|
breakdown: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
totalDebt: number;
|
|
11
10
|
totalRemaining: number;
|
|
11
|
+
totalDebt: number;
|
|
12
12
|
netBalance: number;
|
|
13
13
|
breakdown?: Record<string, number> | undefined;
|
|
14
14
|
}, {
|
|
15
|
-
totalDebt: number;
|
|
16
15
|
totalRemaining: number;
|
|
16
|
+
totalDebt: number;
|
|
17
17
|
netBalance: number;
|
|
18
18
|
breakdown?: Record<string, number> | undefined;
|
|
19
19
|
}>;
|
|
@@ -22,8 +22,8 @@ export declare const usageDataSchema: z.ZodObject<{
|
|
|
22
22
|
}, "strip", z.ZodTypeAny, {
|
|
23
23
|
nextMonthlyGrant: number;
|
|
24
24
|
balance: {
|
|
25
|
-
totalDebt: number;
|
|
26
25
|
totalRemaining: number;
|
|
26
|
+
totalDebt: number;
|
|
27
27
|
netBalance: number;
|
|
28
28
|
breakdown?: Record<string, number> | undefined;
|
|
29
29
|
};
|
|
@@ -32,8 +32,8 @@ export declare const usageDataSchema: z.ZodObject<{
|
|
|
32
32
|
}, {
|
|
33
33
|
nextMonthlyGrant: number;
|
|
34
34
|
balance: {
|
|
35
|
-
totalDebt: number;
|
|
36
35
|
totalRemaining: number;
|
|
36
|
+
totalDebt: number;
|
|
37
37
|
netBalance: number;
|
|
38
38
|
breakdown?: Record<string, number> | undefined;
|
|
39
39
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getModelForMode(mode: string): string;
|
|
@@ -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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
@@ -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,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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.didClientUseTool = void 0;
|
|
4
|
+
const ts_pattern_1 = require("ts-pattern");
|
|
5
|
+
const constants_1 = require("src/constants");
|
|
6
|
+
const didClientUseTool = (message) => (0, ts_pattern_1.match)(message)
|
|
7
|
+
.with({
|
|
8
|
+
role: 'user',
|
|
9
|
+
content: ts_pattern_1.P.string.and(ts_pattern_1.P.when((content) => content.includes(constants_1.TOOL_RESULT_MARKER))),
|
|
10
|
+
}, () => true)
|
|
11
|
+
.otherwise(() => false);
|
|
12
|
+
exports.didClientUseTool = didClientUseTool;
|
|
13
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../../src/util/tools.ts"],"names":[],"mappings":";;;AACA,2CAAqC;AACrC,6CAAkD;AAE3C,MAAM,gBAAgB,GAAG,CAAC,OAAgB,EAAE,EAAE,CACnD,IAAA,kBAAK,EAAC,OAAO,CAAC;KACX,IAAI,CACH;IACE,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,cAAC,CAAC,MAAM,CAAC,GAAG,CACnB,cAAC,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,EAAE,CAAE,OAAkB,CAAC,QAAQ,CAAC,8BAAkB,CAAC,CAAC,CACtE;CACF,EACD,GAAG,EAAE,CAAC,IAAI,CACX;KACA,SAAS,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAA;AAXd,QAAA,gBAAgB,oBAWF"}
|