@xtruder/opencode-claude-max-plugin 0.2.3 → 0.2.5

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/build/index.js CHANGED
@@ -428,8 +428,8 @@ function convertStream(anthropicStream, modelId) {
428
428
  finishReason,
429
429
  usage: {
430
430
  inputTokens: {
431
- total: inputTokens ?? 0,
432
- noCache: undefined,
431
+ total: (inputTokens ?? 0) + (cachedInputTokens ?? 0) + (cacheCreationTokens ?? 0),
432
+ noCache: inputTokens ?? 0,
433
433
  cacheRead: cachedInputTokens ?? 0,
434
434
  cacheWrite: cacheCreationTokens ?? 0
435
435
  },
@@ -864,8 +864,8 @@ class AnthropicSDKModel {
864
864
  finishReason: mapFinishReason2(response.stop_reason),
865
865
  usage: {
866
866
  inputTokens: {
867
- total: response.usage.input_tokens,
868
- noCache: undefined,
867
+ total: response.usage.input_tokens + cacheReadTokens + cacheCreateTokens,
868
+ noCache: response.usage.input_tokens,
869
869
  cacheRead: cacheReadTokens,
870
870
  cacheWrite: cacheCreateTokens
871
871
  },
package/build/server.js CHANGED
@@ -428,8 +428,8 @@ function convertStream(anthropicStream, modelId) {
428
428
  finishReason,
429
429
  usage: {
430
430
  inputTokens: {
431
- total: inputTokens ?? 0,
432
- noCache: undefined,
431
+ total: (inputTokens ?? 0) + (cachedInputTokens ?? 0) + (cacheCreationTokens ?? 0),
432
+ noCache: inputTokens ?? 0,
433
433
  cacheRead: cachedInputTokens ?? 0,
434
434
  cacheWrite: cacheCreationTokens ?? 0
435
435
  },
@@ -864,8 +864,8 @@ class AnthropicSDKModel {
864
864
  finishReason: mapFinishReason2(response.stop_reason),
865
865
  usage: {
866
866
  inputTokens: {
867
- total: response.usage.input_tokens,
868
- noCache: undefined,
867
+ total: response.usage.input_tokens + cacheReadTokens + cacheCreateTokens,
868
+ noCache: response.usage.input_tokens,
869
869
  cacheRead: cacheReadTokens,
870
870
  cacheWrite: cacheCreateTokens
871
871
  },
@@ -1 +1 @@
1
- {"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,EAGV,eAAe,EAEhB,MAAM,yBAAyB,CAAA;AA+XhC,QAAA,MAAM,MAAM,EAAE,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAG3C,CAAA;AAED,eAAe,MAAM,CAAA"}
1
+ {"version":3,"file":"tui.d.ts","sourceRoot":"","sources":["../src/tui.tsx"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,OAAO,KAAK,EAGV,eAAe,EAEhB,MAAM,yBAAyB,CAAA;AAoYhC,QAAA,MAAM,MAAM,EAAE,eAAe,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAG3C,CAAA;AAED,eAAe,MAAM,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtruder/opencode-claude-max-plugin",
3
- "version": "0.2.3",
3
+ "version": "0.2.5",
4
4
  "description": "OpenCode plugin for Claude Max/Pro subscription via @anthropic-ai/sdk - uses Claude Code OAuth credentials",
5
5
  "keywords": [
6
6
  "ai-sdk",
@@ -31,9 +31,9 @@
31
31
  "./tui": {
32
32
  "import": "./src/tui.tsx",
33
33
  "config": {
34
- "enabled": true,
35
- "sidebar": true,
36
- "poll_interval": 60
34
+ "enabled": "true",
35
+ "sidebar": "true",
36
+ "poll_interval": "60"
37
37
  }
38
38
  }
39
39
  },
@@ -57,7 +57,7 @@
57
57
  "@ai-sdk/provider-utils": "3.0.2",
58
58
  "@opencode-ai/plugin": "^1.3.0",
59
59
  "@opentui/solid": "^0.1.96",
60
- "ai": "5.0.124",
60
+ "ai": "^6.0.146",
61
61
  "bun-types": "^1.3.11",
62
62
  "oxfmt": "^0.41.0",
63
63
  "oxlint": "^1.56.0",
package/src/tui.tsx CHANGED
@@ -29,13 +29,18 @@ type Cfg = {
29
29
  }
30
30
 
31
31
  const bool = (value: unknown, fallback: boolean) => {
32
- if (typeof value !== "boolean") return fallback
33
- return value
32
+ if (typeof value === "boolean") return value
33
+ if (typeof value === "string") return value === "true"
34
+ return fallback
34
35
  }
35
36
 
36
37
  const num = (value: unknown, fallback: number) => {
37
- if (typeof value !== "number") return fallback
38
- return value
38
+ if (typeof value === "number") return value
39
+ if (typeof value === "string" && value.length > 0) {
40
+ const n = Number(value)
41
+ if (!Number.isNaN(n)) return n
42
+ }
43
+ return fallback
39
44
  }
40
45
 
41
46
  const rec = (value: unknown) => {