@clinebot/core 0.0.12 → 0.0.14
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 +1 -1
- package/dist/agents/plugin-loader.d.ts +1 -0
- package/dist/index.node.d.ts +4 -0
- package/dist/index.node.js +216 -195
- package/dist/runtime/commands.d.ts +11 -0
- package/dist/runtime/skills.d.ts +13 -0
- package/dist/session/session-service.d.ts +22 -22
- package/dist/session/unified-session-persistence-service.d.ts +6 -6
- package/dist/session/utils/helpers.d.ts +2 -2
- package/dist/tools/schemas.d.ts +1 -0
- package/package.json +7 -5
- package/src/agents/plugin-loader.test.ts +11 -11
- package/src/agents/plugin-loader.ts +5 -3
- package/src/auth/cline.ts +1 -29
- package/src/index.node.ts +10 -0
- package/src/runtime/commands.test.ts +98 -0
- package/src/runtime/commands.ts +83 -0
- package/src/runtime/index.ts +10 -0
- package/src/runtime/skills.ts +44 -0
- package/src/runtime/workflows.ts +20 -29
- package/src/session/default-session-manager.e2e.test.ts +32 -32
- package/src/session/default-session-manager.ts +10 -12
- package/src/session/rpc-session-service.ts +14 -96
- package/src/session/session-service.ts +127 -64
- package/src/session/unified-session-persistence-service.test.ts +3 -3
- package/src/session/unified-session-persistence-service.ts +114 -141
- package/src/session/utils/helpers.ts +22 -41
- package/src/tools/definitions.test.ts +50 -0
- package/src/tools/definitions.ts +26 -0
- package/src/tools/schemas.ts +5 -6
package/src/tools/definitions.ts
CHANGED
|
@@ -16,6 +16,7 @@ import {
|
|
|
16
16
|
EditFileInputSchema,
|
|
17
17
|
type FetchWebContentInput,
|
|
18
18
|
FetchWebContentInputSchema,
|
|
19
|
+
INPUT_ARG_CHAR_LIMIT,
|
|
19
20
|
type ReadFileRequest,
|
|
20
21
|
type ReadFilesInput,
|
|
21
22
|
ReadFilesInputSchema,
|
|
@@ -57,6 +58,21 @@ function formatError(error: unknown): string {
|
|
|
57
58
|
return String(error);
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
function getEditorSizeError(input: EditFileInput): string | null {
|
|
62
|
+
if (
|
|
63
|
+
typeof input.old_text === "string" &&
|
|
64
|
+
input.old_text.length > INPUT_ARG_CHAR_LIMIT
|
|
65
|
+
) {
|
|
66
|
+
return `Editor input too large: old_text was ${input.old_text.length} characters, exceeding the recommended limit of ${INPUT_ARG_CHAR_LIMIT}. Split the edit into smaller tool calls so later tool calls are less likely to be truncated or time out.`;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (input.new_text.length > INPUT_ARG_CHAR_LIMIT) {
|
|
70
|
+
return `Editor input too large: new_text was ${input.new_text.length} characters, exceeding the recommended limit of ${INPUT_ARG_CHAR_LIMIT}. Split the edit into smaller tool calls so later tool calls are less likely to be truncated or time out.`;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return null;
|
|
74
|
+
}
|
|
75
|
+
|
|
60
76
|
/**
|
|
61
77
|
* Create a timeout-wrapped promise
|
|
62
78
|
*/
|
|
@@ -480,6 +496,16 @@ export function createEditorTool(
|
|
|
480
496
|
execute: async (input, context) => {
|
|
481
497
|
const validatedInput = validateWithZod(EditFileInputSchema, input);
|
|
482
498
|
const operation = validatedInput.insert_line == null ? "edit" : "insert";
|
|
499
|
+
const sizeError = getEditorSizeError(validatedInput);
|
|
500
|
+
|
|
501
|
+
if (sizeError) {
|
|
502
|
+
return {
|
|
503
|
+
query: `${operation}:${validatedInput.path}`,
|
|
504
|
+
result: "",
|
|
505
|
+
error: sizeError,
|
|
506
|
+
success: false,
|
|
507
|
+
};
|
|
508
|
+
}
|
|
483
509
|
|
|
484
510
|
try {
|
|
485
511
|
const result = await withTimeout(
|
package/src/tools/schemas.ts
CHANGED
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
|
|
10
|
+
export const INPUT_ARG_CHAR_LIMIT = 6000;
|
|
11
|
+
|
|
10
12
|
/**
|
|
11
13
|
* Schema for read tool input
|
|
12
14
|
*/
|
|
@@ -105,9 +107,8 @@ export const SearchCodebaseUnionInputSchema = z.union([
|
|
|
105
107
|
|
|
106
108
|
const CommandInputSchema = z
|
|
107
109
|
.string()
|
|
108
|
-
.max(2000)
|
|
109
110
|
.describe(
|
|
110
|
-
|
|
111
|
+
`The non-interactive shell command to execute - MUST keep input short and concise (within ${INPUT_ARG_CHAR_LIMIT * 2} characters) to avoid timeouts.`,
|
|
111
112
|
);
|
|
112
113
|
/**
|
|
113
114
|
* Schema for run_commands tool input
|
|
@@ -156,17 +157,15 @@ export const EditFileInputSchema = z
|
|
|
156
157
|
.describe("The absolute file path for the action to be performed on"),
|
|
157
158
|
old_text: z
|
|
158
159
|
.string()
|
|
159
|
-
.max(3000)
|
|
160
160
|
.nullable()
|
|
161
161
|
.optional()
|
|
162
162
|
.describe(
|
|
163
|
-
|
|
163
|
+
`Exact text to replace (must match exactly once). Omit this when creating a missing file or inserting via insert_line. Keep this at or below ${INPUT_ARG_CHAR_LIMIT} characters when possible; larger payloads should be split across multiple tool calls to avoid timeouts.`,
|
|
164
164
|
),
|
|
165
165
|
new_text: z
|
|
166
166
|
.string()
|
|
167
|
-
.max(3000)
|
|
168
167
|
.describe(
|
|
169
|
-
|
|
168
|
+
`The new content to write when creating a missing file, the replacement text for edits, or the inserted text when insert_line is provided. Keep this at or below ${INPUT_ARG_CHAR_LIMIT} characters when possible; for large edits, use multiple calls with small chunks of old_text and new_text to iteratively edit the file.`,
|
|
170
169
|
),
|
|
171
170
|
insert_line: z
|
|
172
171
|
.number()
|