@acnlabs/acn-cli 1.0.2 → 1.0.3
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 +33 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -31,7 +31,7 @@ var require_package = __commonJS({
|
|
|
31
31
|
"package.json"(exports2, module2) {
|
|
32
32
|
module2.exports = {
|
|
33
33
|
name: "@acnlabs/acn-cli",
|
|
34
|
-
version: "1.0.
|
|
34
|
+
version: "1.0.3",
|
|
35
35
|
description: "Official CLI for ACN (Agent Collaboration Network) \u2014 zero-integration agent access",
|
|
36
36
|
main: "dist/index.js",
|
|
37
37
|
bin: {
|
|
@@ -1741,8 +1741,8 @@ function extractUsage(payload) {
|
|
|
1741
1741
|
const rec = asRecord2(payload);
|
|
1742
1742
|
if (!rec) return void 0;
|
|
1743
1743
|
const usageRec = asRecord2(rec.usage) ?? rec;
|
|
1744
|
-
const input = asNonNegInt(usageRec.input_tokens) ?? asNonNegInt(usageRec.prompt_tokens);
|
|
1745
|
-
const output2 = asNonNegInt(usageRec.output_tokens) ?? asNonNegInt(usageRec.completion_tokens);
|
|
1744
|
+
const input = asNonNegInt(usageRec.input_tokens) ?? asNonNegInt(usageRec.prompt_tokens) ?? asNonNegInt(usageRec.input);
|
|
1745
|
+
const output2 = asNonNegInt(usageRec.output_tokens) ?? asNonNegInt(usageRec.completion_tokens) ?? asNonNegInt(usageRec.output);
|
|
1746
1746
|
if (input === null && output2 === null) return void 0;
|
|
1747
1747
|
const out = {
|
|
1748
1748
|
input_tokens: input ?? 0,
|
|
@@ -1754,6 +1754,18 @@ function extractUsage(payload) {
|
|
|
1754
1754
|
}
|
|
1755
1755
|
const modelId = extractModelId(payload);
|
|
1756
1756
|
if (modelId) out.model_id = modelId;
|
|
1757
|
+
const reasoning = asNonNegInt(usageRec.reasoning_tokens) ?? asNonNegInt(usageRec.reasoningTokens);
|
|
1758
|
+
const cacheRead = asNonNegInt(usageRec.cache_read_tokens) ?? asNonNegInt(usageRec.cacheRead);
|
|
1759
|
+
const cacheWrite = asNonNegInt(usageRec.cache_write_tokens) ?? asNonNegInt(usageRec.cacheWrite);
|
|
1760
|
+
const total = asNonNegInt(usageRec.total_tokens) ?? asNonNegInt(usageRec.total);
|
|
1761
|
+
const duration = asNonNegInt(usageRec.duration_ms) ?? asNonNegInt(usageRec.durationMs) ?? asNonNegInt(rec.duration_ms) ?? asNonNegInt(rec.durationMs);
|
|
1762
|
+
const provider = typeof usageRec.provider === "string" && usageRec.provider.trim() || typeof rec.provider === "string" && rec.provider.trim() || "";
|
|
1763
|
+
if (reasoning !== null) out.reasoning_tokens = reasoning;
|
|
1764
|
+
if (cacheRead !== null) out.cache_read_tokens = cacheRead;
|
|
1765
|
+
if (cacheWrite !== null) out.cache_write_tokens = cacheWrite;
|
|
1766
|
+
if (total !== null) out.total_tokens = total;
|
|
1767
|
+
if (duration !== null) out.duration_ms = duration;
|
|
1768
|
+
if (provider) out.provider = provider.slice(0, 80);
|
|
1757
1769
|
return out;
|
|
1758
1770
|
}
|
|
1759
1771
|
function parseCompletePayload(payload) {
|
|
@@ -1926,6 +1938,24 @@ async function postWriteback(event, complete, opts, deps) {
|
|
|
1926
1938
|
if (complete.usage.model_id) {
|
|
1927
1939
|
usageBody.model_id = complete.usage.model_id;
|
|
1928
1940
|
}
|
|
1941
|
+
if (complete.usage.reasoning_tokens != null) {
|
|
1942
|
+
usageBody.reasoning_tokens = complete.usage.reasoning_tokens;
|
|
1943
|
+
}
|
|
1944
|
+
if (complete.usage.cache_read_tokens != null) {
|
|
1945
|
+
usageBody.cache_read_tokens = complete.usage.cache_read_tokens;
|
|
1946
|
+
}
|
|
1947
|
+
if (complete.usage.cache_write_tokens != null) {
|
|
1948
|
+
usageBody.cache_write_tokens = complete.usage.cache_write_tokens;
|
|
1949
|
+
}
|
|
1950
|
+
if (complete.usage.total_tokens != null) {
|
|
1951
|
+
usageBody.total_tokens = complete.usage.total_tokens;
|
|
1952
|
+
}
|
|
1953
|
+
if (complete.usage.duration_ms != null) {
|
|
1954
|
+
usageBody.duration_ms = complete.usage.duration_ms;
|
|
1955
|
+
}
|
|
1956
|
+
if (complete.usage.provider) {
|
|
1957
|
+
usageBody.provider = complete.usage.provider;
|
|
1958
|
+
}
|
|
1929
1959
|
body.usage = usageBody;
|
|
1930
1960
|
} else if (complete.modelId) {
|
|
1931
1961
|
body.usage = { model_id: complete.modelId };
|