linkshell-cli 0.5.15 → 0.5.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/cli/src/runtime/acp/agent-workspace.js +21 -0
- package/dist/cli/src/runtime/acp/agent-workspace.js.map +1 -1
- package/dist/cli/src/runtime/usage-report.d.ts +34 -0
- package/dist/cli/src/runtime/usage-report.js +325 -0
- package/dist/cli/src/runtime/usage-report.js.map +1 -0
- package/dist/cli/tsconfig.tsbuildinfo +1 -1
- package/dist/shared-protocol/src/index.d.ts +570 -2
- package/dist/shared-protocol/src/index.js +37 -0
- package/dist/shared-protocol/src/index.js.map +1 -1
- package/package.json +3 -3
- package/src/runtime/acp/agent-workspace.ts +20 -0
- package/src/runtime/usage-report.ts +335 -0
- package/web/assets/index-CpannLtQ.js +94 -0
- package/web/assets/index-Cxv9bt2l.css +33 -0
- package/web/index.html +2 -2
- package/web/assets/index-BXxBRB9A.css +0 -33
- package/web/assets/index-DAgnaJ6t.js +0 -94
|
@@ -5,6 +5,7 @@ import { createEnvelope, parseTypedPayload, } from "@linkshell/protocol";
|
|
|
5
5
|
import { AcpClient } from "./acp-client.js";
|
|
6
6
|
import { ClaudeSdkClient } from "./claude-sdk-client.js";
|
|
7
7
|
import { ClaudeStreamJsonClient } from "./claude-stream-json-client.js";
|
|
8
|
+
import { aggregateUsage } from "../usage-report.js";
|
|
8
9
|
import { resolveAgentCommand } from "./provider-resolver.js";
|
|
9
10
|
const PERMISSION_TIMEOUT_MS = 5 * 60_000;
|
|
10
11
|
const MAX_TIMELINE_ITEMS = 200;
|
|
@@ -1483,6 +1484,26 @@ export class AgentWorkspaceProxy {
|
|
|
1483
1484
|
await this.loadOlderHistory(payload);
|
|
1484
1485
|
break;
|
|
1485
1486
|
}
|
|
1487
|
+
case "agent.v2.usage.request": {
|
|
1488
|
+
// Aggregate ALL on-disk transcripts (decoupled from live turns). The
|
|
1489
|
+
// scan is synchronous (~3s over a large corpus); acceptable for an
|
|
1490
|
+
// explicit, on-demand dashboard open. Errors must never break the
|
|
1491
|
+
// session, so swallow + send an empty report.
|
|
1492
|
+
try {
|
|
1493
|
+
const report = aggregateUsage();
|
|
1494
|
+
this.input.send(createEnvelope({
|
|
1495
|
+
type: "agent.v2.usage.report",
|
|
1496
|
+
sessionId: this.input.sessionId,
|
|
1497
|
+
payload: report,
|
|
1498
|
+
}));
|
|
1499
|
+
}
|
|
1500
|
+
catch (error) {
|
|
1501
|
+
if (this.input.verbose) {
|
|
1502
|
+
process.stderr.write(`[agent:v2] usage aggregation failed: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
break;
|
|
1506
|
+
}
|
|
1486
1507
|
case "agent.v2.prompt": {
|
|
1487
1508
|
const payload = parseTypedPayload("agent.v2.prompt", envelope.payload);
|
|
1488
1509
|
await this.sendPrompt(payload);
|