@kodizm/acp 0.6.3 → 0.6.4
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/index.js +20 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55866,6 +55866,7 @@ class OpencodeEventMapper {
|
|
|
55866
55866
|
subagents = new Map;
|
|
55867
55867
|
toolBegan = new Set;
|
|
55868
55868
|
toolEnded = new Set;
|
|
55869
|
+
usageByMessage = new Map;
|
|
55869
55870
|
compactingActive = false;
|
|
55870
55871
|
constructor(options) {
|
|
55871
55872
|
this.options = options;
|
|
@@ -56003,14 +56004,29 @@ class OpencodeEventMapper {
|
|
|
56003
56004
|
const tokens = info.tokens;
|
|
56004
56005
|
if (tokens === undefined)
|
|
56005
56006
|
return;
|
|
56006
|
-
|
|
56007
|
-
sessionId: this.options.sessionId,
|
|
56008
|
-
type: "usage",
|
|
56007
|
+
const current = {
|
|
56009
56008
|
inputTokens: tokens.input ?? 0,
|
|
56010
56009
|
outputTokens: tokens.output ?? 0,
|
|
56011
56010
|
cacheReadTokens: tokens.cache?.read ?? 0,
|
|
56012
56011
|
cacheCreationTokens: tokens.cache?.write ?? 0,
|
|
56013
56012
|
costUsd: typeof info.cost === "number" ? info.cost : 0
|
|
56013
|
+
};
|
|
56014
|
+
const previous = this.usageByMessage.get(info.id);
|
|
56015
|
+
this.usageByMessage.set(info.id, current);
|
|
56016
|
+
const delta = previous === undefined ? current : {
|
|
56017
|
+
inputTokens: current.inputTokens - previous.inputTokens,
|
|
56018
|
+
outputTokens: current.outputTokens - previous.outputTokens,
|
|
56019
|
+
cacheReadTokens: current.cacheReadTokens - previous.cacheReadTokens,
|
|
56020
|
+
cacheCreationTokens: current.cacheCreationTokens - previous.cacheCreationTokens,
|
|
56021
|
+
costUsd: current.costUsd - previous.costUsd
|
|
56022
|
+
};
|
|
56023
|
+
const changed = delta.inputTokens !== 0 || delta.outputTokens !== 0 || delta.cacheReadTokens !== 0 || delta.cacheCreationTokens !== 0 || delta.costUsd !== 0;
|
|
56024
|
+
if (!changed)
|
|
56025
|
+
return;
|
|
56026
|
+
this.options.emit({
|
|
56027
|
+
sessionId: this.options.sessionId,
|
|
56028
|
+
type: "usage",
|
|
56029
|
+
...delta
|
|
56014
56030
|
});
|
|
56015
56031
|
}
|
|
56016
56032
|
handleSessionUpdated(payload) {
|
|
@@ -62634,7 +62650,7 @@ var init_driver2 = __esm(() => {
|
|
|
62634
62650
|
// package.json
|
|
62635
62651
|
var package_default = {
|
|
62636
62652
|
name: "@kodizm/acp",
|
|
62637
|
-
version: "0.6.
|
|
62653
|
+
version: "0.6.4",
|
|
62638
62654
|
description: "Custom ACP server bridging Claude Code, codex, and opencode CLIs through a single Kodizm-flavored protocol surface.",
|
|
62639
62655
|
type: "module",
|
|
62640
62656
|
bin: {
|