@kodizm/acp 0.6.2 → 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 +24 -12
- 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) {
|
|
@@ -62186,14 +62202,7 @@ function dispatchOpencodeEvent(event, handlers) {
|
|
|
62186
62202
|
}
|
|
62187
62203
|
}
|
|
62188
62204
|
function isTurnComplete(event) {
|
|
62189
|
-
|
|
62190
|
-
return false;
|
|
62191
|
-
const info = event.properties.info;
|
|
62192
|
-
if (info === undefined)
|
|
62193
|
-
return false;
|
|
62194
|
-
if (info.role !== "assistant")
|
|
62195
|
-
return false;
|
|
62196
|
-
return typeof info.time?.completed === "number";
|
|
62205
|
+
return event.type === "session.idle";
|
|
62197
62206
|
}
|
|
62198
62207
|
var MESSAGE_BUS_TYPES;
|
|
62199
62208
|
var init_prompt_stream = __esm(() => {
|
|
@@ -62641,7 +62650,7 @@ var init_driver2 = __esm(() => {
|
|
|
62641
62650
|
// package.json
|
|
62642
62651
|
var package_default = {
|
|
62643
62652
|
name: "@kodizm/acp",
|
|
62644
|
-
version: "0.6.
|
|
62653
|
+
version: "0.6.4",
|
|
62645
62654
|
description: "Custom ACP server bridging Claude Code, codex, and opencode CLIs through a single Kodizm-flavored protocol surface.",
|
|
62646
62655
|
type: "module",
|
|
62647
62656
|
bin: {
|
|
@@ -63337,6 +63346,9 @@ async function main() {
|
|
|
63337
63346
|
await transport.close();
|
|
63338
63347
|
});
|
|
63339
63348
|
await server3.serve();
|
|
63349
|
+
if (activeDriver?.disposeAll !== undefined) {
|
|
63350
|
+
await activeDriver.disposeAll();
|
|
63351
|
+
}
|
|
63340
63352
|
}
|
|
63341
63353
|
if (import.meta.main) {
|
|
63342
63354
|
await main();
|