pi-opencode-go-provider 1.1.21 → 1.1.26

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.
@@ -0,0 +1,58 @@
1
+ name: Update models
2
+
3
+ on:
4
+ schedule:
5
+ - cron: "7 0 * * *" # 07:07 Asia/Ho_Chi_Minh
6
+ workflow_dispatch:
7
+
8
+ # Publishing uses npm Trusted Publishing (OIDC) bound to this workflow file, so
9
+ # no npm token is stored. A version pushed while publishing was unavailable is
10
+ # published by the next run that finds it missing from npm.
11
+ permissions:
12
+ contents: write
13
+ id-token: write
14
+
15
+ concurrency:
16
+ group: update-models
17
+ cancel-in-progress: false
18
+
19
+ jobs:
20
+ update:
21
+ runs-on: ubuntu-latest
22
+ timeout-minutes: 15
23
+ steps:
24
+ - uses: actions/checkout@v5
25
+
26
+ - uses: actions/setup-node@v5
27
+ with:
28
+ node-version: 24
29
+
30
+ - name: Fetch the model catalog
31
+ run: node scripts/update-models.js
32
+
33
+ - name: Commit, bump and push
34
+ run: |
35
+ if git diff --quiet; then
36
+ echo "No model changes."
37
+ exit 0
38
+ fi
39
+ git config user.name "github-actions[bot]"
40
+ git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
41
+ git add -A
42
+ git commit -m "feat: update opencode-go models from API"
43
+ npm version patch --no-git-tag-version
44
+ version=$(node -p "require('./package.json').version")
45
+ git commit -am "chore(release): v$version"
46
+ git push origin HEAD:main
47
+
48
+ - name: Publish to npm if this version is missing
49
+ run: |
50
+ name=$(node -p "require('./package.json').name")
51
+ version=$(node -p "require('./package.json').version")
52
+ if npm view "$name@$version" version >/dev/null 2>&1; then
53
+ echo "$name@$version is already on npm."
54
+ exit 0
55
+ fi
56
+ # Trusted publishing needs npm 11.5.1 or newer.
57
+ npm install --global npm@latest
58
+ npm publish --access public --provenance
package/AGENTS.md CHANGED
@@ -19,6 +19,7 @@ When a model needs overrides, new properties, or corrections, edit the appropria
19
19
  | `patch.json` | Per-model overrides keyed by model ID. Add reasoning flags, compat settings, pricing corrections, thinking level maps, etc. Applied on top of `models.json` at runtime and for README generation. |
20
20
  | `custom-models.json` | Models that don't exist in the provider API (hidden models, router endpoints, cross-provider aliases). Merged after patch. Format: array of full model objects (same schema as `models.json` entries). |
21
21
  | `index.ts` | Provider extension code. |
22
+ | `sync-policy.ts` | Quiet startup sync policy (TTL, key fingerprint, cross-process lock). Provider-agnostic and shared verbatim across pi-*-provider repos — keep it free of provider specifics. Also dedupes usage-widget polls (`usage-controller.ts`). |
22
23
  | `scripts/update-models.js` | The sync script itself (edit only if changing how models are fetched/transformed). |
23
24
 
24
25
  ## Data Flow
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.1.26
4
+
5
+ - Pin Pi SDK development dependencies to 1.2.0 while retaining wildcard host peers; verify real manifest loading, lifecycle and native/bundled Pi hosts offline.
6
+
7
+ ## 1.1.22
8
+
9
+ - Quiet startup sync: background `/v1/models` revalidation runs only with an API key, only when the disk cache is older than 1 hour (`PI_PROVIDER_SYNC_TTL_MS`, `0` = always), missing, or fetched with a different key, and only in one pi process at a time (lock file next to the cache). Failed refreshes back off for 5 minutes; sessions that skip adopt a cache refreshed by another process.
10
+ - Never store the API key: key changes are detected via a salted sha256 fingerprint in `cache/opencode-go-models.sync.json`. The cache file format is unchanged.
11
+ - Usage widget: no polling without a UI (print/JSON mode, fan-out child agents) or without an API key. Background usage polls are shared across pi processes — one process polls `/zen/go/v1/usage` per 30 seconds and writes `cache/opencode-go-usage.json`, the others render it. `/opencode-go-usage` still always re-reads the API.
12
+ - Write the model cache atomically and swallow API key resolution failures in `session_start`.
13
+ - Add vitest coverage for the sync policy, the session_start integration and usage polling dedupe.
14
+
3
15
  ## 1.1.15
