@livx.cc/agentx 0.99.15 → 0.99.16
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-CsVuR2O0.d.ts → Agent-CvLBalJE.d.ts} +13 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +54 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as AgentOptions, H as Hooks, h as RunResult, A as Agent } from './Agent-
|
|
2
|
-
export { C as ChatFragment, D as DEFAULT_MUTATING, b as Decision, P as PermissionOptions, c as PermissionPolicy, d as PermissionRule, e as PreToolUseDecision, R as ReasoningEffort, f as RecordingHooks, g as RecordingLifecycle, T as ToolUse, i as ToolUseMeta, j as composeHooks, p as planMode, r as reasoningToChatFragment } from './Agent-
|
|
1
|
+
import { a as AgentOptions, H as Hooks, h as RunResult, A as Agent } from './Agent-CvLBalJE.js';
|
|
2
|
+
export { C as ChatFragment, D as DEFAULT_MUTATING, b as Decision, P as PermissionOptions, c as PermissionPolicy, d as PermissionRule, e as PreToolUseDecision, R as ReasoningEffort, f as RecordingHooks, g as RecordingLifecycle, T as ToolUse, i as ToolUseMeta, j as composeHooks, p as planMode, r as reasoningToChatFragment } from './Agent-CvLBalJE.js';
|
|
3
3
|
export { MODEL_ALIASES, ModelSwitch, ResolveModelSwitchOpts, 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
|
@@ -3368,6 +3368,27 @@ var Agent = class _Agent {
|
|
|
3368
3368
|
if (this.options.tools) this.options.tools = this.options.tools.filter((t) => !s.has(t.name));
|
|
3369
3369
|
return before - this.activeTools.length;
|
|
3370
3370
|
}
|
|
3371
|
+
/** Messages the host queued to steer the RUNNING turn (Claude-Code-style mid-turn input). The loop
|
|
3372
|
+
* drains them at each step boundary — after tool results are appended, before the next model call —
|
|
3373
|
+
* so they ride along with the latest tool results. A no-op between turns (nothing drains it). */
|
|
3374
|
+
pendingInjections = [];
|
|
3375
|
+
/** Queue a user message into the in-flight turn. It lands as a `user` message at the next step
|
|
3376
|
+
* boundary; if the model was about to stop, the injection re-opens the loop so it's never lost.
|
|
3377
|
+
* Pushing onto `transcript` directly from outside would race the loop — this drains inside it. */
|
|
3378
|
+
inject(content) {
|
|
3379
|
+
this.pendingInjections.push(content);
|
|
3380
|
+
}
|
|
3381
|
+
/** Drop any queued-but-unconsumed injections. The REPL calls this after a LOCAL command (/cmd, !bash)
|
|
3382
|
+
* — which runs no send() to drain them — so a mid-command steer can't leak into the next real turn. */
|
|
3383
|
+
clearInjections() {
|
|
3384
|
+
this.pendingInjections.length = 0;
|
|
3385
|
+
}
|
|
3386
|
+
/** Fold any host-injected messages into the transcript as user turns. Returns true if any landed. */
|
|
3387
|
+
drainInjections() {
|
|
3388
|
+
if (!this.pendingInjections.length) return false;
|
|
3389
|
+
for (const content of this.pendingInjections.splice(0)) this.transcript.push({ role: "user", content });
|
|
3390
|
+
return true;
|
|
3391
|
+
}
|
|
3371
3392
|
constructor(options) {
|
|
3372
3393
|
this.options = { ...new AgentOptions(), ...options };
|
|
3373
3394
|
if (this.options.fs) this.buildCtx();
|
|
@@ -3633,6 +3654,7 @@ var Agent = class _Agent {
|
|
|
3633
3654
|
});
|
|
3634
3655
|
}
|
|
3635
3656
|
if (toolCalls.length === 0) {
|
|
3657
|
+
if (this.drainInjections()) continue;
|
|
3636
3658
|
log4.verbose(`completed in ${steps} step(s)`);
|
|
3637
3659
|
await this.ctx.jobs?.drain();
|
|
3638
3660
|
await this.activeHooks?.onStop?.(res.content ?? "");
|
|
@@ -3657,6 +3679,7 @@ var Agent = class _Agent {
|
|
|
3657
3679
|
}
|
|
3658
3680
|
this.transcript.push({ role: "tool", tool_call_id: tc.id, name: tc.function.name, content });
|
|
3659
3681
|
}
|
|
3682
|
+
this.drainInjections();
|
|
3660
3683
|
}
|
|
3661
3684
|
}
|
|
3662
3685
|
/**
|