@livx.cc/agentx 0.99.93 → 0.99.94
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 +7 -0
- package/dist/cli.js +17 -1
- package/dist/cli.js.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.d.ts
CHANGED
|
@@ -27,6 +27,13 @@ interface SessionMeta {
|
|
|
27
27
|
costEstimated?: boolean;
|
|
28
28
|
/** Per-turn forensic log: timing, outcome, usage, and provider error per turn — for investigating a reported issue. */
|
|
29
29
|
events?: TurnEvent[];
|
|
30
|
+
/** claude-code/*: Claude Code's own session for this transcript — resumed while the transcript is still the `n`
|
|
31
|
+
* messages it last saw, so the history is a cached prefix rather than a re-sent flattened prompt. */
|
|
32
|
+
cc?: {
|
|
33
|
+
id: string;
|
|
34
|
+
n: number;
|
|
35
|
+
model: string;
|
|
36
|
+
};
|
|
30
37
|
}
|
|
31
38
|
/** One turn's diagnostics, captured for offline forensics (mirrors what the footer prints, but persisted). */
|
|
32
39
|
interface TurnEvent {
|
package/dist/cli.js
CHANGED
|
@@ -5105,7 +5105,8 @@ var Agent = class _Agent {
|
|
|
5105
5105
|
// a child obeys the parent's allow/deny rules (else Task is a one-call bypass)
|
|
5106
5106
|
tools: [...o.tools, ...this.injectedTools],
|
|
5107
5107
|
systemPrompt: o.systemPrompt,
|
|
5108
|
-
|
|
5108
|
+
// A child never resumes the parent's own claude-code session (the host's `resume` link is the parent's).
|
|
5109
|
+
providerOptionsFor: o.providerOptionsFor ?? ((m) => modelProvider(m) === modelProvider(o.model) && o.providerOptions ? { ...o.providerOptions, resume: void 0, onClaudeCodeSession: void 0 } : void 0)
|
|
5109
5110
|
};
|
|
5110
5111
|
tools = [...tools, makeTaskTool(taskOpts), makeTaskBatchTool(taskOpts)];
|
|
5111
5112
|
}
|
|
@@ -18455,6 +18456,7 @@ async function runTurn(agent, store, session, task, cp, cwd = process.cwd(), sen
|
|
|
18455
18456
|
}
|
|
18456
18457
|
return origNotify(e);
|
|
18457
18458
|
};
|
|
18459
|
+
const ccRecord = bindClaudeCodeSession(agent, session);
|
|
18458
18460
|
try {
|
|
18459
18461
|
res = await (sendFn ? sendFn(content) : agent.send(content));
|
|
18460
18462
|
} catch (e) {
|
|
@@ -18506,6 +18508,7 @@ async function runTurn(agent, store, session, task, cp, cwd = process.cwd(), sen
|
|
|
18506
18508
|
const ev = { ts: t0, durationMs: Date.now() - t0, model: agent.options.model, finishReason: res.finishReason, steps: res.steps, tools, tokens: res.usage?.totalTokens, costUsd: cost, estimated: res.usageEstimated };
|
|
18507
18509
|
if (res.finishReason === "error" && res.error) ev.error = errInfo(res.error);
|
|
18508
18510
|
(session.meta.events ??= []).push(ev);
|
|
18511
|
+
ccRecord?.(ok);
|
|
18509
18512
|
if (!session.meta.title) {
|
|
18510
18513
|
session.meta.title = titleOf(agent.transcript);
|
|
18511
18514
|
if (session.meta.title) setTermTitle(`agentx \xB7 ${session.meta.title}`);
|
|
@@ -18518,6 +18521,19 @@ async function runTurn(agent, store, session, task, cp, cwd = process.cwd(), sen
|
|
|
18518
18521
|
}
|
|
18519
18522
|
return { ok, res };
|
|
18520
18523
|
}
|
|
18524
|
+
function bindClaudeCodeSession(agent, session) {
|
|
18525
|
+
const po = agent.options.providerOptions;
|
|
18526
|
+
if (!po?.claudeCodeSession) return void 0;
|
|
18527
|
+
const cc = session.meta.cc, model = agent.options.model;
|
|
18528
|
+
let id;
|
|
18529
|
+
const resume = cc && cc.model === model && cc.n === agent.transcript.length ? cc.id : void 0;
|
|
18530
|
+
agent.options.providerOptions = { ...po, resume, onClaudeCodeSession: (s) => {
|
|
18531
|
+
id = s;
|
|
18532
|
+
} };
|
|
18533
|
+
return (ok) => {
|
|
18534
|
+
session.meta.cc = ok && id ? { id, n: agent.transcript.length, model } : void 0;
|
|
18535
|
+
};
|
|
18536
|
+
}
|
|
18521
18537
|
var remintSessionImages = (data, store, cwd) => remintImageRefs(data.messages, [join16(store.dir, `${data.meta.id}.images`), cwd]);
|
|
18522
18538
|
function startSession(args, store, agent, cwd) {
|
|
18523
18539
|
if (args.resume || args.cont) {
|