4
16
 
5
17
  - Pin Pi SDK development dependencies to 1.0.0 while retaining wildcard host peers.
package/README.md CHANGED
@@ -26,6 +26,7 @@ Run `bun run test:pi` for offline manifest, catalog, lifecycle and streaming che
26
26
  - **Cost Tracking** with per-model pricing for budget management
27
27
  - **Reasoning Models** with thinking level maps for proper effort control
28
28
  - **Prompt-cache session affinity** — sends `x-opencode-session` and `x-opencode-client` so OpenCode Go can pin a session to the same cache node
29
+ - **Quiet live model sync** — Models refresh from the OpenCode Go API in the background, at most hourly and by one pi process at a time ([details](#model-sync))
29
30
  - **Usage widget** — shows how much of the OpenCode Go 5h / 7d / 30d budgets you have spent, below the editor (footer status line outside the TUI). Each account carries its own budgets, so when [pi-multiprovider](https://github.com/monotykamary/pi-multiprovider) 0.8.0+ pools several `opencode-go` accounts the widget bills the session's active one and repaints on every switch or resume.
30
31
 
31
32
  ## Installation
@@ -75,11 +76,11 @@ pi
75
76
 
76
77
  | Model | API | Type | Context | Max Tokens | Input Cost | Output Cost |
77
78
  |-------|-----|------|---------|------------|------------|-------------|
79
+ | Cat Jam Free | Completions | Text | 262K | 131K | — | — |
78
80
  | Claude Haiku 5.5 | Anthropic | Text + Image | 1.0M | 128K | $0.10 | $0.50 |
79
- | DeepSeek V4 Flash | Completions | Text | 1.0M | 384K | $0.15 | $0.60 |
80
- | DeepSeek V4 Flash Vision Exp | Completions | Text + Image | 1.0M | 384K | $0.15 | $0.60 |
81
81
  | DeepSeek V4 Pro (New) | Completions | Text | 1.0M | 384K | $0.66 | $1.98 |
82
82
  | DeepSeek V4.1 Flash | Completions | Text + Image | 1.0M | 384K | $0.15 | $0.60 |
83
+ | Gemini 4 Argon Contributor | Completions | Text + Image | 1.0M | 66K | $4.00 | $20.00 |
83
84
  | GLM-5.2 | Completions | Text | 1.0M | 131K | $1.40 | $4.40 |
84
85
  | GLM-5.3 | Completions | Text | 1.0M | 131K | $1.40 | $4.40 |
85
86
  | GLM-5.3-Flash | Completions | Text + Image | 1.0M | 131K | $0.15 | $0.50 |
@@ -125,8 +126,13 @@ The default model for this provider is `kimi-k2.6` (matching pi core's built-in
125
126
  OpenCode Go meters the plan with three dollar budgets — a rolling 5-hour window,
126
127
  a weekly window and a monthly window. The extension polls
127
128
  `GET https://opencode.ai/zen/go/v1/usage` with your API key and shows how much of
128
- each budget is **left**, below the editor. When no terminal UI is attached (print
129
- or JSON mode) the same line goes to the footer status bar instead.
129
+ each budget is **left**, below the editor. Outside the TUI (e.g. RPC mode) the
130
+ same line goes to the footer status bar instead. Sessions without a UI at all
131
+ (print/JSON mode, fan-out child agents) never poll, and neither does a session
132
+ without an API key. Background polls are shared across pi processes: one process
133
+ polls at most every 30 seconds and writes the snapshot to
134
+ `~/.pi/agent/cache/opencode-go-usage.json` (key fingerprint only, never the key),
135
+ and the others render that file. `/opencode-go-usage` always re-reads the API.
130
136
 
131
137
  ```
132
138
  Usage: 5h: 63% · 7d: 41% · 30d: 12% · 5h ↺ 2h14m · 7d ↺ 3d20h · 30d ↺ 20d0h
@@ -202,6 +208,7 @@ The opencode-go API key can be configured in multiple ways. Credentials are reso
202
208
  | `OPENCODE_API_KEY` | No | Your opencode.ai API key (fallback if not in auth.json). Also used for usage requests |
203
209
  | `OPENCODE_GO_USAGE` | No | Set to `off`/`false`/`0` to disable the usage widget without editing the config file |
204
210
  | `OPENCODE_GO_USAGE_INTERVAL_MS` | No | Override the usage poll interval (clamped to 15s–10m) |
211
+ | `PI_PROVIDER_SYNC_TTL_MS` | No | Model sync freshness window in ms (default `3600000`; `0` = revalidate every session start) |
205
212
 
206
213
  ## Configuration
207
214
 
@@ -215,6 +222,21 @@ Add to your pi configuration for automatic loading:
215
222
  }
216
223
  ```
217
224
 
225
+ ## Model sync
226
+
227
+ Startup never waits on the network. pi starts with the cached catalog (`~/.pi/agent/cache/opencode-go-models.json`,
228
+ falling back to the bundled `models.json`) and revalidates against `/v1/models` in the background — only when:
229
+
230
+ - an OpenCode Go API key is configured (no key, no request),
231
+ - the cache is older than 1 hour, missing, or was fetched with a different API key, and
232
+ - no other pi process is already refreshing it (an `opencode-go-models.lock` file next to the cache).
233
+
234
+ So `/new`, `/reload`, `pi -p` and fan-out child agents share one cache instead of each calling the API; a
235
+ session that skips the fetch still picks up a cache another process refreshed. A failed refresh is retried after
236
+ 5 minutes at the earliest. `PI_PROVIDER_SYNC_TTL_MS` changes the window (`0` revalidates on every session start).
237
+ Only a hash fingerprint of the key is stored (`opencode-go-models.sync.json`), never the key itself. The usage
238
+ widget shares its polls the same way (see [Usage Widget](#usage-widget)).
239
+
218
240
  ## License
219
241
 
220
242
  MIT
package/config.ts CHANGED
@@ -52,6 +52,15 @@ export function configPath(): string {
52
52
  return path.join(getAgentDir(), CONFIG_BASENAME);
53
53
  }
54
54
 
55
+ /**
56
+ * Shared usage snapshot written by whichever pi process last polled
57
+ * /zen/go/v1/usage, so other processes render it from disk instead of polling.
58
+ * Resolved per call: the agent dir can change between sessions (and tests).
59
+ */
60
+ export function usageCachePath(): string {
61
+ return path.join(getAgentDir(), "cache", `${PROVIDER_ID}-usage.json`);
62
+ }
63
+
55
64
  export function clampRefreshInterval(milliseconds: number): number {
56
65
  if (!Number.isFinite(milliseconds)) return DEFAULT_USAGE_CONFIG.refreshIntervalMs;
57
66
  return Math.max(MIN_USAGE_REFRESH_MS, Math.min(MAX_USAGE_REFRESH_MS, Math.round(milliseconds)));
@@ -1,85 +1,65 @@
1
1
  {
2
- "qwen3.7-max": {
3
- "id": "qwen3.7-max",
4
- "name": "Qwen3.7 Max",
2
+ "space-bunny-free": {
3
+ "id": "space-bunny-free",
4
+ "name": "Space Bunny Free",
5
5
  "api": "openai-completions",
6
6
  "baseUrl": "https://opencode.ai/zen/go/v1",
7
7
  "reasoning": true,
8
- "input": [
9
- "text"
10
- ],
11
- "cost": {
12
- "input": 2.5,
13
- "output": 7.5,
14
- "cacheRead": 0.5,
15
- "cacheWrite": 3.125
8
+ "thinkingLevelMap": {
9
+ "off": null,
10
+ "minimal": null,
11
+ "low": "low",
12
+ "medium": "medium",
13
+ "high": "high",
14
+ "xhigh": "xhigh",
15
+ "max": "max"
16
16
  },
17
- "contextWindow": 1000000,
18
- "maxTokens": 65536,
19
- "deprecatedAt": "2026-09-29T00:00:25.466Z"
20
- },
21
- "kimi-k2.6": {
22
- "id": "kimi-k2.6",
23
- "name": "Kimi K2.6",
24
- "api": "openai-completions",
25
- "baseUrl": "https://opencode.ai/zen/go/v1",
26
- "reasoning": true,
27
17
  "input": [
28
18
  "text",
29
19
  "image"
30
20
  ],
31
21
  "cost": {
32
- "input": 0.95,
33
- "output": 4,
34
- "cacheRead": 0.16,
22
+ "input": 0,
23
+ "output": 0,
24
+ "cacheRead": 0,
35
25
  "cacheWrite": 0
36
26
  },
37
- "contextWindow": 262144,
38
- "maxTokens": 65536,
39
- "deprecatedAt": "2026-09-29T00:00:25.466Z"
27
+ "contextWindow": 1048576,
28
+ "maxTokens": 524288,
29
+ "deprecatedAt": "2026-10-07T00:00:29.926Z"
40
30
  },
41
- "glm-5.1": {
42
- "id": "glm-5.1",
43
- "name": "GLM-5.1",
31
+ "deepseek-v4-flash-vision-exp": {
32
+ "id": "deepseek-v4-flash-vision-exp",
33
+ "name": "DeepSeek V4 Flash Vision Exp",
44
34
  "api": "openai-completions",
45
35
  "baseUrl": "https://opencode.ai/zen/go/v1",
46
36
  "reasoning": true,
47
- "input": [
48
- "text"
49
- ],
50
- "cost": {
51
- "input": 1.4,
52
- "output": 4.4,
53
- "cacheRead": 0.26,
54
- "cacheWrite": 0
37
+ "thinkingLevelMap": {
38
+ "off": null,
39
+ "minimal": null,
40
+ "low": "low",
41
+ "medium": null,
42
+ "high": "high",
43
+ "xhigh": null,
44
+ "max": "max"
55
45
  },
56
- "contextWindow": 202752,
57
- "maxTokens": 32768,
58
- "deprecatedAt": "2026-09-29T00:00:25.466Z"
59
- },
60
- "qwen3.6-plus": {
61
- "id": "qwen3.6-plus",
62
- "name": "Qwen3.6 Plus",
63
- "api": "openai-completions",
64
- "baseUrl": "https://opencode.ai/zen/go/v1",
65
- "reasoning": true,
66
46
  "input": [
67
47
  "text",
68
48
  "image"
69
49
  ],
70
50
  "cost": {
71
- "input": 0.5,
72
- "output": 3,
73
- "cacheRead": 0.05,
74
- "cacheWrite": 0.625
51
+ "input": 0.15,
52
+ "output": 0.6,
53
+ "cacheRead": 0.003,
54
+ "cacheWrite": 0
75
55
  },
76
56
  "contextWindow": 1000000,
77
- "maxTokens": 65536,
78
- "deprecatedAt": "2026-09-29T00:00:25.466Z"
57
+ "maxTokens": 384000,
58
+ "deprecatedAt": "2026-10-15T04:29:21.599Z"
79
59
  },
80
- "space-bunny-free": {
81
- "id": "space-bunny-free",
82
- "name": "Space Bunny Free",
60
+ "deepseek-v4-flash": {
61
+ "id": "deepseek-v4-flash",
62
+ "name": "DeepSeek V4 Flash",
83
63
  "api": "openai-completions",
84
64
  "baseUrl": "https://opencode.ai/zen/go/v1",
85
65
  "reasoning": true,
@@ -87,23 +67,22 @@
87
67
  "off": null,
88
68
  "minimal": null,
89
69
  "low": "low",
90
- "medium": "medium",
70
+ "medium": null,
91
71
  "high": "high",
92
- "xhigh": "xhigh",
72
+ "xhigh": null,
93
73
  "max": "max"
94
74
  },
95
75
  "input": [
96
- "text",
97
- "image"
76
+ "text"
98
77
  ],
99
78
  "cost": {
100
- "input": 0,
101
- "output": 0,
102
- "cacheRead": 0,
79
+ "input": 0.15,
80
+ "output": 0.6,
81
+ "cacheRead": 0.003,
103
82
  "cacheWrite": 0
104
83
  },
105
- "contextWindow": 1048576,
106
- "maxTokens": 524288,
107
- "deprecatedAt": "2026-10-07T00:00:29.926Z"
84
+ "contextWindow": 1000000,
85
+ "maxTokens": 384000,
86
+ "deprecatedAt": "2026-10-15T04:29:21.599Z"
108
87
  }
109
88
  }
package/index.ts CHANGED
@@ -8,6 +8,9 @@
8
8
  * Model resolution strategy: Stale-While-Revalidate
9
9
  * 1. Serve stale immediately: disk cache → embedded models.json (zero-latency)
10
10
  * 2. Revalidate in background: live API /models → merge with embedded → cache → hot-swap
11
+ * Quiet startup sync (sync-policy.ts): only with an API key, only when the
12
+ * disk cache is older than the TTL (1h, PI_PROVIDER_SYNC_TTL_MS) or the key
13
+ * changed, and only one pi process at a time (lock file next to the cache).
11
14
  * 3. patch.json + custom-models.json applied on top of whichever source won
12
15
  *
13
16
  * Merge order: [live|cache|embedded] → apply patch.json → merge custom-models.json
@@ -46,6 +49,7 @@ import patchData from "./patch.json" with { type: "json" };
46
49
  import deprecatedData from "./deprecated-models.json" with { type: "json" };
47
50
  import fs from "fs";
48
51
  import path from "path";
52
+ import { acquireModelSync, cacheChangedSinceLoad, markCacheLoaded, writeFileAtomic } from "./sync-policy.ts";
49
53
 
50
54
  // ─── Types ────────────────────────────────────────────────────────────────────
51
55
 
@@ -242,7 +246,8 @@ function loadCachedModels(): JsonModel[] | null {
242
246
  function cacheModels(models: JsonModel[]): void {
243
247
  try {
244
248
  fs.mkdirSync(CACHE_DIR, { recursive: true });
245
- fs.writeFileSync(CACHE_PATH, JSON.stringify(models, null, 2) + "\n");
249
+ // Atomic (tmp + rename): other pi processes may be reading the cache right now.
250
+ writeFileAtomic(CACHE_PATH, JSON.stringify(models, null, 2) + "\n");
246
251
  } catch {
247
252
  // Cache write failure is non-fatal
248
253
  }
@@ -325,6 +330,7 @@ function withDeprecated(models: JsonModel[]): JsonModel[] {
325
330
  }
326
331
 
327
332
  function loadStaleModels(embeddedModels: JsonModel[]): JsonModel[] {
333
+ markCacheLoaded(CACHE_PATH); // stat before read: lets session_start spot newer caches
328
334
  const cached = loadCachedModels();
329
335
  if (!cached || cached.length === 0) return embeddedModels;
330
336
 
@@ -338,13 +344,28 @@ function loadStaleModels(embeddedModels: JsonModel[]): JsonModel[] {
338
344
  return cached;
339
345
  }
340
346
 
341
- async function revalidateModels(apiKey: string | undefined, embeddedModels: JsonModel[], signal?: AbortSignal): Promise<JsonModel[] | null> {
342
- if (!apiKey) return null;
343
- const liveModels = await fetchLiveModels(apiKey, signal);
344
- if (!liveModels || liveModels.length === 0) return null;
345
- const merged = mergeWithEmbedded(liveModels, embeddedModels);
346
- cacheModels(merged);
347
- return merged;
347
+ /**
348
+ * Background revalidation, gated by the quiet startup sync policy
349
+ * (sync-policy.ts): no key → no fetch; fresh cache (TTL) → no fetch; another
350
+ * process already fetching → no fetch. When skipped, a cache that another
351
+ * process refreshed since we loaded it is adopted from disk instead.
352
+ * `force` bypasses the TTL (e.g. after /login); it is still single-flight.
353
+ * opencode-go has no login hook (API key only): a key added or changed via
354
+ * auth.json/env is picked up by the key-fingerprint check on the next session_start.
355
+ */
356
+ async function revalidateModels(apiKey: string | undefined, embeddedModels: JsonModel[], signal?: AbortSignal, force = false): Promise<JsonModel[] | null> {
357
+ const lease = acquireModelSync({ cachePath: CACHE_PATH, apiKey, force });
358
+ if (!lease) return cacheChangedSinceLoad(CACHE_PATH) ? loadStaleModels(embeddedModels) : null;
359
+ let merged: JsonModel[] | null = null;
360
+ try {
361
+ const liveModels = apiKey ? await fetchLiveModels(apiKey, signal) : null;
362
+ if (!liveModels || liveModels.length === 0) return null;
363
+ merged = mergeWithEmbedded(liveModels, embeddedModels);
364
+ cacheModels(merged);
365
+ return merged;
366
+ } finally {
367
+ lease.release(merged ? "fetched" : signal?.aborted ? "aborted" : "failed");
368
+ }
348
369
  }
349
370
 
350
371
  // ─── API Key Resolution (via ModelRegistry) ────────────────────────────────────
@@ -566,14 +587,19 @@ export default function (pi: ExtensionAPI) {
566
587
  applyOpenCodeSessionHeaders(event.headers, ctx.sessionManager.getSessionId());
567
588
  });
568
589
 
590
+ // Fire-and-forget: never await network here — startup must not block on the
591
+ // provider API. Nothing is awaited and every rejection is swallowed.
569
592
  pi.on("session_start", async (_event, ctx) => {
570
593
  usageContext = ctx;
594
+ // Usage polling needs somewhere to render: print/JSON mode and fan-out child
595
+ // agents (no UI) never poll. With a UI, start() dedupes across processes.
571
596
  usageController.start(ctx);
572
597
  revalidateAbort?.abort();
573
598
  revalidateAbort = new AbortController();
574
599
  const signal = revalidateAbort.signal;
575
- resolveApiKey(ctx.modelRegistry).then(() => {
576
- revalidateModels(cachedApiKey, embeddedModels, signal).then((freshBase) => {
600
+ void resolveApiKey(ctx.modelRegistry)
601
+ .then(() => revalidateModels(cachedApiKey, embeddedModels, signal))
602
+ .then((freshBase) => {
577
603
  if (freshBase && !signal.aborted) {
578
604
  pi.registerProvider("opencode-go", {
579
605
  name: "OpenCode Go",
@@ -595,8 +621,8 @@ export default function (pi: ExtensionAPI) {
595
621
  })),
596
622
  });
597
623
  }
598
- });
599
- });
624
+ })
625
+ .catch(() => { /* keep serving the stale catalog */ });
600
626
  });
601
627
 
602
628
  pi.on("turn_end", (_event, ctx) => {
package/models.json CHANGED
@@ -84,6 +84,34 @@
84
84
  "contextWindow": 1000000,
85
85
  "maxTokens": 131072
86
86
  },
87
+ {
88
+ "id": "gemini-4-argon-contributor",
89
+ "name": "Gemini 4 Argon Contributor",
90
+ "api": "openai-completions",
91
+ "baseUrl": "https://opencode.ai/zen/go/v1",
92
+ "reasoning": true,
93
+ "thinkingLevelMap": {
94
+ "off": null,
95
+ "minimal": null,
96
+ "low": "low",
97
+ "medium": "medium",
98
+ "high": "high",
99
+ "xhigh": null,
100
+ "max": null
101
+ },
102
+ "input": [
103
+ "text",
104
+ "image"
105
+ ],
106
+ "cost": {
107
+ "input": 4,
108
+ "output": 20,
109
+ "cacheRead": 0.2,
110
+ "cacheWrite": 0
111
+ },
112
+ "contextWindow": 1048576,
113
+ "maxTokens": 65536
114
+ },
87
115
  {
88
116
  "id": "glm-5.3-flash",
89
117
  "name": "GLM-5.3-Flash",
@@ -197,49 +225,48 @@
197
225
  "maxTokens": 384000
198
226
  },
199
227
  {
200
- "id": "deepseek-v4-flash-vision-exp",
201
- "name": "DeepSeek V4 Flash Vision Exp",
228
+ "id": "longcat-2.0",
229
+ "name": "LongCat-2.0",
202
230
  "api": "openai-completions",
203
231
  "baseUrl": "https://opencode.ai/zen/go/v1",
204
232
  "reasoning": true,
205
- "thinkingLevelMap": {
206
- "off": null,
207
- "minimal": null,
208
- "low": "low",
209
- "medium": null,
210
- "high": "high",
211
- "xhigh": null,
212
- "max": "max"
213
- },
214
233
  "input": [
215
- "text",
216
- "image"
234
+ "text"
217
235
  ],
218
236
  "cost": {
219
- "input": 0.15,
220
- "output": 0.6,
221
- "cacheRead": 0.003,
237
+ "input": 0.3,
238
+ "output": 1.2,
239
+ "cacheRead": 0.006,
222
240
  "cacheWrite": 0
223
241
  },
224
242
  "contextWindow": 1000000,
225
- "maxTokens": 384000
243
+ "maxTokens": 131072
226
244
  },
227
245
  {
228
- "id": "longcat-2.0",
229
- "name": "LongCat-2.0",
246
+ "id": "cat-jam-free",
247
+ "name": "Cat Jam Free",
230
248
  "api": "openai-completions",
231
249
  "baseUrl": "https://opencode.ai/zen/go/v1",
232
250
  "reasoning": true,
251
+ "thinkingLevelMap": {
252
+ "off": null,
253
+ "minimal": null,
254
+ "low": "low",
255
+ "medium": "medium",
256
+ "high": "high",
257
+ "xhigh": "xhigh",
258
+ "max": "max"
259
+ },
233
260
  "input": [
234
261
  "text"
235
262
  ],
236
263
  "cost": {
237
- "input": 0.3,
238
- "output": 1.2,
239
- "cacheRead": 0.006,
264
+ "input": 0,
265
+ "output": 0,
266
+ "cacheRead": 0,
240
267
  "cacheWrite": 0
241
268
  },
242
- "contextWindow": 1000000,
269
+ "contextWindow": 262144,
243
270
  "maxTokens": 131072
244
271
  },
245
272
  {
@@ -740,32 +767,5 @@
740
767
  },
741
768
  "contextWindow": 1000000,
742
769
  "maxTokens": 65536
743
- },
744
- {
745
- "id": "deepseek-v4-flash",
746
- "name": "DeepSeek V4 Flash",
747
- "api": "openai-completions",
748
- "baseUrl": "https://opencode.ai/zen/go/v1",
749
- "reasoning": true,
750
- "thinkingLevelMap": {
751
- "off": null,
752
- "minimal": null,
753
- "low": "low",
754
- "medium": null,
755
- "high": "high",
756
- "xhigh": null,
757
- "max": "max"
758
- },
759
- "input": [
760
- "text"
761
- ],
762
- "cost": {
763
- "input": 0.15,
764
- "output": 0.6,
765
- "cacheRead": 0.003,
766
- "cacheWrite": 0
767
- },
768
- "contextWindow": 1000000,
769
- "maxTokens": 384000
770
770
  }
771
771
  ]
package/package.json CHANGED
@@ -1,9 +1,18 @@
1
1
  {
2
2
  "name": "pi-opencode-go-provider",
3
- "version": "1.1.21",
3
+ "version": "1.1.26",
4
4
  "description": "Opencode Go provider extension for pi - Fast, efficient GLM, Kimi, and MiniMax models through the opencode.ai API",
5
5
  "type": "module",
6
6
  "main": "index.ts",
7
+ "scripts": {
8
+ "clean": "echo 'nothing to clean'",
9
+ "build": "echo 'nothing to build'",
10
+ "check": "npm run typecheck && npm run test && node scripts/test-pi-compat.mjs",
11
+ "update-models": "node scripts/update-models.js",
12
+ "test": "node --test 'tests/!(sync-policy|quiet-startup-sync|usage-sync).test.ts' && vitest run",
13
+ "typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.vitest.json",
14
+ "test:pi": "node scripts/test-pi-compat.mjs"
15
+ },
7
16
  "keywords": [
8
17
  "pi",
9
18
  "extension",
@@ -27,20 +36,16 @@
27
36
  "brace-expansion": "5.0.12"
28
37
  },
29
38
  "devDependencies": {
30
- "@earendil-works/pi-coding-agent": "1.1.0",
39
+ "@earendil-works/pi-coding-agent": "1.2.0",
31
40
  "@types/node": "~22.19.0",
32
- "typescript": "^6.0.3"
41
+ "typescript": "^6.0.3",
42
+ "vitest": "4.1.7"
33
43
  },
34
44
  "peerDependencies": {
35
45
  "@earendil-works/pi-coding-agent": "*"
36
46
  },
37
- "scripts": {
38
- "clean": "echo 'nothing to clean'",
39
- "build": "echo 'nothing to build'",
40
- "check": "npm run typecheck && npm run test && node scripts/test-pi-compat.mjs",
41
- "update-models": "node scripts/update-models.js",
42
- "test": "node --test",
43
- "typecheck": "tsc --noEmit",
44
- "test:pi": "node scripts/test-pi-compat.mjs"
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "git+https://github.com/monotykamary/pi-opencode-go-provider.git"
45
50
  }
46
- }
51
+ }
@@ -1,4 +1,4 @@
1
- // Offline Pi 1.1.0 manifest, lifecycle, catalog and real transport regression.
1
+ // Offline Pi 1.2.0 manifest, lifecycle, catalog and real transport regression.
2
2
  import assert from 'node:assert/strict';
3
3
  import { mkdtemp, readFile, rm } from 'node:fs/promises';
4
4
  import { tmpdir } from 'node:os';
@@ -18,13 +18,13 @@ try {
18
18
  const hostEntry = process.env.PI1_HOST_ENTRY === 'bundle' ? 'dist/bundle/index.js' : 'dist/index.js';
19
19
  const sdk = await import(host ? pathToFileURL(join(host, hostEntry)).href : '@earendil-works/pi-coding-agent');
20
20
  const { createAgentSession, DefaultResourceLoader, ModelRuntime, SessionManager, SettingsManager, VERSION } = sdk;
21
- assert.equal(VERSION, '1.1.0', 'executing host version');
22
- assert.equal((await import('@earendil-works/pi-coding-agent')).VERSION, '1.1.0', 'development host version');
21
+ assert.equal(VERSION, '1.2.0', 'executing host version');
22
+ assert.equal((await import('@earendil-works/pi-coding-agent')).VERSION, '1.2.0', 'development host version');
23
23
  const manifest = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
24
24
  for (const name of ['@earendil-works/pi-ai', '@earendil-works/pi-agent-core', '@earendil-works/pi-coding-agent', '@earendil-works/pi-tui', 'typebox']) {
25
25
  assert.equal(manifest.dependencies?.[name], undefined, `${name}: do not bundle host packages`);
26
26
  if (manifest.peerDependencies?.[name] !== undefined) assert.equal(manifest.peerDependencies[name], '*');
27
- if (name !== 'typebox' && manifest.devDependencies?.[name]) assert.equal(manifest.devDependencies[name], '1.1.0');
27
+ if (name !== 'typebox' && manifest.devDependencies?.[name]) assert.equal(manifest.devDependencies[name], '1.2.0');
28
28
  }
29
29
  const settingsManager = SettingsManager.inMemory({ packages: [root], compaction: { enabled: false }, retry: { enabled: false } });
30
30
  const resourceLoader = new DefaultResourceLoader({ cwd: home, agentDir: home, settingsManager,