@clinebot/core 0.0.11 → 0.0.13
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/agent-config-loader.d.ts +1 -1
- package/dist/agents/agent-config-parser.d.ts +5 -2
- package/dist/agents/index.d.ts +1 -1
- package/dist/agents/plugin-config-loader.d.ts +4 -0
- package/dist/agents/plugin-loader.d.ts +1 -0
- package/dist/agents/plugin-sandbox-bootstrap.js +446 -0
- package/dist/agents/plugin-sandbox.d.ts +4 -0
- package/dist/index.node.d.ts +5 -0
- package/dist/index.node.js +685 -413
- package/dist/runtime/commands.d.ts +11 -0
- package/dist/runtime/sandbox/subprocess-sandbox.d.ts +8 -1
- package/dist/runtime/skills.d.ts +13 -0
- package/dist/session/default-session-manager.d.ts +5 -0
- package/dist/session/session-config-builder.d.ts +4 -1
- package/dist/session/session-manager.d.ts +1 -0
- package/dist/session/session-service.d.ts +22 -22
- package/dist/session/unified-session-persistence-service.d.ts +12 -6
- package/dist/session/utils/helpers.d.ts +2 -2
- package/dist/session/utils/types.d.ts +9 -0
- package/dist/tools/definitions.d.ts +2 -2
- package/dist/tools/presets.d.ts +3 -3
- package/dist/tools/schemas.d.ts +15 -14
- package/dist/types/config.d.ts +5 -0
- package/dist/types/events.d.ts +22 -0
- package/package.json +5 -4
- package/src/agents/agent-config-loader.test.ts +2 -0
- package/src/agents/agent-config-loader.ts +1 -0
- package/src/agents/agent-config-parser.ts +12 -5
- package/src/agents/index.ts +1 -0
- package/src/agents/plugin-config-loader.test.ts +49 -0
- package/src/agents/plugin-config-loader.ts +10 -73
- package/src/agents/plugin-loader.test.ts +127 -1
- package/src/agents/plugin-loader.ts +72 -5
- package/src/agents/plugin-sandbox-bootstrap.ts +445 -0
- package/src/agents/plugin-sandbox.test.ts +198 -1
- package/src/agents/plugin-sandbox.ts +223 -353
- package/src/index.node.ts +14 -0
- package/src/runtime/commands.test.ts +98 -0
- package/src/runtime/commands.ts +83 -0
- package/src/runtime/hook-file-hooks.test.ts +1 -1
- package/src/runtime/hook-file-hooks.ts +16 -6
- package/src/runtime/index.ts +10 -0
- package/src/runtime/runtime-builder.test.ts +67 -0
- package/src/runtime/runtime-builder.ts +70 -16
- package/src/runtime/sandbox/subprocess-sandbox.ts +35 -11
- package/src/runtime/skills.ts +44 -0
- package/src/runtime/workflows.ts +20 -29
- package/src/session/default-session-manager.e2e.test.ts +52 -33
- package/src/session/default-session-manager.test.ts +453 -1
- package/src/session/default-session-manager.ts +210 -12
- package/src/session/rpc-session-service.ts +14 -96
- package/src/session/session-config-builder.ts +2 -0
- package/src/session/session-manager.ts +1 -0
- package/src/session/session-service.ts +127 -64
- package/src/session/session-team-coordination.ts +30 -0
- package/src/session/unified-session-persistence-service.test.ts +3 -3
- package/src/session/unified-session-persistence-service.ts +159 -141
- package/src/session/utils/helpers.ts +22 -41
- package/src/session/utils/types.ts +10 -0
- package/src/storage/sqlite-team-store.ts +16 -5
- package/src/tools/definitions.test.ts +137 -8
- package/src/tools/definitions.ts +115 -70
- package/src/tools/presets.test.ts +2 -3
- package/src/tools/presets.ts +3 -3
- package/src/tools/schemas.ts +28 -28
- package/src/types/config.ts +5 -0
- package/src/types/events.ts +23 -0
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
|
*/
|
|
@@ -20,20 +22,24 @@ export const ReadFileLineRangeSchema = z
|
|
|
20
22
|
.number()
|
|
21
23
|
.int()
|
|
22
24
|
.positive()
|
|
25
|
+
.nullable()
|
|
23
26
|
.optional()
|
|
24
|
-
.describe(
|
|
27
|
+
.describe(
|
|
28
|
+
"Optional one-based starting line number to read from; use null or omit for the start of the file",
|
|
29
|
+
),
|
|
25
30
|
end_line: z
|
|
26
31
|
.number()
|
|
27
32
|
.int()
|
|
28
33
|
.positive()
|
|
34
|
+
.nullable()
|
|
29
35
|
.optional()
|
|
30
|
-
.describe(
|
|
36
|
+
.describe(
|
|
37
|
+
"Optional one-based ending line number to read through; use null or omit for the end of the file",
|
|
38
|
+
),
|
|
31
39
|
})
|
|
32
40
|
.refine(
|
|
33
41
|
({ start_line, end_line }) =>
|
|
34
|
-
start_line
|
|
35
|
-
end_line === undefined ||
|
|
36
|
-
start_line <= end_line,
|
|
42
|
+
start_line == null || end_line == null || start_line <= end_line,
|
|
37
43
|
{
|
|
38
44
|
message: "start_line must be less than or equal to end_line",
|
|
39
45
|
path: ["end_line"],
|
|
@@ -48,9 +54,7 @@ export const ReadFileRequestSchema = z
|
|
|
48
54
|
})
|
|
49
55
|
.refine(
|
|
50
56
|
({ start_line, end_line }) =>
|
|
51
|
-
start_line
|
|
52
|
-
end_line === undefined ||
|
|
53
|
-
start_line <= end_line,
|
|
57
|
+
start_line == null || end_line == null || start_line <= end_line,
|
|
54
58
|
{
|
|
55
59
|
message: "start_line must be less than or equal to end_line",
|
|
56
60
|
path: ["end_line"],
|
|
@@ -64,7 +68,7 @@ export const ReadFilesInputSchema = z.object({
|
|
|
64
68
|
files: z
|
|
65
69
|
.array(ReadFileRequestSchema)
|
|
66
70
|
.describe(
|
|
67
|
-
"Array of file read requests. Omit start_line
|
|
71
|
+
"Array of file read requests. Omit start_line/end_line or set them to null to return the full file content boundaries; provide integers to return only that inclusive one-based line range. Prefer this tool over running terminal command to get file content for better performance and reliability.",
|
|
68
72
|
),
|
|
69
73
|
});
|
|
70
74
|
|
|
@@ -103,9 +107,8 @@ export const SearchCodebaseUnionInputSchema = z.union([
|
|
|
103
107
|
|
|
104
108
|
const CommandInputSchema = z
|
|
105
109
|
.string()
|
|
106
|
-
.max(2000)
|
|
107
110
|
.describe(
|
|
108
|
-
|
|
111
|
+
`The non-interactive shell command to execute - MUST keep input short and concise (within ${INPUT_ARG_CHAR_LIMIT * 2} characters) to avoid timeouts.`,
|
|
109
112
|
);
|
|
110
113
|
/**
|
|
111
114
|
* Schema for run_commands tool input
|
|
@@ -154,17 +157,15 @@ export const EditFileInputSchema = z
|
|
|
154
157
|
.describe("The absolute file path for the action to be performed on"),
|
|
155
158
|
old_text: z
|
|
156
159
|
.string()
|
|
157
|
-
.max(3000)
|
|
158
160
|
.nullable()
|
|
159
161
|
.optional()
|
|
160
162
|
.describe(
|
|
161
|
-
|
|
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.`,
|
|
162
164
|
),
|
|
163
165
|
new_text: z
|
|
164
166
|
.string()
|
|
165
|
-
.max(3000)
|
|
166
167
|
.describe(
|
|
167
|
-
|
|
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.`,
|
|
168
169
|
),
|
|
169
170
|
insert_line: z
|
|
170
171
|
.number()
|
|
@@ -176,18 +177,22 @@ export const EditFileInputSchema = z
|
|
|
176
177
|
),
|
|
177
178
|
})
|
|
178
179
|
.describe(
|
|
179
|
-
"Edit a text file by replacing old_text with new_text, create the file with new_text if it does not exist, or insert new_text at insert_line when insert_line is provided. IMPORTANT: large edits can time out, so use small chunks and multiple calls when possible.",
|
|
180
|
+
"Edit a text file by replacing old_text with new_text, create the file with new_text if it does not exist, or insert new_text at insert_line when insert_line is provided. Prefer using this tool for file edits over shell commands. IMPORTANT: large edits can time out, so use small chunks and multiple calls when possible.",
|
|
180
181
|
);
|
|
181
182
|
|
|
182
183
|
/**
|
|
183
184
|
* Schema for apply_patch tool input
|
|
184
185
|
*/
|
|
185
|
-
export const ApplyPatchInputSchema = z
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
186
|
+
export const ApplyPatchInputSchema = z
|
|
187
|
+
.object({
|
|
188
|
+
input: z
|
|
189
|
+
.string()
|
|
190
|
+
.min(1)
|
|
191
|
+
.describe("The apply_patch text payload, including patch instructions"),
|
|
192
|
+
})
|
|
193
|
+
.describe(
|
|
194
|
+
"Modify or create a text file by applying patches. Prefer using this tool for file edits over shell commands. IMPORTANT: large patches can time out, so use small chunks and multiple calls when possible.",
|
|
195
|
+
);
|
|
191
196
|
export const ApplyPatchInputUnionSchema = z.union([
|
|
192
197
|
ApplyPatchInputSchema,
|
|
193
198
|
z.string(),
|
|
@@ -197,12 +202,7 @@ export const ApplyPatchInputUnionSchema = z.union([
|
|
|
197
202
|
* Schema for skills tool input
|
|
198
203
|
*/
|
|
199
204
|
export const SkillsInputSchema = z.object({
|
|
200
|
-
skill: z
|
|
201
|
-
.string()
|
|
202
|
-
.min(1)
|
|
203
|
-
.describe(
|
|
204
|
-
'The skill name. E.g., "commit", "review-pr", "pdf", or "ms-office-suite:pdf"',
|
|
205
|
-
),
|
|
205
|
+
skill: z.string().min(1).describe("Name of the skill to execute."),
|
|
206
206
|
args: z
|
|
207
207
|
.string()
|
|
208
208
|
.nullable()
|
package/src/types/config.ts
CHANGED
|
@@ -76,4 +76,9 @@ export interface CoreSessionConfig
|
|
|
76
76
|
| Promise<ConsecutiveMistakeLimitDecision>
|
|
77
77
|
| ConsecutiveMistakeLimitDecision;
|
|
78
78
|
toolRoutingRules?: ToolRoutingRule[];
|
|
79
|
+
/**
|
|
80
|
+
* Optional skill allowlist for the `skills` tool. When provided, only these
|
|
81
|
+
* skills are surfaced in tool metadata and invocable by name.
|
|
82
|
+
*/
|
|
83
|
+
skills?: string[];
|
|
79
84
|
}
|
package/src/types/events.ts
CHANGED
|
@@ -36,6 +36,24 @@ export interface SessionTeamProgressEvent {
|
|
|
36
36
|
summary: import("@clinebot/shared").TeamProgressSummary;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
+
export interface SessionPendingPromptsEvent {
|
|
40
|
+
sessionId: string;
|
|
41
|
+
prompts: Array<{
|
|
42
|
+
id: string;
|
|
43
|
+
prompt: string;
|
|
44
|
+
delivery: "queue" | "steer";
|
|
45
|
+
attachmentCount: number;
|
|
46
|
+
}>;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface SessionPendingPromptSubmittedEvent {
|
|
50
|
+
sessionId: string;
|
|
51
|
+
id: string;
|
|
52
|
+
prompt: string;
|
|
53
|
+
delivery: "queue" | "steer";
|
|
54
|
+
attachmentCount: number;
|
|
55
|
+
}
|
|
56
|
+
|
|
39
57
|
export type CoreSessionEvent =
|
|
40
58
|
| { type: "chunk"; payload: SessionChunkEvent }
|
|
41
59
|
| {
|
|
@@ -46,6 +64,11 @@ export type CoreSessionEvent =
|
|
|
46
64
|
};
|
|
47
65
|
}
|
|
48
66
|
| { type: "team_progress"; payload: SessionTeamProgressEvent }
|
|
67
|
+
| { type: "pending_prompts"; payload: SessionPendingPromptsEvent }
|
|
68
|
+
| {
|
|
69
|
+
type: "pending_prompt_submitted";
|
|
70
|
+
payload: SessionPendingPromptSubmittedEvent;
|
|
71
|
+
}
|
|
49
72
|
| { type: "ended"; payload: SessionEndedEvent }
|
|
50
73
|
| { type: "hook"; payload: SessionToolEvent }
|
|
51
74
|
| { type: "status"; payload: { sessionId: string; status: string } };
|