@livx.cc/agentx 0.99.13 → 0.99.14
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-DYMSg21f.d.ts → Agent-CsVuR2O0.d.ts} +10 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +30 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +30 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -324,6 +324,16 @@ declare class AgentOptions {
|
|
|
324
324
|
* `'off'`/undefined = none; `'low'|'medium'|'high'` or a raw token budget. Mapped to the
|
|
325
325
|
* provider-specific request shape via {@link reasoningToChatFragment}; explicit `providerOptions` wins. */
|
|
326
326
|
reasoning?: ReasoningEffort;
|
|
327
|
+
/** Seed a fresh `run()` with prior conversation turns (real role/content messages) so the model
|
|
328
|
+
* sees history as structured turns instead of a flattened text blob. They are inserted AFTER the
|
|
329
|
+
* stable system prompt and BEFORE the current user turn — so the cached system(+tools) prefix never
|
|
330
|
+
* shifts. Turns are normalized before sending (empties dropped, adjacent same-role coalesced, and the
|
|
331
|
+
* first tail turn forced to `user`) so the transcript is always a valid Anthropic alternation ending
|
|
332
|
+
* at the current user prompt. Unset/empty ⇒ current behavior, byte-for-byte. */
|
|
333
|
+
priorMessages?: Array<{
|
|
334
|
+
role: 'user' | 'assistant';
|
|
335
|
+
content: MessageContent;
|
|
336
|
+
}>;
|
|
327
337
|
}
|
|
328
338
|
/**
|
|
329
339
|
* The agentic loop: chat() -> dispatch tool_calls over the VFS -> thread results
|
package/dist/cli.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
|
-
import { H as Hooks, h as RunResult, R as ReasoningEffort, A as Agent } from './Agent-
|
|
2
|
+
import { H as Hooks, h as RunResult, R as ReasoningEffort, A as Agent } from './Agent-CsVuR2O0.js';
|
|
3
3
|
import { IFilesystem } from '@livx.cc/wcli/core';
|
|
4
4
|
import { M as Message, H as HostBridge, c as ContentPart, e as MessageContent } from './tools-DKf3hN4M.js';
|
|
5
5
|
|
package/dist/cli.js
CHANGED
|
@@ -3318,7 +3318,34 @@ var AgentOptions = class {
|
|
|
3318
3318
|
* `'off'`/undefined = none; `'low'|'medium'|'high'` or a raw token budget. Mapped to the
|
|
3319
3319
|
* provider-specific request shape via {@link reasoningToChatFragment}; explicit `providerOptions` wins. */
|
|
3320
3320
|
reasoning;
|
|
3321
|
+
/** Seed a fresh `run()` with prior conversation turns (real role/content messages) so the model
|
|
3322
|
+
* sees history as structured turns instead of a flattened text blob. They are inserted AFTER the
|
|
3323
|
+
* stable system prompt and BEFORE the current user turn — so the cached system(+tools) prefix never
|
|
3324
|
+
* shifts. Turns are normalized before sending (empties dropped, adjacent same-role coalesced, and the
|
|
3325
|
+
* first tail turn forced to `user`) so the transcript is always a valid Anthropic alternation ending
|
|
3326
|
+
* at the current user prompt. Unset/empty ⇒ current behavior, byte-for-byte. */
|
|
3327
|
+
priorMessages;
|
|
3321
3328
|
};
|
|
3329
|
+
function seedTranscriptTail(prior, current) {
|
|
3330
|
+
const seq = (prior ?? []).filter((m) => contentText(m.content).trim().length > 0).map((m) => ({ role: m.role, content: m.content }));
|
|
3331
|
+
seq.push({ role: "user", content: current });
|
|
3332
|
+
const out = [];
|
|
3333
|
+
for (const m of seq) {
|
|
3334
|
+
const last = out[out.length - 1];
|
|
3335
|
+
if (last && last.role === m.role) {
|
|
3336
|
+
if (typeof last.content === "string" && typeof m.content === "string") {
|
|
3337
|
+
last.content = `${last.content}
|
|
3338
|
+
|
|
3339
|
+
${m.content}`;
|
|
3340
|
+
continue;
|
|
3341
|
+
}
|
|
3342
|
+
out.push({ role: m.role === "user" ? "assistant" : "user", content: "(continuing)" });
|
|
3343
|
+
}
|
|
3344
|
+
out.push({ role: m.role, content: m.content });
|
|
3345
|
+
}
|
|
3346
|
+
if (out.length && out[0].role !== "user") out.unshift({ role: "user", content: "(Earlier conversation)" });
|
|
3347
|
+
return out;
|
|
3348
|
+
}
|
|
3322
3349
|
var Agent = class _Agent {
|
|
3323
3350
|
options;
|
|
3324
3351
|
transcript = [];
|
|
@@ -3486,7 +3513,9 @@ var Agent = class _Agent {
|
|
|
3486
3513
|
const userContent = await this.applyPromptSubmit(task);
|
|
3487
3514
|
this.transcript = [
|
|
3488
3515
|
{ role: "system", content: systemPrompt + (startCtx ? "\n\n" + startCtx : "") },
|
|
3489
|
-
|
|
3516
|
+
// Prior turns (if any) sit between the stable system prefix and the live user turn — the cached
|
|
3517
|
+
// system(+tools) prefix is unaffected; normalization keeps the alternation valid.
|
|
3518
|
+
...seedTranscriptTail(this.options.priorMessages, userContent)
|
|
3490
3519
|
];
|
|
3491
3520
|
return this.runLoop();
|
|
3492
3521
|
}
|