@osanoai/multicli 1.5.0
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/README.md +209 -0
- package/dist/clientFilter.d.ts +5 -0
- package/dist/clientFilter.d.ts.map +1 -0
- package/dist/clientFilter.js +27 -0
- package/dist/clientFilter.js.map +1 -0
- package/dist/constants.d.ts +88 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +90 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +205 -0
- package/dist/index.js.map +1 -0
- package/dist/modelCatalog.d.ts +14 -0
- package/dist/modelCatalog.d.ts.map +1 -0
- package/dist/modelCatalog.js +99 -0
- package/dist/modelCatalog.js.map +1 -0
- package/dist/tools/ask-claude.tool.d.ts +3 -0
- package/dist/tools/ask-claude.tool.d.ts.map +1 -0
- package/dist/tools/ask-claude.tool.js +28 -0
- package/dist/tools/ask-claude.tool.js.map +1 -0
- package/dist/tools/ask-codex.tool.d.ts +3 -0
- package/dist/tools/ask-codex.tool.d.ts.map +1 -0
- package/dist/tools/ask-codex.tool.js +27 -0
- package/dist/tools/ask-codex.tool.js.map +1 -0
- package/dist/tools/ask-gemini.tool.d.ts +3 -0
- package/dist/tools/ask-gemini.tool.d.ts.map +1 -0
- package/dist/tools/ask-gemini.tool.js +36 -0
- package/dist/tools/ask-gemini.tool.js.map +1 -0
- package/dist/tools/brainstorm-claude.tool.d.ts +3 -0
- package/dist/tools/brainstorm-claude.tool.d.ts.map +1 -0
- package/dist/tools/brainstorm-claude.tool.js +42 -0
- package/dist/tools/brainstorm-claude.tool.js.map +1 -0
- package/dist/tools/brainstorm-codex.tool.d.ts +3 -0
- package/dist/tools/brainstorm-codex.tool.d.ts.map +1 -0
- package/dist/tools/brainstorm-codex.tool.js +42 -0
- package/dist/tools/brainstorm-codex.tool.js.map +1 -0
- package/dist/tools/brainstorm.tool.d.ts +3 -0
- package/dist/tools/brainstorm.tool.d.ts.map +1 -0
- package/dist/tools/brainstorm.tool.js +42 -0
- package/dist/tools/brainstorm.tool.js.map +1 -0
- package/dist/tools/fetch-chunk.tool.d.ts +3 -0
- package/dist/tools/fetch-chunk.tool.d.ts.map +1 -0
- package/dist/tools/fetch-chunk.tool.js +58 -0
- package/dist/tools/fetch-chunk.tool.js.map +1 -0
- package/dist/tools/important-read-now.tool.d.ts +3 -0
- package/dist/tools/important-read-now.tool.d.ts.map +1 -0
- package/dist/tools/important-read-now.tool.js +31 -0
- package/dist/tools/important-read-now.tool.js.map +1 -0
- package/dist/tools/index.d.ts +8 -0
- package/dist/tools/index.d.ts.map +1 -0
- package/dist/tools/index.js +34 -0
- package/dist/tools/index.js.map +1 -0
- package/dist/tools/registry.d.ts +25 -0
- package/dist/tools/registry.d.ts.map +1 -0
- package/dist/tools/registry.js +78 -0
- package/dist/tools/registry.js.map +1 -0
- package/dist/tools/simple-tools.d.ts +8 -0
- package/dist/tools/simple-tools.d.ts.map +1 -0
- package/dist/tools/simple-tools.js +78 -0
- package/dist/tools/simple-tools.js.map +1 -0
- package/dist/tools/test-tool.example.d.ts +13 -0
- package/dist/tools/test-tool.example.d.ts.map +1 -0
- package/dist/tools/test-tool.example.js +32 -0
- package/dist/tools/test-tool.example.js.map +1 -0
- package/dist/tools/timeout-test.tool.d.ts +3 -0
- package/dist/tools/timeout-test.tool.d.ts.map +1 -0
- package/dist/tools/timeout-test.tool.js +32 -0
- package/dist/tools/timeout-test.tool.js.map +1 -0
- package/dist/utils/brainstormPromptBuilder.d.ts +11 -0
- package/dist/utils/brainstormPromptBuilder.d.ts.map +1 -0
- package/dist/utils/brainstormPromptBuilder.js +93 -0
- package/dist/utils/brainstormPromptBuilder.js.map +1 -0
- package/dist/utils/changeModeChunker.d.ts +11 -0
- package/dist/utils/changeModeChunker.d.ts.map +1 -0
- package/dist/utils/changeModeChunker.js +89 -0
- package/dist/utils/changeModeChunker.js.map +1 -0
- package/dist/utils/changeModeParser.d.ts +15 -0
- package/dist/utils/changeModeParser.d.ts.map +1 -0
- package/dist/utils/changeModeParser.js +67 -0
- package/dist/utils/changeModeParser.js.map +1 -0
- package/dist/utils/changeModeTranslator.d.ts +8 -0
- package/dist/utils/changeModeTranslator.d.ts.map +1 -0
- package/dist/utils/changeModeTranslator.js +70 -0
- package/dist/utils/changeModeTranslator.js.map +1 -0
- package/dist/utils/chunkCache.d.ts +22 -0
- package/dist/utils/chunkCache.d.ts.map +1 -0
- package/dist/utils/chunkCache.js +147 -0
- package/dist/utils/chunkCache.js.map +1 -0
- package/dist/utils/claudeExecutor.d.ts +2 -0
- package/dist/utils/claudeExecutor.d.ts.map +1 -0
- package/dist/utils/claudeExecutor.js +21 -0
- package/dist/utils/claudeExecutor.js.map +1 -0
- package/dist/utils/cliDetector.d.ts +17 -0
- package/dist/utils/cliDetector.d.ts.map +1 -0
- package/dist/utils/cliDetector.js +45 -0
- package/dist/utils/cliDetector.js.map +1 -0
- package/dist/utils/codexExecutor.d.ts +2 -0
- package/dist/utils/codexExecutor.d.ts.map +1 -0
- package/dist/utils/codexExecutor.js +19 -0
- package/dist/utils/codexExecutor.js.map +1 -0
- package/dist/utils/commandExecutor.d.ts +2 -0
- package/dist/utils/commandExecutor.d.ts.map +1 -0
- package/dist/utils/commandExecutor.js +53 -0
- package/dist/utils/commandExecutor.js.map +1 -0
- package/dist/utils/geminiExecutor.d.ts +3 -0
- package/dist/utils/geminiExecutor.d.ts.map +1 -0
- package/dist/utils/geminiExecutor.js +126 -0
- package/dist/utils/geminiExecutor.js.map +1 -0
- package/dist/utils/logger.d.ts +14 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +56 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/timeoutManager.d.ts +2 -0
- package/dist/utils/timeoutManager.d.ts.map +1 -0
- package/dist/utils/timeoutManager.js +2 -0
- package/dist/utils/timeoutManager.js.map +1 -0
- package/package.json +68 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Tool, Prompt } from "@modelcontextprotocol/sdk/types.js";
|
|
2
|
+
import { ToolArguments } from "../constants.js";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
export interface UnifiedTool {
|
|
5
|
+
name: string;
|
|
6
|
+
description: string;
|
|
7
|
+
zodSchema: z.ZodType;
|
|
8
|
+
prompt?: {
|
|
9
|
+
description: string;
|
|
10
|
+
arguments?: Array<{
|
|
11
|
+
name: string;
|
|
12
|
+
description: string;
|
|
13
|
+
required: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
};
|
|
16
|
+
execute: (args: ToolArguments, onProgress?: (newOutput: string) => void) => Promise<string>;
|
|
17
|
+
category?: 'gemini' | 'codex' | 'claude' | 'utility';
|
|
18
|
+
}
|
|
19
|
+
export declare const toolRegistry: UnifiedTool[];
|
|
20
|
+
export declare function toolExists(toolName: string): boolean;
|
|
21
|
+
export declare function getToolDefinitions(subset?: UnifiedTool[]): Tool[];
|
|
22
|
+
export declare function getPromptDefinitions(subset?: UnifiedTool[]): Prompt[];
|
|
23
|
+
export declare function executeTool(toolName: string, args: ToolArguments, onProgress?: (newOutput: string) => void): Promise<string>;
|
|
24
|
+
export declare function getPromptMessage(toolName: string, args: Record<string, any>): string;
|
|
25
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,oCAAoC,CAAC;AAElE,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,OAAO,EAAE,CAAC,EAAY,MAAM,KAAK,CAAC;AAElC,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,CAAC,CAAC,OAAO,CAAC;IAErB,MAAM,CAAC,EAAE;QACP,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,CAAC,EAAE,KAAK,CAAC;YAChB,IAAI,EAAE,MAAM,CAAC;YACb,WAAW,EAAE,MAAM,CAAC;YACpB,QAAQ,EAAE,OAAO,CAAC;SACnB,CAAC,CAAC;KACJ,CAAC;IAEF,OAAO,EAAE,CAAC,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5F,QAAQ,CAAC,EAAE,QAAQ,GAAG,OAAO,GAAG,QAAQ,GAAG,SAAS,CAAC;CACtD;AAED,eAAO,MAAM,YAAY,EAAE,WAAW,EAAO,CAAC;AAC9C,wBAAgB,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAEpD;AACD,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,CAejE;AAcD,wBAAgB,oBAAoB,CAAC,MAAM,CAAC,EAAE,WAAW,EAAE,GAAG,MAAM,EAAE,CAQrE;AAED,wBAAsB,WAAW,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,UAAU,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAgBlI;AAED,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAsBpF"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z, ZodError } from "zod";
|
|
2
|
+
export const toolRegistry = [];
|
|
3
|
+
export function toolExists(toolName) {
|
|
4
|
+
return toolRegistry.some(t => t.name === toolName);
|
|
5
|
+
}
|
|
6
|
+
export function getToolDefinitions(subset) {
|
|
7
|
+
return (subset ?? toolRegistry).map(tool => {
|
|
8
|
+
const jsonSchema = z.toJSONSchema(tool.zodSchema);
|
|
9
|
+
const inputSchema = {
|
|
10
|
+
type: "object",
|
|
11
|
+
properties: jsonSchema.properties || {},
|
|
12
|
+
required: jsonSchema.required || [],
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
name: tool.name,
|
|
16
|
+
description: tool.description,
|
|
17
|
+
inputSchema,
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
function extractPromptArguments(zodSchema) {
|
|
22
|
+
const jsonSchema = z.toJSONSchema(zodSchema);
|
|
23
|
+
const properties = jsonSchema.properties || {};
|
|
24
|
+
const required = jsonSchema.required || [];
|
|
25
|
+
return Object.entries(properties).map(([name, prop]) => ({
|
|
26
|
+
name,
|
|
27
|
+
description: prop.description || `${name} parameter`,
|
|
28
|
+
required: required.includes(name)
|
|
29
|
+
}));
|
|
30
|
+
}
|
|
31
|
+
export function getPromptDefinitions(subset) {
|
|
32
|
+
return (subset ?? toolRegistry)
|
|
33
|
+
.filter(tool => tool.prompt)
|
|
34
|
+
.map(tool => ({
|
|
35
|
+
name: tool.name,
|
|
36
|
+
description: tool.prompt.description,
|
|
37
|
+
arguments: tool.prompt.arguments || extractPromptArguments(tool.zodSchema),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
export async function executeTool(toolName, args, onProgress) {
|
|
41
|
+
const tool = toolRegistry.find(t => t.name === toolName);
|
|
42
|
+
if (!tool) {
|
|
43
|
+
throw new Error(`Unknown tool: ${toolName}`);
|
|
44
|
+
}
|
|
45
|
+
try {
|
|
46
|
+
const validatedArgs = tool.zodSchema.parse(args);
|
|
47
|
+
return tool.execute(validatedArgs, onProgress);
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error instanceof ZodError) {
|
|
51
|
+
const issues = error.issues.map(issue => `${issue.path.join('.')}: ${issue.message}`).join(', ');
|
|
52
|
+
throw new Error(`Invalid arguments for ${toolName}: ${issues}`);
|
|
53
|
+
}
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export function getPromptMessage(toolName, args) {
|
|
58
|
+
const tool = toolRegistry.find(t => t.name === toolName);
|
|
59
|
+
if (!tool?.prompt) {
|
|
60
|
+
throw new Error(`No prompt defined for tool: ${toolName}`);
|
|
61
|
+
}
|
|
62
|
+
const paramStrings = [];
|
|
63
|
+
if (args.prompt) {
|
|
64
|
+
paramStrings.push(args.prompt);
|
|
65
|
+
}
|
|
66
|
+
Object.entries(args).forEach(([key, value]) => {
|
|
67
|
+
if (key !== 'prompt' && value !== undefined && value !== null && value !== false) {
|
|
68
|
+
if (typeof value === 'boolean') {
|
|
69
|
+
paramStrings.push(`[${key}]`);
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
paramStrings.push(`(${key}: ${value})`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
return `Use the ${toolName} tool${paramStrings.length > 0 ? ': ' + paramStrings.join(' ') : ''}`;
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=registry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/tools/registry.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,QAAQ,EAAE,MAAM,KAAK,CAAC;AAoBlC,MAAM,CAAC,MAAM,YAAY,GAAkB,EAAE,CAAC;AAC9C,MAAM,UAAU,UAAU,CAAC,QAAgB;IACzC,OAAO,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC;AACrD,CAAC;AACD,MAAM,UAAU,kBAAkB,CAAC,MAAsB;IACvD,OAAO,CAAC,MAAM,IAAI,YAAY,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;QACzC,MAAM,UAAU,GAAG,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,SAAS,CAAQ,C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I,IAAI,CAAC,MAAM,EAAE,CAAC;QAChB,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACjC,CAAC;IAED,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QAC5C,IAAI,GAAG,KAAK,QAAQ,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,KAAK,EAAE,CAAC;YACjF,IAAI,OAAO,KAAK,KAAK,SAAS,EAAE,CAAC;gBAC/B,YAAY,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACN,YAAY,CAAC,IAAI,CAAC,IAAI,GAAG,KAAK,KAAK,GAAG,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,QAAQ,QAAQ,YAAY,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,YAAY,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;AACnG,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { UnifiedTool } from './registry.js';
|
|
2
|
+
export declare const geminiHelpTool: UnifiedTool;
|
|
3
|
+
export declare const codexHelpTool: UnifiedTool;
|
|
4
|
+
export declare const claudeHelpTool: UnifiedTool;
|
|
5
|
+
export declare const geminiListModelsTool: UnifiedTool;
|
|
6
|
+
export declare const codexListModelsTool: UnifiedTool;
|
|
7
|
+
export declare const claudeListModelsTool: UnifiedTool;
|
|
8
|
+
//# sourceMappingURL=simple-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"simple-tools.d.ts","sourceRoot":"","sources":["../../src/tools/simple-tools.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,eAAO,MAAM,cAAc,EAAE,WAW5B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,WAW3B,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,WAW5B,CAAC;AAIF,eAAO,MAAM,oBAAoB,EAAE,WAWlC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,WAWjC,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,WAWlC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { executeCommand } from '../utils/commandExecutor.js';
|
|
3
|
+
import { formatCatalog } from '../modelCatalog.js';
|
|
4
|
+
const helpArgsSchema = z.object({});
|
|
5
|
+
export const geminiHelpTool = {
|
|
6
|
+
name: "Gemini Help",
|
|
7
|
+
description: "Receive help information from the Gemini CLI",
|
|
8
|
+
zodSchema: helpArgsSchema,
|
|
9
|
+
prompt: {
|
|
10
|
+
description: "Receive help information from the Gemini CLI",
|
|
11
|
+
},
|
|
12
|
+
category: 'gemini',
|
|
13
|
+
execute: async (args, onProgress) => {
|
|
14
|
+
return executeCommand("gemini", ["-help"], onProgress);
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export const codexHelpTool = {
|
|
18
|
+
name: "Codex Help",
|
|
19
|
+
description: "Receive help information from the Codex CLI",
|
|
20
|
+
zodSchema: helpArgsSchema,
|
|
21
|
+
prompt: {
|
|
22
|
+
description: "Receive help information from the Codex CLI",
|
|
23
|
+
},
|
|
24
|
+
category: 'codex',
|
|
25
|
+
execute: async (args, onProgress) => {
|
|
26
|
+
return executeCommand("codex", ["--help"], onProgress);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
export const claudeHelpTool = {
|
|
30
|
+
name: "Claude Help",
|
|
31
|
+
description: "Receive help information from the Claude Code CLI",
|
|
32
|
+
zodSchema: helpArgsSchema,
|
|
33
|
+
prompt: {
|
|
34
|
+
description: "Receive help information from the Claude Code CLI",
|
|
35
|
+
},
|
|
36
|
+
category: 'claude',
|
|
37
|
+
execute: async (args, onProgress) => {
|
|
38
|
+
return executeCommand("claude", ["--help"], onProgress);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
const noArgsSchema = z.object({});
|
|
42
|
+
export const geminiListModelsTool = {
|
|
43
|
+
name: "List Gemini Models",
|
|
44
|
+
description: "List available Gemini model families, their strengths, and known model IDs. You MUST call this before Ask Gemini to choose the right model for your task. It's the law.",
|
|
45
|
+
zodSchema: noArgsSchema,
|
|
46
|
+
prompt: {
|
|
47
|
+
description: "List available Gemini models with family descriptions",
|
|
48
|
+
},
|
|
49
|
+
category: 'gemini',
|
|
50
|
+
execute: async () => {
|
|
51
|
+
return formatCatalog('gemini');
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
export const codexListModelsTool = {
|
|
55
|
+
name: "List Codex Models",
|
|
56
|
+
description: "List available Codex model families, their strengths, and known model IDs. You MUST call this before Ask Codex to choose the right model for your task. It's the law.",
|
|
57
|
+
zodSchema: noArgsSchema,
|
|
58
|
+
prompt: {
|
|
59
|
+
description: "List available Codex models with family descriptions",
|
|
60
|
+
},
|
|
61
|
+
category: 'codex',
|
|
62
|
+
execute: async () => {
|
|
63
|
+
return formatCatalog('codex');
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
export const claudeListModelsTool = {
|
|
67
|
+
name: "List Claude Models",
|
|
68
|
+
description: "List available Claude model families, their strengths, and known model IDs. You MUST call this before Ask Claude to choose the right model for your task. It's the law.",
|
|
69
|
+
zodSchema: noArgsSchema,
|
|
70
|
+
prompt: {
|
|
71
|
+
description: "List available Claude models with family descriptions",
|
|
72
|
+
},
|
|
73
|
+
category: 'claude',
|
|
74
|
+
execute: async () => {
|
|
75
|
+
return formatCatalog('claude');
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
//# sourceMappingURL=simple-tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3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QAClC,OAAO,cAAc,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,CAAC;IAC1D,CAAC;CACF,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;AAElC,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,yKAAyK;IACtL,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE;QACN,WAAW,EAAE,uDAAuD;KACrE;IACD,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAgB;IAC9C,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,uKAAuK;IACpL,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE;QACN,WAAW,EAAE,sDAAsD;KACpE;IACD,QAAQ,EAAE,OAAO;IACjB,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,OAAO,aAAa,CAAC,OAAO,CAAC,CAAC;IAChC,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,IAAI,EAAE,oBAAoB;IAC1B,WAAW,EAAE,yKAAyK;IACtL,SAAS,EAAE,YAAY;IACvB,MAAM,EAAE;QACN,WAAW,EAAE,uDAAuD;KACrE;IACD,QAAQ,EAAE,QAAQ;IAClB,OAAO,EAAE,KAAK,IAAI,EAAE;QAClB,OAAO,aAAa,CAAC,QAAQ,CAAC,CAAC;IACjC,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Adding a new tool with the unified registry
|
|
3
|
+
* To add this tool:
|
|
4
|
+
* 1. Rename this file to remove .example (test-tool.ts)
|
|
5
|
+
* 2. Import and register in src/tools/index.ts:
|
|
6
|
+
* import { testTool } from './test-tool.js';
|
|
7
|
+
* toolRegistry.push(testTool);
|
|
8
|
+
*
|
|
9
|
+
* That's it! No more editing multiple files.
|
|
10
|
+
*/
|
|
11
|
+
import { UnifiedTool } from './registry.js';
|
|
12
|
+
export declare const testTool: UnifiedTool;
|
|
13
|
+
//# sourceMappingURL=test-tool.example.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-tool.example.d.ts","sourceRoot":"","sources":["../../src/tools/test-tool.example.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,eAAO,MAAM,QAAQ,EAAE,WAgBtB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example: Adding a new tool with the unified registry
|
|
3
|
+
* To add this tool:
|
|
4
|
+
* 1. Rename this file to remove .example (test-tool.ts)
|
|
5
|
+
* 2. Import and register in src/tools/index.ts:
|
|
6
|
+
* import { testTool } from './test-tool.js';
|
|
7
|
+
* toolRegistry.push(testTool);
|
|
8
|
+
*
|
|
9
|
+
* That's it! No more editing multiple files.
|
|
10
|
+
*/
|
|
11
|
+
import { z } from 'zod';
|
|
12
|
+
const testToolArgsSchema = z.object({
|
|
13
|
+
message: z.string().describe("Test message to echo"), // Required field (no .optional())
|
|
14
|
+
});
|
|
15
|
+
export const testTool = {
|
|
16
|
+
name: "test-tool",
|
|
17
|
+
description: "A test tool demonstrating the simplified registration",
|
|
18
|
+
zodSchema: testToolArgsSchema,
|
|
19
|
+
prompt: {
|
|
20
|
+
description: "Test the new unified tool registration",
|
|
21
|
+
arguments: [{
|
|
22
|
+
name: "message",
|
|
23
|
+
description: "Message to test with",
|
|
24
|
+
required: true
|
|
25
|
+
}]
|
|
26
|
+
},
|
|
27
|
+
category: 'utility',
|
|
28
|
+
execute: async (args) => {
|
|
29
|
+
return `Test tool received: ${args.message}`;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=test-tool.example.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-tool.example.js","sourceRoot":"","sources":["../../src/tools/test-tool.example.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC;IAClC,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC,EAAE,kCAAkC;CACzF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,QAAQ,GAAgB;IACnC,IAAI,EAAE,WAAW;IACjB,WAAW,EAAE,uDAAuD;IACpE,SAAS,EAAE,kBAAkB;IAC7B,MAAM,EAAE;QACN,WAAW,EAAE,wCAAwC;QACrD,SAAS,EAAE,CAAC;gBACV,IAAI,EAAE,SAAS;gBACf,WAAW,EAAE,sBAAsB;gBACnC,QAAQ,EAAE,IAAI;aACf,CAAC;KACH;IACD,QAAQ,EAAE,SAAS;IACnB,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE;QACtB,OAAO,uBAAuB,IAAI,CAAC,OAAO,EAAE,CAAC;IAC/C,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout-test.tool.d.ts","sourceRoot":"","sources":["../../src/tools/timeout-test.tool.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAM5C,eAAO,MAAM,eAAe,EAAE,WA8B7B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
const timeoutTestArgsSchema = z.object({
|
|
3
|
+
duration: z.number().min(10).describe("Duration in milliseconds (minimum 10ms)"),
|
|
4
|
+
});
|
|
5
|
+
export const timeoutTestTool = {
|
|
6
|
+
name: "timeout-test",
|
|
7
|
+
description: "Test timeout prevention by running for a specified duration",
|
|
8
|
+
zodSchema: timeoutTestArgsSchema,
|
|
9
|
+
prompt: {
|
|
10
|
+
description: "Test the timeout prevention system by running a long operation",
|
|
11
|
+
},
|
|
12
|
+
category: 'simple',
|
|
13
|
+
execute: async (args, onProgress) => {
|
|
14
|
+
const duration = args.duration;
|
|
15
|
+
const steps = Math.ceil(duration / 5000); // Progress every 5 seconds
|
|
16
|
+
const stepDuration = duration / steps;
|
|
17
|
+
const startTime = Date.now();
|
|
18
|
+
const results = [];
|
|
19
|
+
results.push(`Starting timeout test for ${duration}ms (${duration / 1000}s)`);
|
|
20
|
+
for (let i = 1; i <= steps; i++) {
|
|
21
|
+
await new Promise(resolve => setTimeout(resolve, stepDuration));
|
|
22
|
+
const elapsed = Date.now() - startTime;
|
|
23
|
+
results.push(`Step ${i}/${steps} completed - Elapsed: ${Math.round(elapsed / 1000)}s`);
|
|
24
|
+
}
|
|
25
|
+
const totalElapsed = Date.now() - startTime;
|
|
26
|
+
results.push(`\nTimeout test completed successfully!`);
|
|
27
|
+
results.push(`Target duration: ${duration}ms`);
|
|
28
|
+
results.push(`Actual duration: ${totalElapsed}ms`);
|
|
29
|
+
return results.join('\n');
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=timeout-test.tool.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"timeout-test.tool.js","sourceRoot":"","sources":["../../src/tools/timeout-test.tool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,yCAAyC,CAAC;CACjF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,eAAe,GAAgB;IAC1C,IA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D,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface BrainstormArgs {
|
|
2
|
+
prompt: string;
|
|
3
|
+
methodology: string;
|
|
4
|
+
domain?: string;
|
|
5
|
+
constraints?: string;
|
|
6
|
+
existingContext?: string;
|
|
7
|
+
ideaCount: number;
|
|
8
|
+
includeAnalysis: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function buildBrainstormPrompt(args: BrainstormArgs): string;
|
|
11
|
+
//# sourceMappingURL=brainstormPromptBuilder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brainstormPromptBuilder.d.ts","sourceRoot":"","sources":["../../src/utils/brainstormPromptBuilder.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,OAAO,CAAC;CAC1B;AAsDD,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,cAAc,GAAG,MAAM,CAiDlE"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns methodology-specific instructions for structured brainstorming
|
|
3
|
+
*/
|
|
4
|
+
function getMethodologyInstructions(methodology, domain) {
|
|
5
|
+
const methodologies = {
|
|
6
|
+
'divergent': `**Divergent Thinking Approach:**
|
|
7
|
+
- Generate maximum quantity of ideas without self-censoring
|
|
8
|
+
- Build on wild or seemingly impractical ideas
|
|
9
|
+
- Combine unrelated concepts for unexpected solutions
|
|
10
|
+
- Use "Yes, and..." thinking to expand each concept
|
|
11
|
+
- Postpone evaluation until all ideas are generated`,
|
|
12
|
+
'convergent': `**Convergent Thinking Approach:**
|
|
13
|
+
- Focus on refining and improving existing concepts
|
|
14
|
+
- Synthesize related ideas into stronger solutions
|
|
15
|
+
- Apply critical evaluation criteria
|
|
16
|
+
- Prioritize based on feasibility and impact
|
|
17
|
+
- Develop implementation pathways for top ideas`,
|
|
18
|
+
'scamper': `**SCAMPER Creative Triggers:**
|
|
19
|
+
- **Substitute:** What can be substituted or replaced?
|
|
20
|
+
- **Combine:** What can be combined or merged?
|
|
21
|
+
- **Adapt:** What can be adapted from other domains?
|
|
22
|
+
- **Modify:** What can be magnified, minimized, or altered?
|
|
23
|
+
- **Put to other use:** How else can this be used?
|
|
24
|
+
- **Eliminate:** What can be removed or simplified?
|
|
25
|
+
- **Reverse:** What can be rearranged or reversed?`,
|
|
26
|
+
'design-thinking': `**Human-Centered Design Thinking:**
|
|
27
|
+
- **Empathize:** Consider user needs, pain points, and contexts
|
|
28
|
+
- **Define:** Frame problems from user perspective
|
|
29
|
+
- **Ideate:** Generate user-focused solutions
|
|
30
|
+
- **Consider Journey:** Think through complete user experience
|
|
31
|
+
- **Prototype Mindset:** Focus on testable, iterative concepts`,
|
|
32
|
+
'lateral': `**Lateral Thinking Approach:**
|
|
33
|
+
- Make unexpected connections between unrelated fields
|
|
34
|
+
- Challenge fundamental assumptions
|
|
35
|
+
- Use random word association to trigger new directions
|
|
36
|
+
- Apply metaphors and analogies from other domains
|
|
37
|
+
- Reverse conventional thinking patterns`,
|
|
38
|
+
'auto': `**AI-Optimized Approach:**
|
|
39
|
+
${domain ? `Given the ${domain} domain, I'll apply the most effective combination of:` : 'I\'ll intelligently combine multiple methodologies:'}
|
|
40
|
+
- Divergent exploration with domain-specific knowledge
|
|
41
|
+
- SCAMPER triggers and lateral thinking
|
|
42
|
+
- Human-centered perspective for practical value`
|
|
43
|
+
};
|
|
44
|
+
return methodologies[methodology] || methodologies['auto'];
|
|
45
|
+
}
|
|
46
|
+
export function buildBrainstormPrompt(args) {
|
|
47
|
+
const { prompt, methodology, domain, constraints, existingContext, ideaCount, includeAnalysis } = args;
|
|
48
|
+
const frameworkInstructions = getMethodologyInstructions(methodology, domain);
|
|
49
|
+
const enhancedPrompt = `# BRAINSTORMING SESSION
|
|
50
|
+
|
|
51
|
+
## Core Challenge
|
|
52
|
+
${prompt}
|
|
53
|
+
|
|
54
|
+
## Methodology Framework
|
|
55
|
+
${frameworkInstructions}
|
|
56
|
+
|
|
57
|
+
## Context Engineering
|
|
58
|
+
*Use the following context to inform your reasoning:*
|
|
59
|
+
${domain ? `**Domain Focus:** ${domain} - Apply domain-specific knowledge, terminology, and best practices.` : ''}
|
|
60
|
+
${constraints ? `**Constraints & Boundaries:** ${constraints}` : ''}
|
|
61
|
+
${existingContext ? `**Background Context:** ${existingContext}` : ''}
|
|
62
|
+
|
|
63
|
+
## Output Requirements
|
|
64
|
+
- Generate ${ideaCount} distinct, creative ideas
|
|
65
|
+
- Each idea should be unique and non-obvious
|
|
66
|
+
- Focus on actionable, implementable concepts
|
|
67
|
+
- Use clear, descriptive naming
|
|
68
|
+
- Provide brief explanations for each idea
|
|
69
|
+
|
|
70
|
+
${includeAnalysis ? `
|
|
71
|
+
## Analysis Framework
|
|
72
|
+
For each idea, provide:
|
|
73
|
+
- **Feasibility:** Implementation difficulty (1-5 scale)
|
|
74
|
+
- **Impact:** Potential value/benefit (1-5 scale)
|
|
75
|
+
- **Innovation:** Uniqueness/creativity (1-5 scale)
|
|
76
|
+
- **Quick Assessment:** One-sentence evaluation
|
|
77
|
+
` : ''}
|
|
78
|
+
|
|
79
|
+
## Format
|
|
80
|
+
Present ideas in a structured format:
|
|
81
|
+
|
|
82
|
+
### Idea [N]: [Creative Name]
|
|
83
|
+
**Description:** [2-3 sentence explanation]
|
|
84
|
+
${includeAnalysis ? '**Feasibility:** [1-5] | **Impact:** [1-5] | **Innovation:** [1-5]\n**Assessment:** [Brief evaluation]' : ''}
|
|
85
|
+
|
|
86
|
+
---
|
|
87
|
+
|
|
88
|
+
**Before finalizing, review the list: remove near-duplicates and ensure each idea satisfies the constraints.**
|
|
89
|
+
|
|
90
|
+
Begin brainstorming session:`;
|
|
91
|
+
return enhancedPrompt;
|
|
92
|
+
}
|
|
93
|
+
//# sourceMappingURL=brainstormPromptBuilder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brainstormPromptBuilder.js","sourceRoot":"","sources":["../../src/utils/brainstormPromptBuilder.ts"],"names":[],"mappings":"AAUA;;GAEG;AACH,SAAS,0BAA0B,CAAC,WAAmB,EAAE,MAAe;IACtE,MAAM,aAAa,GAA2B;QAC5C,WAAW,EAAE;;;;;oDAKmC;QAEhD,YAAY,EAAE;;;;;gDAK8B;QAE5C,SAAS,EAAE;;;;;;;mDAOoC;QAE/C,iBAAiB,EAAE;;;;;+DAKwC;QAE3D,SAAS,EAAE;;;;;yCAK0B;QAErC,MAAM,EAAE;EACV,MAAM,CAAC,CAAC,CAAC,aAAa,MAAM,wDAAwD,CAAC,CAAC,CAAC,qDAAqD;;;iDAG7F;KAC9C,CAAC;IAEF,OAAO,aAAa,CAAC,WAAW,CAAC,IAAI,aAAa,CAAC,MAAM,CAAC,CAAC;AAC7D,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,IAAoB;IACxD,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,EAAE,eAAe,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,IAAI,CAAC;IAEvG,MAAM,qBAAqB,GAAG,0BAA0B,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;IAE9E,MAAM,cAAc,GAAG;;;EAGvB,MAAM;;;EAGN,qBAAqB;;;;EAIrB,MAAM,CAAC,CAAC,CAAC,qBAAqB,MAAM,sEAAsE,CAAC,CAAC,CAAC,EAAE;EAC/G,WAAW,CAAC,CAAC,CAAC,iCAAiC,WAAW,EAAE,CAAC,CAAC,CAAC,EAAE;EACjE,eAAe,CAAC,CAAC,CAAC,2BAA2B,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE;;;aAGxD,SAAS;;;;;;EAMpB,eAAe,CAAC,CAAC,CAAC;;;;;;;CAOnB,CAAC,CAAC,CAAC,EAAE;;;;;;;EAOJ,eAAe,CAAC,CAAC,CAAC,wGAAwG,CAAC,CAAC,CAAC,EAAE;;;;;;6BAMpG,CAAC;IAE5B,OAAO,cAAc,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ChangeModeEdit } from './changeModeParser.js';
|
|
2
|
+
export interface EditChunk {
|
|
3
|
+
edits: ChangeModeEdit[];
|
|
4
|
+
chunkIndex: number;
|
|
5
|
+
totalChunks: number;
|
|
6
|
+
hasMore: boolean;
|
|
7
|
+
estimatedChars: number;
|
|
8
|
+
}
|
|
9
|
+
export declare function chunkChangeModeEdits(edits: ChangeModeEdit[], maxCharsPerChunk?: number): EditChunk[];
|
|
10
|
+
export declare function summarizeChunking(chunks: EditChunk[]): string;
|
|
11
|
+
//# sourceMappingURL=changeModeChunker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeChunker.d.ts","sourceRoot":"","sources":["../../src/utils/changeModeChunker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,cAAc,EAAE,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;CACxB;AAiBD,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,cAAc,EAAE,EACvB,gBAAgB,GAAE,MAAc,GAC/B,SAAS,EAAE,CAyDb;AAgBD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAc7D"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function estimateEditSize(edit) {
|
|
2
|
+
const jsonOverhead = 250;
|
|
3
|
+
const contentSize = edit.filename.length * 2 + edit.oldCode.length + edit.newCode.length;
|
|
4
|
+
return jsonOverhead + contentSize;
|
|
5
|
+
}
|
|
6
|
+
function groupEditsByFile(edits) {
|
|
7
|
+
const groups = new Map();
|
|
8
|
+
for (const edit of edits) {
|
|
9
|
+
const fileEdits = groups.get(edit.filename) || [];
|
|
10
|
+
fileEdits.push(edit);
|
|
11
|
+
groups.set(edit.filename, fileEdits);
|
|
12
|
+
}
|
|
13
|
+
return groups;
|
|
14
|
+
}
|
|
15
|
+
export function chunkChangeModeEdits(edits, maxCharsPerChunk = 20000) {
|
|
16
|
+
if (edits.length === 0) {
|
|
17
|
+
return [{
|
|
18
|
+
edits: [],
|
|
19
|
+
chunkIndex: 1,
|
|
20
|
+
totalChunks: 1,
|
|
21
|
+
hasMore: false,
|
|
22
|
+
estimatedChars: 0
|
|
23
|
+
}];
|
|
24
|
+
}
|
|
25
|
+
const chunks = [];
|
|
26
|
+
const fileGroups = groupEditsByFile(edits);
|
|
27
|
+
let currentChunk = [];
|
|
28
|
+
let currentSize = 0;
|
|
29
|
+
for (const [, fileEdits] of fileGroups) {
|
|
30
|
+
const fileSize = fileEdits.reduce((sum, edit) => sum + estimateEditSize(edit), 0);
|
|
31
|
+
if (fileSize > maxCharsPerChunk) {
|
|
32
|
+
if (currentChunk.length > 0) {
|
|
33
|
+
chunks.push(createChunk(currentChunk, chunks.length + 1, 0, currentSize));
|
|
34
|
+
currentChunk = [];
|
|
35
|
+
currentSize = 0;
|
|
36
|
+
}
|
|
37
|
+
for (const edit of fileEdits) {
|
|
38
|
+
const editSize = estimateEditSize(edit);
|
|
39
|
+
if (currentSize + editSize > maxCharsPerChunk && currentChunk.length > 0) {
|
|
40
|
+
chunks.push(createChunk(currentChunk, chunks.length + 1, 0, currentSize));
|
|
41
|
+
currentChunk = [];
|
|
42
|
+
currentSize = 0;
|
|
43
|
+
}
|
|
44
|
+
currentChunk.push(edit);
|
|
45
|
+
currentSize += editSize;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
if (currentSize + fileSize > maxCharsPerChunk && currentChunk.length > 0) {
|
|
50
|
+
chunks.push(createChunk(currentChunk, chunks.length + 1, 0, currentSize));
|
|
51
|
+
currentChunk = [];
|
|
52
|
+
currentSize = 0;
|
|
53
|
+
}
|
|
54
|
+
currentChunk.push(...fileEdits);
|
|
55
|
+
currentSize += fileSize;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
if (currentChunk.length > 0) {
|
|
59
|
+
chunks.push(createChunk(currentChunk, chunks.length + 1, 0, currentSize));
|
|
60
|
+
}
|
|
61
|
+
const totalChunks = chunks.length;
|
|
62
|
+
return chunks.map((chunk, index) => ({
|
|
63
|
+
...chunk,
|
|
64
|
+
totalChunks,
|
|
65
|
+
hasMore: index < totalChunks - 1
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
function createChunk(edits, chunkIndex, totalChunks, estimatedChars) {
|
|
69
|
+
return {
|
|
70
|
+
edits,
|
|
71
|
+
chunkIndex,
|
|
72
|
+
totalChunks,
|
|
73
|
+
hasMore: false,
|
|
74
|
+
estimatedChars
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
export function summarizeChunking(chunks) {
|
|
78
|
+
const totalEdits = chunks.reduce((sum, chunk) => sum + chunk.edits.length, 0);
|
|
79
|
+
const totalChars = chunks.reduce((sum, chunk) => sum + chunk.estimatedChars, 0);
|
|
80
|
+
return `Chunking Summary:
|
|
81
|
+
# edits: ${totalEdits}
|
|
82
|
+
# chunks: ${chunks.length}
|
|
83
|
+
est chars: ${totalChars.toLocaleString()}
|
|
84
|
+
mean size: ${chunks.length === 0 ? 0 : Math.round(totalChars / chunks.length).toLocaleString()} chars
|
|
85
|
+
|
|
86
|
+
Chunks:
|
|
87
|
+
${chunks.map(chunk => ` Chunk ${chunk.chunkIndex}: ${chunk.edits.length} edits, ~${chunk.estimatedChars.toLocaleString()} chars`).join('\n')}`;
|
|
88
|
+
}
|
|
89
|
+
//# sourceMappingURL=changeModeChunker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeChunker.js","sourceRoot":"","sources":["../../src/utils/changeModeChunker.ts"],"names":[],"mappings":"AAUA,SAAS,gBAAgB,CAAC,IAAoB;IAC5C,MAAM,YAAY,GAAG,GAAG,CAAC;IACzB,MAAM,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;IACzF,OAAO,YAAY,GAAG,WAAW,CAAC;AACpC,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAuB;IAC/C,MAAM,MAAM,GAAG,IAAI,GAAG,EAA4B,CAAC;IACnD,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACrB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AACD,MAAM,UAAU,oBAAoB,CAClC,KAAuB,EACvB,mBAA2B,KAAK;IAEhC,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,CAAC;gBACN,KAAK,EAAE,EAAE;gBACT,UAAU,EAAE,CAAC;gBACb,WAAW,EAAE,CAAC;gBACd,OAAO,EAAE,KAAK;gBACd,cAAc,EAAE,CAAC;aAClB,CAAC,CAAC;IACL,CAAC;IAED,MAAM,MAAM,GAAgB,EAAE,CAAC;IAC/B,MAAM,UAAU,GAAG,gBAAgB,CAAC,KAAK,CAAC,CAAC;IA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AC,CAAC;IAEhF,OAAO;WACE,UAAU;YACT,MAAM,CAAC,MAAM;aACZ,UAAU,CAAC,cAAc,EAAE;aAC3B,MAAM,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,cAAc,EAAE;;;EAG5F,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CACnB,WAAW,KAAK,CAAC,UAAU,KAAK,KAAK,CAAC,KAAK,CAAC,MAAM,YAAY,KAAK,CAAC,cAAc,CAAC,cAAc,EAAE,QAAQ,CAC5G,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ChangeModeEdit {
|
|
2
|
+
filename: string;
|
|
3
|
+
oldStartLine: number;
|
|
4
|
+
oldEndLine: number;
|
|
5
|
+
oldCode: string;
|
|
6
|
+
newStartLine: number;
|
|
7
|
+
newEndLine: number;
|
|
8
|
+
newCode: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function parseChangeModeOutput(geminiResponse: string): ChangeModeEdit[];
|
|
11
|
+
export declare function validateChangeModeEdits(edits: ChangeModeEdit[]): {
|
|
12
|
+
valid: boolean;
|
|
13
|
+
errors: string[];
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=changeModeParser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeParser.d.ts","sourceRoot":"","sources":["../../src/utils/changeModeParser.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AACD,wBAAgB,qBAAqB,CAAC,cAAc,EAAE,MAAM,GAAG,cAAc,EAAE,CAiE9E;AACD,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,cAAc,EAAE,GAAG;IAChE,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAyBA"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
export function parseChangeModeOutput(geminiResponse) {
|
|
2
|
+
const edits = [];
|
|
3
|
+
const markdownPattern = /\*\*FILE:\s*(.+?):(\d+)\*\*\s*\n```\s*\nOLD:\s*\n([\s\S]*?)\nNEW:\s*\n([\s\S]*?)\n```/g;
|
|
4
|
+
let match;
|
|
5
|
+
while ((match = markdownPattern.exec(geminiResponse)) !== null) {
|
|
6
|
+
const [_fullMatch, filename, startLineStr, oldCodeRaw, newCodeRaw] = match;
|
|
7
|
+
const oldCode = oldCodeRaw.trimEnd();
|
|
8
|
+
const newCode = newCodeRaw.trimEnd();
|
|
9
|
+
const startLine = parseInt(startLineStr, 10);
|
|
10
|
+
const oldLineCount = oldCode === '' ? 0 : oldCode.split('\n').length;
|
|
11
|
+
const newLineCount = newCode === '' ? 0 : newCode.split('\n').length;
|
|
12
|
+
const oldEndLine = startLine + (oldLineCount > 0 ? oldLineCount - 1 : 0);
|
|
13
|
+
const newStartLine = startLine;
|
|
14
|
+
const newEndLine = newStartLine + (newLineCount > 0 ? newLineCount - 1 : 0);
|
|
15
|
+
edits.push({
|
|
16
|
+
filename: filename.trim(),
|
|
17
|
+
oldStartLine: startLine,
|
|
18
|
+
oldEndLine: oldEndLine,
|
|
19
|
+
oldCode: oldCode,
|
|
20
|
+
newStartLine: newStartLine,
|
|
21
|
+
newEndLine: newEndLine,
|
|
22
|
+
newCode: newCode,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
if (edits.length === 0) {
|
|
26
|
+
const editPattern = /\/old\/ \* (.+?) 'start:' (\d+)\n([\s\S]*?)\n\/\/ 'end:' (\d+)\s*\n\s*\\new\\ \* (.+?) 'start:' (\d+)\n([\s\S]*?)\n\/\/ 'end:' (\d+)/g;
|
|
27
|
+
while ((match = editPattern.exec(geminiResponse)) !== null) {
|
|
28
|
+
const [_fullMatch, oldFilename, oldStartLine, oldCode, oldEndLine, newFilename, newStartLine, newCode, newEndLine,] = match;
|
|
29
|
+
if (oldFilename !== newFilename) {
|
|
30
|
+
console.warn(`[changeModeParser] Filename mismatch: ${oldFilename} vs ${newFilename}`);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
edits.push({
|
|
34
|
+
filename: oldFilename.trim(),
|
|
35
|
+
oldStartLine: parseInt(oldStartLine, 10),
|
|
36
|
+
oldEndLine: parseInt(oldEndLine, 10),
|
|
37
|
+
oldCode: oldCode.trimEnd(),
|
|
38
|
+
newStartLine: parseInt(newStartLine, 10),
|
|
39
|
+
newEndLine: parseInt(newEndLine, 10),
|
|
40
|
+
newCode: newCode.trimEnd(),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return edits;
|
|
45
|
+
}
|
|
46
|
+
export function validateChangeModeEdits(edits) {
|
|
47
|
+
const errors = [];
|
|
48
|
+
for (const edit of edits) {
|
|
49
|
+
if (!edit.filename) {
|
|
50
|
+
errors.push('Edit missing filename');
|
|
51
|
+
}
|
|
52
|
+
if (edit.oldStartLine > edit.oldEndLine) {
|
|
53
|
+
errors.push(`Invalid line range for ${edit.filename}: ${edit.oldStartLine} > ${edit.oldEndLine}`);
|
|
54
|
+
}
|
|
55
|
+
if (edit.newStartLine > edit.newEndLine) {
|
|
56
|
+
errors.push(`Invalid new line range for ${edit.filename}: ${edit.newStartLine} > ${edit.newEndLine}`);
|
|
57
|
+
}
|
|
58
|
+
if (!edit.oldCode && !edit.newCode) {
|
|
59
|
+
errors.push(`Empty edit for ${edit.filename}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return {
|
|
63
|
+
valid: errors.length === 0,
|
|
64
|
+
errors,
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=changeModeParser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"changeModeParser.js","sourceRoot":"","sources":["../../src/utils/changeModeParser.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,qBAAqB,CAAC,cAAsB;IAC1D,MAAM,KAAK,GAAqB,EAAE,CAAC;IACnC,MAAM,eAAe,GAAG,wFAAwF,CAAC;IAEjH,IAAI,KAAK,CAAC;IACV,OAAO,CAAC,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QAC/D,MAAM,CAAC,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,UAAU,CAAC,GAAG,KAAK,CAAC;QAE3E,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,UAAU,CAAC,OAAO,EAAE,CAAC;QACrC,MAAM,SAAS,GAAG,QAAQ,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;QAE7C,MAAM,YAAY,GAAG,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QACrE,MAAM,YAAY,GAAG,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAErE,MAAM,UAAU,GAAG,SAAS,GAAG,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,YAAY,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAEzE,MAAM,YAAY,GAAG,SAAS,CAAC;QAC/B,MAAM,UAAU,GAAG,YAAY,GAAG,CAAC,YAAY,GAAG,C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