@livx.cc/agentx 0.99.110 → 0.99.111
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/cli.d.ts +6 -2
- package/dist/cli.js +87 -22
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +34 -11
- package/dist/index.js.map +1 -1
- package/dist/{secondChannel-3IPP3Qgh.d.ts → secondChannel-CJMY5EbL.d.ts} +6 -0
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AgentOptions, H as Hooks, p as RunResult, f as Decider, A as Agent, i as PermissionPolicy, L as LineKind, C as ChannelMode, q as SecondChannelOptions, S as SecondChannel } from './secondChannel-
|
|
2
|
-
export { b as ChatFragment, c as Classification, d as Classifier, e as CompactResult, D as DEFAULT_MUTATING, g as Decision, M as ModelRouter, h as ModelRouterOptions, P as PermissionOptions, j as PermissionRule, k as PreToolUseDecision, R as ReasoningEffort, l as RecordingHooks, m as RecordingLifecycle, n as RouteDecision, o as RouterState, T as Tier, r as ToolUse, s as ToolUseMeta, t as claudeCodeDisallowedTools, u as composeHooks, v as estimateTokens, w as jevAvailable, x as jevClassifier, y as pickTier, z as planMode, B as reasoningToChatFragment } from './secondChannel-
|
|
1
|
+
import { a as AgentOptions, H as Hooks, p as RunResult, f as Decider, A as Agent, i as PermissionPolicy, L as LineKind, C as ChannelMode, q as SecondChannelOptions, S as SecondChannel } from './secondChannel-CJMY5EbL.js';
|
|
2
|
+
export { b as ChatFragment, c as Classification, d as Classifier, e as CompactResult, D as DEFAULT_MUTATING, g as Decision, M as ModelRouter, h as ModelRouterOptions, P as PermissionOptions, j as PermissionRule, k as PreToolUseDecision, R as ReasoningEffort, l as RecordingHooks, m as RecordingLifecycle, n as RouteDecision, o as RouterState, T as Tier, r as ToolUse, s as ToolUseMeta, t as claudeCodeDisallowedTools, u as composeHooks, v as estimateTokens, w as jevAvailable, x as jevClassifier, y as pickTier, z as planMode, B as reasoningToChatFragment } from './secondChannel-CJMY5EbL.js';
|
|
3
3
|
export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, latestClaude, modelShortLabel, resolveModelAlias, resolveModelSwitch } from './models.js';
|
|
4
4
|
import { IFilesystem, FileMetadata } from '@livx.cc/wcli/core';
|
|
5
5
|
export { CommandExecutor, FileMetadata, IFilesystem, IndexedDbFilesystem, MemFilesystem, registerHeadlessCommands } from '@livx.cc/wcli/core';
|
package/dist/index.js
CHANGED
|
@@ -4913,6 +4913,39 @@ var Agent = class _Agent {
|
|
|
4913
4913
|
* steers over its own channel (claude-code's warm InputQueue via `providerOptions.steer`). Non-text
|
|
4914
4914
|
* injections (images) stay queued for the step-boundary `drainInjections()` re-open — the text-only
|
|
4915
4915
|
* steer channel can't carry them. Consumed DURING chat(); no overlap with drainInjections() (post-call). */
|
|
4916
|
+
/** claude-code/*: the providerOptions every step adds (and prewarm, so the session it starts is the one step 1 reuses). */
|
|
4917
|
+
claudeCodePo() {
|
|
4918
|
+
const o = this.options;
|
|
4919
|
+
if (!o.model.startsWith("claude-code/")) return void 0;
|
|
4920
|
+
const po = { steer: () => this.drainPendingSteers() };
|
|
4921
|
+
const bridged = (t) => o.ccBridge === "all" || CC_BRIDGED.has(t.name);
|
|
4922
|
+
if (o.providerOptions?.claudeCodeSession && this.activeTools.some(bridged)) {
|
|
4923
|
+
this.ccServer ??= ccToolServer("agentx", () => this.activeTools.filter(bridged), (n, a) => this.ccExec(n, a));
|
|
4924
|
+
po.mcpServers = { ...o.providerOptions?.mcpServers, agentx: this.ccServer };
|
|
4925
|
+
}
|
|
4926
|
+
const denyTools = claudeCodeDisallowedTools(o.permissions);
|
|
4927
|
+
if (denyTools.length) {
|
|
4928
|
+
const prior = o.providerOptions?.disallowedTools ?? [];
|
|
4929
|
+
po.disallowedTools = [.../* @__PURE__ */ new Set([...prior, ...denyTools])];
|
|
4930
|
+
}
|
|
4931
|
+
return po;
|
|
4932
|
+
}
|
|
4933
|
+
/** claude-code/* warm session: start it now (its process, MCP handshakes) so the first turn doesn't pay for it. Its
|
|
4934
|
+
* system prompt is fixed at the start, so it is prepared here (no task hint) — memoized, the turns reuse the same one.
|
|
4935
|
+
* No model call; the transcript gains only that system message. Other models: nothing to warm. */
|
|
4936
|
+
async prewarm() {
|
|
4937
|
+
const o = this.options;
|
|
4938
|
+
if (!o.model.startsWith("claude-code/") || !o.providerOptions?.claudeCodeSession) return;
|
|
4939
|
+
await this.ensureFs();
|
|
4940
|
+
const systemPrompt = await this.prepare(), startCtx = await this.fireSessionStart();
|
|
4941
|
+
const sys = { role: "system", content: systemPrompt + (startCtx ? "\n\n" + startCtx : "") };
|
|
4942
|
+
if (this.transcript[0]?.role === "system") this.transcript[0] = sys;
|
|
4943
|
+
else this.transcript.unshift(sys);
|
|
4944
|
+
const po = this.claudeCodePo(), frag = reasoningToChatFragment(o.model, o.reasoning);
|
|
4945
|
+
const r = await o.ai.chat({ model: o.model, messages: this.trimContext(), tools: [], stream: true, ...frag, ...o.promptCache ? { promptCache: true } : {}, providerOptions: { ...frag.providerOptions, ...o.providerOptions, ...po, prewarm: true } });
|
|
4946
|
+
for await (const _ of r) {
|
|
4947
|
+
}
|
|
4948
|
+
}
|
|
4916
4949
|
drainPendingSteers() {
|
|
4917
4950
|
if (!this.pendingInjections.length) return [];
|
|
4918
4951
|
const texts = [];
|
|
@@ -5205,18 +5238,8 @@ var Agent = class _Agent {
|
|
|
5205
5238
|
}
|
|
5206
5239
|
};
|
|
5207
5240
|
const cursorPo = isCursorWithTools ? { toolTimeoutMs: effectiveToolTimeoutMs, toolExecutor: hostExec } : void 0;
|
|
5208
|
-
const claudeSteerPo =
|
|
5209
|
-
const bridged = (t) => o.ccBridge === "all" || CC_BRIDGED.has(t.name);
|
|
5210
|
-
if (claudeSteerPo && o.providerOptions?.claudeCodeSession && this.activeTools.some(bridged)) {
|
|
5211
|
-
this.ccServer ??= ccToolServer("agentx", () => this.activeTools.filter(bridged), (n, a) => this.ccExec(n, a));
|
|
5212
|
-
claudeSteerPo.mcpServers = { ...o.providerOptions?.mcpServers, agentx: this.ccServer };
|
|
5213
|
-
}
|
|
5241
|
+
const claudeSteerPo = this.claudeCodePo();
|
|
5214
5242
|
if (this.ccServer) this.ccExec = hostExec;
|
|
5215
|
-
const denyTools = o.model.startsWith("claude-code/") ? claudeCodeDisallowedTools(o.permissions) : [];
|
|
5216
|
-
if (denyTools.length) {
|
|
5217
|
-
const prior = o.providerOptions?.disallowedTools ?? [];
|
|
5218
|
-
claudeSteerPo.disallowedTools = [.../* @__PURE__ */ new Set([...prior, ...denyTools])];
|
|
5219
|
-
}
|
|
5220
5243
|
const cursorDeny = o.model.startsWith("cursor/") ? o.permissions?.denyRules(true) ?? [] : [];
|
|
5221
5244
|
if (cursorDeny.length)
|
|
5222
5245
|
throw new Error(`cursor/* cannot enforce --disallowedTools (${cursorDeny.join(", ")}): its native tools bypass them. Refusing to run \u2014 use a claude-code/* or API model, or drop --disallowedTools.`);
|