@kilncraft/core 1.1.1 → 1.2.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/dist/index.d.ts +81 -2
- package/dist/index.js +1327 -87
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -138,6 +138,21 @@ declare function sessionExists(store: SessionStore, sessionID: string): boolean;
|
|
|
138
138
|
declare function readSessionFile(store: SessionStore, sessionID: string, filename: string): string | undefined;
|
|
139
139
|
declare function writeSessionFile(store: SessionStore, sessionID: string, filename: string, contents: string): void;
|
|
140
140
|
|
|
141
|
+
declare class BackgroundShellManager {
|
|
142
|
+
private readonly shells;
|
|
143
|
+
start(command: string, cwd: string, env?: NodeJS.ProcessEnv): string;
|
|
144
|
+
list(): string[];
|
|
145
|
+
output(id: string): {
|
|
146
|
+
stdout: string;
|
|
147
|
+
stderr: string;
|
|
148
|
+
exitCode: number;
|
|
149
|
+
running: boolean;
|
|
150
|
+
} | undefined;
|
|
151
|
+
write(id: string, input: string): boolean;
|
|
152
|
+
kill(id: string): boolean;
|
|
153
|
+
closeAll(): void;
|
|
154
|
+
}
|
|
155
|
+
|
|
141
156
|
declare class ToolRegistry {
|
|
142
157
|
private readonly tools;
|
|
143
158
|
register<TInput>(tool: ToolDefinition<TInput>): void;
|
|
@@ -194,13 +209,29 @@ declare function compactMessages(messages: ChatMessage[], options: CompactionOpt
|
|
|
194
209
|
type AgentEvent = {
|
|
195
210
|
type: "turn.start";
|
|
196
211
|
prompt: string;
|
|
212
|
+
} | {
|
|
213
|
+
type: "turn.phase";
|
|
214
|
+
phase: "thinking" | "tool" | "compacting" | "waiting_permission" | "retrying" | "idle" | "error";
|
|
215
|
+
detail?: string;
|
|
197
216
|
} | {
|
|
198
217
|
type: "assistant.text";
|
|
199
218
|
text: string;
|
|
219
|
+
} | {
|
|
220
|
+
type: "assistant.reasoning";
|
|
221
|
+
text: string;
|
|
222
|
+
} | {
|
|
223
|
+
type: "assistant.reasoning.end";
|
|
200
224
|
} | {
|
|
201
225
|
type: "assistant.message";
|
|
202
226
|
text: string;
|
|
203
227
|
toolCalls: ToolCall[];
|
|
228
|
+
} | {
|
|
229
|
+
type: "tool.call.start";
|
|
230
|
+
call: ToolCall;
|
|
231
|
+
} | {
|
|
232
|
+
type: "tool.call.delta";
|
|
233
|
+
callID: string;
|
|
234
|
+
argsDelta: string;
|
|
204
235
|
} | {
|
|
205
236
|
type: "tool.call";
|
|
206
237
|
call: ToolCall;
|
|
@@ -211,6 +242,12 @@ type AgentEvent = {
|
|
|
211
242
|
output: ToolOutput;
|
|
212
243
|
decision: PermissionDecision;
|
|
213
244
|
durationMs: number;
|
|
245
|
+
} | {
|
|
246
|
+
type: "tool.retry";
|
|
247
|
+
attempt: number;
|
|
248
|
+
delayMs: number;
|
|
249
|
+
reason: string;
|
|
250
|
+
provider?: string;
|
|
214
251
|
} | {
|
|
215
252
|
type: "permission.requested";
|
|
216
253
|
requestID: string;
|
|
@@ -232,6 +269,9 @@ type AgentEvent = {
|
|
|
232
269
|
stopReason: string;
|
|
233
270
|
usage: Usage;
|
|
234
271
|
cost: number;
|
|
272
|
+
toolCalls: number;
|
|
273
|
+
retries: number;
|
|
274
|
+
durationMs: number;
|
|
235
275
|
} | {
|
|
236
276
|
type: "error";
|
|
237
277
|
error: KilncraftError;
|
|
@@ -252,6 +292,9 @@ interface AgentOptions {
|
|
|
252
292
|
logger: Logger;
|
|
253
293
|
maxTurns?: number;
|
|
254
294
|
maxTokens?: number;
|
|
295
|
+
reasoningEffort?: "low" | "medium" | "high";
|
|
296
|
+
promptCache?: boolean;
|
|
297
|
+
smallModel?: string;
|
|
255
298
|
systemPrompt?: string;
|
|
256
299
|
agent?: string;
|
|
257
300
|
store?: SessionStore;
|
|
@@ -259,9 +302,18 @@ interface AgentOptions {
|
|
|
259
302
|
audit?: AuditLog;
|
|
260
303
|
checkpoints?: CheckpointManager;
|
|
261
304
|
askPermission?: (request: PermissionAskRequest, requestID: string) => Promise<PermissionDecision>;
|
|
305
|
+
askUser?: (request: {
|
|
306
|
+
question: string;
|
|
307
|
+
options?: string[];
|
|
308
|
+
}) => Promise<string | undefined>;
|
|
309
|
+
shells?: BackgroundShellManager;
|
|
310
|
+
isSubagent?: boolean;
|
|
262
311
|
plugins?: PluginHost;
|
|
263
312
|
sandbox?: SandboxAdapter;
|
|
264
313
|
lsp?: LspManagerLike;
|
|
314
|
+
maxRetries?: number;
|
|
315
|
+
retryDelayMs?: number;
|
|
316
|
+
fallbackProviders?: ProviderAdapter[];
|
|
265
317
|
}
|
|
266
318
|
interface PromptRunOptions {
|
|
267
319
|
onEvent?: (event: AgentEvent) => void | Promise<void>;
|
|
@@ -283,7 +335,10 @@ declare class Agent {
|
|
|
283
335
|
private usage;
|
|
284
336
|
private cost;
|
|
285
337
|
private totalToolCalls;
|
|
286
|
-
private
|
|
338
|
+
private retries;
|
|
339
|
+
private titleGenerated;
|
|
340
|
+
private modelInfo;
|
|
341
|
+
private readonly shells;
|
|
287
342
|
constructor(options: AgentOptions);
|
|
288
343
|
get id(): string;
|
|
289
344
|
getSession(): Session;
|
|
@@ -293,7 +348,12 @@ declare class Agent {
|
|
|
293
348
|
getCost(): number;
|
|
294
349
|
getPermissions(): PermissionEngine;
|
|
295
350
|
getTodos(): Todo[];
|
|
351
|
+
close(): void;
|
|
296
352
|
prompt(input: string, options?: PromptRunOptions): Promise<TurnResult>;
|
|
353
|
+
private streamWithRetry;
|
|
354
|
+
private runSubagent;
|
|
355
|
+
private generateTitle;
|
|
356
|
+
private isDefaultTitle;
|
|
297
357
|
compact(): Promise<CompactionResult>;
|
|
298
358
|
private finish;
|
|
299
359
|
private result;
|
|
@@ -370,6 +430,8 @@ interface OpenAIChunk {
|
|
|
370
430
|
choices?: Array<{
|
|
371
431
|
delta?: {
|
|
372
432
|
content?: string;
|
|
433
|
+
reasoning_content?: string;
|
|
434
|
+
reasoning?: string;
|
|
373
435
|
tool_calls?: OpenAIToolCallDelta[];
|
|
374
436
|
};
|
|
375
437
|
finish_reason?: string;
|
|
@@ -408,8 +470,17 @@ declare const bashInput: z.ZodObject<{
|
|
|
408
470
|
command: z.ZodString;
|
|
409
471
|
cwd: z.ZodOptional<z.ZodString>;
|
|
410
472
|
timeout: z.ZodOptional<z.ZodNumber>;
|
|
473
|
+
background: z.ZodOptional<z.ZodBoolean>;
|
|
411
474
|
}, z.core.$strip>;
|
|
412
475
|
type BashInput = z.infer<typeof bashInput>;
|
|
476
|
+
declare const outputInput: z.ZodObject<{
|
|
477
|
+
shellID: z.ZodString;
|
|
478
|
+
}, z.core.$strip>;
|
|
479
|
+
declare const killInput: z.ZodObject<{
|
|
480
|
+
shellID: z.ZodString;
|
|
481
|
+
}, z.core.$strip>;
|
|
482
|
+
declare const bashOutputTool: ToolDefinition<z.infer<typeof outputInput>>;
|
|
483
|
+
declare const killShellTool: ToolDefinition<z.infer<typeof killInput>>;
|
|
413
484
|
declare const bashTool: ToolDefinition<BashInput>;
|
|
414
485
|
|
|
415
486
|
declare const DEFAULT_IGNORE: Set<string>;
|
|
@@ -474,6 +545,14 @@ declare const lsTool: ToolDefinition<LsInput>;
|
|
|
474
545
|
declare const pathInput: z.ZodObject<{
|
|
475
546
|
path: z.ZodString;
|
|
476
547
|
}, z.core.$strip>;
|
|
548
|
+
declare const positionInput: z.ZodObject<{
|
|
549
|
+
path: z.ZodString;
|
|
550
|
+
line: z.ZodNumber;
|
|
551
|
+
character: z.ZodNumber;
|
|
552
|
+
}, z.core.$strip>;
|
|
553
|
+
declare const lspDefinitionTool: ToolDefinition<z.infer<typeof positionInput>>;
|
|
554
|
+
declare const lspHoverTool: ToolDefinition<z.infer<typeof positionInput>>;
|
|
555
|
+
declare const lspReferencesTool: ToolDefinition<z.infer<typeof positionInput>>;
|
|
477
556
|
declare const lspDiagnosticsTool: ToolDefinition<z.infer<typeof pathInput>>;
|
|
478
557
|
declare const lspSymbolsTool: ToolDefinition<z.infer<typeof pathInput>>;
|
|
479
558
|
|
|
@@ -492,5 +571,5 @@ declare const writeInput: z.ZodObject<{
|
|
|
492
571
|
type WriteInput = z.infer<typeof writeInput>;
|
|
493
572
|
declare const writeTool: ToolDefinition<WriteInput>;
|
|
494
573
|
|
|
495
|
-
export { Agent, AnthropicProvider, AuditLog, CheckpointManager, DEFAULT_IGNORE, GLOB_IGNORE, GeminiProvider, MODEL_CATALOG, OpenAIProvider, PermissionEngine, PluginHost, ProviderRegistry, SessionStore, ToolRegistry, assertInsideWorkspace, assertRealInside, atomicWrite, availableProviderIds, bashTool, buildSystemPrompt, compactMessages, createDefaultProviderRegistry, createDefaultToolRegistry, diffText, editTool, escapeRegExp, estimateMessagesTokens, estimateTokens, fileExists, formatTodos, getCommand, getPath, globToRegExp, globTool, grepTool, hashInput, isBinary, isDangerousCommand, isOpenAiChunk, isPathInside, lineNumbered, listKnownModels, loadPlugins, lsTool, lspDiagnosticsTool, lspSymbolsTool, matchesGlob, modelInfoFor, readSessionFile, readTextFile, readTool, resolveDataDir, resolveWorkspacePath, sessionExists, shouldCompact, summarizeInput, todoSchema, todoTool, toolOutputToText, truncateText, walkFiles, writeSessionFile, writeTool };
|
|
574
|
+
export { Agent, AnthropicProvider, AuditLog, CheckpointManager, DEFAULT_IGNORE, GLOB_IGNORE, GeminiProvider, MODEL_CATALOG, OpenAIProvider, PermissionEngine, PluginHost, ProviderRegistry, SessionStore, ToolRegistry, assertInsideWorkspace, assertRealInside, atomicWrite, availableProviderIds, bashOutputTool, bashTool, buildSystemPrompt, compactMessages, createDefaultProviderRegistry, createDefaultToolRegistry, diffText, editTool, escapeRegExp, estimateMessagesTokens, estimateTokens, fileExists, formatTodos, getCommand, getPath, globToRegExp, globTool, grepTool, hashInput, isBinary, isDangerousCommand, isOpenAiChunk, isPathInside, killShellTool, lineNumbered, listKnownModels, loadPlugins, lsTool, lspDefinitionTool, lspDiagnosticsTool, lspHoverTool, lspReferencesTool, lspSymbolsTool, matchesGlob, modelInfoFor, readSessionFile, readTextFile, readTool, resolveDataDir, resolveWorkspacePath, sessionExists, shouldCompact, summarizeInput, todoSchema, todoTool, toolOutputToText, truncateText, walkFiles, writeSessionFile, writeTool };
|
|
496
575
|
export type { AgentEvent, AgentOptions, AnthropicOptions, AuditEntry, BashInput, Checkpoint, CompactionOptions, CompactionResult, CreateSessionInput, EditInput, ExportFormat, GeminiOptions, GlobInput, GrepInput, LsInput, OpenAIOptions, PermissionAskRequest, PermissionEngineOptions, PermissionRequest, PromptOptions, PromptRunOptions, ReadInput, SearchResult, SessionFilter, Todo, TodoInput, TurnResult, WriteInput };
|