agent.libx.js 0.87.3 → 0.89.1
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/{Agent-tfPQy4k5.d.ts → Agent-B0l9qT_j.d.ts} +35 -1
- package/dist/cli.d.ts +4 -1
- package/dist/cli.js +422 -20
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +42 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -142,6 +142,32 @@ declare function planMode(opts?: {
|
|
|
142
142
|
/** Run several Hooks as one: preToolUse stops at the first block; post/stop all fire. */
|
|
143
143
|
declare function composeHooks(...list: (Hooks | undefined)[]): Hooks;
|
|
144
144
|
|
|
145
|
+
/**
|
|
146
|
+
* Normalized reasoning/thinking control → provider-specific request fragment.
|
|
147
|
+
*
|
|
148
|
+
* Pure & dependency-free (no `ai.libx.js` import — provider is detected from the
|
|
149
|
+
* `provider/model` prefix), so it stays inside the Agent's structural-typing boundary.
|
|
150
|
+
* The returned fragment is spread into `ai.chat()`; callers never hand-craft the
|
|
151
|
+
* per-provider encoding (Anthropic `thinking.budget_tokens`, OpenAI `reasoning_effort`).
|
|
152
|
+
*/
|
|
153
|
+
/** `'off'`/undefined = no reasoning; named buckets; or a raw token budget (budget-based providers). */
|
|
154
|
+
type ReasoningEffort = 'off' | 'low' | 'medium' | 'high' | number;
|
|
155
|
+
interface ChatFragment {
|
|
156
|
+
providerOptions?: Record<string, unknown>;
|
|
157
|
+
/** Request `max_tokens`. Raised for budget-based providers so `budget_tokens < max_tokens` holds. */
|
|
158
|
+
maxTokens?: number;
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Map a normalized effort to a partial `ChatOptions` fragment for `model`'s provider.
|
|
162
|
+
* Returns `{}` (safe no-op) for `'off'`, undefined, or an unsupported provider.
|
|
163
|
+
*
|
|
164
|
+
* Supported: `anthropic/*` (extended thinking), `openai/*` (reasoning_effort).
|
|
165
|
+
* `google/*` is intentionally NOT mapped here — its adapter `Object.assign`s
|
|
166
|
+
* providerOptions over the built `generationConfig`, clobbering it; pass an
|
|
167
|
+
* explicit `providerOptions` if you need Gemini thinking.
|
|
168
|
+
*/
|
|
169
|
+
declare function reasoningToChatFragment(model: string, effort?: ReasoningEffort): ChatFragment;
|
|
170
|
+
|
|
145
171
|
interface RunResult {
|
|
146
172
|
text: string;
|
|
147
173
|
steps: number;
|
|
@@ -237,6 +263,10 @@ declare class AgentOptions {
|
|
|
237
263
|
};
|
|
238
264
|
/** Provider-specific options forwarded to ai.chat() (e.g. cursor mcpServers, cwd). */
|
|
239
265
|
providerOptions?: Record<string, unknown>;
|
|
266
|
+
/** Extended-thinking / reasoning effort, normalized across providers (anthropic, openai).
|
|
267
|
+
* `'off'`/undefined = none; `'low'|'medium'|'high'` or a raw token budget. Mapped to the
|
|
268
|
+
* provider-specific request shape via {@link reasoningToChatFragment}; explicit `providerOptions` wins. */
|
|
269
|
+
reasoning?: ReasoningEffort;
|
|
240
270
|
}
|
|
241
271
|
/**
|
|
242
272
|
* The agentic loop: chat() -> dispatch tool_calls over the VFS -> thread results
|
|
@@ -251,6 +281,10 @@ declare class Agent {
|
|
|
251
281
|
private prepared;
|
|
252
282
|
private systemPromptCache;
|
|
253
283
|
private started;
|
|
284
|
+
/** Force the next `send()`/`run()` to rebuild the system prompt, tools, plan-mode and permission hooks
|
|
285
|
+
* from `options` — apply mid-conversation changes to `planMode`/`permissions`/`model` etc. (prepare()
|
|
286
|
+
* is otherwise memoized per conversation). */
|
|
287
|
+
reprepare(): void;
|
|
254
288
|
/** Inject tools into a running agent (e.g. dynamically mounted MCP servers). Takes effect on the next turn. */
|
|
255
289
|
addTools(tools: AgentTool[]): void;
|
|
256
290
|
/** Remove tools by name from a running agent. Returns the count removed. */
|
|
@@ -318,4 +352,4 @@ declare class Agent {
|
|
|
318
352
|
trimContext(): Message[];
|
|
319
353
|
}
|
|
320
354
|
|
|
321
|
-
export { Agent as A, DEFAULT_MUTATING as D, type Hooks as H, PermissionOptions as P,
|
|
355
|
+
export { Agent as A, type ChatFragment as C, DEFAULT_MUTATING as D, type Hooks as H, PermissionOptions as P, type ReasoningEffort as R, type ToolUse as T, AgentOptions as a, type Decision as b, PermissionPolicy as c, type PermissionRule as d, type PreToolUseDecision as e, RecordingHooks as f, RecordingLifecycle as g, type RunResult as h, type ToolUseMeta as i, composeHooks as j, planMode as p, reasoningToChatFragment as r };
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import {
|
|
2
|
+
import { h as RunResult, R as ReasoningEffort } from './Agent-B0l9qT_j.js';
|
|
3
3
|
import { IFilesystem } from '@livx.cc/wcli/core';
|
|
4
4
|
import { M as Message, c as ContentPart } from './tools-Ch-OzOU8.js';
|
|
5
5
|
|
|
@@ -52,10 +52,13 @@ interface Args {
|
|
|
52
52
|
maxSteps?: number;
|
|
53
53
|
maxTokens?: number;
|
|
54
54
|
timeoutMs?: number;
|
|
55
|
+
reasoning?: ReasoningEffort;
|
|
55
56
|
help: boolean;
|
|
56
57
|
version: boolean;
|
|
57
58
|
cont: boolean;
|
|
58
59
|
resume?: string;
|
|
60
|
+
sessionId?: string;
|
|
61
|
+
fork?: boolean;
|
|
59
62
|
outputFormat: 'text' | 'json' | 'stream-json';
|
|
60
63
|
allowedTools?: string[];
|
|
61
64
|
disallowedTools?: string[];
|