@moikapy/lich 0.7.1 → 0.9.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/CHANGELOG.md +63 -0
- package/README.md +38 -19
- package/dist/{chunk-CVX7LZWC.js → chunk-4N3S6ACI.js} +2 -2
- package/dist/{chunk-WNFBIX4E.js → chunk-KOEZQUIX.js} +1312 -600
- package/dist/chunk-KOEZQUIX.js.map +1 -0
- package/dist/{chunk-PZNYVGD4.js → chunk-P2YEHNM4.js} +2 -2
- package/dist/chunk-P2YEHNM4.js.map +1 -0
- package/dist/chunk-PL6MKRKE.js +75 -0
- package/dist/chunk-PL6MKRKE.js.map +1 -0
- package/dist/chunk-TYRKVBWQ.js +104 -0
- package/dist/chunk-TYRKVBWQ.js.map +1 -0
- package/dist/cli.d.ts +19 -1
- package/dist/cli.js +125 -47
- package/dist/cli.js.map +1 -1
- package/dist/{gateway-44QTIJTJ.js → gateway-OSB7254F.js} +209 -46
- package/dist/gateway-OSB7254F.js.map +1 -0
- package/dist/index.d.ts +122 -62
- package/dist/index.js +12 -4
- package/dist/resolve-H22TOVB5.js +7 -0
- package/dist/resolve-H22TOVB5.js.map +1 -0
- package/dist/store-YYLEB7JG.js +9 -0
- package/dist/store-YYLEB7JG.js.map +1 -0
- package/dist/{tui-MEJGEILU.js → tui-XXIU4W7K.js} +216 -25
- package/dist/tui-XXIU4W7K.js.map +1 -0
- package/docs/architecture/agent-loop.md +28 -9
- package/docs/architecture/overview.md +10 -9
- package/docs/architecture/tools.md +3 -1
- package/docs/getting-started.md +6 -6
- package/docs/index.md +1 -1
- package/docs/user-guide/cli.md +17 -8
- package/docs/user-guide/games.md +5 -4
- package/docs/user-guide/library.md +6 -3
- package/docs/user-guide/redot.md +2 -2
- package/docs/user-guide/tui.md +3 -2
- package/package.json +1 -1
- package/dist/chunk-PZNYVGD4.js.map +0 -1
- package/dist/chunk-WNFBIX4E.js.map +0 -1
- package/dist/gateway-44QTIJTJ.js.map +0 -1
- package/dist/tui-MEJGEILU.js.map +0 -1
- /package/dist/{chunk-CVX7LZWC.js.map → chunk-4N3S6ACI.js.map} +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -42,6 +42,12 @@ interface AssistantMessage {
|
|
|
42
42
|
role: "assistant";
|
|
43
43
|
content: string;
|
|
44
44
|
tool_calls?: ToolCall[];
|
|
45
|
+
/**
|
|
46
|
+
* Opaque provider content blocks preserved for round-trip (e.g. Anthropic
|
|
47
|
+
* thinking / redacted_thinking). When present, Anthropic replays these
|
|
48
|
+
* instead of reconstructing text + tool_use from content/tool_calls.
|
|
49
|
+
*/
|
|
50
|
+
provider_content?: readonly Record<string, unknown>[];
|
|
45
51
|
}
|
|
46
52
|
interface ToolMessage {
|
|
47
53
|
role: "tool";
|
|
@@ -83,10 +89,14 @@ interface ProviderConfig {
|
|
|
83
89
|
api_key?: string;
|
|
84
90
|
api_key_env?: string;
|
|
85
91
|
timeout_ms?: number;
|
|
92
|
+
/** Anthropic-only: forward ChatOptions.temperature (default: omit). */
|
|
93
|
+
send_temperature?: boolean;
|
|
86
94
|
/** Ollama-only: request thinking mode (adds think:true to /api/chat). */
|
|
87
95
|
think?: boolean;
|
|
88
96
|
/** Ollama-only: how long the model stays loaded (e.g. "10m"). */
|
|
89
97
|
keep_alive?: string;
|
|
98
|
+
/** Ollama-only: context window size sent as options.num_ctx. */
|
|
99
|
+
num_ctx?: number;
|
|
90
100
|
/** Injectable fetch, mainly for tests. Defaults to global fetch. */
|
|
91
101
|
fetch_fn?: typeof fetch;
|
|
92
102
|
}
|
|
@@ -115,7 +125,7 @@ declare const agent_config_schema: z.ZodEffects<z.ZodObject<{
|
|
|
115
125
|
agent_name: z.ZodDefault<z.ZodString>;
|
|
116
126
|
system_prompt: z.ZodOptional<z.ZodString>;
|
|
117
127
|
max_turns: z.ZodDefault<z.ZodNumber>;
|
|
118
|
-
providers: z.ZodArray<z.ZodObject<{
|
|
128
|
+
providers: z.ZodEffects<z.ZodArray<z.ZodObject<{
|
|
119
129
|
kind: z.ZodEnum<["openai_compat", "anthropic", "ollama"]>;
|
|
120
130
|
name: z.ZodString;
|
|
121
131
|
model: z.ZodString;
|
|
@@ -145,7 +155,27 @@ declare const agent_config_schema: z.ZodEffects<z.ZodObject<{
|
|
|
145
155
|
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
146
156
|
/** Injectable fetch, mainly for tests; passes through untouched. */
|
|
147
157
|
fetch_fn: z.ZodOptional<z.ZodType<typeof fetch, z.ZodTypeDef, typeof fetch>>;
|
|
148
|
-
}, z.ZodTypeAny, "passthrough">>, "many"
|
|
158
|
+
}, z.ZodTypeAny, "passthrough">>, "many">, z.objectOutputType<{
|
|
159
|
+
kind: z.ZodEnum<["openai_compat", "anthropic", "ollama"]>;
|
|
160
|
+
name: z.ZodString;
|
|
161
|
+
model: z.ZodString;
|
|
162
|
+
base_url: z.ZodOptional<z.ZodString>;
|
|
163
|
+
api_key: z.ZodOptional<z.ZodString>;
|
|
164
|
+
api_key_env: z.ZodOptional<z.ZodString>;
|
|
165
|
+
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
166
|
+
/** Injectable fetch, mainly for tests; passes through untouched. */
|
|
167
|
+
fetch_fn: z.ZodOptional<z.ZodType<typeof fetch, z.ZodTypeDef, typeof fetch>>;
|
|
168
|
+
}, z.ZodTypeAny, "passthrough">[], z.objectInputType<{
|
|
169
|
+
kind: z.ZodEnum<["openai_compat", "anthropic", "ollama"]>;
|
|
170
|
+
name: z.ZodString;
|
|
171
|
+
model: z.ZodString;
|
|
172
|
+
base_url: z.ZodOptional<z.ZodString>;
|
|
173
|
+
api_key: z.ZodOptional<z.ZodString>;
|
|
174
|
+
api_key_env: z.ZodOptional<z.ZodString>;
|
|
175
|
+
timeout_ms: z.ZodOptional<z.ZodNumber>;
|
|
176
|
+
/** Injectable fetch, mainly for tests; passes through untouched. */
|
|
177
|
+
fetch_fn: z.ZodOptional<z.ZodType<typeof fetch, z.ZodTypeDef, typeof fetch>>;
|
|
178
|
+
}, z.ZodTypeAny, "passthrough">[]>;
|
|
149
179
|
work_dir: z.ZodOptional<z.ZodString>;
|
|
150
180
|
tools_enabled: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"all">, z.ZodArray<z.ZodString, "many">]>>;
|
|
151
181
|
temperature: z.ZodOptional<z.ZodNumber>;
|
|
@@ -168,13 +198,13 @@ declare const agent_config_schema: z.ZodEffects<z.ZodObject<{
|
|
|
168
198
|
tools_enabled: z.ZodDefault<z.ZodUnion<[z.ZodLiteral<"all">, z.ZodArray<z.ZodString, "many">]>>;
|
|
169
199
|
}, "strip", z.ZodTypeAny, {
|
|
170
200
|
tools_enabled: string[] | "all";
|
|
171
|
-
platforms: ("
|
|
201
|
+
platforms: ("telegram" | "discord" | "twitch" | "webhook")[];
|
|
172
202
|
token_envs: Record<string, string>;
|
|
173
203
|
allowed_users: Record<string, string[]>;
|
|
174
204
|
allowed_chats: Record<string, string[]>;
|
|
175
205
|
}, {
|
|
176
206
|
tools_enabled?: string[] | "all" | undefined;
|
|
177
|
-
platforms?: ("
|
|
207
|
+
platforms?: ("telegram" | "discord" | "twitch" | "webhook")[] | undefined;
|
|
178
208
|
token_envs?: Record<string, string> | undefined;
|
|
179
209
|
allowed_users?: Record<string, string[]> | undefined;
|
|
180
210
|
allowed_chats?: Record<string, string[]> | undefined;
|
|
@@ -224,9 +254,9 @@ declare const agent_config_schema: z.ZodEffects<z.ZodObject<{
|
|
|
224
254
|
enabled?: boolean | undefined;
|
|
225
255
|
}>>>;
|
|
226
256
|
}, "strip", z.ZodTypeAny, {
|
|
257
|
+
plugins: string[];
|
|
258
|
+
agent_name: string;
|
|
227
259
|
max_turns: number;
|
|
228
|
-
log_level: "debug" | "info" | "warn" | "error";
|
|
229
|
-
theme: string;
|
|
230
260
|
providers: z.objectOutputType<{
|
|
231
261
|
kind: z.ZodEnum<["openai_compat", "anthropic", "ollama"]>;
|
|
232
262
|
name: z.ZodString;
|
|
@@ -238,24 +268,24 @@ declare const agent_config_schema: z.ZodEffects<z.ZodObject<{
|
|
|
238
268
|
/** Injectable fetch, mainly for tests; passes through untouched. */
|
|
239
269
|
fetch_fn: z.ZodOptional<z.ZodType<typeof fetch, z.ZodTypeDef, typeof fetch>>;
|
|
240
270
|
}, z.ZodTypeAny, "passthrough">[];
|
|
241
|
-
agent_name: string;
|
|
242
271
|
tools_enabled: string[] | "all";
|
|
243
272
|
context_budget_tokens: number;
|
|
244
273
|
compress_threshold: number;
|
|
245
274
|
terminal_timeout_ms: number;
|
|
246
|
-
|
|
247
|
-
|
|
275
|
+
log_level: "debug" | "info" | "warn" | "error";
|
|
276
|
+
theme: string;
|
|
248
277
|
system_prompt?: string | undefined;
|
|
278
|
+
work_dir?: string | undefined;
|
|
279
|
+
temperature?: number | undefined;
|
|
280
|
+
max_tokens?: number | undefined;
|
|
249
281
|
session_dir?: string | undefined;
|
|
250
282
|
gateway?: {
|
|
251
283
|
tools_enabled: string[] | "all";
|
|
252
|
-
platforms: ("
|
|
284
|
+
platforms: ("telegram" | "discord" | "twitch" | "webhook")[];
|
|
253
285
|
token_envs: Record<string, string>;
|
|
254
286
|
allowed_users: Record<string, string[]>;
|
|
255
287
|
allowed_chats: Record<string, string[]>;
|
|
256
288
|
} | undefined;
|
|
257
|
-
temperature?: number | undefined;
|
|
258
|
-
max_tokens?: number | undefined;
|
|
259
289
|
mcp_servers?: Record<string, {
|
|
260
290
|
enabled: boolean;
|
|
261
291
|
command: string;
|
|
@@ -277,27 +307,27 @@ declare const agent_config_schema: z.ZodEffects<z.ZodObject<{
|
|
|
277
307
|
/** Injectable fetch, mainly for tests; passes through untouched. */
|
|
278
308
|
fetch_fn: z.ZodOptional<z.ZodType<typeof fetch, z.ZodTypeDef, typeof fetch>>;
|
|
279
309
|
}, z.ZodTypeAny, "passthrough">[];
|
|
280
|
-
|
|
281
|
-
|
|
310
|
+
plugins?: string[] | undefined;
|
|
311
|
+
agent_name?: string | undefined;
|
|
282
312
|
system_prompt?: string | undefined;
|
|
313
|
+
max_turns?: number | undefined;
|
|
314
|
+
work_dir?: string | undefined;
|
|
315
|
+
tools_enabled?: string[] | "all" | undefined;
|
|
316
|
+
temperature?: number | undefined;
|
|
317
|
+
max_tokens?: number | undefined;
|
|
318
|
+
context_budget_tokens?: number | undefined;
|
|
319
|
+
compress_threshold?: number | undefined;
|
|
283
320
|
session_dir?: string | undefined;
|
|
284
|
-
|
|
285
|
-
theme?: string | undefined;
|
|
321
|
+
terminal_timeout_ms?: number | undefined;
|
|
286
322
|
gateway?: {
|
|
287
323
|
tools_enabled?: string[] | "all" | undefined;
|
|
288
|
-
platforms?: ("
|
|
324
|
+
platforms?: ("telegram" | "discord" | "twitch" | "webhook")[] | undefined;
|
|
289
325
|
token_envs?: Record<string, string> | undefined;
|
|
290
326
|
allowed_users?: Record<string, string[]> | undefined;
|
|
291
327
|
allowed_chats?: Record<string, string[]> | undefined;
|
|
292
328
|
} | undefined;
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
temperature?: number | undefined;
|
|
296
|
-
max_tokens?: number | undefined;
|
|
297
|
-
context_budget_tokens?: number | undefined;
|
|
298
|
-
compress_threshold?: number | undefined;
|
|
299
|
-
terminal_timeout_ms?: number | undefined;
|
|
300
|
-
plugins?: string[] | undefined;
|
|
329
|
+
log_level?: "debug" | "info" | "warn" | "error" | undefined;
|
|
330
|
+
theme?: string | undefined;
|
|
301
331
|
mcp_servers?: Record<string, {
|
|
302
332
|
command: string;
|
|
303
333
|
enabled?: boolean | undefined;
|
|
@@ -311,25 +341,25 @@ declare const agent_config_schema: z.ZodEffects<z.ZodObject<{
|
|
|
311
341
|
work_dir: string;
|
|
312
342
|
providers: ProviderConfig[];
|
|
313
343
|
session_dir: string;
|
|
314
|
-
|
|
315
|
-
log_level: "debug" | "info" | "warn" | "error";
|
|
316
|
-
theme: string;
|
|
344
|
+
plugins: string[];
|
|
317
345
|
agent_name: string;
|
|
346
|
+
max_turns: number;
|
|
318
347
|
tools_enabled: string[] | "all";
|
|
319
348
|
context_budget_tokens: number;
|
|
320
349
|
compress_threshold: number;
|
|
321
350
|
terminal_timeout_ms: number;
|
|
322
|
-
|
|
351
|
+
log_level: "debug" | "info" | "warn" | "error";
|
|
352
|
+
theme: string;
|
|
323
353
|
system_prompt?: string | undefined;
|
|
354
|
+
temperature?: number | undefined;
|
|
355
|
+
max_tokens?: number | undefined;
|
|
324
356
|
gateway?: {
|
|
325
357
|
tools_enabled: string[] | "all";
|
|
326
|
-
platforms: ("
|
|
358
|
+
platforms: ("telegram" | "discord" | "twitch" | "webhook")[];
|
|
327
359
|
token_envs: Record<string, string>;
|
|
328
360
|
allowed_users: Record<string, string[]>;
|
|
329
361
|
allowed_chats: Record<string, string[]>;
|
|
330
362
|
} | undefined;
|
|
331
|
-
temperature?: number | undefined;
|
|
332
|
-
max_tokens?: number | undefined;
|
|
333
363
|
mcp_servers?: Record<string, {
|
|
334
364
|
enabled: boolean;
|
|
335
365
|
command: string;
|
|
@@ -351,27 +381,27 @@ declare const agent_config_schema: z.ZodEffects<z.ZodObject<{
|
|
|
351
381
|
/** Injectable fetch, mainly for tests; passes through untouched. */
|
|
352
382
|
fetch_fn: z.ZodOptional<z.ZodType<typeof fetch, z.ZodTypeDef, typeof fetch>>;
|
|
353
383
|
}, z.ZodTypeAny, "passthrough">[];
|
|
354
|
-
|
|
355
|
-
|
|
384
|
+
plugins?: string[] | undefined;
|
|
385
|
+
agent_name?: string | undefined;
|
|
356
386
|
system_prompt?: string | undefined;
|
|
387
|
+
max_turns?: number | undefined;
|
|
388
|
+
work_dir?: string | undefined;
|
|
389
|
+
tools_enabled?: string[] | "all" | undefined;
|
|
390
|
+
temperature?: number | undefined;
|
|
391
|
+
max_tokens?: number | undefined;
|
|
392
|
+
context_budget_tokens?: number | undefined;
|
|
393
|
+
compress_threshold?: number | undefined;
|
|
357
394
|
session_dir?: string | undefined;
|
|
358
|
-
|
|
359
|
-
theme?: string | undefined;
|
|
395
|
+
terminal_timeout_ms?: number | undefined;
|
|
360
396
|
gateway?: {
|
|
361
397
|
tools_enabled?: string[] | "all" | undefined;
|
|
362
|
-
platforms?: ("
|
|
398
|
+
platforms?: ("telegram" | "discord" | "twitch" | "webhook")[] | undefined;
|
|
363
399
|
token_envs?: Record<string, string> | undefined;
|
|
364
400
|
allowed_users?: Record<string, string[]> | undefined;
|
|
365
401
|
allowed_chats?: Record<string, string[]> | undefined;
|
|
366
402
|
} | undefined;
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
temperature?: number | undefined;
|
|
370
|
-
max_tokens?: number | undefined;
|
|
371
|
-
context_budget_tokens?: number | undefined;
|
|
372
|
-
compress_threshold?: number | undefined;
|
|
373
|
-
terminal_timeout_ms?: number | undefined;
|
|
374
|
-
plugins?: string[] | undefined;
|
|
403
|
+
log_level?: "debug" | "info" | "warn" | "error" | undefined;
|
|
404
|
+
theme?: string | undefined;
|
|
375
405
|
mcp_servers?: Record<string, {
|
|
376
406
|
command: string;
|
|
377
407
|
enabled?: boolean | undefined;
|
|
@@ -455,8 +485,9 @@ interface HookContext {
|
|
|
455
485
|
work_dir: string;
|
|
456
486
|
/**
|
|
457
487
|
* This plugin's own per-run state sub-map. Every hook invocation receives
|
|
458
|
-
* a ctx exposing only the invoking plugin's bag; the bag is
|
|
459
|
-
*
|
|
488
|
+
* a ctx exposing only the invoking plugin's bag; the bag is scoped per
|
|
489
|
+
* Agent.run via AsyncLocalStorage (and swapped fresh at each run start).
|
|
490
|
+
* Absent only on hand-built contexts outside the runner.
|
|
460
491
|
*/
|
|
461
492
|
state?: Map<string, unknown>;
|
|
462
493
|
}
|
|
@@ -520,6 +551,20 @@ declare function load_plugins(entries: readonly string[], base_dir: string): Pro
|
|
|
520
551
|
/** Joined one-liner per load error, for a single warn log. */
|
|
521
552
|
declare function plugin_errors_summary(errors: readonly PluginLoadError[]): string;
|
|
522
553
|
|
|
554
|
+
interface SessionRecord {
|
|
555
|
+
ts: string;
|
|
556
|
+
kind: "message" | "meta";
|
|
557
|
+
message?: Message;
|
|
558
|
+
meta?: Record<string, unknown>;
|
|
559
|
+
}
|
|
560
|
+
interface SessionHandle {
|
|
561
|
+
id: string;
|
|
562
|
+
path: string;
|
|
563
|
+
append(record: SessionRecord): Promise<void>;
|
|
564
|
+
}
|
|
565
|
+
declare function open_session(dir: string, label?: string): Promise<SessionHandle>;
|
|
566
|
+
declare function read_session_messages(file_path: string): Promise<Message[]>;
|
|
567
|
+
|
|
523
568
|
/**
|
|
524
569
|
* Typed event emitter for the agent loop.
|
|
525
570
|
*
|
|
@@ -547,12 +592,15 @@ interface AgentEvents {
|
|
|
547
592
|
turn: number;
|
|
548
593
|
call: ToolCall;
|
|
549
594
|
result: ToolResult;
|
|
595
|
+
cancelled?: boolean;
|
|
550
596
|
};
|
|
551
597
|
compress_start: {
|
|
552
598
|
estimated_tokens: number;
|
|
553
599
|
};
|
|
600
|
+
/** Summarizer usage is optional so the recorder never treats it as an assistant turn. */
|
|
554
601
|
compress_end: {
|
|
555
602
|
summary_chars: number;
|
|
603
|
+
usage?: Usage;
|
|
556
604
|
};
|
|
557
605
|
turn_end: {
|
|
558
606
|
turn: number;
|
|
@@ -581,6 +629,10 @@ declare class AgentEmitter {
|
|
|
581
629
|
clear(): void;
|
|
582
630
|
}
|
|
583
631
|
|
|
632
|
+
interface ChatFn {
|
|
633
|
+
(messages: readonly Message[], tools: readonly ToolDefinition[], options?: ChatOptions): Promise<ChatResult>;
|
|
634
|
+
}
|
|
635
|
+
|
|
584
636
|
/**
|
|
585
637
|
* The Think-Act-Observe agent loop.
|
|
586
638
|
*
|
|
@@ -590,6 +642,17 @@ declare class AgentEmitter {
|
|
|
590
642
|
* loop never imports provider routers or the tool executor directly.
|
|
591
643
|
*/
|
|
592
644
|
|
|
645
|
+
interface ToolRunner {
|
|
646
|
+
execute(name: string, args: Record<string, unknown>, context?: ToolContext): Promise<ToolResult>;
|
|
647
|
+
}
|
|
648
|
+
interface LoopDeps {
|
|
649
|
+
chat: ChatFn;
|
|
650
|
+
tools: ToolRunner;
|
|
651
|
+
definitions: () => ToolDefinition[];
|
|
652
|
+
emitter?: AgentEmitter;
|
|
653
|
+
/** Per-run ToolContext threaded to every tool execution (A6). */
|
|
654
|
+
tool_context?: ToolContext;
|
|
655
|
+
}
|
|
593
656
|
interface LoopParams {
|
|
594
657
|
system_prompt?: string;
|
|
595
658
|
max_turns: number;
|
|
@@ -606,6 +669,7 @@ interface LoopOutcome {
|
|
|
606
669
|
turns_used: number;
|
|
607
670
|
stopped_reason: "final" | "budget" | "aborted";
|
|
608
671
|
}
|
|
672
|
+
declare function run_conversation(deps: LoopDeps, messages: readonly Message[], params: LoopParams): Promise<LoopOutcome>;
|
|
609
673
|
|
|
610
674
|
interface AgentRunOptions {
|
|
611
675
|
input: string;
|
|
@@ -613,6 +677,8 @@ interface AgentRunOptions {
|
|
|
613
677
|
history?: readonly Message[];
|
|
614
678
|
signal?: AbortSignal;
|
|
615
679
|
label?: string;
|
|
680
|
+
/** Shared transcript handle (TUI: one file per launch). When set, Agent reuses it. */
|
|
681
|
+
session?: SessionHandle;
|
|
616
682
|
}
|
|
617
683
|
interface AgentRunResult {
|
|
618
684
|
outcome: LoopOutcome;
|
|
@@ -635,6 +701,7 @@ declare class Agent {
|
|
|
635
701
|
mcp?: McpRuntime;
|
|
636
702
|
});
|
|
637
703
|
run(options: AgentRunOptions): Promise<AgentRunResult>;
|
|
704
|
+
private run_body;
|
|
638
705
|
/** Close MCP sessions so stdio children do not keep the event loop alive. */
|
|
639
706
|
close(): void;
|
|
640
707
|
/** tools/list once, before the model sees definitions. Empty allowlists never connect. */
|
|
@@ -646,8 +713,8 @@ declare class Agent {
|
|
|
646
713
|
private call_plugin_run_start;
|
|
647
714
|
/** Best-effort on_run_end fan-out; hook errors are logged, never fatal. */
|
|
648
715
|
private call_plugin_run_end;
|
|
649
|
-
/** Best-effort
|
|
650
|
-
private
|
|
716
|
+
/** Best-effort recorder: open failures warn and skip persistence for this run. */
|
|
717
|
+
private open_recorder;
|
|
651
718
|
}
|
|
652
719
|
declare function create_agent(raw_config: unknown): Agent;
|
|
653
720
|
/** create_agent plus plugin loading: broken entries are warned and skipped. */
|
|
@@ -682,18 +749,6 @@ declare class ToolExecutor {
|
|
|
682
749
|
/** Register every builtin tool onto a fresh registry (idempotent per registry). */
|
|
683
750
|
declare function register_builtin_tools(registry: ToolRegistry, context?: ToolContext): void;
|
|
684
751
|
|
|
685
|
-
/**
|
|
686
|
-
* HookedToolRunner: wraps the ToolExecutor with plugin hooks.
|
|
687
|
-
*
|
|
688
|
-
* before_tool_call hooks run in registration order and may veto a call (first
|
|
689
|
-
* blocker wins; the wrapped executor is never called). Hook errors are warned
|
|
690
|
-
* and skipped, never fatal. after_tool_call hooks observe the result summary
|
|
691
|
-
* plus the executor's structured ok/error fields. Every hook invocation
|
|
692
|
-
* receives a ctx exposing only its own plugin's state sub-map: the bag is a
|
|
693
|
-
* module-internal WeakMap keyed on the plugin object, swapped fresh at each
|
|
694
|
-
* call_run_start and shared by the lifecycle and per-tool ctx build sites.
|
|
695
|
-
*/
|
|
696
|
-
|
|
697
752
|
/** Structural ToolRunner shape accepted from the wrapped executor. */
|
|
698
753
|
interface WrappedToolRunner {
|
|
699
754
|
execute(name: string, args: Record<string, unknown>, context?: ToolContext): Promise<ToolResult>;
|
|
@@ -707,6 +762,11 @@ declare class HookedToolRunner {
|
|
|
707
762
|
private readonly wrapped;
|
|
708
763
|
private readonly hooked_plugins;
|
|
709
764
|
constructor(wrapped: WrappedToolRunner, plugins: readonly Plugin[]);
|
|
765
|
+
/**
|
|
766
|
+
* Isolate plugin state for one Agent.run so concurrent runs on the same
|
|
767
|
+
* Agent cannot reset each other's bags (M-6).
|
|
768
|
+
*/
|
|
769
|
+
run_scope<T>(fn: () => Promise<T>): Promise<T>;
|
|
710
770
|
/** Run before hooks in order; the first {block: true} verdict wins. */
|
|
711
771
|
private run_before_hooks;
|
|
712
772
|
/** Fire-and-forget in spirit but awaited here so runs settle cleanly. */
|
|
@@ -722,4 +782,4 @@ declare class HookedToolRunner {
|
|
|
722
782
|
|
|
723
783
|
declare const LICH_VERSION: string;
|
|
724
784
|
|
|
725
|
-
export { type AfterToolCallInfo, Agent, type AgentConfig, AgentEmitter, type AgentEvent, type AgentEventHandler, type AgentEvents, type AgentRunOptions, type AgentRunResult, type BeforeToolCallInfo, type BeforeToolCallResult, type ChatOptions, type ChatResult, type HookContext, HookedToolRunner, LICH_VERSION, type LoadedPlugin, type LoopOutcome, type LoopParams, type Message, type Plugin, type PluginHooks, type PluginLoadError, type ProviderConfig, ProviderError, type RunEndInfo, type Tool, type ToolCall, type ToolContext, type ToolDefinition, ToolExecutor, ToolRegistry, type ToolResult, type Usage, catalog_client_entry, create_agent, create_agent_with_plugins, load_plugins, parse_agent_config, plugin_errors_summary, register_builtin_tools, run_agent };
|
|
785
|
+
export { type AfterToolCallInfo, Agent, type AgentConfig, AgentEmitter, type AgentEvent, type AgentEventHandler, type AgentEvents, type AgentRunOptions, type AgentRunResult, type AssistantMessage, type BeforeToolCallInfo, type BeforeToolCallResult, type ChatOptions, type ChatResult, type HookContext, HookedToolRunner, type JsonSchemaObject, LICH_VERSION, type LoadedPlugin, type LoopDeps, type LoopOutcome, type LoopParams, type Message, type Plugin, type PluginHooks, type PluginLoadError, type ProviderConfig, ProviderError, type RunEndInfo, type Tool, type ToolCall, type ToolContext, type ToolDefinition, ToolExecutor, ToolRegistry, type ToolResult, type ToolRunner, type Usage, catalog_client_entry, create_agent, create_agent_with_plugins, load_plugins, open_session, parse_agent_config, plugin_errors_summary, read_session_messages, register_builtin_tools, run_agent, run_conversation };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LICH_VERSION,
|
|
3
3
|
catalog_client_entry
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-P2YEHNM4.js";
|
|
5
5
|
import {
|
|
6
6
|
Agent,
|
|
7
7
|
AgentEmitter,
|
|
@@ -15,8 +15,13 @@ import {
|
|
|
15
15
|
parse_agent_config,
|
|
16
16
|
plugin_errors_summary,
|
|
17
17
|
register_builtin_tools,
|
|
18
|
-
run_agent
|
|
19
|
-
|
|
18
|
+
run_agent,
|
|
19
|
+
run_conversation
|
|
20
|
+
} from "./chunk-KOEZQUIX.js";
|
|
21
|
+
import {
|
|
22
|
+
open_session,
|
|
23
|
+
read_session_messages
|
|
24
|
+
} from "./chunk-TYRKVBWQ.js";
|
|
20
25
|
export {
|
|
21
26
|
Agent,
|
|
22
27
|
AgentEmitter,
|
|
@@ -29,9 +34,12 @@ export {
|
|
|
29
34
|
create_agent,
|
|
30
35
|
create_agent_with_plugins,
|
|
31
36
|
load_plugins,
|
|
37
|
+
open_session,
|
|
32
38
|
parse_agent_config,
|
|
33
39
|
plugin_errors_summary,
|
|
40
|
+
read_session_messages,
|
|
34
41
|
register_builtin_tools,
|
|
35
|
-
run_agent
|
|
42
|
+
run_agent,
|
|
43
|
+
run_conversation
|
|
36
44
|
};
|
|
37
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|